| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 109 | 
| Code Lines | 82 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 82 | public function testGetDefaultOptions()  | 
            ||
| 83 | 	{	 | 
            ||
| 84 | $expectedOptions = array (  | 
            ||
| 85 | 'uri' => array(  | 
            ||
| 86 | 'filter' => FILTER_SANITIZE_URL,  | 
            ||
| 87 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 88 | ),  | 
            ||
| 89 | 'base' => array(  | 
            ||
| 90 | 'default' => 'http://linkeddata.center/botk/resource/',  | 
            ||
| 91 | 'filter' => FILTER_SANITIZE_URL,  | 
            ||
| 92 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 93 | ),  | 
            ||
| 94 | 'id' => array(  | 
            ||
| 95 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 96 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_ID',  | 
            ||
| 97 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 98 | ),  | 
            ||
| 99 | 'page' => array(  | 
            ||
| 100 | 'filter' => FILTER_SANITIZE_URL,  | 
            ||
| 101 | 'flags' => FILTER_FORCE_ARRAY,  | 
            ||
| 102 | ),  | 
            ||
| 103 | 'homepage' => array(  | 
            ||
| 104 | 'filter' => FILTER_SANITIZE_URL,  | 
            ||
| 105 | 'flags' => FILTER_FORCE_ARRAY,  | 
            ||
| 106 | ),  | 
            ||
| 107 | 'businessType' => array(  | 
            ||
| 108 | // additional types as extension of schema:LocalBusiness  | 
            ||
| 109 | 'filter' => FILTER_DEFAULT,  | 
            ||
| 110 | 'flags' => FILTER_FORCE_ARRAY,  | 
            ||
| 111 | ),  | 
            ||
| 112 | 'taxID' => array(  | 
            ||
| 113 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 114 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_TOKEN',  | 
            ||
| 115 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 116 | ),  | 
            ||
| 117 | 'vatID' => array( // italian rules  | 
            ||
| 118 | 'filter' => FILTER_VALIDATE_REGEXP,  | 
            ||
| 119 | 			                        'options' 	=> array('regexp'=>'/^[0-9]{11}$/'), | 
            ||
| 120 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 121 | ),  | 
            ||
| 122 | 'legalName' => array(  | 
            ||
| 123 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 124 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',  | 
            ||
| 125 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 126 | ),  | 
            ||
| 127 | 'businessName' => array(  | 
            ||
| 128 | // a schema:alternateName for schema:PostalAddress  | 
            ||
| 129 | 'filter' => FILTER_DEFAULT,  | 
            ||
| 130 | 'flags' => FILTER_FORCE_ARRAY,  | 
            ||
| 131 | ),  | 
            ||
| 132 | 'addressDescription'=> array( //  | 
            ||
| 133 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 134 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',  | 
            ||
| 135 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 136 | ),  | 
            ||
| 137 | 'addressCountry' => array(  | 
            ||
| 138 | 'default' => 'IT',  | 
            ||
| 139 | 'filter' => FILTER_VALIDATE_REGEXP,  | 
            ||
| 140 | 			                        'options' 	=> array('regexp'=>'/^[A-Z]{2}$/'), | 
            ||
| 141 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 142 | ),  | 
            ||
| 143 | 'addressLocality' => array(  | 
            ||
| 144 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 145 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',  | 
            ||
| 146 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 147 | ),  | 
            ||
| 148 | 'addressRegion' => array(  | 
            ||
| 149 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 150 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',  | 
            ||
| 151 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 152 | ),  | 
            ||
| 153 | 'streetAddress' => array(  | 
            ||
| 154 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 155 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_ADDRESS',  | 
            ||
| 156 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 157 | ),  | 
            ||
| 158 | 'postalCode' => array( // italian rules  | 
            ||
| 159 | 'filter' => FILTER_VALIDATE_REGEXP,  | 
            ||
| 160 | 			                        'options' 	=> array('regexp'=>'/^[0-9]{5}$/'), | 
            ||
| 161 | 'flags' => FILTER_REQUIRE_SCALAR,  | 
            ||
| 162 | ),  | 
            ||
| 163 | 'telephone' => array(  | 
            ||
| 164 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 165 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_TELEPHONE',  | 
            ||
| 166 | 'flags' => FILTER_FORCE_ARRAY,  | 
            ||
| 167 | ),  | 
            ||
| 168 | 'faxNumber' => array(  | 
            ||
| 169 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 170 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_TELEPHONE',  | 
            ||
| 171 | 'flags' => FILTER_FORCE_ARRAY,  | 
            ||
| 172 | ),  | 
            ||
| 173 | 'email' => array(  | 
            ||
| 174 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 175 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_EMAIL',  | 
            ||
| 176 | 'flags' => FILTER_FORCE_ARRAY,  | 
            ||
| 177 | ),  | 
            ||
| 178 | 'lat' => array(  | 
            ||
| 179 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 180 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_GEO',  | 
            ||
| 181 | ),  | 
            ||
| 182 | 'long' => array(  | 
            ||
| 183 | 'filter' => FILTER_CALLBACK,  | 
            ||
| 184 | 'options' => '\BOTK\Filters::FILTER_SANITIZE_GEO',  | 
            ||
| 185 | ),  | 
            ||
| 186 | );  | 
            ||
| 187 | |||
| 188 | $localBusiness = new BOTK\Model\LocalBusiness(array());  | 
            ||
| 189 | $this->assertEquals($expectedOptions, $localBusiness->getOptions());  | 
            ||
| 190 | }  | 
            ||
| 191 | |||
| 315 |