Passed
Push — main ( efe307...afac3c )
by Nelson
01:24
created
pin/libs/config.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,19 +7,19 @@
 block discarded – undo
7 7
  */
8 8
 class Config
9 9
 {
10
-	private static $_db_config = [
11
-		'dsn' => "mysql:host=DB_HOST;dbname=DB_NAME;charset=utf8",
12
-		'user' => "USER_NAME",
13
-		'password' => "USER_PASSWORD",
14
-		'parameters' => [
15
-			PDO::ATTR_PERSISTENT => true, 
16
-		    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
17
-		]
18
-	];
10
+    private static $_db_config = [
11
+        'dsn' => "mysql:host=DB_HOST;dbname=DB_NAME;charset=utf8",
12
+        'user' => "USER_NAME",
13
+        'password' => "USER_PASSWORD",
14
+        'parameters' => [
15
+            PDO::ATTR_PERSISTENT => true, 
16
+            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
17
+        ]
18
+    ];
19 19
 
20
-	public static function getDbConfig()
21
-	{
22
-		return self::$_db_config;
23
-	}
20
+    public static function getDbConfig()
21
+    {
22
+        return self::$_db_config;
23
+    }
24 24
 
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
pin/libs/query_builder.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
      */
119 119
     public function __toString() {
120 120
         $sql = 'SELECT ' . (empty($this->_columns) ? '*' : $this->_columns) . 
121
-        	   ' ' . 'FROM ' . $this->_table;
121
+                ' ' . 'FROM ' . $this->_table;
122 122
 
123 123
         $check_for = [
124 124
             '_joins',
Please login to merge, or discard this patch.
pin/libs/template.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -7,62 +7,62 @@
 block discarded – undo
7 7
  */
8 8
 class Template 
9 9
 {
10
-	/**
11
-	 * @var string
12
-	 */
13
-	private $_template = 'default';
10
+    /**
11
+     * @var string
12
+     */
13
+    private $_template = 'default';
14 14
 
15
-	/**
16
-	 * @var array
17
-	 */
18
-	private $_properties = [];
15
+    /**
16
+     * @var array
17
+     */
18
+    private $_properties = [];
19 19
 
20
-	/**
21
-	 * Método para setear propiedades
22
-	 * @param string $prop
23
-	 * @param mixed $value
24
-	 */
25
-	public function set($prop, $value)
26
-	{
27
-		$this->_properties[$prop] = $value;
28
-	}
20
+    /**
21
+     * Método para setear propiedades
22
+     * @param string $prop
23
+     * @param mixed $value
24
+     */
25
+    public function set($prop, $value)
26
+    {
27
+        $this->_properties[$prop] = $value;
28
+    }
29 29
 
30 30
 
31
-	/**
32
-	 * Método para obtener propiedades
33
-	 * @param string $prop
34
-	 * @return mixed|null
35
-	 */
36
-	public function get($prop)
37
-	{
38
-		return isset($this->_properties[$prop]) ? $this->_properties[$prop] : null;
39
-	}
31
+    /**
32
+     * Método para obtener propiedades
33
+     * @param string $prop
34
+     * @return mixed|null
35
+     */
36
+    public function get($prop)
37
+    {
38
+        return isset($this->_properties[$prop]) ? $this->_properties[$prop] : null;
39
+    }
40 40
 
41
-	/**
42
-	 * Permite setear el template manualmente
43
-	 * @param string $template
44
-	 */
45
-	public function setTemplate($template)
46
-	{
47
-		$this->_template = $template;
48
-	}
41
+    /**
42
+     * Permite setear el template manualmente
43
+     * @param string $template
44
+     */
45
+    public function setTemplate($template)
46
+    {
47
+        $this->_template = $template;
48
+    }
49 49
 
50 50
 
51
-	/**
52
-	 * Permite renderizar una vista dentro de la plantilla
53
-	 * @param string $view
54
-	 */
55
-	public function render($view)
56
-	{
57
-		$template_file = PIN_PATH . 'templates' . DS . $this->_template . '.phtml';
51
+    /**
52
+     * Permite renderizar una vista dentro de la plantilla
53
+     * @param string $view
54
+     */
55
+    public function render($view)
56
+    {
57
+        $template_file = PIN_PATH . 'templates' . DS . $this->_template . '.phtml';
58 58
 		
59
-		ob_start();
60
-		load_view($view, $this->_properties);
61
-		$yield = ob_get_clean();
62
-		if (file_exists($template_file)) {
63
-			include $template_file;
64
-		} else {
65
-			throw new Exception("Archivo de template no encontrado $template_file", 1);
66
-		}
67
-	}
59
+        ob_start();
60
+        load_view($view, $this->_properties);
61
+        $yield = ob_get_clean();
62
+        if (file_exists($template_file)) {
63
+            include $template_file;
64
+        } else {
65
+            throw new Exception("Archivo de template no encontrado $template_file", 1);
66
+        }
67
+    }
68 68
 }
69 69
\ No newline at end of file
Please login to merge, or discard this patch.
pin/pages/login.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,17 +2,17 @@
 block discarded – undo
2 2
 	
3 3
 function signin()
4 4
 {
5
-	Session::set("is_logged_in", true);
6
-	Session::set("flash", "Bienvenido!");
7
-	redirect_to("");
8
-	return;
5
+    Session::set("is_logged_in", true);
6
+    Session::set("flash", "Bienvenido!");
7
+    redirect_to("");
8
+    return;
9 9
 }
10 10
 
11 11
 function signout()
12 12
 {
13
-	Session::destroy();
14
-	Session::set("flash", "Adios!");
15
-	redirect_to("");
16
-	return;
13
+    Session::destroy();
14
+    Session::set("flash", "Adios!");
15
+    redirect_to("");
16
+    return;
17 17
 }
18 18
 
Please login to merge, or discard this patch.
pin/pages/default.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 function index()
4 4
 {
5
-	$template = new Template();
6
-	$template->set("saludo", "Saludo interno");
7
-	$template->render("default/index");
5
+    $template = new Template();
6
+    $template->set("saludo", "Saludo interno");
7
+    $template->render("default/index");
8 8
 }
9 9
 
10 10
 function redirigir()
11 11
 {
12
-	return redirect_to("page/show");
12
+    return redirect_to("page/show");
13 13
 }
Please login to merge, or discard this patch.
pin/pages/page.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -3,32 +3,32 @@
 block discarded – undo
3 3
 
4 4
 function page_initializer()
5 5
 {
6
-	if (Session::get("is_logged_in") !== true) {
7
-		//ir a la pagina inicial
8
-		Session::set("flash", "Debe iniciar sesión para acceder al recurso *<i>page</i>*");
9
-		redirect_to("");
10
-		return;
11
-	}
6
+    if (Session::get("is_logged_in") !== true) {
7
+        //ir a la pagina inicial
8
+        Session::set("flash", "Debe iniciar sesión para acceder al recurso *<i>page</i>*");
9
+        redirect_to("");
10
+        return;
11
+    }
12 12
 }
13 13
 
14 14
 function show($slug = '')
15 15
 {
16
-	$template = new Template();
17
-	$template->set("slug", $slug);
18
-	$template->render("page/show");
16
+    $template = new Template();
17
+    $template->set("slug", $slug);
18
+    $template->render("page/show");
19 19
 }
20 20
 
21 21
 function edit()
22 22
 {
23
-	$template = new Template();
24
-	$template->render("page/edit");	
23
+    $template = new Template();
24
+    $template->render("page/edit");	
25 25
 }
26 26
 
27 27
 function update()
28 28
 {
29
-	$template = new Template();
30
-	Session::set("flash", "Página actualizada correctamente");
31
-	$template->render("page/edit");	
29
+    $template = new Template();
30
+    Session::set("flash", "Página actualizada correctamente");
31
+    $template->render("page/edit");	
32 32
 }
33 33
 
34 34
 
Please login to merge, or discard this patch.
load.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -2,60 +2,60 @@  discard block
 block discarded – undo
2 2
 
3 3
 function load_file($file, $extension, $base_dir, $classification, $parameters = null)
4 4
 {
5
-	if (isset($parameters) && is_array($parameters)) {
6
-		extract($parameters);
7
-	}
8
-	if (file_exists($base_dir . $file . $extension)) {	
9
-		require $base_dir . $file . $extension;
10
-	} else {
11
-		throw (new Exception("$classification <b>$file</b> no existe!"));	
12
-	}
5
+    if (isset($parameters) && is_array($parameters)) {
6
+        extract($parameters);
7
+    }
8
+    if (file_exists($base_dir . $file . $extension)) {	
9
+        require $base_dir . $file . $extension;
10
+    } else {
11
+        throw (new Exception("$classification <b>$file</b> no existe!"));	
12
+    }
13 13
 }
14 14
 
15 15
 function load_lib($lib)
16 16
 {
17
-	load_file($lib, ".php", PIN_PATH . 'libs' . DS, "Librería");
17
+    load_file($lib, ".php", PIN_PATH . 'libs' . DS, "Librería");
18 18
 }
19 19
 
20 20
 function load_config($config)
21 21
 {
22
-	load_file($config, ".php", PIN_PATH . 'config' . DS, "Configuración");
22
+    load_file($config, ".php", PIN_PATH . 'config' . DS, "Configuración");
23 23
 }
24 24
 
25 25
 
26 26
 function load_helper($helper)
27 27
 {
28
-	load_file($helper, ".php", PIN_PATH . 'helpers' . DS, "Helper");
28
+    load_file($helper, ".php", PIN_PATH . 'helpers' . DS, "Helper");
29 29
 }
30 30
 
31 31
 function load_view($view, array $parameters = null)
32 32
 {
33
-	load_file($view, ".phtml", PIN_PATH . 'views' . DS, "Vista", $parameters);
33
+    load_file($view, ".phtml", PIN_PATH . 'views' . DS, "Vista", $parameters);
34 34
 }
35 35
 
36 36
 function load_partial($partial, array $parameters = null)
37 37
 {
38
-	load_file($partial, ".phtml", PIN_PATH . 'partials'. DS , "Parcial", $parameters);		
38
+    load_file($partial, ".phtml", PIN_PATH . 'partials'. DS , "Parcial", $parameters);		
39 39
 }
40 40
 
41 41
 function redirect_to($url)
42 42
 {
43
-	$url = PUBLIC_PATH . $url;
44
-	header("Location: $url", true, 301);
43
+    $url = PUBLIC_PATH . $url;
44
+    header("Location: $url", true, 301);
45 45
 }
46 46
 
47 47
 //implementar autoloader para clases
48 48
 //espera que las clases se definan en PascalCase y los archivos
49 49
 //usen snake_case. Ejemplo class QueryBuilder, archivo query_builder.php
50 50
 spl_autoload_register(function($className){
51
-	$file_name = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className));
52
-	$file = PIN_PATH . 'libs' . DS . $file_name . '.php';
53
-	if (file_exists($file)) {
54
-		require_once $file;
55
-		return;
56
-	} else {
57
-		throw new Exception("$className no existe en $file", 1);		
58
-	}
51
+    $file_name = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className));
52
+    $file = PIN_PATH . 'libs' . DS . $file_name . '.php';
53
+    if (file_exists($file)) {
54
+        require_once $file;
55
+        return;
56
+    } else {
57
+        throw new Exception("$className no existe en $file", 1);		
58
+    }
59 59
 });
