Completed
Push — scrutinizer ( c2ef4a )
by Fabio
21:50
created
demos/quickstart/protected/index/Zend/Search/Lucene/Search/QueryToken.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
      * IndexReader constructor needs token type and token text as a parameters.
75 75
      *
76 76
      * @param $tokType integer
77
-     * @param $tokText string
77
+     * @param string $tokText string
78 78
      */
79 79
     public function __construct($tokType, $tokText)
80 80
     {
Please login to merge, or discard this patch.
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -31,72 +31,72 @@
 block discarded – undo
31 31
  */
32 32
 class Zend_Search_Lucene_Search_QueryToken
33 33
 {
34
-    /**
35
-     * Token type Word.
36
-     */
37
-    const TOKTYPE_WORD = 0;
34
+	/**
35
+	 * Token type Word.
36
+	 */
37
+	const TOKTYPE_WORD = 0;
38 38
 
39
-    /**
40
-     * Token type Field.
41
-     * Field indicator in 'field:word' pair
42
-     */
43
-    const TOKTYPE_FIELD = 1;
39
+	/**
40
+	 * Token type Field.
41
+	 * Field indicator in 'field:word' pair
42
+	 */
43
+	const TOKTYPE_FIELD = 1;
44 44
 
45
-    /**
46
-     * Token type Sign.
47
-     * '+' (required) or '-' (absentee) sign
48
-     */
49
-    const TOKTYPE_SIGN = 2;
45
+	/**
46
+	 * Token type Sign.
47
+	 * '+' (required) or '-' (absentee) sign
48
+	 */
49
+	const TOKTYPE_SIGN = 2;
50 50
 
51
-    /**
52
-     * Token type Bracket.
53
-     * '(' or ')'
54
-     */
55
-    const TOKTYPE_BRACKET = 3;
51
+	/**
52
+	 * Token type Bracket.
53
+	 * '(' or ')'
54
+	 */
55
+	const TOKTYPE_BRACKET = 3;
56 56
 
57 57
 
58
-    /**
59
-     * Token type.
60
-     *
61
-     * @var integer
62
-     */
63
-    public $type;
58
+	/**
59
+	 * Token type.
60
+	 *
61
+	 * @var integer
62
+	 */
63
+	public $type;
64 64
 
65
-    /**
66
-     * Token text.
67
-     *
68
-     * @var integer
69
-     */
70
-    public $text;
65
+	/**
66
+	 * Token text.
67
+	 *
68
+	 * @var integer
69
+	 */
70
+	public $text;
71 71
 
72 72
 
73
-    /**
74
-     * IndexReader constructor needs token type and token text as a parameters.
75
-     *
76
-     * @param $tokType integer
77
-     * @param $tokText string
78
-     */
79
-    public function __construct($tokType, $tokText)
80
-    {
81
-        switch ($tokType) {
82
-            case self::TOKTYPE_BRACKET:
83
-                // fall through to the next case
84
-            case self::TOKTYPE_FIELD:
85
-                // fall through to the next case
86
-            case self::TOKTYPE_SIGN:
87
-                // fall through to the next case
88
-            case self::TOKTYPE_WORD:
89
-                break;
90
-            default:
91
-                throw new Zend_Search_Lucene_Exception("Unrecognized token type \"$tokType\".");
92
-        }
73
+	/**
74
+	 * IndexReader constructor needs token type and token text as a parameters.
75
+	 *
76
+	 * @param $tokType integer
77
+	 * @param $tokText string
78
+	 */
79
+	public function __construct($tokType, $tokText)
80
+	{
81
+		switch ($tokType) {
82
+			case self::TOKTYPE_BRACKET:
83
+				// fall through to the next case
84
+			case self::TOKTYPE_FIELD:
85
+				// fall through to the next case
86
+			case self::TOKTYPE_SIGN:
87
+				// fall through to the next case
88
+			case self::TOKTYPE_WORD:
89
+				break;
90
+			default:
91
+				throw new Zend_Search_Lucene_Exception("Unrecognized token type \"$tokType\".");
92
+		}
93 93
 
94
-        if (!strlen($tokText)) {
95
-            throw new Zend_Search_Lucene_Exception('Token text must be supplied.');
96
-        }
94
+		if (!strlen($tokText)) {
95
+			throw new Zend_Search_Lucene_Exception('Token text must be supplied.');
96
+		}
97 97
 
98
-        $this->type = $tokType;
99
-        $this->text = $tokText;
100
-    }
98
+		$this->type = $tokType;
99
+		$this->text = $tokText;
100
+	}
101 101
 }
102 102
 
Please login to merge, or discard this patch.
quickstart/protected/index/Zend/Search/Lucene/Search/QueryTokenizer.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
     /**
144 144
      * Returns next token
145 145
      *
146
-     * @return Zend_Search_Lucene_Search_QueryToken
146
+     * @return integer
147 147
      */
148 148
     public function next()
149 149
     {
Please login to merge, or discard this patch.
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -34,132 +34,132 @@
 block discarded – undo
34 34
  */
35 35
 class Zend_Search_Lucene_Search_QueryTokenizer implements Iterator
36 36
 {
37
-    /**
38
-     * inputString tokens.
39
-     *
40
-     * @var array
41
-     */
42
-    protected $_tokens = array();
43
-
44
-    /**
45
-     * tokens pointer.
46
-     *
47
-     * @var integer
48
-     */
49
-    protected $_currToken = 0;
50
-
51
-
52
-    /**
53
-     * QueryTokenize constructor needs query string as a parameter.
54
-     *
55
-     * @param string $inputString
56
-     */
57
-    public function __construct($inputString)
58
-    {
59
-        if (!strlen($inputString)) {
60
-            throw new Zend_Search_Lucene_Exception('Cannot tokenize empty query string.');
61
-        }
62
-
63
-        $currentToken = '';
64
-        for ($count = 0; $count < strlen($inputString); $count++) {
65
-            if (ctype_alnum( $inputString{$count} )) {
66
-                $currentToken .= $inputString{$count};
67
-            } else {
68
-                // Previous token is finished
69
-                if (strlen($currentToken)) {
70
-                    $this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD,
71
-                                                                $currentToken);
72
-                    $currentToken = '';
73
-                }
74
-
75
-                if ($inputString{$count} == '+' || $inputString{$count} == '-') {
76
-                    $this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_SIGN,
77
-                                                                $inputString{$count});
78
-                } elseif ($inputString{$count} == '(' || $inputString{$count} == ')') {
79
-                    $this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_BRACKET,
80
-                                                                $inputString{$count});
81
-                } elseif ($inputString{$count} == ':' && $this->count()) {
82
-                    if ($this->_tokens[count($this->_tokens)-1]->type == Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD) {
83
-                        $this->_tokens[count($this->_tokens)-1]->type = Zend_Search_Lucene_Search_QueryToken::TOKTYPE_FIELD;
84
-                    }
85
-                }
86
-            }
87
-        }
88
-
89
-        if (strlen($currentToken)) {
90
-            $this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD, $currentToken);
91
-        }
92
-
93
-        if (empty($this->_tokens))
94
-        	$this->_tokens[] = $inputString;
95
-    }
96
-
97
-
98
-    /**
99
-     * Returns number of tokens
100
-     *
101
-     * @return integer
102
-     */
103
-    public function count()
104
-    {
105
-        return count($this->_tokens);
106
-    }
107
-
108
-
109
-    /**
110
-     * Returns TRUE if a token exists at the current position.
111
-     *
112
-     * @return boolean
113
-     */
114
-    public function valid()
115
-    {
116
-        return $this->_currToken < $this->count();
117
-    }
118
-
119
-
120
-    /**
121
-     * Resets token stream.
122
-     *
123
-     * @return integer
124
-     */
125
-    public function rewind()
126
-    {
127
-        $this->_currToken = 0;
128
-    }
129
-
130
-
131
-    /**
132
-     * Returns the token at the current position or FALSE if
133
-     * the position does not contain a valid token.
134
-     *
135
-     * @return mixed
136
-     */
137
-    public function current()
138
-    {
139
-        return $this->valid() ? $this->_tokens[$this->_currToken] : false;
140
-    }
141
-
142
-
143
-    /**
144
-     * Returns next token
145
-     *
146
-     * @return Zend_Search_Lucene_Search_QueryToken
147
-     */
148
-    public function next()
149
-    {
150
-        return ++$this->_currToken;
151
-    }
152
-
153
-
154
-    /**
155
-     * Return the position of the current token.
156
-     *
157
-     * @return integer
158
-     */
159
-    public function key()
160
-    {
161
-        return $this->_currToken;
162
-    }
37
+	/**
38
+	 * inputString tokens.
39
+	 *
40
+	 * @var array
41
+	 */
42
+	protected $_tokens = array();
43
+
44
+	/**
45
+	 * tokens pointer.
46
+	 *
47
+	 * @var integer
48
+	 */
49
+	protected $_currToken = 0;
50
+
51
+
52
+	/**
53
+	 * QueryTokenize constructor needs query string as a parameter.
54
+	 *
55
+	 * @param string $inputString
56
+	 */
57
+	public function __construct($inputString)
58
+	{
59
+		if (!strlen($inputString)) {
60
+			throw new Zend_Search_Lucene_Exception('Cannot tokenize empty query string.');
61
+		}
62
+
63
+		$currentToken = '';
64
+		for ($count = 0; $count < strlen($inputString); $count++) {
65
+			if (ctype_alnum( $inputString{$count} )) {
66
+				$currentToken .= $inputString{$count};
67
+			} else {
68
+				// Previous token is finished
69
+				if (strlen($currentToken)) {
70
+					$this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD,
71
+																$currentToken);
72
+					$currentToken = '';
73
+				}
74
+
75
+				if ($inputString{$count} == '+' || $inputString{$count} == '-') {
76
+					$this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_SIGN,
77
+																$inputString{$count});
78
+				} elseif ($inputString{$count} == '(' || $inputString{$count} == ')') {
79
+					$this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_BRACKET,
80
+																$inputString{$count});
81
+				} elseif ($inputString{$count} == ':' && $this->count()) {
82
+					if ($this->_tokens[count($this->_tokens)-1]->type == Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD) {
83
+						$this->_tokens[count($this->_tokens)-1]->type = Zend_Search_Lucene_Search_QueryToken::TOKTYPE_FIELD;
84
+					}
85
+				}
86
+			}
87
+		}
88
+
89
+		if (strlen($currentToken)) {
90
+			$this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD, $currentToken);
91
+		}
92
+
93
+		if (empty($this->_tokens))
94
+			$this->_tokens[] = $inputString;
95
+	}
96
+
97
+
98
+	/**
99
+	 * Returns number of tokens
100
+	 *
101
+	 * @return integer
102
+	 */
103
+	public function count()
104
+	{
105
+		return count($this->_tokens);
106
+	}
107
+
108
+
109
+	/**
110
+	 * Returns TRUE if a token exists at the current position.
111
+	 *
112
+	 * @return boolean
113
+	 */
114
+	public function valid()
115
+	{
116
+		return $this->_currToken < $this->count();
117
+	}
118
+
119
+
120
+	/**
121
+	 * Resets token stream.
122
+	 *
123
+	 * @return integer
124
+	 */
125
+	public function rewind()
126
+	{
127
+		$this->_currToken = 0;
128
+	}
129
+
130
+
131
+	/**
132
+	 * Returns the token at the current position or FALSE if
133
+	 * the position does not contain a valid token.
134
+	 *
135
+	 * @return mixed
136
+	 */
137
+	public function current()
138
+	{
139
+		return $this->valid() ? $this->_tokens[$this->_currToken] : false;
140
+	}
141
+
142
+
143
+	/**
144
+	 * Returns next token
145
+	 *
146
+	 * @return Zend_Search_Lucene_Search_QueryToken
147
+	 */
148
+	public function next()
149
+	{
150
+		return ++$this->_currToken;
151
+	}
152
+
153
+
154
+	/**
155
+	 * Return the position of the current token.
156
+	 *
157
+	 * @return integer
158
+	 */
159
+	public function key()
160
+	{
161
+		return $this->_currToken;
162
+	}
163 163
 
