Pārlūkot izejas kodu

removed unnecessary stuff in business

develop
Robin Thoni 8 gadus atpakaļ
vecāks
revīzija
52aa535eab
1 mainītis faili ar 0 papildinājumiem un 74 dzēšanām
  1. 0
    74
      src/Utils/Business/LuBusiness.php

+ 0
- 74
src/Utils/Business/LuBusiness.php Parādīt failu

@@ -6,54 +6,6 @@ use Luticate\Utils\Dbo\LuDbo;
6 6
 use Luticate\Utils\LuDataAccess;
7 7
 
8 8
 abstract class LuBusiness {
9
-    public static $parameters = array();
10
-
11
-    /**
12
-     * @param string $name
13
-     * @param mixed  $default
14
-     * @return mixed
15
-     */
16
-    public static function getParam($name, $default = null)
17
-    {
18
-        return array_key_exists($name, self::$parameters) ? self::$parameters[$name] : $default;
19
-    }
20
-
21
-    /**
22
-     * @param string[] $params
23
-     * @return bool
24
-     */
25
-    public static function hasParam(array $params)
26
-    {
27
-        foreach ($params as $p) {
28
-            if (!array_key_exists($p, self::$parameters)) {
29
-                return false;
30
-            }
31
-        }
32
-        return true;
33
-    }
34
-
35
-    /**
36
-     * @param string $param
37
-     * @param mixed $validate
38
-     * @return string
39
-     */
40
-    public static function checkParam($param, $validate = null)
41
-    {
42
-        if (!self::hasParam(array($param)))
43
-            abort(400, 'Missing parameter: ' . $param);
44
-        $value = self::getParam($param);
45
-        if ($validate != null) {
46
-            if (is_callable($validate)) {
47
-                $validate = $validate($value);
48
-            }
49
-            else {
50
-                $validate = preg_match($validate, $value);
51
-            }
52
-            if (!$validate)
53
-                abort(400, 'Bad parameter value: ' . $param);
54
-        }
55
-        return $value;
56
-    }
57 9
 
58 10
     /**
59 11
      * @param string $reason
@@ -82,32 +34,6 @@ abstract class LuBusiness {
82 34
         throw new LuBusinessException($reason, 400);
83 35
     }
84 36
 
85
-    /**
86
-     * @param $param string
87
-     * @param $values string[]
88
-     * @return string
89
-     */
90
-    public static function getParamInArray($param, $values)
91
-    {
92
-        $value = self::getParam($param);
93
-        if (is_null($value) || !in_array($value, $values))
94
-            $value = $values[0];
95
-        return $value;
96
-    }
97
-
98
-    /**
99
-     * @param $param string
100
-     * @param $default int
101
-     * @return int
102
-     */
103
-    public static function getParamInt($param, $default = 0)
104
-    {
105
-        $value = self::getParam($param);
106
-        if (!is_null($value) && is_numeric($value))
107
-            return (int)$value;
108
-        return $default;
109
-    }
110
-
111 37
     /**
112 38
      * @param $id int
113 39
      * @return LuDbo|null

Notiek ielāde…
Atcelt
Saglabāt