Use native type-checking

This commit is contained in:
Andrey
2015-07-20 11:19:39 -03:00
parent e36ab876d5
commit 5bc2b9fabd
+6 -10
View File
@@ -117,15 +117,12 @@ class Database
*/
public function writePoints(array $points, $precision = self::PRECISION_NANOSECONDS)
{
$payload = array();
foreach ($points as $point) {
if (! $point instanceof Point) {
throw new \InvalidArgumentException('An array of Point[] should be passed');
}
$payload[] = (string) $point;
}
$payload = array_map(
function (Point $point) {
return (string) $point;
},
$points
);
return $this->client->write($this->name, implode(PHP_EOL, $payload), $precision);
}
@@ -190,7 +187,6 @@ class Database
*/
protected function getRetentionPolicyQuery($method, RetentionPolicy $retentionPolicy)
{
if (!in_array($method, array('CREATE', 'ALTER'))) {
throw new \InvalidArgumentException(sprintf('%s is not a valid method'));
}