tapestry-cloud/tapestry

View on GitHub
src/Providers/ProjectConfigurationServiceProvider.php

Summary

Maintainability
A
0 mins
Test Coverage
A
96%

Missing class import via use statement (line '53', column '23').
Open

            throw new \Exception('Configuration can only be either PHP or YAML based, not both.');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid assigning values to variables in if clauses and the like (line '34', column '13').
Open

    public function register()
    {
        $container = $this->getContainer();

        /** @var Tapestry $tapestry */

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid assigning values to variables in if clauses and the like (line '38', column '13').
Open

    public function register()
    {
        $container = $this->getContainer();

        /** @var Tapestry $tapestry */

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class '\Symfony\Component\Yaml\Yaml' in method 'getConfigurationFromPath'.
Open

            return Yaml::parse(file_get_contents($path));

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Line exceeds 120 characters; contains 132 characters
Open

        if ($envConfigPathName = $this->identifyConfigurationPath($tapestry['currentWorkingDirectory'], $tapestry['environment'])) {

The variable $YAMLPath is not named in camelCase.
Open

    private function identifyConfigurationPath($configPath, $env = null)
    {
        $basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
        $PHPPath = $basePath.'.php';
        $YAMLPath = $basePath.'.yaml';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $YAMLPath is not named in camelCase.
Open

    private function identifyConfigurationPath($configPath, $env = null)
    {
        $basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
        $PHPPath = $basePath.'.php';
        $YAMLPath = $basePath.'.yaml';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $YAMLPath is not named in camelCase.
Open

    private function identifyConfigurationPath($configPath, $env = null)
    {
        $basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
        $PHPPath = $basePath.'.php';
        $YAMLPath = $basePath.'.yaml';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $PHPPath is not named in camelCase.
Open

    private function identifyConfigurationPath($configPath, $env = null)
    {
        $basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
        $PHPPath = $basePath.'.php';
        $YAMLPath = $basePath.'.yaml';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $PHPPath is not named in camelCase.
Open

    private function identifyConfigurationPath($configPath, $env = null)
    {
        $basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
        $PHPPath = $basePath.'.php';
        $YAMLPath = $basePath.'.yaml';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $PHPPath is not named in camelCase.
Open

    private function identifyConfigurationPath($configPath, $env = null)
    {
        $basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
        $PHPPath = $basePath.'.php';
        $YAMLPath = $basePath.'.yaml';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status