1 | <?php |
||
34 | class Utils |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * Removes the first ocurrence of a substring in a string |
||
39 | * @param string $string String |
||
40 | * @param string $substrToRemove Substring to remove |
||
41 | * @return string String without $substrToRemove or $string if $substrToRemove hasn't been found |
||
42 | */ |
||
43 | public static function removeSubstring($string, $substrToRemove) { |
||
59 | |||
60 | /** |
||
61 | * Check if a substring is in a string |
||
62 | * @param string $string String |
||
63 | * @param string $strToSearch Substring to search |
||
64 | * @return boolean TRUE on success,FALSE otherwise |
||
65 | */ |
||
66 | public static function inString($string, $strToSearch) { |
||
69 | |||
70 | /** |
||
71 | * Adds a trailing slash to a given path. |
||
72 | * |
||
73 | * This method does not add the trailing slash if is already set. |
||
74 | * |
||
75 | * @param string $path Path |
||
76 | * @return string |
||
77 | */ |
||
78 | public static function addTrailingSlash($path) { |
||
86 | |||
87 | /** |
||
88 | * Replace all the backslash for slashes |
||
89 | * |
||
90 | * @param string $path Path |
||
91 | * @return string Converted path |
||
92 | */ |
||
93 | public static function filterPath($path) { |
||
96 | |||
97 | /** |
||
98 | * Replace repeated substring. |
||
99 | * |
||
100 | * @param string $string String |
||
101 | * @param string $substring Substring |
||
102 | * @return string |
||
103 | */ |
||
104 | public static function removeDouble($string, $substring) { |
||
107 | |||
108 | /** |
||
109 | * Slices a file into name and extension |
||
110 | * |
||
111 | * @param string $filePath File path |
||
112 | * @return array Associative array with 2 keys: name and extension |
||
113 | */ |
||
114 | public static function getSlicedFile($filePath) { |
||
128 | |||
129 | public static function startsWith($string, $substring) { |
||
132 | } |
||
133 |