Skip to content

Commit bae2d5e

Browse files
committed
fix static method declarations
git-svn-id: http://svn.php.net/repository/pear/packages/Text_LanguageDetect/trunk@322327 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent ba99bec commit bae2d5e

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

Text/LanguageDetect.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ function _trigram($text)
482482
* @param array $arr array of trgram
483483
* @return array ranks of trigrams
484484
*/
485-
function _arr_rank(&$arr)
485+
function _arr_rank($arr)
486486
{
487487

488488
// sorts alphabetically first as a standard way of breaking rank ties
@@ -950,7 +950,7 @@ function unicodeBlockName($unicode) {
950950
// assume it is being passed a utf8 char, so convert it
951951

952952
// input check
953-
if ($this->utf8strlen($unicode) > 1) {
953+
if (self::utf8strlen($unicode) > 1) {
954954
throw new Text_LanguageDetect_Exception(
955955
'Pass this function only a single char',
956956
Text_LanguageDetect_Exception::PARAM_TYPE
@@ -1489,12 +1489,11 @@ function clusteredSearch($str)
14891489
*
14901490
* Returns the numbers of characters (not bytes) in a utf8 string
14911491
*
1492-
* @static
14931492
* @access public
14941493
* @param string $str string to get the length of
14951494
* @return int number of chars
14961495
*/
1497-
function utf8strlen($str)
1496+
static function utf8strlen($str)
14981497
{
14991498
// utf8_decode() will convert unknown chars to '?', which is actually
15001499
// ideal for counting.
@@ -1565,12 +1564,12 @@ function _utf8char2unicode($char) {
15651564
* $counter will be incremeted by the number of bytes in the char.
15661565
*
15671566
* @access private
1568-
* @param string &$str the string being iterated over
1567+
* @param string $str the string being iterated over
15691568
* @param int &$counter the iterator, will increment by reference
15701569
* @param bool $special_convert whether to do special conversions
15711570
* @return char the next (possibly multi-byte) char from $counter
15721571
*/
1573-
function _next_char(&$str, &$counter, $special_convert = false)
1572+
static function _next_char($str, &$counter, $special_convert = false)
15741573
{
15751574

15761575
$char = $str{$counter++};

Text/LanguageDetect/Parser.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,10 @@ function Text_LanguageDetect_Parser($string) {
109109
/**
110110
* Returns true if a string is suitable for parsing
111111
*
112-
* @static
113-
* @access public
114112
* @param string $str input string to test
115113
* @return bool true if acceptable, false if not
116114
*/
117-
function validateString($str) {
115+
public static function validateString($str) {
118116
if (!empty($str) && strlen($str) > 3 && preg_match('/\S/', $str)) {
119117
return true;
120118
} else {

tests/Text_LanguageDetectTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
set_include_path(
88
__DIR__ . '/../' . PATH_SEPARATOR . get_include_path()
99
);
10+
error_reporting(E_ALL|E_STRICT);
1011

1112
require_once 'Text/LanguageDetect.php';
1213
require_once 'PHPUnit/Framework/TestCase.php';

0 commit comments

Comments
 (0)