| Conditions | 13 | 
| Paths | 256 | 
| Total Lines | 63 | 
| Code Lines | 40 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 69 | public function readData($option): array  | 
            ||
| 70 |     { | 
            ||
| 71 | $url = htmlspecialchars_decode($option['link'], ENT_NOQUOTES);  | 
            ||
| 72 | $ch = curl_init();  | 
            ||
| 73 |         if ($ch !== false) { | 
            ||
| 74 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  | 
            ||
| 75 | curl_setopt($ch, CURLOPT_HEADER, false);  | 
            ||
| 76 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);  | 
            ||
| 77 | curl_setopt($ch, CURLOPT_URL, $url);  | 
            ||
| 78 | curl_setopt($ch, CURLOPT_REFERER, $url);  | 
            ||
| 79 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);  | 
            ||
| 80 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');  | 
            ||
| 81 | $curlResult = curl_exec($ch);  | 
            ||
| 82 | $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);  | 
            ||
| 83 | curl_close($ch);  | 
            ||
| 84 |         } else { | 
            ||
| 85 | $curlResult = '';  | 
            ||
| 86 | }  | 
            ||
| 87 | |||
| 88 | $rows = str_getcsv($curlResult, "\n");  | 
            ||
| 89 | |||
| 90 | // remove x number of rows from the beginning  | 
            ||
| 91 |         if (isset($option['offset']) and is_numeric($option['offset'])) { | 
            ||
| 92 | $rows = array_slice($rows, $option['offset']);  | 
            ||
| 93 | }  | 
            ||
| 94 | |||
| 95 | $selectedColumns = array();  | 
            ||
| 96 |         if (isset($option['columns']) && strlen($option['columns']) > 0) { | 
            ||
| 97 | $selectedColumns = str_getcsv($option['columns'], ',');  | 
            ||
| 98 | }  | 
            ||
| 99 | |||
| 100 | // get the delimiter by reading the first row  | 
            ||
| 101 | $delimiter = $this->detectDelimiter($rows[0]);  | 
            ||
| 102 | |||
| 103 | // the first row will define the column headers, even if it is not a real header  | 
            ||
| 104 | // trim removes any leading or ending spaces  | 
            ||
| 105 |         $header = array_map('trim', str_getcsv($rows[0], $delimiter)); | 
            ||
| 106 | |||
| 107 | // if the data has a real header, remove the first row  | 
            ||
| 108 |         if (!isset($option['hasHeader']) or $option['hasHeader'] !== 'false') { | 
            ||
| 109 | $rows = array_slice($rows, 1);  | 
            ||
| 110 | }  | 
            ||
| 111 | |||
| 112 | $data = array();  | 
            ||
| 113 |         if (count($selectedColumns) !== 0) { | 
            ||
| 114 | // if only a subset of columns or fixed column values are set, they are replaced here  | 
            ||
| 115 | $header = $this->minimizeRow($selectedColumns, $header);  | 
            ||
| 116 |             foreach ($rows as $row) { | 
            ||
| 117 |                 $data[] = $this->minimizeRow($selectedColumns, array_map('trim', str_getcsv($row, $delimiter))); | 
            ||
| 118 | }  | 
            ||
| 119 |         } else { | 
            ||
| 120 |             foreach ($rows as $row) { | 
            ||
| 121 |                 $data[] = array_map('trim', str_getcsv($row, $delimiter)); | 
            ||
| 122 | }  | 
            ||
| 123 | }  | 
            ||
| 124 | unset($rows);  | 
            ||
| 125 | |||
| 126 | return [  | 
            ||
| 127 | 'header' => $header,  | 
            ||
| 128 | 'dimensions' => array_slice($header, 0, count($header) - 1),  | 
            ||
| 129 | 'data' => $data,  | 
            ||
| 130 | 'rawdata' => $curlResult,  | 
            ||
| 131 | 'error' => ($http_code>=200 && $http_code<300) ? 0 : 'HTTP response code: '.$http_code,  | 
            ||
| 132 | ];  | 
            ||
| 164 | }  | 
            
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths