Method provideEntityAndNodes
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideEntityAndNodes()
{
$blockWithoutNodeId = 'blockWithoutNodeId';
$blockWithoutNode = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
Phake::when($blockWithoutNode)->getAttributes()->thenReturn(array());
- Create a ticketCreate a ticket
Avoid using static access to class '\Phake' in method 'setUp'. Open
$linkTag = Phake::mock('OpenOrchestra\BBcodeBundle\ElementNode\BBcodeElementNodeInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'setUp'. Open
$this->bbcodeParser = Phake::mock('OpenOrchestra\BBcodeBundle\Parser\BBcodeParserInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'provideEntityAndNodes'. Open
$blockWithNode1 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'setUp'. Open
$this->nodeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'provideEntityAndNodes'. Open
$blockWithNode3 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'setUp'. Open
$this->currentSiteManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'setUp'. Open
Phake::when($this->bbcodeParser)->getElementByTagName(Phake::anyParameters())->thenReturn(
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'setUp'. Open
Phake::when($this->bbcodeParser)->parse(Phake::anyParameters())->thenReturn($this->bbcodeParser);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'provideEntityAndNodes'. Open
$blockWithoutNode = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'testAddReferencesToEntity'. Open
Phake::verify($this->nodeRepository, Phake::times(count($nodes)))->updateUseReference(Phake::anyParameters());
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'provideEntityAndNodes'. Open
$blockWithNodeTinymce = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'provideEntityAndNodes'. Open
$blockWithNode2 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Phake' in method 'testAddReferencesToEntity'. Open
Phake::verify($this->nodeRepository, Phake::times(count($nodes)))->updateUseReference(Phake::anyParameters());
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid unused parameters such as '$entityId'. Open
public function testAddReferencesToEntity($entity, $entityId, array $nodes)
- 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 when
from undeclared class \Phake
Open
Phake::when($this->bbcodeParser)->parse(Phake::anyParameters())->thenReturn($this->bbcodeParser);
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNode1)->getId()->thenReturn($blockWithNode1Id);
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNode3)->getAttributes()
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open
parent::checkRemoveReferencesToEntity($entity, $entityId, $nodes, BlockInterface::ENTITY_TYPE, $this->nodeRepository);
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$blockWithoutNode = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$linkTag = Phake::mock('OpenOrchestra\BBcodeBundle\ElementNode\BBcodeElementNodeInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$blockWithNodeTinymce = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method anyParameters
from undeclared class \Phake
Open
Phake::verify($this->nodeRepository, Phake::times(count($nodes)))->updateUseReference(Phake::anyParameters());
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithoutNode)->getAttributes()->thenReturn(array());
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNode1)->getAttributes()
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$blockWithNode2 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNode2)->getAttributes()
- Create a ticketCreate a ticket
- Exclude checks
Call to method anyParameters
from undeclared class \Phake
Open
Phake::when($this->bbcodeParser)->getElementByTagName(Phake::anyParameters())->thenReturn(
- Create a ticketCreate a ticket
- Exclude checks
Call to method verify
from undeclared class \Phake
Open
Phake::verify($this->nodeRepository, Phake::times(count($nodes)))->updateUseReference(Phake::anyParameters());
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$blockWithNode1 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNode3)->getId()->thenReturn($blockWithNode3Id);
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNode2)->getId()->thenReturn($blockWithNode2Id);
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNodeTinymce)->getId()->thenReturn($blockWithNodeTinymceId);
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$this->currentSiteManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($this->bbcodeParser)->getElementByTagName(Phake::anyParameters())->thenReturn(
- Create a ticketCreate a ticket
- Exclude checks
Call to method times
from undeclared class \Phake
Open
Phake::verify($this->nodeRepository, Phake::times(count($nodes)))->updateUseReference(Phake::anyParameters());
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$this->nodeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$this->bbcodeParser = Phake::mock('OpenOrchestra\BBcodeBundle\Parser\BBcodeParserInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method anyParameters
from undeclared class \Phake
Open
Phake::when($this->bbcodeParser)->parse(Phake::anyParameters())->thenReturn($this->bbcodeParser);
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($linkTag)->getAttribute()->thenReturn(array('link'=> '{"label":"link","site": {"siteId":"2","nodeId":"nodeId4"}}'));
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithoutNode)->getId()->thenReturn($blockWithoutNodeId);
- Create a ticketCreate a ticket
- Exclude checks
Call to method mock
from undeclared class \Phake
Open
$blockWithNode3 = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Create a ticketCreate a ticket
- Exclude checks
Call to method when
from undeclared class \Phake
Open
Phake::when($blockWithNodeTinymce)->getAttributes()->thenReturn(array($bbCodeWithLink));
- Create a ticketCreate a ticket
- Exclude checks
Avoid excessively long variable names like $blockWithNodeTinymceId. Keep variable name length under 20. Open
$blockWithNodeTinymceId = 'blockIdTinymce';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Expected 1 space after comma in function call; 2 found Open
$this->strategy = new NodeInBlockReferenceStrategy($this->currentSiteManager, $this->bbcodeParser, $this->nodeRepository);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
parent::checkRemoveReferencesToEntity($entity, $entityId, $nodes, BlockInterface::ENTITY_TYPE, $this->nodeRepository);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$this->strategy = new NodeInBlockReferenceStrategy($this->currentSiteManager, $this->bbcodeParser, $this->nodeRepository);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$bbCodeWithLink = 'Some [b]String[b] with [link={"label":"link","site": {"siteId":"2","nodeId":"nodeId4"}}]link[/link]';
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
Phake::when($linkTag)->getAttribute()->thenReturn(array('link'=> '{"label":"link","site": {"siteId":"2","nodeId":"nodeId4"}}'));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
'Block with node (tinymce)' => array($blockWithNodeTinymce, $blockWithNodeTinymceId, array($nodeId4 => $node4)),
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces before closing bracket; newline found Open
->thenReturn(array(
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces before closing bracket; newline found Open
->thenReturn(array(
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces before closing bracket; newline found Open
->thenReturn(array(
- Create a ticketCreate a ticket
- Exclude checks