@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace ParagonIE\Sodium\Core\Curve25519\Ge; |
3 | 3 | |
4 | -class P1p1 extends \ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 |
|
5 | -{ |
|
4 | +class P1p1 extends \ParagonIE_Sodium_Core_Curve25519_Ge_P1p1 { |
|
6 | 5 | |
7 | 6 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace ParagonIE\Sodium\Core\Curve25519\Ge; |
3 | 3 | |
4 | -class Cached extends \ParagonIE_Sodium_Core_Curve25519_Ge_Cached |
|
5 | -{ |
|
4 | +class Cached extends \ParagonIE_Sodium_Core_Curve25519_Ge_Cached { |
|
6 | 5 | |
7 | 6 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace ParagonIE\Sodium\Core\Curve25519\Ge; |
3 | 3 | |
4 | -class Precomp extends \ParagonIE_Sodium_Core_Curve25519_Ge_Precomp |
|
5 | -{ |
|
4 | +class Precomp extends \ParagonIE_Sodium_Core_Curve25519_Ge_Precomp { |
|
6 | 5 | |
7 | 6 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace ParagonIE\Sodium\Core; |
3 | 3 | |
4 | -class Curve25519 extends \ParagonIE_Sodium_Core_Curve25519 |
|
5 | -{ |
|
4 | +class Curve25519 extends \ParagonIE_Sodium_Core_Curve25519 { |
|
6 | 5 | |
7 | 6 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace ParagonIE\Sodium\Core\ChaCha20; |
3 | 3 | |
4 | -class Ctx extends \ParagonIE_Sodium_Core_ChaCha20_Ctx |
|
5 | -{ |
|
4 | +class Ctx extends \ParagonIE_Sodium_Core_ChaCha20_Ctx { |
|
6 | 5 | |
7 | 6 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace ParagonIE\Sodium\Core\ChaCha20; |
3 | 3 | |
4 | -class IetfCtx extends \ParagonIE_Sodium_Core_ChaCha20_IetfCtx |
|
5 | -{ |
|
4 | +class IetfCtx extends \ParagonIE_Sodium_Core_ChaCha20_IetfCtx { |
|
6 | 5 | |
7 | 6 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | require_once 'autoload.php'; |
4 | -define('DO_PEDANTIC_TEST', true); |
|
4 | +define( 'DO_PEDANTIC_TEST', true ); |
|
5 | 5 | |
6 | 6 | ParagonIE_Sodium_Compat::$fastMult = true; |
@@ -1,72 +1,72 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (PHP_VERSION_ID < 70000) { |
4 | - if (!is_callable('sodiumCompatAutoloader')) { |
|
5 | - /** |
|
6 | - * Sodium_Compat autoloader. |
|
7 | - * |
|
8 | - * @param string $class Class name to be autoloaded. |
|
9 | - * |
|
10 | - * @return bool Stop autoloading? |
|
11 | - */ |
|
12 | - function sodiumCompatAutoloader($class) |
|
13 | - { |
|
14 | - $namespace = 'ParagonIE_Sodium_'; |
|
15 | - // Does the class use the namespace prefix? |
|
16 | - $len = strlen($namespace); |
|
17 | - if (strncmp($namespace, $class, $len) !== 0) { |
|
18 | - // no, move to the next registered autoloader |
|
19 | - return false; |
|
20 | - } |
|
4 | + if (!is_callable('sodiumCompatAutoloader')) { |
|
5 | + /** |
|
6 | + * Sodium_Compat autoloader. |
|
7 | + * |
|
8 | + * @param string $class Class name to be autoloaded. |
|
9 | + * |
|
10 | + * @return bool Stop autoloading? |
|
11 | + */ |
|
12 | + function sodiumCompatAutoloader($class) |
|
13 | + { |
|
14 | + $namespace = 'ParagonIE_Sodium_'; |
|
15 | + // Does the class use the namespace prefix? |
|
16 | + $len = strlen($namespace); |
|
17 | + if (strncmp($namespace, $class, $len) !== 0) { |
|
18 | + // no, move to the next registered autoloader |
|
19 | + return false; |
|
20 | + } |
|
21 | 21 | |
22 | - // Get the relative class name |
|
23 | - $relative_class = substr($class, $len); |
|
22 | + // Get the relative class name |
|
23 | + $relative_class = substr($class, $len); |
|
24 | 24 | |
25 | - // Replace the namespace prefix with the base directory, replace namespace |
|
26 | - // separators with directory separators in the relative class name, append |
|
27 | - // with .php |
|
28 | - $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php'; |
|
29 | - // if the file exists, require it |
|
30 | - if (file_exists($file)) { |
|
31 | - require_once $file; |
|
32 | - return true; |
|
33 | - } |
|
34 | - return false; |
|
35 | - } |
|
25 | + // Replace the namespace prefix with the base directory, replace namespace |
|
26 | + // separators with directory separators in the relative class name, append |
|
27 | + // with .php |
|
28 | + $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php'; |
|
29 | + // if the file exists, require it |
|
30 | + if (file_exists($file)) { |
|
31 | + require_once $file; |
|
32 | + return true; |
|
33 | + } |
|
34 | + return false; |
|
35 | + } |
|
36 | 36 | |
37 | - // Now that we have an autoloader, let's register it! |
|
38 | - spl_autoload_register('sodiumCompatAutoloader'); |
|
39 | - } |
|
37 | + // Now that we have an autoloader, let's register it! |
|
38 | + spl_autoload_register('sodiumCompatAutoloader'); |
|
39 | + } |
|
40 | 40 | } else { |
41 | - require_once dirname(__FILE__) . '/autoload-php7.php'; |
|
41 | + require_once dirname(__FILE__) . '/autoload-php7.php'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /* Explicitly, always load the Compat class: */ |
45 | 45 | require_once dirname(__FILE__) . '/src/Compat.php'; |
46 | 46 | |
47 | 47 | if (!class_exists('SodiumException', false)) { |
48 | - require_once dirname(__FILE__) . '/src/SodiumException.php'; |
|
48 | + require_once dirname(__FILE__) . '/src/SodiumException.php'; |
|
49 | 49 | } |
50 | 50 | if (PHP_VERSION_ID >= 50300) { |
51 | - // Namespaces didn't exist before 5.3.0, so don't even try to use this |
|
52 | - // unless PHP >= 5.3.0 |
|
53 | - require_once dirname(__FILE__) . '/lib/namespaced.php'; |
|
54 | - require_once dirname(__FILE__) . '/lib/sodium_compat.php'; |
|
51 | + // Namespaces didn't exist before 5.3.0, so don't even try to use this |
|
52 | + // unless PHP >= 5.3.0 |
|
53 | + require_once dirname(__FILE__) . '/lib/namespaced.php'; |
|
54 | + require_once dirname(__FILE__) . '/lib/sodium_compat.php'; |
|
55 | 55 | } else { |
56 | - require_once dirname(__FILE__) . '/src/PHP52/SplFixedArray.php'; |
|
56 | + require_once dirname(__FILE__) . '/src/PHP52/SplFixedArray.php'; |
|
57 | 57 | } |
58 | 58 | if (PHP_VERSION_ID < 70200 || !extension_loaded('sodium')) { |
59 | - if (PHP_VERSION_ID >= 50300 && !defined('SODIUM_CRYPTO_SCALARMULT_BYTES')) { |
|
60 | - require_once dirname(__FILE__) . '/lib/php72compat_const.php'; |
|
61 | - } |
|
62 | - if (PHP_VERSION_ID >= 70000) { |
|
63 | - assert(class_exists('ParagonIE_Sodium_Compat'), 'Possible filesystem/autoloader bug?'); |
|
64 | - } else { |
|
65 | - assert(class_exists('ParagonIE_Sodium_Compat')); |
|
66 | - } |
|
67 | - require_once(dirname(__FILE__) . '/lib/php72compat.php'); |
|
59 | + if (PHP_VERSION_ID >= 50300 && !defined('SODIUM_CRYPTO_SCALARMULT_BYTES')) { |
|
60 | + require_once dirname(__FILE__) . '/lib/php72compat_const.php'; |
|
61 | + } |
|
62 | + if (PHP_VERSION_ID >= 70000) { |
|
63 | + assert(class_exists('ParagonIE_Sodium_Compat'), 'Possible filesystem/autoloader bug?'); |
|
64 | + } else { |
|
65 | + assert(class_exists('ParagonIE_Sodium_Compat')); |
|
66 | + } |
|
67 | + require_once(dirname(__FILE__) . '/lib/php72compat.php'); |
|
68 | 68 | } elseif (!function_exists('sodium_crypto_stream_xchacha20_xor')) { |
69 | - // Older versions of {PHP, ext/sodium} will not define these |
|
70 | - require_once(dirname(__FILE__) . '/lib/php72compat.php'); |
|
69 | + // Older versions of {PHP, ext/sodium} will not define these |
|
70 | + require_once(dirname(__FILE__) . '/lib/php72compat.php'); |
|
71 | 71 | } |
72 | 72 | require_once(dirname(__FILE__) . '/lib/ristretto255.php'); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (PHP_VERSION_ID < 70000) { |
|
4 | - if (!is_callable('sodiumCompatAutoloader')) { |
|
3 | +if ( PHP_VERSION_ID < 70000 ) { |
|
4 | + if ( ! is_callable( 'sodiumCompatAutoloader' ) ) { |
|
5 | 5 | /** |
6 | 6 | * Sodium_Compat autoloader. |
7 | 7 | * |
@@ -9,25 +9,25 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @return bool Stop autoloading? |
11 | 11 | */ |
12 | - function sodiumCompatAutoloader($class) |
|
12 | + function sodiumCompatAutoloader( $class ) |
|
13 | 13 | { |
14 | 14 | $namespace = 'ParagonIE_Sodium_'; |
15 | 15 | // Does the class use the namespace prefix? |
16 | - $len = strlen($namespace); |
|
17 | - if (strncmp($namespace, $class, $len) !== 0) { |
|
16 | + $len = strlen( $namespace ); |
|
17 | + if ( strncmp( $namespace, $class, $len ) !== 0 ) { |
|
18 | 18 | // no, move to the next registered autoloader |
19 | 19 | return false; |
20 | 20 | } |
21 | 21 | |
22 | 22 | // Get the relative class name |
23 | - $relative_class = substr($class, $len); |
|
23 | + $relative_class = substr( $class, $len ); |
|
24 | 24 | |
25 | 25 | // Replace the namespace prefix with the base directory, replace namespace |
26 | 26 | // separators with directory separators in the relative class name, append |
27 | 27 | // with .php |
28 | - $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php'; |
|
28 | + $file = dirname( __FILE__ ) . '/src/' . str_replace( '_', '/', $relative_class ) . '.php'; |
|
29 | 29 | // if the file exists, require it |
30 | - if (file_exists($file)) { |
|
30 | + if ( file_exists( $file ) ) { |
|
31 | 31 | require_once $file; |
32 | 32 | return true; |
33 | 33 | } |
@@ -35,38 +35,38 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | // Now that we have an autoloader, let's register it! |
38 | - spl_autoload_register('sodiumCompatAutoloader'); |
|
38 | + spl_autoload_register( 'sodiumCompatAutoloader' ); |
|
39 | 39 | } |
40 | 40 | } else { |
41 | - require_once dirname(__FILE__) . '/autoload-php7.php'; |
|
41 | + require_once dirname( __FILE__ ) . '/autoload-php7.php'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /* Explicitly, always load the Compat class: */ |
45 | -require_once dirname(__FILE__) . '/src/Compat.php'; |
|
45 | +require_once dirname( __FILE__ ) . '/src/Compat.php'; |
|
46 | 46 | |
47 | -if (!class_exists('SodiumException', false)) { |
|
48 | - require_once dirname(__FILE__) . '/src/SodiumException.php'; |
|
47 | +if ( ! class_exists( 'SodiumException', false ) ) { |
|
48 | + require_once dirname( __FILE__ ) . '/src/SodiumException.php'; |
|
49 | 49 | } |
50 | -if (PHP_VERSION_ID >= 50300) { |
|
50 | +if ( PHP_VERSION_ID >= 50300 ) { |
|
51 | 51 | // Namespaces didn't exist before 5.3.0, so don't even try to use this |
52 | 52 | // unless PHP >= 5.3.0 |
53 | - require_once dirname(__FILE__) . '/lib/namespaced.php'; |
|
54 | - require_once dirname(__FILE__) . '/lib/sodium_compat.php'; |
|
53 | + require_once dirname( __FILE__ ) . '/lib/namespaced.php'; |
|
54 | + require_once dirname( __FILE__ ) . '/lib/sodium_compat.php'; |
|
55 | 55 | } else { |
56 | - require_once dirname(__FILE__) . '/src/PHP52/SplFixedArray.php'; |
|
56 | + require_once dirname( __FILE__ ) . '/src/PHP52/SplFixedArray.php'; |
|
57 | 57 | } |
58 | -if (PHP_VERSION_ID < 70200 || !extension_loaded('sodium')) { |
|
59 | - if (PHP_VERSION_ID >= 50300 && !defined('SODIUM_CRYPTO_SCALARMULT_BYTES')) { |
|
60 | - require_once dirname(__FILE__) . '/lib/php72compat_const.php'; |
|
58 | +if ( PHP_VERSION_ID < 70200 || ! extension_loaded( 'sodium' ) ) { |
|
59 | + if ( PHP_VERSION_ID >= 50300 && ! defined( 'SODIUM_CRYPTO_SCALARMULT_BYTES' ) ) { |
|
60 | + require_once dirname( __FILE__ ) . '/lib/php72compat_const.php'; |
|
61 | 61 | } |
62 | - if (PHP_VERSION_ID >= 70000) { |
|
63 | - assert(class_exists('ParagonIE_Sodium_Compat'), 'Possible filesystem/autoloader bug?'); |
|
62 | + if ( PHP_VERSION_ID >= 70000 ) { |
|
63 | + assert( class_exists( 'ParagonIE_Sodium_Compat' ), 'Possible filesystem/autoloader bug?' ); |
|
64 | 64 | } else { |
65 | - assert(class_exists('ParagonIE_Sodium_Compat')); |
|
65 | + assert( class_exists( 'ParagonIE_Sodium_Compat' ) ); |
|
66 | 66 | } |
67 | - require_once(dirname(__FILE__) . '/lib/php72compat.php'); |
|
68 | -} elseif (!function_exists('sodium_crypto_stream_xchacha20_xor')) { |
|
67 | + require_once( dirname( __FILE__ ) . '/lib/php72compat.php' ); |
|
68 | +} elseif ( ! function_exists( 'sodium_crypto_stream_xchacha20_xor' ) ) { |
|
69 | 69 | // Older versions of {PHP, ext/sodium} will not define these |
70 | - require_once(dirname(__FILE__) . '/lib/php72compat.php'); |
|
70 | + require_once( dirname( __FILE__ ) . '/lib/php72compat.php' ); |
|
71 | 71 | } |
72 | -require_once(dirname(__FILE__) . '/lib/ristretto255.php'); |
|
72 | +require_once( dirname( __FILE__ ) . '/lib/ristretto255.php' ); |
@@ -9,8 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @return bool Stop autoloading? |
11 | 11 | */ |
12 | - function sodiumCompatAutoloader($class) |
|
13 | - { |
|
12 | + function sodiumCompatAutoloader($class) { |
|
14 | 13 | $namespace = 'ParagonIE_Sodium_'; |
15 | 14 | // Does the class use the namespace prefix? |
16 | 15 | $len = strlen($namespace); |
@@ -3,29 +3,29 @@ |
||
3 | 3 | This file should only ever be loaded on PHP 7+ |
4 | 4 | */ |
5 | 5 | if (PHP_VERSION_ID < 70000) { |
6 | - return; |
|
6 | + return; |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | spl_autoload_register(function ($class) { |
10 | - $namespace = 'ParagonIE_Sodium_'; |
|
11 | - // Does the class use the namespace prefix? |
|
12 | - $len = strlen($namespace); |
|
13 | - if (strncmp($namespace, $class, $len) !== 0) { |
|
14 | - // no, move to the next registered autoloader |
|
15 | - return false; |
|
16 | - } |
|
10 | + $namespace = 'ParagonIE_Sodium_'; |
|
11 | + // Does the class use the namespace prefix? |
|
12 | + $len = strlen($namespace); |
|
13 | + if (strncmp($namespace, $class, $len) !== 0) { |
|
14 | + // no, move to the next registered autoloader |
|
15 | + return false; |
|
16 | + } |
|
17 | 17 | |
18 | - // Get the relative class name |
|
19 | - $relative_class = substr($class, $len); |
|
18 | + // Get the relative class name |
|
19 | + $relative_class = substr($class, $len); |
|
20 | 20 | |
21 | - // Replace the namespace prefix with the base directory, replace namespace |
|
22 | - // separators with directory separators in the relative class name, append |
|
23 | - // with .php |
|
24 | - $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php'; |
|
25 | - // if the file exists, require it |
|
26 | - if (file_exists($file)) { |
|
27 | - require_once $file; |
|
28 | - return true; |
|
29 | - } |
|
30 | - return false; |
|
21 | + // Replace the namespace prefix with the base directory, replace namespace |
|
22 | + // separators with directory separators in the relative class name, append |
|
23 | + // with .php |
|
24 | + $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php'; |
|
25 | + // if the file exists, require it |
|
26 | + if (file_exists($file)) { |
|
27 | + require_once $file; |
|
28 | + return true; |
|
29 | + } |
|
30 | + return false; |
|
31 | 31 | }); |
@@ -2,28 +2,28 @@ |
||
2 | 2 | /* |
3 | 3 | This file should only ever be loaded on PHP 7+ |
4 | 4 | */ |
5 | -if (PHP_VERSION_ID < 70000) { |
|
5 | +if ( PHP_VERSION_ID < 70000 ) { |
|
6 | 6 | return; |
7 | 7 | } |
8 | 8 | |
9 | -spl_autoload_register(function ($class) { |
|
9 | +spl_autoload_register( function( $class ) { |
|
10 | 10 | $namespace = 'ParagonIE_Sodium_'; |
11 | 11 | // Does the class use the namespace prefix? |
12 | - $len = strlen($namespace); |
|
13 | - if (strncmp($namespace, $class, $len) !== 0) { |
|
12 | + $len = strlen( $namespace ); |
|
13 | + if ( strncmp( $namespace, $class, $len ) !== 0 ) { |
|
14 | 14 | // no, move to the next registered autoloader |
15 | 15 | return false; |
16 | 16 | } |
17 | 17 | |
18 | 18 | // Get the relative class name |
19 | - $relative_class = substr($class, $len); |
|
19 | + $relative_class = substr( $class, $len ); |
|
20 | 20 | |
21 | 21 | // Replace the namespace prefix with the base directory, replace namespace |
22 | 22 | // separators with directory separators in the relative class name, append |
23 | 23 | // with .php |
24 | - $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php'; |
|
24 | + $file = dirname( __FILE__ ) . '/src/' . str_replace( '_', '/', $relative_class ) . '.php'; |
|
25 | 25 | // if the file exists, require it |
26 | - if (file_exists($file)) { |
|
26 | + if ( file_exists( $file ) ) { |
|
27 | 27 | require_once $file; |
28 | 28 | return true; |
29 | 29 | } |