164 164
 }
165 165
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         $currentToken = '';
64 64
         for ($count = 0; $count < strlen($inputString); $count++) {
65
-            if (ctype_alnum( $inputString{$count} )) {
65
+            if (ctype_alnum($inputString{$count} )) {
66 66
                 $currentToken .= $inputString{$count};
67 67
             } else {
68 68
                 // Previous token is finished
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
                     $this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_BRACKET,
80 80
                                                                 $inputString{$count});
81 81
                 } elseif ($inputString{$count} == ':' && $this->count()) {
82
-                    if ($this->_tokens[count($this->_tokens)-1]->type == Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD) {
83
-                        $this->_tokens[count($this->_tokens)-1]->type = Zend_Search_Lucene_Search_QueryToken::TOKTYPE_FIELD;
82
+                    if ($this->_tokens[count($this->_tokens) - 1]->type == Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD) {
83
+                        $this->_tokens[count($this->_tokens) - 1]->type = Zend_Search_Lucene_Search_QueryToken::TOKTYPE_FIELD;
84 84
                     }
85 85
                 }
86 86
             }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,8 +90,9 @@
 block discarded – undo
90 90
             $this->_tokens[] = new Zend_Search_Lucene_Search_QueryToken(Zend_Search_Lucene_Search_QueryToken::TOKTYPE_WORD, $currentToken);
91 91
         }
92 92
 
93
-        if (empty($this->_tokens))
94
-        	$this->_tokens[] = $inputString;
93
+        if (empty($this->_tokens)) {
94
+                	$this->_tokens[] = $inputString;
95
+        }
95 96
     }
96 97
 
97 98
 
Please login to merge, or discard this patch.
demos/quickstart/protected/index/Zend/Search/Lucene/Search/Similarity.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
     /**
408 408
      * Float to byte conversion
409 409
      *
410
-     * @param integer $b
411
-     * @return float
410
+     * @param double $f
411
+     * @return integer
412 412
      */
413 413
     static private function _floatToByte($f)
