unil-lettres /
dilps-tiresias
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Application; |
||
| 6 | |||
| 7 | use Cake\Chronos\Chronos; |
||
|
0 ignored issues
–
show
|
|||
| 8 | use DateTimeZone; |
||
| 9 | |||
| 10 | abstract class Utility |
||
| 11 | { |
||
| 12 | 42 | public static function dateToJulian(Chronos $date): int |
|
| 13 | { |
||
| 14 | 42 | return gregoriantojd((int) $date->format('m'), (int) $date->format('d'), (int) $date->format('Y')); |
|
| 15 | } |
||
| 16 | |||
| 17 | 41 | public static function julianToDate(int $date): Chronos |
|
| 18 | { |
||
| 19 | 41 | $parts = explode('/', jdtogregorian($date)); |
|
| 20 | |||
| 21 | 41 | $result = new Chronos('now', new DateTimeZone('UTC')); |
|
| 22 | |||
| 23 | 41 | return $result->setDate((int) $parts[2], (int) $parts[0], (int) $parts[1])->setTime(0, 0, 0, 0); |
|
| 24 | } |
||
| 25 | |||
| 26 | 18 | public static function sanitizeRichText(string $string): string |
|
| 27 | { |
||
| 28 | 18 | $sanitized = self::noUnbreakableSpaces(strip_tags($string, '<p><br><strong><em><u>')); |
|
| 29 | |||
| 30 | 18 | return $sanitized; |
|
| 31 | } |
||
| 32 | |||
| 33 | 66 | public static function noUnbreakableSpaces(string $string): string |
|
| 34 | { |
||
| 35 | 66 | return str_replace([' ', html_entity_decode(' ')], ' ', $string); |
|
| 36 | } |
||
| 37 | |||
| 38 | 54 | public static function sanitizeSingleLineRichText(string $string): string |
|
| 39 | { |
||
| 40 | 54 | $sanitized = self::noUnbreakableSpaces(strip_tags($string, '<strong><em><u>')); |
|
| 41 | |||
| 42 | 54 | return $sanitized; |
|
| 43 | } |
||
| 44 | |||
| 45 | 56 | public static function richTextToPlainText(string $string): string |
|
| 46 | { |
||
| 47 | 56 | return trim(self::noUnbreakableSpaces(html_entity_decode(strip_tags(preg_replace( |
|
| 48 | 56 | [ |
|
| 49 | 56 | '~<br\s*/?>~i', |
|
| 50 | 56 | '~<p\s*>~i', |
|
| 51 | 56 | '~</p\s*>~i', |
|
| 52 | 56 | '~\n{2,}~i', |
|
| 53 | 56 | ], |
|
| 54 | 56 | [ |
|
| 55 | 56 | "\n", |
|
| 56 | 56 | "\n\n", |
|
| 57 | 56 | "\n\n", |
|
| 58 | 56 | "\n\n", |
|
| 59 | 56 | ], |
|
| 60 | 56 | $string |
|
| 61 | 56 | ))))); |
|
| 62 | } |
||
| 63 | } |
||
| 64 |
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