features/search/lib.php
Method perform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static function perform($terms){
$terms = Search::split_terms($terms);
$terms_db = Search::db_escape_terms($terms);
$terms_rx = Search::rx_escape_terms($terms);
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Search {
- Exclude checks
Method name "Search::transform_term" is not in camel caps format Open
Open
static function transform_term($term){
- Exclude checks
The static declaration must come after the visibility declaration Open
Open
static private function pretty_terms($terms_html){
- Exclude checks
Each PHP statement must be on a line by itself Open
Open
$term = preg_replace_callback("/(\s)/", function($m) {return '{WHITESPACE-'.ord($m[1]).'}';}, $term);
- Exclude checks
Each PHP statement must be on a line by itself Open
Open
$terms = preg_replace_callback("/\"(.*?)\"/", function($m) {return Search::transform_term($m[1]);}, $terms);
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$terms = preg_replace_callback("/\"(.*?)\"/", function($m) {return Search::transform_term($m[1]);}, $terms);
- Exclude checks
Visibility must be declared on method "perform" Open
Open
static function perform($terms){
- Exclude checks
The static declaration must come after the visibility declaration Open
Open
static private function rx_escape_terms($terms){
- Exclude checks
The closing brace for the class must go on the next line after the body Open
Open
}
- Exclude checks
The static declaration must come after the visibility declaration Open
Open
static private function html_escape_terms($terms){
- Exclude checks
Visibility must be declared on method "transform_term" Open
Open
static function transform_term($term){
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$term = preg_replace_callback("/(\s)/", function($m) {return '{WHITESPACE-'.ord($m[1]).'}';}, $term);
- Exclude checks
Method name "Search::escape_rlike" is not in camel caps format Open
Open
static private function escape_rlike($string){
- Exclude checks
The static declaration must come after the visibility declaration Open
Open
static private function db_escape_terms($terms){
- Exclude checks
Method name "Search::rx_escape_terms" is not in camel caps format Open
Open
static private function rx_escape_terms($terms){
- Exclude checks
The static declaration must come after the visibility declaration Open
Open
static private function escape_rlike($string){
- Exclude checks
Visibility must be declared on method "sort_results" Open
Open
static function sort_results($a, $b){
- Exclude checks
Method name "Search::sort_results" is not in camel caps format Open
Open
static function sort_results($a, $b){
- Exclude checks
Opening brace of a class must be on the line after the definition Open
Open
class Search {
- Exclude checks
Method name "Search::split_terms" is not in camel caps format Open
Open
static private function split_terms($terms){
- Exclude checks
Method name "Search::html_escape_terms" is not in camel caps format Open
Open
static private function html_escape_terms($terms){
- Exclude checks
Method name "Search::pretty_terms" is not in camel caps format Open
Open
static private function pretty_terms($terms_html){
- Exclude checks
Blank line found at start of control structure Open
Open
foreach($terms as $term){
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
$term = preg_replace_callback("/\{WHITESPACE-([0-9]+)\}/", function($m) {return chr($m[1]);}, $term);
- Exclude checks
Each PHP statement must be on a line by itself Open
Open
$term = preg_replace_callback("/\{WHITESPACE-([0-9]+)\}/", function($m) {return chr($m[1]);}, $term);
- Exclude checks
The static declaration must come after the visibility declaration Open
Open
static private function split_terms($terms){
- Exclude checks
Blank line found at start of control structure Open
Open
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
- Exclude checks
Method name "Search::db_escape_terms" is not in camel caps format Open
Open
static private function db_escape_terms($terms){
- Exclude checks
Opening brace must be the last content on the line Open
Open
$terms = preg_replace_callback("/\"(.*?)\"/", function($m) {return Search::transform_term($m[1]);}, $terms);
- Exclude checks
Closing brace must be on a line by itself Open
Open
$terms = preg_replace_callback("/\"(.*?)\"/", function($m) {return Search::transform_term($m[1]);}, $terms);
- Exclude checks
Opening brace should be on a new line Open
Open
static function perform($terms){
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
Open
foreach($terms as $term){
- Exclude checks
Closing brace must be on a line by itself Open
Open
$term = preg_replace_callback("/(\s)/", function($m) {return '{WHITESPACE-'.ord($m[1]).'}';}, $term);
- Exclude checks
Opening brace should be on a new line Open
Open
static private function db_escape_terms($terms){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
- Exclude checks
Closing brace must be on a line by itself Open
Open
$term = preg_replace_callback("/\{WHITESPACE-([0-9]+)\}/", function($m) {return chr($m[1]);}, $term);
- Exclude checks
Newline required after opening brace Open
Open
if ($ax == $bx){ return 0; }
- Exclude checks
Closing brace must be on a line by itself Open
Open
if ($ax == $bx){ return 0; }
- Exclude checks
Expected 1 space after closing brace; 0 found Open
Open
}else{
- Exclude checks
Opening brace must be the last content on the line Open
Open
$term = preg_replace_callback("/\{WHITESPACE-([0-9]+)\}/", function($m) {return chr($m[1]);}, $term);
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
foreach($terms_db as $term_db){
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
Open
foreach($terms as $term){
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
Open
foreach($terms_rx as $term_rx){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
foreach($terms_rx as $term_rx){
- Exclude checks
Opening brace should be on a new line Open
Open
static function sort_results($a, $b){
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
Open
foreach($terms as $term){
- Exclude checks
Opening brace should be on a new line Open
Open
static private function rx_escape_terms($terms){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
if (preg_match("/\s|,/", $term)){
- Exclude checks
Expected 1 space after ELSE keyword; 0 found Open
Open
}else{
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
Open
foreach($terms_db as $term_db){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
if (count($terms_html) == 1){
- Exclude checks
Opening brace must be the last content on the line Open
Open
$term = preg_replace_callback("/(\s)/", function($m) {return '{WHITESPACE-'.ord($m[1]).'}';}, $term);
- Exclude checks
Opening brace should be on a new line Open
Open
static private function escape_rlike($string){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
foreach($terms as $term){
- Exclude checks
Opening brace should be on a new line Open
Open
static function transform_term($term){
- Exclude checks
Expected 1 space after WHILE keyword; 0 found Open
Open
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
foreach($terms as $term){
- Exclude checks
Opening brace should be on a new line Open
Open
static private function html_escape_terms($terms){
- Exclude checks
Opening brace should be on a new line Open
Open
static private function pretty_terms($terms_html){
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
Open
foreach($terms as $term){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
if ($ax == $bx){ return 0; }
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
foreach($terms as $term){
- Exclude checks
Opening brace should be on a new line Open
Open
static private function split_terms($terms){
- Exclude checks
Expected 1 space after closing parenthesis; found 0 Open
Open
foreach($terms as $term){
- Exclude checks