Text.php
2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
namespace Phalcon {
/**
* Phalcon\Text
*
* Provides utilities to work with texts
*/
abstract class Text {
const RANDOM_ALNUM = 0;
const RANDOM_ALPHA = 1;
const RANDOM_HEXDEC = 2;
const RANDOM_NUMERIC = 3;
const RANDOM_NOZERO = 4;
/**
* Converts strings to camelize style
*
*<code>
* echo \Phalcon\Text::camelize('coco_bongo'); //CocoBongo
*</code>
*
* @param string $str
* @return string
*/
public static function camelize($str){ }
/**
* Uncamelize strings which are camelized
*
*<code>
* echo \Phalcon\Text::camelize('CocoBongo'); //coco_bongo
*</code>
*
* @param string $str
* @return string
*/
public static function uncamelize($str){ }
/**
* Adds a number to a string or increment that number if it already is defined
*
*<code>
* echo \Phalcon\Text::increment("a"); // "a_1"
* echo \Phalcon\Text::increment("a_1"); // "a_2"
*</code>
*
* @param string $str
* @param string $separator
* @return string
*/
public static function increment($str, $separator=null){ }
/**
* Generates a random string based on the given type. Type is one of the RANDOM_* constants
*
*<code>
* echo \Phalcon\Text::random(Phalcon\Text::RANDOM_ALNUM); //"aloiwkqz"
*</code>
*
* @param int $type
* @param int $length
* @return string
*/
public static function random($type, $length=null){ }
/**
* Check if a string starts with a given string
*
*<code>
* echo \Phalcon\Text::startsWith("Hello", "He"); // true
* echo \Phalcon\Text::startsWith("Hello", "he"); // false
* echo \Phalcon\Text::startsWith("Hello", "he", false); // true
*</code>
*
* @param string $str
* @param string $start
* @param boolean $ignoreCase
* @return boolean
*/
public static function startsWith($str, $start, $ignoreCase=null){ }
/**
* Check if a string ends with a given string
*
*<code>
* echo \Phalcon\Text::endsWith("Hello", "llo"); // true
* echo \Phalcon\Text::endsWith("Hello", "LLO"); // false
* echo \Phalcon\Text::endsWith("Hello", "LLO", false); // true
*</code>
*
* @param string $str
* @param string $end
* @param boolean $ignoreCase
* @return boolean
*/
public static function endsWith($str, $end, $ignoreCase=null){ }
/**
* Lowercases a string, this function makes use of the mbstring extension if available
*
* @param string $str
* @return string
*/
public static function lower($str){ }
/**
* Uppercases a string, this function makes use of the mbstring extension if available
*
* @param string $str
* @return string
*/
public static function upper($str){ }
}
}