idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
53,200 | public final function addColumn ( $ name , $ type , $ length = null , $ notnull = false , $ default = null , $ autoIncrement = false , $ comment = null ) { return $ this -> addColumnObject ( $ this -> _database -> createColumn ( $ name , $ type , $ length , $ notnull , $ default , $ autoIncrement , $ comment ) ) ; } | Add a column using parameters |
53,201 | public function addColumnObject ( $ column ) { $ name = $ column -> getName ( ) ; $ this -> forbidColumn ( $ name ) ; $ sql = 'ADD COLUMN ' ; $ sql .= $ this -> _database -> prepareIdentifier ( $ name ) ; $ sql .= ' ' ; $ sql .= $ column -> getDefinition ( ) ; $ this -> alter ( $ sql ) ; $ this -> _columns [ $ name ] =... | Add a column using a column object |
53,202 | public function dropColumn ( $ name ) { $ this -> requireColumn ( $ name ) ; $ this -> alter ( 'DROP COLUMN ' . $ this -> _database -> prepareIdentifier ( $ name ) ) ; unset ( $ this -> _columns [ $ name ] ) ; $ this -> _updateConstraints ( $ name , null ) ; } | Drop a column |
53,203 | protected function _updateConstraints ( $ oldColumnName , $ newColumnName ) { $ columnIndex = null ; foreach ( $ this -> _primaryKey as $ index => $ column ) { if ( $ oldColumnName == $ column -> getName ( ) ) { $ columnIndex = $ index ; break ; } } if ( $ columnIndex !== null ) { if ( $ newColumnName ) { $ this -> _pr... | Update constraints after renaming or dropping a column |
53,204 | public function hasIndex ( $ columns , $ unique = false ) { if ( ! is_array ( $ columns ) ) { $ columns = array ( $ columns ) ; } foreach ( $ this -> getIndexes ( ) as $ index ) { if ( $ index -> isUnique ( ) == $ unique and $ index -> getColumns ( ) == $ columns ) { return true ; } } return false ; } | Check for presence of index with given properties ignoring index name |
53,205 | public function toArray ( $ assoc = false ) { $ data = array ( 'name' => $ this -> _name , 'comment' => $ this -> getComment ( ) , ) ; foreach ( $ this -> _columns as $ name => $ column ) { if ( $ assoc ) { $ data [ 'columns' ] [ $ name ] = $ column -> toArray ( ) ; } else { $ data [ 'columns' ] [ ] = $ column -> toArr... | Export table data to an associative array |
53,206 | public function to ( $ url ) { if ( $ url == '/' && $ this -> getRoot ( ) == $ url ) { return $ url ; } return $ this -> isValidUrl ( $ url ) ? $ url : $ this -> generateUrl ( $ url ) ; } | Generates a URL useful for anchor tags . |
53,207 | public function redirect ( $ url ) { if ( ! $ this -> isValidUrl ( $ url ) ) { $ url = $ this -> generateUrl ( $ url ) ; } header ( 'Location: ' . $ url ) ; } | Redirect to given URL . |
53,208 | public function generateUrl ( $ url ) { $ extern = false ; if ( ( 0 === strrpos ( $ url , 'http://' ) ) || ( 0 === strrpos ( $ url , 'https://' ) ) ) { $ extern = true ; } $ http = ( isset ( $ _SERVER [ 'HTTPS' ] ) ) ? 'https://' : 'http://' ; if ( ! $ extern ) { return ( $ this -> getRoot ( ) == '/' ) ? ( ( $ this -> ... | Used to generate a URL based on relative or absolute . |
53,209 | public static function get ( string $ type ) : ImagineInterface { switch ( $ type ) { case self :: GD : return new GdImagine ( ) ; case self :: IMAGICK : return new ImagickImagine ( ) ; case self :: GMAGICK : return new GmagickImagine ( ) ; default : throw new InvalidConfigException ( sprintf ( 'Image driver %s not fou... | Create imagine object for given driver |
53,210 | public static function get_image_fields ( $ field , $ attachment_id , $ sub_field = false ) { $ size = apply_filters ( Filter :: IMAGE , false , $ field , $ sub_field ) ; if ( ! $ size ) { return $ attachment_id ; } $ src = wp_get_attachment_image_src ( $ attachment_id , $ size ) ; if ( ! $ src ) { return $ attachment_... | Get image fields . |
53,211 | public function setFlashVar ( $ key , $ value ) { $ this -> flashVar [ $ key ] = $ value ; $ this -> set ( $ key , $ value ) ; } | Set session var that is only valid for only one request . |
53,212 | public function removeFlashVar ( ) { foreach ( $ this -> flashVar as $ key => $ value ) { unset ( $ this -> storage [ $ key ] ) ; } $ this -> flashVar = array ( ) ; } | Remove the FlashVars and the respective vars in the storage var . |
53,213 | public function moveToPermanent ( ) { $ destination_path = str_replace ( $ this -> getFileName ( ) , '' , $ this -> getPathName ( ) ) ; if ( null !== $ this -> getPathName ( ) && $ this -> getPathName ( ) != $ this -> prePersistName ) { $ this -> move ( $ destination_path ) ; } } | When the file persists if it is in the tmp subdir it will be move before save . |
53,214 | public function getRedirect ( ) { if ( ! $ this -> isRedirect ( ) ) return null ; if ( $ this -> isPermanentRedirect ( ) ) return substr ( $ this -> name , 19 ) ; return substr ( $ this -> name , 9 ) ; } | Returns the redirect value for this view providing it s a redirect |
53,215 | public function convert ( $ xmlString ) { $ dom = new \ DOMDocument ( ) ; $ dom -> loadXML ( $ xmlString ) ; $ documentElement = $ dom -> documentElement ; return $ documentElement ? $ this -> convertDOM ( $ dom -> documentElement ) : $ xmlString ; } | Main conversion API method to convert an XML string into an object tree . |
53,216 | public function stream ( ) { $ stream = fopen ( $ this -> file , 'r' ) ; $ stream = $ stream === false ? null : $ stream ; return new Stream ( $ stream ) ; } | Returns a stream representing the uploaded file . |
53,217 | protected function getConfig ( ) { $ config = array ( ) ; $ config [ 'headers' ] = $ this -> headers ; $ config [ 'config' ] = array ( 'curl' => $ this -> curlConfig ) ; $ config [ 'query' ] = $ this -> parameters ; $ config [ 'cookies' ] = true ; return $ config ; } | Get http request config for guzzle |
53,218 | public function formatException ( \ Exception $ exception , array $ record = array ( ) ) { $ record [ 'msg' ] = $ this -> normalizeException ( $ exception ) ; return $ this -> format ( $ record ) ; } | Format exception with normalizer And replace msg record with formatted exception |
53,219 | public static function fromNative ( ) { $ args = func_get_args ( ) ; if ( count ( $ args ) != 2 ) { throw new \ BadMethodCallException ( 'This methods expects two arguments. One for the key and one for the value.' ) ; } $ keyString = \ strval ( $ args [ 0 ] ) ; $ valueString = \ strval ( $ args [ 1 ] ) ; $ key = new St... | Returns a KeyValuePair from native PHP arguments evaluated as strings |
53,220 | public function sameValueAs ( ValueObjectInterface $ keyValuePair ) { if ( false === Util :: classEquals ( $ this , $ keyValuePair ) ) { return false ; } return $ this -> getKey ( ) -> sameValueAs ( $ keyValuePair -> getKey ( ) ) && $ this -> getValue ( ) -> sameValueAs ( $ keyValuePair -> getValue ( ) ) ; } | Tells whether two KeyValuePair are equal |
53,221 | private function fromArray ( array $ metadata ) { $ defaults = array ( 'type' => 'mixed' , 'mappedClass' => null ) ; $ data = array_merge ( $ defaults , $ metadata ) ; $ type = $ data [ 'type' ] ; $ mappedClass = $ data [ 'mappedClass' ] ; $ isSupported = isset ( static :: $ supportedTypes [ $ type ] ) ; if ( $ isSuppo... | Import an array of metadata |
53,222 | protected function filtering ( RouteInterface $ route , RequestInterface $ request ) { foreach ( $ route -> getFilters ( ) as $ field => $ filter ) { list ( $ grpName , $ keyName ) = explode ( '.' , $ field , 2 ) ; switch ( $ grpName ) { case 'session' : $ against = isset ( $ _SESSION [ $ keyName ] ) ? $ _SESSION [ $ k... | Filtering in route |
53,223 | function responseCode ( $ code = null ) { if ( $ code === null ) { return $ this -> http_response_code ; } else { $ this -> http_response_code = $ code ; return $ this ; } } | Equivalent in functionality to http_response_code from PHP |
53,224 | private function getOtherValue ( $ val ) { $ otherValue = $ val -> getValue ( ) ; return $ otherValue instanceof XPath2Item ? $ otherValue -> getValue ( ) : $ otherValue ; } | Convert an XPath2Item value to a native float or return the original value |
53,225 | public function addGet ( $ pathPattern , $ handler = null , array $ defaultValues = [ ] ) { $ this -> getCollectors ( ) [ 0 ] -> addGet ( $ pathPattern , $ handler , $ defaultValues ) ; return $ this ; } | Add a GET HEAD route to the first collector |
53,226 | public function addPost ( $ pathPattern , $ handler = null , array $ defaultValues = [ ] ) { $ this -> getCollectors ( ) [ 0 ] -> addPost ( $ pathPattern , $ handler , $ defaultValues ) ; return $ this ; } | Add a POST route to the first collector |
53,227 | protected function matchRoute ( ) { foreach ( $ this -> getCollectors ( ) as $ coll ) { if ( $ coll -> matchRoute ( $ this -> result ) ) { return true ; } } return false ; } | Match routes in collectors |
53,228 | protected function executeHandler ( ) { $ handler = $ this -> result -> getHandler ( ) ; if ( is_null ( $ handler ) ) { return $ this -> defaultHandler ( ) ; } else { $ callable = $ this -> resolver -> resolve ( $ handler ) ; if ( ( $ route = $ this -> result -> getRoute ( ) ) && $ route -> hasExtension ( ) ) { if ( $ ... | Execute handler from result |
53,229 | protected function defaultHandler ( ) { if ( $ this -> runExtensions ( self :: BEFORE_DEFAULT , $ this -> result ) ) { $ status = $ this -> result -> getStatus ( ) ; $ handler = $ this -> getHandler ( $ status ) ; if ( $ handler ) { $ handler ( $ this -> result ) ; } else { echo Message :: get ( Message :: DEBUG_NEED_H... | Execute dispatcher s default handler |
53,230 | public function isMatched ( $ pathinfo , $ index ) { $ pathinfo = $ this -> _urlRewrite ( $ pathinfo ) ; if ( ! empty ( $ pathinfo ) ) { $ res = explode ( '/' , $ pathinfo ) ; $ this -> _controllerName = empty ( $ res [ 0 ] ) ? $ this -> _controllerName : ucfirst ( $ res [ 0 ] ) ; if ( count ( $ res ) >= 2 ) { $ this -... | Determine whether the routing rules is matched . |
53,231 | public static function getStackByType ( $ type ) { foreach ( self :: getStacks ( ) as $ stack ) { if ( $ stack -> isType ( $ type ) ) { return $ stack ; } } return new Stacks \ NullStack ( ) ; } | Returns a stack based on type . |
53,232 | public static function inspect ( $ dir ) { if ( ! is_dir ( $ dir ) ) { throw new FileNotFoundException ( sprintf ( 'Directory "%s" does not exist.' , $ dir ) ) ; } foreach ( self :: getStacks ( ) as $ stack ) { if ( $ stack -> inspect ( $ dir ) === true ) { return $ stack ; } } return new Stacks \ NullStack ( ) ; } | Inspects directory with stacks . |
53,233 | public function process ( $ access = '' ) { if ( is_array ( $ access ) ) { if ( isset ( $ access [ 'name' ] ) ) { $ name = $ access [ 'name' ] ; if ( isset ( $ this -> access [ $ name ] ) ) { $ accessInstance = $ this -> access [ $ name ] ; $ accessInstance = new $ accessInstance ; if ( $ accessInstance instanceof Midd... | Process the array |
53,234 | protected function isSerialized ( $ message ) { $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_BaseConsumer: isSerialized' , 1 ) ; return ( $ message == serialize ( false ) || @ unserialize ( $ message ) !== false ) ; } | Detect if the message is in seralized format . |
53,235 | protected function reportErrorPayload ( ) { $ errorPayload = $ this -> message ; unset ( $ errorPayload [ 'payload' ] ) ; unset ( $ errorPayload [ 'original' ] ) ; echo '-> message: ' . print_r ( $ errorPayload , true ) , PHP_EOL ; $ this -> statHat -> ezCount ( 'MB_Toolbox: MB_Toolbox_BaseConsumer: reportErrorPayload'... | Log payload with RabbitMQ objects removed for clarity . |
53,236 | protected function throttle ( $ maxMessageRate ) { $ this -> throttleMessageCount ++ ; if ( $ this -> throttleSecondStamp != date ( 's' ) ) { $ this -> throttleSecondStamp = date ( 's' ) ; $ this -> throttleMessageCount = 0 ; } if ( $ this -> throttleMessageCount > $ maxMessageRate ) { sleep ( MBC_BaseConsumer :: THROT... | Throddle the rate the consumer processes messages . |
53,237 | public static function extractImports ( $ content ) { $ imports = array ( ) ; static :: filterImports ( $ content , function ( $ matches ) use ( & $ imports ) { $ imports [ ] = $ matches [ 'url' ] ; } ) ; return array_unique ( $ imports ) ; } | Extracts all references from the supplied CSS content . |
53,238 | static function getTrace ( $ e , $ seen = null ) { $ starter = $ seen ? 'Caused by: ' : '' ; $ result = array ( ) ; if ( ! $ seen ) $ seen = array ( ) ; $ trace = $ e -> getTrace ( ) ; $ prev = $ e -> getPrevious ( ) ; $ result [ ] = sprintf ( '%s%s: %s' , $ starter , get_class ( $ e ) , $ e -> getMessage ( ) ) ; $ fil... | Returns a string describing in detail the stack context of an exception . |
53,239 | public function loadFromFile ( $ path ) { $ fileSystem = new Filesystem ( ) ; if ( ! $ fileSystem -> exists ( $ path ) ) { throw new FileNotFoundException ( ) ; } $ configurationFile = new SplFileInfo ( $ path ) ; if ( $ configurationFile -> getExtension ( ) !== 'yml' ) { throw new Exception ( 'Only yml are allowed for... | Load the configuration from a yaml file in the file system . |
53,240 | public function cmdGetState ( ) { $ result = $ this -> getListState ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableState ( $ result ) ; $ this -> output ( ) ; } | Callback for state - get command |
53,241 | public function cmdUpdateState ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this ->... | Callback for state - update command |
53,242 | protected function getListState ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { $ list = $ this -> state -> getList ( ) ; $ this -> limitArray ( $ list ) ; return $ list ; } if ( $ this -> getParam ( 'country' ) ) { $ list = $ this -> state -> getList ( array ( 'country' => $ id ) ) ; $ this -> limitA... | Returns an array of country states |
53,243 | protected function submitAddState ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'state' ) ; $ this -> addState ( ) ; } | Add a new country state at once |
53,244 | protected function addState ( ) { if ( ! $ this -> isError ( ) ) { $ state_id = $ this -> state -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ state_id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ state_id ) ; } } | Add a new country state |
53,245 | protected function wizardAddState ( ) { $ this -> validatePrompt ( 'code' , $ this -> text ( 'Code' ) , 'state' ) ; $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'state' ) ; $ this -> validatePrompt ( 'country' , $ this -> text ( 'Country' ) , 'state' ) ; $ this -> validatePrompt ( 'zone_id' , $ this ... | Add a new country state step by step |
53,246 | public function matchRequest ( $ requestedRoute , $ httpMethod ) { foreach ( $ this -> routes as $ route => $ callback ) { $ routeRx = preg_replace ( '%/:([^ /?]+)(\?)?%' , '/\2(?P<\1>[^ /?]+)\2' , $ route ) ; $ routeMethod = strstr ( $ route , ':' , true ) ; if ( $ routeMethod && substr ( $ routeMethod , - 1 ) != '/' ... | Compares the requested route param with the registered routes and checks whether there is a match - true on a match false if not . |
53,247 | public function getClosure ( $ app ) { if ( ! isset ( $ this -> routes [ $ this -> matched ] ) ) return false ; $ callback = $ this -> routes [ $ this -> matched ] ; if ( is_string ( $ callback ) ) { $ className = 'Resources\\' . $ callback ; if ( class_exists ( $ className ) ) { $ callback = function ( ) use ( $ app ,... | Returns a Closure instance which contains the logic to generate the output for the requested route or false . |
53,248 | public function jsonEncode ( $ object , UriBuilder $ uriBuilder , $ metaDataProcessorGroup = NULL ) { return json_encode ( $ this -> process ( $ object , $ uriBuilder , $ metaDataProcessorGroup ) ) ; } | Returns JsonEncode of the given object . If UriPointers are found in the DTO hierarchy the UriBuilder is required to resolve them . |
53,249 | public function process ( $ object , UriBuilder $ uriBuilder , $ metaDataProcessorGroup = NULL ) { $ formerConfigurationStackAttributes = array ( 'cacheTagService' , 'metaDataProcessors' , 'metaDataProcessorStorage' , 'uriBuilder' , 'propertyPath' , ) ; array_unshift ( $ this -> formerConfigurationStack , [ ] ) ; forea... | Basically TearUp and TearDown of the processing environment . The processing mechanism is another method . |
53,250 | protected function processInternal ( $ object ) { if ( is_scalar ( $ object ) ) { return $ object ; } elseif ( is_array ( $ object ) ) { return $ this -> processCollectionType ( $ object , array_keys ( $ object ) ) ; } elseif ( $ object instanceof \ DateTime ) { return $ object -> format ( DateTimeConverter :: DEFAULT_... | Dispatcher which kind of processing has to be done . |
53,251 | protected function processCollectionType ( $ collection , $ collectionKeys ) { $ result = [ ] ; foreach ( $ collectionKeys as $ collectionKey ) { array_push ( $ this -> propertyPath , $ collectionKey ) ; $ value = ObjectAccess :: getProperty ( $ collection , $ collectionKey ) ; $ result [ $ collectionKey ] = $ this -> ... | This method handles collection types which are DTOs and arrays . |
53,252 | protected function processUriPointer ( UriPointer $ uriPointer ) { $ uri = $ this -> uriBuilder -> reset ( ) -> setCreateAbsoluteUri ( TRUE ) -> uriFor ( $ uriPointer -> getActionName ( ) , $ uriPointer -> getArguments ( ) , $ uriPointer -> getControllerName ( ) , $ uriPointer -> getPackageKey ( ) , $ uriPointer -> get... | UriPointers are a special type because they are meant to create a very specific and unique uri string . |
53,253 | protected function getMetaData ( $ propertyPath , $ processedValue , $ object ) { $ metaData = [ ] ; foreach ( $ this -> metaDataProcessors as $ metaDataProcessorKey => $ metaDataProcessorConfiguration ) { if ( ! isset ( $ this -> metaDataProcessorStorage [ $ metaDataProcessorKey ] ) ) { $ this -> metaDataProcessorStor... | Returns MetaData for the given property |
53,254 | private function extractClass ( $ regEx , $ classContent ) { preg_match ( $ regEx , $ classContent , $ matches ) ; if ( isset ( $ matches [ 1 ] ) && class_exists ( $ matches [ 1 ] ) ) { return $ matches [ 1 ] ; } return ; } | Extract class usage from origin class content using regular expresion . |
53,255 | public function redirect ( $ key , $ config = [ ] , $ statusCode = 302 ) { $ router = $ this -> getService ( 'Router' ) ; $ url = $ this -> getService ( 'Url' ) ; $ urlNew = $ url -> generate ( $ key , $ config ) ; $ router -> redirect ( $ urlNew , $ statusCode ) ; } | deprecated and must use redirectAbs |
53,256 | public function redirectAbs ( $ url , $ statusCode = 302 ) { $ router = $ this -> getService ( 'Router' ) ; $ router -> redirect ( $ url , $ statusCode ) ; exit ; } | must be renamed to redirect in next major version |
53,257 | private function toOutput ( \ Throwable $ t ) { $ renderer = new \ Nuki \ Handlers \ Http \ Output \ Renderers \ RawRenderer ( ) ; $ response = new \ Nuki \ Handlers \ Http \ Output \ Response ( $ renderer ) ; $ content = get_class ( $ t ) . ': ' ; $ content .= $ t -> getMessage ( ) ; $ content .= ' in ' ; $ content .=... | Write to output |
53,258 | private function toUserOutput ( string $ msg ) { $ renderer = new \ Nuki \ Handlers \ Http \ Output \ Renderers \ RawRenderer ( ) ; $ response = new \ Nuki \ Handlers \ Http \ Output \ Response ( $ renderer ) ; $ renderer -> setContent ( new \ Nuki \ Models \ IO \ Output \ Content ( $ msg ) ) ; $ response -> httpStatus... | Write message to user output |
53,259 | public static function imgUrl ( $ file , $ folder = false ) { $ src = '@web/images/' ; if ( $ folder !== false ) { $ src .= $ folder . '/' ; } $ src .= $ file ; return Url :: to ( $ src ) ; } | Get image url by filename |
53,260 | public static function img ( $ file , $ folder = false , array $ options = [ ] ) { return Html :: img ( self :: imgUrl ( $ file , $ folder ) , $ options ) ; } | Display img tag |
53,261 | public static function linkUrl ( $ pageId , $ pageUrl ) { if ( self :: $ pages === null ) { self :: initPages ( ) ; } if ( $ pageUrl ) { if ( strpos ( $ pageUrl , 'http' ) === 0 ) { return Url :: to ( $ pageUrl ) ; } return Url :: to ( [ $ pageUrl ] ) ; } if ( isset ( self :: $ pages [ $ pageId ] [ 'link' ] ) ) { if ( ... | Get page url by id |
53,262 | public static function link ( $ menu , $ text , array $ options = [ ] , array $ fields = [ ] ) { if ( $ menu instanceof ActiveRecord ) { if ( ! $ fields ) { $ fields = self :: $ fields ; } if ( $ menu -> { $ fields [ 'page_blank' ] } ) { $ options [ 'target' ] = '_blank' ; } return Html :: a ( $ text , self :: linkUrl ... | Display link by page |
53,263 | public static function isLinkActive ( $ menu , array $ fields = [ ] ) { if ( $ menu instanceof ActiveRecord ) { if ( self :: $ pages === null ) { self :: initPages ( ) ; } if ( ! $ fields ) { $ fields = self :: $ fields ; } $ pageUrl = $ menu -> { $ fields [ 'page_url' ] } ; if ( $ pageUrl ) { if ( strpos ( $ pageUrl ,... | Check if page is active |
53,264 | public static function youTubeId ( $ url ) { parse_str ( parse_url ( $ url , PHP_URL_QUERY ) , $ vars ) ; if ( isset ( $ vars [ 'v' ] ) ) { return $ vars [ 'v' ] ; } return false ; } | Return movie ID based on YouTube url |
53,265 | private static function initPages ( ) { $ modelPage = Yii :: createObject ( Page :: class ) ; $ pages = $ modelPage :: find ( ) -> getMap ( ) -> asArray ( ) -> all ( ) ; if ( $ pages ) { foreach ( $ pages as $ page ) { self :: $ pages [ $ page [ 'id' ] ] = $ page ; } } } | Init pages array |
53,266 | public function getDescendantsAndSelf ( $ columns = [ '*' ] ) { if ( is_array ( $ columns ) ) return $ this -> descendantsAndSelf ( ) -> get ( $ columns ) ; $ arguments = func_get_args ( ) ; $ limit = intval ( array_shift ( $ arguments ) ) ; $ columns = array_shift ( $ arguments ) ? : [ '*' ] ; return $ this -> descend... | Retrieve all nested children an self . |
53,267 | public function moveToNewParent ( ) { $ pid = static :: $ moveToNewParentId ; if ( is_null ( $ pid ) ) $ this -> makeRoot ( ) ; else if ( $ pid !== false ) $ this -> makeChildOf ( $ pid ) ; } | Move to the new parent if appropiate . |
53,268 | public function restoreDescendants ( ) { if ( is_null ( $ this -> getRight ( ) ) || is_null ( $ this -> getLeft ( ) ) ) return ; $ self = $ this ; $ this -> getConnection ( ) -> transaction ( function ( ) use ( $ self ) { $ self -> newNestedSetQuery ( ) -> withTrashed ( ) -> where ( $ self -> getLeftColumnName ( ) , '>... | Restores all of the current node s descendants . |
53,269 | protected function determineDepth ( $ node , $ nesting = 0 ) { while ( $ parent = $ node -> parent ( ) -> first ( ) ) { $ nesting = $ nesting + 1 ; $ node = $ parent ; } return [ $ node , $ nesting ] ; } | Return an array with the last node we could reach and its nesting level |
53,270 | protected function setJavascriptData ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { JavaScriptFacade :: put ( $ key ) ; } else { JavaScriptFacade :: put ( [ $ key => $ value ] ) ; } } | Pass data directly to Javascript . |
53,271 | protected function actionAdd ( $ params = array ( ) ) { $ response = array ( 'errors' => array ( ) , 'data' => array ( ) , ) ; $ values = $ this -> company -> prepareParams ( $ params ) ; if ( empty ( $ values [ 'name' ] ) ) { $ response [ 'errors' ] [ ] = 'cmp01' ; } if ( empty ( $ values [ 'build' ] ) ) { $ response ... | Add company . |
53,272 | public function put ( $ url , $ params , $ options = [ ] , $ headers = [ ] ) { return $ this -> update ( 'put' , $ url , $ params , $ options , $ headers ) ; } | Do a PUT request |
53,273 | protected function update ( $ type , $ url , $ params , $ options = [ ] , $ headers = [ ] ) { return $ this -> makeCall ( $ type , $ url , $ params , $ options , $ headers ) ; } | Proxy function for both edit requests types |
53,274 | protected function makeCall ( $ type , $ url , $ params , $ options , $ headers ) { if ( ! isset ( $ this -> adapter ) ) { throw new NoAdapterException ( 'No adapter set' ) ; } if ( substr ( $ url , 0 , 1 ) === '/' ) { $ url = substr ( $ url , 1 ) ; } $ result = $ this -> adapter -> doRequest ( $ type , $ this -> baseU... | Calls the adapter which will perform the request |
53,275 | protected function runResponseHandler ( Result $ result , $ type , $ url , $ params ) { if ( isset ( $ this -> responseHandlers [ $ result -> getStatus ( ) ] ) ) { $ handler = $ this -> responseHandlers [ $ result -> getStatus ( ) ] ; } else { $ handler = $ this -> responseHandlers [ 'default' ] ; } if ( is_callable ( ... | Run the correct response handler function |
53,276 | public function set ( $ index , AssetInterface $ asset ) { $ this -> data [ $ index ] = $ asset ; $ this -> provides [ ] = $ asset -> is ( ) ; return $ this ; } | Store an Asset container by named index . |
53,277 | public function get ( $ index , array $ params = [ ] , $ asAsset = false ) { if ( ! $ asAsset ) { return isset ( $ this -> data [ $ index ] ) ? $ this -> data [ $ index ] -> fetch ( $ params , $ this ) : null ; } return isset ( $ this -> data [ $ index ] ) ? $ this -> data [ $ index ] : null ; } | Retrieve an asset . |
53,278 | public function parse ( $ mail ) { $ mailPart = $ this -> workAroundMissingBoundary ( $ this -> partFactory -> getPart ( $ mail ) , $ mail ) ; $ partTreeFactory = new PartTreeFactory ( $ this -> partFactory ) ; $ partTree = $ partTreeFactory -> make ( $ mailPart ) ; $ parts = $ partTree -> flattenParts ( ) ; $ envelope... | Accepts the raw email as a string including headers and body . Has to be called before the other functions are available . |
53,279 | private function workAroundMissingBoundary ( Part $ part , $ rawMailBody ) { try { $ part -> countParts ( ) ; } catch ( RuntimeException $ e ) { if ( count ( $ part -> getHeaders ( ) ) > 0 && $ part -> getHeaders ( ) -> has ( 'Content-Type' ) && array_key_exists ( 'boundary' , $ this -> getContentType ( $ part ) -> get... | Some emails are missing a MIME closing boundary . This violations the standard but most software still handles it well - except the Zend Framework who rather don t want to accommodate broken emails . |
53,280 | private function getLoggingEmails ( $ mail , $ parts ) { $ emailAddresses = $ this -> flattenEmailAddresses ( $ this -> getAllEmailAddresses ( $ parts ) ) ; $ messageIds = [ ] ; $ headers = $ mail -> getHeaders ( ) ; if ( ! empty ( $ headers ) && $ headers -> has ( 'message-id' ) ) { $ messageId = $ headers -> get ( 'm... | Returns a list of all emails in the parser including the message id . This is mostly useful for logging . |
53,281 | private function flattenEmailAddresses ( $ emailAddressesByField ) { $ flattened = [ ] ; foreach ( $ emailAddressesByField as $ field => $ emailAddresses ) { foreach ( $ emailAddresses as $ emailAddress ) { $ flattened [ ] = $ emailAddress ; } } return array_unique ( $ flattened ) ; } | Takes the hash of email address and the field they were found in and returns a flattened array of those email addresses . |
53,282 | private function getAddressesFromFieldInPart ( $ field , Part $ part ) { $ addresses = [ ] ; $ headers = $ part -> getHeaders ( ) ; if ( empty ( $ headers ) ) { return $ addresses ; } if ( ! $ headers -> has ( $ field ) ) { return $ addresses ; } $ addressList = null ; try { $ addressList = $ part -> getHeader ( $ fiel... | Retrieves the addresses from a specific field in a part |
53,283 | public function init ( ) { $ this -> renameTableQueries = array ( ) ; $ this -> dropCheckQueries = array ( ) ; $ this -> dropForeignKeyQueries = array ( ) ; $ this -> dropIndexQueries = array ( ) ; $ this -> dropPrimaryKeyQueries = array ( ) ; $ this -> dropColumnQueries = array ( ) ; $ this -> alterColumnQueries = arr... | Reinitilizes SQL collector . |
53,284 | public function collect ( TableDiff $ tableDiff ) { if ( $ tableDiff -> getOldAsset ( ) -> getName ( ) !== $ tableDiff -> getNewAsset ( ) -> getName ( ) ) { $ this -> renameTableQueries = array_merge ( $ this -> renameTableQueries , $ this -> platform -> getRenameTableSQLQueries ( $ tableDiff ) ) ; } $ this -> collectC... | Collects queries to alter tables . |
53,285 | public function getQueries ( ) { return array_merge ( $ this -> getRenameTableQueries ( ) , $ this -> getDropCheckQueries ( ) , $ this -> getDropForeignKeyQueries ( ) , $ this -> getDropIndexQueries ( ) , $ this -> getDropPrimaryKeyQueries ( ) , $ this -> getDropColumnQueries ( ) , $ this -> getAlterColumnQueries ( ) ,... | Gets the queries collected to alter the table . |
53,286 | private function collectColumns ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedColumns ( ) as $ column ) { $ this -> createColumnQueries = array_merge ( $ this -> createColumnQueries , $ this -> platform -> getCreateColumnSQLQueries ( $ column , $ tableDiff -> getNewAsset ( ) -> getName ( ) ) ) ; } fore... | Collects queries about column to alter a table . |
53,287 | private function collectPrimaryKeys ( TableDiff $ tableDiff ) { if ( $ tableDiff -> getCreatedPrimaryKey ( ) !== null ) { $ this -> createPrimaryKeyQueries = array_merge ( $ this -> createPrimaryKeyQueries , $ this -> platform -> getCreatePrimaryKeySQLQueries ( $ tableDiff -> getCreatedPrimaryKey ( ) , $ tableDiff -> g... | Collect queries about primary keys to alter a table . |
53,288 | private function collectForeignKeys ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedForeignKeys ( ) as $ foreignKey ) { $ this -> createForeignKeyQueries = array_merge ( $ this -> createForeignKeyQueries , $ this -> platform -> getCreateForeignKeySQLQueries ( $ foreignKey , $ tableDiff -> getNewAsset ( )... | Collects queries about foreign keys to alter a table . |
53,289 | private function collectIndexes ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedIndexes ( ) as $ index ) { $ this -> createIndexQueries = array_merge ( $ this -> createIndexQueries , $ this -> platform -> getCreateIndexSQLQueries ( $ index , $ tableDiff -> getNewAsset ( ) -> getName ( ) ) ) ; } foreach (... | Collects queries about indexes to alter a table . |
53,290 | private function collectChecks ( TableDiff $ tableDiff ) { foreach ( $ tableDiff -> getCreatedChecks ( ) as $ check ) { $ this -> createCheckQueries = array_merge ( $ this -> createCheckQueries , $ this -> platform -> getCreateCheckSQLQueries ( $ check , $ tableDiff -> getNewAsset ( ) -> getName ( ) ) ) ; } foreach ( $... | Collects queries about checks to alter a table . |
53,291 | public static function init ( Config $ config ) : Container { $ logger = Logger :: init ( $ config ) ; return new Container ( $ logger ) ; } | Initiate Hooks Container |
53,292 | public static function emitBefore ( TransactionInterface $ transaction ) { $ request = $ transaction -> getRequest ( ) ; try { $ request -> getEmitter ( ) -> emit ( 'before' , new BeforeEvent ( $ transaction ) ) ; } catch ( RequestException $ e ) { if ( $ e -> emittedError ( ) ) { throw $ e ; } self :: emitError ( $ tr... | Emits the before send event for a request and emits an error event if an error is encountered during the before send . |
53,293 | public static function emitComplete ( TransactionInterface $ transaction , array $ stats = [ ] ) { $ request = $ transaction -> getRequest ( ) ; $ transaction -> getResponse ( ) -> setEffectiveUrl ( $ request -> getUrl ( ) ) ; try { $ request -> getEmitter ( ) -> emit ( 'complete' , new CompleteEvent ( $ transaction , ... | Emits the complete event for a request and emits an error event if an error is encountered during the after send . |
53,294 | public static function emitError ( TransactionInterface $ transaction , \ Exception $ e , array $ stats = [ ] ) { $ request = $ transaction -> getRequest ( ) ; if ( ! ( $ e instanceof RequestException ) ) { $ e = new RequestException ( $ e -> getMessage ( ) , $ request , null , $ e ) ; } $ e -> emittedError ( true ) ; ... | Emits an error event for a request and accounts for the propagation of an error event being stopped to prevent the exception from being thrown . |
53,295 | public static function convertEventArray ( array $ options , array $ events , $ handler ) { foreach ( $ events as $ name ) { if ( ! isset ( $ options [ $ name ] ) ) { $ options [ $ name ] = [ $ handler ] ; } elseif ( is_callable ( $ options [ $ name ] ) ) { $ options [ $ name ] = [ $ options [ $ name ] , $ handler ] ; ... | Converts an array of event options into a formatted array of valid event configuration . |
53,296 | public function addController ( $ uriPattern , callable $ controller , $ method = '' , $ contentType = '' ) { $ routeBuilder = new RouteBuilder ( ) ; $ routeBuilder -> addUriPattern ( $ uriPattern ) -> addController ( $ controller , $ this -> getAppController ( ) ) -> addMethod ( $ method ) -> addContentType ( $ conten... | Adds a controller to the list of observed controllers . |
53,297 | public function call ( Request $ request ) { if ( $ request !== $ this -> getRequestStack ( ) -> getCurrentRequest ( ) ) { $ this -> getRequestStack ( ) -> push ( $ request ) ; } if ( ! $ request -> getRequestFormat ( null ) && $ request -> getAcceptableContentTypes ( ) ) { $ request -> setRequestFormat ( $ request -> ... | Calls the controller matched with the request uri . |
53,298 | public function renderBasic ( ) { $ html = "<textarea rows='$this->rows'" ; $ html .= " " . $ this -> getCompiledAttributes ( "form-control" ) ; $ html .= ">" ; $ html .= $ this -> value ; $ html .= "</textarea>" ; return $ html ; } | Render basics of textarea |
53,299 | public function addContent ( string $ content ) : \ Symfony \ Component \ HttpFoundation \ Response { return $ this -> setContent ( $ this -> getContent ( ) . $ content ) ; } | Add To Content |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.