60 60
 
61 61
 
@@ -79,42 +79,42 @@  discard block
 block discarded – undo
79 79
 
80 80
     if (error_reporting() !== 0) {
81 81
         echo "<div style='padding: 40px;'>";
82
-		echo "<h1>Fatal error</h1>";
82
+        echo "<h1>Fatal error</h1>";
83 83
         echo "<p>Uncaught exception: '" . get_class($exception) . "'</p>";
84 84
         echo "<p>Message: '" . $exception->getMessage() . "'</p>";
85 85
         echo "<p>Stack trace:<pre>" . $exception->getTraceAsString() . "</pre></p>";
86 86
         echo "<p>Thrown in '" . $exception->getFile() . "' on line " . $exception->getLine() . "</p>";
87
-		echo "</div>";
87
+        echo "</div>";
88 88
     }
89 89
 }
90 90
 
91 91
 
92 92
 function load_page_from_url($url)
93 93
 {
94
-	$content = explode('/', $url);
94
+    $content = explode('/', $url);
95 95
     //quitar el elemento inicial vacio
96 96
     array_shift($content); 
97 97
 	
98
-	$page = !empty($content[0]) ? trim($content[0]) : 'default';
99
-	array_shift($content); 
98
+    $page = !empty($content[0]) ? trim($content[0]) : 'default';
99
+    array_shift($content); 
100 100
 	
101
-	if (file_exists(PIN_PATH . 'pages' . DS . $page . '.php')) {
102
-		require PIN_PATH . 'pages' . DS . $page . '.php';
103
-	} else {
104
-		throw (new Exception("La página <b>$page</b> no existe!"));
105
-	}
101
+    if (file_exists(PIN_PATH . 'pages' . DS . $page . '.php')) {
102
+        require PIN_PATH . 'pages' . DS . $page . '.php';
103
+    } else {
104
+        throw (new Exception("La página <b>$page</b> no existe!"));
105
+    }
106 106
 	
107
-	$function_to_be_load = !empty($content[0]) ? trim($content[0]) : 'index';
108
-	array_shift($content); 
107
+    $function_to_be_load = !empty($content[0]) ? trim($content[0]) : 'index';
108
+    array_shift($content); 
109 109
 
110
-	if (function_exists("page_initializer")) {
111
-		call_user_func("page_initializer");
112
-	}
110
+    if (function_exists("page_initializer")) {
111
+        call_user_func("page_initializer");
112
+    }
113 113
 	
114
-	if (function_exists($function_to_be_load)) {
115
-		call_user_func_array($function_to_be_load, $content);		
116
-	} else {
117
-		throw (new Exception("La función <b>$function_to_be_load</b> no existe en la página <b>$page</b>!"));
118
-	}
114
+    if (function_exists($function_to_be_load)) {
115
+        call_user_func_array($function_to_be_load, $content);		
116
+    } else {
117
+        throw (new Exception("La función <b>$function_to_be_load</b> no existe en la página <b>$page</b>!"));
118
+    }
119 119
     
120 120
 }
121 121
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 function load_partial($partial, array $parameters = null)
37 37
 {
38
-	load_file($partial, ".phtml", PIN_PATH . 'partials'. DS , "Parcial", $parameters);		
38
+	load_file($partial, ".phtml", PIN_PATH . 'partials' . DS, "Parcial", $parameters);		
39 39
 }
40 40
 
41 41
 function redirect_to($url)
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 //implementar autoloader para clases
48 48
 //espera que las clases se definan en PascalCase y los archivos
49 49
 //usen snake_case. Ejemplo class QueryBuilder, archivo query_builder.php
50
-spl_autoload_register(function($className){
50
+spl_autoload_register(function($className) {
51 51
 	$file_name = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className));
52 52
 	$file = PIN_PATH . 'libs' . DS . $file_name . '.php';
53 53
 	if (file_exists($file)) {
Please login to merge, or discard this patch.