gdbots/enrichments-bundle-php

View on GitHub

Showing 24 of 24 total issues

Method enrich has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function enrich(PbjxEvent $pbjxEvent): void
    {
        /** @var UaParser $message */
        $message = $pbjxEvent->getMessage();
        if (!$message->has('ctx_ua')) {
Severity: Minor
Found in src/UaParserEnricher.php - About 1 hr to fix

    Missing class import via use statement (line '16', column '64').
    Open

            $command->set('occurred_at', Microtime::fromFloat((new \DateTime('2015-12-25T01:15:30.123456Z'))->format('U.u')));
    Severity: Minor
    Found in tests/TimeSamplingEnricherTest.php by phpmd

    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

    Missing class import via use statement (line '18', column '64').
    Open

            $command->set('occurred_at', Microtime::fromFloat((new \DateTime('2015-12-25T01:15:30.123456Z'))->format('U.u')));
    Severity: Minor
    Found in tests/TimePartingEnricherTest.php by phpmd

    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 using static access to class 'Gdbots\Tests\Bundle\EnrichmentsBundle\Fixtures\FakeCommand' in method 'testEnrich'.
    Open

            $command = Fixtures\FakeCommand::create();
    Severity: Minor
    Found in tests/TimePartingEnricherTest.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Schemas\Enrichments\Mixin\TimeSampling\TimeSamplingV1Mixin' in method 'defineSchema'.
    Open

                    TimeSamplingV1Mixin::create(),
    Severity: Minor
    Found in tests/Fixtures/FakeCommand.php by phpmd

    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

    Avoid using static access to class 'Gdbots\Tests\Bundle\EnrichmentsBundle\Fixtures\FakeCommand' in method 'testEnrich'.
    Open

            $command = Fixtures\FakeCommand::create();
    Severity: Minor
    Found in tests/TimeSamplingEnricherTest.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Schemas\Common\Enum\DayOfWeek' in method 'testEnrich'.
    Open

            $this->assertSame(DayOfWeek::FRIDAY(), $command->get('day_of_week'));
    Severity: Minor
    Found in tests/TimePartingEnricherTest.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Schemas\Enrichments\Mixin\UaParser\UaParserV1Mixin' in method 'defineSchema'.
    Open

                    UaParserV1Mixin::create(),
    Severity: Minor
    Found in tests/Fixtures/FakeCommand.php by phpmd

    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

    Avoid using static access to class '\UAParser\Parser' in method '__construct'.
    Open

            $this->parser = Parser::create();
    Severity: Minor
    Found in src/UaParserEnricher.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Pbj\WellKnown\Microtime' in method 'testEnrich'.
    Open

            $command->set('occurred_at', Microtime::fromFloat((new \DateTime('2015-12-25T01:15:30.123456Z'))->format('U.u')));
    Severity: Minor
    Found in tests/TimeSamplingEnricherTest.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Schemas\Common\Enum\Month' in method 'enrich'.
    Open

                ->set('month_of_year', Month::create((int)$date->format('n')))
    Severity: Minor
    Found in src/TimePartingEnricher.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Schemas\Enrichments\Mixin\TimeParting\TimePartingV1Mixin' in method 'defineSchema'.
    Open

                    TimePartingV1Mixin::create(),
    Severity: Minor
    Found in tests/Fixtures/FakeCommand.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Pbj\WellKnown\Microtime' in method 'testEnrich'.
    Open

            $command->set('occurred_at', Microtime::fromFloat((new \DateTime('2015-12-25T01:15:30.123456Z'))->format('U.u')));
    Severity: Minor
    Found in tests/TimePartingEnricherTest.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Schemas\Common\Enum\Month' in method 'testEnrich'.
    Open

            $this->assertSame(Month::DECEMBER(), $command->get('month_of_year'));
    Severity: Minor
    Found in tests/TimePartingEnricherTest.php by phpmd

    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

    Avoid using static access to class 'Gdbots\Tests\Bundle\EnrichmentsBundle\Fixtures\FakeCommand' in method 'testEnrich'.
    Open

            $command = Fixtures\FakeCommand::create();
    Severity: Minor
    Found in tests/UaParserEnricherTest.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Schemas\Pbjx\Mixin\Command\CommandV1Mixin' in method 'defineSchema'.
    Open

                    CommandV1Mixin::create(),
    Severity: Minor
    Found in tests/Fixtures/FakeCommand.php by phpmd

    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

    Avoid using static access to class '\Gdbots\Pbj\MessageResolver' in method 'defineSchema'.
    Open

            MessageResolver::registerSchema($schema);
    Severity: Minor
    Found in tests/Fixtures/FakeCommand.php by phpmd

    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

    Avoid unused parameters such as '$config'.
    Open

        public function load(array $config, ContainerBuilder $container)

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid using static access to class '\Gdbots\Schemas\Common\Enum\DayOfWeek' in method 'enrich'.
    Open

                ->set('day_of_week', DayOfWeek::create($dayOfWeek))
    Severity: Minor
    Found in src/TimePartingEnricher.php by phpmd

    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

    Only one argument is allowed per line in a multi-line function call
    Open

            $schema = new Schema('pbj:gdbots:tests.enrichments:fixtures:fake-command:1-0-0', __CLASS__, [],
    Severity
    Category
    Status
    Source
    Language