Basho\Riak\Command\Builder::required PHP Method

required() protected method

Used to verify a property within the builder is not null and is instantiated
protected required ( $objectName )
$objectName
    protected function required($objectName)
    {
        $method = "get{$objectName}";
        $class = "Basho\\Riak\\{$objectName}";
        $value = $this->{$method}();
        if (is_null($value)) {
            throw new Builder\Exception("Expected non-empty value for {$objectName}");
        }
        if (is_object($value) && $value instanceof $class === false) {
            throw new Builder\Exception("Expected instance of {$class}, received instance of " . get_class($value));
        }
        if (is_array($value) && count($value) == 0) {
            throw new Builder\Exception("Expected non-empty array value for {$objectName}");
        }
    }