| 1 | <?php |
||
| 2 | |||
| 3 | trait trait_helper |
||
| 4 | { |
||
| 5 | /** @param array Columns (config) */ |
||
| 6 | public static $cols; |
||
| 7 | /** @param array Query result, allows altering before table::load() */ |
||
| 8 | public static $data = []; |
||
| 9 | /** @param bool Export flag (for current request) */ |
||
| 10 | public static $export; |
||
| 11 | /** @param bool Export is allowed (shows buttons in the tfoot) */ |
||
| 12 | public static $exportActive = true; |
||
| 13 | /** @param bool Export data altered (use false for pure result) */ |
||
| 14 | public static $exportDataAsDisplayed = true; |
||
| 15 | /** @param array Errors collector */ |
||
| 16 | protected static $errors = []; |
||
| 17 | /** @param array Collector (values for current table call) */ |
||
| 18 | protected static $t = ['page' => 1, 'tables' => []]; |
||
| 19 | |||
| 20 | public static function assets($path = "/public/table") |
||
| 21 | { |
||
| 22 | return "<script src=\"{$path}/table_helper.js\" defer></script>\n\t" . |
||
| 23 | "<script src=\"{$path}/table.js\" defer></script>\n\t" . |
||
| 24 | "<link href=\"{$path}/table.css\" rel=\"stylesheet\">\n"; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** Array to space separated key value list |
||
| 28 | * @param array $attributes |
||
| 29 | * @return string */ |
||
| 30 | protected static function attributes(array $attributes) |
||
| 31 | { |
||
| 32 | $list = [' ']; |
||
| 33 | foreach ($attributes as $key => $value) { |
||
| 34 | if ($value === true || (empty($value) && $value != 0)) { |
||
| 35 | $list[] = $key; |
||
| 36 | } else { |
||
| 37 | $list[] = $key . '="' . $value . '"'; |
||
| 38 | } |
||
| 39 | } |
||
| 40 | return rtrim(implode(' ', $list)); |
||
| 41 | } |
||
| 42 | |||
| 43 | protected static function error($message = null) |
||
| 44 | { |
||
| 45 | if (isset($message)) { |
||
| 46 | self::$errors[] = $message; |
||
| 47 | } else { |
||
| 48 | return empty(self::$errors) ? null : |
||
| 49 | '<p class="tbl-err">' . implode('</br>', self::$errors) . '</p>'; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | /** Parses view to string |
||
| 54 | * @param string $template |
||
| 55 | * @param array $vars |
||
| 56 | * @return string */ |
||
| 57 | protected static function view($template, $vars = []) |
||
| 58 | { |
||
| 59 | extract($vars); |
||
| 60 | ob_start(); |
||
| 61 | require $template; |
||
| 62 | return (string) ob_get_clean(); |
||
| 63 | } |
||
| 64 | |||
| 65 | /** Needed for more than one table on page |
||
| 66 | * @param strings $items */ |
||
|
0 ignored issues
–
show
|
|||
| 67 | protected static function reset($items) |
||
| 68 | { |
||
| 69 | if (!in_array($items, self::$t["tables"])) { |
||
| 70 | self::$t["tables"][] = $items; |
||
| 71 | self::$cols = []; |
||
| 72 | self::$t['rows'] = null; |
||
| 73 | } else { |
||
| 74 | echo 'Existing table-id used in table::create(): ' . $items; |
||
| 75 | } |
||
| 76 | } |
||
| 77 | } |
||
| 78 |
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