InterfaceExample   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 6
dl 0
loc 43
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A demonstrate() 0 37 1
1
#!/bin/php
2
<?php
3
/**
4
 * @author stev leibelt <[email protected]>
5
 * @since 2014-07-12 
6
 */
7
8
require_once 'AbstractExample.php';
9
require_once __DIR__ . '/../vendor/autoload.php';
10
11
/**
12
 * Class InterfaceExample
13
 */
14
class InterfaceExample extends AbstractExample
15
{
16
    /**
17
     * @return mixed
18
     */
19
    function demonstrate()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
20
    {
21
        //----begin of factories
22
        $interfaceFactory       = $this->getInterfaceGeneratorFactory();
23
        $documentationFactory   = $this->getDocumentationGeneratorFactory();
24
        $methodFactory          = $this->getMethodGeneratorFactory();
25
        //----end of factories
26
27
        //----begin of generators
28
        $interface      = $interfaceFactory->create();
29
        $method         = $methodFactory->create();
30
        //----end of generators
31
32
        //----begin content creation
33
        $interface->setDocumentation($documentationFactory->create());
34
        $interface->setName('FooInterface');
35
        $interface->setNamespace('My\\Example');
36
        $interface->addExtends('BarInterface', true);
37
38
        $method->setDocumentation($documentationFactory->create());
39
        $method->setName('foo');
40
        $method->markAsHasNoBody();
41
        $method->markAsPublic();
42
        $method->getDocumentation()
0 ignored issues
show
Bug introduced by
The method setReturn cannot be called on $method->getDocumentation() (of type null|string|array).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
43
            ->setReturn('string');
44
        //----end content creation
45
46
        //----begin of interface generation
47
        $interface->addMethod($method);
48
        //----end of interface generation
49
50
        //----begin of output
51
        echo 'generated content' . PHP_EOL;
52
        echo '----' . PHP_EOL;
53
        echo $interface->generate() . PHP_EOL;
54
        //----end of output
55
    }
56
}
57
58
$example = new InterfaceExample();
59
$example->demonstrate();
60