Neomerx\JsonApi\Schema\SchemaProvider::__construct PHP Method

__construct() public method

public __construct ( Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface $factory )
$factory Neomerx\JsonApi\Contracts\Schema\SchemaFactoryInterface
    public function __construct(SchemaFactoryInterface $factory)
    {
        $isOk = is_string($this->getResourceType()) === true && empty($this->getResourceType()) === false;
        if ($isOk === false) {
            throw new InvalidArgumentException(T::t('Resource type is not set for Schema \'%s\'.', [static::class]));
        }
        if ($this->selfSubUrl === null) {
            $this->selfSubUrl = '/' . $this->getResourceType();
        } else {
            $isOk = is_string($this->selfSubUrl) === true && empty($this->selfSubUrl) === false && $this->selfSubUrl[0] === '/' && $this->selfSubUrl[strlen($this->selfSubUrl) - 1] != '/';
            if ($isOk === false) {
                $message = T::t('\'Self\' sub-url set incorrectly for Schema \'%s\'.', [static::class]);
                throw new InvalidArgumentException($message);
            }
        }
        $this->factory = $factory;
    }

Usage Example

コード例 #1
0
ファイル: Schema.php プロジェクト: limoncello-php/json-api
 /**
  * @param FactoryInterface      $factory
  * @param JsonSchemesInterface  $jsonSchemes
  * @param ModelSchemesInterface $modelSchemes
  */
 public function __construct(FactoryInterface $factory, JsonSchemesInterface $jsonSchemes, ModelSchemesInterface $modelSchemes)
 {
     $this->resourceType = static::TYPE;
     parent::__construct($factory);
     $this->jsonSchemes = $jsonSchemes;
     $this->modelSchemes = $modelSchemes;
 }
All Usage Examples Of Neomerx\JsonApi\Schema\SchemaProvider::__construct