diff options
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php')
-rw-r--r-- | vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php deleted file mode 100644 index fab6ac2a..00000000 --- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Form\Extension\Validator\Util; | ||
13 | |||
14 | /** | ||
15 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
16 | */ | ||
17 | class ServerParams | ||
18 | { | ||
19 | /** | ||
20 | * Returns maximum post size in bytes. | ||
21 | * | ||
22 | * @return null|integer The maximum post size in bytes | ||
23 | */ | ||
24 | public function getPostMaxSize() | ||
25 | { | ||
26 | $iniMax = $this->getNormalizedIniPostMaxSize(); | ||
27 | |||
28 | if ('' === $iniMax) { | ||
29 | return null; | ||
30 | } | ||
31 | |||
32 | if (preg_match('#^\+?(0X?)?(.*?)([KMG]?)$#', $iniMax, $match)) { | ||
33 | $shifts = array('' => 0, 'K' => 10, 'M' => 20, 'G' => 30); | ||
34 | $bases = array('' => 10, '0' => 8, '0X' => 16); | ||
35 | |||
36 | return intval($match[2], $bases[$match[1]]) << $shifts[$match[3]]; | ||
37 | } | ||
38 | |||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * Returns the normalized "post_max_size" ini setting. | ||
44 | * | ||
45 | * @return string | ||
46 | */ | ||
47 | public function getNormalizedIniPostMaxSize() | ||
48 | { | ||
49 | return strtoupper(trim(ini_get('post_max_size'))); | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * Returns the content length of the request. | ||
54 | * | ||
55 | * @return mixed The request content length. | ||
56 | */ | ||
57 | public function getContentLength() | ||
58 | { | ||
59 | return isset($_SERVER['CONTENT_LENGTH']) | ||
60 | ? (int) $_SERVER['CONTENT_LENGTH'] | ||
61 | : null; | ||
62 | } | ||
63 | |||
64 | } | ||