PluginProbe
Media Cloud Sync / 1.3.11
Media Cloud Sync v1.3.11
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.3.11, at includes/sdk/google/brick/math/src/Exception/NumberFormatException.php

34 lines 950 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\GCP\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 public static function invalidFormat(string $value) : self
12 {
13 return new self(\sprintf('The given value "%s" does not represent a valid number.', $value));
14 }
15 /**
16 * @param string $char The failing character.
17 *
18 * @psalm-pure
19 */
20 public static function charNotInAlphabet(string $char) : self
21 {
22 $ord = \ord($char);
23 if ($ord < 32 || $ord > 126) {
24 $char = \strtoupper(\dechex($ord));
25 if ($ord < 10) {
26 $char = '0' . $char;
27 }
28 } else {
29 $char = '"' . $char . '"';
30 }
31 return new self(\sprintf('Char %s is not a valid character in the given alphabet.', $char));
32 }
33 }
34