@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @access public |
| 325 | 325 | */ |
| 326 | 326 | function addHTMLImage($file, |
| 327 | - $c_type='application/octet-stream', |
|
| 327 | + $c_type = 'application/octet-stream', |
|
| 328 | 328 | $name = '', |
| 329 | 329 | $isfile = true, |
| 330 | 330 | $content_id = null |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | { |
| 466 | 466 | // Check state of file and raise an error properly |
| 467 | 467 | if (!file_exists($file_name)) { |
| 468 | - return $this->_raiseError('File not found: ' . $file_name); |
|
| 468 | + return $this->_raiseError('File not found: '.$file_name); |
|
| 469 | 469 | } |
| 470 | 470 | if (!is_file($file_name)) { |
| 471 | - return $this->_raiseError('Not a regular file: ' . $file_name); |
|
| 471 | + return $this->_raiseError('Not a regular file: '.$file_name); |
|
| 472 | 472 | } |
| 473 | 473 | if (!is_readable($file_name)) { |
| 474 | - return $this->_raiseError('File is not readable: ' . $file_name); |
|
| 474 | + return $this->_raiseError('File is not readable: '.$file_name); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | // Temporarily reset magic_quotes_runtime and read file contents |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | return $body; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | - return $this->txtHeaders($headers, $overwrite) . $separation . $body; |
|
| 723 | + return $this->txtHeaders($headers, $overwrite).$separation.$body; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | /** |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | { |
| 759 | 759 | // Check state of file and raise an error properly |
| 760 | 760 | if (file_exists($filename) && !is_writable($filename)) { |
| 761 | - return $this->_raiseError('File is not writable: ' . $filename); |
|
| 761 | + return $this->_raiseError('File is not writable: '.$filename); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | // Temporarily reset magic_quotes_runtime and read file contents |
@@ -767,13 +767,13 @@ discard block |
||
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | if (!($fh = fopen($filename, 'ab'))) { |
| 770 | - return $this->_raiseError('Unable to open file: ' . $filename); |
|
| 770 | + return $this->_raiseError('Unable to open file: '.$filename); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // Write message headers into file (skipping Content-* headers) |
| 774 | 774 | $head = $this->txtHeaders($headers, $overwrite, true); |
| 775 | 775 | if (fwrite($fh, $head) === false) { |
| 776 | - return $this->_raiseError('Error writing to file: ' . $filename); |
|
| 776 | + return $this->_raiseError('Error writing to file: '.$filename); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | fclose($fh); |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | { |
| 804 | 804 | // Check state of file and raise an error properly |
| 805 | 805 | if (file_exists($filename) && !is_writable($filename)) { |
| 806 | - return $this->_raiseError('File is not writable: ' . $filename); |
|
| 806 | + return $this->_raiseError('File is not writable: '.$filename); |
|
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | // Temporarily reset magic_quotes_runtime and read file contents |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | if (!($fh = fopen($filename, 'ab'))) { |
| 815 | - return $this->_raiseError('Unable to open file: ' . $filename); |
|
| 815 | + return $this->_raiseError('Unable to open file: '.$filename); |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | // Write the rest of the message into file |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | foreach ($this->_html_images as $i => $img) { |
| 854 | 854 | $cid = $this->_html_images[$i]['cid']; |
| 855 | 855 | if (!preg_match('#'.preg_quote($domainID).'$#', $cid)) { |
| 856 | - $this->_html_images[$i]['cid'] = $cid . $domainID; |
|
| 856 | + $this->_html_images[$i]['cid'] = $cid.$domainID; |
|
| 857 | 857 | } |
| 858 | 858 | } |
| 859 | 859 | } |
@@ -861,14 +861,14 @@ discard block |
||
| 861 | 861 | if (count($this->_html_images) && isset($this->_htmlbody)) { |
| 862 | 862 | foreach ($this->_html_images as $key => $value) { |
| 863 | 863 | $regex = array(); |
| 864 | - $regex[] = '#(\s)((?i)src|background|href(?-i))\s*=\s*(["\']?)' . |
|
| 865 | - preg_quote($value['name'], '#') . '\3#'; |
|
| 866 | - $regex[] = '#(?i)url(?-i)\(\s*(["\']?)' . |
|
| 867 | - preg_quote($value['name'], '#') . '\1\s*\)#'; |
|
| 864 | + $regex[] = '#(\s)((?i)src|background|href(?-i))\s*=\s*(["\']?)'. |
|
| 865 | + preg_quote($value['name'], '#').'\3#'; |
|
| 866 | + $regex[] = '#(?i)url(?-i)\(\s*(["\']?)'. |
|
| 867 | + preg_quote($value['name'], '#').'\1\s*\)#'; |
|
| 868 | 868 | |
| 869 | 869 | $rep = array(); |
| 870 | - $rep[] = '\1\2=\3cid:' . $value['cid'] .'\3'; |
|
| 871 | - $rep[] = 'url(\1cid:' . $value['cid'] . '\1)'; |
|
| 870 | + $rep[] = '\1\2=\3cid:'.$value['cid'].'\3'; |
|
| 871 | + $rep[] = 'url(\1cid:'.$value['cid'].'\1)'; |
|
| 872 | 872 | |
| 873 | 873 | $this->_htmlbody = preg_replace($regex, $rep, $this->_htmlbody); |
| 874 | 874 | $this->_html_images[$key]['name'] |
@@ -886,18 +886,18 @@ discard block |
||
| 886 | 886 | |
| 887 | 887 | switch (true) { |
| 888 | 888 | case $text && !$attachments: |
| 889 | - $message =& $this->_addTextPart($null, $this->_txtbody); |
|
| 889 | + $message = & $this->_addTextPart($null, $this->_txtbody); |
|
| 890 | 890 | break; |
| 891 | 891 | |
| 892 | 892 | case !$text && !$html && $attachments: |
| 893 | - $message =& $this->_addMixedPart(); |
|
| 893 | + $message = & $this->_addMixedPart(); |
|
| 894 | 894 | for ($i = 0; $i < count($this->_parts); $i++) { |
| 895 | 895 | $this->_addAttachmentPart($message, $this->_parts[$i]); |
| 896 | 896 | } |
| 897 | 897 | break; |
| 898 | 898 | |
| 899 | 899 | case $text && $attachments: |
| 900 | - $message =& $this->_addMixedPart(); |
|
| 900 | + $message = & $this->_addMixedPart(); |
|
| 901 | 901 | $this->_addTextPart($message, $this->_txtbody); |
| 902 | 902 | for ($i = 0; $i < count($this->_parts); $i++) { |
| 903 | 903 | $this->_addAttachmentPart($message, $this->_parts[$i]); |
@@ -906,11 +906,11 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | case $html && !$attachments && !$html_images: |
| 908 | 908 | if (isset($this->_txtbody)) { |
| 909 | - $message =& $this->_addAlternativePart($null); |
|
| 909 | + $message = & $this->_addAlternativePart($null); |
|
| 910 | 910 | $this->_addTextPart($message, $this->_txtbody); |
| 911 | 911 | $this->_addHtmlPart($message); |
| 912 | 912 | } else { |
| 913 | - $message =& $this->_addHtmlPart($null); |
|
| 913 | + $message = & $this->_addHtmlPart($null); |
|
| 914 | 914 | } |
| 915 | 915 | break; |
| 916 | 916 | |
@@ -921,10 +921,10 @@ discard block |
||
| 921 | 921 | // * html |
| 922 | 922 | // * image... |
| 923 | 923 | if (isset($this->_txtbody)) { |
| 924 | - $message =& $this->_addAlternativePart($null); |
|
| 924 | + $message = & $this->_addAlternativePart($null); |
|
| 925 | 925 | $this->_addTextPart($message, $this->_txtbody); |
| 926 | 926 | |
| 927 | - $ht =& $this->_addRelatedPart($message); |
|
| 927 | + $ht = & $this->_addRelatedPart($message); |
|
| 928 | 928 | $this->_addHtmlPart($ht); |
| 929 | 929 | for ($i = 0; $i < count($this->_html_images); $i++) { |
| 930 | 930 | $this->_addHtmlImagePart($ht, $this->_html_images[$i]); |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | // * Content-Type: multipart/related; |
| 934 | 934 | // * html |
| 935 | 935 | // * image... |
| 936 | - $message =& $this->_addRelatedPart($null); |
|
| 936 | + $message = & $this->_addRelatedPart($null); |
|
| 937 | 937 | $this->_addHtmlPart($message); |
| 938 | 938 | for ($i = 0; $i < count($this->_html_images); $i++) { |
| 939 | 939 | $this->_addHtmlImagePart($message, $this->_html_images[$i]); |
@@ -961,9 +961,9 @@ discard block |
||
| 961 | 961 | break; |
| 962 | 962 | |
| 963 | 963 | case $html && $attachments && !$html_images: |
| 964 | - $message =& $this->_addMixedPart(); |
|
| 964 | + $message = & $this->_addMixedPart(); |
|
| 965 | 965 | if (isset($this->_txtbody)) { |
| 966 | - $alt =& $this->_addAlternativePart($message); |
|
| 966 | + $alt = & $this->_addAlternativePart($message); |
|
| 967 | 967 | $this->_addTextPart($alt, $this->_txtbody); |
| 968 | 968 | $this->_addHtmlPart($alt); |
| 969 | 969 | } else { |
@@ -975,13 +975,13 @@ discard block |
||
| 975 | 975 | break; |
| 976 | 976 | |
| 977 | 977 | case $html && $attachments && $html_images: |
| 978 | - $message =& $this->_addMixedPart(); |
|
| 978 | + $message = & $this->_addMixedPart(); |
|
| 979 | 979 | if (isset($this->_txtbody)) { |
| 980 | - $alt =& $this->_addAlternativePart($message); |
|
| 980 | + $alt = & $this->_addAlternativePart($message); |
|
| 981 | 981 | $this->_addTextPart($alt, $this->_txtbody); |
| 982 | - $rel =& $this->_addRelatedPart($alt); |
|
| 982 | + $rel = & $this->_addRelatedPart($alt); |
|
| 983 | 983 | } else { |
| 984 | - $rel =& $this->_addRelatedPart($message); |
|
| 984 | + $rel = & $this->_addRelatedPart($message); |
|
| 985 | 985 | } |
| 986 | 986 | $this->_addHtmlPart($rel); |
| 987 | 987 | for ($i = 0; $i < count($this->_html_images); $i++) { |
@@ -1105,10 +1105,10 @@ discard block |
||
| 1105 | 1105 | foreach ($headers as $key => $val) { |
| 1106 | 1106 | if (is_array($val)) { |
| 1107 | 1107 | foreach ($val as $value) { |
| 1108 | - $ret .= "$key: $value" . $eol; |
|
| 1108 | + $ret .= "$key: $value".$eol; |
|
| 1109 | 1109 | } |
| 1110 | 1110 | } else { |
| 1111 | - $ret .= "$key: $val" . $eol; |
|
| 1111 | + $ret .= "$key: $val".$eol; |
|
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | // add required boundary parameter if not defined |
| 1155 | 1155 | if (preg_match('/^multipart\//i', $type)) { |
| 1156 | 1156 | if (empty($this->_build_params['boundary'])) { |
| 1157 | - $this->_build_params['boundary'] = '=_' . md5(rand() . microtime()); |
|
| 1157 | + $this->_build_params['boundary'] = '=_'.md5(rand().microtime()); |
|
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | $header .= ";$eol boundary=\"".$this->_build_params['boundary']."\""; |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | { |
| 1261 | 1261 | $input = array("To" => $recipients); |
| 1262 | 1262 | $retval = $this->_encodeHeaders($input); |
| 1263 | - return $retval["To"] ; |
|
| 1263 | + return $retval["To"]; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | /** |
@@ -1344,10 +1344,10 @@ discard block |
||
| 1344 | 1344 | */ |
| 1345 | 1345 | function _contentHeaders() |
| 1346 | 1346 | { |
| 1347 | - $attachments = count($this->_parts) ? true : false; |
|
| 1348 | - $html_images = count($this->_html_images) ? true : false; |
|
| 1349 | - $html = strlen($this->_htmlbody) ? true : false; |
|
| 1350 | - $text = (!$html && strlen($this->_txtbody)) ? true : false; |
|
| 1347 | + $attachments = count($this->_parts) ? true : false; |
|
| 1348 | + $html_images = count($this->_html_images) ? true : false; |
|
| 1349 | + $html = strlen($this->_htmlbody) ? true : false; |
|
| 1350 | + $text = (!$html && strlen($this->_txtbody)) ? true : false; |
|
| 1351 | 1351 | $headers = array(); |
| 1352 | 1352 | |
| 1353 | 1353 | // See get() |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | |
| 1388 | 1388 | if ($headers['Content-Type'] == 'text/plain') { |
| 1389 | 1389 | // single-part message: add charset and encoding |
| 1390 | - $charset = 'charset=' . $this->_build_params['text_charset']; |
|
| 1390 | + $charset = 'charset='.$this->_build_params['text_charset']; |
|
| 1391 | 1391 | // place charset parameter in the same line, if possible |
| 1392 | 1392 | // 26 = strlen("Content-Type: text/plain; ") |
| 1393 | 1393 | $headers['Content-Type'] |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | = $this->_build_params['text_encoding']; |
| 1397 | 1397 | } else if ($headers['Content-Type'] == 'text/html') { |
| 1398 | 1398 | // single-part message: add charset and encoding |
| 1399 | - $charset = 'charset=' . $this->_build_params['html_charset']; |
|
| 1399 | + $charset = 'charset='.$this->_build_params['html_charset']; |
|
| 1400 | 1400 | // place charset parameter in the same line, if possible |
| 1401 | 1401 | $headers['Content-Type'] |
| 1402 | 1402 | .= (strlen($charset) + 25 <= 76) ? "; $charset" : ";$eol $charset"; |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | ) { |
| 1412 | 1412 | $boundary = $m[1]; |
| 1413 | 1413 | } else { |
| 1414 | - $boundary = '=_' . md5(rand() . microtime()); |
|
| 1414 | + $boundary = '=_'.md5(rand().microtime()); |
|
| 1415 | 1415 | } |
| 1416 | 1416 | |
| 1417 | 1417 | $this->_build_params['boundary'] = $boundary; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | private function getPrivateProperty($instance, string $field) |
| 46 | 46 | { |
| 47 | - return (function (string $field) { |
|
| 47 | + return (function(string $field) { |
|
| 48 | 48 | return $this->$field; |
| 49 | 49 | })->call($instance, $field); |
| 50 | 50 | } |
@@ -301,7 +301,7 @@ |
||
| 301 | 301 | $settings = $this->settings; |
| 302 | 302 | |
| 303 | 303 | if ($settings && isset($settings['timezone'])) { |
| 304 | - $tzParameters = array_filter($method->getParameters(), function ($parameter) { |
|
| 304 | + $tzParameters = array_filter($method->getParameters(), function($parameter) { |
|
| 305 | 305 | return \in_array($parameter->getName(), ['tz', 'timezone'], true); |
| 306 | 306 | }); |
| 307 | 307 | |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | $date = new static(); |
| 607 | 607 | |
| 608 | 608 | if (static::hasMacro($method)) { |
| 609 | - return static::bindMacroContext(null, function () use (&$method, &$parameters, &$date) { |
|
| 609 | + return static::bindMacroContext(null, function() use (&$method, &$parameters, &$date) { |
|
| 610 | 610 | return $date->callMacro($method, $parameters); |
| 611 | 611 | }); |
| 612 | 612 | } |
@@ -931,8 +931,7 @@ discard block |
||
| 931 | 931 | |
| 932 | 932 | return $this->setOptions( |
| 933 | 933 | $state ? |
| 934 | - $this->options | $options : |
|
| 935 | - $this->options & ~$options |
|
| 934 | + $this->options | $options : $this->options & ~$options |
|
| 936 | 935 | ); |
| 937 | 936 | } |
| 938 | 937 | |
@@ -1144,7 +1143,7 @@ discard block |
||
| 1144 | 1143 | |
| 1145 | 1144 | $this->filters = array_values(array_filter( |
| 1146 | 1145 | $this->filters, |
| 1147 | - function ($tuple) use ($key, $filter) { |
|
| 1146 | + function($tuple) use ($key, $filter) { |
|
| 1148 | 1147 | return $tuple[$key] !== $filter; |
| 1149 | 1148 | } |
| 1150 | 1149 | )); |
@@ -1664,7 +1663,7 @@ discard block |
||
| 1664 | 1663 | public function __call($method, $parameters) |
| 1665 | 1664 | { |
| 1666 | 1665 | if (static::hasMacro($method)) { |
| 1667 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
| 1666 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
| 1668 | 1667 | return $this->callMacro($method, $parameters); |
| 1669 | 1668 | }); |
| 1670 | 1669 | } |
@@ -1914,7 +1913,7 @@ discard block |
||
| 1914 | 1913 | * |
| 1915 | 1914 | * @param callable $callback |
| 1916 | 1915 | */ |
| 1917 | - public function forEach(callable $callback) |
|
| 1916 | + public function forEach (callable $callback) |
|
| 1918 | 1917 | { |
| 1919 | 1918 | foreach ($this as $date) { |
| 1920 | 1919 | $callback($date); |
@@ -2368,7 +2367,7 @@ discard block |
||
| 2368 | 2367 | return [$method, array_shift($parameters)]; |
| 2369 | 2368 | } |
| 2370 | 2369 | |
| 2371 | - return [function ($date) use ($method, $parameters) { |
|
| 2370 | + return [function($date) use ($method, $parameters) { |
|
| 2372 | 2371 | return ([$date, $method])(...$parameters); |
| 2373 | 2372 | }, $method]; |
| 2374 | 2373 | } |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | $interval->localStrictModeEnabled = true; |
| 657 | 657 | |
| 658 | 658 | $result = static::hasMacro($method) |
| 659 | - ? static::bindMacroContext(null, function () use (&$method, &$parameters, &$interval) { |
|
| 659 | + ? static::bindMacroContext(null, function() use (&$method, &$parameters, &$interval) { |
|
| 660 | 660 | return $interval->callMacro($method, $parameters); |
| 661 | 661 | }) |
| 662 | 662 | : $interval->$method(...$parameters); |
@@ -746,9 +746,7 @@ discard block |
||
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | switch ($unit === 'µs' ? 'µs' : strtolower($unit)) { |
| 749 | - case 'millennia': |
|
| 750 | - case 'millennium': |
|
| 751 | - $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; |
|
| 749 | + case 'millennia' : case 'millennium' : $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; |
|
| 752 | 750 | |
| 753 | 751 | break; |
| 754 | 752 | |
@@ -1343,7 +1341,7 @@ discard block |
||
| 1343 | 1341 | public function __call($method, $parameters) |
| 1344 | 1342 | { |
| 1345 | 1343 | if (static::hasMacro($method)) { |
| 1346 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
| 1344 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
| 1347 | 1345 | return $this->callMacro($method, $parameters); |
| 1348 | 1346 | }); |
| 1349 | 1347 | } |
@@ -1410,7 +1408,7 @@ discard block |
||
| 1410 | 1408 | $minimumUnit = 's'; |
| 1411 | 1409 | $skip = []; |
| 1412 | 1410 | extract($this->getForHumansInitialVariables($syntax, $short)); |
| 1413 | - $skip = array_filter((array) $skip, static function ($value) { |
|
| 1411 | + $skip = array_filter((array) $skip, static function($value) { |
|
| 1414 | 1412 | return \is_string($value) && $value !== ''; |
| 1415 | 1413 | }); |
| 1416 | 1414 | |
@@ -1447,7 +1445,7 @@ discard block |
||
| 1447 | 1445 | $optionalSpace = ''; |
| 1448 | 1446 | } |
| 1449 | 1447 | |
| 1450 | - $join = function ($list) use ($default, $last) { |
|
| 1448 | + $join = function($list) use ($default, $last) { |
|
| 1451 | 1449 | if (\count($list) < 2) { |
| 1452 | 1450 | return implode('', $list); |
| 1453 | 1451 | } |
@@ -1464,7 +1462,7 @@ discard block |
||
| 1464 | 1462 | } |
| 1465 | 1463 | |
| 1466 | 1464 | $glue = $join; |
| 1467 | - $join = function ($list) use ($glue) { |
|
| 1465 | + $join = function($list) use ($glue) { |
|
| 1468 | 1466 | return implode($glue, $list); |
| 1469 | 1467 | }; |
| 1470 | 1468 | } |
@@ -1623,7 +1621,7 @@ discard block |
||
| 1623 | 1621 | /** @var \Symfony\Component\Translation\Translator $translator */ |
| 1624 | 1622 | $translator = $this->getLocalTranslator(); |
| 1625 | 1623 | |
| 1626 | - $handleDeclensions = function ($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { |
|
| 1624 | + $handleDeclensions = function($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { |
|
| 1627 | 1625 | if (!$absolute) { |
| 1628 | 1626 | $declensionMode = $declensionMode ?? $this->translate($transId.'_mode'); |
| 1629 | 1627 | |
@@ -1673,14 +1671,14 @@ discard block |
||
| 1673 | 1671 | } |
| 1674 | 1672 | |
| 1675 | 1673 | $diffIntervalArray = [ |
| 1676 | - ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], |
|
| 1677 | - ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], |
|
| 1678 | - ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], |
|
| 1679 | - ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], |
|
| 1680 | - ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], |
|
| 1681 | - ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], |
|
| 1682 | - ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], |
|
| 1683 | - ['value' => $intervalValues->milliseconds, 'unit' => 'millisecond', 'unitShort' => 'ms'], |
|
| 1674 | + ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], |
|
| 1675 | + ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], |
|
| 1676 | + ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], |
|
| 1677 | + ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], |
|
| 1678 | + ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], |
|
| 1679 | + ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], |
|
| 1680 | + ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], |
|
| 1681 | + ['value' => $intervalValues->milliseconds, 'unit' => 'millisecond', 'unitShort' => 'ms'], |
|
| 1684 | 1682 | ['value' => $intervalValues->microExcludeMilli, 'unit' => 'microsecond', 'unitShort' => 'µs'], |
| 1685 | 1683 | ]; |
| 1686 | 1684 | |
@@ -1699,7 +1697,7 @@ discard block |
||
| 1699 | 1697 | } |
| 1700 | 1698 | } |
| 1701 | 1699 | |
| 1702 | - $transChoice = function ($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { |
|
| 1700 | + $transChoice = function($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { |
|
| 1703 | 1701 | $count = $unitData['value']; |
| 1704 | 1702 | |
| 1705 | 1703 | if ($short) { |
@@ -2233,7 +2231,7 @@ discard block |
||
| 2233 | 2231 | |
| 2234 | 2232 | private function invertCascade(array $values) |
| 2235 | 2233 | { |
| 2236 | - return $this->set(array_map(function ($value) { |
|
| 2234 | + return $this->set(array_map(function($value) { |
|
| 2237 | 2235 | return -$value; |
| 2238 | 2236 | }, $values))->doCascade(true)->invert(); |
| 2239 | 2237 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | $search = rtrim(strtr($directory, '\\', '/'), '/'); |
| 138 | 138 | |
| 139 | - return $this->setDirectories(array_filter($this->getDirectories(), function ($item) use ($search) { |
|
| 139 | + return $this->setDirectories(array_filter($this->getDirectories(), function($item) use ($search) { |
|
| 140 | 140 | return rtrim(strtr($item, '\\', '/'), '/') !== $search; |
| 141 | 141 | })); |
| 142 | 142 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public function setLocale($locale) |
| 309 | 309 | { |
| 310 | - $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function ($matches) { |
|
| 310 | + $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function($matches) { |
|
| 311 | 311 | // _2-letters or YUE is a region, _3+-letters is a variant |
| 312 | 312 | $upper = strtoupper($matches[1]); |
| 313 | 313 | |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | $completeLocaleChunks = preg_split('/[_.-]+/', $completeLocale); |
| 335 | 335 | |
| 336 | - $getScore = function ($language) use ($completeLocaleChunks) { |
|
| 336 | + $getScore = function($language) use ($completeLocaleChunks) { |
|
| 337 | 337 | return self::compareChunkLists($completeLocaleChunks, preg_split('/[_.-]+/', $language)); |
| 338 | 338 | }; |
| 339 | 339 | |
| 340 | - usort($locales, function ($first, $second) use ($getScore) { |
|
| 340 | + usort($locales, function($first, $second) use ($getScore) { |
|
| 341 | 341 | return $getScore($second) <=> $getScore($first); |
| 342 | 342 | }); |
| 343 | 343 | |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $events = $this->app['events']; |
| 53 | 53 | |
| 54 | 54 | if ($this->isEventDispatcher($events)) { |
| 55 | - $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function () use ($service) { |
|
| 55 | + $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function() use ($service) { |
|
| 56 | 56 | $service->updateLocale(); |
| 57 | 57 | }); |
| 58 | 58 | } |
@@ -1922,13 +1922,13 @@ discard block |
||
| 1922 | 1922 | 'DD' => ['rawFormat', ['d']], |
| 1923 | 1923 | 'Do' => ['ordinal', ['day', 'D']], |
| 1924 | 1924 | 'd' => 'dayOfWeek', |
| 1925 | - 'dd' => function (CarbonInterface $date, $originalFormat = null) { |
|
| 1925 | + 'dd' => function(CarbonInterface $date, $originalFormat = null) { |
|
| 1926 | 1926 | return $date->getTranslatedMinDayName($originalFormat); |
| 1927 | 1927 | }, |
| 1928 | - 'ddd' => function (CarbonInterface $date, $originalFormat = null) { |
|
| 1928 | + 'ddd' => function(CarbonInterface $date, $originalFormat = null) { |
|
| 1929 | 1929 | return $date->getTranslatedShortDayName($originalFormat); |
| 1930 | 1930 | }, |
| 1931 | - 'dddd' => function (CarbonInterface $date, $originalFormat = null) { |
|
| 1931 | + 'dddd' => function(CarbonInterface $date, $originalFormat = null) { |
|
| 1932 | 1932 | return $date->getTranslatedDayName($originalFormat); |
| 1933 | 1933 | }, |
| 1934 | 1934 | 'DDD' => 'dayOfYear', |
@@ -1952,34 +1952,34 @@ discard block |
||
| 1952 | 1952 | 'A' => 'upperMeridiem', |
| 1953 | 1953 | 's' => 'second', |
| 1954 | 1954 | 'ss' => ['getPaddedUnit', ['second']], |
| 1955 | - 'S' => function (CarbonInterface $date) { |
|
| 1955 | + 'S' => function(CarbonInterface $date) { |
|
| 1956 | 1956 | return (string) floor($date->micro / 100000); |
| 1957 | 1957 | }, |
| 1958 | - 'SS' => function (CarbonInterface $date) { |
|
| 1958 | + 'SS' => function(CarbonInterface $date) { |
|
| 1959 | 1959 | return str_pad((string) floor($date->micro / 10000), 2, '0', STR_PAD_LEFT); |
| 1960 | 1960 | }, |
| 1961 | - 'SSS' => function (CarbonInterface $date) { |
|
| 1961 | + 'SSS' => function(CarbonInterface $date) { |
|
| 1962 | 1962 | return str_pad((string) floor($date->micro / 1000), 3, '0', STR_PAD_LEFT); |
| 1963 | 1963 | }, |
| 1964 | - 'SSSS' => function (CarbonInterface $date) { |
|
| 1964 | + 'SSSS' => function(CarbonInterface $date) { |
|
| 1965 | 1965 | return str_pad((string) floor($date->micro / 100), 4, '0', STR_PAD_LEFT); |
| 1966 | 1966 | }, |
| 1967 | - 'SSSSS' => function (CarbonInterface $date) { |
|
| 1967 | + 'SSSSS' => function(CarbonInterface $date) { |
|
| 1968 | 1968 | return str_pad((string) floor($date->micro / 10), 5, '0', STR_PAD_LEFT); |
| 1969 | 1969 | }, |
| 1970 | 1970 | 'SSSSSS' => ['getPaddedUnit', ['micro', 6]], |
| 1971 | - 'SSSSSSS' => function (CarbonInterface $date) { |
|
| 1971 | + 'SSSSSSS' => function(CarbonInterface $date) { |
|
| 1972 | 1972 | return str_pad((string) floor($date->micro * 10), 7, '0', STR_PAD_LEFT); |
| 1973 | 1973 | }, |
| 1974 | - 'SSSSSSSS' => function (CarbonInterface $date) { |
|
| 1974 | + 'SSSSSSSS' => function(CarbonInterface $date) { |
|
| 1975 | 1975 | return str_pad((string) floor($date->micro * 100), 8, '0', STR_PAD_LEFT); |
| 1976 | 1976 | }, |
| 1977 | - 'SSSSSSSSS' => function (CarbonInterface $date) { |
|
| 1977 | + 'SSSSSSSSS' => function(CarbonInterface $date) { |
|
| 1978 | 1978 | return str_pad((string) floor($date->micro * 1000), 9, '0', STR_PAD_LEFT); |
| 1979 | 1979 | }, |
| 1980 | 1980 | 'M' => 'month', |
| 1981 | 1981 | 'MM' => ['rawFormat', ['m']], |
| 1982 | - 'MMM' => function (CarbonInterface $date, $originalFormat = null) { |
|
| 1982 | + 'MMM' => function(CarbonInterface $date, $originalFormat = null) { |
|
| 1983 | 1983 | $month = $date->getTranslatedShortMonthName($originalFormat); |
| 1984 | 1984 | $suffix = $date->getTranslationMessage('mmm_suffix'); |
| 1985 | 1985 | if ($suffix && $month !== $date->monthName) { |
@@ -1988,7 +1988,7 @@ discard block |
||
| 1988 | 1988 | |
| 1989 | 1989 | return $month; |
| 1990 | 1990 | }, |
| 1991 | - 'MMMM' => function (CarbonInterface $date, $originalFormat = null) { |
|
| 1991 | + 'MMMM' => function(CarbonInterface $date, $originalFormat = null) { |
|
| 1992 | 1992 | return $date->getTranslatedMonthName($originalFormat); |
| 1993 | 1993 | }, |
| 1994 | 1994 | 'Mo' => ['ordinal', ['month', 'M']], |
@@ -2016,7 +2016,7 @@ discard block |
||
| 2016 | 2016 | 'YY' => ['rawFormat', ['y']], |
| 2017 | 2017 | 'YYYY' => ['getPaddedUnit', ['year', 4]], |
| 2018 | 2018 | 'YYYYY' => ['getPaddedUnit', ['year', 5]], |
| 2019 | - 'YYYYYY' => function (CarbonInterface $date) { |
|
| 2019 | + 'YYYYYY' => function(CarbonInterface $date) { |
|
| 2020 | 2020 | return ($date->year < 0 ? '' : '+').$date->getPaddedUnit('year', 6); |
| 2021 | 2021 | }, |
| 2022 | 2022 | 'z' => ['rawFormat', ['T']], |
@@ -2169,7 +2169,7 @@ discard block |
||
| 2169 | 2169 | $code = $match[0]; |
| 2170 | 2170 | $sequence = $formats[$code] ?? preg_replace_callback( |
| 2171 | 2171 | '/MMMM|MM|DD|dddd/', |
| 2172 | - function ($code) { |
|
| 2172 | + function($code) { |
|
| 2173 | 2173 | return mb_substr($code[0], 1); |
| 2174 | 2174 | }, |
| 2175 | 2175 | $formats[strtoupper($code)] ?? '' |
@@ -2229,7 +2229,7 @@ discard block |
||
| 2229 | 2229 | 'j' => true, |
| 2230 | 2230 | 'l' => 'dddd', |
| 2231 | 2231 | 'N' => true, |
| 2232 | - 'S' => function ($date) { |
|
| 2232 | + 'S' => function($date) { |
|
| 2233 | 2233 | $day = $date->rawFormat('j'); |
| 2234 | 2234 | |
| 2235 | 2235 | return str_replace((string) $day, '', $date->isoFormat('Do')); |
@@ -2375,7 +2375,7 @@ discard block |
||
| 2375 | 2375 | |
| 2376 | 2376 | protected static function executeStaticCallable($macro, ...$parameters) |
| 2377 | 2377 | { |
| 2378 | - return static::bindMacroContext(null, function () use (&$macro, &$parameters) { |
|
| 2378 | + return static::bindMacroContext(null, function() use (&$macro, &$parameters) { |
|
| 2379 | 2379 | if ($macro instanceof Closure) { |
| 2380 | 2380 | $boundMacro = @Closure::bind($macro, null, static::class); |
| 2381 | 2381 | |
@@ -2429,7 +2429,7 @@ discard block |
||
| 2429 | 2429 | $unit = static::singularUnit($unit); |
| 2430 | 2430 | $dateUnits = ['year', 'month', 'day']; |
| 2431 | 2431 | if (\in_array($unit, $dateUnits)) { |
| 2432 | - return $this->setDate(...array_map(function ($name) use ($unit, $value) { |
|
| 2432 | + return $this->setDate(...array_map(function($name) use ($unit, $value) { |
|
| 2433 | 2433 | return (int) ($name === $unit ? $value : $this->$name); |
| 2434 | 2434 | }, $dateUnits)); |
| 2435 | 2435 | } |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | $unit = 'micro'; |
| 2443 | 2443 | } |
| 2444 | 2444 | |
| 2445 | - return $this->setTime(...array_map(function ($name) use ($unit, $value) { |
|
| 2445 | + return $this->setTime(...array_map(function($name) use ($unit, $value) { |
|
| 2446 | 2446 | return (int) ($name === $unit ? $value : $this->$name); |
| 2447 | 2447 | }, $units)); |
| 2448 | 2448 | } |
@@ -2504,7 +2504,7 @@ discard block |
||
| 2504 | 2504 | |
| 2505 | 2505 | protected function executeCallableWithContext($macro, ...$parameters) |
| 2506 | 2506 | { |
| 2507 | - return static::bindMacroContext($this, function () use (&$macro, &$parameters) { |
|
| 2507 | + return static::bindMacroContext($this, function() use (&$macro, &$parameters) { |
|
| 2508 | 2508 | return $this->executeCallable($macro, ...$parameters); |
| 2509 | 2509 | }); |
| 2510 | 2510 | } |
@@ -2550,7 +2550,7 @@ discard block |
||
| 2550 | 2550 | $syntaxPattern = implode('|', array_keys($diffSyntaxModes)); |
| 2551 | 2551 | |
| 2552 | 2552 | if (preg_match("/^(?<size>$sizePattern)(?<syntax>$syntaxPattern)DiffForHumans$/", $method, $match)) { |
| 2553 | - $dates = array_filter($parameters, function ($parameter) { |
|
| 2553 | + $dates = array_filter($parameters, function($parameter) { |
|
| 2554 | 2554 | return $parameter instanceof DateTimeInterface; |
| 2555 | 2555 | }); |
| 2556 | 2556 | $other = null; |
@@ -2670,7 +2670,7 @@ discard block |
||
| 2670 | 2670 | } |
| 2671 | 2671 | } |
| 2672 | 2672 | |
| 2673 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
| 2673 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
| 2674 | 2674 | $macro = $this->getLocalMacro($method); |
| 2675 | 2675 | |
| 2676 | 2676 | if (!$macro) { |
@@ -226,14 +226,12 @@ |
||
| 226 | 226 | $startOfWeek = $this->avoidMutation()->startOfWeek($weekStartsAt); |
| 227 | 227 | |
| 228 | 228 | return $startOfWeek != $this ? |
| 229 | - $this->startOfWeek($weekStartsAt)->addWeek() : |
|
| 230 | - $this; |
|
| 229 | + $this->startOfWeek($weekStartsAt)->addWeek() : $this; |
|
| 231 | 230 | } |
| 232 | 231 | |
| 233 | 232 | $startOfWeek = $this->startOfWeek($weekStartsAt); |
| 234 | 233 | |
| 235 | 234 | return $startOfWeek != $this ? |
| 236 | - $startOfWeek->addWeek() : |
|
| 237 | - $this->avoidMutation(); |
|
| 235 | + $startOfWeek->addWeek() : $this->avoidMutation(); |
|
| 238 | 236 | } |
| 239 | 237 | } |