idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
44,300 | public function isDir ( $ path ) { $ node = $ this -> at ( $ path ) ; return null !== $ node && 'dir' === $ node -> type ; } | Equivalent to PHP is_dir function . |
44,301 | public function md5File ( $ path ) { if ( ! $ this -> isFile ( $ path ) ) return false ; return md5 ( $ this -> at ( $ path ) -> content ) ; } | Equivalent to PHP md5_file function . |
44,302 | public function fileGetContents ( $ path ) { if ( ! $ this -> isFile ( $ path ) ) return false ; return $ this -> at ( $ path ) -> content ; } | Equivalent to PHP file_get_contents function . |
44,303 | public function filePutContents ( $ path , $ content , $ flags = 0 ) { if ( ! $ this -> isFile ( $ path ) && ! $ this -> createFile ( $ path ) ) return false ; if ( ( $ flags & FILE_APPEND ) == FILE_APPEND ) $ this -> at ( $ path ) -> content .= $ content ; else $ this -> at ( $ path ) -> content = $ content ; return true ; } | Equivalent to PHP file_put_contents function . |
44,304 | public function isReadable ( $ path ) { $ node = $ this -> at ( $ path ) ; return null !== $ node && ( 0x0100 & $ node -> perms ) ; } | Equivalent to PHP is_readable function . Assumes that the user is the file owner . |
44,305 | public function isWritable ( $ path ) { $ node = $ this -> at ( $ path ) ; return null !== $ node && ( 0x0080 & $ node -> perms ) ; } | Equivalent to PHP is_writable function . Assumes that the user is the file owner . |
44,306 | public function isExecutable ( $ path ) { $ node = $ this -> at ( $ path ) ; return null !== $ node && ( 0x0040 & $ node -> perms ) && ! ( 0x0800 & $ node -> perms ) ; } | Equivalent to PHP is_executable function . Assumes that the user is the file owner . |
44,307 | public function rmdir ( $ path ) { $ path = $ this -> realpath ( $ path ) . '/' ; $ length = strlen ( $ path ) ; foreach ( array_keys ( $ this -> files ) as $ filename ) { if ( substr ( $ filename , 0 , $ length ) === $ path ) { return false ; } } $ this -> at ( $ path , null ) ; return true ; } | Equivalent to PHP rmdir function . |
44,308 | public function rename ( $ oldPath , $ newPath ) { $ old = $ this -> at ( $ oldPath ) ; $ new = $ this -> at ( $ newPath ) ; if ( null === $ old || ( null !== $ new && 'dir' === $ new -> type ) ) return false ; if ( 'file' === $ old -> type ) { $ this -> at ( $ newPath , $ old ) ; } else { if ( ! $ this -> mkdir ( $ newPath , $ old -> perms ) ) { return false ; } $ oldPath = $ this -> realpath ( $ oldPath ) . '/' ; $ newPath = $ this -> realpath ( $ newPath ) . '/' ; $ length = strlen ( $ oldPath ) ; foreach ( array_keys ( $ this -> files ) as $ childPath ) { if ( substr ( $ childPath , 0 , $ length ) === $ oldPath ) { $ newChildPath = $ newPath . substr ( $ childPath , $ length ) ; $ this -> at ( $ newChildPath , $ this -> at ( $ childPath ) ) ; $ this -> at ( $ childPath , null ) ; } } } $ this -> at ( $ oldPath , null ) ; return true ; } | Equivalent to PHP rename function . |
44,309 | public function fileperms ( $ path ) { $ node = $ this -> at ( $ path ) ; if ( null === $ node ) { return false ; } return $ node -> perms ; } | Equivalent to PHP fileperms function . |
44,310 | public function chmod ( $ path , $ value ) { $ node = $ this -> at ( $ path ) ; if ( null === $ node || ! is_numeric ( $ value ) ) { return false ; } $ node -> perms = $ value ; return true ; } | Equivalent to PHP chmod function . |
44,311 | public function mkdir ( $ path , $ mode = 0777 , $ recursive = false ) { if ( null !== $ this -> at ( $ path ) ) { trigger_error ( "mkdir(): File exists" ) ; return false ; } $ parts = explode ( '/' , $ this -> realpath ( $ path ) ) ; $ filesCount = 0 ; $ missing = [ ] ; $ item = array_shift ( $ parts ) ; foreach ( $ parts as $ part ) { $ item .= "/{$part}" ; $ node = $ this -> at ( $ item ) ; if ( $ node === null ) { $ missing [ ] = $ item ; } else if ( $ node -> type == 'file' ) { $ filesCount ++ ; } } if ( $ filesCount > 0 ) { trigger_error ( "mkdir(): Not a directory" ) ; return false ; } if ( count ( $ missing ) > 1 && ! $ recursive ) { trigger_error ( "mkdir(): No such file or directory" ) ; return false ; } foreach ( $ missing as $ path ) { $ this -> at ( $ path , ( object ) [ 'type' => 'dir' , 'perms' => $ mode ] ) ; } return true ; } | Equivalent to PHP mkdir function . |
44,312 | public function enable ( ) { $ this -> errorHandler -> addErrorHandler ( function ( ) { return true ; } ) ; $ this -> errorHandler -> addExceptionHandler ( function ( Exception $ ex ) { return true ; } ) ; } | Enable suppressing of errors . |
44,313 | public function getBodyAttributes ( ) { $ attributes = [ ] ; $ api = GoogleAPI :: singleton ( ) ; if ( $ key = $ api -> getAPIKey ( ) ) { $ attributes [ 'data-google-api-key' ] = $ key ; } if ( $ lang = $ api -> getAPILanguage ( ) ) { $ attributes [ 'data-google-api-lang' ] = $ lang ; } if ( $ api -> isAnalyticsEnabled ( ) ) { $ attributes [ 'data-google-tracking-id' ] = $ api -> getAnalyticsTrackingID ( ) ; } return $ attributes ; } | Answers the HTML tag attributes for the body as an array . |
44,314 | protected function getVerificationCode ( $ code ) { $ code = trim ( $ code ) ; if ( stripos ( $ code , '<meta' ) === 0 ) { preg_match ( '/content="(.+)"/' , $ code , $ matches ) ; $ code = isset ( $ matches [ 1 ] ) ? $ matches [ 1 ] : null ; } return $ code ; } | Removes any HTML present in the pasted value and answers the verification code . |
44,315 | public function getDocumentBySlug ( $ slug ) { $ search = $ this -> repository -> createSearch ( ) ; $ search -> addQuery ( new TermQuery ( 'slug' , $ slug ) , 'must' ) ; $ results = $ this -> repository -> execute ( $ search ) ; if ( count ( $ results ) === 0 ) { $ this -> logger && $ this -> logger -> warning ( sprintf ( "Can not render snippet for '%s' because content was not found." , $ slug ) ) ; return null ; } return $ results -> current ( ) ; } | Retrieves document by slug . |
44,316 | public function setDescription ( $ description = null ) { if ( empty ( $ description ) ) $ this -> description = null ; else if ( ! is_string ( $ description ) ) throw new InvalidArgumentException ( "Invalid RpcMethod description" ) ; else $ this -> description = $ description ; return $ this ; } | Set the method s description |
44,317 | public function addSignature ( ) { $ signature = [ "PARAMETERS" => [ ] , "RETURNTYPE" => 'undefined' ] ; array_push ( $ this -> signatures , $ signature ) ; $ this -> current_signature = max ( array_keys ( $ this -> signatures ) ) ; return $ this ; } | Add a signature and switch internal pointer |
44,318 | public function getSignatures ( $ compact = true ) { if ( $ compact ) { $ signatures = [ ] ; foreach ( $ this -> signatures as $ signature ) { $ signatures [ ] = array_merge ( [ $ signature [ "RETURNTYPE" ] ] , array_values ( $ signature [ "PARAMETERS" ] ) ) ; } return $ signatures ; } else { return $ this -> signatures ; } } | Get the method s signatures |
44,319 | public function getSignature ( $ compact = true ) { if ( $ compact ) { return array_merge ( [ $ this -> signatures [ $ this -> current_signature ] [ "RETURNTYPE" ] ] , array_values ( $ this -> signatures [ $ this -> current_signature ] [ "PARAMETERS" ] ) ) ; } else { return $ this -> signatures [ $ this -> current_signature ] ; } } | Get the current method s signature |
44,320 | public function deleteSignature ( $ signature ) { if ( ! is_integer ( $ signature ) || ! isset ( $ this -> signatures [ $ signature ] ) ) { throw new InvalidArgumentException ( "Invalid RpcMethod signature reference" ) ; } unset ( $ this -> signatures [ $ signature ] ) ; return true ; } | Delete a signature |
44,321 | public function selectSignature ( $ signature ) { if ( ! is_integer ( $ signature ) || ! isset ( $ this -> signatures [ $ signature ] ) ) { throw new InvalidArgumentException ( "Invalid RpcMethod signature reference" ) ; } $ this -> current_signature = $ signature ; return $ this ; } | Select a signature |
44,322 | public function setReturnType ( $ type ) { if ( ! in_array ( $ type , self :: $ rpcvalues ) ) throw new InvalidArgumentException ( "Invalid RpcMethod return type" ) ; $ this -> signatures [ $ this -> current_signature ] [ "RETURNTYPE" ] = self :: $ rpcvalues [ $ type ] ; return $ this ; } | Set the current signature s return type |
44,323 | public function addParameter ( $ type , $ name ) { if ( ! in_array ( $ type , self :: $ rpcvalues ) ) throw new InvalidArgumentException ( "Invalid type for parameter $name" ) ; if ( empty ( $ name ) ) throw new InvalidArgumentException ( "Missing parameter name" ) ; $ this -> signatures [ $ this -> current_signature ] [ "PARAMETERS" ] [ $ name ] = self :: $ rpcvalues [ $ type ] ; return $ this ; } | Add a parameter to current signature |
44,324 | public function deleteParameter ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> signatures [ $ this -> current_signature ] [ "PARAMETERS" ] ) ) throw new Exception ( "Cannot find parameter $name" ) ; unset ( $ this -> signatures [ $ this -> current_signature ] [ "PARAMETERS" ] [ $ name ] ) ; return $ this ; } | Delete a parameter from current signature |
44,325 | public function getParameters ( $ format = self :: FETCH_ASSOC ) { if ( $ format === self :: FETCH_NUMERIC ) return array_values ( $ this -> signatures [ $ this -> current_signature ] [ "PARAMETERS" ] ) ; else return $ this -> signatures [ $ this -> current_signature ] [ "PARAMETERS" ] ; } | Get current signature s parameters |
44,326 | public static function create ( $ name , callable $ callback , ... $ arguments ) { try { return new RpcMethod ( $ name , $ callback , ... $ arguments ) ; } catch ( Exception $ e ) { throw $ e ; } } | Static class constructor - create an RpcMethod object |
44,327 | public function loadTable ( $ table ) { $ file = $ this -> path . '/' . $ table . '.json' ; if ( is_file ( $ file ) ) { $ data = file_get_contents ( $ file ) ; if ( ! $ data ) { return $ this -> blankTable ( ) ; } if ( ! $ data = @ json_decode ( $ data , true , 512 ) ) { throw new Exception ( "Unable to parse table file '{$table}.json'" ) ; } return $ data ; } return $ this -> blankTable ( ) ; } | Load table data |
44,328 | public function saveTable ( $ table , array & $ data ) { $ file = $ this -> path . '/' . $ table . '.json' ; $ data = $ this -> touchModified ( $ data ) ; $ opt = is_numeric ( $ this -> opt [ 'json_options' ] ) ? $ this -> opt [ 'json_options' ] : 0 ; $ dept = is_numeric ( $ this -> opt [ 'json_depth' ] ) ? $ this -> opt [ 'json_depth' ] : 512 ; return file_put_contents ( $ file , json_encode ( $ data , $ opt , $ dept ) , LOCK_EX ) > 0 ; } | Save table data |
44,329 | private function generateTree ( $ data , $ total_depth , $ current_depth = 1 ) { ksort ( $ data ) ; $ table = [ ] ; foreach ( $ data as $ key => $ value ) { $ row = [ ] ; if ( $ current_depth > 1 ) { $ row = array_merge ( $ row , array_fill ( 0 , ( $ current_depth - 1 ) , '' ) ) ; } $ row [ ] = '<comment>' . $ key . '</comment>' ; if ( ! is_array ( $ value ) ) { $ row [ ] = ( is_bool ( $ value ) ) ? ( ( $ value ) ? 'true' : 'false' ) : $ value ; } $ empty_columns = ( $ total_depth - $ current_depth ) ; $ empty_columns = array_fill ( count ( $ row ) - 1 , $ empty_columns , '' ) ; $ row = array_merge ( $ row , $ empty_columns ) ; $ table [ ] = $ row ; if ( is_array ( $ value ) ) { $ table = array_merge ( $ table , $ this -> generateTree ( $ value , $ total_depth , $ current_depth + 1 ) ) ; } } return $ table ; } | Take a configuration array recursively traverse and create a padded tree array to output as a table . |
44,330 | private function getConfigDepth ( $ config ) { $ total_depth = 1 ; foreach ( $ config as $ data ) { if ( is_array ( $ data ) ) { $ depth = $ this -> getConfigDepth ( $ data ) + 1 ; if ( $ depth > $ total_depth ) { $ total_depth = $ depth ; } } } return $ total_depth ; } | Determine the depth of this configuration so we know how to pad the outputted table of data . |
44,331 | private function sregValue ( $ value = '' ) { $ owner = $ this -> owner ; $ values = explode ( '|' , $ value ) ; $ count = count ( $ values ) ; foreach ( $ values as $ key => $ fieldPath ) { if ( $ fieldPath == '' || $ fieldPath == 'null' ) { return null ; } elseif ( $ relValue = $ this -> sregTraverse ( $ fieldPath ) ) { if ( is_object ( $ relValue ) && method_exists ( $ relValue , 'AbsoluteLink' ) ) { if ( $ link = $ relValue -> AbsoluteLink ( ) ) { return $ link ; } else { continue ; } } else { return $ relValue ; } } elseif ( $ key + 1 == $ count && ! $ owner -> hasMethod ( $ fieldPath ) ) { return $ fieldPath ; } } } | Splits string by | loops each segment and returns the first non - null value |
44,332 | public function forceSsl ( $ type ) { $ host = env ( 'SERVER_NAME' ) ; if ( empty ( $ host ) ) { $ host = env ( 'HTTP_HOST' ) ; } if ( 'secure' == $ type ) { $ this -> redirect ( 'https://' . $ host . $ this -> here ) ; } } | Blackhole callback for the SecurityComponent . |
44,333 | protected function _edit ( $ id ) { try { $ result = $ this -> { $ this -> modelClass } -> edit ( $ id , $ this -> request -> data ) ; } catch ( OutOfBoundsException $ e ) { return $ this -> alert ( $ e , array ( 'redirect' => $ this -> referer ( array ( 'action' => 'list' ) , true ) ) ) ; } $ this -> request -> data = $ this -> { $ this -> modelClass } -> data ; if ( ! empty ( $ this -> request -> data [ $ this -> { $ this -> modelClass } -> alias ] [ $ this -> { $ this -> modelClass } -> displayField ] ) ) { $ this -> _appendToCrumb ( $ this -> request -> data [ $ this -> { $ this -> modelClass } -> alias ] [ $ this -> { $ this -> modelClass } -> displayField ] ) ; } if ( false === $ result ) { $ this -> alert ( 'save.fail' ) ; } else if ( $ this -> request -> is ( 'put' ) ) { $ this -> alert ( 'save.success' ) ; } } | Common edit action . |
44,334 | protected function _list ( $ object = null , $ scope = array ( ) , $ whitelist = array ( ) ) { $ View = $ this -> _getViewObject ( ) ; if ( ! $ View -> Helpers -> loaded ( 'Common.Table' ) ) { $ this -> _getViewObject ( ) -> loadHelper ( 'Common.Table' ) ; } $ this -> { $ this -> modelClass } -> recursive = 0 ; $ this -> set ( 'results' , $ this -> paginate ( $ object , $ scope , $ whitelist ) ) ; } | Common list action . |
44,335 | protected function _status ( $ id , $ status ) { if ( ! $ this -> { $ this -> modelClass } -> changeStatus ( $ id , $ status ) ) { return $ this -> alert ( 'status.fail' ) ; } $ this -> alert ( 'status.success' ) ; } | Common status action . |
44,336 | public function setupServices ( ) { $ settings = $ this -> getApp ( ) -> container -> get ( 'settings' ) ; if ( ! empty ( $ settings [ 'services' ] ) ) { if ( ! is_array ( $ settings [ 'services' ] ) ) { throw InvalidServiceConfigException :: build ( [ ] , [ 'serviceConfig' => $ settings [ 'services' ] ] ) ; } foreach ( $ settings [ 'services' ] as $ service => $ config ) { $ this -> setupService ( $ service , $ config ) ; } } } | Registers the services with the application |
44,337 | public function getService ( $ serviceName ) { $ serviceName = $ this -> getServiceName ( $ serviceName ) ; return $ this -> getApp ( ) -> container -> get ( $ serviceName ) ; } | Returns a service using the service name given |
44,338 | public function endsWith ( string $ haystack , string $ needle ) : bool { $ escaped = preg_quote ( $ needle ) ; return ( bool ) preg_match ( "/$escaped$/" , $ haystack ) ; } | Checks if a string ends with another one . |
44,339 | public function processRequest ( ) { $ this -> signal -> send ( $ this , 'onProcessRequest' ) ; if ( Console :: isCli ( ) ) { $ exitCode = $ this -> _runner -> run ( $ _SERVER [ 'argv' ] ) ; if ( is_int ( $ exitCode ) ) { $ this -> end ( $ exitCode ) ; } } else { $ this -> runController ( $ this -> parseRoute ( ) ) ; } } | Processes the current request . It first resolves the request into controller and action and then creates the controller to perform the action . |
44,340 | public function runController ( $ route ) { if ( ( $ ca = $ this -> createController ( $ route ) ) !== null ) { list ( $ controller , $ actionID , $ params ) = $ ca ; $ _GET = array_merge ( $ _GET , $ params ) ; $ csrfExempt = $ controller -> getCsrfExempt ( ) ; if ( Console :: isCli ( ) === false && in_array ( $ actionID , $ csrfExempt ) === false ) { $ request = $ this -> getComponent ( 'request' ) ; if ( $ request -> enableCsrfValidation ) { $ request -> csrf -> validate ( ) ; } } $ oldController = $ this -> _controller ; $ this -> _controller = $ controller ; $ controller -> init ( ) ; $ controller -> run ( $ actionID , $ params ) ; $ this -> _controller = $ oldController ; } else { throw new HttpException ( 404 , Mindy :: t ( 'base' , 'Unable to resolve the request "{route}".' , [ '{route}' => $ this -> request -> getPath ( ) ] ) ) ; } } | Creates the controller and performs the specified action . |
44,341 | public function createController ( $ route , $ owner = null ) { if ( $ owner === null ) { $ owner = $ this ; } if ( $ route ) { list ( $ handler , $ vars ) = $ route ; if ( $ handler instanceof Closure ) { $ handler -> __invoke ( $ this -> getComponent ( 'request' ) ) ; $ this -> end ( ) ; } else { list ( $ className , $ actionName ) = $ handler ; $ controller = Creator :: createObject ( $ className , time ( ) , $ owner === $ this ? null : $ owner , $ this -> getComponent ( 'request' ) ) ; return [ $ controller , $ actionName , array_merge ( $ _GET , $ vars ) ] ; } } return null ; } | Creates a controller instance based on a route . The route should contain the controller ID and the action ID . It may also contain additional GET variables . All these must be concatenated together with slashes . |
44,342 | protected function parseActionParams ( $ pathInfo ) { if ( ( $ pos = strpos ( $ pathInfo , '/' ) ) !== false ) { $ manager = $ this -> getUrlManager ( ) ; $ manager -> parsePathInfo ( ( string ) substr ( $ pathInfo , $ pos + 1 ) ) ; $ actionID = substr ( $ pathInfo , 0 , $ pos ) ; return $ manager -> caseSensitive ? $ actionID : strtolower ( $ actionID ) ; } else { return $ pathInfo ; } } | Parses a path info into an action ID and GET variables . |
44,343 | public function findModule ( $ id ) { if ( ( $ controller = $ this -> getController ( ) ) !== null && ( $ module = $ controller -> getModule ( ) ) !== null ) { do { if ( ( $ m = $ module -> getModule ( $ id ) ) !== null ) { return $ m ; } } while ( ( $ module = $ module -> getParentModule ( ) ) !== null ) ; } if ( ( $ m = $ this -> getModule ( $ id ) ) !== null ) { return $ m ; } } | Do not call this method . This method is used internally to search for a module by its ID . |
44,344 | public function init ( ) { if ( Console :: isCli ( ) ) { defined ( 'STDIN' ) or define ( 'STDIN' , fopen ( 'php://stdin' , 'r' ) ) ; if ( ! isset ( $ _SERVER [ 'argv' ] ) ) { die ( 'This script must be run from the command line.' ) ; } $ this -> _runner = $ this -> createCommandRunner ( ) ; $ this -> _runner -> commands = $ this -> commandMap ; $ this -> _runner -> addCommands ( $ this -> getCommandPath ( ) ) ; $ env = @ getenv ( 'CONSOLE_COMMANDS' ) ; if ( ! empty ( $ env ) ) { $ this -> _runner -> addCommands ( $ env ) ; } foreach ( $ this -> modules as $ name => $ settings ) { $ modulePath = Alias :: get ( "Modules." . $ name . ".Commands" ) ; if ( $ modulePath ) { $ this -> _runner -> addCommands ( $ modulePath ) ; } } } else { $ this -> getComponent ( 'request' ) ; } } | Initializes the application . This method overrides the parent implementation by preloading the request component . |
44,345 | public function findConfigurationFile ( $ filename = null , $ pwd = null ) { $ filename = $ filename ? : $ this -> getConfigurationFileName ( ) ; $ pwd = $ pwd ? : getcwd ( ) ; $ dirs = explode ( DS , $ pwd ) ; $ find = false ; do { $ dir = join ( DS , $ dirs ) ; $ config_file_path = $ dir . DS . $ filename ; if ( file_exists ( $ config_file_path ) && is_file ( $ config_file_path ) ) return $ config_file_path ; } while ( array_pop ( $ dirs ) ) ; return $ pwd . DS . $ filename ; } | find configuration file |
44,346 | public function loadConfigurationFile ( $ file = null ) { $ file = $ file ? : $ this -> findConfigurationFile ( ) ; if ( ! file_exists ( $ file ) ) return ; $ this -> config = $ this -> yaml -> load ( $ file ) ; } | load configuraton file |
44,347 | public function valid ( $ value ) { $ valid = true ; $ error = array ( ) ; if ( $ this -> minLength !== null && ! ( strlen ( $ value ) >= $ this -> minLength ) ) { $ valid = false ; $ error [ ] = 'minimum length' ; } if ( $ this -> maxLength !== null && ! ( strlen ( $ value ) <= $ this -> maxLength ) ) { $ valid = false ; $ error [ ] = 'maximum length' ; } if ( $ this -> minValue !== null && ( ! is_numeric ( $ value ) || ! ( $ value >= $ this -> minValue ) ) ) { $ valid = false ; $ error [ ] = 'minimum value' ; } if ( $ this -> maxValue !== null && ( ! is_numeric ( $ value ) || ! ( $ value <= $ this -> maxValue ) ) ) { $ valid = false ; $ error [ ] = 'maximum value' ; } if ( $ this -> startsWith !== null && ! ( strpos ( $ value , $ this -> startsWith ) === 0 ) ) { $ valid = false ; $ error [ ] = 'starts with' ; } if ( $ this -> endsWith !== null && ! ( strpos ( $ value , $ this -> endsWith ) === strlen ( $ value ) - strlen ( $ this -> endsWith ) ) ) { $ valid = false ; $ error [ ] = 'ends with' ; } if ( $ this -> regex !== null && ! preg_match ( $ this -> regex , $ value ) ) { $ valid = false ; $ error [ ] = 'valid custom field' ; } if ( $ this -> enum !== null && is_array ( $ this -> enum ) ) { if ( ! in_array ( $ value , $ this -> enum ) ) { $ valid = false ; $ error [ ] = 'is value of list' ; } } if ( $ this -> valid !== null ) { switch ( $ this -> valid ) { case 'email' : if ( ! filter_var ( $ value , FILTER_VALIDATE_EMAIL ) ) $ valid = false ; break ; case 'url' : if ( ! filter_var ( $ value , FILTER_VALIDATE_URL ) ) $ valid = false ; break ; default : $ valid = false ; } } if ( ! $ valid ) { $ error [ ] = 'valid \'' . $ this -> valid . '\'' ; } return $ valid === true ? true : $ error ; } | Validate constraints . |
44,348 | public function appendConfiguration ( ArrayNodeDefinition $ rootNode ) { $ rootNode -> children ( ) -> arrayNode ( 'qa' ) -> children ( ) -> arrayNode ( 'phpcs' ) -> children ( ) -> arrayNode ( 'dir' ) -> prototype ( 'scalar' ) -> end ( ) -> performNoDeepMerging ( ) -> end ( ) -> scalarNode ( 'standard' ) -> end ( ) -> scalarNode ( 'options' ) -> end ( ) -> end ( ) -> end ( ) -> arrayNode ( 'jshint' ) -> children ( ) -> arrayNode ( 'files' ) -> beforeNormalization ( ) -> ifString ( ) -> then ( function ( $ v ) { return array_filter ( array ( $ v ) ) ; } ) -> end ( ) -> prototype ( 'scalar' ) -> end ( ) -> performNoDeepMerging ( ) -> end ( ) -> scalarNode ( 'run' ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) -> end ( ) ; } | Appends the QA configuration |
44,349 | public function transformRows ( \ Cassandra \ Rows $ rows ) { $ entries = [ ] ; while ( true ) { while ( $ rows -> valid ( ) ) { $ entry = $ this -> transform ( $ rows -> current ( ) ) ; if ( $ entry ) { array_push ( $ entries , $ entry ) ; } $ rows -> next ( ) ; } if ( $ rows -> isLastPage ( ) ) { break ; } $ rows = $ rows -> nextPage ( ) ; } return $ entries ; } | Transform Cassandra Rows . |
44,350 | public function log ( string $ sql , array $ parameters = [ ] ) : void { $ message = sprintf ( '[SQL]: %s' , $ this -> removeWhitespace ( $ sql ) ) ; $ this -> logger -> log ( $ this -> logLevel , $ message , $ parameters ) ; } | Logs SQL and parameters |
44,351 | public function setValue ( $ value ) { if ( $ value === "" ) { $ value = $ this -> value ; } if ( $ this -> type === "boolean" ) { $ value = is_bool ( $ value ) ? $ value : in_array ( $ value , [ 'y' , 'yes' , 'on' , '1' ] ) ; } else if ( $ this -> type === "number" ) { if ( ! is_numeric ( $ value ) ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " must be a number" ) ; } $ value = ( float ) $ value ; if ( $ this -> required && $ value === 0 ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " is required" ) ; } } else if ( $ this -> type === "enum" ) { if ( ! in_array ( $ value , $ this -> enum , true ) ) { $ variant = "'" . implode ( "' or '" , $ this -> enum ) . "'" ; throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " must be equal " . $ variant ) ; } } else { $ value = trim ( $ value ) ; if ( $ this -> required && ! strlen ( $ value ) ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " is required" ) ; } } if ( $ this -> type_of ) { $ value = call_user_func ( $ this -> type_of , $ value ) ; if ( $ value === false && $ this -> type !== "boolean" ) { throw new \ InvalidArgumentException ( $ this -> getTheTitle ( ) . " value is invalid" ) ; } } $ this -> value = $ value ; return $ this ; } | Set new value |
44,352 | public static function exec ( $ cmd , $ timeout , & $ code ) { $ code = - 11 ; $ descriptors = [ 0 => [ 'pipe' , 'r' ] , 1 => [ 'pipe' , 'w' ] , 2 => [ 'pipe' , 'w' ] ] ; $ process = proc_open ( 'exec ' . $ cmd , $ descriptors , $ pipes ) ; if ( ! is_resource ( $ process ) ) { throw new \ Exception ( 'Could not execute process' ) ; } stream_set_blocking ( $ pipes [ 1 ] , 0 ) ; stream_set_blocking ( $ pipes [ 2 ] , 0 ) ; $ timeout *= 1000000 ; $ buffer = '' ; while ( $ timeout > 0 ) { $ start = microtime ( true ) ; $ read = [ $ pipes [ 1 ] ] ; $ write = $ other = [ ] ; stream_select ( $ read , $ write , $ other , 0 , $ timeout ) ; $ status = proc_get_status ( $ process ) ; if ( false === $ status [ 'running' ] ) { $ code = $ status [ 'exitcode' ] ; } $ buffer .= stream_get_contents ( $ pipes [ 1 ] ) ; if ( ! $ status [ 'running' ] ) { break ; } $ timeout -= ( microtime ( true ) - $ start ) * 1000000 ; } $ errors = stream_get_contents ( $ pipes [ 2 ] ) ; if ( ! empty ( $ errors ) ) { throw new \ Exception ( $ errors ) ; } proc_terminate ( $ process , 9 ) ; fclose ( $ pipes [ 0 ] ) ; fclose ( $ pipes [ 1 ] ) ; fclose ( $ pipes [ 2 ] ) ; proc_close ( $ process ) ; return $ buffer ; } | Execute a command and return it s output . Exit when the timeout has expired . |
44,353 | public static function err ( $ message , $ endLine = PHP_EOL ) { if ( ! Argument :: getInstance ( ) -> has ( 'quiet' ) ) { fwrite ( STDERR , $ message . $ endLine ) ; } } | Display message on error output |
44,354 | public static function std ( $ message , $ endLine = PHP_EOL ) { if ( ! Argument :: getInstance ( ) -> has ( 'quiet' ) ) { fwrite ( STDOUT , $ message . $ endLine ) ; } } | Display message on standart output |
44,355 | public function checkbox ( $ name_id , $ checked = false ) { $ el = $ this -> element ( 'input' , $ name_id , 'checkbox' ) -> value ( 1 ) -> attribute ( 'checked' , $ checked ? 'checked' : null ) ; return $ el ; } | Creates a checkbox . |
44,356 | public function addRelativeUrl ( $ relativeUrl ) { $ this -> pathTrailingSlash = S :: endsWith ( $ relativeUrl , '/' ) ; $ parts = array_filter ( explode ( '/' , trim ( $ relativeUrl , '/' ) ) ) ; $ this -> path = array_merge ( $ this -> path , $ parts ) ; return $ this ; } | Modifies the current URL with adding an relative Url to the pathParts |
44,357 | public function filter ( $ value ) { if ( ! is_scalar ( $ value ) && ! is_array ( $ value ) ) { return $ value ; } if ( $ this -> options [ 'pattern' ] === null ) { throw new Exception \ RuntimeException ( sprintf ( 'Filter %s does not have a valid pattern set' , get_class ( $ this ) ) ) ; } return preg_replace ( $ this -> options [ 'pattern' ] , $ this -> options [ 'replacement' ] , $ value ) ; } | Perform regexp replacement as filter |
44,358 | protected function validatePattern ( $ pattern ) { if ( ! preg_match ( '/(?<modifier>[imsxeADSUXJu]+)$/' , $ pattern , $ matches ) ) { return true ; } if ( false !== strstr ( $ matches [ 'modifier' ] , 'e' ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Pattern for a PregReplace filter may not contain the "e" pattern modifier; received "%s"' , $ pattern ) ) ; } } | Validate a pattern and ensure it does not contain the e modifier |
44,359 | public static function getRules ( $ update , $ id ) { if ( is_null ( $ update ) ) { return static :: $ registerRules ; } static :: $ updateRules [ 'name' ] .= ',' . $ id . ',user_id' ; static :: $ updateRules [ 'email' ] .= ',' . $ id . ',user_id' ; return static :: $ updateRules ; } | Get rules for new or update |
44,360 | public function getIsAdminAttribute ( ) { $ project = Project :: getProjectByUrl ( Route :: Input ( 'project' ) ) ; if ( $ project ) { $ admins = explode ( ',' , $ project -> admins ) ; if ( in_array ( Auth :: id ( ) , $ admins ) ) { return $ this -> attributes [ 'is_admin' ] = true ; } return $ this -> attributes [ 'is_admin' ] = false ; } } | This attribute specified user is admin or not for logined user |
44,361 | public function getIsWriterAttribute ( ) { $ project = Project :: getProjectByUrl ( Route :: Input ( 'project' ) ) ; if ( $ project ) { $ writers = explode ( ',' , $ project -> writers ) ; if ( in_array ( Auth :: id ( ) , $ writers ) ) { return $ this -> attributes [ 'is_writer' ] = true ; } return $ this -> attributes [ 'is_writer' ] = false ; } } | This attribute specified user is write or not for logined user |
44,362 | public function getIsReaderAttribute ( ) { $ project = Project :: getProjectByUrl ( Route :: Input ( 'project' ) ) ; if ( $ project ) { $ readers = explode ( ',' , $ project -> readers ) ; if ( in_array ( Auth :: id ( ) , $ readers ) ) { return $ this -> attributes [ 'is_reader' ] = true ; } return $ this -> attributes [ 'is_reader' ] = false ; } } | This attribute specified user is reader or not for logined user |
44,363 | public static function getGroupIdName ( $ users ) { $ users = explode ( "," , $ users ) ; $ usersArray = array ( ) ; foreach ( $ users as $ user ) { $ user = User :: find ( $ user ) ; if ( $ user ) $ usersArray [ ] = array ( 'name' => $ user -> name , 'user_id' => $ user -> user_id ) ; } return $ usersArray ; } | Get id of groups permission |
44,364 | private static function _readFile ( $ locale , $ path , $ attribute , $ value , $ temp ) { if ( ! empty ( self :: $ _ldml [ ( string ) $ locale ] ) ) { $ result = self :: $ _ldml [ ( string ) $ locale ] -> xpath ( $ path ) ; if ( ! empty ( $ result ) ) { foreach ( $ result as & $ found ) { if ( empty ( $ value ) ) { if ( empty ( $ attribute ) ) { $ temp [ ] = ( string ) $ found ; } else if ( empty ( $ temp [ ( string ) $ found [ $ attribute ] ] ) ) { $ temp [ ( string ) $ found [ $ attribute ] ] = ( string ) $ found ; } } else if ( empty ( $ temp [ $ value ] ) ) { if ( empty ( $ attribute ) ) { $ temp [ $ value ] = ( string ) $ found ; } else { $ temp [ $ value ] = ( string ) $ found [ $ attribute ] ; } } } } } return $ temp ; } | Read the content from locale |
44,365 | private static function _findRoute ( $ locale , $ path , $ attribute , $ value , & $ temp ) { if ( empty ( self :: $ _ldml [ ( string ) $ locale ] ) ) { $ filename = dirname ( __FILE__ ) . '/Data/' . $ locale . '.xml' ; if ( ! file_exists ( $ filename ) ) { throw new Zend_Locale_Exception ( "Missing locale file '$filename' for '$locale' locale." ) ; } self :: $ _ldml [ ( string ) $ locale ] = simplexml_load_file ( $ filename ) ; } $ search = '' ; $ tok = strtok ( $ path , '/' ) ; if ( ! empty ( self :: $ _ldml [ ( string ) $ locale ] ) ) { while ( $ tok !== false ) { $ search .= '/' . $ tok ; if ( strpos ( $ search , '[@' ) !== false ) { while ( strrpos ( $ search , '[@' ) > strrpos ( $ search , ']' ) ) { $ tok = strtok ( '/' ) ; if ( empty ( $ tok ) ) { $ search .= '/' ; } $ search = $ search . '/' . $ tok ; } } $ result = self :: $ _ldml [ ( string ) $ locale ] -> xpath ( $ search . '/alias' ) ; if ( ! empty ( $ result ) ) { $ source = $ result [ 0 ] [ 'source' ] ; $ newpath = $ result [ 0 ] [ 'path' ] ; if ( $ newpath != '//ldml' ) { while ( substr ( $ newpath , 0 , 3 ) == '../' ) { $ newpath = substr ( $ newpath , 3 ) ; $ search = substr ( $ search , 0 , strrpos ( $ search , '/' ) ) ; } $ path = $ search . '/' . $ newpath ; while ( ( $ tok = strtok ( '/' ) ) !== false ) { $ path = $ path . '/' . $ tok ; } } if ( $ source != 'locale' ) { $ locale = $ source ; } $ temp = self :: _getFile ( $ locale , $ path , $ attribute , $ value , $ temp ) ; return false ; } $ tok = strtok ( '/' ) ; } } return true ; } | Find possible routing to other path or locale |
44,366 | private static function _getFile ( $ locale , $ path , $ attribute = false , $ value = false , $ temp = array ( ) ) { $ result = self :: _findRoute ( $ locale , $ path , $ attribute , $ value , $ temp ) ; if ( $ result ) { $ temp = self :: _readFile ( $ locale , $ path , $ attribute , $ value , $ temp ) ; } if ( ( $ locale != 'root' ) && ( $ result ) ) { $ locale = substr ( $ locale , 0 , - strlen ( strrchr ( $ locale , '_' ) ) ) ; if ( ! empty ( $ locale ) ) { $ temp = self :: _getFile ( $ locale , $ path , $ attribute , $ value , $ temp ) ; } else { $ temp = self :: _getFile ( 'root' , $ path , $ attribute , $ value , $ temp ) ; } } return $ temp ; } | Read the right LDML file |
44,367 | private static function _calendarDetail ( $ locale , $ list ) { $ ret = "001" ; foreach ( $ list as $ key => $ value ) { if ( strpos ( $ locale , '_' ) !== false ) { $ locale = substr ( $ locale , strpos ( $ locale , '_' ) + 1 ) ; } if ( strpos ( $ key , $ locale ) !== false ) { $ ret = $ key ; break ; } } return $ ret ; } | Find the details for supplemental calendar datas |
44,368 | private static function _checkLocale ( $ locale ) { if ( empty ( $ locale ) ) { $ locale = new Zend_Locale ( ) ; } if ( ! ( Zend_Locale :: isLocale ( ( string ) $ locale , null , false ) ) ) { throw new Zend_Locale_Exception ( "Locale (" . ( string ) $ locale . ") is a unknown locale" ) ; } return ( string ) $ locale ; } | Internal function for checking the locale |
44,369 | public static function clearCache ( ) { if ( self :: $ _cacheTags ) { self :: $ _cache -> clean ( Zend_Cache :: CLEANING_MODE_MATCHING_TAG , array ( 'Zend_Locale' ) ) ; } else { self :: $ _cache -> clean ( Zend_Cache :: CLEANING_MODE_ALL ) ; } } | Clears all set cache data |
44,370 | private static function _getTagSupportForCache ( ) { $ backend = self :: $ _cache -> getBackend ( ) ; if ( $ backend instanceof Zend_Cache_Backend_ExtendedInterface ) { $ cacheOptions = $ backend -> getCapabilities ( ) ; self :: $ _cacheTags = $ cacheOptions [ 'tags' ] ; } else { self :: $ _cacheTags = false ; } return self :: $ _cacheTags ; } | Internal method to check if the given cache supports tags |
44,371 | protected static function _getFile ( $ fullPath ) { $ file = '' ; if ( preg_match ( '/\/(_[A-Z].[A-Za-z]+)\.php$/' , $ fullPath , $ matches ) ) { $ file = isset ( $ matches ) && isset ( $ matches [ 1 ] ) ? $ matches [ 1 ] : $ file ; self :: $ numFileLogs = 0 ; } else { switch ( self :: $ numFileLogs ) { case 0 : self :: _doLog ( 'Unable to get filename for: ' . $ fullPath ) ; break ; case 1 : self :: _doLog ( 'MULTIPLE ERRORS ENCOUNTERED GETTING FILE NAMES (no more will be logged): ' . $ fullPath ) ; break ; default : break ; } self :: $ numFileLogs ++ ; } return $ file ; } | Extracts the filename from a full path |
44,372 | public function getSessionHandler ( ContainerInterface $ container ) : SessionHandlerInterface { $ prefix = $ container -> get ( 'ellipse.session.id.prefix' ) ; $ ttl = $ container -> get ( 'ellipse.session.ttl' ) ; $ cache = $ container -> get ( 'ellipse.session.cache' ) ; return new Psr6SessionHandler ( $ cache , [ 'prefix' => $ prefix , 'ttl' => $ ttl ] ) ; } | Return a session handler based on the cache item pool . |
44,373 | public function getSetSessionHandlerMiddleware ( ContainerInterface $ container ) : SetSessionHandlerMiddleware { $ handler = $ container -> get ( SessionHandlerInterface :: class ) ; return new SetSessionHandlerMiddleware ( $ handler ) ; } | Return a set session handler middleware . |
44,374 | protected function updateConfig ( $ key , $ value = null , $ default = null ) { $ value = $ value ? : singleton ( 'env' ) -> get ( 'Cookie.' . $ key ) ; if ( ! $ value && ! singleton ( 'env' ) -> get ( 'Cookie.dont_use_same_config_as_sessions' ) ) { $ value = singleton ( 'env' ) -> get ( 'Session.' . $ key ) ; } if ( ! $ value && $ default ) { $ value = $ default ; } return $ value ; } | Allow setting cookie domain |
44,375 | public function append ( $ query , $ args = null ) { if ( $ query instanceof PDBquery ) { $ args = $ query -> getArgs ( ) ; $ query = $ query -> getQuery ( ) ; } ; $ this -> _query .= ' ' . $ query ; if ( is_array ( $ args ) ) { foreach ( $ args as $ arg ) { $ this -> _args [ ] = $ arg ; } ; } elseif ( $ args !== null ) { $ this -> _args [ ] = $ args ; } ; return $ this ; } | Append to current query |
44,376 | public function implode ( $ glue , $ queries ) { $ first = true ; foreach ( $ queries as $ query ) { if ( $ first ) { $ first = false ; } else { $ this -> _query .= ' ' . $ glue ; } ; $ this -> append ( $ query ) ; } ; return $ this ; } | Append multiple PDBquery objects |
44,377 | public function implodeClosed ( $ glue , $ queries ) { $ this -> _query .= ' (' ; $ this -> implode ( $ glue , $ queries ) ; $ this -> _query .= ' )' ; return $ this ; } | Append multiple PDBquery objects wrapped in parenthesis |
44,378 | private function _getColumns ( $ table ) { if ( isset ( $ this -> _tables [ $ table ] ) ) { return $ this -> _tables [ $ table ] ; } ; $ this -> _tables [ $ table ] = false ; if ( $ rows = $ this -> selectArray ( "PRAGMA table_info({$table})" ) ) { $ cols = array ( ) ; foreach ( $ rows as $ row ) { $ cols [ ] = $ row [ 'name' ] ; } ; if ( count ( $ cols ) > 0 ) { $ this -> _tables [ $ table ] = $ cols ; } ; } ; return $ this -> _tables [ $ table ] ; } | Get list of column names for a table |
44,379 | private function _execute ( $ args = array ( ) ) { if ( $ this -> _err ) { return false ; } ; if ( $ this -> _sth ) { if ( $ this -> _sth -> execute ( $ args ) ) { return true ; } else { $ this -> _err = implode ( ' ' , $ this -> _sth -> errorInfo ( ) ) ; return false ; } ; } else { $ this -> _err = "No statement to execute." ; } ; return false ; } | Execute stored prepared statement |
44,380 | public function exec ( $ q , $ args = array ( ) ) { if ( $ q instanceof PDBquery ) { $ args = $ q -> getArgs ( ) ; $ q = $ q -> getQuery ( ) ; } ; return $ this -> _prepare ( $ q ) -> _execute ( $ args ) ? $ this -> _sth -> rowCount ( ) : false ; } | Execute a result - less statement |
44,381 | public function insert ( $ table , $ values ) { $ colOK = $ this -> _getColumns ( $ table ) ; $ query = $ this -> query ( 'INSERT INTO ' . $ table ) ; $ colQs = array ( ) ; $ cols = array ( ) ; if ( is_array ( $ values ) ) { foreach ( $ values as $ key => $ val ) { if ( in_array ( $ key , $ colOK ) ) { $ cols [ ] = $ key ; $ colQs [ ] = $ this -> query ( '?' , $ val ) ; } ; } ; } ; $ query -> implodeClosed ( ',' , $ cols ) -> append ( 'VALUES' ) -> implodeClosed ( ',' , $ colQs ) ; return $ this -> _prepare ( $ query -> getQuery ( ) ) -> _execute ( $ query -> getArgs ( ) ) ? $ this -> _dbh -> lastInsertId ( ) : false ; } | Execute INSERT statement with variable associative column data |
44,382 | public function update ( $ table , $ values , $ tail , $ tailArgs = array ( ) ) { $ colOK = $ this -> _getColumns ( $ table ) ; $ query = $ this -> query ( 'UPDATE ' . $ table . ' SET' ) ; $ cols = array ( ) ; if ( ! ( $ tail instanceof PDBquery ) ) { $ tail = $ this -> query ( $ tail , $ tailArgs ) ; } ; if ( is_array ( $ values ) ) { foreach ( $ values as $ key => $ val ) { if ( in_array ( $ key , $ colOK ) ) { $ cols [ ] = $ this -> query ( "{$key}=?" , array ( $ val ) ) ; } ; } ; } ; $ query -> implode ( ',' , $ cols ) -> append ( $ tail ) ; return $ this -> _prepare ( $ query -> getQuery ( ) ) -> _execute ( $ query -> getArgs ( ) ) ? $ this -> _sth -> rowCount ( ) : false ; } | Execute UPDATE statement with variable associative column data |
44,383 | public function selectAtom ( $ q , $ args = array ( ) ) { $ this -> exec ( $ q , $ args ) ; return $ this -> _sth ? $ this -> _sth -> fetchColumn ( ) : false ; } | Fetch a single value |
44,384 | public function selectList ( $ q , $ args = array ( ) ) { $ this -> exec ( $ q , $ args ) ; return $ this -> _sth ? $ this -> _sth -> fetchAll ( \ PDO :: FETCH_COLUMN , 0 ) : false ; } | Fetch a simple list of result values |
44,385 | public function selectSingleArray ( $ q , $ args = array ( ) ) { $ this -> exec ( $ q , $ args ) ; return $ this -> _sth ? $ this -> _sth -> fetch ( \ PDO :: FETCH_ASSOC ) : false ; } | Fetch a single row as associative array |
44,386 | public function selectArray ( $ q , $ args = array ( ) ) { $ this -> exec ( $ q , $ args ) ; return $ this -> _sth ? $ this -> _sth -> fetchAll ( \ PDO :: FETCH_ASSOC ) : false ; } | Fetch all results in an associative array |
44,387 | public function selectArrayIndexed ( $ q , $ args = array ( ) ) { $ this -> exec ( $ q , $ args ) ; if ( $ this -> _sth ) { $ result = array ( ) ; while ( $ row = $ this -> _sth -> fetch ( \ PDO :: FETCH_ASSOC ) ) { $ result [ $ row [ key ( $ row ) ] ] = $ row ; } ; return $ result ; } else { return false ; } ; } | Fetch all results in an associative array index by first column |
44,388 | public function selectArrayPairs ( $ q , $ args = array ( ) ) { $ this -> exec ( $ q , $ args ) ; return $ this -> _sth ? $ this -> _sth -> fetchAll ( \ PDO :: FETCH_COLUMN | \ PDO :: FETCH_GROUP ) : false ; } | Fetch 2 - column result into associative array |
44,389 | public function andAdd ( ) { $ args = func_get_args ( ) ; $ value = array_shift ( $ args ) ; $ params = [ ] ; while ( $ args ) { $ param = array_shift ( $ args ) ; if ( is_array ( $ param ) ) { $ params = array_merge ( $ params , $ param ) ; } else { $ params [ ] = $ param ; } } $ value = new WhereConditionValue ( $ this , $ value , $ params ) ; $ this -> add ( $ value ) ; return $ this ; } | add condition . |
44,390 | public function andNot ( ) { $ args = func_get_args ( ) ; call_user_func_array ( array ( $ this , 'andAdd' ) , $ args ) ; $ value = array_pop ( $ this -> conditions ) ; $ value -> not ( ) ; $ this -> add ( $ value ) ; return $ this ; } | add not condition . |
44,391 | public function orAdd ( ) { $ args = func_get_args ( ) ; $ value = array_shift ( $ args ) ; $ params = [ ] ; while ( $ args ) { $ param = array_shift ( $ args ) ; if ( is_array ( $ param ) ) { $ params = array_merge ( $ params , $ param ) ; } else { $ params [ ] = $ param ; } } $ value = new WhereConditionValue ( $ this , $ value , $ params ) ; $ value -> chain_by = WhereCondition :: CHAIN_BY_OR ; $ this -> add ( $ value ) ; return $ this ; } | add or condition . |
44,392 | public function andNotIn ( $ key , array $ values ) { if ( $ values ) { $ value = sprintf ( '%s NOT IN (%s)' , $ key , join ( ', ' , array_fill ( 0 , count ( $ values ) , '?' ) ) ) ; return $ this -> andAdd ( $ value , $ values ) ; } else { $ value = '1' ; return $ this -> andAdd ( $ value , $ values ) ; } } | add not in condition . |
44,393 | public function orIn ( $ key , array $ values ) { if ( $ values ) { $ value = sprintf ( '%s IN (%s)' , $ key , join ( ', ' , array_fill ( 0 , count ( $ values ) , '?' ) ) ) ; return $ this -> orAdd ( $ value , $ values ) ; } else { $ value = '0' ; return $ this -> orAdd ( $ value , $ values ) ; } } | or in condition . |
44,394 | public function andBetween ( $ key , $ min , $ max ) { $ value = sprintf ( '%s BETWEEN ? AND ?' , $ key ) ; return $ this -> andAdd ( $ value , [ $ min , $ max ] ) ; } | add between condition . |
44,395 | public function andNotBetween ( $ key , $ min , $ max ) { $ value = sprintf ( '%s NOT BETWEEN ? AND ?' , $ key ) ; return $ this -> andAdd ( $ value , [ $ min , $ max ] ) ; } | add not between condition . |
44,396 | public function orBetween ( $ key , $ min , $ max ) { $ value = sprintf ( '%s BETWEEN ? AND ?' , $ key ) ; return $ this -> orAdd ( $ value , [ $ min , $ max ] ) ; } | or between condition . |
44,397 | public function orNotBetween ( $ key , $ min , $ max ) { $ value = sprintf ( '%s NOT BETWEEN ? AND ?' , $ key ) ; return $ this -> orAdd ( $ value , [ $ min , $ max ] ) ; } | or not between condition . |
44,398 | public function andLike ( $ key , $ like ) { $ value = sprintf ( '%s LIKE ?' , $ key ) ; return $ this -> andAdd ( $ value , [ $ like ] ) ; } | add like condition . |
44,399 | public function andNotLike ( $ key , $ like ) { $ value = sprintf ( '%s NOT LIKE ?' , $ key ) ; return $ this -> andAdd ( $ value , [ $ like ] ) ; } | add not like condition . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.