<?php declare(strict_types=1);
namespace Neomerx\JsonApi\Parser\RelationshipData;
/**
* Copyright 2015-2019 info@neomerx.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use Neomerx\JsonApi\Contracts\Parser\IdentifierInterface;
use Neomerx\JsonApi\Contracts\Parser\RelationshipDataInterface;
use Neomerx\JsonApi\Contracts\Parser\ResourceInterface;
use Neomerx\JsonApi\Exceptions\LogicException;
use function Neomerx\JsonApi\I18n\format as _;
/**
* @package Neomerx\JsonApi
*/
class RelationshipDataIsNull implements RelationshipDataInterface
{
/** @var string */
public const MSG_INVALID_OPERATION = 'Invalid operation.';
/**
* @inheritdoc
*/
public function isCollection(): bool
{
return false;
}
/**
* @inheritdoc
*/
public function isNull(): bool
{
return true;
}
/**
* @inheritdoc
*/
public function isResource(): bool
{
return false;
}
/**
* @inheritdoc
*/
public function isIdentifier(): bool
{
return false;
}
/**
* @inheritdoc
*/
public function getIdentifier(): IdentifierInterface
{
throw new LogicException(_(static::MSG_INVALID_OPERATION));
}
/**
* @inheritdoc
*/
public function getIdentifiers(): iterable
{
throw new LogicException(_(static::MSG_INVALID_OPERATION));
}
/**
* @inheritdoc
*/
public function getResource(): ResourceInterface
{
throw new LogicException(_(static::MSG_INVALID_OPERATION));
}
/**
* @inheritdoc
*/
public function getResources(): iterable
{
throw new LogicException(_(static::MSG_INVALID_OPERATION));
}
}