idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
51,800
private function isProcessRunning ( $ pid ) { $ state = array ( ) ; exec ( sprintf ( 'ps -o pid %d' , $ pid ) , $ state ) ; $ state = array_map ( 'trim' , $ state ) ; return 1 < count ( $ state ) && in_array ( $ pid , $ state ) ; }
Check if a process with the given pid is running
51,801
private function getSupervisorPid ( ) { $ pidPath = $ this -> paths [ 'pid_file' ] ; $ pid = null ; if ( is_file ( $ pidPath ) && is_readable ( $ pidPath ) ) { $ pid = ( int ) file_get_contents ( $ pidPath ) ; } return $ pid ; }
Determines the supervisord process id
51,802
protected function addPaths ( ArrayNodeDefinition $ node ) { $ node -> fixXmlConfig ( 'path' ) -> children ( ) -> arrayNode ( 'paths' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'workspace_directory' ) -> defaultValue ( '%kernel.root_dir%/supervisor/%kernel.environment%/' ) -> end ( ) -> scalarNode ( '...
Add paths configuration
51,803
protected function addCommands ( ArrayNodeDefinition $ node ) { $ node -> fixXmlConfig ( 'command' ) -> children ( ) -> arrayNode ( 'commands' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'rabbitmq_consumer' ) -> defaultValue ( 'rabbitmq:consumer' ) -> end ( ) -> scalarNode ( 'rabbitmq_multiple_consumer...
Add commands configuration
51,804
protected function addConsumer ( ArrayNodeDefinition $ node ) { $ consumerChildren = $ node -> children ( ) -> arrayNode ( 'consumer' ) -> addDefaultsIfNotSet ( ) -> children ( ) ; $ general = $ consumerChildren -> arrayNode ( 'general' ) ; $ this -> addGeneralConsumerConfiguration ( $ general ) ; $ individualPrototype...
Add general and individual consumer configuration
51,805
public function execute ( $ cmd , $ failOnError = true ) { $ command = $ this -> createSupervisorControlCommand ( $ cmd ) ; $ this -> logger -> debug ( 'Executing: ' . $ command ) ; $ p = new Process ( $ command ) ; $ p -> setWorkingDirectory ( $ this -> applicationDirectory ) ; $ p -> run ( ) ; if ( $ failOnError ) { ...
Execute a supervisorctl command
51,806
public function runAndReload ( ) { $ commands = [ ] ; $ commands [ ] = sprintf ( ' && %s' , $ this -> createSupervisorControlCommand ( 'reread' ) ) ; $ commands [ ] = sprintf ( ' && %s' , $ this -> createSupervisorControlCommand ( 'update' ) ) ; $ this -> run ( implode ( '' , $ commands ) ) ; }
Update configuration and processes
51,807
public function run ( $ followingCommand = '' ) { $ result = $ this -> execute ( 'status' , false ) -> getOutput ( ) ; if ( strpos ( $ result , 'sock no such file' ) || strpos ( $ result , 'refused connection' ) ) { $ command = sprintf ( 'supervisord%1$s%2$s%3$s' , $ this -> configurationParameter , $ this -> identifie...
Start supervisord if not already running
51,808
public function log ( $ text , $ userId = '' , $ attributes = [ ] ) { Activity :: create ( [ 'text' => $ text , 'user_id' => ( $ userId == '' ? null : $ userId ) , 'ip_address' => $ attributes [ 'ipAddress' ] , ] ) ; return true ; }
Log activity in an Eloquent model .
51,809
public function cleanLog ( $ maxAgeInMonths ) { $ minimumDate = Carbon :: now ( ) -> subMonths ( $ maxAgeInMonths ) ; Activity :: where ( 'created_at' , '<=' , $ minimumDate ) -> delete ( ) ; return true ; }
Clean old log records .
51,810
public function log ( $ text , $ userId = '' , $ attributes = [ ] ) { $ logText = $ text ; $ logText .= ( $ userId != '' ? ' (by user_id ' . $ userId . ')' : '' ) ; $ logText .= ( count ( $ attributes ) ) ? PHP_EOL . print_r ( $ attributes , true ) : '' ; Log :: info ( $ logText ) ; return true ; }
Log activity in Laravels log handler .
51,811
public function log ( $ text , $ userId = '' ) { $ userId = $ this -> normalizeUserId ( $ userId ) ; if ( ! $ this -> shouldLogCall ( $ text , $ userId ) ) { return false ; } $ ipAddress = Request :: getClientIp ( ) ; foreach ( $ this -> logHandlers as $ logHandler ) { $ logHandler -> log ( $ text , $ userId , compact ...
Log some activity to all registered log handlers .
51,812
public function cleanLog ( ) { foreach ( $ this -> logHandlers as $ logHandler ) { $ logHandler -> cleanLog ( Config :: get ( 'activitylog.deleteRecordsOlderThanMonths' ) ) ; } return true ; }
Clean out old entries in the log .
51,813
public function normalizeUserId ( $ userId ) { if ( is_numeric ( $ userId ) ) { return $ userId ; } if ( is_object ( $ userId ) ) { return $ userId -> id ; } if ( $ this -> auth -> check ( ) ) { return $ this -> auth -> user ( ) -> id ; } if ( is_numeric ( $ this -> config -> get ( 'activitylog.defaultUserId' ) ) ) { r...
Normalize the user id .
51,814
protected function shouldLogCall ( $ text , $ userId ) { $ beforeHandler = $ this -> config -> get ( 'activitylog.beforeHandler' ) ; if ( is_null ( $ beforeHandler ) || $ beforeHandler == '' ) { return true ; } return app ( $ beforeHandler ) -> shouldLog ( $ text , $ userId ) ; }
Determine if this call should be logged .
51,815
public function getFormatted ( ) { if ( $ this -> getUnit ( ) != "" ) { return $ this -> getValue ( ) . " " . $ this -> getUnit ( ) ; } else { return ( string ) $ this -> getValue ( ) ; } }
Get the value as formatted string with unit .
51,816
public function getWeather ( $ query , $ units = 'imperial' , $ lang = 'en' , $ appid = '' ) { $ answer = $ this -> getRawWeatherData ( $ query , $ units , $ lang , $ appid , 'xml' ) ; $ xml = $ this -> parseXML ( $ answer ) ; return new CurrentWeather ( $ xml , $ units ) ; }
Returns the current weather at the place you specified .
51,817
public function getWeatherGroup ( $ ids , $ units = 'imperial' , $ lang = 'en' , $ appid = '' ) { $ answer = $ this -> getRawWeatherGroupData ( $ ids , $ units , $ lang , $ appid ) ; $ json = $ this -> parseJson ( $ answer ) ; return new CurrentWeatherGroup ( $ json , $ units ) ; }
Returns the current weather for a group of city ids .
51,818
public function getCurrentUVIndex ( $ lat , $ lon ) { $ answer = $ this -> getRawCurrentUVIndexData ( $ lat , $ lon ) ; $ json = $ this -> parseJson ( $ answer ) ; return new UVIndex ( $ json ) ; }
Returns the current uv index at the location you specified .
51,819
public function getUVIndex ( $ lat , $ lon , $ dateTime , $ timePrecision = 'day' ) { $ answer = $ this -> getRawUVIndexData ( $ lat , $ lon , $ dateTime , $ timePrecision ) ; $ json = $ this -> parseJson ( $ answer ) ; return new UVIndex ( $ json ) ; }
Returns the uv index at date time and location you specified .
51,820
public function getRawWeatherGroupData ( $ ids , $ units = 'imperial' , $ lang = 'en' , $ appid = '' ) { $ url = $ this -> buildUrl ( $ ids , $ units , $ lang , $ appid , 'json' , $ this -> weatherGroupUrl ) ; return $ this -> cacheOrFetchResult ( $ url ) ; }
Directly returns the JSON string returned by OpenWeatherMap for the group of current weather . Only a JSON response format is supported for this webservice .
51,821
public function getRawWeatherHistory ( $ query , \ DateTime $ start , $ endOrCount = 1 , $ type = 'hour' , $ units = 'imperial' , $ lang = 'en' , $ appid = '' ) { if ( ! in_array ( $ type , array ( 'tick' , 'hour' , 'day' ) ) ) { throw new \ InvalidArgumentException ( '$type must be either "tick", "hour" or "day"' ) ; ...
Directly returns the json string returned by OpenWeatherMap for the weather history .
51,822
public function getRawCurrentUVIndexData ( $ lat , $ lon ) { if ( ! $ this -> apiKey ) { throw new \ RuntimeException ( 'Before using this method, you must set the api key using ->setApiKey()' ) ; } if ( ! is_float ( $ lat ) || ! is_float ( $ lon ) ) { throw new \ InvalidArgumentException ( '$lat and $lon must be float...
Directly returns the json string returned by OpenWeatherMap for the current UV index data .
51,823
public function getRawUVIndexData ( $ lat , $ lon , $ dateTime , $ timePrecision = 'day' ) { if ( ! $ this -> apiKey ) { throw new \ RuntimeException ( 'Before using this method, you must set the api key using ->setApiKey()' ) ; } if ( ! is_float ( $ lat ) || ! is_float ( $ lon ) ) { throw new \ InvalidArgumentExceptio...
Directly returns the json string returned by OpenWeatherMap for the UV index data .
51,824
private function cacheOrFetchResult ( $ url ) { if ( $ this -> cache !== false ) { $ cache = $ this -> cache ; $ cache -> setSeconds ( $ this -> seconds ) ; if ( $ cache -> isCached ( $ url ) ) { $ this -> wasCached = true ; return $ cache -> getCached ( $ url ) ; } $ result = $ this -> fetcher -> fetch ( $ url ) ; $ c...
Fetches the result or delivers a cached version of the result .
51,825
private function buildUrl ( $ query , $ units , $ lang , $ appid , $ mode , $ url ) { $ queryUrl = $ this -> buildQueryUrlParameter ( $ query ) ; $ url = $ url . "$queryUrl&units=$units&lang=$lang&mode=$mode&APPID=" ; $ url .= empty ( $ appid ) ? $ this -> apiKey : $ appid ; return $ url ; }
Build the url to fetch weather data from .
51,826
private function buildQueryUrlParameter ( $ query ) { switch ( $ query ) { case is_array ( $ query ) && isset ( $ query [ 'lat' ] ) && isset ( $ query [ 'lon' ] ) && is_numeric ( $ query [ 'lat' ] ) && is_numeric ( $ query [ 'lon' ] ) : return "lat={$query['lat']}&lon={$query['lon']}" ; case is_array ( $ query ) && is_...
Builds the query string for the url .
51,827
final public static function unpack ( string $ data ) : self { $ self = new static ( ) ; [ $ self -> version , $ self -> type , $ self -> requestId , $ self -> contentLength , $ self -> paddingLength , $ self -> reserved ] = array_values ( unpack ( FCGI :: HEADER_FORMAT , $ data ) ) ; $ payload = substr ( $ data , FCGI...
Unpacks the message from the binary data buffer
51,828
public function setContentData ( string $ data ) : self { $ this -> contentData = $ data ; $ this -> contentLength = strlen ( $ this -> contentData ) ; $ extraLength = $ this -> contentLength % 8 ; $ this -> paddingLength = $ extraLength ? ( 8 - $ extraLength ) : 0 ; return $ this ; }
Sets the content data and adjusts the length fields
51,829
protected static function unpackPayload ( $ self , string $ data ) : void { [ $ self -> contentData , $ self -> paddingData ] = array_values ( unpack ( "a{$self->contentLength}contentData/a{$self->paddingLength}paddingData" , $ data ) ) ; }
Method to unpack the payload for the record .
51,830
public static function hasFrame ( string $ buffer ) : bool { $ bufferLength = strlen ( $ buffer ) ; if ( $ bufferLength < FCGI :: HEADER_LEN ) { return false ; } $ fastInfo = unpack ( FCGI :: HEADER_FORMAT , $ buffer ) ; if ( $ bufferLength < FCGI :: HEADER_LEN + $ fastInfo [ 'contentLength' ] + $ fastInfo [ 'paddingLe...
Checks if the buffer contains a valid frame to parse
51,831
public static function parseFrame ( string & $ buffer ) : Record { $ bufferLength = strlen ( $ buffer ) ; if ( $ bufferLength < FCGI :: HEADER_LEN ) { throw new \ RuntimeException ( "Not enough data in the buffer to parse" ) ; } $ recordHeader = unpack ( FCGI :: HEADER_FORMAT , $ buffer ) ; $ recordType = $ recordHeade...
Parses a frame from the binary buffer
51,832
public static function detect ( Language $ language , AcceptLanguage $ acceptLanguage ) { $ acceptLanguageString = $ acceptLanguage -> getAcceptLanguageString ( ) ; $ languages = array ( ) ; $ language -> setLanguages ( $ languages ) ; if ( ! empty ( $ acceptLanguageString ) ) { $ httpLanguages = preg_split ( '/q=([\d\...
Detect a user s languages and order them by priority .
51,833
public static function detect ( Browser $ browser , UserAgent $ userAgent = null ) { self :: $ browser = $ browser ; if ( is_null ( $ userAgent ) ) { $ userAgent = self :: $ browser -> getUserAgent ( ) ; } self :: $ userAgentString = $ userAgent -> getUserAgentString ( ) ; self :: $ browser -> setName ( Browser :: UNKN...
Routine to determine the browser type .
51,834
public static function checkChromeFrame ( ) { if ( strpos ( self :: $ userAgentString , 'chromeframe' ) !== false ) { self :: $ browser -> setIsChromeFrame ( true ) ; return true ; } return false ; }
Determine if the user is using Chrome Frame .
51,835
public static function checkFacebookWebView ( ) { if ( strpos ( self :: $ userAgentString , 'FBAV' ) !== false ) { self :: $ browser -> setIsFacebookWebView ( true ) ; return true ; } return false ; }
Determine if the user is using Facebook .
51,836
public static function checkBrowserBlackBerry ( ) { if ( stripos ( self :: $ userAgentString , 'blackberry' ) !== false ) { if ( stripos ( self :: $ userAgentString , 'Version/' ) !== false ) { $ aresult = explode ( 'Version/' , self :: $ userAgentString ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' '...
Determine if the user is using a BlackBerry .
51,837
public static function checkBrowserRobot ( ) { if ( stripos ( self :: $ userAgentString , 'bot' ) !== false || stripos ( self :: $ userAgentString , 'spider' ) !== false || stripos ( self :: $ userAgentString , 'crawler' ) !== false ) { self :: $ browser -> setIsRobot ( true ) ; return true ; } return false ; }
Determine if the browser is a robot .
51,838
public static function checkBrowserSamsung ( ) { if ( stripos ( self :: $ userAgentString , 'SamsungBrowser' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'SamsungBrowser' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> s...
Determine if the browser is Samsung .
51,839
public static function checkBrowserChrome ( ) { if ( stripos ( self :: $ userAgentString , 'Chrome' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'Chrome' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> setVersion ( $ ave...
Determine if the browser is Chrome .
51,840
public static function checkBrowserVivaldi ( ) { if ( stripos ( self :: $ userAgentString , 'Vivaldi' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'Vivaldi' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> setVersion ( $ ...
Determine if the browser is Vivaldi .
51,841
public static function checkBrowserEdge ( ) { if ( stripos ( self :: $ userAgentString , 'Edge' ) !== false ) { $ version = explode ( 'Edge/' , self :: $ userAgentString ) ; if ( isset ( $ version [ 1 ] ) ) { self :: $ browser -> setVersion ( ( float ) $ version [ 1 ] ) ; } self :: $ browser -> setName ( Browser :: EDG...
Determine if the browser is Microsoft Edge .
51,842
public static function checkBrowserGsa ( ) { if ( stripos ( self :: $ userAgentString , 'GSA' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'GSA' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> setVersion ( $ aversion [ 0...
Determine if the browser is Google Search Appliance .
51,843
public static function checkBrowserWebTv ( ) { if ( stripos ( self :: $ userAgentString , 'webtv' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'webtv' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> setVersion ( $ aversi...
Determine if the browser is WebTv .
51,844
public static function checkBrowserNetPositive ( ) { if ( stripos ( self :: $ userAgentString , 'NetPositive' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'NetPositive' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> set...
Determine if the browser is NetPositive .
51,845
public static function checkBrowserGaleon ( ) { if ( stripos ( self :: $ userAgentString , 'galeon' ) !== false ) { $ aresult = explode ( ' ' , stristr ( self :: $ userAgentString , 'galeon' ) ) ; $ aversion = explode ( '/' , $ aresult [ 0 ] ) ; if ( isset ( $ aversion [ 1 ] ) ) { self :: $ browser -> setVersion ( $ av...
Determine if the browser is Galeon .
51,846
public static function checkBrowserKonqueror ( ) { if ( stripos ( self :: $ userAgentString , 'Konqueror' ) !== false ) { $ aresult = explode ( ' ' , stristr ( self :: $ userAgentString , 'Konqueror' ) ) ; $ aversion = explode ( '/' , $ aresult [ 0 ] ) ; if ( isset ( $ aversion [ 1 ] ) ) { self :: $ browser -> setVersi...
Determine if the browser is Konqueror .
51,847
public static function checkBrowserIcab ( ) { if ( stripos ( self :: $ userAgentString , 'icab' ) !== false ) { $ aversion = explode ( ' ' , stristr ( str_replace ( '/' , ' ' , self :: $ userAgentString ) , 'icab' ) ) ; if ( isset ( $ aversion [ 1 ] ) ) { self :: $ browser -> setVersion ( $ aversion [ 1 ] ) ; } self ::...
Determine if the browser is iCab .
51,848
public static function checkBrowserOmniWeb ( ) { if ( stripos ( self :: $ userAgentString , 'omniweb' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'omniweb' ) ) ; $ aversion = explode ( ' ' , isset ( $ aresult [ 1 ] ) ? $ aresult [ 1 ] : '' ) ; self :: $ browser -> setVersion ( $ av...
Determine if the browser is OmniWeb .
51,849
public static function checkBrowserPhoenix ( ) { if ( stripos ( self :: $ userAgentString , 'Phoenix' ) !== false ) { $ aversion = explode ( '/' , stristr ( self :: $ userAgentString , 'Phoenix' ) ) ; if ( isset ( $ aversion [ 1 ] ) ) { self :: $ browser -> setVersion ( $ aversion [ 1 ] ) ; } self :: $ browser -> setNa...
Determine if the browser is Phoenix .
51,850
public static function checkBrowserFirebird ( ) { if ( stripos ( self :: $ userAgentString , 'Firebird' ) !== false ) { $ aversion = explode ( '/' , stristr ( self :: $ userAgentString , 'Firebird' ) ) ; if ( isset ( $ aversion [ 1 ] ) ) { self :: $ browser -> setVersion ( $ aversion [ 1 ] ) ; } self :: $ browser -> se...
Determine if the browser is Firebird .
51,851
public static function checkBrowserNetscapeNavigator9Plus ( ) { if ( stripos ( self :: $ userAgentString , 'Firefox' ) !== false && preg_match ( '/Navigator\/([^ ]*)/i' , self :: $ userAgentString , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { self :: $ browser -> setVersion ( $ matches [ 1 ] ) ; } self :: $ brow...
Determine if the browser is Netscape Navigator 9 + .
51,852
public static function checkBrowserShiretoko ( ) { if ( stripos ( self :: $ userAgentString , 'Mozilla' ) !== false && preg_match ( '/Shiretoko\/([^ ]*)/i' , self :: $ userAgentString , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { self :: $ browser -> setVersion ( $ matches [ 1 ] ) ; } self :: $ browser -> setNam...
Determine if the browser is Shiretoko .
51,853
public static function checkBrowserIceCat ( ) { if ( stripos ( self :: $ userAgentString , 'Mozilla' ) !== false && preg_match ( '/IceCat\/([^ ]*)/i' , self :: $ userAgentString , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { self :: $ browser -> setVersion ( $ matches [ 1 ] ) ; } self :: $ browser -> setName ( Br...
Determine if the browser is Ice Cat .
51,854
public static function checkBrowserNokia ( ) { if ( preg_match ( "/Nokia([^\/]+)\/([^ SP]+)/i" , self :: $ userAgentString , $ matches ) ) { self :: $ browser -> setVersion ( $ matches [ 2 ] ) ; if ( stripos ( self :: $ userAgentString , 'Series60' ) !== false || strpos ( self :: $ userAgentString , 'S60' ) !== false )...
Determine if the browser is Nokia .
51,855
public static function checkBrowserFirefox ( ) { if ( stripos ( self :: $ userAgentString , 'safari' ) === false ) { if ( preg_match ( "/Firefox[\/ \(]([^ ;\)]+)/i" , self :: $ userAgentString , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { self :: $ browser -> setVersion ( $ matches [ 1 ] ) ; } self :: $ browser ...
Determine if the browser is Firefox .
51,856
public static function checkBrowserSeaMonkey ( ) { if ( stripos ( self :: $ userAgentString , 'safari' ) === false ) { if ( preg_match ( "/SeaMonkey[\/ \(]([^ ;\)]+)/i" , self :: $ userAgentString , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { self :: $ browser -> setVersion ( $ matches [ 1 ] ) ; } self :: $ brow...
Determine if the browser is SeaMonkey .
51,857
public static function checkBrowserIceweasel ( ) { if ( stripos ( self :: $ userAgentString , 'Iceweasel' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'Iceweasel' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> setVersio...
Determine if the browser is Iceweasel .
51,858
public static function checkBrowserMozilla ( ) { if ( stripos ( self :: $ userAgentString , 'mozilla' ) !== false && preg_match ( '/rv:[0-9].[0-9][a-b]?/i' , self :: $ userAgentString ) && stripos ( self :: $ userAgentString , 'netscape' ) === false ) { $ aversion = explode ( ' ' , stristr ( self :: $ userAgentString ,...
Determine if the browser is Mozilla .
51,859
public static function checkBrowserLynx ( ) { if ( stripos ( self :: $ userAgentString , 'lynx' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'Lynx' ) ) ; $ aversion = explode ( ' ' , ( isset ( $ aresult [ 1 ] ) ? $ aresult [ 1 ] : '' ) ) ; self :: $ browser -> setVersion ( $ aversio...
Determine if the browser is Lynx .
51,860
public static function checkBrowserAmaya ( ) { if ( stripos ( self :: $ userAgentString , 'amaya' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'Amaya' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> setVersion ( $ aversi...
Determine if the browser is Amaya .
51,861
public static function checkBrowserYandex ( ) { if ( stripos ( self :: $ userAgentString , 'YaBrowser' ) !== false ) { $ aresult = explode ( '/' , stristr ( self :: $ userAgentString , 'YaBrowser' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; self :: $ browser -> setVersion (...
Determine if the browser is Yandex .
51,862
public static function checkBrowserAndroid ( ) { if ( stripos ( self :: $ userAgentString , 'Android' ) !== false ) { if ( preg_match ( '/Version\/([\d\.]*)/i' , self :: $ userAgentString , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { self :: $ browser -> setVersion ( $ matches [ 1 ] ) ; } } else { self :: $ brow...
Determine if the browser is Android .
51,863
private static function checkIpad ( Device $ device , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'ipad' ) !== false ) { $ device -> setName ( Device :: IPAD ) ; return true ; } return false ; }
Determine if the device is iPad .
51,864
private static function checkIphone ( Device $ device , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'iphone;' ) !== false ) { $ device -> setName ( Device :: IPHONE ) ; return true ; } return false ; }
Determine if the device is iPhone .
51,865
public function getLanguages ( ) { if ( ! is_array ( $ this -> languages ) ) { LanguageDetector :: detect ( $ this , $ this -> getAcceptLanguage ( ) ) ; } return $ this -> languages ; }
Get all user s languages .
51,866
public function getLanguage ( ) { if ( ! is_array ( $ this -> languages ) ) { LanguageDetector :: detect ( $ this , $ this -> getAcceptLanguage ( ) ) ; } return strtolower ( substr ( reset ( $ this -> languages ) , 0 , 2 ) ) ; }
Get a user s language .
51,867
public function getLanguageLocale ( $ separator = '-' ) { if ( ! is_array ( $ this -> languages ) ) { LanguageDetector :: detect ( $ this , $ this -> getAcceptLanguage ( ) ) ; } $ userLanguage = $ this -> getLanguage ( ) ; foreach ( $ this -> languages as $ language ) { if ( strlen ( $ language ) === 5 && strpos ( $ la...
Get a user s language and locale .
51,868
public static function detect ( Os $ os , UserAgent $ userAgent ) { $ os -> setName ( $ os :: UNKNOWN ) ; $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setIsMobile ( false ) ; self :: checkMobileBrowsers ( $ os , $ userAgent ) ; return ( self :: checkChromeOs ( $ os , $ userAgent ) || self :: checkIOS ( $ os...
Determine the user s operating system .
51,869
public static function checkMobileBrowsers ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'opera mini' ) !== false ) { $ os -> setIsMobile ( true ) ; } elseif ( stripos ( $ userAgent -> getUserAgentString ( ) , 'mspie' ) !== false || stripos ( $ userAgent -> getUserAgentStr...
Determine if the user s browser is on a mobile device .
51,870
private static function checkIOS ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'CPU OS' ) !== false || stripos ( $ userAgent -> getUserAgentString ( ) , 'iPhone OS' ) !== false && stripos ( $ userAgent -> getUserAgentString ( ) , 'OS X' ) ) { $ os -> setName ( $ os :: IOS ...
Determine if the user s operating system is iOS .
51,871
private static function checkChromeOs ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , ' CrOS' ) !== false || stripos ( $ userAgent -> getUserAgentString ( ) , 'CrOS ' ) !== false ) { $ os -> setName ( $ os :: CHROME_OS ) ; if ( preg_match ( '/Chrome\/([\d\.]*)/i' , $ userAge...
Determine if the user s operating system is Chrome OS .
51,872
private static function checkOSX ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'OS X' ) !== false ) { $ os -> setName ( $ os :: OSX ) ; if ( preg_match ( '/OS X ([\d\._]*)/i' , $ userAgent -> getUserAgentString ( ) , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { $ os ...
Determine if the user s operating system is OS X .
51,873
private static function checkWindows ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'Windows NT' ) !== false ) { $ os -> setName ( $ os :: WINDOWS ) ; if ( preg_match ( '/Windows NT ([\d\.]*)/i' , $ userAgent -> getUserAgentString ( ) , $ matches ) ) { if ( isset ( $ matche...
Determine if the user s operating system is Windows .
51,874
private static function checkWindowsPhone ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'Windows Phone' ) !== false ) { $ os -> setIsMobile ( true ) ; $ os -> setName ( $ os :: WINDOWS_PHONE ) ; if ( preg_match ( '/Windows Phone ([\d\.]*)/i' , $ userAgent -> getUserAgentSt...
Determine if the user s operating system is Windows Phone .
51,875
private static function checkSymbOS ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'SymbOS' ) !== false ) { $ os -> setName ( $ os :: SYMBOS ) ; return true ; } return false ; }
Determine if the user s operating system is SymbOS .
51,876
private static function checkLinux ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'Linux' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: LINUX ) ; return true ; } return false ; }
Determine if the user s operating system is Linux .
51,877
private static function checkNokia ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'Nokia' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: NOKIA ) ; $ os -> setIsMobile ( true ) ; return true ; } return false ; }
Determine if the user s operating system is Nokia .
51,878
private static function checkBlackBerry ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'BlackBerry' ) !== false ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'Version/' ) !== false ) { $ aresult = explode ( 'Version/' , $ userAgent -> getUserAgentString ( ) ) ;...
Determine if the user s operating system is BlackBerry .
51,879
private static function checkAndroid ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'Android' ) !== false ) { if ( preg_match ( '/Android ([\d\.]*)/i' , $ userAgent -> getUserAgentString ( ) , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { $ os -> setVersion ( $ matches...
Determine if the user s operating system is Android .
51,880
private static function checkFreeBSD ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'FreeBSD' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: FREEBSD ) ; return true ; } return false ; }
Determine if the user s operating system is FreeBSD .
51,881
private static function checkOpenBSD ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'OpenBSD' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: OPENBSD ) ; return true ; } return false ; }
Determine if the user s operating system is OpenBSD .
51,882
private static function checkSunOS ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'SunOS' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: SUNOS ) ; return true ; } return false ; }
Determine if the user s operating system is SunOS .
51,883
private static function checkNetBSD ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'NetBSD' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: NETBSD ) ; return true ; } return false ; }
Determine if the user s operating system is NetBSD .
51,884
private static function checkOpenSolaris ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'OpenSolaris' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: OPENSOLARIS ) ; return true ; } return false ; }
Determine if the user s operating system is OpenSolaris .
51,885
private static function checkOS2 ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'OS\/2' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: OS2 ) ; return true ; } return false ; }
Determine if the user s operating system is OS2 .
51,886
private static function checkBeOS ( Os $ os , UserAgent $ userAgent ) { if ( stripos ( $ userAgent -> getUserAgentString ( ) , 'BeOS' ) !== false ) { $ os -> setVersion ( $ os :: VERSION_UNKNOWN ) ; $ os -> setName ( $ os :: BEOS ) ; return true ; } return false ; }
Determine if the user s operating system is BeOS .
51,887
public function getName ( ) { if ( ! isset ( $ this -> name ) ) { OsDetector :: detect ( $ this , $ this -> getUserAgent ( ) ) ; } return $ this -> name ; }
Return the name of the OS .
51,888
public function getVersion ( ) { if ( isset ( $ this -> version ) ) { return ( string ) $ this -> version ; } else { OsDetector :: detect ( $ this , $ this -> getUserAgent ( ) ) ; return ( string ) $ this -> version ; } }
Return the version of the OS .
51,889
public function getIsMobile ( ) { if ( ! isset ( $ this -> name ) ) { OsDetector :: detect ( $ this , $ this -> getUserAgent ( ) ) ; } return $ this -> isMobile ; }
Is the browser from a mobile device?
51,890
public function getName ( ) { if ( ! isset ( $ this -> name ) ) { BrowserDetector :: detect ( $ this , $ this -> getUserAgent ( ) ) ; } return $ this -> name ; }
Return the name of the Browser .
51,891
public function getVersion ( ) { if ( ! isset ( $ this -> name ) ) { BrowserDetector :: detect ( $ this , $ this -> getUserAgent ( ) ) ; } return ( string ) $ this -> version ; }
The version of the browser .
51,892
public function getIsChromeFrame ( ) { if ( ! isset ( $ this -> name ) ) { BrowserDetector :: detect ( $ this , $ this -> getUserAgent ( ) ) ; } return $ this -> isChromeFrame ; }
Used to determine if the browser is actually chromeframe .
51,893
public function getIsFacebookWebView ( ) { if ( ! isset ( $ this -> name ) ) { BrowserDetector :: detect ( $ this , $ this -> getUserAgent ( ) ) ; } return $ this -> isFacebookWebView ; }
Used to determine if the browser is actually facebook .
51,894
private function setupDoctrineListener ( array $ config , ContainerBuilder $ container ) { $ autoIndexing = $ container -> getParameter ( 'solr.auto_index' ) ; if ( $ autoIndexing == false ) { return ; } if ( $ this -> isODMConfigured ( $ container ) ) { $ container -> getDefinition ( 'solr.document.odm.subscriber' ) -...
doctrine_orm and doctrine_mongoDB can t be used together . mongo_db wins when it is configured .
51,895
protected function removeFieldSuffix ( $ property ) { if ( ( $ pos = strrpos ( $ property , '_' ) ) !== false ) { return substr ( $ property , 0 , $ pos ) ; } return $ property ; }
returns the clean fieldname without type - suffix
51,896
public function removePrefixedKeyValues ( $ value ) { if ( ( $ pos = strrpos ( $ value , '_' ) ) !== false ) { return substr ( $ value , ( $ pos + 1 ) ) ; } return $ value ; }
keyfield product_1 becomes 1
51,897
private function toCamelCase ( $ fieldname ) { $ words = str_replace ( '_' , ' ' , $ fieldname ) ; $ words = ucwords ( $ words ) ; $ pascalCased = str_replace ( ' ' , '' , $ words ) ; return lcfirst ( $ pascalCased ) ; }
returns field name camelcased if it has underlines
51,898
public function getSelectQuery ( AbstractQuery $ query ) : SolariumQuery { $ selectQuery = $ this -> solrClientCore -> createSelect ( $ query -> getOptions ( ) ) ; $ selectQuery -> setQuery ( $ query -> getQuery ( ) ) ; $ selectQuery -> setFilterQueries ( $ query -> getFilterQueries ( ) ) ; $ selectQuery -> setSorts ( ...
Get select query
51,899
private function getIndexableEntities ( $ entity = null ) { if ( $ entity ) { return [ $ entity ] ; } $ entities = [ ] ; $ namespaces = $ this -> getContainer ( ) -> get ( 'solr.doctrine.classnameresolver.known_entity_namespaces' ) ; $ metaInformationFactory = $ this -> getContainer ( ) -> get ( 'solr.meta.information....
Get a list of entities which are indexable by Solr