heximcz/mxtoolbox

View on GitHub

Showing 11 of 37 total issues

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

    public function parseDataFromMultiprocessing()
    {
        if(is_array($this->digOutput) && count($this->digOutput) > 0) {

            foreach ($this->testResult as &$blackList) {
Severity: Minor
Found in src/MxToolbox/NetworkTools/QuickDig.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 getJsonFromDigMultiprocess has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getJsonFromDigMultiprocess($addr, &$testResult)
    {
        $this->ipAddress = $addr;
        $this->testResult = &$testResult;
        $this->netTool->ipValidator($this->ipAddress);
Severity: Minor
Found in src/MxToolbox/NetworkTools/QuickDig.php - About 1 hr to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct(NetworkTools $netTool, $addr, $myHostName, $mailFrom, $mailRcptTo)
    Severity: Minor
    Found in src/MxToolbox/NetworkTools/SmtpServerChecks.php - About 35 mins to fix

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

          private function checkExistPTR($addr)
          {
              if (!$this->ipValidator($addr))
                  return false;
              $this->ipAddress = $this->getIpAddressFromDomainName($addr);
      Severity: Minor
      Found in src/MxToolbox/NetworkTools/NetworkTools.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 getJsonFromDigMultiprocess has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getJsonFromDigMultiprocess($addr, &$testResult)
          {
              $this->ipAddress = $addr;
              $this->testResult = &$testResult;
              $this->netTool->ipValidator($this->ipAddress);
      Severity: Minor
      Found in src/MxToolbox/NetworkTools/QuickDig.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 makeAliveBlacklistFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function makeAliveBlacklistFile(&$aliveBlacklists)
          {
              if (!array_key_exists('blHostName', $aliveBlacklists[0]))
                  throw new MxToolboxRuntimeException("Cannot found index ['blHostName'] in array. Build test array first.");
      
      
      Severity: Minor
      Found in src/MxToolbox/FileSystem/BlacklistsHostnameFile.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 searchDigResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function searchDigResult($domainName) {
              foreach ($this->digOutput as $item) {
                  if (($firstLine = strtok($item[0], "\n")) !== false) {
                      if ($this->digParser->isDomainNameInString($domainName, $firstLine))
                          return $item[0];
      Severity: Minor
      Found in src/MxToolbox/NetworkTools/QuickDig.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

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

          public function cleanPrevResults($checkResponse = true)
          {
              if ($this->isArrayInitialized($this->testStructure)) {
                  foreach ($this->testStructure as $index => $blackList) {
                      // here is default true because blacklist is loaded from alive file 
      Severity: Minor
      Found in src/MxToolbox/DataGrid/MxToolboxDataGrid.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

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

          private function getMxRecords($hostName)
          {
              if (preg_match("/^[a-zA-Z0-9.\-]{2,256}\.[a-z]{2,6}$/", trim($hostName))) {
                  $ptr = dns_get_record($hostName, DNS_MX);
                  if (isset($ptr[0]['target'])) {
      Severity: Minor
      Found in src/MxToolbox/NetworkTools/NetworkTools.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

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

          public function checkAllDnsbl($addr, &$testResult)
          {
              $this->ipValidator($addr);
              $this->ipAddress = $this->getIpAddressFromDomainName($addr);
              if (count($testResult) > 0) {
      Severity: Minor
      Found in src/MxToolbox/NetworkTools/NetworkTools.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

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

          protected function setTestResultArray($blacklistHostNamesArray, $alive = true, $ownBlacklist = false)
          {
              if ($this->isArrayInitialized($blacklistHostNamesArray)) {
                  $this->testStructure = array();
                  foreach ($blacklistHostNamesArray as $index => $blackList) {
      Severity: Minor
      Found in src/MxToolbox/DataGrid/MxToolboxDataGrid.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