PluginProbe
Media Cloud Sync / 1.2.6
Media Cloud Sync v1.2.6
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / google / brick / math / src / Exception / NumberFormatException.php

NumberFormatException.php in Media Cloud Sync 1.2.6, at includes/sdk/google/brick/math/src/Exception/NumberFormatException.php

32 lines 811 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace Dudlewebs\WPMCS\Brick\Math\Exception;
5
6 /**
7 * Exception thrown when attempting to create a number from a string with an invalid format.
8 */
9 class NumberFormatException extends MathException
10 {
11 /**
12 * @param string $char The failing character.
13 *
14 * @return NumberFormatException
15 *
16 * @psalm-pure
17 */
18 public static function charNotInAlphabet(string $char): self
19 {
20 $ord = \ord($char);
21 if ($ord < 32 || $ord > 126) {
22 $char = \strtoupper(\dechex($ord));
23 if ($ord < 10) {
24 $char = '0' . $char;
25 }
26 } else {
27 $char = '"' . $char . '"';
28 }
29 return new self(sprintf('Char %s is not a valid character in the given alphabet.', $char));
30 }
31 }
32