ApiBundle/Transformer/SiteTransformer.php
Function transform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function transform($site, array $params = array())
{
if (!$site instanceof SiteInterface) {
throw new TransformerParameterTypeException();
}
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid unused parameters such as '$params'. Open
Open
public function transform($site, array $params = array())
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Call to method __construct
from undeclared class \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open
Open
throw new TransformerParameterTypeException();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
$facade->siteId = $site->getSiteId();
- Create a ticketCreate a ticket
- Exclude checks
@throws type of transform
has undeclared type \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open
Open
public function transform($site, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguages
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
foreach ($site->getLanguages() as $language) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
$facade->id = $site->getId();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\SiteTransformer::hasGroup
Open
Open
if ($this->hasGroup(CMSGroupContext::SITE_MAIN_ALIAS)) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getMainAlias
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
$facade->mainAlias = $this->getContext()->transform('site_alias', $site->getMainAlias());
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\SiteTransformer::hasGroup
Open
Open
if ($this->hasGroup(CMSGroupContext::BLOCKS)) {
- Create a ticketCreate a ticket
- Exclude checks
Return type of transform()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
Open
public function transform($site, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\SiteTransformer::newFacade
Open
Open
$facade = $this->newFacade();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\SiteTransformer::getContext
Open
Open
$facade->mainAlias = $this->getContext()->transform('site_alias', $site->getMainAlias());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getBlocks
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
foreach ($site->getBlocks() as $value) {
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractTransformer
Open
Open
class SiteTransformer extends AbstractTransformer
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
if (!$site instanceof SiteInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\SiteTransformer::hasGroup
Open
Open
return $this->hasGroup(CMSGroupContext::SITE);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $site
has undeclared type \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
public function transform($site, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Call to method getName
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
Open
$facade->name = $site->getName();
- Create a ticketCreate a ticket
- Exclude checks