fucongcong/framework

View on GitHub
core/Group/App/App.php

Summary

Maintainability
A
55 mins
Test Coverage

Showing 23 of 23 total issues

The class App has 16 public methods. Consider refactoring App to keep number of public methods under 10.
Open

class App
{
/**
* array instances
*
Severity: Minor
Found in core/Group/App/App.php by phpmd

Function singleton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

public function singleton($name, $callable = null)
{
if (!isset($this->instances[$name]) && $callable) {
$obj = call_user_func($callable);
if (!is_object($obj)) {
Severity: Minor
Found in core/Group/App/App.php - About 55 mins to fix

Avoid using undefined variables such as '$concrete' which will lead to PHP notices.
Open

throw new Exception("Target [$concrete] is not instantiable!");
Severity: Minor
Found in core/Group/App/App.php by phpmd

The class App has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
Open

class App
{
/**
* array instances
*
Severity: Minor
Found in core/Group/App/App.php by phpmd

Missing class import via use statement (line '151', column '24').
Open

$request = new \Request($request->get, $request->post, [], $request->cookie
Severity: Minor
Found in core/Group/App/App.php by phpmd

Missing class import via use statement (line '111', column '29').
Open

$debugbar = new \Group\Debug\DebugBar();
Severity: Minor
Found in core/Group/App/App.php by phpmd

Missing class import via use statement (line '141', column '29').
Open

$debugbar = new \Group\Debug\DebugBar();
Severity: Minor
Found in core/Group/App/App.php by phpmd

The method singleton uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

} else {
$this->instances[$name] = $obj;
}
Severity: Minor
Found in core/Group/App/App.php by phpmd

The method singleton uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

} else {
if (isset($this->aops[$name])) {
$this->instances[$name] = new Bean($name, $obj);
} else {
$this->instances[$name] = $obj;
Severity: Minor
Found in core/Group/App/App.php by phpmd

Avoid unused local variables such as '$concrete'.
Open

throw new Exception("Target [$concrete] is not instantiable!");
Severity: Minor
Found in core/Group/App/App.php by phpmd

Avoid unused local variables such as '$request'.
Open

$request = $this->container->getRequest();
Severity: Minor
Found in core/Group/App/App.php by phpmd

Space found before comma in function call
Open

, $request->files, $request->server);
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Inline control structures are not allowed
Open

if ($val == $provider) unset($this->serviceProviders[$key]);
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Inline control structures are not allowed
Open

if(isset($this->instances[$name]))
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Whitespace found at end of line
Open

{
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 0
Open

if (!(self::$instance instanceof self)){
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Whitespace found at end of line
Open

{
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Whitespace found at end of line
Open

{
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Whitespace found at end of line
Open

{
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Expected 1 space after IF keyword; 0 found
Open

if(isset($this->instances[$name]))
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Whitespace found at end of line
Open

}
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Whitespace found at end of line
Open

{
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer

Whitespace found at end of line
Open

{
Severity: Minor
Found in core/Group/App/App.php by phpcodesniffer
Category
Status