Completed
Push — develop ( f0d100...266ee2 )
by J.D.
04:14
created
src/library/sodium_compat/lib/namespaced.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (PHP_VERSION_ID < 50300) {
4
-    return;
4
+	return;
5 5
 }
6 6
 
7 7
 /*
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
  * $x = Compat::crypto_aead_xchacha20poly1305_encrypt(...$args);
20 20
  */
21 21
 spl_autoload_register(function ($class) {
22
-    if ($class[0] === '\\') {
23
-        $class = substr($class, 1);
24
-    }
25
-    $namespace = 'ParagonIE\\Sodium';
26
-    // Does the class use the namespace prefix?
27
-    $len = strlen($namespace);
28
-    if (strncmp($namespace, $class, $len) !== 0) {
29
-        // no, move to the next registered autoloader
30
-        return false;
31
-    }
22
+	if ($class[0] === '\\') {
23
+		$class = substr($class, 1);
24
+	}
25
+	$namespace = 'ParagonIE\\Sodium';
26
+	// Does the class use the namespace prefix?
27
+	$len = strlen($namespace);
28
+	if (strncmp($namespace, $class, $len) !== 0) {
29
+		// no, move to the next registered autoloader
30
+		return false;
31
+	}
32 32
 
33
-    // Get the relative class name
34
-    $relative_class = substr($class, $len);
33
+	// Get the relative class name
34
+	$relative_class = substr($class, $len);
35 35
 
36
-    // Replace the namespace prefix with the base directory, replace namespace
37
-    // separators with directory separators in the relative class name, append
38
-    // with .php
39
-    $file = dirname(__DIR__) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php';
40
-    // if the file exists, require it
41
-    if (file_exists($file)) {
42
-        require_once $file;
43
-        return true;
44
-    }
45
-    return false;
36
+	// Replace the namespace prefix with the base directory, replace namespace
37
+	// separators with directory separators in the relative class name, append
38
+	// with .php
39
+	$file = dirname(__DIR__) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php';
40
+	// if the file exists, require it
41
+	if (file_exists($file)) {
42
+		require_once $file;
43
+		return true;
44
+	}
45
+	return false;
46 46
 });
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (PHP_VERSION_ID < 50300) {
3
+if ( PHP_VERSION_ID < 50300 ) {
4 4
     return;
5 5
 }
6 6
 
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * $x = Compat::crypto_aead_xchacha20poly1305_encrypt(...$args);
20 20
  */
21
-spl_autoload_register(function ($class) {
22
-    if ($class[0] === '\\') {
23
-        $class = substr($class, 1);
21
+spl_autoload_register( function ( $class ) {
22
+    if ( $class[0] === '\\' ) {
23
+        $class = substr( $class, 1 );
24 24
     }
25 25
     $namespace = 'ParagonIE\\Sodium';
26 26
     // Does the class use the namespace prefix?
27
-    $len = strlen($namespace);
28
-    if (strncmp($namespace, $class, $len) !== 0) {
27
+    $len = strlen( $namespace );
28
+    if ( strncmp( $namespace, $class, $len ) !== 0 ) {
29 29
         // no, move to the next registered autoloader
30 30
         return false;
31 31
     }
32 32
 
33 33
     // Get the relative class name
34
-    $relative_class = substr($class, $len);
34
+    $relative_class = substr( $class, $len );
35 35
 
36 36
     // Replace the namespace prefix with the base directory, replace namespace
37 37
     // separators with directory separators in the relative class name, append
38 38
     // with .php
39
-    $file = dirname(__DIR__) . '/namespaced/' . str_replace('\\', '/', $relative_class) . '.php';
39
+    $file = dirname( __DIR__ ) . '/namespaced/' . str_replace( '\\', '/', $relative_class ) . '.php';
40 40
     // if the file exists, require it
41
-    if (file_exists($file)) {
41
+    if ( file_exists( $file ) ) {
42 42
         require_once $file;
43 43
         return true;
44 44
     }
Please login to merge, or discard this patch.
src/library/sodium_compat/autoload.php 3 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (!is_callable('sodiumCompatAutoloader')) {
4
-    /**
5
-     * Sodium_Compat autoloader.
6
-     *
7
-     * @param string $class Class name to be autoloaded.
8
-     *
9
-     * @return bool         Stop autoloading?
10
-     */
11
-    function sodiumCompatAutoader($class)
12
-    {
13
-        $namespace = 'ParagonIE_Sodium_';
14
-        // Does the class use the namespace prefix?
15
-        $len = strlen($namespace);
16
-        if (strncmp($namespace, $class, $len) !== 0) {
17
-            // no, move to the next registered autoloader
18
-            return false;
19
-        }
4
+	/**
5
+	 * Sodium_Compat autoloader.
6
+	 *
7
+	 * @param string $class Class name to be autoloaded.
8
+	 *
9
+	 * @return bool         Stop autoloading?
10
+	 */
11
+	function sodiumCompatAutoader($class)
12
+	{
13
+		$namespace = 'ParagonIE_Sodium_';
14
+		// Does the class use the namespace prefix?
15
+		$len = strlen($namespace);
16
+		if (strncmp($namespace, $class, $len) !== 0) {
17
+			// no, move to the next registered autoloader
18
+			return false;
19
+		}
20 20
 
21
-        // Get the relative class name
22
-        $relative_class = substr($class, $len);
21
+		// Get the relative class name
22
+		$relative_class = substr($class, $len);
23 23
 
24
-        // Replace the namespace prefix with the base directory, replace namespace
25
-        // separators with directory separators in the relative class name, append
26
-        // with .php
27
-        $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php';
28
-        // if the file exists, require it
29
-        if (file_exists($file)) {
30
-            require_once $file;
31
-            return true;
32
-        }
33
-        return false;
34
-    }
24
+		// Replace the namespace prefix with the base directory, replace namespace
25
+		// separators with directory separators in the relative class name, append
26
+		// with .php
27
+		$file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php';
28
+		// if the file exists, require it
29
+		if (file_exists($file)) {
30
+			require_once $file;
31
+			return true;
32
+		}
33
+		return false;
34
+	}
35 35
 
36
-    // Now that we have an autoloader, let's register it!
37
-    spl_autoload_register('sodiumCompatAutoader');
36
+	// Now that we have an autoloader, let's register it!
37
+	spl_autoload_register('sodiumCompatAutoader');
38 38
 }
39 39
 
40 40
 if (PHP_VERSION_ID >= 50300) {
41
-    // Namespaces didn't exist before 5.3.0, so don't even try to use this
42
-    // unless PHP >= 5.3.0
43
-    require_once dirname(__FILE__) . '/lib/namespaced.php';
44
-    require_once dirname(__FILE__) . '/lib/sodium_compat.php';
41
+	// Namespaces didn't exist before 5.3.0, so don't even try to use this
42
+	// unless PHP >= 5.3.0
43
+	require_once dirname(__FILE__) . '/lib/namespaced.php';
44
+	require_once dirname(__FILE__) . '/lib/sodium_compat.php';
45 45
 }
46 46
 if (PHP_VERSION_ID < 70200 || !extension_loaded('sodium')) {
47
-    require_once dirname(__FILE__) . '/lib/php72compat.php';
47
+	require_once dirname(__FILE__) . '/lib/php72compat.php';
48 48
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!is_callable('sodiumCompatAutoloader')) {
3
+if ( ! is_callable( 'sodiumCompatAutoloader' ) ) {
4 4
     /**
5 5
      * Sodium_Compat autoloader.
6 6
      *
@@ -8,25 +8,25 @@  discard block
 block discarded – undo
8 8
      *
9 9
      * @return bool         Stop autoloading?
10 10
      */
11
-    function sodiumCompatAutoader($class)
11
+    function sodiumCompatAutoader( $class )
12 12
     {
13 13
         $namespace = 'ParagonIE_Sodium_';
14 14
         // Does the class use the namespace prefix?
15
-        $len = strlen($namespace);
16
-        if (strncmp($namespace, $class, $len) !== 0) {
15
+        $len = strlen( $namespace );
16
+        if ( strncmp( $namespace, $class, $len ) !== 0 ) {
17 17
             // no, move to the next registered autoloader
18 18
             return false;
19 19
         }
20 20
 
21 21
         // Get the relative class name
22
-        $relative_class = substr($class, $len);
22
+        $relative_class = substr( $class, $len );
23 23
 
24 24
         // Replace the namespace prefix with the base directory, replace namespace
25 25
         // separators with directory separators in the relative class name, append
26 26
         // with .php
27
-        $file = dirname(__FILE__) . '/src/' . str_replace('_', '/', $relative_class) . '.php';
27
+        $file = dirname( __FILE__ ) . '/src/' . str_replace( '_', '/', $relative_class ) . '.php';
28 28
         // if the file exists, require it
29
-        if (file_exists($file)) {
29
+        if ( file_exists( $file ) ) {
30 30
             require_once $file;
31 31
             return true;
32 32
         }
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
     }
35 35
 
36 36
     // Now that we have an autoloader, let's register it!
37
-    spl_autoload_register('sodiumCompatAutoader');
37
+    spl_autoload_register( 'sodiumCompatAutoader' );
38 38
 }
39 39
 
40
-if (PHP_VERSION_ID >= 50300) {
40
+if ( PHP_VERSION_ID >= 50300 ) {
41 41
     // Namespaces didn't exist before 5.3.0, so don't even try to use this
42 42
     // unless PHP >= 5.3.0
43
-    require_once dirname(__FILE__) . '/lib/namespaced.php';
44
-    require_once dirname(__FILE__) . '/lib/sodium_compat.php';
43
+    require_once dirname( __FILE__ ) . '/lib/namespaced.php';
44
+    require_once dirname( __FILE__ ) . '/lib/sodium_compat.php';
45 45
 }
46
-if (PHP_VERSION_ID < 70200 || !extension_loaded('sodium')) {
47
-    require_once dirname(__FILE__) . '/lib/php72compat.php';
46
+if ( PHP_VERSION_ID < 70200 || ! extension_loaded( 'sodium' ) ) {
47
+    require_once dirname( __FILE__ ) . '/lib/php72compat.php';
48 48
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
      *
9 9
      * @return bool         Stop autoloading?
10 10
      */
11
-    function sodiumCompatAutoader($class)
12
-    {
11
+    function sodiumCompatAutoader($class) {
13 12
         $namespace = 'ParagonIE_Sodium_';
14 13
         // Does the class use the namespace prefix?
15 14
         $len = strlen($namespace);
Please login to merge, or discard this patch.