GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CFPHPAyuda   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 88
rs 10
c 0
b 0
f 0
wmc 12
lcom 1
cbo 1

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A enviarCorreo() 0 3 1
A filtroEmail() 0 10 2
A rangoTexto() 0 5 1
A Redireccion() 0 5 2
A redireccionUrl() 0 5 1
A redireccionUrlMsj() 0 7 1
A redireccion_() 0 4 1
A redirect() 0 12 1
A filtrarEntero() 0 5 1
1
<?php
2
3
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the MIT license. For more information, see
18
 * @category   
19
 * @package    sistema/ayudantes
20
 * @copyright  Copyright (c) 2006 - 2014 webcol.net (http://www.webcol.net/calima)
21
 * @license	https://github.com/webcol/Calima/blob/master/LICENSE	MIT
22
 * @version	##BETA 1.0##, ##2014 - 2015##
23
 * <http://www.calimaframework.com>.
24
 */
25
26
namespace Sistema\Ayudantes;
27
28
29
30
class CFPHPAyuda {
31
    
32
    
33
    private $_sesion;
34
    //Email
35
    
36
    public function __construct() {
37
        //parent::__construct();
38
    
39
    $this->_sesion=new \Sistema\Nucleo\CFSesion();
40
    }
41
    public function enviarCorreo($para, $titulo= 'Asunto', $mensaje= 'cuerpo del correo'){
42
        return mail($para, $titulo, $mensaje);
43
    }
44
    
45
    
46
     // filtros Email
47
    
48
    function filtroEmail($email){
49
        if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)){
50
            echo "E-Mail no es valido";
51
        }
52
        else
53
        {
54
            echo "E-Mail es valido";
55
        }
56
        
57
    }
58
    
59
    //cadenas
60
    
61
    function rangoTexto($texto, $inicio, $cantidad){
62
        
63
        return $limite= substr($texto, $inicio, $cantidad); 
64
        
65
    }
66
    
67
    //Redirecionar
68
    
69
    function Redireccion($url, $permanent = false){
70
    header('Location: ' . $url, true, $permanent ? 301 : 302);
71
72
    exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The method Redireccion() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
73
    }
74
    
75
    function redireccionUrl($url){
76
        $url=Cf_BASE_URL.$url;
77
    header('Location: ' . $url);
78
    exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The method redireccionUrl() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
79
    }
80
    
81
    function redireccionUrlMsj($controlador){
0 ignored issues
show
Coding Style introduced by
redireccionUrlMsj uses the super-global variable $_SESSION which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
82
        $this->_sesion->iniciarSesion('_s', false);
83
        $_SESSION[error_ingreso]='Error en el intento de ingreso';
84
        $controlador=Cf_BASE_URL.$controlador;
85
    header('Location: ' . $controlador);
86
    exit();
0 ignored issues
show
Coding Style Compatibility introduced by
The method redireccionUrlMsj() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
87
    }
88
    
89
    function redireccion_($url, $statusCode = 303){
90
    header('Location: ' . $url, true, $statusCode);
91
    die();
0 ignored issues
show
Coding Style Compatibility introduced by
The method redireccion_() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
92
    }
93
    
94
    function redirect($controller,$method = "index",$args = array())
95
{
96
    global $core; /* Guess Obviously */
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
97
98
    $location = $core->Cf_BASE_URL . "/" . $controller . "/" . $method . "/" . implode("/",$args);
99
100
    /*
101
        * Use @header to redirect the page:
102
    */
103
    header("Location: " . $location);
104
    exit;
0 ignored issues
show
Coding Style Compatibility introduced by
The method redirect() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
105
}
106
    
107
    
108
    
109
    //texto
110
    public function filtrarEntero($int){
111
        
112
       return filter_var($int, FILTER_VALIDATE_INT);
113
       
114
    }
115
    
116
   
117
}
118