Best Atoum code snippet using extractor.space
FilterController.php
Source:FilterController.php
1<?php2// src/AppBundle/Controller/FilterController.php3namespace AppBundle\Controller;4use Symfony\Component\HttpFoundation\Request,5 Symfony\Component\HttpFoundation\RequestStack,6 Symfony\Bundle\FrameworkBundle\Controller\Controller;7use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method,8 Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;9use AppBundle\Service\Filter\Utility\Interfaces\FilterArgumentsInterface,10 AppBundle\Entity\Estate,11 AppBundle\Service\Filter\Utility\Currency;12class FilterController extends Controller implements FilterArgumentsInterface13{14 // All15 public function estateTypeFilterAction(array $filterArguments, array $estates)16 {17 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');18 $estateTypes = $filterAvailableValuesExtractor->availableEstateTypes($estates);19 $checked = ( !empty($filterArguments[self::FILTER_ESTATE_TYPE]) ) ? $filterArguments[self::FILTER_ESTATE_TYPE] : [];20 return $this->render('AppBundle:Filter:estate_type.html.twig', [21 'estateTypes' => $estateTypes,22 'checked' => $checked23 ]);24 }25 // All26 public function tradeTypeFilterAction(array $filterArguments, array $estates)27 {28 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');29 $tradeTypes = $filterAvailableValuesExtractor->availableTradeTypes($estates);30 $checked = ( !empty($filterArguments[self::FILTER_TRADE_TYPE]) ) ? $filterArguments[self::FILTER_TRADE_TYPE] : [];31 return $this->render('AppBundle:Filter:trade_type.html.twig', [32 'tradeTypes' => $tradeTypes,33 'checked' => $checked34 ]);35 }36 // All37 public function currencyFilterAction(array $filterArguments, array $estates)38 {39 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');40 $currencies = $filterAvailableValuesExtractor->availableCurrencies();41 $checked = ( !empty($filterArguments[self::FILTER_CURRENCY]) ) ? $filterArguments[self::FILTER_CURRENCY] : Currency::getDefaultCurrency();42 return $this->render('AppBundle:Filter:currency.html.twig', [43 'currencies' => $currencies,44 'checked' => $checked45 ]);46 }47 // All48 public function priceFilterAction(array $filterArguments, array $estates, $currency)49 {50 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');51 $priceRange = $filterAvailableValuesExtractor->availablePriceRange($estates, $currency);52 $values = ( !empty($filterArguments[self::FILTER_PRICE]) ) ? $filterArguments[self::FILTER_PRICE] : [];53 return $this->render('AppBundle:Filter:price.html.twig', [54 'currency' => $currency,55 'priceRange' => $priceRange,56 'values' => $values57 ]);58 }59 // Variable60 public function pricePerSquareFilterAction(array $filterArguments, array $estates, $currency)61 {62 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');63 $pricePerSquareRange = $filterAvailableValuesExtractor->availablePricePerSquareRange($estates, $currency);64 # BIG FAT KLUDGE65 $pricePerSquareRange = $this->featurePricePerSquareRangeKludge($pricePerSquareRange, $filterArguments);66 # KLUDGES NEVER END67 $values = ( !empty($filterArguments[self::FILTER_PRICE_PER_SQUARE]) ) ? $filterArguments[self::FILTER_PRICE_PER_SQUARE] : [];68 return $this->render('AppBundle:Filter:price_per_square.html.twig', [69 'currency' => $currency,70 'pricePerSquareRange' => $pricePerSquareRange,71 'values' => $values72 ]);73 }74 private function featurePricePerSquareRangeKludge($pricePerSquareRange = [], $filterArguments)75 {76 $estateType = $this->get('request_stack')->getMasterRequest()->attributes->get('_route_params')['estateType'];77 if( $estateType == 'residential' )78 {79 if( empty($filterArguments['estate_type']) )80 return $pricePerSquareRange;81 if( $filterArguments['estate_type'] == 3 )82 {83 if( empty($filterArguments['trade_type']) )84 return $pricePerSquareRange;85 if( $filterArguments['trade_type'] == 'trade_type_rent' ) {86 return ['min' => NULL, 'max' => NULL];87 }88 if( $filterArguments['trade_type'] == 'trade_type_sale' ) {89 return $pricePerSquareRange;90 }91 }92 if( $filterArguments['estate_type'] == 4 )93 {94 if( empty($filterArguments['trade_type']) )95 return $pricePerSquareRange;96 if( $filterArguments['trade_type'] == 'trade_type_rent' ) {97 return ['min' => NULL, 'max' => NULL];98 }99 if( $filterArguments['trade_type'] == 'trade_type_sale' ) {100 return $pricePerSquareRange;101 }102 }103 }104 if( $estateType == 'commercial' )105 {106 if( empty($filterArguments['trade_type']) )107 return $pricePerSquareRange;108 if( $filterArguments['trade_type'] == 'trade_type_rent' ){109 return $pricePerSquareRange;110 }111 if( $filterArguments['trade_type'] == 'trade_type_sale' ) {112 return $pricePerSquareRange;113 }114 }115 }116 // All117 public function spaceFilterAction(array $filterArguments, array $estates)118 {119 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');120 $spaceRange = $filterAvailableValuesExtractor->availableSpaceRange($estates);121 $values = ( !empty($filterArguments[self::FILTER_SPACE]) ) ? $filterArguments[self::FILTER_SPACE] : [];122 return $this->render('AppBundle:Filter:space.html.twig', [123 'spaceRange' => $spaceRange,124 'values' => $values125 ]);126 }127 // Exclude128 public function spacePlotFilterAction(array $filterArguments, array $estates)129 {130 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');131 $spacePlotRange = $filterAvailableValuesExtractor->availableSpacePlotRange($estates);132 $values = ( !empty($filterArguments[self::FILTER_SPACE_PLOT]) ) ? $filterArguments[self::FILTER_SPACE_PLOT] : [];133 return $this->render('AppBundle:Filter:space_plot.html.twig', [134 'spacePlotRange' => $spacePlotRange,135 'values' => $values136 ]);137 }138 // Variable139 public function featureFilterAction(array $filterArguments, array $estates)140 {141 $filterAvailableValuesExtractor = $this->get('app.filter.available_values_extractor');142 $features = $filterAvailableValuesExtractor->availableFeatures($estates);143 # BIG FAT KLUDGE144 $features = $this->featureFilterKludge($features, $filterArguments);145 # KLUDGES NEVER END146 $checked = ( !empty($filterArguments[self::FILTER_FEATURES]) ) ? $filterArguments[self::FILTER_FEATURES] : [];147 return $this->render('AppBundle:Filter:feature.html.twig', [148 'features' => $features,...
extractor.php
Source:extractor.php
1<?php2/*3Copyright (C) 2013 Makoto Mizukami. All rights reserved.4Permission is hereby granted, free of charge, to any person obtaining a5copy of this software and associated documentation files (the "Software"),6to deal in the Software without restriction, including without limitation7the rights to use, copy, modify, merge, publish, distribute, sublicense,8and/or sell copies of the Software, and to permit persons to whom the9Software is furnished to do so, subject to the following conditions:10The above copyright notice and this permission notice shall be included in11all copies or substantial portions of the Software.12THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR13IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,14FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE15AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER16LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING17FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER18DEALINGS IN THE SOFTWARE.19*/20/*21extractor - reference extractor22Copyright (C) 2011 Makoto Mizukami.23*/24function extractor_hashtag_regex(){25 $UNICODE_SPACES = 26 "\011-\015" . // White_Space # Cc [5] <control-0009> / <control-000D>27 "\040" . // White_Space # Zs SPACE28 "\302\205" . // White_Space # Cc <control-0085>29 "\302\240" . // White_Space # Zs NO-BREAK SPACE30 "\341\232\200" . // White_Space # Zs OGHAM SPACE MARK31 "\341\243\240" . // White_Space # Zs MONGOLIAN VOWEL SEPARATOR32 "\342\200\200-\342\200\212" . // White_Space # Zs [11] EN QUAD / HAIR SPACE33 "\342\200\250" . // White_Space # Zl LINE SEPARATOR34 "\342\200\251" . // White_Space # Zp PARAGRAPH SEPARATOR35 "\342\200\257" . // White_Space # Zs NARROW NO-BREAK SPACE36 "\342\201\237" . // White_Space # Zs MEDIUM MATHEMATICAL SPACE37 "\343\200\200" . // White_Space # Zs IDEOGRAPHIC SPACE38 "";39 $LATIN_ACCENTS = "ÃÃÃÃÃÃ
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃà áâãäåæçèéêëìÃîïðñòóôõöøùúûüýþÅ\303\277";40 $NON_LATIN_HASHTAG_CHARS = 41 "\320\200-\323\277" . // Cyrillic (U+0400 / U+04ff)42 "\324\200-\324\247" . // Cyrillic Supplement (U+0500 / U+0527)43 "\342\267\240-\342\267\277" . // Cyrillic Extended A (U+2DE0 / U+2DFF)44 "\352\231\200-\352\232\237" . // Cyrillic Extended B (U+a640 / U+a69f)45 "\341\204\200-\341\207\277" . // Hangul Jamo (U+1100 / U+11ff)46 "\343\204\260-\343\206\205" . // Hangul Compatibility Jamo (U+3130 / U+3185)47 "\352\245\240-\352\245\277" . // Hangul Jamo Extended-A (U+A960 / U+A97F)48 "\352\260\200-\355\236\257" . // Hangul Syllables (U+AC00 / U+D7AF)49 "\355\236\260-\355\237\277" . // Hangul Jamo Extended-B (U+D7B0 / U+D7FF)50 "\357\276\241-\357\277\234" . // half-width Hangul (U+FFA1 / U+FFDC51 "\343\202\241-\343\203\272" . // Katakana (full-width) (U+30A1 / U+30FA)52 "\343\203\274-\343\203\276" . // Katakana Chouon and iteration marks (full-width) (U+30FC / U+30FE)53 "\357\275\246-\357\276\237" . // Katakana (half-width) (U+FF66 / U+FF9F)54 "\357\275\260" . // Katakana Chouon (half-width) (U+FF70 / U+FF70)55 "\357\274\220-\357\274\231" . // Fullwidth Digit (U+FF10 / U+FF19)56 "\357\274\241-\357\274\272" . // Latin (full-width, capital) (U+FF21 / U+FF3A)57 "\357\275\201-\357\275\232" . // Latin (full-width, small) (U+FF41 / U+FF5A)58 "\343\201\200-\343\202\226" . // Hiragana (U+3041 / U+3096)59 "\343\202\231-\343\202\236" . // Hiragana voicing and iteration mark (U+3099 / U+309E)60 "\343\220\200-\344\266\277" . // Kanji (CJK Extension A) (U+3400 / U+4DBF)61 "\344\270\200-\351\277\277" . // Kanji (Unified) (U+4E00 / U+9FFF)62 "\360\240\200\200-\360\252\233\237" . // Kanji (CJK Extension B) (U+20000 / U+2A6DF)63 "\360\252\234\200-\360\253\234\277" . // Kanji (CJK Extension C) (U+2A700 / U+2B73F)64 "\360\253\235\200-\360\253\240\237" . // Kanji (CJK Extension D) (U+2B740 / U+2B81F)65 "\360\257\240\200-\360\257\250\237" . // Kanji (CJK supplement) (U+2F800 / U+2FA1F)66 "\343\200\205" . // Kanji (iteration mark) (U+3005)67 "\343\200\273" . // Han iteration mark (U+303B)68 "";69 $HASHTAG_BOUNDARY = "^|$|[^&\/a-z0-9_{$LATIN_ACCENTS}{$NON_LATIN_HASHTAG_CHARS}]";70 $HASHTAG_ALPHA = "[a-z_{$LATIN_ACCENTS}{$NON_LATIN_HASHTAG_CHARS}]";71 $HASHTAG_ALPHANUMERIC = "[a-z0-9_{$LATIN_ACCENTS}{$NON_LATIN_HASHTAG_CHARS}]";72 $HASHTAG = "/({$HASHTAG_BOUNDARY})(#|ï¼)({$HASHTAG_ALPHANUMERIC}*{$HASHTAG_ALPHA}{$HASHTAG_ALPHANUMERIC}*)/iu";73 return $HASHTAG;74}75function extractor_url_regex(){76 $REGEX_URL_BEFORE = "(?:[^-\/\"'!=A-Z0-9_@ï¼ ]|^)";77 $REGEX_URL_DOMAIN = "(?:[^[:punct:]\s][\.-](?=[^[:punct:]\s])|[^[:punct:]\s]){1,}\.[a-z]{2,}(?::[0-9]+)?";78 $REGEX_URL_PATH_CHARS = "[a-z0-9!\*';:=\+\,\$\/%#\[\]\-_~]";79 $REGEX_URL_PATH = "(?:(?:{$REGEX_URL_PATH_CHARS}+)|(?:@{$REGEX_URL_PATH_CHARS}\/)|(?:[\.,]{$REGEX_URL_PATH_CHARS}+)|(?:\({$REGEX_URL_PATH_CHARS}+\)))*";80 $REGEX_URL_QUERY = "[a-z0-9!\*'\(\);:&=\+\$\/%#\[\]\-_\.,~]*[a-z0-9_&=#\/]";81 return "/" .82 "({$REGEX_URL_BEFORE})" . // $1 Preceding character83 "(" . // $2 URL84 "(https?:\/\/)" . // $3 Protocol85 "({$REGEX_URL_DOMAIN})" . // $4 Domain(s) and optional port number86 "(\/{$REGEX_URL_PATH})?" . // $5 URL Path and anchor87 "(\?{$REGEX_URL_QUERY})?" . // $6 Query String88 ")" .89 "/iux";90}91define("EXTRACTOR_HASHTAG_REGEX", extractor_hashtag_regex());92define("EXTRACTOR_USER_REGEX", "/(^|[^a-zA-Z0-9_])([@ï¼ ])([a-zA-Z0-9_]{1,20})(?=(.|$))/imu");93define("EXTRACTOR_USER_LIST_REGEX", "/(^|[^a-zA-Z0-9_])([@ï¼ ])([a-zA-Z0-9_]{1,20}(?:\/[a-zA-Z][a-zA-Z0-9_\-\302\200-\303\277]{0,24})?)(?=(.|$))/imu");94define("EXTRACTOR_URL_REGEX", extractor_url_regex());95define("EXTRACTOR_ISBN_REGEX", "/([^-\/\"'!=A-Z0-9_@ï¼ ]|^)(urn:isbn:([\d\-X]+))/imu");96function expand_tco($text, $entities){97 $urls = $entities->urls;98 if(!empty($entities->media)){99 $urls = array_merge($urls, $entities->media);100 }101 foreach($urls as $obj_url){102 if(empty($obj_url->expanded_url)){103 continue;104 }105 $obj_url->expanded_url = !empty($obj_url->media_url) ? $obj_url->media_url : $obj_url->expanded_url;106 $text = preg_replace("/" . preg_quote($obj_url->url, "/") . "/u", $obj_url->expanded_url, $text);107 }108 return $text;109}110function long_url($url){111 $lu_re = "/^https?:\/\/(bit\.ly|cli\.gs|digg\.com|fb\.me|is\.gd|j\.mp|kl\.am|su\.pr|tinyurl\.com|goo\.gl|307\.to|adjix\.com|b23\.ru|bacn\.me|bloat\.me|budurl\.com|clipurl\.us|cort\.as|dFL8\.me|dwarfurl\.com|ff\.im|fff\.to|href\.in|idek\.net|korta\.nu|lin\.cr|livesi\.de|ln-s\.net|loopt\.us|lost\.in|memurl\.com|merky\.de|migre\.me|moourl\.com|nanourl\.se|om\.ly|ow\.ly|peaurl\.com|ping\.fm|piurl\.com|plurl\.me|pnt\.me|poprl\.com|post\.ly|rde\.me|reallytinyurl\.com|redir\.ec|retwt\.me|rubyurl\.com|short\.ie|short\.to|smallr\.com|sn\.im|sn\.vc|snipr\.com|snipurl\.com|snurl\.com|tiny\.cc|tinysong\.com|togoto\.us|tr\.im|tra\.kz|trg\.li|twurl\.cc|twurl\.nl|u\.mavrev\.com|u\.nu|ur1\.ca|url\.az|url\.ie|urlx\.ie|w34\.us|xrl\.us|yep\.it|zi\.ma|zurl\.ws|chilp\.it|notlong\.com|qlnk\.net|trim\.li|url4\.eu|htn\.to|t\.co)\//";112 if(!preg_match($lu_re, $url)){113 return $url;114 }115 $headers = get_headers($url, 1);116 if(empty($headers["Location"])){117 return $url;118 }119 $location = is_array($headers["Location"]) ? $headers["Location"][0] : $headers["Location"];120 return $location;121}122function extractor_rplexturl_anchor($matches, $in_detail = FALSE){123 $url = $matches[2];124 $disp = !$in_detail && mb_strlen($url) > 128 ? mb_substr($url, 0, 125) . "..." : $url;125 return $matches[1] . markup_external_anchor($url, $disp);126}127function extractor_rplexturl_anchor_detail($matches){128 $matches[2] = long_url($matches[2]);129 return extractor_rplexturl_anchor($matches, TRUE);130}131function extractor_rplhash_anchor($matches){132 return "{$matches[1]}<a href=\"hash/" . rawurlencode($matches[3]) . "\">{$matches[2]}{$matches[3]}</a>";133}134function extractor_rplisbn_anchor($matches){135 $anchor = $matches[2];136 $isbn = preg_replace("/[^\dX]/i", "", $matches[3]);137 if(is_numeric($isbn) && strlen($isbn) === 13){138 $anchor = markup_external_anchor("http://duckduckgo.com/?q=isbn%20{$isbn}", $matches[2]);139 }else if((is_numeric($isbn) && strlen($isbn) === 10) || (strlen($isbn) === 9 && strtoupper($matches[3][9]) === "X")){140 $isbn13 = "978";141 $cd = (9 * 1) + (7 * 3) + (8 * 1);142 for($i = 0; $i < 9; $i += 1){143 $isbn13 .= $isbn[$i];144 $cd += (int) $isbn[$i] * ($i % 2 === 1 ? 1 : 3);145 }146 $isbn13 .= (string) ((10 - ($cd % 10)) % 10);147 $anchor = markup_external_anchor("http://duckduckgo.com/?q=isbn%20{$isbn13}", $matches[2]);148 }149 return $matches[1] . $anchor;150}151function extractor_replace_anchors($status, $in_detail = FALSE){152 $text = $status->text;153 $text = !empty($status->entities) ? expand_tco($text, $status->entities) : $text;154 $text = preg_replace_callback(EXTRACTOR_HASHTAG_REGEX, "extractor_rplhash_anchor", $text);155 $text = preg_replace(EXTRACTOR_USER_LIST_REGEX, "$1$2<a href=\"user/$3\">$3</a>", $text);156 $text = preg_replace_callback(EXTRACTOR_URL_REGEX, ($in_detail ? "extractor_rplexturl_anchor_detail" : "extractor_rplexturl_anchor"), $text);157 $text = preg_replace_callback(EXTRACTOR_ISBN_REGEX, "extractor_rplisbn_anchor", $text);158 return $text;159}160function extractor_extract_usernames($status){161 if(empty($status->entities)){162 preg_match_all(EXTRACTOR_USER_REGEX, $status->text, $matches);163 return $matches[4];164 }165 $entities = $status->entities;166 $names = array();167 foreach($entities->user_mentions as $user){168 $names[] = $user->screen_name;169 }170 return $names;171}172function extractor_extract_urls($status){173 $entities = !empty($status->entities->urls) ? $status->entities->urls : array();174 if(!empty($status->entities->media)){175 $entities = array_merge($entities, $status->entities->media);176 }177 $urls = array();178 foreach($entities as $entity){179 $urls[] = !empty($entity->media_url) ? $entity->media_url : (!empty($entity->expanded_url) ? $entity->expanded_url : $entity->url);180 }181 preg_match_all(EXTRACTOR_URL_REGEX, $status->text, $matches);182 $urls = array_unique(array_merge($matches[2], $urls));183 return $urls;184}185function extractor_get_users_str_to_reply($status, $is_to_all = FALSE){186 $to_users = array($status->user->screen_name);187 if($is_to_all){188 $found = extractor_extract_usernames($status);189 $to_users = array_unique(array_merge($to_users, $found));190 if(!is_current_user($status->user->screen_name) && $me = array_search(USERNAME, $to_users)){191 array_splice($to_users, $me, 1);192 }193 }194 return "@" . implode(" @", $to_users) . " ";195}...
Validator.php
Source:Validator.php
1<?php2// src/AppBundle/Service/Filter/Validator.php3namespace AppBundle\Service\Filter;4use Symfony\Component\HttpFoundation\Request;5use AppBundle\Service\Filter\Utility\Interfaces\FilterArgumentsInterface,6 AppBundle\Entity\Estate,7 AppBundle\Entity\EstateFeatures;8class Validator implements FilterArgumentsInterface9{10 private $_availableValuesExtractor;11 public function setAvailableValuesExtractor(AvailableValuesExtractor $availableValuesExtractor)12 {13 $this->_availableValuesExtractor = $availableValuesExtractor;14 }15 public function validateArguments(array $filterArguments, array $estates, $currency)16 {17 if( !empty($filterArguments[self::FILTER_DISTRICTS]) )18 {19 if( !$this->validateDistricts($filterArguments[self::FILTER_DISTRICTS]) )20 return FALSE;21 }22 if( !empty($filterArguments[self::FILTER_ESTATE_TYPE]) )23 {24 if( !$this->validateEstateType($filterArguments[self::FILTER_ESTATE_TYPE], $estates) )25 return FALSE;26 }27 if( !empty($filterArguments[self::FILTER_TRADE_TYPE]) )28 {29 if( !$this->validateTradeType($filterArguments[self::FILTER_TRADE_TYPE], $estates) )30 return FALSE;31 }32 if( !empty($filterArguments[self::FILTER_CURRENCY]) )33 {34 if( !$this->validateCurrency($filterArguments[self::FILTER_CURRENCY]) )35 return FALSE;36 }37 if( !empty($filterArguments[self::FILTER_PRICE]) )38 {39 $filterArguments[self::FILTER_PRICE] = $this->sanitizePriceRange($filterArguments[self::FILTER_PRICE], $estates, $currency);40 }41 if( !empty($filterArguments[self::FILTER_PRICE_PER_SQUARE]) )42 {43 $filterArguments[self::FILTER_PRICE_PER_SQUARE] = $this->sanitizePricePerSquareRange($filterArguments[self::FILTER_PRICE_PER_SQUARE], $estates, $currency);44 }45 if( !empty($filterArguments[self::FILTER_SPACE]) )46 {47 $filterArguments[self::FILTER_SPACE] = $this->sanitizeSpaceRange($filterArguments[self::FILTER_SPACE], $estates);48 }49 if( !empty($filterArguments[self::FILTER_SPACE_PLOT]) )50 {51 $filterArguments[self::FILTER_SPACE_PLOT] = $this->sanitizeSpacePlotRange($filterArguments[self::FILTER_SPACE_PLOT], $estates);52 }53 if( !empty($filterArguments[self::FILTER_ATTRIBUTES]) )54 {55 $filterArguments[self::FILTER_ATTRIBUTES] = $this->sanitizeAttributes($filterArguments[self::FILTER_ATTRIBUTES], $estates);56 }57 if( !empty($filterArguments[self::FILTER_FEATURES]) )58 {59 if( !$this->validateFeatures($filterArguments[self::FILTER_FEATURES]) )60 return FALSE;61 }62 return $filterArguments;63 }64 protected function validateEstateType($estateType, $estates)65 {66 $existingEstateTypes = $this->_availableValuesExtractor->availableEstateTypes($estates, $flatValues = TRUE);67 if( !in_array($estateType, $existingEstateTypes, TRUE) )68 return FALSE;69 return TRUE;70 }71 protected function validateTradeType($tradeType, $estates)72 {73 $existingTradeTypes = array_keys($this->_availableValuesExtractor->availableTradeTypes($estates));74 if( !in_array($tradeType, $existingTradeTypes, TRUE) )75 return FALSE;76 return TRUE;77 }78 protected function validateCurrency($currency)79 {80 $existingCurrencies = $this->_availableValuesExtractor->availableCurrencies();81 if( !in_array($currency, $existingCurrencies, TRUE) )82 return FALSE;83 return TRUE;84 }85 protected function sanitizePriceRange($priceRange, $estates, $currency)86 {87 $notValid = function($value) {88 return ( empty($value) || !is_numeric($value) || ($value < 0) );89 };90 $existingPriceRange = $this->_availableValuesExtractor->availablePriceRange($estates, $currency);91 if( !isset($priceRange['min']) || $notValid($priceRange['min']) )92 $priceRange['min'] = $existingPriceRange['min'];93 if( !isset($priceRange['max']) || $notValid($priceRange['max']) )94 $priceRange['max'] = $existingPriceRange['max'];95 return $priceRange;96 }97 protected function sanitizePricePerSquareRange($pricePerSquareRange, $estates, $currency)98 {99 $notValid = function($value) {100 return ( empty($value) || !is_numeric($value) || ($value < 0) );101 };102 $existingPricePerSquareRange = $this->_availableValuesExtractor->availablePricePerSquareRange($estates, $currency);103 if( !isset($pricePerSquareRange['min']) || $notValid($pricePerSquareRange['min']) )104 $pricePerSquareRange['min'] = $existingPricePerSquareRange['min'];105 if( !isset($pricePerSquareRange['max']) || $notValid($pricePerSquareRange['max']) )106 $pricePerSquareRange['max'] = $existingPricePerSquareRange['max'];107 if( $pricePerSquareRange['min'] == round($existingPricePerSquareRange['min']) &&108 $pricePerSquareRange['max'] == round($existingPricePerSquareRange['max']) ) {109 $pricePerSquareRange = NULL;110 }111 return $pricePerSquareRange;112 }113 protected function sanitizeSpaceRange($spaceRange, $estates)114 {115 $notValid = function($value) {116 return ( empty($value) || !is_numeric($value) || ($value < 0) );117 };118 $existingSpaceRange = $this->_availableValuesExtractor->availableSpaceRange($estates);119 if( !isset($spaceRange['min']) || $notValid($spaceRange['min']) )120 $spaceRange['min'] = $existingSpaceRange['min'];121 if( !isset($spaceRange['max']) || $notValid($spaceRange['max']) )122 $spaceRange['max'] = $existingSpaceRange['max'];123 if( $spaceRange['min'] == round($existingSpaceRange['min']) &&124 $spaceRange['max'] == round($existingSpaceRange['max']) ) {125 $spaceRange = NULL;126 }127 return $spaceRange;128 }129 protected function sanitizeSpacePlotRange($spacePlotRange, $estates)130 {131 $notValid = function($value) {132 return ( empty($value) || !is_numeric($value) || ($value < 0) );133 };134 $existingSpacePlotRange = $this->_availableValuesExtractor->availableSpacePlotRange($estates);135 if( !isset($spacePlotRange['min']) || $notValid($spacePlotRange['min']) )136 $spacePlotRange['min'] = $existingSpacePlotRange['min'];137 if( !isset($spacePlotRange['max']) || $notValid($spacePlotRange['max']) )138 $spacePlotRange['max'] = $existingSpacePlotRange['max'];139 if( $spacePlotRange['min'] == round($existingSpacePlotRange['min']) &&140 $spacePlotRange['max'] == round($existingSpacePlotRange['max']) ) {141 $spacePlotRange = NULL;142 }143 return $spacePlotRange;144 }145 protected function validateFeatures($features)146 {147 $existingEstateFeatures = EstateFeatures::getEstateFeatures();148 foreach ($features as $feature => $value)149 {150 if( !in_array($feature, $existingEstateFeatures, TRUE) )151 return FALSE;152 if( !in_array($value, ['yes', 'no'], TRUE) )153 return FALSE;154 }155 return TRUE;156 }157 protected function sanitizeAttributes($attributes, $estates)...
space
Using AI Code Generation
1$extractor = new SpaceExtractor();2$extractor->extract("This is a test sentence");3$extractor = new PunctuationExtractor();4$extractor->extract("This is a test sentence");5$extractor = new WordlistExtractor();6$extractor->extract("This is a test sentence");7$extractor = new NgramExtractor();8$extractor->extract("This is a test sentence");9$extractor = new NgramExtractor();10$extractor->extract("This is a test sentence", 2);11$extractor = new NgramExtractor();12$extractor->extract("This is a test sentence", 3);
space
Using AI Code Generation
1$extractor = new Extractor();2$extractor->setSpace();3$extractor->extract('1.txt', '1.php');4$extractor = new Extractor();5$extractor->setTab();6$extractor->extract('1.txt', '1.php');7$extractor = new Extractor();8$extractor->setComma();9$extractor->extract('1.txt', '1.php');10$extractor = new Extractor();11$extractor->setSpace();12$extractor->extract('2.txt', '2.php');13$extractor = new Extractor();14$extractor->setTab();15$extractor->extract('2.txt', '2.php');16$extractor = new Extractor();17$extractor->setComma();18$extractor->extract('2.txt', '2.php');19$extractor = new Extractor();20$extractor->setSpace();21$extractor->extract('3.txt', '3.php');22$extractor = new Extractor();23$extractor->setTab();24$extractor->extract('3.txt', '3.php');25$extractor = new Extractor();26$extractor->setComma();27$extractor->extract('3.txt', '3.php');28$extractor = new Extractor();29$extractor->setSpace();30$extractor->extract('4.txt', '4.php');31$extractor = new Extractor();32$extractor->setTab();33$extractor->extract('4.txt', '4.php');34$extractor = new Extractor();35$extractor->setComma();36$extractor->extract('4.txt', '4.php');37$extractor = new Extractor();
space
Using AI Code Generation
1$extractor = new Extractor();2$extractor->setSpaceMethod();3$extractor->setInput('input.txt');4$extractor->setOutput('output.txt');5$extractor->extract();6$extractor = new Extractor();7$extractor->setTabMethod();8$extractor->setInput('input.txt');9$extractor->setOutput('output.txt');10$extractor->extract();11$extractor = new Extractor();12$extractor->setCommaMethod();13$extractor->setInput('input.txt');14$extractor->setOutput('output.txt');15$extractor->extract();16$extractor = new Extractor();17$extractor->setPipeMethod();18$extractor->setInput('input.txt');19$extractor->setOutput('output.txt');20$extractor->extract();21$extractor = new Extractor();22$extractor->setSpaceMethod();23$extractor->setInput('input.txt');24$extractor->setOutput('output.txt');25$extractor->extract();26$extractor = new Extractor();27$extractor->setTabMethod();28$extractor->setInput('input.txt');29$extractor->setOutput('output.txt');30$extractor->extract();31$extractor = new Extractor();32$extractor->setCommaMethod();33$extractor->setInput('input.txt');34$extractor->setOutput('output.txt');35$extractor->extract();36$extractor = new Extractor();37$extractor->setPipeMethod();38$extractor->setInput('input.txt');39$extractor->setOutput('output.txt');40$extractor->extract();41$extractor = new Extractor();42$extractor->setSpaceMethod();43$extractor->setInput('input
space
Using AI Code Generation
1$extractor = new Extractor();2$extractor->setInputFile('input.txt');3$extractor->setOutputFile('output.txt');4$extractor->setWordLength(3);5$extractor->extractWords();6$extractor = new Extractor();7$extractor->setInputFile('input.txt');8$extractor->setOutputFile('output.txt');9$extractor->setWordLength(3);10$extractor->setDelimiter('-');11$extractor->extractWords();12$extractor = new Extractor();13$extractor->setInputFile('input.txt');14$extractor->setOutputFile('output.txt');15$extractor->setWordLength(3);16$extractor->setDelimiter(',');17$extractor->extractWords();18$extractor = new Extractor();19$extractor->setInputFile('input.txt');20$extractor->setOutputFile('output.txt');21$extractor->setWordLength(3);22$extractor->extractWords();23$extractor = new Extractor();24$extractor->setInputFile('input.txt');25$extractor->setOutputFile('output.txt');26$extractor->setWordLength(3);27$extractor->setDelimiter('-');28$extractor->extractWords();29$extractor = new Extractor();30$extractor->setInputFile('input.txt');31$extractor->setOutputFile('output.txt');32$extractor->setWordLength(3);33$extractor->setDelimiter(',');34$extractor->extractWords();35$extractor = new Extractor();36$extractor->setInputFile('input.txt');37$extractor->setOutputFile('output.txt');38$extractor->setWordLength(3);39$extractor->extractWords();40$extractor = new Extractor();41$extractor->setInputFile('input.txt');42$extractor->setOutputFile('output.txt');43$extractor->setWordLength(3);44$extractor->setDelimiter('-');
space
Using AI Code Generation
1require_once 'Extractor.php';2$extractor = new Extractor();3$extractor->setSpace();4$extractor->setSource('1.txt');5$extractor->setDestination('2.txt');6$extractor->extract();7require_once 'Extractor.php';8$extractor = new Extractor();9$extractor->setComma();10$extractor->setSource('1.txt');11$extractor->setDestination('2.txt');12$extractor->extract();13require_once 'Extractor.php';14$extractor = new Extractor();15$extractor->setTab();16$extractor->setSource('1.txt');17$extractor->setDestination('2.txt');18$extractor->extract();19require_once 'Extractor.php';20$extractor = new Extractor();21$extractor->setTab();22$extractor->setSource('1.txt');23$extractor->setDestination('2.txt');24$extractor->extract();25require_once 'Extractor.php';26$extractor = new Extractor();27$extractor->setTab();28$extractor->setSource('1.txt');29$extractor->setDestination('2.txt');30$extractor->extract();31require_once 'Extractor.php';32$extractor = new Extractor();33$extractor->setTab();34$extractor->setSource('1.txt');35$extractor->setDestination('2.txt');36$extractor->extract();37require_once 'Extractor.php';38$extractor = new Extractor();39$extractor->setTab();40$extractor->setSource('1.txt');41$extractor->setDestination('2.txt');42$extractor->extract();43require_once 'Extractor.php';44$extractor = new Extractor();45$extractor->setTab();46$extractor->setSource('1.txt');47$extractor->setDestination('2.txt');48$extractor->extract();
space
Using AI Code Generation
1$extractor = new Space();2$extractor->setPdf($pdf);3$text = $extractor->getText();4echo $text;5$extractor = new Text();6$extractor->setPdf($pdf);7$text = $extractor->getText();8echo $text;9$extractor = new Location();10$extractor->setPdf($pdf);11$text = $extractor->getText();12echo $text;13$extractor = new Order();14$extractor->setPdf($pdf);15$text = $extractor->getText();16echo $text;17$extractor = new Stream();18$extractor->setPdf($pdf);19$text = $extractor->getText();20echo $text;21$extractor = new Xml();22$extractor->setPdf($pdf);23$text = $extractor->getText();24echo $text;25$extractor = new XmlRaw();26$extractor->setPdf($pdf);27$text = $extractor->getText();28echo $text;29$extractor = new XmlSimple();30$extractor->setPdf($pdf);31$text = $extractor->getText();32echo $text;33$extractor = new XmlSimpleRaw();34$extractor->setPdf($pdf);35$text = $extractor->getText();36echo $text;
space
Using AI Code Generation
1$extractor = new Extractor();2$extractor->setSpace(1);3$extractor->extract("1.txt");4$extractor->printResult();5$extractor->setSpace(2);6$extractor->extract("1.txt");7$extractor->printResult();8$extractor->setSpace(3);9$extractor->extract("1.txt");10$extractor->printResult();11$extractor->setSpace(4);12$extractor->extract("1.txt");13$extractor->printResult();14$extractor = new Extractor();15$extractor->setSpace(1);16$extractor->extract("2.txt");17$extractor->printResult();18$extractor->setSpace(2);19$extractor->extract("2.txt");20$extractor->printResult();21$extractor->setSpace(3);22$extractor->extract("2.txt");23$extractor->printResult();24$extractor->setSpace(4);25$extractor->extract("2.txt");26$extractor->printResult();27$extractor = new Extractor();28$extractor->setSpace(1);29$extractor->extract("3.txt");30$extractor->printResult();31$extractor->setSpace(2);32$extractor->extract("3.txt");33$extractor->printResult();34$extractor->setSpace(3);35$extractor->extract("3.txt");36$extractor->printResult();37$extractor->setSpace(4);38$extractor->extract("3.txt");39$extractor->printResult();40$extractor = new Extractor();41$extractor->setSpace(1);42$extractor->extract("4.txt");43$extractor->printResult();44$extractor->setSpace(2);45$extractor->extract("4.txt");46$extractor->printResult();47$extractor->setSpace(3);48$extractor->extract("4.txt");49$extractor->printResult();50$extractor->setSpace(4);51$extractor->extract("4.txt");52$extractor->printResult();
space
Using AI Code Generation
1$extractor = new Space();2$extractor->extract($text);3$extractor->getKeywords();4$extractor->getWeightedKeywords();5$extractor->getKeywordCount();6$extractor->getWeightedKeywordCount();7$extractor->getKeywordDensity();8$extractor->getWeightedKeywordDensity();9$extractor = new Frequency();10$extractor->extract($text);11$extractor->getKeywords();12$extractor->getWeightedKeywords();13$extractor->getKeywordCount();14$extractor->getWeightedKeywordCount();15$extractor->getKeywordDensity();16$extractor->getWeightedKeywordDensity();17$extractor = new TfIdf();18$extractor->extract($text);19$extractor->getKeywords();20$extractor->getWeightedKeywords();21$extractor->getKeywordCount();22$extractor->getWeightedKeywordCount();23$extractor->getKeywordDensity();24$extractor->getWeightedKeywordDensity();25$extractor = new TfIdf();26$extractor->extract($text);27$extractor->getKeywords();28$extractor->getWeightedKeywords();29$extractor->getKeywordCount();30$extractor->getWeightedKeywordCount();31$extractor->getKeywordDensity();32$extractor->getWeightedKeywordDensity();33$extractor = new TfIdf();34$extractor->extract($text);35$extractor->getKeywords();36$extractor->getWeightedKeywords();37$extractor->getKeywordCount();38$extractor->getWeightedKeywordCount();39$extractor->getKeywordDensity();40$extractor->getWeightedKeywordDensity();41$extractor = new TfIdf();42$extractor->extract($text);43$extractor->getKeywords();44$extractor->getWeightedKeywords();45$extractor->getKeywordCount();46$extractor->getWeightedKeywordCount();47$extractor->getKeywordDensity();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with space on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!