Completed
Push — master ( 9a341d...f10304 )
by Thierry
01:44
created

Validator   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 62
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A validateFunction() 0 4 1
A validateEvent() 0 4 1
A validateClass() 0 4 1
A validateMethod() 0 4 1
A validateUploadedFile() 0 4 1
1
<?php
2
3
/**
4
 * Validator.php - Trait for validation functions
5
 *
6
 * @package jaxon-core
7
 * @author Thierry Feuzeu <[email protected]>
8
 * @copyright 2016 Thierry Feuzeu <[email protected]>
9
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
10
 * @link https://github.com/jaxon-php/jaxon-core
11
 */
12
13
namespace Jaxon\Utils\Traits;
14
15
use Jaxon\Utils\Container;
16
17
trait Validator
18
{
19
    /**
20
     * Validate a function name
21
     *
22
     * @param string        $sName            The function name
23
     *
24
     * @return bool            True if the function name is valid, and false if not
25
     */
26
    public function validateFunction($sName)
27
    {
28
        return Container::getInstance()->getValidator()->validateFunction($sName);
29
    }
30
31
    /**
32
     * Validate an event name
33
     *
34
     * @param string        $sName            The event name
35
     *
36
     * @return bool            True if the event name is valid, and false if not
37
     */
38
    public function validateEvent($sName)
39
    {
40
        return Container::getInstance()->getValidator()->validateEvent($sName);
41
    }
42
43
    /**
44
     * Validate a class name
45
     *
46
     * @param string        $sName            The class name
47
     *
48
     * @return bool            True if the class name is valid, and false if not
49
     */
50
    public function validateClass($sName)
51
    {
52
        return Container::getInstance()->getValidator()->validateClass($sName);
53
    }
54
55
    /**
56
     * Validate a method name
57
     *
58
     * @param string        $sName            The function name
59
     *
60
     * @return bool            True if the method name is valid, and false if not
61
     */
62
    public function validateMethod($sName)
63
    {
64
        return Container::getInstance()->getValidator()->validateMethod($sName);
65
    }
66
67
    /**
68
     * Validate an uploaded file
69
     *
70
     * @param array         $aUploadedFile    The file data received in the $_FILES array
71
     *
72
     * @return bool            True if the file data are valid, and false if not
73
     */
74
    public function validateUploadedFile(array $aUploadedFile)
75
    {
76
        return Container::getInstance()->getValidator()->validateUploadedFile($aUploadedFile);
77
    }
78
}
79