414 414
     {
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
      *
495 495
      * @param mixed $input
496 496
      * @param Zend_Search_Lucene $reader
497
-     * @return a score factor for the term
497
+     * @return double score factor for the term
498 498
      */
499 499
     public function idf($input, $reader)
500 500
     {
Please login to merge, or discard this patch.
Indentation   +492 added lines, -492 removed lines patch added patch discarded remove patch
@@ -31,521 +31,521 @@
 block discarded – undo
31 31
  */
32 32
 abstract class Zend_Search_Lucene_Search_Similarity
33 33
 {
34
-    /**
35
-     * The Similarity implementation used by default.
36
-     *
37
-     * @var Zend_Search_Lucene_Search_Similarity
38
-     */
39
-    static private $_defaultImpl;
34
+	/**
35
+	 * The Similarity implementation used by default.
36
+	 *
37
+	 * @var Zend_Search_Lucene_Search_Similarity
38
+	 */
39
+	static private $_defaultImpl;
40 40
 
41
-    /**
42
-     * Cache of decoded bytes.
43
-     * Array of floats
44
-     *
45
-     * @var array
46
-     */
47
-    static private $_normTable = array( 0   => 0.0,
48
-                                        1   => 5.820766E-10,
49
-                                        2   => 6.9849193E-10,
50
-                                        3   => 8.1490725E-10,
51
-                                        4   => 9.313226E-10,
52
-                                        5   => 1.1641532E-9,
53
-                                        6   => 1.3969839E-9,
54
-                                        7   => 1.6298145E-9,
55
-                                        8   => 1.8626451E-9,
56
-                                        9   => 2.3283064E-9,
57
-                                        10  => 2.7939677E-9,
58
-                                        11  => 3.259629E-9,
59
-                                        12  => 3.7252903E-9,
60
-                                        13  => 4.656613E-9,
61
-                                        14  => 5.5879354E-9,
62
-                                        15  => 6.519258E-9,
63
-                                        16  => 7.4505806E-9,
64
-                                        17  => 9.313226E-9,
65
-                                        18  => 1.1175871E-8,
66
-                                        19  => 1.3038516E-8,
67
-                                        20  => 1.4901161E-8,
68
-                                        21  => 1.8626451E-8,
69
-                                        22  => 2.2351742E-8,
70
-                                        23  => 2.6077032E-8,
71
-                                        24  => 2.9802322E-8,
72
-                                        25  => 3.7252903E-8,
73
-                                        26  => 4.4703484E-8,
74
-                                        27  => 5.2154064E-8,
75
-                                        28  => 5.9604645E-8,
76
-                                        29  => 7.4505806E-8,
77
-                                        30  => 8.940697E-8,
78
-                                        31  => 1.0430813E-7,
79
-                                        32  => 1.1920929E-7,
80
-                                        33  => 1.4901161E-7,
81
-                                        34  => 1.7881393E-7,
82
-                                        35  => 2.0861626E-7,
83
-                                        36  => 2.3841858E-7,
84
-                                        37  => 2.9802322E-7,
85
-                                        38  => 3.5762787E-7,
86
-                                        39  => 4.172325E-7,
87
-                                        40  => 4.7683716E-7,
88
-                                        41  => 5.9604645E-7,
89
-                                        42  => 7.1525574E-7,
90
-                                        43  => 8.34465E-7,
91
-                                        44  => 9.536743E-7,
92
-                                        45  => 1.1920929E-6,
93
-                                        46  => 1.4305115E-6,
94
-                                        47  => 1.66893E-6,
95
-                                        48  => 1.9073486E-6,
96
-                                        49  => 2.3841858E-6,
97
-                                        50  => 2.861023E-6,
98
-                                        51  => 3.33786E-6,
99
-                                        52  => 3.8146973E-6,
100
-                                        53  => 4.7683716E-6,
101
-                                        54  => 5.722046E-6,
102
-                                        55  => 6.67572E-6,
103
-                                        56  => 7.6293945E-6,
104
-                                        57  => 9.536743E-6,
105
-                                        58  => 1.1444092E-5,
106
-                                        59  => 1.335144E-5,
107
-                                        60  => 1.5258789E-5,
108
-                                        61  => 1.9073486E-5,
109
-                                        62  => 2.2888184E-5,
110
-                                        63  => 2.670288E-5,
111
-                                        64  => 3.0517578E-5,
112
-                                        65  => 3.8146973E-5,
113
-                                        66  => 4.5776367E-5,
114
-                                        67  => 5.340576E-5,
115
-                                        68  => 6.1035156E-5,
116
-                                        69  => 7.6293945E-5,
117
-                                        70  => 9.1552734E-5,
118
-                                        71  => 1.0681152E-4,
119
-                                        72  => 1.2207031E-4,
120
-                                        73  => 1.5258789E-4,
121
-                                        74  => 1.8310547E-4,
122
-                                        75  => 2.1362305E-4,
123
-                                        76  => 2.4414062E-4,
124
-                                        77  => 3.0517578E-4,
125
-                                        78  => 3.6621094E-4,
126
-                                        79  => 4.272461E-4,
127
-                                        80  => 4.8828125E-4,
128
-                                        81  => 6.1035156E-4,
129
-                                        82  => 7.324219E-4,
130
-                                        83  => 8.544922E-4,
131
-                                        84  => 9.765625E-4,
132
-                                        85  => 0.0012207031,
133
-                                        86  => 0.0014648438,
134
-                                        87  => 0.0017089844,
135
-                                        88  => 0.001953125,
136
-                                        89  => 0.0024414062,
137
-                                        90  => 0.0029296875,
138
-                                        91  => 0.0034179688,
139
-                                        92  => 0.00390625,
140
-                                        93  => 0.0048828125,
141
-                                        94  => 0.005859375,
142
-                                        95  => 0.0068359375,
143
-                                        96  => 0.0078125,
144
-                                        97  => 0.009765625,
145
-                                        98  => 0.01171875,
146
-                                        99  => 0.013671875,
147
-                                        100 => 0.015625,
148
-                                        101 => 0.01953125,
149
-                                        102 => 0.0234375,
150
-                                        103 => 0.02734375,
151
-                                        104 => 0.03125,
152
-                                        105 => 0.0390625,
153
-                                        106 => 0.046875,
154
-                                        107 => 0.0546875,
155
-                                        108 => 0.0625,
156
-                                        109 => 0.078125,
157
-                                        110 => 0.09375,
158
-                                        111 => 0.109375,
159
-                                        112 => 0.125,
160
-                                        113 => 0.15625,
161
-                                        114 => 0.1875,
162
-                                        115 => 0.21875,
163
-                                        116 => 0.25,
164
-                                        117 => 0.3125,
165
-                                        118 => 0.375,
166
-                                        119 => 0.4375,
167
-                                        120 => 0.5,
168
-                                        121 => 0.625,
169
-                                        122 => 0.75,
170
-                                        123 => 0.875,
171
-                                        124 => 1.0,
172
-                                        125 => 1.25,
173
-                                        126 => 1.5,
174
-                                        127 => 1.75,
175
-                                        128 => 2.0,
176
-                                        129 => 2.5,
177
-                                        130 => 3.0,
178
-                                        131 => 3.5,
179
-                                        132 => 4.0,
180
-                                        133 => 5.0,
181
-                                        134 => 6.0,
182
-                                        135 => 7.0,
183
-                                        136 => 8.0,
184
-                                        137 => 10.0,
185
-                                        138 => 12.0,
186
-                                        139 => 14.0,
187
-                                        140 => 16.0,
188
-                                        141 => 20.0,
189
-                                        142 => 24.0,
190
-                                        143 => 28.0,
191
-                                        144 => 32.0,
192
-                                        145 => 40.0,
193
-                                        146 => 48.0,
194
-                                        147 => 56.0,
195
-                                        148 => 64.0,
196
-                                        149 => 80.0,
197
-                                        150 => 96.0,
198
-                                        151 => 112.0,
199
-                                        152 => 128.0,
200
-                                        153 => 160.0,
201
-                                        154 => 192.0,
202
-                                        155 => 224.0,
203
-                                        156 => 256.0,
204
-                                        157 => 320.0,
205
-                                        158 => 384.0,
206
-                                        159 => 448.0,
207
-                                        160 => 512.0,
208
-                                        161 => 640.0,
209
-                                        162 => 768.0,
210
-                                        163 => 896.0,
211
-                                        164 => 1024.0,
212
-                                        165 => 1280.0,
213
-                                        166 => 1536.0,
214
-                                        167 => 1792.0,
215
-                                        168 => 2048.0,
216
-                                        169 => 2560.0,
217
-                                        170 => 3072.0,
218
-                                        171 => 3584.0,
219
-                                        172 => 4096.0,
220
-                                        173 => 5120.0,
221
-                                        174 => 6144.0,
222
-                                        175 => 7168.0,
223
-                                        176 => 8192.0,
224
-                                        177 => 10240.0,
225
-                                        178 => 12288.0,
226
-                                        179 => 14336.0,
227
-                                        180 => 16384.0,
228
-                                        181 => 20480.0,
229
-                                        182 => 24576.0,
230
-                                        183 => 28672.0,
231
-                                        184 => 32768.0,
232
-                                        185 => 40960.0,
233
-                                        186 => 49152.0,
234
-                                        187 => 57344.0,
235
-                                        188 => 65536.0,
236
-                                        189 => 81920.0,
237
-                                        190 => 98304.0,
238
-                                        191 => 114688.0,
239
-                                        192 => 131072.0,
240
-                                        193 => 163840.0,
241
-                                        194 => 196608.0,
242
-                                        195 => 229376.0,
243
-                                        196 => 262144.0,
244
-                                        197 => 327680.0,
245
-                                        198 => 393216.0,
246
-                                        199 => 458752.0,
247
-                                        200 => 524288.0,
248
-                                        201 => 655360.0,
249
-                                        202 => 786432.0,
250
-                                        203 => 917504.0,
251
-                                        204 => 1048576.0,
252
-                                        205 => 1310720.0,
253
-                                        206 => 1572864.0,
254
-                                        207 => 1835008.0,
255
-                                        208 => 2097152.0,
256
-                                        209 => 2621440.0,
257
-                                        210 => 3145728.0,
258
-                                        211 => 3670016.0,
259
-                                        212 => 4194304.0,
260
-                                        213 => 5242880.0,
261
-                                        214 => 6291456.0,
262
-                                        215 => 7340032.0,
263
-                                        216 => 8388608.0,
264
-                                        217 => 1.048576E7,
265
-                                        218 => 1.2582912E7,
266
-                                        219 => 1.4680064E7,
267
-                                        220 => 1.6777216E7,
268
-                                        221 => 2.097152E7,
269
-                                        222 => 2.5165824E7,
270
-                                        223 => 2.9360128E7,
271
-                                        224 => 3.3554432E7,
272
-                                        225 => 4.194304E7,
273
-                                        226 => 5.0331648E7,
274
-                                        227 => 5.8720256E7,
275
-                                        228 => 6.7108864E7,
276
-                                        229 => 8.388608E7,
277
-                                        230 => 1.00663296E8,
278
-                                        231 => 1.17440512E8,
279
-                                        232 => 1.34217728E8,
280
-                                        233 => 1.6777216E8,
281
-                                        234 => 2.01326592E8,
282
-                                        235 => 2.34881024E8,
283
-                                        236 => 2.68435456E8,
284
-                                        237 => 3.3554432E8,
285
-                                        238 => 4.02653184E8,
286
-                                        239 => 4.69762048E8,
287
-                                        240 => 5.3687091E8,
288
-                                        241 => 6.7108864E8,
289
-                                        242 => 8.0530637E8,
290
-                                        243 => 9.395241E8,
291
-                                        244 => 1.07374182E9,
292
-                                        245 => 1.34217728E9,
293
-                                        246 => 1.61061274E9,
294
-                                        247 => 1.87904819E9,
295
-                                        248 => 2.14748365E9,
296
-                                        249 => 2.68435456E9,
297
-                                        250 => 3.22122547E9,
298
-                                        251 => 3.75809638E9,
299
-                                        252 => 4.2949673E9,
300
-                                        253 => 5.3687091E9,
301
-                                        254 => 6.4424509E9,
302
-                                        255 => 7.5161928E9 );
41
+	/**
42
+	 * Cache of decoded bytes.
43
+	 * Array of floats
44
+	 *
45
+	 * @var array
46
+	 */
47
+	static private $_normTable = array( 0   => 0.0,
48
+										1   => 5.820766E-10,
49
+										2   => 6.9849193E-10,
50
+										3   => 8.1490725E-10,
51
+										4   => 9.313226E-10,
52
+										5   => 1.1641532E-9,
53
+										6   => 1.3969839E-9,
54
+										7   => 1.6298145E-9,
55
+										8   => 1.8626451E-9,
56
+										9   => 2.3283064E-9,
57
+										10  => 2.7939677E-9,
58
+										11  => 3.259629E-9,
59
+										12  => 3.7252903E-9,
60
+										13  => 4.656613E-9,
61
+										14  => 5.5879354E-9,
62
+										15  => 6.519258E-9,
63
+										16  => 7.4505806E-9,
64
+										17  => 9.313226E-9,
65
+										18  => 1.1175871E-8,
66
+										19  => 1.3038516E-8,
67
+										20  => 1.4901161E-8,
68
+										21  => 1.8626451E-8,
69
+										22  => 2.2351742E-8,
70
+										23  => 2.6077032E-8,
71
+										24  => 2.9802322E-8,
72
+										25  => 3.7252903E-8,
73
+										26  => 4.4703484E-8,
74
+										27  => 5.2154064E-8,
75
+										28  => 5.9604645E-8,
76
+										29  => 7.4505806E-8,
77
+										30  => 8.940697E-8,
78
+										31  => 1.0430813E-7,
79
+										32  => 1.1920929E-7,
80
+										33  => 1.4901161E-7,
81
+										34  => 1.7881393E-7,
82
+										35  => 2.0861626E-7,
83
+										36  => 2.3841858E-7,
84
+										37  => 2.9802322E-7,
85
+										38  => 3.5762787E-7,
86
+										39  => 4.172325E-7,
87
+										40  => 4.7683716E-7,
88
+										41  => 5.9604645E-7,
89
+										42  => 7.1525574E-7,
90
+										43  => 8.34465E-7,
91
+										44  => 9.536743E-7,
92
+										45  => 1.1920929E-6,
93
+										46  => 1.4305115E-6,
94
+										47  => 1.66893E-6,
95
+										48  => 1.9073486E-6,
96
+										49  => 2.3841858E-6,
97
+										50  => 2.861023E-6,
98
+										51  => 3.33786E-6,
99
+										52  => 3.8146973E-6,
100
+										53  => 4.7683716E-6,
101
+										54  => 5.722046E-6,
102
+										55  => 6.67572E-6,
103
+										56  => 7.6293945E-6,
104
+										57  => 9.536743E-6,
105
+										58  => 1.1444092E-5,
106
+										59  => 1.335144E-5,
107
+										60  => 1.5258789E-5,
108
+										61  => 1.9073486E-5,
109
+										62  => 2.2888184E-5,
110
+										63  => 2.670288E-5,
111
+										64  => 3.0517578E-5,
112
+										65  => 3.8146973E-5,
113
+										66  => 4.5776367E-5,
114
+										67  => 5.340576E-5,
115
+										68  => 6.1035156E-5,
116
+										69  => 7.6293945E-5,
117
+										70  => 9.1552734E-5,
118
+										71  => 1.0681152E-4,
119
+										72  => 1.2207031E-4,
120
+										73  => 1.5258789E-4,
121
+										74  => 1.8310547E-4,
122
+										75  => 2.1362305E-4,
123
+										76  => 2.4414062E-4,
124
+										77  => 3.0517578E-4,
125
+										78  => 3.6621094E-4,
126
+										79  => 4.272461E-4,
127
+										80  => 4.8828125E-4,
128
+										81  => 6.1035156E-4,
129
+										82  => 7.324219E-4,
130
+										83  => 8.544922E-4,
131
+										84  => 9.765625E-4,
132
+										85  => 0.0012207031,
133
+										86  => 0.0014648438,
134
+										87  => 0.0017089844,
135
+										88  => 0.001953125,
136
+										89  => 0.0024414062,
137
+										90  => 0.0029296875,
138
+										91  => 0.0034179688,
139
+										92  => 0.00390625,
140
+										93  => 0.0048828125,
141
+										94  => 0.005859375,
142
+										95  => 0.0068359375,
143
+										96  => 0.0078125,
144
+										97  => 0.009765625,
145
+										98  => 0.01171875,
146
+										99  => 0.013671875,
147
+										100 => 0.015625,
148
+										101 => 0.01953125,
149
+										102 => 0.0234375,
150
+										103 => 0.02734375,
151
+										104 => 0.03125,
152
+										105 => 0.0390625,
153
+										106 => 0.046875,
154
+										107 => 0.0546875,
155
+										108 => 0.0625,
156
+										109 => 0.078125,
157
+										110 => 0.09375,
158
+										111 => 0.109375,
159
+										112 => 0.125,
160
+										113 => 0.15625,
161
+										114 => 0.1875,
162
+										115 => 0.21875,
163
+										116 => 0.25,
164
+										117 => 0.3125,
165
+										118 => 0.375,
166
+										119 => 0.4375,
167
+										120 => 0.5,
168
+										121 => 0.625,
169
+										122 => 0.75,
170
+										123 => 0.875,
171
+										124 => 1.0,
172
+										125 => 1.25,
173
+										126 => 1.5,
174
+										127 => 1.75,
175
+										128 => 2.0,
176
+										129 => 2.5,
177
+										130 => 3.0,
178
+										131 => 3.5,
179
+										132 => 4.0,
180
+										133 => 5.0,
181
+										134 => 6.0,
182
+										135 => 7.0,
183
+										136 => 8.0,
184
+										137 => 10.0,
185
+										138 => 12.0,
186
+										139 => 14.0,
187
+										140 => 16.0,
188
+										141 => 20.0,
189
+										142 => 24.0,
190
+										143 => 28.0,
191
+										144 => 32.0,
192
+										145 => 40.0,
193
+										146 => 48.0,
194
+										147 => 56.0,
195
+										148 => 64.0,
196
+										149 => 80.0,
197
+										150 => 96.0,
198
+										151 => 112.0,
199
+										152 => 128.0,
200
+										153 => 160.0,
201
+										154 => 192.0,
202
+										155 => 224.0,
203
+										156 => 256.0,
204
+										157 => 320.0,
205
+										158 => 384.0,
206
+										159 => 448.0,
207
+										160 => 512.0,
208
+										161 => 640.0,
209
+										162 => 768.0,
210
+										163 => 896.0,
211
+										164 => 1024.0,
212
+										165 => 1280.0,
213
+										166 => 1536.0,
214
+										167 => 1792.0,
215
+										168 => 2048.0,
216
+										169 => 2560.0,
217
+										170 => 3072.0,
218
+										171 => 3584.0,
219
+										172 => 4096.0,
220
+										173 => 5120.0,
221
+										174 => 6144.0,
222
+										175 => 7168.0,
223
+										176 => 8192.0,
224
+										177 => 10240.0,
225
+										178 => 12288.0,
226
+										179 => 14336.0,
227
+										180 => 16384.0,
228
+										181 => 20480.0,
229
+										182 => 24576.0,
230
+										183 => 28672.0,
231
+										184 => 32768.0,
232
+										185 => 40960.0,
233
+										186 => 49152.0,
234
+										187 => 57344.0,
235
+										188 => 65536.0,
236
+										189 => 81920.0,
237
+										190 => 98304.0,
238
+										191 => 114688.0,
239
+										192 => 131072.0,
240
+										193 => 163840.0,
241
+										194 => 196608.0,
242
+										195 => 229376.0,
243
+										196 => 262144.0,
244
+										197 => 327680.0,
245
+										198 => 393216.0,
246
+										199 => 458752.0,
247
+										200 => 524288.0,
248
+										201 => 655360.0,
249
+										202 => 786432.0,
250
+										203 => 917504.0,
251
+										204 => 1048576.0,
252
+										205 => 1310720.0,
253
+										206 => 1572864.0,
254
+										207 => 1835008.0,
255
+										208 => 2097152.0,
256
+										209 => 2621440.0,
257
+										210 => 3145728.0,
258
+										211 => 3670016.0,
259
+										212 => 4194304.0,
260
+										213 => 5242880.0,
261
+										214 => 6291456.0,
262
+										215 => 7340032.0,
263
+										216 => 8388608.0,
264
+										217 => 1.048576E7,
265
+										218 => 1.2582912E7,
266
+										219 => 1.4680064E7,
267
+										220 => 1.6777216E7,
268
+										221 => 2.097152E7,
269
+										222 => 2.5165824E7,
270
+										223 => 2.9360128E7,
271
+										224 => 3.3554432E7,
272
+										225 => 4.194304E7,
273
+										226 => 5.0331648E7,
274
+										227 => 5.8720256E7,
275
+										228 => 6.7108864E7,
276
+										229 => 8.388608E7,
277
+										230 => 1.00663296E8,
278
+										231 => 1.17440512E8,
279
+										232 => 1.34217728E8,
280
+										233 => 1.6777216E8,
281
+										234 => 2.01326592E8,
282
+										235 => 2.34881024E8,
283
+										236 => 2.68435456E8,
284
+										237 => 3.3554432E8,
285
+										238 => 4.02653184E8,
286
+										239 => 4.69762048E8,
287
+										240 => 5.3687091E8,
288
+										241 => 6.7108864E8,
289
+										242 => 8.0530637E8,
290
+										243 => 9.395241E8,
291
+										244 => 1.07374182E9,
292
+										245 => 1.34217728E9,
293
+										246 => 1.61061274E9,
294
+										247 => 1.87904819E9,
295
+										248 => 2.14748365E9,
296
+										249 => 2.68435456E9,
297
+										250 => 3.22122547E9,
298
+										251 => 3.75809638E9,
299
+										252 => 4.2949673E9,
300
+										253 => 5.3687091E9,
301
+										254 => 6.4424509E9,
302
+										255 => 7.5161928E9 );
303 303
 
304 304
 
305
-    /**
306
-     * Set the default Similarity implementation used by indexing and search
307
-     * code.
308
-     *
309
-     * @param Zend_Search_Lucene_Search_Similarity $similarity
310
-     */
311
-    static public function setDefault(Zend_Search_Lucene_Search_Similarity $similarity)
312
-    {
313
-        self::$_defaultImpl = $similarity;
314
-    }
305
+	/**
306
+	 * Set the default Similarity implementation used by indexing and search
307
+	 * code.
308
+	 *
309
+	 * @param Zend_Search_Lucene_Search_Similarity $similarity
310
+	 */
311
+	static public function setDefault(Zend_Search_Lucene_Search_Similarity $similarity)
312
+	{
313
+		self::$_defaultImpl = $similarity;
314
+	}
315 315
 
316 316
 
317
-    /**
318
-     * Return the default Similarity implementation used by indexing and search
319
-     * code.
320
-     *
321
-     * @return Zend_Search_Lucene_Search_Similarity
322
-     */
323
-    static public function getDefault()
324
-    {
325
-        if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Search_Similarity) {
326
-            self::$_defaultImpl = new Zend_Search_Lucene_Search_Similarity_Default();
327
-        }
317
+	/**
318
+	 * Return the default Similarity implementation used by indexing and search
319
+	 * code.
320
+	 *
321
+	 * @return Zend_Search_Lucene_Search_Similarity
322
+	 */
323
+	static public function getDefault()
324
+	{
325
+		if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Search_Similarity) {
326
+			self::$_defaultImpl = new Zend_Search_Lucene_Search_Similarity_Default();
327
+		}
328 328
 
329
-        return self::$_defaultImpl;
330
-    }
329
+		return self::$_defaultImpl;
330
+	}
331 331
 
332 332
 
333
-    /**
334
-     * Computes the normalization value for a field given the total number of
335
-     * terms contained in a field.  These values, together with field boosts, are
336
-     * stored in an index and multipled into scores for hits on each field by the
337
-     * search code.
338
-     *
339
-     * Matches in longer fields are less precise, so implemenations of this
340
-     * method usually return smaller values when 'numTokens' is large,
341
-     * and larger values when 'numTokens' is small.
342
-     *
343
-     * That these values are computed under
344
-     * IndexWriter::addDocument(Document) and stored then using
345
-     * encodeNorm(float).  Thus they have limited precision, and documents
346
-     * must be re-indexed if this method is altered.
347
-     *
348
-     * fieldName - name of field
349
-     * numTokens - the total number of tokens contained in fields named
350
-     *             'fieldName' of 'doc'.
351
-     * Returns a normalization factor for hits on this field of this document
352
-     *
353
-     * @param string $fieldName
354
-     * @param integer $numTokens
355
-     * @return float
356
-     */
357
-    abstract public function lengthNorm($fieldName, $numTokens);
333
+	/**
334
+	 * Computes the normalization value for a field given the total number of
335
+	 * terms contained in a field.  These values, together with field boosts, are
336
+	 * stored in an index and multipled into scores for hits on each field by the
337
+	 * search code.
338
+	 *
339
+	 * Matches in longer fields are less precise, so implemenations of this
340
+	 * method usually return smaller values when 'numTokens' is large,
341
+	 * and larger values when 'numTokens' is small.
342
+	 *
343
+	 * That these values are computed under
344
+	 * IndexWriter::addDocument(Document) and stored then using
345
+	 * encodeNorm(float).  Thus they have limited precision, and documents
346
+	 * must be re-indexed if this method is altered.
347
+	 *
348
+	 * fieldName - name of field
349
+	 * numTokens - the total number of tokens contained in fields named
350
+	 *             'fieldName' of 'doc'.
351
+	 * Returns a normalization factor for hits on this field of this document
352
+	 *
353
+	 * @param string $fieldName
354
+	 * @param integer $numTokens
355
+	 * @return float
356
+	 */
357
+	abstract public function lengthNorm($fieldName, $numTokens);
358 358
 
359
-    /**
360
-     * Computes the normalization value for a query given the sum of the squared
361
-     * weights of each of the query terms.  This value is then multipled into the
362
-     * weight of each query term.
363
-     *
364
-     * This does not affect ranking, but rather just attempts to make scores
365
-     * from different queries comparable.
366
-     *
367
-     * sumOfSquaredWeights - the sum of the squares of query term weights
368
-     * Returns a normalization factor for query weights
369
-     *
370
-     * @param float $sumOfSquaredWeights
371
-     * @return float
372
-     */
373
-    abstract public function queryNorm($sumOfSquaredWeights);
359
+	/**
360
+	 * Computes the normalization value for a query given the sum of the squared
361
+	 * weights of each of the query terms.  This value is then multipled into the
362
+	 * weight of each query term.
363
+	 *
364
+	 * This does not affect ranking, but rather just attempts to make scores
365
+	 * from different queries comparable.
366
+	 *
367
+	 * sumOfSquaredWeights - the sum of the squares of query term weights
368
+	 * Returns a normalization factor for query weights
369
+	 *
370
+	 * @param float $sumOfSquaredWeights
371
+	 * @return float
372
+	 */
373
+	abstract public function queryNorm($sumOfSquaredWeights);
374 374
 
375 375
 
376
-    /**
377
-     *  Decodes a normalization factor stored in an index.
378
-     *
379
-     * @param integer $byte
380
-     * @return float
381
-     */
382
-    static public function decodeNorm($byte)
383
-    {
384
-        return self::$_normTable[$byte & 0xFF];
385
-    }
376
+	/**
377
+	 *  Decodes a normalization factor stored in an index.
378
+	 *
379
+	 * @param integer $byte
380
+	 * @return float
381
+	 */
382
+	static public function decodeNorm($byte)
383
+	{
384
+		return self::$_normTable[$byte & 0xFF];
385
+	}
386 386
 
387 387
 
388
-    /**
389
-     * Encodes a normalization factor for storage in an index.
390
-     *
391
-     * The encoding uses a five-bit exponent and three-bit mantissa, thus
392
-     * representing values from around 7x10^9 to 2x10^-9 with about one
393
-     * significant decimal digit of accuracy.  Zero is also represented.
394
-     * Negative numbers are rounded up to zero.  Values too large to represent
395
-     * are rounded down to the largest representable value.  Positive values too
396
-     * small to represent are rounded up to the smallest positive representable
397
-     * value.
398
-     *
399
-     * @param float $f
400
-     * @return integer
401
-     */
402
-    static function encodeNorm($f)
403
-    {
404
-      return self::_floatToByte($f);
405
-    }
388
+	/**
389
+	 * Encodes a normalization factor for storage in an index.
390
+	 *
391
+	 * The encoding uses a five-bit exponent and three-bit mantissa, thus
392
+	 * representing values from around 7x10^9 to 2x10^-9 with about one
393
+	 * significant decimal digit of accuracy.  Zero is also represented.
394
+	 * Negative numbers are rounded up to zero.  Values too large to represent
395
+	 * are rounded down to the largest representable value.  Positive values too
396
+	 * small to represent are rounded up to the smallest positive representable
397
+	 * value.
398
+	 *
399
+	 * @param float $f
400
+	 * @return integer
401
+	 */
402
+	static function encodeNorm($f)
403
+	{
404
+	  return self::_floatToByte($f);
405
+	}
406 406
 
407
-    /**
408
-     * Float to byte conversion
409
-     *
410
-     * @param integer $b
411
-     * @return float
412
-     */
413
-    static private function _floatToByte($f)
414
-    {
415
-        // round negatives up to zero
416
-        if ($f <= 0.0) {
417
-            return 0;
418
-        }
407
+	/**
408
+	 * Float to byte conversion
409
+	 *
410
+	 * @param integer $b
411
+	 * @return float
412
+	 */
413
+	static private function _floatToByte($f)
414
+	{
415
+		// round negatives up to zero
416
+		if ($f <= 0.0) {
417
+			return 0;
418
+		}
419 419
 
420
-        // search for appropriate value
421
-        $lowIndex = 0;
422
-        $highIndex = 255;
423
-        while ($highIndex >= $lowIndex) {
424
-            // $mid = ($highIndex - $lowIndex)/2;
425
-            $mid = ($highIndex + $lowIndex) >> 1;
426
-            $delta = $f - self::$_normTable[$mid];
420
+		// search for appropriate value
421
+		$lowIndex = 0;
422
+		$highIndex = 255;
423
+		while ($highIndex >= $lowIndex) {
424
+			// $mid = ($highIndex - $lowIndex)/2;
425
+			$mid = ($highIndex + $lowIndex) >> 1;
426
+			$delta = $f - self::$_normTable[$mid];
427 427
 
428
-            if ($delta < 0) {
429
-                $highIndex = $mid-1;
430
-            } elseif ($delta > 0) {
431
-                $lowIndex  = $mid+1;
432
-            } else {
433
-                return $mid; // We got it!
434
-            }
435
-        }
428
+			if ($delta < 0) {
429
+				$highIndex = $mid-1;
430
+			} elseif ($delta > 0) {
431
+				$lowIndex  = $mid+1;
432
+			} else {
433
+				return $mid; // We got it!
434
+			}
435
+		}
436 436
 
437
-        // round to closest value
438
-        if ($highIndex != 255 &&
439
-            $f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex+1] - $f ) {
440
-            return $highIndex + 1;
441
-        } else {
442
-            return $highIndex;
443
-        }
444
-    }
437
+		// round to closest value
438
+		if ($highIndex != 255 &&
439
+			$f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex+1] - $f ) {
440
+			return $highIndex + 1;
441
+		} else {
442
+			return $highIndex;
443
+		}
444
+	}
445 445
 
