marcelog/PAMI

View on GitHub

Showing 30 of 282 total issues

Function __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($rawContent)
    {
        parent::__construct();
        $this->channelVariables = array('default' => array());
        $this->rawContent = $rawContent;
Severity: Minor
Found in src/PAMI/Message/IncomingMessage.php - About 1 hr 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

Function process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function process()
    {
        $msgs = $this->getMessages();
        foreach ($msgs as $aMsg) {
            $this->logger->debug(
Severity: Minor
Found in src/PAMI/Client/Impl/ClientImpl.php - About 1 hr 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

Method open has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function open()
    {
        $cString = $this->scheme . $this->host . ':' . $this->port;
        $this->context = stream_context_create();
        $errno = 0;
Severity: Minor
Found in src/PAMI/Client/Impl/ClientImpl.php - About 1 hr to fix

    Method handle has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle(EventMessage $event)
        {
            if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
                if ($event->getSubEvent() == 'Start') {
                    switch($pid = pcntl_fork())
    Severity: Minor
    Found in doc/examples/asyncagi/example.php - About 1 hr to fix

      Method process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function process()
          {
              $msgs = $this->getMessages();
              foreach ($msgs as $aMsg) {
                  $this->logger->debug(
      Severity: Minor
      Found in src/PAMI/Client/Impl/ClientImpl.php - About 1 hr to fix

        Function dispatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function dispatch(IncomingMessage $message)
            {
                foreach ($this->eventListeners as $data) {
                    $listener = $data[0];
                    $predicate = $data[1];
        Severity: Minor
        Found in src/PAMI/Client/Impl/ClientImpl.php - About 55 mins 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

        Function serialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function serialize()
            {
                $result = array();
                foreach ($this->getKeys() as $k => $v) {
                    $result[] = $k . ': ' . $v;
        Severity: Minor
        Found in src/PAMI/Message/Message.php - About 45 mins 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

        Function handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handle(EventMessage $event)
            {
                if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
                    if ($event->getSubEvent() == 'Start') {
                        switch($pid = pcntl_fork())
        Severity: Minor
        Found in doc/examples/asyncagi/example.php - About 35 mins 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

        Function getChannelVariables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getChannelVariables($channel = null)
            {
                if (is_null($channel)) {
                    if (!isset($this->keys['channel'])) {
                        return $this->getChannelVariables('default');
        Severity: Minor
        Found in src/PAMI/Message/IncomingMessage.php - About 35 mins 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

        Function send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function send(OutgoingMessage $message)
            {
                $messageToSend = $message->serialize();
                $length = strlen($messageToSend);
                $this->logger->debug(
        Severity: Minor
        Found in src/PAMI/Client/Impl/ClientImpl.php - About 25 mins 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

        Severity
        Category
        Status
        Source
        Language