isotopsweden/wp-cargo

View on GitHub
src/runner/class-basic.php

Summary

Maintainability
A
2 hrs
Test Coverage

Function run_queue has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function run_queue() {
        $database = $this->cargo->make( 'database' );
        $pusher   = $this->cargo->make( 'pusher' );

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php - About 2 hrs to fix

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

Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
Open

    public function run_queue() {
Severity: Critical
Found in src/runner/class-basic.php by sonar-php

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

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

                    } else {
                        $this->log_info( sprintf( 'Pushed item with id: %d', $item->id ) );
                    }
Severity: Minor
Found in src/runner/class-basic.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

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

            } else {
                $this->log_info( sprintf( 'Item with id %d is not pushed since data string is empty', $item->id ) );
            }
Severity: Minor
Found in src/runner/class-basic.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

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

    public function run_queue() {
        $database = $this->cargo->make( 'database' );
        $pusher   = $this->cargo->make( 'pusher' );

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php by phpmd

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

Method name "Basic::run_all" is not in camel caps format
Open

    public function run_all() {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        foreach ( $this->terms() as $term ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space found before closing bracket of FOREACH loop
Open

        foreach ( $this->posts() as $post ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space found before closing bracket of FOREACH loop
Open

        foreach ( $this->terms() as $term ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space found before closing bracket of FOREACH loop
Open

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        foreach ( $this->posts() as $post ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            if ( ! empty( $item->data ) && cargo_is_json( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Opening brace of a class must be on the line after the definition
Open

class Basic extends Abstract_Runner {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space found after opening bracket of FOREACH loop
Open

        foreach ( $this->terms() as $term ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Method name "Basic::run_queue" is not in camel caps format
Open

    public function run_queue() {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space found after opening bracket of FOREACH loop
Open

        foreach ( $this->posts() as $post ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space found after opening bracket of FOREACH loop
Open

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            if ( ! $database->delete( $item->id ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                    if ( is_wp_error( $res ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                if ( $res = $pusher->send( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                    if ( ! $res ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Run all content task.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $pusher->send( new Options() );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Push all terms.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                if ( $res = $pusher->send( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->log_info( sprintf( 'Pushed post with id %d to pusher', $post->ID ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->log_info( 'Pushed all options' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ( ! empty( $item->data ) && cargo_is_json( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function run_all() {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ( $this->posts() as $post ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $pusher->send( new Menus() );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $database = $this->cargo->make( 'database' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->log_success( 'Done!' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $pusher = $this->cargo->make( 'pusher' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Push all menus.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->log_info( 'Pushed all menus' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ( $this->terms() as $term ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                // Bail if we don't get a true when we run through all items.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Push all posts.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $pusher->send( new Post( $post ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $pusher->send( new Term( $term ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Push all options.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Run queued content task.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function run_queue() {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $pusher   = $this->cargo->make( 'pusher' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->log_info( sprintf( 'Pushed term with id %d to pusher', $term->term_id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                        $this->log_info( sprintf( 'Pushed item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $this->log_info( sprintf( 'Item with id %d is not pushed since data string is empty', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                        $this->log_error( $res );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            // If it can be send delete it from the database.
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    if ( ! $res ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->log_success( 'Done!' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    } else {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    if ( is_wp_error( $res ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ( ! $database->delete( $item->id ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                }
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            } else {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                        break;
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $this->log_error( sprintf( 'Failed to delete item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $pusher->send( new Options() );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $pusher = $this->cargo->make( 'pusher' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $pusher   = $this->cargo->make( 'pusher' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Opening brace should be on a new line
Open

    public function run_all() {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            if ( ! empty( $item->data ) && cargo_is_json( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $pusher = $this->cargo->make( 'pusher' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

        foreach ( $this->terms() as $term ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $pusher->send( new Term( $term ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $this->log_info( sprintf( 'Pushed term with id %d to pusher', $term->term_id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                if ( $res = $pusher->send( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $pusher->send( new Term( $term ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $this->log_info( 'Pushed all options' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            if ( ! empty( $item->data ) && cargo_is_json( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $pusher->send( new Post( $post ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $this->log_info( sprintf( 'Pushed post with id %d to pusher', $post->ID ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $this->log_info( sprintf( 'Pushed post with id %d to pusher', $post->ID ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $pusher->send( new Term( $term ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Opening brace should be on a new line
Open

    public function run_queue() {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $this->log_info( 'Pushed all menus' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $pusher->send( new Options() );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $this->log_info( 'Pushed all options' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $this->log_success( 'Done!' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $pusher->send( new Post( $post ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $this->log_info( sprintf( 'Pushed term with id %d to pusher', $term->term_id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $pusher->send( new Term( $term ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $pusher->send( new Menus() );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $this->log_info( 'Pushed all menus' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            if ( ! empty( $item->data ) && cargo_is_json( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $this->log_info( sprintf( 'Pushed post with id %d to pusher', $post->ID ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $this->log_info( sprintf( 'Pushed term with id %d to pusher', $term->term_id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $database = $this->cargo->make( 'database' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

        foreach ( $this->posts() as $post ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $pusher->send( new Menus() );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            if ( ! empty( $item->data ) && cargo_is_json( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $pusher->send( new Post( $post ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $database = $this->cargo->make( 'database' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $pusher   = $this->cargo->make( 'pusher' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $pusher->send( new Post( $post ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $this->log_info( sprintf( 'Pushed term with id %d to pusher', $term->term_id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $this->log_success( 'Done!' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

            if ( ! empty( $item->data ) && cargo_is_json( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $this->log_info( sprintf( 'Pushed post with id %d to pusher', $post->ID ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

                if ( $res = $pusher->send( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                $this->log_info( sprintf( 'Item with id %d is not pushed since data string is empty', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                $this->log_error( sprintf( 'Failed to delete item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                    if ( is_wp_error( $res ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                $this->log_error( sprintf( 'Failed to delete item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                        $this->log_error( $res );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            if ( ! $database->delete( $item->id ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $this->log_success( 'Done!' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                $this->log_error( sprintf( 'Failed to delete item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                        $this->log_info( sprintf( 'Pushed item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                $this->log_info( sprintf( 'Item with id %d is not pushed since data string is empty', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            if ( ! $database->delete( $item->id ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

                    if ( ! $res ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                $this->log_info( sprintf( 'Item with id %d is not pushed since data string is empty', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                $this->log_error( sprintf( 'Failed to delete item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

                    if ( is_wp_error( $res ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                        $this->log_info( sprintf( 'Pushed item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $this->log_success( 'Done!' );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                        $this->log_info( sprintf( 'Pushed item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                $this->log_info( sprintf( 'Item with id %d is not pushed since data string is empty', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

            if ( ! $database->delete( $item->id ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                if ( $res = $pusher->send( $item->data ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

                        $this->log_error( $res );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                        $this->log_info( sprintf( 'Pushed item with id: %d', $item->id ) );
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

                    if ( is_wp_error( $res ) ) {
Severity: Minor
Found in src/runner/class-basic.php by phpcodesniffer

The method run_all is not named in camelCase.
Open

    public function run_all() {
        $pusher = $this->cargo->make( 'pusher' );

        // Push all posts.
        foreach ( $this->posts() as $post ) {
Severity: Minor
Found in src/runner/class-basic.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method run_queue is not named in camelCase.
Open

    public function run_queue() {
        $database = $this->cargo->make( 'database' );
        $pusher   = $this->cargo->make( 'pusher' );

        foreach ( $database->all() as $item ) {
Severity: Minor
Found in src/runner/class-basic.php by phpmd

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status