446 446
 
447
-    /**
448
-     * Computes a score factor based on a term or phrase's frequency in a
449
-     * document.  This value is multiplied by the idf(Term, Searcher)
450
-     * factor for each term in the query and these products are then summed to
451
-     * form the initial score for a document.
452
-     *
453
-     * Terms and phrases repeated in a document indicate the topic of the
454
-     * document, so implementations of this method usually return larger values
455
-     * when 'freq' is large, and smaller values when 'freq'
456
-     * is small.
457
-     *
458
-     * freq - the frequency of a term within a document
459
-     * Returns a score factor based on a term's within-document frequency
460
-     *
461
-     * @param float $freq
462
-     * @return float
463
-     */
464
-    abstract public function tf($freq);
447
+	/**
448
+	 * Computes a score factor based on a term or phrase's frequency in a
449
+	 * document.  This value is multiplied by the idf(Term, Searcher)
450
+	 * factor for each term in the query and these products are then summed to
451
+	 * form the initial score for a document.
452
+	 *
453
+	 * Terms and phrases repeated in a document indicate the topic of the
454
+	 * document, so implementations of this method usually return larger values
455
+	 * when 'freq' is large, and smaller values when 'freq'
456
+	 * is small.
457
+	 *
458
+	 * freq - the frequency of a term within a document
459
+	 * Returns a score factor based on a term's within-document frequency
460
+	 *
461
+	 * @param float $freq
462
+	 * @return float
463
+	 */
464
+	abstract public function tf($freq);
465 465
 
