idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
233,100 | public function setFlashData ( $ newdata , $ value = '' ) { if ( is_string ( $ newdata ) ) { $ newdata = [ $ newdata => $ value ] ; } if ( ! empty ( $ newdata ) ) { foreach ( $ newdata as $ key => $ val ) { $ this -> newFlashData [ $ key ] = $ val ; } } } | Set Flash Data |
233,101 | public function getFlashData ( $ key = null ) { if ( $ key === null ) { return $ this -> lastFlashData ; } return isset ( $ this -> lastFlashData [ $ key ] ) ? $ this -> lastFlashData [ $ key ] : null ; } | Get Flash Data |
233,102 | private function write ( ) { $ sessionData [ 'data' ] = $ this -> data ; $ sessionData [ 'flash' ] = $ this -> newFlashData ; $ stmt = $ this -> db -> prepare ( "UPDATE {$this->tableName} SET data = ? WHERE session_id = ?" ) ; $ stmt -> execute ( [ json_encode ( $ sessionData ) , $ this -> sessionId ] ) ; } | Write Session Data |
233,103 | private function cleanExpired ( ) { if ( mt_rand ( 1 , 10 ) == 1 ) { $ expiredTime = $ this -> now - $ this -> secondsUntilExpiration ; $ stmt = $ this -> db -> prepare ( "DELETE FROM {$this->tableName} WHERE time_updated < {$expiredTime}" ) ; $ stmt -> execute ( ) ; } } | Clean Old Sessions |
233,104 | private function generateId ( ) { $ randomNumber = mt_rand ( 0 , mt_getrandmax ( ) ) ; $ ipAddressFragment = md5 ( substr ( $ this -> ipAddress , 0 , 5 ) ) ; $ timestamp = md5 ( microtime ( true ) . $ this -> now ) ; return hash ( 'sha256' , $ randomNumber . $ ipAddressFragment . $ this -> salt . $ timestamp ) ; } | Generate New Session ID |
233,105 | public function hasValue ( $ value , bool $ strict = false ) : bool { return in_array ( $ value , $ this -> data , $ strict ) ; } | Has value . |
233,106 | public function pullAll ( array $ keys , $ valueDefault = null ) : array { return Arrays :: pullAll ( $ this -> data , $ keys , $ valueDefault ) ; } | Pull all . |
233,107 | protected function isAllowed ( ServerRequestInterface $ request , string $ role ) : bool { $ route = $ request -> getAttribute ( 'route' ) ; $ config = 'routes.' . $ route -> getGroups ( ) [ 0 ] -> getPattern ( ) . '.' . \ strtr ( '/' . $ route -> getName ( ) , [ $ route -> getGroups ( ) [ 0 ] -> getPattern ( ) => '' ,... | Check if request allowed for current user . |
233,108 | public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ frontController = FrontController :: getInstance ( ) ; $ frontController -> setDispatcher ( $ serviceLocator -> get ( 'Dispatcher' ) ) ; $ frontController -> setRequest ( $ serviceLocator -> get ( 'Request' ) ) ; $ frontController -> setResp... | Create front controller service |
233,109 | protected function findOr404 ( Request $ request , array $ criteria = [ ] ) { if ( ! $ request -> attributes -> has ( 'id' ) ) { throw new \ LogicException ( 'Request does not have "id" attribute set.' ) ; } $ criteria [ 'id' ] = $ request -> attributes -> get ( 'id' ) ; if ( null === $ resource = $ this -> getManager ... | Returns resource by ID parameter |
233,110 | public function iconDownload ( ) { if ( $ this -> iconIsLocal ( "client_icon_id" ) || $ this [ "client_icon_id" ] == 0 ) { return ; } $ download = $ this -> getParent ( ) -> transferInitDownload ( rand ( 0x0000 , 0xFFFF ) , 0 , $ this -> iconGetName ( "client_icon_id" ) ) ; $ transfer = Teamspeak :: factory ( "filetran... | Downloads and returns the clients icon file content . |
233,111 | public static function uploadsUrl ( $ url = '' ) { $ url = Config :: get ( 'congraph::congraph.uploads_url' ) . '/' . $ url ; $ rtrim = ! empty ( $ url ) ; $ url = url ( self :: normalizeUrl ( $ url , $ rtrim ) ) ; return $ url ; } | Get uploads url from config and optionally concatonates given url to uploads url |
233,112 | public static function normalizePath ( $ path , $ rtrim = true ) { $ path = trim ( $ path ) ; $ path = str_replace ( '\\' , '/' , $ path ) ; $ path = preg_replace ( '/\/+/' , '==DS==' , $ path ) ; $ segments = explode ( '==DS==' , $ path ) ; $ path = implode ( DIRECTORY_SEPARATOR , $ segments ) ; if ( $ rtrim ) { $ pat... | Normalizes path slashes when mixed between path and url conversion |
233,113 | public static function normalizeUrl ( $ url , $ rtrim = true ) { $ url = trim ( $ url ) ; $ url = str_replace ( '\\' , '/' , $ url ) ; $ url = preg_replace ( '/\/+/' , '==DS==' , $ url ) ; $ segments = explode ( '==DS==' , $ url ) ; $ url = implode ( '/' , $ segments ) ; if ( $ rtrim ) { $ url = rtrim ( $ url , '/' ) ;... | Normalizes url slashes when mixed between path and url conversion |
233,114 | public static function uniqueFilename ( $ path ) { $ dir = self :: getDirectory ( $ path ) ; $ filename = self :: getFileName ( $ path ) ; $ filename = self :: sanitizeFileName ( $ filename ) ; $ info = pathinfo ( $ filename ) ; $ ext = ! empty ( $ info [ 'extension' ] ) ? '.' . $ info [ 'extension' ] : '' ; $ name = b... | Get a filename that is sanitized and unique for the given directory . |
233,115 | public static function sanitizeFileName ( $ filename ) { $ special_chars = array ( "?" , "[" , "]" , "/" , "\\" , "=" , "<" , ">" , ":" , ";" , "," , "'" , "\"" , "&" , "$" , "#" , "*" , "(" , ")" , "|" , "~" , "`" , "!" , "{" , "}" , chr ( 0 ) ) ; $ filename = str_replace ( $ special_chars , '' , $ filename ) ; $ file... | Sanitizes a filename replacing whitespace with dashes |
233,116 | public static function getFileName ( $ path , $ includeExtension = true ) { $ option = ( $ includeExtension ) ? PATHINFO_BASENAME : PATHINFO_FILENAME ; return pathinfo ( $ path , $ option ) ; } | Extracts filename from path with or without extension |
233,117 | public function index ( ) { $ options = $ this -> getQueryHelperOptions ( ) ; $ items = $ this -> repo -> allPaged ( $ options ) ; if ( ! $ items ) { return $ this -> respondNotFound ( 'Unable to fetch the selected resources' ) ; } $ response = [ 'data' => [ ] , 'meta' => [ 'pagination' => [ ] ] ] ; $ resource = new Fr... | Return items in a paged way |
233,118 | public function show ( $ id ) { $ item = $ this -> repo -> getById ( $ id ) ; if ( ! $ item ) { return $ this -> respondNotFound ( ) ; } $ resource = new Fractal \ Resource \ Item ( $ item , new $ this -> transformerClass ) ; return $ this -> fractal -> createData ( $ resource ) -> toArray ( ) ; } | Return an item by it s id |
233,119 | public function setDefaultModel ( $ model ) { if ( is_string ( $ model ) ) { $ model = new ReflectionClass ( $ model ) ; $ model = $ model -> newInstanceWithoutConstructor ( ) ; } if ( $ model instanceof Model ) { $ this -> defaultModel = get_class ( $ model ) ; return ; } throw new \ InvalidArgumentException ( 'Collec... | Set default model class |
233,120 | protected function checkItems ( array $ data ) { foreach ( $ data as & $ item ) { if ( ! $ item instanceof Model ) { $ item = new $ this -> defaultModel ( $ item ) ; } } return $ data ; } | Check if all items are instance of Model if not create new Model for each item |
233,121 | public function findJournalForId ( $ id ) { $ dql = ' SELECT j,p FROM %s j LEFT JOIN j.postings p WHERE j.id = :id AND j.organization = :organization ' ; return $ this -> em -> createQuery ( sprintf ( $ dql , $ this -> journalFqcn ) ) -> se... | Find Journal for id |
233,122 | public function createJournal ( ) { $ journal = new $ this -> journalFqcn ( ) ; $ journal -> setOrganization ( $ this -> oh -> getOrganization ( ) ) ; return $ journal ; } | Create new Journal |
233,123 | public function addRoute ( $ expression , $ route ) { if ( strpos ( $ expression , '*' ) !== false ) { return $ this -> addRegexpRoute ( $ expression , $ route ) ; } else { return $ this -> addSimpleRoute ( $ expression , $ route ) ; } } | Add new route . |
233,124 | private function addRegexpRoute ( $ expression , $ route ) { $ expression = '|^' . str_replace ( array ( '*' , '\\' ) , array ( '.*' , '\\\\' ) , $ expression ) . '$|i' ; if ( array_key_exists ( $ expression , $ this -> regexpRoutes ) && $ this -> regexpRoutes [ $ expression ] == $ route ) { return false ; } $ this -> ... | Add new regexp route . |
233,125 | private function addSimpleRoute ( $ expression , $ route ) { if ( array_key_exists ( $ expression , $ this -> simpleRoutes ) && $ this -> simpleRoutes [ $ expression ] == $ route ) { return false ; } $ this -> simpleRoutes [ $ expression ] = ( string ) $ route ; return true ; } | Add new simple route . |
233,126 | private function doDetect ( $ className , $ performInterfaceDetection = true ) { $ detection = $ this -> doDetectByRoutes ( $ className ) ; if ( $ detection ) { return $ detection ; } $ parentClass = get_parent_class ( $ className ) ; if ( $ parentClass ) { $ parentDetection = $ this -> doDetect ( $ parentClass , false... | Detect pool . |
233,127 | private function doDetectByRoutes ( $ className ) { if ( ! empty ( $ this -> simpleRoutes [ $ className ] ) ) { return new ClassDetection ( $ this -> simpleRoutes [ $ className ] ) ; } foreach ( $ this -> regexpRoutes as $ regexpRoute => $ poolName ) { if ( preg_match ( $ regexpRoute , $ className ) ) { return new Clas... | Perform detection based on class name and routes registered for this class . |
233,128 | private function doDetectByInterfaces ( $ className ) { $ interfaces = $ this -> getOrderedInterfaces ( $ className ) ; foreach ( $ interfaces as $ interface ) { $ candidate = $ this -> doDetectByRoutes ( $ interface ) ; if ( $ candidate ) { return $ candidate ; } } return ; } | Perform detection based on class interfaces . |
233,129 | private function getOrderedInterfaces ( $ className ) { $ interfacesArr = $ this -> prepareClassTreeInterfaces ( $ className ) ; $ interfaces = array ( ) ; foreach ( $ interfacesArr as $ classInterfaces ) { foreach ( $ classInterfaces as $ interface ) { if ( array_search ( $ interface , $ interfaces ) === false ) { arr... | Get a list of class interfaces ordered by plase of interface declaration . |
233,130 | private function prepareClassTreeInterfaces ( $ className ) { $ interfacesArr = array ( ) ; $ reflection = new ReflectionClass ( $ className ) ; $ interfacesArr [ ] = $ reflection -> getInterfaceNames ( ) ; if ( empty ( $ interfacesArr [ 0 ] ) ) { return array ( ) ; } $ classParents = class_parents ( $ className ) ; fo... | Prepares all interfaces for given class and its parents . |
233,131 | public function findAllTreeItems ( $ publishedOnly = false ) { $ filter = $ publishedOnly ? [ 'published' => true ] : [ ] ; return $ this -> repository -> findBy ( $ filter , [ 'lft' => 'ASC' ] ) ; } | Returns all items in tree structure |
233,132 | public function getUniqueAlias ( $ entity , string $ titleProperty = 'title' , string $ titleValue = null , string $ aliasColumn = 'seoTitle' ) : string { $ alias = Strings :: webalize ( $ titleValue ?? $ entity -> { $ titleProperty } ) ; $ id = $ entity -> id ?? null ; while ( ! $ this -> seoTitleIsUnique ( $ id , $ a... | Returns unique seo alias for entity |
233,133 | private function seoTitleIsUnique ( $ id , string $ generatedAlias , string $ aliasColumn = 'seoTitle' ) : bool { $ alias = Strings :: webalize ( $ generatedAlias ) ; if ( $ id === null ) { $ results = $ this -> repository -> findBy ( [ $ aliasColumn => $ alias ] ) ; } else { $ results = $ this -> repository -> findBy ... | Checks if seo title is unique . |
233,134 | public function removeImage ( $ entityId ) { if ( ! $ entityId ) { return false ; } $ delete = ' UPDATE ' . $ this -> repository -> getClassName ( ) . ' a SET a.image = NULL WHERE a.id = ' . $ entityId . ' ' ; $ q = $ this -> query ( $ delete ) ; $ q -> execute ( ) ; } | Sets image to NULL |
233,135 | public function getNewMaxId ( $ entityClassname ) : int { $ maxId = $ this -> em -> createQueryBuilder ( ) -> select ( 'MAX(e.id) + 1' ) -> from ( $ entityClassname , 'e' ) -> getQuery ( ) -> getSingleScalarResult ( ) ; return ( int ) $ maxId ; } | Returns new MAX ID for entity |
233,136 | public function rebuildTree ( $ entityClass = '' , $ parentEntity ) { if ( $ entityClass === '' ) { throw new Exception ( 'messages.error.classNameNotProvided' ) ; } if ( $ parentEntity === null ) { throw new Exception ( 'messages.error.cantRemakeTree' ) ; } $ dqlLft = ' UPDATE ' . $ entityClass . ' a ... | Rebuilds a tree structure by setting lft and rgt values across the rest of the tree |
233,137 | public function deleteTreeItem ( $ entityClass = '' , $ id ) { if ( $ entityClass === '' ) { throw new Exception ( 'messages.error.classNameNotProvided' ) ; } $ entity = $ this -> findById ( $ id ) ; $ difference = $ entity -> rgt - $ entity -> lft + 1 ; $ deleteTree = ' DELETE FROM ' . $ entityClass . '... | Deletes a tree node and updates rest of the tree |
233,138 | public function deriveColumn ( $ index ) { $ this -> validateColumnIndex ( $ index ) ; $ column = new DerivedColumn ( $ this -> columns [ $ index ] -> getAlias ( ) ) ; return $ column -> setTable ( $ this ) ; } | Derives an expression in the query s select clause as a column of the query s associated resultset . |
233,139 | public function deriveColumns ( ) { $ derived = array ( ) ; for ( $ i = 0 ; $ i < count ( $ this -> columns ) ; $ i ++ ) { $ derived [ ] = $ this -> deriveColumn ( $ i ) ; } return $ derived ; } | Derives all expressions in the query s select clause as columns of the query s associated resultset . |
233,140 | public function setModuleDirs ( $ dirs ) { if ( ! is_array ( $ dirs ) && ! ( $ dirs instanceof \ Traversable ) ) { throw new \ InvalidArgumentException ( 'Invalid argument $dirs; array or instance of Traversable expected' ) ; } $ this -> moduleDirs = array ( ) ; foreach ( $ dirs as $ dir ) { if ( ! is_dir ( $ dir ) || ... | Set module directories |
233,141 | public static function isValidFieldOccurrence ( $ arg ) { if ( $ arg === null || ctype_digit ( $ arg ) ) { $ arg = ( int ) $ arg ; } return is_int ( $ arg ) && $ arg >= 0 && $ arg < 100 ; } | Return TRUE if argument is a valid field occurrence . |
233,142 | public static function match ( $ reBody ) { if ( strpos ( $ reBody , '#' ) !== false ) { $ reBody = str_replace ( '#' , '\#' , $ reBody ) ; } $ regexp = "#{$reBody}#D" ; return function ( Field $ field ) use ( $ regexp ) { return ( bool ) preg_match ( $ regexp , $ field -> getShorthand ( ) ) ; } ; } | Return predicate that matches a field shorthand against a regular expression . |
233,143 | public static function factory ( array $ field ) { foreach ( array ( 'tag' , 'occurrence' , 'subfields' ) as $ index ) { if ( ! array_key_exists ( $ index , $ field ) ) { throw new InvalidArgumentException ( "Missing '{$index}' index in field array" ) ; } } return new Field ( $ field [ 'tag' ] , $ field [ 'occurrence' ... | Return a new field based on its array representation . |
233,144 | public function setSubfields ( array $ subfields ) { $ this -> _subfields = array ( ) ; foreach ( $ subfields as $ subfield ) { $ this -> addSubfield ( $ subfield ) ; } } | Set the field subfields . |
233,145 | public function addSubfield ( \ HAB \ Pica \ Record \ Subfield $ subfield ) { if ( in_array ( $ subfield , $ this -> getSubfields ( ) , true ) ) { throw new InvalidArgumentException ( "Cannot add subfield: Subfield already part of the subfield list" ) ; } $ this -> _subfields [ ] = $ subfield ; } | Add a subfield to the end of the subfield list . |
233,146 | public function removeSubfield ( \ HAB \ Pica \ Record \ Subfield $ subfield ) { $ index = array_search ( $ subfield , $ this -> _subfields , true ) ; if ( $ index === false ) { throw new InvalidArgumentException ( "Cannot remove subfield: Subfield not part of the subfield list" ) ; } unset ( $ this -> _subfields [ $ i... | Remove a subfield . |
233,147 | public function getSubfields ( ) { if ( func_num_args ( ) === 0 ) { return $ this -> _subfields ; } else { $ selected = array ( ) ; $ codes = array ( ) ; $ subfields = $ this -> getSubfields ( ) ; array_walk ( $ subfields , function ( $ value , $ index ) use ( & $ codes ) { $ codes [ $ index ] = $ value -> getCode ( ) ... | Return the field s subfields . |
233,148 | public function getNthSubfield ( $ code , $ n ) { $ count = 0 ; foreach ( $ this -> getSubfields ( ) as $ subfield ) { if ( $ subfield -> getCode ( ) == $ code ) { if ( $ count == $ n ) { return $ subfield ; } $ count ++ ; } } return null ; } | Return the nth occurrence of a subfield with specified code . |
233,149 | public function getSubfieldsWithCode ( $ code ) { return array_filter ( $ this -> _subfields , function ( Subfield $ s ) use ( $ code ) { return $ s -> getCode ( ) == $ code ; } ) ; } | Return all subfields with the specified code . |
233,150 | public function setDefinition ( $ definition ) { if ( $ definition instanceof Expression ) { $ definition = ( string ) $ definition ; } $ this -> definition = $ definition ; } | Set the definition . |
233,151 | private function getDefaultAdapter ( ) { if ( extension_loaded ( 'curl' ) ) { $ this -> parallelAdapter = new MultiAdapter ( $ this -> messageFactory ) ; $ this -> adapter = function_exists ( 'curl_reset' ) ? new CurlAdapter ( $ this -> messageFactory ) : $ this -> parallelAdapter ; if ( ini_get ( 'allow_url_fopen' ) )... | Create a default adapter to use based on the environment |
233,152 | private function mergeDefaults ( & $ options ) { if ( ! isset ( $ options [ 'headers' ] ) || ! isset ( $ this -> defaults [ 'headers' ] ) ) { $ options = array_replace_recursive ( $ this -> defaults , $ options ) ; return null ; } $ defaults = $ this -> defaults ; unset ( $ defaults [ 'headers' ] ) ; $ options = array_... | Merges default options into the array passed by reference and returns an array of headers that need to be merged in after the request is created . |
233,153 | protected function build ( ) { $ content = '' ; if ( isset ( $ this -> parameters ) && is_array ( $ this -> parameters ) ) { $ content = http_build_query ( $ this -> parameters ) ; } if ( isset ( $ this -> body ) ) { $ content = $ this -> body ; } $ content_type = 'application/x-www-form-urlencoded; charset=utf-8' ; if... | Ready the request for transport |
233,154 | protected function sendRequest ( ) { $ context = stream_context_create ( $ this -> request ) ; $ response = trim ( file_get_contents ( $ this -> endpoint , FALSE , $ context ) ) ; $ this -> response = new Response ( $ http_response_header , $ response , $ this -> request ) ; return $ this -> response ; } | Sends the actual request and returns the response . |
233,155 | public function setSubResources ( array $ subResources ) { foreach ( $ subResources as $ name => $ mapping ) { if ( ! is_string ( $ name ) || ! is_array ( $ mapping ) ) { throw Exception :: invalidSubResources ( $ this -> className ) ; } if ( ! isset ( $ mapping [ 'fieldName' ] ) ) { throw Exception :: invalidSubResour... | Sets the set of allowable sub - resources . |
233,156 | public function format ( array $ response ) { $ car = '<br />' ; $ format = '' ; foreach ( $ response as $ media ) { $ format .= '<div class="media">' . '<img src="' . $ media -> getThumburl ( ) . '"' . ' width="' . $ media -> getThumbwidth ( ) . '"' . ' height="' . $ media -> getThumbheight ( ) . '"' . ' title="' . Ap... | format a media response as an HTML string |
233,157 | public function filterCamelCaseToUnderscore ( $ text ) { $ text = StaticFilter :: execute ( $ text , 'Word\CamelCaseToUnderscore' ) ; $ text = StaticFilter :: execute ( $ text , 'StringToLower' ) ; return $ text ; } | Filter camel case to underscore |
233,158 | protected function doLoadClassMetadata ( $ type ) { if ( false === $ this -> classMetadataExists ( $ type ) ) { return null ; } $ className = $ this -> getClassNameForType ( $ type ) ; return $ this -> mf -> getMetadataFor ( $ className ) ; } | Loads Doctrine ClassMetadata for an entity type . |
233,159 | protected function classMetadataExists ( $ type ) { $ className = $ this -> getClassNameForType ( $ type ) ; try { $ metadata = $ this -> mf -> getMetadataFor ( $ className ) ; return true ; } catch ( MappingException $ e ) { return false ; } return false === $ this -> shouldFilterClassMetadata ( $ metadata ) ; } | Determines if Doctrine ClassMetadata exists for an entity type . |
233,160 | protected function getTypeForClassName ( $ className ) { if ( empty ( $ this -> rootNamespace ) ) { return $ className ; } return $ this -> stripNamespace ( $ this -> rootNamespace , $ className ) ; } | Gets the entity type from a Doctrine class name . |
233,161 | protected function getClassNameForType ( $ type ) { if ( ! empty ( $ this -> rootNamespace ) && strstr ( $ type , $ this -> rootNamespace ) ) { $ type = $ this -> stripNamespace ( $ this -> rootNamespace , $ type ) ; } if ( ! empty ( $ this -> rootNamespace ) ) { return sprintf ( '%s\\%s' , $ this -> rootNamespace , $ ... | Gets the Doctrine class name from an entity type . |
233,162 | public function dispatch ( $ action = [ ] , $ group = null ) { if ( is_string ( $ action ) ) { $ action = [ '_controller' => $ action ] ; } $ this -> registerGroup ( $ group , $ action ) ; if ( $ middleware = $ this -> findMiddleware ( $ action ) ) { app ( ) -> call ( [ $ this , 'middleware' ] , $ middleware ) ; } if (... | Dispatch a action from array |
233,163 | protected function findMiddleware ( $ action ) { if ( is_array ( $ action ) && isset ( $ action [ '_middleware' ] ) ) { return $ action [ '_middleware' ] ; } elseif ( isset ( $ this -> group [ '_middleware' ] ) ) { return $ this -> group [ '_middleware' ] ; } return false ; } | find and return middleware |
233,164 | protected function findControllerAndMethod ( array $ action ) { if ( isset ( $ action [ '_controller' ] ) || $ action [ 'uses' ] ) { $ controller = isset ( $ action [ '_controller' ] ) ? $ action [ '_controller' ] : $ action [ 'uses' ] ; if ( strstr ( $ controller , ':' ) ) { list ( $ controller , $ method ) = explode ... | find controller method and namespace in action variable |
233,165 | protected function findNamespaceInController ( & $ controller ) { if ( strstr ( $ controller , '\\' ) ) { $ namespace = explode ( '\\' , $ controller ) ; $ controller = end ( $ namespace ) ; $ namespace = rtrim ( join ( '\\' , array_slice ( $ namespace , 0 , count ( $ namespace ) - 1 ) ) , '\\' ) ; } else { $ namespace... | find namespace in controller |
233,166 | private function handleResponse ( $ response ) { if ( $ response instanceof View ) { $ content = $ response -> render ( ) ; } elseif ( $ response instanceof Response ) { $ content = $ response -> getContent ( ) ; } elseif ( $ response instanceof Request ) { $ content = $ response -> getResponse ( ) -> getContent ( ) ; ... | Handler the controller returned value |
233,167 | protected function setup ( InputInterface $ input ) { return $ this -> setup -> setForcedRollback ( $ input -> getOption ( 'force-rollback' ) ) -> setExecuteQueries ( $ input -> getOption ( 'execute' ) ) -> setRollbackedFirst ( $ input -> getOption ( 'rollback-first' ) ) -> run ( ) ; } | Start migration setup |
233,168 | public function getDocComment ( $ withCommentMark = false ) { $ docComment = $ this -> _reflectionMethod -> getDocComment ( ) ; if ( $ withCommentMark === true ) { $ docComment = PhpDocCommentObject :: ltrim ( $ docComment ) ; } else { $ docComment = PhpDocCommentObject :: stripCommentMarks ( $ docComment ) ; } return ... | Get DocComment of method |
233,169 | public function compile ( ExpressCompiler $ compiler , $ flags = 0 ) { try { if ( $ flags & self :: FLAG_RAW ) { $ compiler -> write ( $ this -> expression -> compile ( $ compiler -> getExpressionContextFactory ( ) , false , '$this->exp' ) ) ; } else { $ compiler -> write ( "\t\ttry {\n" ) ; if ( $ this -> stringify ) ... | Compiles an expression into PHP code . |
233,170 | public function normalize ( & $ data , $ format ) { if ( ! is_array ( $ data ) ) { return $ this -> $ format ( $ data ) ; } foreach ( $ data as $ key => $ value ) { if ( $ key != ( $ normalizedKey = $ this -> $ format ( $ key ) ) ) { if ( array_key_exists ( $ normalizedKey , $ data ) ) { throw new \ InvalidArgumentExce... | Normalize given data If an array is given normalize keys according to given method |
233,171 | public static function fromCurrent ( $ key = null , $ default = null ) { switch ( static :: getMethod ( ) ) { case 'get' : $ data = $ _GET ; break ; case 'post' : $ data = $ _POST ; break ; default : $ data = null ; } return static :: from ( static :: getMethod ( ) , $ key , $ default , $ data ) ; } | Get variable from the current HTTP method |
233,172 | public static function getHeader ( $ header ) { $ headers = static :: getHeaders ( ) ; if ( true === isset ( $ headers [ $ header ] ) ) { return $ headers [ $ header ] ; } return null ; } | Get request header by key |
233,173 | public static function all ( ) { if ( true === isset ( static :: $ method [ 'data' ] ) ) { return static :: $ method [ 'data' ] ; } parse_str ( static :: getBody ( ) , $ vars ) ; return [ 'get' => $ _GET , 'post' => $ _POST , 'put' => static :: isMethod ( 'put' ) ? $ vars : [ ] , 'delete' => static :: isMethod ( 'delet... | Return all the data from get post put delete patch connect head options and trace |
233,174 | public static function getIp ( ) { if ( isset ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) ) { return $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ; } if ( isset ( $ _SERVER [ 'HTTP-X-FORWARDED-FOR' ] ) ) { return $ _SERVER [ 'HTTP-X-FORWARDED-FOR' ] ; } if ( isset ( $ _SERVER [ 'HTTP_VIA' ] ) ) { return $ _SERVER [ 'HTTP_VIA' ] ;... | Returns the request IP address |
233,175 | public static function parseUrl ( $ key = null ) { if ( null !== $ key && false === is_string ( $ key ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ key ) ) , E_USER_ERROR ) ; } $ url = [ ] ; $ types = [ 'host' => 'HTTP_HOST' , 'port'... | Returns parsed url by giving an option key for only the value of that key to return |
233,176 | private static function get ( $ key = null , $ default = null ) { if ( null !== $ key && isset ( static :: $ method [ 'method' ] , static :: $ method [ 'data' ] ) ) { if ( static :: isMethod ( static :: $ method [ 'method' ] ) ) { $ helper = new StringToArray ( ) ; $ data = $ helper -> execute ( $ key , $ default , sta... | Returns variable from source while converting an array from string |
233,177 | private static function from ( $ type , $ key , $ default , & $ source = null ) { if ( null === $ source ) { if ( static :: isMethod ( $ type ) ) { $ source = [ ] ; static :: parseRawHttpRequest ( $ source ) ; } } static :: $ method = [ 'method' => $ type , 'data' => & $ source ] ; if ( null !== $ key ) { return static... | Get variable from variable source |
233,178 | private static function parseRawHttpRequest ( array & $ data ) { if ( false === isset ( $ _SERVER [ 'CONTENT_TYPE' ] ) ) { $ _SERVER [ 'CONTENT_TYPE' ] = '' ; } $ input = static :: getBody ( ) ; preg_match ( '/boundary=(.*)$/' , $ _SERVER [ 'CONTENT_TYPE' ] , $ matches ) ; if ( 0 === count ( $ matches ) ) { $ json = @ ... | Parses raw HTTP request string |
233,179 | public function renderCalendarLeftmenuAction ( ) { $ melisKey = $ this -> params ( ) -> fromRoute ( 'melisKey' , '' ) ; $ view = new ViewModel ( ) ; $ view -> melisKey = $ melisKey ; return $ view ; } | Render the leftmenu |
233,180 | public function set ( $ name , $ value ) { parent :: set ( $ name , $ value ) ; $ _SESSION [ $ name ] = $ value ; return $ this ; } | Set value in session . |
233,181 | public function find ( $ url ) { if ( ! array_key_exists ( $ url , $ this -> controllerMap ) ) { return null ; } return $ this -> controllerMap [ $ url ] ; } | Finds the controller for the given url . |
233,182 | public function parse ( ) { $ name_without_parens = preg_replace ( '/[{}]/' , '' , $ this -> full_name ) ; $ parts = explode ( '|' , $ name_without_parens ) ; $ name_without_pipes = trim ( $ parts [ 0 ] ) ; $ parts = explode ( '::' , $ name_without_pipes ) ; $ name_without_case_keys = trim ( $ parts [ 0 ] ) ; array_shi... | Parses token elements |
233,183 | public function with ( $ relation ) { foreach ( ( array ) $ relation as $ node ) { $ instance = $ this -> factory -> build ( $ this -> model ( ) , $ node ) ; $ this -> relations [ $ instance -> name ( ) ] = $ instance ; } return $ this ; } | Adds relation to query |
233,184 | public function relation ( $ relation ) { list ( $ name , $ furtherRelations ) = $ this -> factory -> splitRelationName ( $ relation ) ; if ( ! isset ( $ this -> relations [ $ name ] ) ) { throw new QueryException ( sprintf ( 'Unable to retrieve relation "%s" query, relation does not exists in query "%s"' , $ name , $ ... | Returns relation instance |
233,185 | public function getRealName ( ) { if ( $ this -> firstname || $ this -> surname ) { return trim ( $ this -> getFirstname ( ) . ' ' . $ this -> getSurname ( ) ) ; } return null ; } | Get realname Firstname Surname |
233,186 | public function putTemplate ( $ cacheKey , Template $ template ) { if ( $ template -> getCacheTime ( ) == null && ! is_numeric ( $ template -> getCacheTime ( ) ) ) $ template -> setCacheTime ( $ this -> defaultCacheTime ) ; $ this -> put ( $ cacheKey , $ template , ( int ) $ template -> getCacheTime ( ) ) ; return true... | Stores the specified template to cache using the cacheKey specified . |
233,187 | public function getTemplateCacheKey ( Template $ template , $ globals ) { $ locals = $ template -> getLocals ( ) ; $ cachekey = '' ; if ( $ template -> isTopTemplate ( ) ) $ cachekey .= $ this -> Request -> getAdjustedRequestURI ( ) ; else $ cachekey .= $ template -> getContentType ( ) . $ template -> getName ( ) ; $ c... | Returns a cacheKey for the specified Template |
233,188 | protected function ensureRepository ( $ repository ) { if ( $ repository === null ) { return new Repository ( ) ; } if ( $ repository instanceof RepostoryContract ) { return $ repository ; } if ( is_array ( $ repository ) ) { return new Repository ( $ repository ) ; } throw new \ LogicException ( 'A repository should e... | Ensure a Repository instance . |
233,189 | public function toSQL ( Parameters $ params , bool $ inner_clause ) { if ( $ key = $ this -> getKey ( ) ) { try { $ params -> get ( $ key ) ; } catch ( \ OutOfRangeException $ e ) { $ key = null ; } } if ( $ key === null ) { $ val = $ this -> getValue ( ) ; if ( is_bool ( $ val ) ) $ val = $ val ? 1 : 0 ; $ key = $ par... | Write a constant as SQL query syntax |
233,190 | public function getChildren ( ) { $ output = new BaseContainer ( ) ; foreach ( $ this -> getRelation ( ) -> getChildren ( ) as $ childRelation ) { $ childAttribute = $ childRelation -> getAttributeByName ( $ this -> name ) ; $ output -> add ( $ childAttribute , $ childAttribute -> getChildren ( ) ) ; } return $ output ... | Get all inherited Attributes |
233,191 | public function isInherited ( & $ originalColumn = null ) { $ inhcount = $ this -> attinhcount ; if ( $ inhcount == 0 ) { $ originalColumn = null ; return false ; } if ( func_num_args ( ) === 0 ) { return true ; } $ originalRelation = $ this -> getRelation ( ) ; do { $ originalRelation = $ originalRelation -> getParent... | Is this column inheritied from another relation |
233,192 | public function addReference ( PgAttribute $ primaryKey , $ includeChildTables = true ) { $ this -> references -> add ( $ primaryKey ) ; $ primaryKey -> isReferencedBy -> add ( $ this ) ; if ( $ includeChildTables || true ) { foreach ( $ primaryKey -> getRelation ( ) -> getChildren ( ) as $ child ) { $ this -> addRefer... | Add a reference to this attribute |
233,193 | public function getSequence ( ) { if ( preg_match ( "/^nextval\\('([^']+)'::regclass\\)$/" , $ this -> default , $ matches ) ) { return $ this -> catalog -> pgClasses -> findOneByName ( $ matches [ 1 ] ) ; } return null ; } | Is this column a sequence |
233,194 | public function getEntity ( ) { $ references = $ this -> getReferences ( ) ; foreach ( $ references as $ reference ) { if ( $ reference -> isPrimaryKey ( ) ) { return array ( 'entity' => 'normality' , 'normality' => $ reference -> getRelation ( ) -> getEntityName ( ) , ) ; } } switch ( $ this -> getType ( ) -> name ) {... | Return a reference to the entity |
233,195 | public function isZombie ( ) { $ ref = $ this -> getReferences ( ) ; if ( $ this -> isPrimaryKey ( ) and ! $ ref -> isEmpty ( ) ) { return true ; } if ( $ this -> notNull and ! $ ref -> isEmpty ( ) ) { return true ; } return false ; } | Is this column a zombie - column candidate? Happens when at least one of the following is true |
233,196 | protected function getTableFields ( ) { $ connection = Connection :: connect ( ) ; $ driver = getenv ( 'P_DRIVER' ) ; if ( $ driver == 'pgsql' ) { $ describe = '\d ' ; } $ describe = 'describe ' ; $ q = $ connection -> prepare ( $ describe . $ this -> getTableName ( $ this -> className ) ) ; $ q -> execute ( ) ; return... | Get all the column names in a table |
233,197 | protected function getAssignedValues ( ) { $ tableFields = $ this -> getTableFields ( ) ; $ newPropertiesArray = get_object_vars ( $ this ) ; $ columns = $ values = $ tableData = [ ] ; foreach ( $ newPropertiesArray as $ index => $ value ) { if ( in_array ( $ index , $ tableFields ) ) { array_push ( $ columns , $ index... | Get user assigned column values |
233,198 | public static function getSpinnerCombinations ( $ text ) { $ matches = self :: getSpinnerMatches ( $ text ) ; foreach ( $ matches as $ row ) { if ( ! preg_match ( '/[{}]/' , $ row ) ) { $ all [ ] = explode ( '|' , $ row ) ; } } $ combinations = call_user_func_array ( __CLASS__ . '::arrayCartesian' , $ all ) ; foreach (... | Get all combinations for spinner sentence |
233,199 | public static function arrayCartesian ( ) { $ args = func_get_args ( ) ; if ( count ( $ args ) == 0 ) { return [ [ ] ] ; } $ work = array_shift ( $ args ) ; $ cartesian = call_user_func_array ( __METHOD__ , $ args ) ; $ result = [ ] ; foreach ( $ work as $ value ) { foreach ( $ cartesian as $ product ) { $ result [ ] =... | Calculate cartesian product of multiple arrays |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.