Code Duplication    Length = 28-31 lines in 2 locations

code/Commands/List/ListControllerCommand.php 1 location

@@ 4-31 (lines=28) @@
1
<?php
2
3
4
class ListControllerCommand extends AbstractListCommand
5
{
6
    /**
7
     * @var string
8
     */
9
    protected $signature = 'list:controller';
10
11
    /**
12
     * @var string
13
     */
14
    protected $description = 'List all subclasses of Controller';
15
16
    protected function getClassName()
17
    {
18
        return 'Controller';
19
    }
20
21
    /**
22
     * @param $className
23
     *
24
     * @return array
25
     */
26
    protected function getParentClasses($className)
27
    {
28
        // removes $className and Controller => RequestHandler => ViewableData => Object
29
        $parentClasses = array_slice(parent::getParentClasses($className), 4, -1);
30
31
        return array_reverse($parentClasses);
32
    }
33
}
34

code/Commands/List/ListDataObjectCommand.php 1 location

@@ 4-34 (lines=31) @@
1
<?php
2
3
4
class ListDataObjectCommand extends AbstractListCommand
5
{
6
    /**
7
     * @var string
8
     */
9
    protected $signature = 'list:dataobject';
10
11
    /**
12
     * @var string
13
     */
14
    protected $description = 'List all subclasses of DataObject';
15
16
    /**
17
     * @return string
18
     */
19
    protected function getClassName()
20
    {
21
        return 'DataObject';
22
    }
23
24
    /**
25
     * @param string $className
26
     *
27
     * @return array
28
     */
29
    protected function getParentClasses($className)
30
    {
31
        // removes $className and DataObject => ViewableData => Object
32
        $parentClasses = array_slice(parent::getParentClasses($className), 3, -1);
33
34
        return array_reverse($parentClasses);
35
    }
36
}
37