466
-    /**
467
-     * Computes the amount of a sloppy phrase match, based on an edit distance.
468
-     * This value is summed for each sloppy phrase match in a document to form
469
-     * the frequency that is passed to tf(float).
470
-     *
471
-     * A phrase match with a small edit distance to a document passage more
472
-     * closely matches the document, so implementations of this method usually
473
-     * return larger values when the edit distance is small and smaller values
474
-     * when it is large.
475
-     *
476
-     * distance - the edit distance of this sloppy phrase match
477
-     * Returns the frequency increment for this match
478
-     *
479
-     * @param integer $distance
480
-     * @return float
481
-     */
482
-    abstract public function sloppyFreq($distance);
466
+	/**
467
+	 * Computes the amount of a sloppy phrase match, based on an edit distance.
468
+	 * This value is summed for each sloppy phrase match in a document to form
469
+	 * the frequency that is passed to tf(float).
470
+	 *
471
+	 * A phrase match with a small edit distance to a document passage more
472
+	 * closely matches the document, so implementations of this method usually
473
+	 * return larger values when the edit distance is small and smaller values
474
+	 * when it is large.
475
+	 *
476
+	 * distance - the edit distance of this sloppy phrase match
477
+	 * Returns the frequency increment for this match
478
+	 *
479
+	 * @param integer $distance
480
+	 * @return float
481
+	 */
482
+	abstract public function sloppyFreq($distance);
483 483
 
484 484
 
485
-    /**
486
-     * Computes a score factor for a simple term or a phrase.
487
-     *
488
-     * The default implementation is:
489
-     *   return idfFreq(searcher.docFreq(term), searcher.maxDoc());
490
-     *
491
-     * input - the term in question or array of terms
492
-     * reader - reader the document collection being searched
493
-     * Returns a score factor for the term
494
-     *
495
-     * @param mixed $input
496
-     * @param Zend_Search_Lucene $reader
497
-     * @return a score factor for the term
498
-     */
499
-    public function idf($input, $reader)
500
-    {
501
-        if (!is_array($input)) {
502
-            return $this->idfFreq($reader->docFreq($input), $reader->count());
503
-        } else {
504
-            $idf = 0.0;
505
-            foreach ($input as $term) {
506
-                $idf += $this->idfFreq($reader->docFreq($term), $reader->count());
507
-            }
508
-            return $idf;
509
-        }
510
-    }
485
+	/**
486
+	 * Computes a score factor for a simple term or a phrase.
487
+	 *
488
+	 * The default implementation is:
489
+	 *   return idfFreq(searcher.docFreq(term), searcher.maxDoc());
490
+	 *
491
+	 * input - the term in question or array of terms
492
+	 * reader - reader the document collection being searched
493
+	 * Returns a score factor for the term
494
+	 *
495
+	 * @param mixed $input
496
+	 * @param Zend_Search_Lucene $reader
497
+	 * @return a score factor for the term
498
+	 */
499
+	public function idf($input, $reader)
500
+	{
501
+		if (!is_array($input)) {
502
+			return $this->idfFreq($reader->docFreq($input), $reader->count());
503
+		} else {
504
+			$idf = 0.0;
505
+			foreach ($input as $term) {
506
+				$idf += $this->idfFreq($reader->docFreq($term), $reader->count());
507
+			}
508
+			return $idf;
509
+		}
510
+	}
511 511
 
512
-    /**
513
-     * Computes a score factor based on a term's document frequency (the number
514
-     * of documents which contain the term).  This value is multiplied by the
515
-     * tf(int) factor for each term in the query and these products are
516
-     * then summed to form the initial score for a document.
517
-     *
518
-     * Terms that occur in fewer documents are better indicators of topic, so
519
-     * implemenations of this method usually return larger values for rare terms,
520
-     * and smaller values for common terms.
521
-     *
522
-     * docFreq - the number of documents which contain the term
523
-     * numDocs - the total number of documents in the collection
524
-     * Returns a score factor based on the term's document frequency
525
-     *
526
-     * @param integer $docFreq
527
-     * @param integer $numDocs
528
-     * @return float
529
-     */
530
-    abstract public function idfFreq($docFreq, $numDocs);
512
+	/**
513
+	 * Computes a score factor based on a term's document frequency (the number
514
+	 * of documents which contain the term).  This value is multiplied by the
515
+	 * tf(int) factor for each term in the query and these products are
516
+	 * then summed to form the initial score for a document.
517
+	 *
518
+	 * Terms that occur in fewer documents are better indicators of topic, so
519
+	 * implemenations of this method usually return larger values for rare terms,
520
+	 * and smaller values for common terms.
521
+	 *
522
+	 * docFreq - the number of documents which contain the term
523
+	 * numDocs - the total number of documents in the collection
524
+	 * Returns a score factor based on the term's document frequency
525
+	 *
526
+	 * @param integer $docFreq
527
+	 * @param integer $numDocs
528
+	 * @return float
529
+	 */
530
+	abstract public function idfFreq($docFreq, $numDocs);
531 531
 
532
-    /**
533
-     * Computes a score factor based on the fraction of all query terms that a
534
-     * document contains.  This value is multiplied into scores.
535
-     *
536
-     * The presence of a large portion of the query terms indicates a better
537
-     * match with the query, so implemenations of this method usually return
538
-     * larger values when the ratio between these parameters is large and smaller
539
-     * values when the ratio between them is small.
540
-     *
541
-     * overlap - the number of query terms matched in the document
542
-     * maxOverlap - the total number of terms in the query
543
-     * Returns a score factor based on term overlap with the query
544
-     *
545
-     * @param integer $overlap
546
-     * @param integer $maxOverlap
547
-     * @return float
548
-     */
549
-    abstract public function coord($overlap, $maxOverlap);
532
+	/**
533
+	 * Computes a score factor based on the fraction of all query terms that a
534
+	 * document contains.  This value is multiplied into scores.
535
+	 *
536
+	 * The presence of a large portion of the query terms indicates a better
537
+	 * match with the query, so implemenations of this method usually return
538
+	 * larger values when the ratio between these parameters is large and smaller
539
+	 * values when the ratio between them is small.
540
+	 *
541
+	 * overlap - the number of query terms matched in the document
542
+	 * maxOverlap - the total number of terms in the query
543
+	 * Returns a score factor based on term overlap with the query
544
+	 *
545
+	 * @param integer $overlap
546
+	 * @param integer $maxOverlap
547
+	 * @return float
548
+	 */
549
+	abstract public function coord($overlap, $maxOverlap);
550 550
 }
551 551
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @var array
46 46
      */
47
-    static private $_normTable = array( 0   => 0.0,
47
+    static private $_normTable = array(0   => 0.0,
48 48
                                         1   => 5.820766E-10,
49 49
                                         2   => 6.9849193E-10,
50 50
                                         3   => 8.1490725E-10,
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                                         252 => 4.2949673E9,
300 300
                                         253 => 5.3687091E9,
301 301
                                         254 => 6.4424509E9,
302
-                                        255 => 7.5161928E9 );
302
+                                        255 => 7.5161928E9);
303 303
 
304 304
 
305 305
     /**
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
             $delta = $f - self::$_normTable[$mid];
427 427
 
428 428
             if ($delta < 0) {
429
-                $highIndex = $mid-1;
429
+                $highIndex = $mid - 1;
430 430
             } elseif ($delta > 0) {
431
-                $lowIndex  = $mid+1;
431
+                $lowIndex  = $mid + 1;
432 432
             } else {
433 433
                 return $mid; // We got it!
434 434
             }
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
         // round to closest value
438 438
         if ($highIndex != 255 &&
439
-            $f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex+1] - $f ) {
439
+            $f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex + 1] - $f) {
440 440
             return $highIndex + 1;
441 441
         } else {
442 442
             return $highIndex;
Please login to merge, or discard this patch.
demos/quickstart/protected/index/Zend/Search/Lucene/Search/Weight.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     /**
53 53
      * Assigns the query normalization factor to this.
54 54
      *
55
-     * @param $norm
55
+     * @param double $norm
56 56
      */
57 57
     abstract public function normalize($norm);
58 58
 }
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Zend Framework
4
- *
5
- * LICENSE
6
- *
7
- * This source file is subject to version 1.0 of the Zend Framework
8
- * license, that is bundled with this package in the file LICENSE, and
9
- * is available through the world-wide-web at the following URL:
10
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
11
- * a copy of the Zend Framework license and are unable to obtain it
12
- * through the world-wide-web, please send a note to [email protected]
13
- * so we can mail you a copy immediately.
14
- *
15
- * @package    Zend_Search_Lucene
16
- * @subpackage Search
17
- * @copyright  Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
18
- * @license    http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
19
- */
3
+	 * Zend Framework
4
+	 *
5
+	 * LICENSE
6
+	 *
7
+	 * This source file is subject to version 1.0 of the Zend Framework
8
+	 * license, that is bundled with this package in the file LICENSE, and
9
+	 * is available through the world-wide-web at the following URL:
10
+	 * http://www.zend.com/license/framework/1_0.txt. If you did not receive
11
+	 * a copy of the Zend Framework license and are unable to obtain it
12
+	 * through the world-wide-web, please send a note to [email protected]
13
+	 * so we can mail you a copy immediately.
14
+	 *
15
+	 * @package    Zend_Search_Lucene
16
+	 * @subpackage Search
17
+	 * @copyright  Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
18
+	 * @license    http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
19
+	 */
20 20
 
21 21
 
22 22
 /**
@@ -35,25 +35,25 @@  discard block
 block discarded – undo
35 35
  */
36 36
 abstract class Zend_Search_Lucene_Search_Weight
37 37
 {
38
-    /**
39
-     * The weight for this query.
40
-     *
41
-     * @return float
42
-     */
43
-    abstract public function getValue();
38
+	/**
39
+	 * The weight for this query.
40
+	 *
41
+	 * @return float
42
+	 */
43
+	abstract public function getValue();
44 44
 
45
-    /**
46
-     * The sum of squared weights of contained query clauses.
47
-     *
48
-     * @return float
49
-     */
50
-    abstract public function sumOfSquaredWeights();
45
+	/**
46
+	 * The sum of squared weights of contained query clauses.
47
+	 *
48
+	 * @return float
49
+	 */
50
+	abstract public function sumOfSquaredWeights();
51 51
 
52
-    /**
53
-     * Assigns the query normalization factor to this.
54
-     *
55
-     * @param $norm
56
-     */
57
-    abstract public function normalize($norm);
52
+	/**
53
+	 * Assigns the query normalization factor to this.
54
+	 *
55
+	 * @param $norm
56
+	 */
57
+	abstract public function normalize($norm);
58 58
 }
59 59
 
Please login to merge, or discard this patch.
protected/index/Zend/Search/Lucene/Storage/Directory/Filesystem.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@
 block discarded – undo
241 241
      * Sets the modified time of $filename to now.
242 242
      *
243 243
      * @param string $filename
244
-     * @return void
244
+     * @return boolean
245 245
      */
246 246
     public function touchFile($filename)
