Neomerx\JsonApi\Schema\Container::getSchemaByResourceType PHP Метод

getSchemaByResourceType() публичный Метод

public getSchemaByResourceType ( $resourceType )
    public function getSchemaByResourceType($resourceType)
    {
        // Schema is not found among instantiated schemas for resource type $resourceType
        $isOk = is_string($resourceType) === true && $this->hasResourceToJsonTypeMapping($resourceType) === true;
        // Schema might not be found if it hasn't been searched by type (not resource type) before.
        // We instantiate all schemas and then find one.
        if ($isOk === false) {
            foreach ($this->getProviderMappings() as $type => $schema) {
                if ($this->hasCreatedProvider($type) === false) {
                    // it will instantiate the schema
                    $this->getSchemaByType($type);
                }
            }
        }
        // search one more time
        $isOk = is_string($resourceType) === true && $this->hasResourceToJsonTypeMapping($resourceType) === true;
        if ($isOk === false) {
            throw new InvalidArgumentException(T::t('Schema is not registered for resource type \'%s\'.', [$resourceType]));
        }
        return $this->getSchemaByType($this->getJsonType($resourceType));
    }