Niktux /
solidifier
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Solidifier; |
||
| 4 | |||
| 5 | use Symfony\Component\EventDispatcher\EventDispatcher; |
||
| 6 | use Gaufrette\Filesystem; |
||
| 7 | use Solidifier\Reporters\HTMLReporter; |
||
| 8 | use Symfony\Component\Yaml\Yaml; |
||
| 9 | use Gaufrette\Adapter\Local; |
||
| 10 | use Solidifier\Visitors\PreAnalyze\ObjectTypes; |
||
| 11 | |||
| 12 | class Application extends \Pimple |
||
| 13 | { |
||
| 14 | public function __construct() |
||
| 15 | { |
||
| 16 | parent::__construct(); |
||
| 17 | |||
| 18 | $this->initializeFilesystem(); |
||
|
0 ignored issues
–
show
|
|||
| 19 | $this->initializeServices(); |
||
|
0 ignored issues
–
show
The call to the method
Solidifier\Application::initializeServices() seems un-needed as the method has no side-effects.
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left. Let’s take a look at an example: class User
{
private $email;
public function getEmail()
{
return $this->email;
}
public function setEmail($email)
{
$this->email = $email;
}
}
If we look at the $user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.
On the hand, if we look at the $user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
// instance variable).
Loading history...
|
|||
| 20 | $this->initializeSubscribers(); |
||
|
0 ignored issues
–
show
The call to the method
Solidifier\Application::initializeSubscribers() seems un-needed as the method has no side-effects.
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left. Let’s take a look at an example: class User
{
private $email;
public function getEmail()
{
return $this->email;
}
public function setEmail($email)
{
$this->email = $email;
}
}
If we look at the $user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.
On the hand, if we look at the $user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
// instance variable).
Loading history...
|
|||
| 21 | } |
||
| 22 | |||
| 23 | private function initializeFilesystem() |
||
| 24 | { |
||
| 25 | $this['filesystem.path'] = 'src/'; |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 26 | $this['filesystem.adapter'] = function($c) { |
||
| 27 | return new Local($c['filesystem.path']); |
||
| 28 | }; |
||
| 29 | |||
| 30 | $this['filesystem'] = function($c) { |
||
| 31 | return new Filesystem($c['filesystem.adapter']); |
||
| 32 | }; |
||
| 33 | } |
||
| 34 | |||
| 35 | private function initializeServices() |
||
| 36 | { |
||
| 37 | $this['configuration'] = function($c) { |
||
| 38 | |||
| 39 | $configuration = array(); |
||
| 40 | |||
| 41 | $filename = '.solidifier.yml'; |
||
| 42 | $fs = $c['filesystem']; |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 43 | |||
| 44 | if($fs->has($filename)) |
||
| 45 | { |
||
| 46 | $configuration = Yaml::parse($fs->read($filename)); |
||
| 47 | } |
||
| 48 | |||
| 49 | return $configuration; |
||
| 50 | }; |
||
| 51 | |||
| 52 | $this['event.dispatcher'] = function($c) { |
||
|
0 ignored issues
–
show
|
|||
| 53 | return new EventDispatcher(); |
||
| 54 | }; |
||
| 55 | |||
| 56 | $this['dispatcher'] = function($c) { |
||
| 57 | return new Dispatchers\EventDispatcher($c['event.dispatcher']); |
||
| 58 | }; |
||
| 59 | |||
| 60 | $this['analyzer'] = function($c) { |
||
| 61 | $analyzer = new Analyzers\Analyzer($c['dispatcher'], $c['filesystem']); |
||
| 62 | |||
| 63 | $handler = new ConfigurationHandler($c['configuration'], $c['objectTypes.list']); |
||
| 64 | $handler->configure($analyzer); |
||
| 65 | |||
| 66 | return $analyzer; |
||
| 67 | }; |
||
| 68 | |||
| 69 | $this['twig.path'] = 'views'; |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 70 | $this['twig.cache'] = false; |
||
| 71 | $this['twig.debug'] = true; |
||
| 72 | |||
| 73 | $this['twig'] = function($c) { |
||
| 74 | $loader = new \Twig_Loader_Filesystem($c['twig.path']); |
||
| 75 | $twig = new \Twig_Environment($loader, array( |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 76 | 'cache' => $c['twig.cache'], |
||
| 77 | 'debug' => $c['twig.debug'], |
||
| 78 | )); |
||
| 79 | |||
| 80 | if($c['twig.debug'] === true) |
||
| 81 | { |
||
| 82 | $twig->addExtension(new \Twig_Extension_Debug()); |
||
| 83 | } |
||
| 84 | |||
| 85 | return $twig; |
||
| 86 | }; |
||
| 87 | |||
| 88 | $this['objectTypes.list'] = function($c) { |
||
|
0 ignored issues
–
show
|
|||
| 89 | return new ObjectTypes(); |
||
| 90 | }; |
||
| 91 | } |
||
| 92 | |||
| 93 | private function initializeSubscribers() |
||
| 94 | { |
||
| 95 | $this['subscriber.console'] = function($c) { |
||
|
0 ignored issues
–
show
|
|||
| 96 | return new EventSubscribers\Console(); |
||
| 97 | }; |
||
| 98 | |||
| 99 | $this['reporter.html'] = function($c) { |
||
| 100 | return new Reporters\HTMLReporter($c['twig']); |
||
| 101 | }; |
||
| 102 | |||
| 103 | $this['subscriber.html'] = function($c) { |
||
| 104 | return new EventSubscribers\HTML($c['reporter.html']); |
||
| 105 | }; |
||
| 106 | } |
||
| 107 | } |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call: