xezzus /
humanity
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | namespace humanity; |
||
| 3 | |||
| 4 | class Widget { |
||
| 5 | |||
| 6 | public static $js; |
||
| 7 | public static $css; |
||
| 8 | public static $title; |
||
| 9 | public static $description; |
||
| 10 | public static $keywords; |
||
| 11 | private static $config; |
||
| 12 | private static $app; |
||
| 13 | private static $view; |
||
| 14 | private static $property; |
||
| 15 | private static $path; |
||
|
0 ignored issues
–
show
|
|||
| 16 | private static $uri; |
||
| 17 | |||
| 18 | View Code Duplication | public function __construct(){ |
|
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 19 | # Config |
||
| 20 | self::$config = (new Config)->get(); |
||
| 21 | # Application |
||
| 22 | self::$app = new Application; |
||
| 23 | # View |
||
| 24 | self::$view = new View; |
||
| 25 | # Js |
||
| 26 | self::$js = new Js; |
||
| 27 | # Css |
||
| 28 | self::$css = new Css; |
||
| 29 | # Title |
||
| 30 | self::$title = new Title; |
||
| 31 | # Desctiption |
||
| 32 | self::$description = new Description; |
||
| 33 | # Keywords |
||
| 34 | self::$keywords = new Keywords; |
||
| 35 | # Uri |
||
| 36 | self::$uri = new Uri; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function __get($name){ |
||
| 40 | self::$property= $name; |
||
| 41 | return new self; |
||
| 42 | } |
||
| 43 | |||
| 44 | public function __call($_name,$value){ |
||
| 45 | if(isset($value[0]) && !empty($value[0]) && is_array($value[0])) extract($value[0]); |
||
| 46 | $file = self::$config['core']['widget'].'/'.self::$property.'/'.$_name.'.phtml'; |
||
| 47 | if(is_file($file)) require($file); |
||
| 48 | } |
||
| 49 | |||
| 50 | } |
||
| 51 | ?> |
||
|
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. Loading history...
|
|||
| 52 |
This check marks private properties in classes that are never used. Those properties can be removed.