Showing 82 of 90 total issues
Function getExceptionArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getExceptionArray($exception)
{
$_message = 'Uknonwn exception object, not instance of \Exception.';
$_file = 'unknown';
$_line = 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parseRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function parseRequest($request)
{
// extra data from request to composition, which changes the pathInfo of the Request-Object.
$resolver = $this->getComposition()->getResolvedPathInfo($request);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function run($app)
{
foreach ($app->getApplicationModules() as $id => $module) {
$folder = $module->basePath . DIRECTORY_SEPARATOR . 'commands';
if (file_exists($folder) && is_dir($folder)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function logValueToTable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function logValueToTable(array $logs)
{
$table = new Table();
$table->setHeaders(['Key', 'Value']);
$rows = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function init
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function init()
{
$path = Yii::getAlias($this->configFile);
if (file_exists($path)) {
$config = (include($path));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getControllers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function getControllers(Module $module)
{
$files = [];
try { // https://github.com/yiisoft/yii2/blob/master/framework/base/Module.php#L253
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionAdd
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionAdd($repo, $filename, $language = "*")
{
$repoPath = "repos/$repo";
$messageFiles = glob("$repoPath/src/**/messages/$language/$filename.php") ?: glob("$repoPath/src/messages/$language/$filename.php");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionCreate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionCreate()
{
Console::clearScreenBeforeCursor();
$moduleName = $this->prompt("Enter the name of the module you like to generate:");
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function timeToIso8601Duration
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function timeToIso8601Duration($time)
{
$units = [
"Y" => 365 * 24 * 3600,
"D" => 24 * 3600,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getAdminModules
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getAdminModules()
{
if ($this->_adminModules === null) {
$this->_adminModules = [];
foreach ($this->getModules() as $id => $obj) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getThemes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getThemes($throwException = false)
{
if ($this->_themes) {
return $this->_themes;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $this->outputSuccess("Theme files has been created successfully. Please run `".$_SERVER['PHP_SELF']." import` to import the theme into the database.");
Avoid too many return
statements within this method. Open
return $model->addError($attribute, Yii::t('luya', '{attribute} must include at least one lowercase letter.', ['attribute' => $model->getAttributeLabel($attribute)]));
Avoid too many return
statements within this method. Open
return $model->addError($attribute, Yii::t('luya', '{attribute} must include at least one uppercase letter.', ['attribute' => $model->getAttributeLabel($attribute)]));
Function removeEmptyValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function removeEmptyValues(array $haystack)
{
foreach ($haystack as $key => $value) {
if (is_array($value)) {
$haystack[$key] = $this->removeEmptyValues($value);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function callMethodSanitizeArguments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function callMethodSanitizeArguments($object, $method, array $argumentsList = [])
{
// get class reflection object
$reflection = new ReflectionMethod($object, $method);
// array where the sanitized arguemnts will be stored
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function behaviors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function behaviors()
{
$behaviors = parent::behaviors();
if ($this->enableCors) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function resolveRoute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function resolveRoute($route)
{
$routeParts = explode('/', $route);
foreach ($routeParts as $k => $v) {
if (($k == 0 && $v == $this->id) || (empty($v))) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getMailer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getMailer()
{
if ($this->_mailer === null) {
$this->_mailer = new PHPMailer();
$this->_mailer->CharSet = 'UTF-8';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function applicationConsole
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function applicationConsole()
{
$this->setIsCli(true);
$config = $this->getConfigArray();
$config['defaultRoute'] = 'help';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"