Showing 22 of 29 total issues
Media
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class Media implements MediaInterface
{
use BlameableDocument;
use TimestampableDocument;
use Keywordable;
- Create a ticketCreate a ticket
Function process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function process(ContainerBuilder $container)
{
$resourcePath = '.';
foreach ($container->getResources() as $resource) {
if (!$resource instanceof FileResource) {
- 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
Method getConfigTreeBuilder
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('open_orchestra_media_model');
- Create a ticketCreate a ticket
Method setUp
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUp()
{
$this->media = Phake::mock('OpenOrchestra\Media\Model\MediaInterface');
$this->defaultStrategy = Phake::mock('OpenOrchestra\Media\DisplayMedia\DisplayMediaInterface');
- Create a ticketCreate a ticket
Method provideFolderForRecord
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideFolderForRecord()
{
$parentPath = '/parentPath';
$folderId = 'folderId';
$oldFolderPath = $parentPath . '/oldId';
- Create a ticketCreate a ticket
Method testBuildView
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBuildView()
{
$folder0 = Phake::mock($this->folderClass);
$folder0Id = 'folder0Id';
$folder0Name = 'folder0Name';
- Create a ticketCreate a ticket
Method findFolderTree
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findFolderTree($siteId)
{
$qa = $this->createAggregationQuery();
$qa->match(array('siteId' => $siteId));
$folders = $qa->getQuery()->aggregate()->toArray();
- Create a ticketCreate a ticket
Method buildTreeFolders
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildTreeFolders(array $folders, $language, $contributionRigth, $depth = 0)
{
$lastFolder = end($folders);
$result = array();
foreach ($folders as $folder) {
- Create a ticketCreate a ticket
Method testRenderMedia
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testRenderMedia($image, $url, $alt, $id = '', $class = '', $style = '', $width = 0, $height = 0)
- Create a ticketCreate a ticket
Function buildTreeFolders
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function buildTreeFolders(array $folders, $language, $contributionRigth, $depth = 0)
{
$lastFolder = end($folders);
$result = array();
foreach ($folders as $folder) {
- 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
Method testRenderMedia
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testRenderMedia($image, $url, $alt, $id = '', $class = '', $style = '')
- Create a ticketCreate a ticket
Method testRenderMedia
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testRenderMedia($image, $url, $alt, $id = '', $class = '', $style = '')
- Create a ticketCreate a ticket
Function setPath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setPath(LifecycleEventArgs $eventArgs)
{
$document = $eventArgs->getDocument();
if ($document instanceof FolderInterface) {
$folderRepository = $this->container->get('open_orchestra_media.repository.media_folder');
- 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
Method testRenderMedia
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testRenderMedia($image, $url, $alt, $id = '', $class = '', $style = '')
- Create a ticketCreate a ticket
Method testRenderMedia
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testRenderMedia($image, $url, $alt, $id = '', $class = '', $style = '')
- Create a ticketCreate a ticket
Method testDisplayMediaForWysiwyg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testDisplayMediaForWysiwyg($image, $url, $alt, $id = null, $format = null)
- Create a ticketCreate a ticket
Method testRecord
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$method,
MediaFolderInterface $folder,
ArrayCollection $children,
$expectedFolderPath,
$expectedChildFolderPath
- Create a ticketCreate a ticket
Method testDisplayMediaForWysiwyg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testDisplayMediaForWysiwyg($image, $url, $alt, $id = null, $format = null)
- Create a ticketCreate a ticket
Method testDisplayMediaForWysiwyg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testDisplayMediaForWysiwyg($image, $url, $alt, $id = null, $format = null)
- Create a ticketCreate a ticket