247 247
     {
Please login to merge, or discard this patch.
Indentation   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -36,234 +36,234 @@
 block discarded – undo
36 36
  */
37 37
 class Zend_Search_Lucene_Storage_Directory_Filesystem extends Zend_Search_Lucene_Storage_Directory
38 38
 {
39
-    /**
40
-     * Filesystem path to the directory
41
-     *
42
-     * @var string
43
-     */
44
-    private $_dirPath = null;
45
-
46
-    /**
47
-     * Cache for Zend_Search_Lucene_Storage_File_Filesystem objects
48
-     * Array: filename => Zend_Search_Lucene_Storage_File object
49
-     *
50
-     * @var array
51
-     * @throws Zend_Search_Lucene_Exception
52
-     */
53
-    private $_fileHandlers;
54
-
55
-
56
-    /**
57
-     * Utility function to recursive directory creation
58
-     *
59
-     * @param string $dir
60
-     * @param integer $mode
61
-     * @param boolean $recursive
62
-     * @return boolean
63
-     */
64
-
65
-    static public function mkdirs($dir, $mode = 0777, $recursive = true)
66
-    {
67
-        if (is_null($dir) || $dir === '') {
68
-            return false;
69
-        }
70
-        if (is_dir($dir) || $dir === '/') {
71
-            return true;
72
-        }
73
-        if (self::mkdirs(dirname($dir), $mode, $recursive)) {
74
-            return mkdir($dir, $mode);
75
-        }
76
-        return false;
77
-    }
78
-
79
-
80
-    /**
81
-     * Object constructor
82
-     * Checks if $path is a directory or tries to create it.
83
-     *
84
-     * @param string $path
85
-     * @throws Zend_Search_Lucene_Exception
86
-     */
87
-    public function __construct($path)
88
-    {
89
-        if (!is_dir($path)) {
90
-            if (file_exists($path)) {
91
-                throw new Zend_Search_Lucene_Exception('Path exists, but it\'s not a directory');
92
-            } else {
93
-                if (!self::mkdirs($path)) {
94
-                    throw new Zend_Search_Lucene_Exception("Can't create directory '$path'.");
95
-                }
96
-            }
97
-        }
98
-        $this->_dirPath = $path;
99
-        $this->_fileHandlers = array();
100
-    }
101
-
102
-
103
-    /**
104
-     * Closes the store.
105
-     *
106
-     * @return void
107
-     */
108
-    public function close()
109
-    {
110
-        foreach ($this->_fileHandlers as $fileObject) {
111
-            $fileObject->close();
112
-        }
113
-
114
-        unset($this->_fileHandlers);
115
-    }
116
-
117
-
118
-    /**
119
-     * Returns an array of strings, one for each file in the directory.
120
-     *
121
-     * @return array
122
-     */
123
-    public function fileList()
124
-    {
125
-        $result = array();
126
-
127
-        $dirContent = opendir( $this->_dirPath );
128
-        while ($file = readdir($dirContent)) {
129
-            if (($file == '..')||($file == '.'))   continue;
130
-
131
-            $fullName = $this->_dirPath . '/' . $file;
132
-
133
-            if( !is_dir($this->_dirPath . '/' . $file) ) {
134
-                $result[] = $file;
135
-            }
136
-        }
137
-
138
-        return $result;
139
-    }
140
-
141
-    /**
142
-     * Creates a new, empty file in the directory with the given $filename.
143
-     *
144
-     * @param string $filename
145
-     * @return Zend_Search_Lucene_Storage_File
146
-     */
147
-    public function createFile($filename)
148
-    {
149
-        if (isset($this->_fileHandlers[$filename])) {
150
-            $this->_fileHandlers[$filename]->close();
151
-        }
152
-        unset($this->_fileHandlers[$filename]);
153
-        $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'w+b');
154
-        return $this->_fileHandlers[$filename];
155
-    }
156
-
157
-
158
-    /**
159
-     * Removes an existing $filename in the directory.
160
-     *
161
-     * @param string $filename
162
-     * @return void
163
-     */
164
-    public function deleteFile($filename)
165
-    {
166
-        if (isset($this->_fileHandlers[$filename])) {
167
-            $this->_fileHandlers[$filename]->close();
168
-        }
169
-        unset($this->_fileHandlers[$filename]);
170
-        unlink($this->_dirPath .'/'. $filename);
171
-    }
172
-
173
-
174
-    /**
175
-     * Returns true if a file with the given $filename exists.
176
-     *
177
-     * @param string $filename
178
-     * @return boolean
179
-     */
180
-    public function fileExists($filename)
181
-    {
182
-        return file_exists($this->_dirPath .'/'. $filename);
183
-    }
184
-
185
-
186
-    /**
187
-     * Returns the length of a $filename in the directory.
188
-     *
189
-     * @param string $filename
190
-     * @return integer
191
-     */
192
-    public function fileLength($filename)
193
-    {
194
-        if (isset( $this->_fileHandlers[$filename] )) {
195
-            return $this->_fileHandlers[$filename]->size();
196
-        }
197
-        return filesize($this->_dirPath .'/'. $filename);
198
-    }
199
-
200
-
201
-    /**
202
-     * Returns the UNIX timestamp $filename was last modified.
203
-     *
204
-     * @param string $filename
205
-     * @return integer
206
-     */
207
-    public function fileModified($filename)
208
-    {
209
-        return filemtime($this->_dirPath .'/'. $filename);
210
-    }
211
-
212
-
213
-    /**
214
-     * Renames an existing file in the directory.
215
-     *
216
-     * @param string $from
217
-     * @param string $to
218
-     * @return void
219
-     */
220
-    public function renameFile($from, $to)
221
-    {
222
-        if ($this->_fileHandlers[$from] !== null) {
223
-            $this->_fileHandlers[$from]->close();
224
-        }
225
-        unset($this->_fileHandlers[$from]);
226
-
227
-        if ($this->_fileHandlers[$to] !== null) {
228
-            $this->_fileHandlers[$to]->close();
229
-        }
230
-        unset($this->_fileHandlers[$to]);
231
-
232
-        if (file_exists($this->_dirPath . '/' . $to)) {
233
-            unlink($this->_dirPath . '/' . $to);
234
-        }
235
-
236
-        return @rename($this->_dirPath . '/' . $from, $this->_dirPath . '/' . $to);
237
-    }
238
-
239
-
240
-    /**
241
-     * Sets the modified time of $filename to now.
242
-     *
243
-     * @param string $filename
244
-     * @return void
245
-     */
246
-    public function touchFile($filename)
247
-    {
248
-        return touch($this->_dirPath .'/'. $filename);
249
-    }
250
-
251
-
252
-    /**
253
-     * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory.
254
-     *
255
-     * @param string $filename
256
-     * @return Zend_Search_Lucene_Storage_File
257
-     */
258
-    public function getFileObject($filename)
259
-    {
260
-        if (isset( $this->_fileHandlers[$filename] )) {
261
-            $this->_fileHandlers[$filename]->seek(0);
262
-            return $this->_fileHandlers[$filename];
263
-        }
264
-
265
-        $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'rb');
266
-        return $this->_fileHandlers[$filename];
267
-    }
39
+	/**
40
+	 * Filesystem path to the directory
41
+	 *
42
+	 * @var string
43
+	 */
44
+	private $_dirPath = null;
45
+
46
+	/**
47
+	 * Cache for Zend_Search_Lucene_Storage_File_Filesystem objects
48
+	 * Array: filename => Zend_Search_Lucene_Storage_File object
49
+	 *
50
+	 * @var array
51
+	 * @throws Zend_Search_Lucene_Exception
52
+	 */
53
+	private $_fileHandlers;
54
+
55
+
56
+	/**
57
+	 * Utility function to recursive directory creation
58
+	 *
59
+	 * @param string $dir
60
+	 * @param integer $mode
61
+	 * @param boolean $recursive
62
+	 * @return boolean
63
+	 */
64
+
65
+	static public function mkdirs($dir, $mode = 0777, $recursive = true)
66
+	{
67
+		if (is_null($dir) || $dir === '') {
68
+			return false;
69
+		}
70
+		if (is_dir($dir) || $dir === '/') {
71
+			return true;
72
+		}
73
+		if (self::mkdirs(dirname($dir), $mode, $recursive)) {
74
+			return mkdir($dir, $mode);
75
+		}
76
+		return false;
77
+	}
78
+
79
+
80
+	/**
81
+	 * Object constructor
82
+	 * Checks if $path is a directory or tries to create it.
83
+	 *
84
+	 * @param string $path
85
+	 * @throws Zend_Search_Lucene_Exception
86
+	 */
87
+	public function __construct($path)
88
+	{
89
+		if (!is_dir($path)) {
90
+			if (file_exists($path)) {
91
+				throw new Zend_Search_Lucene_Exception('Path exists, but it\'s not a directory');
92
+			} else {
93
+				if (!self::mkdirs($path)) {
94
+					throw new Zend_Search_Lucene_Exception("Can't create directory '$path'.");
95
+				}
96
+			}
97
+		}
98
+		$this->_dirPath = $path;
99
+		$this->_fileHandlers = array();
100
+	}
101
+
102
+
103
+	/**
104
+	 * Closes the store.
105
+	 *
106
+	 * @return void
107
+	 */
108
+	public function close()
109
+	{
110
+		foreach ($this->_fileHandlers as $fileObject) {
111
+			$fileObject->close();
112
+		}
113
+
114
+		unset($this->_fileHandlers);
115
+	}
116
+
117
+
118
+	/**
119
+	 * Returns an array of strings, one for each file in the directory.
120
+	 *
121
+	 * @return array
122
+	 */
123
+	public function fileList()
124
+	{
125
+		$result = array();
126
+
127
+		$dirContent = opendir( $this->_dirPath );
128
+		while ($file = readdir($dirContent)) {
129
+			if (($file == '..')||($file == '.'))   continue;
130
+
131
+			$fullName = $this->_dirPath . '/' . $file;
132
+
133
+			if( !is_dir($this->_dirPath . '/' . $file) ) {
134
+				$result[] = $file;
135
+			}
136
+		}
137
+
138
+		return $result;
139
+	}
140
+
141
+	/**
142
+	 * Creates a new, empty file in the directory with the given $filename.
143
+	 *
144
+	 * @param string $filename
145
+	 * @return Zend_Search_Lucene_Storage_File
146
+	 */
147
+	public function createFile($filename)
148
+	{
149
+		if (isset($this->_fileHandlers[$filename])) {
150
+			$this->_fileHandlers[$filename]->close();
151
+		}
152
+		unset($this->_fileHandlers[$filename]);
153
+		$this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'w+b');
154
+		return $this->_fileHandlers[$filename];
155
+	}
156
+
157
+
158
+	/**
159
+	 * Removes an existing $filename in the directory.
160
+	 *
161
+	 * @param string $filename
162
+	 * @return void
163
+	 */
164
+	public function deleteFile($filename)
165
+	{
166
+		if (isset($this->_fileHandlers[$filename])) {
167
+			$this->_fileHandlers[$filename]->close();
168
+		}
169
+		unset($this->_fileHandlers[$filename]);
170
+		unlink($this->_dirPath .'/'. $filename);
171
+	}
172
+
173
+
174
+	/**
175
+	 * Returns true if a file with the given $filename exists.
176
+	 *
177
+	 * @param string $filename
178
+	 * @return boolean
179
+	 */
180
+	public function fileExists($filename)
181
+	{
182
+		return file_exists($this->_dirPath .'/'. $filename);
183
+	}
184
+
185
+
186
+	/**
187
+	 * Returns the length of a $filename in the directory.
188
+	 *
189
+	 * @param string $filename
190
+	 * @return integer
191
+	 */
192
+	public function fileLength($filename)
193
+	{
194
+		if (isset( $this->_fileHandlers[$filename] )) {
195
+			return $this->_fileHandlers[$filename]->size();
196
+		}
197
+		return filesize($this->_dirPath .'/'. $filename);
198
+	}
199
+
200
+
201
+	/**
202
+	 * Returns the UNIX timestamp $filename was last modified.
203
+	 *
204
+	 * @param string $filename
205
+	 * @return integer
206
+	 */
207
+	public function fileModified($filename)
208
+	{
209
+		return filemtime($this->_dirPath .'/'. $filename);
210
+	}
211
+
212
+
213
+	/**
214
+	 * Renames an existing file in the directory.
215
+	 *
216
+	 * @param string $from
217
+	 * @param string $to
218
+	 * @return void
219
+	 */
220
+	public function renameFile($from, $to)
221
+	{
222
+		if ($this->_fileHandlers[$from] !== null) {
223
+			$this->_fileHandlers[$from]->close();
224
+		}
225
+		unset($this->_fileHandlers[$from]);
226
+
227
+		if ($this->_fileHandlers[$to] !== null) {
228
+			$this->_fileHandlers[$to]->close();
229
+		}
230
+		unset($this->_fileHandlers[$to]);
231
+
232
+		if (file_exists($this->_dirPath . '/' . $to)) {
233
+			unlink($this->_dirPath . '/' . $to);
234
+		}
235
+
236
+		return @rename($this->_dirPath . '/' . $from, $this->_dirPath . '/' . $to);
237
+	}
238
+
239
+
240
+	/**
241
+	 * Sets the modified time of $filename to now.
242
+	 *
243
+	 * @param string $filename
244
+	 * @return void
245
+	 */
246
+	public function touchFile($filename)
247
+	{
248
+		return touch($this->_dirPath .'/'. $filename);
249
+	}
250
+
251
+
252
+	/**
253
+	 * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory.
254
+	 *
255
+	 * @param string $filename
256
+	 * @return Zend_Search_Lucene_Storage_File
257
+	 */
258
+	public function getFileObject($filename)
259
+	{
260
+		if (isset( $this->_fileHandlers[$filename] )) {
261
+			$this->_fileHandlers[$filename]->seek(0);
262
+			return $this->_fileHandlers[$filename];
263
+		}
264
+
265
+		$this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'rb');
266
+		return $this->_fileHandlers[$filename];
267
+	}
268 268
 }
