elephantly/AmpConverterBundle

View on GitHub

Showing 164 of 164 total issues

Expected 0 spaces after opening bracket; 1 found
Open

        if ( (isset($this->options['amp_anim']) && $this->options['amp_anim']) || !isset($this->options['amp_anim'])) {

Expected 1 space after ELSE keyword; 0 found
Open

            }else{

Expected 1 space after FOREACH keyword; 0 found
Open

        foreach($this->getAmpAttributes() as $ampAttribute) {

Expected 1 space after closing brace; 0 found
Open

        }else {

No space found after comma in function call
Open

                    $this->outputElement->setAttribute($mandatoryAttribute,$attributeDefaultValue);

Whitespace found at end of line
Open

<?php 
Severity: Minor
Found in Converter/ConverterChain.php by phpcodesniffer

Expected 1 space after closing parenthesis; found 0
Open

            }elseif (in_array($key, $this->attributes)){

Line indented incorrectly; expected at least 8 spaces, found 7
Open

       $container->setDefinition('elephantly.amp_converter', $converterDefinition);

Expected 1 space after IF keyword; 0 found
Open

        if($document && $this->cleaner) {
Severity: Minor
Found in Converter/AmpConverter.php by phpcodesniffer

No space found after comma in function call
Open

        $regex = rtrim($regex,"| ");

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in Converter/ConverterChain.php by phpcodesniffer

The variable $OEmbed is not named in camelCase.
Open

    public function callback()
    {
        $src = $this->inputElement->getAttribute('data-href');
        preg_match('/https:\/\/www.facebook\.com\/\w*\/(\w*)\/\d*/', $src, $embedType);
        switch ($embedType) {

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 $OEmbed is not named in camelCase.
Open

    public function callback()
    {
        $src = $this->inputElement->getAttribute('data-href');
        preg_match('/https:\/\/www.facebook\.com\/\w*\/(\w*)\/\d*/', $src, $embedType);
        switch ($embedType) {

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 $OEmbed is not named in camelCase.
Open

    public function callback()
    {
        $src = $this->inputElement->getAttribute('data-href');
        preg_match('/https:\/\/www.facebook\.com\/\w*\/(\w*)\/\d*/', $src, $embedType);
        switch ($embedType) {

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 $OEmbed is not named in camelCase.
Open

    public function callback()
    {
        $src = $this->inputElement->getAttribute('data-href');
        preg_match('/https:\/\/www.facebook\.com\/\w*\/(\w*)\/\d*/', $src, $embedType);
        switch ($embedType) {

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

Define a constant instead of duplicating this literal "height" 6 times.
Open

            case 'height':

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "data-tweetid" 4 times.
Open

        $this->attributes = array('data-*', 'data-tweetid');

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "data-player" 3 times.
Open

        $this->attributes = array('data-account', 'data-player', 'data-player-id', 'data-embed', 'data-video-id', 'data-playlist-id', 'data-param-*');

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "coverage" 5 times.
Open

$commandLine->option('coverage', 'default', 3);
Severity: Critical
Found in kahlan-config.travis.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "width" 3 times.
Open

        $this->mandatoryAttributes = array('layout', 'width', 'height');
Severity: Critical
Found in Converter/Media/AmpVideoConverter.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Severity
Category
Status
Source
Language