269 269
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $result = array();
126 126
 
127
-        $dirContent = opendir( $this->_dirPath );
127
+        $dirContent = opendir($this->_dirPath);
128 128
         while ($file = readdir($dirContent)) {
129
-            if (($file == '..')||($file == '.'))   continue;
129
+            if (($file == '..') || ($file == '.'))   continue;
130 130
 
131 131
             $fullName = $this->_dirPath . '/' . $file;
132 132
 
133
-            if( !is_dir($this->_dirPath . '/' . $file) ) {
133
+            if (!is_dir($this->_dirPath . '/' . $file)) {
134 134
                 $result[] = $file;
135 135
             }
136 136
         }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $this->_fileHandlers[$filename]->close();
168 168
         }
169 169
         unset($this->_fileHandlers[$filename]);
170
-        unlink($this->_dirPath .'/'. $filename);
170
+        unlink($this->_dirPath . '/' . $filename);
171 171
     }
172 172
 
173 173
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function fileExists($filename)
181 181
     {
182
-        return file_exists($this->_dirPath .'/'. $filename);
182
+        return file_exists($this->_dirPath . '/' . $filename);
183 183
     }
184 184
 
185 185
 
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function fileLength($filename)
193 193
     {
194
-        if (isset( $this->_fileHandlers[$filename] )) {
194
+        if (isset($this->_fileHandlers[$filename])) {
195 195
             return $this->_fileHandlers[$filename]->size();
196 196
         }
197
-        return filesize($this->_dirPath .'/'. $filename);
197
+        return filesize($this->_dirPath . '/' . $filename);
198 198
     }
199 199
 
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function fileModified($filename)
208 208
     {
209
-        return filemtime($this->_dirPath .'/'. $filename);
209
+        return filemtime($this->_dirPath . '/' . $filename);
210 210
     }
211 211
 
212 212
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      */
246 246
     public function touchFile($filename)
247 247
     {
248
-        return touch($this->_dirPath .'/'. $filename);
248
+        return touch($this->_dirPath . '/' . $filename);
249 249
     }
250 250
 
251 251
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public function getFileObject($filename)
259 259
     {
260
-        if (isset( $this->_fileHandlers[$filename] )) {
260
+        if (isset($this->_fileHandlers[$filename])) {
261 261
             $this->_fileHandlers[$filename]->seek(0);
262 262
             return $this->_fileHandlers[$filename];
263 263
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,9 @@
 block discarded – undo
126 126
 
127 127
         $dirContent = opendir( $this->_dirPath );
128 128
         while ($file = readdir($dirContent)) {
129
-            if (($file == '..')||($file == '.'))   continue;
129
+            if (($file == '..')||($file == '.')) {
130
+            	continue;
131
+            }
130 132
 
131 133
             $fullName = $this->_dirPath . '/' . $file;
132 134
 
Please login to merge, or discard this patch.
demos/quickstart/protected/pages/Search.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -42,6 +42,9 @@
 block discarded – undo
42 42
 		return $prefix.implode(' ', $subtext).$suffix;
43 43
 	}
44 44
 
45
+	/**
46
+	 * @param string $word
47
+	 */
45 48
 	protected function containsKeys($word, $keys)
46 49
 	{
47 50
 		foreach($keys as $key)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 {
8 8
 	public function onLoad($param)
9 9
 	{
10
-		if(!$this->IsPostBack && strlen($text = $this->search->getText()) > 0)
10
+		if (!$this->IsPostBack && strlen($text = $this->search->getText()) > 0)
11 11
 		{
12 12
 			$quickstart = $this->getApplication()->getModule("quickstart_search");
13
-			$hits_1 =  $quickstart->find($text);
13
+			$hits_1 = $quickstart->find($text);
14 14
 			$this->quickstart_results->setDataSource($hits_1);
15 15
 			$this->quickstart_results->dataBind();
16 16
 
@@ -21,32 +21,32 @@  discard block
 block discarded – undo
21 21
 	public function highlightSearch($text)
22 22
 	{
23 23
 		$words = str_word_count($text, 1);
24
-		$keys = str_word_count(strtolower($this->search->getText()),1);
24
+		$keys = str_word_count(strtolower($this->search->getText()), 1);
25 25
 		$where = 0;
26 26
 		$t = count($words);
27
-		for($i = 0; $i<$t; $i++)
27
+		for ($i = 0; $i < $t; $i++)
28 28
 		{
29
-			if($this->containsKeys(strtolower($words[$i]), $keys))
29
+			if ($this->containsKeys(strtolower($words[$i]), $keys))
30 30
 			{
31
-				$words[$i] = '<span class="searchterm">'.$words[$i].'</span>';
31
+				$words[$i] = '<span class="searchterm">' . $words[$i] . '</span>';
32 32
 				$where = $i;
33 33
 				break;
34 34
 			}
35 35
 		}
36 36
 
37
-		$min = 	$where - 15 < 0 ? 0 : $where - 15;
38
-		$max = 	$where + 15 > $t ? $t : $where + 15;
39
-		$subtext = array_splice($words, $min, $max-$min);
37
+		$min = $where - 15 < 0 ? 0 : $where - 15;
38
+		$max = $where + 15 > $t ? $t : $where + 15;
39
+		$subtext = array_splice($words, $min, $max - $min);
40 40
 		$prefix = $min == 0 ? '' : '...';
41 41
 		$suffix = $max == $t ? '' : '...';
42
-		return $prefix.implode(' ', $subtext).$suffix;
42
+		return $prefix . implode(' ', $subtext) . $suffix;
43 43
 	}
44 44
 
45 45
 	protected function containsKeys($word, $keys)
46 46
 	{
47
-		foreach($keys as $key)
47
+		foreach ($keys as $key)
48 48
 		{
49
-			if(is_int(strpos($word, $key)))
49
+			if (is_int(strpos($word, $key)))
50 50
 				return true;
51 51
 		}
52 52
 		return false;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@
 block discarded – undo
46 46
 	{
47 47
 		foreach($keys as $key)
48 48
 		{
49
-			if(is_int(strpos($word, $key)))
50
-				return true;
49
+			if(is_int(strpos($word, $key))) {
50
+							return true;
51
+			}
51 52
 		}
52 53
 		return false;
53 54
 	}
Please login to merge, or discard this patch.
demos/quickstart/protected/pages/ViewSource.php 3 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -69,11 +69,17 @@  discard block
 block discarded – undo
69 69
 		return $list;
70 70
 	}
71 71
 
72
+	/**
73
+	 * @param string $extension
74
+	 */
72 75
 	protected function isFileTypeAllowed($extension)
73 76
 	{
74 77
 		return in_array($extension,array('tpl','page','php','html'));
75 78
 	}
76 79
 
80
+	/**
81
+	 * @param string $fileName
82
+	 */
77 83
 	protected function getFileExtension($fileName)
78 84
 	{
79 85
 		if(($pos=strrpos($fileName,'.'))===false)
@@ -82,6 +88,9 @@  discard block
 block discarded – undo
82 88
 			return substr($fileName,$pos+1);
83 89
 	}
84 90
 
91
+	/**
92
+	 * @param string $extension
93
+	 */
85 94
 	protected function getFileType($extension)
86 95
 	{
87 96
 		if($extension==='tpl' || $extension==='page')
@@ -90,6 +99,9 @@  discard block
 block discarded – undo
90 99
 			return 'Class file';
91 100
 	}
92 101
 
102
+	/**
103
+	 * @param string $extension
104
+	 */
93 105
 	protected function getFileLanguage($extension)
94 106
 	{
95 107
 		switch($extension)
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -2,34 +2,34 @@  discard block
 block discarded – undo
2 2
 
3 3
 class ViewSource extends TPage
4 4
 {
5
-	private $_path=null;
6
-	private $_fullPath=null;
7
-	private $_fileType=null;
5
+	private $_path = null;
6
+	private $_fullPath = null;
7
+	private $_fileType = null;
8 8
 
9 9
 	public function onLoad($param)
10 10
 	{
11 11
 		parent::onLoad($param);
12
-		$path=$this->Request['path'];
13
-		$fullPath=realpath($this->Service->BasePath.'/'.$path);
14
-		$fileExt=$this->getFileExtension($fullPath);
15
-		if($fullPath!==false && is_file($fullPath) && strpos($fullPath,$this->Service->BasePath)!==false)
12
+		$path = $this->Request['path'];
13
+		$fullPath = realpath($this->Service->BasePath . '/' . $path);
14
+		$fileExt = $this->getFileExtension($fullPath);
15
+		if ($fullPath !== false && is_file($fullPath) && strpos($fullPath, $this->Service->BasePath) !== false)
16 16
 		{
17
- 			if($this->isFileTypeAllowed($fileExt))
17
+ 			if ($this->isFileTypeAllowed($fileExt))
18 18
  			{
19
-				$this->_fullPath=strtr($fullPath,'\\','/');
20
-				$this->_path=strtr(substr($fullPath,strlen($this->Service->BasePath)),'\\','/');
19
+				$this->_fullPath = strtr($fullPath, '\\', '/');
20
+				$this->_path = strtr(substr($fullPath, strlen($this->Service->BasePath)), '\\', '/');
21 21
  			}
22 22
 		}
23
-		if($this->_fullPath===null)
24
-			throw new THttpException(500,'File Not Found: %s',$path);
23
+		if ($this->_fullPath === null)
24
+			throw new THttpException(500, 'File Not Found: %s', $path);
25 25
 
26
-		$this->SourceList->DataSource=$this->SourceFiles;
26
+		$this->SourceList->DataSource = $this->SourceFiles;
27 27
 		$this->SourceList->dataBind();
28 28
 
29
-		$this->Highlighter->Language=$this->getFileLanguage($fileExt);
30
-		if($this->Request['lines']==='false')
31
-			$this->Highlighter->ShowLineNumbers=false;
32
-		$this->SourceView->Text=file_get_contents($this->_fullPath);
29
+		$this->Highlighter->Language = $this->getFileLanguage($fileExt);
30
+		if ($this->Request['lines'] === 'false')
31
+			$this->Highlighter->ShowLineNumbers = false;
32
+		$this->SourceView->Text = file_get_contents($this->_fullPath);
33 33
 	}
34 34
 
35 35
 	public function getFilePath()
@@ -39,23 +39,23 @@  discard block
 block discarded – undo
39 39
 
40 40
 	protected function getSourceFiles()
41 41
 	{
42
-		$list=array();
43
-		$basePath=dirname($this->_fullPath);
44
-		if($dh=opendir($basePath))
42
+		$list = array();
43
+		$basePath = dirname($this->_fullPath);
44
+		if ($dh = opendir($basePath))
45 45
 		{
46
-			while(($file=readdir($dh))!==false)
46
+			while (($file = readdir($dh)) !== false)
47 47
 			{
48
-				if(is_file($basePath.'/'.$file))
48
+				if (is_file($basePath . '/' . $file))
49 49
 				{
50
-					$extension=$this->getFileExtension($basePath.'/'.$file);
51
-					if($this->isFileTypeAllowed($extension))
50
+					$extension = $this->getFileExtension($basePath . '/' . $file);
51
+					if ($this->isFileTypeAllowed($extension))
52 52
 					{
53
-						$fileType=$this->getFileType($extension);
54
-						$list[]=array(
53
+						$fileType = $this->getFileType($extension);
54
+						$list[] = array(
55 55
 							'name'=>$file,
56 56
 							'type'=>$fileType,
57
-							'active'=>basename($this->_fullPath)===$file,
58
-							'url'=>'?page=ViewSource&amp;path=/'.ltrim(strtr(dirname($this->_path),'\\','/').'/'.$file,'/')
57
+							'active'=>basename($this->_fullPath) === $file,
58
+							'url'=>'?page=ViewSource&amp;path=/' . ltrim(strtr(dirname($this->_path), '\\', '/') . '/' . $file, '/')
59 59
 						);
60 60
 					}
61 61
 				}
@@ -63,28 +63,28 @@  discard block
 block discarded – undo
63 63
 			}
64 64
 			closedir($dh);
65 65
 		}
66
-		foreach($list as $item)
67
-			$aux[]=$item['name'];
66
+		foreach ($list as $item)
67
+			$aux[] = $item['name'];
68 68
 		array_multisort($aux, SORT_ASC, $list);
69 69
 		return $list;
70 70
 	}
71 71
 
72 72
 	protected function isFileTypeAllowed($extension)
73 73
 	{
74
-		return in_array($extension,array('tpl','page','php','html'));
74
+		return in_array($extension, array('tpl', 'page', 'php', 'html'));
75 75
 	}
76 76
 
77 77
 	protected function getFileExtension($fileName)
78 78
 	{
79
-		if(($pos=strrpos($fileName,'.'))===false)
79
+		if (($pos = strrpos($fileName, '.')) === false)
80 80
 			return '';
81 81
 		else
82
-			return substr($fileName,$pos+1);
82
+			return substr($fileName, $pos + 1);
83 83
 	}
84 84
 
85 85
 	protected function getFileType($extension)
86 86
 	{
87
-		if($extension==='tpl' || $extension==='page')
87
+		if ($extension === 'tpl' || $extension === 'page')
88 88
 			return 'Template file';
89 89
 		else
90 90
 			return 'Class file';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	protected function getFileLanguage($extension)
94 94
 	{
95
-		switch($extension)
95
+		switch ($extension)
96 96
 		{
97 97
 			case 'page' :
98 98
 			case 'tpl' :
Please login to merge, or discard this patch.
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,15 +20,17 @@  discard block
 block discarded – undo
20 20
 				$this->_path=strtr(substr($fullPath,strlen($this->Service->BasePath)),'\\','/');
21 21
  			}
22 22
 		}
23
-		if($this->_fullPath===null)
24
-			throw new THttpException(500,'File Not Found: %s',$path);
23
+		if($this->_fullPath===null) {
24
+					throw new THttpException(500,'File Not Found: %s',$path);
25
+		}
25 26
 
26 27
 		$this->SourceList->DataSource=$this->SourceFiles;
27 28
 		$this->SourceList->dataBind();
28 29
 
29 30
 		$this->Highlighter->Language=$this->getFileLanguage($fileExt);
30
-		if($this->Request['lines']==='false')
31
-			$this->Highlighter->ShowLineNumbers=false;
31
+		if($this->Request['lines']==='false') {
32
+					$this->Highlighter->ShowLineNumbers=false;
33
+		}
32 34
 		$this->SourceView->Text=file_get_contents($this->_fullPath);
33 35
 	}
34 36
 
@@ -63,8 +65,9 @@  discard block
 block discarded – undo
63 65
 			}
64 66
 			closedir($dh);
65 67
 		}
66
-		foreach($list as $item)
67
-			$aux[]=$item['name'];
68
+		foreach($list as $item) {
69
+					$aux[]=$item['name'];
70
+		}
68 71
 		array_multisort($aux, SORT_ASC, $list);
69 72
 		return $list;
70 73
 	}
@@ -76,18 +79,20 @@  discard block
 block discarded – undo
76 79
 
77 80
 	protected function getFileExtension($fileName)
78 81
 	{
79
-		if(($pos=strrpos($fileName,'.'))===false)
80
-			return '';
81
-		else
82
-			return substr($fileName,$pos+1);
82
+		if(($pos=strrpos($fileName,'.'))===false) {
83
+					return '';
84
+		} else {
85
+					return substr($fileName,$pos+1);
86
+		}
83 87
 	}
84 88
 
85 89
 	protected function getFileType($extension)
86 90
 	{
87
-		if($extension==='tpl' || $extension==='page')
88
-			return 'Template file';
89
-		else
90
-			return 'Class file';
91
+		if($extension==='tpl' || $extension==='page') {
92
+					return 'Template file';
93
+		} else {
94
+					return 'Class file';
95
+		}
91 96
 	}
92 97
 
93 98
 	protected function getFileLanguage($extension)
Please login to merge, or discard this patch.
demos/sqlmap/protected/pages/Sample/crud2.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -63,6 +63,9 @@
 block discarded – undo
63 63
 		$this->loadData();
64 64
 	}
65 65
 
66
+	/**
67
+	 * @param integer $index
68
+	 */
66 69
 	private function getText($param, $index)
67 70
 	{
68 71
 		$item = $param->Item;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
 
12 12
 	private function loadData()
13 13
 	{
14
-		$this->personList->DataSource =  $this->sqlmap()->queryForList('SelectAll');
14
+		$this->personList->DataSource = $this->sqlmap()->queryForList('SelectAll');
15 15
 		$this->personList->dataBind();
16 16
 	}
17 17
 
18 18
 	public function onLoad($param)
19 19
 	{
20
-		if(!$this->IsPostBack)
20
+		if (!$this->IsPostBack)
21 21
 			$this->loadData();
22 22
 	}
23 23
 
24
-	protected function editPerson($sender,$param)
24
+	protected function editPerson($sender, $param)
25 25
 	{
26
-		$this->personList->EditItemIndex=$param->Item->ItemIndex;
26
+		$this->personList->EditItemIndex = $param->Item->ItemIndex;
27 27
 		$this->loadData();
28 28
 	}
29 29
 
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 		$person->FirstName = "-- New Person --";
55 55
 		$this->sqlmap()->insert("Insert", $person);
56 56
 
57
-		$this->loadData();;
57
+		$this->loadData(); ;
58 58
 	}
59 59
 
60 60
 	protected function refreshList($sender, $param)
61 61
 	{
62
-		$this->personList->EditItemIndex=-1;
62
+		$this->personList->EditItemIndex = -1;
63 63
 		$this->loadData();
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@
 block discarded – undo
17 17
 
18 18
 	public function onLoad($param)
19 19
 	{
20
-		if(!$this->IsPostBack)
21
-			$this->loadData();
20
+		if(!$this->IsPostBack) {
21
+					$this->loadData();
22
+		}
22 23
 	}
23 24
 
24 25
 	protected function editPerson($sender,$param)
Please login to merge, or discard this patch.
demos/time-tracker/protected/App_Code/Dao/UserDao.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 	}
43 43
 
44 44
 	/**
45
-	 * @return array list of all enabled users.
45
+	 * @return TList list of all enabled users.
46 46
 	 */
47 47
 	public function getAllUsers()
48 48
 	{
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$param['user'] = $user;
61 61
 		$param['password'] = md5($password);
62 62
 		$sqlmap->insert('AddNewUser', $param);
63
-		if(count($user->getRoles()) > 0)
63
+		if (count($user->getRoles()) > 0)
64 64
 			$this->updateUserRoles($user);
65 65
 	}
66 66
 
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 	 * @param TimeTrackerUser updated user details.
79 79
 	 * @param string new user password, null to avoid updating password.
80 80
 	 */
81
-	public function updateUser($user,$password=null)
81
+	public function updateUser($user, $password = null)
82 82
 	{
83 83
 		$sqlmap = $this->getSqlMap();
84
-		if($password !== null)
84
+		if ($password !== null)
85 85
 		{
86 86
 			$param['user'] = $user;
87 87
 			$param['password'] = md5($password);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	{
127 127
 		$sqlmap = $this->getSqlMap();
128 128
 		$param['username'] = $user->getName();
129
-		$param['token'] = md5(microtime().$param['username']);
129
+		$param['token'] = md5(microtime() . $param['username']);
130 130
 		$sqlmap->insert('RegisterAutoSignon', $param);
131 131
 		return $param['token'];
132 132
 	}
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 	 * @param TimeTrackerUser deletes all signon token for given user, null to delete all
136 136
 	 * tokens.
137 137
 	 */
138
-	public function clearSignonTokens($user=null)
138
+	public function clearSignonTokens($user = null)
139 139
 	{
140 140
 		$sqlmap = $this->getSqlMap();
141
-		if($user !== null)
141
+		if ($user !== null)
142 142
 			$sqlmap->delete('DeleteAutoSignon', $user->getName());
143 143
 		else
144 144
 			$sqlmap->delete('DeleteAllSignon');
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	{
152 152
 		$sqlmap = $this->getSqlMap();
153 153
 		$sqlmap->delete('DeleteUserRoles', $user);
154
-		foreach($user->getRoles() as $role)
154
+		foreach ($user->getRoles() as $role)
155 155
 		{
156 156
 			$param['username'] = $user->getName();
157 157
 			$param['role'] = $role;
Please login to merge, or discard this patch.
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@  discard block
 block discarded – undo
60 60
 		$param['user'] = $user;
61 61
 		$param['password'] = md5($password);
62 62
 		$sqlmap->insert('AddNewUser', $param);
63
-		if(count($user->getRoles()) > 0)
64
-			$this->updateUserRoles($user);
63
+		if(count($user->getRoles()) > 0) {
64
+					$this->updateUserRoles($user);
65
+		}
65 66
 	}
66 67
 
67 68
 	/**
@@ -86,8 +87,7 @@  discard block
 block discarded – undo
86 87
 			$param['user'] = $user;
87 88
 			$param['password'] = md5($password);
88 89
 			$sqlmap->update('UpdateUserDetailsAndPassword', $param);
89
-		}
90
-		else
90
+		} else
91 91
 		{
92 92
 			$sqlmap->update('UpdateUserDetails', $user);
93 93
 		}
@@ -138,10 +138,11 @@  discard block
 block discarded – undo
138 138
 	public function clearSignonTokens($user=null)
139 139
 	{
140 140
 		$sqlmap = $this->getSqlMap();
141
-		if($user !== null)
142
-			$sqlmap->delete('DeleteAutoSignon', $user->getName());
143
-		else
144
-			$sqlmap->delete('DeleteAllSignon');
141
+		if($user !== null) {
142
+					$sqlmap->delete('DeleteAutoSignon', $user->getName());
143
+		} else {
144
+					$sqlmap->delete('DeleteAllSignon');
145
+		}
145 146
 	}
146 147
 
147 148
 	/**
Please login to merge, or discard this patch.