idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
231,200 | public function value ( $ name ) { if ( empty ( $ this -> requestOrder ) ) { throw new RuntimeException ( 'Unable to determine the request order' ) ; } $ result = null ; foreach ( $ this -> requestOrder as $ token ) { $ method = $ this -> resolveRequestOrderMethod ( $ token ) ; if ( empty ( $ method ) ) { continue ; } ... | Retrieve a value using the configured request order |
231,201 | public function files ( $ name , $ sanitize = true ) { return $ this -> resolveValue ( $ name , $ _FILES , $ sanitize , true ) ; } | Retrieve the the date associated with a file upload |
231,202 | public function put ( $ source = 'php://input' , $ sanitize = true ) { if ( is_null ( $ source ) ) { $ source = 'php://input' ; } $ source = @ fopen ( $ source , 'r' ) ; if ( ! is_resource ( $ source ) ) { throw new InvalidArgumentException ( 'Expected parameter 1 to be an open-able resource' ) ; } $ data = null ; whil... | Retrieve date from the input stream |
231,203 | public function domain ( $ maxLevels = 0 ) { $ parts = explode ( '.' , $ this -> uri ( ) -> getHost ( ) ) ; return implode ( '.' , array_slice ( $ parts , - 1 * $ maxLevels ) ) ; } | Retrieve the current domain |
231,204 | public function protocol ( $ raw = false ) { if ( $ raw ) { return $ this -> server ( 'SERVER_PROTOCOL' ) ; } $ parts = explode ( '/' , $ this -> server ( 'SERVER_PROTOCOL' ) ) ; return strtolower ( array_shift ( $ parts ) ) . $ this -> server ( 'HTTPS' ) === 'on' ? 's' : '' ; } | Retrieve the requests protocol |
231,205 | public static function determineFileUploadMaxSize ( ) { static $ maxSize = - 1 ; if ( $ maxSize < 0 ) { $ maxSize = self :: parsePhpIniSize ( ini_get ( 'post_max_size' ) ) ; $ upload_max = self :: parsePhpIniSize ( ini_get ( 'upload_max_filesize' ) ) ; if ( $ upload_max > 0 && $ upload_max < $ maxSize ) { $ maxSize = $... | Returns a file size limit in bytes based on the PHP upload_max_filesize and post_max_size |
231,206 | public function getView ( ) { if ( is_null ( $ this -> prefix ) ) { return $ this -> getBaseView ( ) ; } $ view = $ this -> concatViewAndPrefix ( $ this -> prefix , $ this -> view ) ; $ prefixes = clone $ this -> prefixes ; $ this -> attempted ( $ view ) ; while ( ! view ( ) -> exists ( $ view ) ) { if ( is_null ( $ th... | Find the most reasonable view available . |
231,207 | protected function parseController ( $ class ) { $ controller = new ReflectionClass ( $ class ) ; $ this -> fullController = $ controller -> name ; $ class = $ controller -> getShortName ( ) ; $ this -> controller = strtolower ( str_replace ( 'Controller' , '' , $ class ) ) ; } | Get a properly formatted controller name . |
231,208 | protected function parseAction ( $ action ) { if ( $ action === $ this -> fullController ) { return $ this -> action = null ; } $ this -> action = strtolower ( preg_replace ( [ '/^get/' , '/^post/' , '/^put/' , '/^patch/' , '/^delete/' ] , '' , $ action ) ) ; } | Get a properly formatted action name . |
231,209 | protected function getPrefixes ( ) { $ router = app ( \ Illuminate \ Routing \ Router :: class ) ; $ this -> prefixes = collect ( explode ( '/' , $ router -> getCurrentRoute ( ) -> getPrefix ( ) ) ) ; $ this -> prefixes = $ this -> removeControllerFromPrefixes ( $ this -> prefixes ) -> filter ( ) ; if ( $ this -> prefi... | Search for any prefixes attached to this route . |
231,210 | protected function setView ( ) { $ views = [ $ this -> controller , $ this -> action , ] ; $ this -> view = implode ( '.' , array_filter ( $ views ) ) ; } | Combine the controller and action to create a proper view string . |
231,211 | private function getBaseView ( ) { $ this -> attempted ( $ this -> view ) ; return view ( ) -> exists ( $ this -> view ) ? $ this -> view : null ; } | Return the base view if it exists . |
231,212 | public function checkConfig ( ) { $ views = [ $ this -> fullController , $ this -> action , ] ; $ this -> configIndex = implode ( '.' , array_filter ( $ views ) ) ; return array_get ( config ( 'view-routing' ) , $ this -> configIndex ) ; } | Check the view routing config for the controller and method . |
231,213 | public static function sanitizeOutput ( $ buffer ) { if ( ! isset ( $ _GET [ 'unsanitized' ] ) ) { $ search = array ( '/\>[^\S ]+/s' , '/[^\S ]+\</s' , '/(\s)+/s' , '/<!--(.|\s)*? ) ; $ replace = array ( '>' , '<' , '\\1' , '' ) ; $ buffer = preg_replace ( $ search , $ replace , $ buffer ) ; return $ buffer ; } return ... | Minify the html for the outputbuffer |
231,214 | public function resolver ( $ name = null ) { if ( null === $ this -> __templateResolver ) { $ this -> setResolver ( new TemplatePathStack ( ) ) ; } if ( null !== $ name ) { $ viewPath = $ this -> __templateResolver -> resolve ( $ name , $ this ) ; return $ this -> __templateResolver -> resolve ( $ name , $ this ) ; } r... | Retrieve template name or template resolver |
231,215 | public function setVars ( $ variables ) { if ( ! is_array ( $ variables ) && ! $ variables instanceof ArrayAccess ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Expected array or ArrayAccess object; received "%s"' , ( is_object ( $ variables ) ? get_class ( $ variables ) : gettype ( $ variables ) ) ) )... | Set variable storage |
231,216 | public function vars ( $ key = null ) { if ( null === $ this -> __vars ) { $ this -> setVars ( new Variables ( ) ) ; } if ( null === $ key ) { return $ this -> __vars ; } return $ this -> __vars [ $ key ] ; } | Get a single variable or all variables |
231,217 | public function get ( $ key ) { if ( null === $ this -> __vars ) { $ this -> setVars ( new Variables ( ) ) ; } return $ this -> __vars [ $ key ] ; } | Get a single variable |
231,218 | public static function factory ( $ config = array ( ) ) { $ default = array ( 'base_url' => 'https://addons.mozilla.org/nl/firefox/addon/' , 'debug' => false ) ; $ required = array ( 'base_url' , 'app_name' ) ; $ config = Collection :: fromConfig ( $ config , $ default , $ required ) ; $ client = new self ( $ config ->... | Factory method to create a new MozillaAddonsClient |
231,219 | public static function insert ( $ name , $ callback , $ once = false ) { if ( static :: bound ( $ name ) ) { array_unshift ( static :: $ events [ $ name ] , [ $ once ? 'once' : 'always' => $ callback ] ) ; } else { static :: bind ( $ name , $ callback , $ once ) ; } } | Identical to the append method except the event handler is added to the start of the queue . |
231,220 | public static function fire ( $ name , $ data = [ ] , $ stop = false ) { if ( static :: bound ( $ name ) ) { static :: $ fired [ $ name ] = true ; foreach ( static :: $ events [ $ name ] as $ key => $ value ) { list ( $ type , $ callback ) = each ( $ value ) ; if ( is_string ( $ callback ) ) { $ callback = [ $ instance... | Trigger all callback functions for an event . |
231,221 | protected function setDefaultConnectionAttributes ( ) { $ config = Application :: getInstance ( ) -> getConfig ( ) ; $ options = [ \ PDO :: ATTR_ERRMODE => \ PDO :: ERRMODE_EXCEPTION , \ PDO :: ATTR_DEFAULT_FETCH_MODE => \ PDO :: FETCH_ASSOC , \ PDO :: ATTR_STRINGIFY_FETCHES => false ] ; if ( ! isset ( $ config -> keep... | set initial attributes for database connection |
231,222 | public function current ( ) { return isset ( $ this -> rows [ $ this -> rowsCounter ] ) ? $ this -> rows [ $ this -> rowsCounter ] : false ; } | This method return current row |
231,223 | private function appendPage ( ) { $ result = $ this -> executeNextSdkCommand ( ) ; $ iterator = $ this -> commands -> parseResult ( $ result , $ this -> hydrationMode , $ this -> refresh , $ this -> readOnly , $ this -> primers ) ; $ this -> getInnerIterator ( ) -> append ( $ iterator ) ; if ( $ result instanceof SdkRe... | Get a result page and populate the inner iterator . |
231,224 | public function setOptions ( $ options = [ ] ) { if ( false === is_array ( $ options ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ options ) ) , E_USER_ERROR ) ; } $ this -> options = array_merge ( $ this -> options , $ options ) ; } | Set debug options |
231,225 | private function action ( ) { $ options = ( object ) $ this -> options ; if ( true === $ options -> write ) { $ this -> writeToFile ( ) ; } if ( true == $ options -> display ) { return $ this -> displayError ( ) ; } exit ( ) ; } | Determines what to do with the error |
231,226 | private function writeToFile ( ) { $ logger = $ this -> getLogger ( ) ; $ logger -> setDirectory ( Path :: get ( 'log-error' ) ) ; $ error = $ this -> error -> toJson ( $ this -> options [ 'types' ] ) ; if ( false === $ error ) { $ this -> error -> setContext ( null ) ; $ this -> error -> setBacktrace ( null ) ; } $ er... | Writes current error to log file |
231,227 | private function displayError ( ) { if ( count ( $ this -> options [ 'ip' ] ) === 0 || true === in_array ( Request :: getIp ( ) , $ this -> options [ 'ip' ] ) ) { $ error = [ 'type' => $ this -> error -> getType ( ) , 'text' => $ this -> error -> getMessage ( ) , 'file' => $ this -> error -> getFile ( ) , 'line' => $ t... | Prints the error to client |
231,228 | private function formatBacktrace ( ) { $ backtrace = $ this -> error -> getBacktrace ( ) ; if ( null !== $ backtrace ) { array_shift ( $ backtrace ) ; array_shift ( $ backtrace ) ; foreach ( $ backtrace as $ index => $ stack ) { foreach ( [ 'type' , 'args' ] as $ type ) { if ( true === isset ( $ backtrace [ $ index ] [... | Formats the backtrace |
231,229 | public function stylesheet ( $ file ) { $ dirtypes = [ 'css' , 'stylesheets' , 'styles' ] ; $ asset = '' ; if ( $ this -> _generator -> isValidUrl ( $ file ) ) { $ asset = $ file ; } else { foreach ( $ dirtypes as $ dir ) { $ ext = substr ( $ file , strrpos ( $ file , '.' ) + 1 ) ; $ file = $ file . ( ( $ ext != 'css' ... | Returns a stylesheet HTML tag with given filename . |
231,230 | public function link ( $ url , $ content = '' , $ options = [ ] , $ safe = false ) { if ( is_null ( $ content ) ) { $ content = $ url ; } return '<a href="' . $ this -> _generator -> generateUrl ( $ url ) . '"' . self :: attributes ( $ options ) . '>' . self :: encode ( $ content , $ safe ) . '</a>' ; } | Generates an anchor tag . |
231,231 | public function image ( $ url , $ alt = null , $ options = [ ] ) { $ options [ 'alt' ] = $ alt ; return '<img src="' . $ this -> _generator -> asset ( $ url ) . '"' . self :: attributes ( $ options ) . '>' ; } | Creates an image element . |
231,232 | public function whereInStrict ( string $ key , $ values ) : Collection { return $ this -> whereIn ( $ key , $ values , true ) ; } | Filter items by the given key value pair using strict comparison . |
231,233 | public function arsort ( int $ option = SORT_REGULAR ) : Collection { $ index = 0 ; $ items = $ this -> items ; foreach ( $ items as & $ item ) { $ item = [ $ index ++ , $ item ] ; } uasort ( $ items , function ( $ a , $ b ) use ( $ option ) { if ( $ a [ 1 ] === $ b [ 1 ] ) { return $ a [ 0 ] - $ b [ 0 ] ; } $ set = [ ... | Sort an array in reverse order and maintain index association . |
231,234 | public function natcasesort ( ) : Collection { $ index = 0 ; $ items = $ this -> items ; foreach ( $ items as & $ item ) { $ item = [ $ index ++ , $ item ] ; } uasort ( $ items , function ( $ a , $ b ) { $ result = strnatcasecmp ( $ a [ 1 ] , $ b [ 1 ] ) ; return $ result === 0 ? $ a [ 0 ] - $ b [ 0 ] : $ result ; } ) ... | Sort an array using a case insensitive natural order algorithm . |
231,235 | public function natsort ( ) : Collection { $ index = 0 ; $ items = $ this -> items ; foreach ( $ items as & $ item ) { $ item = [ $ index ++ , $ item ] ; } uasort ( $ items , function ( $ a , $ b ) { $ result = strnatcmp ( $ a [ 1 ] , $ b [ 1 ] ) ; return $ result === 0 ? $ a [ 0 ] - $ b [ 0 ] : $ result ; } ) ; foreac... | Sort an array using a natural order algorithm . |
231,236 | public function uksort ( callable $ callback ) : Collection { $ items = $ this -> items ; $ keys = array_combine ( array_keys ( $ items ) , range ( 1 , count ( $ items ) ) ) ; uksort ( $ items , function ( $ a , $ b ) use ( $ callback , $ keys ) { $ result = call_user_func ( $ callback , $ a , $ b ) ; return $ result =... | Sort an array by keys using a user - defined comparison function . |
231,237 | public function usort ( callable $ callback ) : Collection { $ index = 0 ; $ items = $ this -> items ; foreach ( $ items as & $ item ) { $ item = [ $ index ++ , $ item ] ; } usort ( $ items , function ( $ a , $ b ) use ( $ callback ) { $ result = call_user_func ( $ callback , $ a [ 1 ] , $ b [ 1 ] ) ; return $ result =... | Sort an array by values using a user - defined comparison function . |
231,238 | public function initialize ( Listener $ listener ) { $ this -> tracker -> initialize ( $ listener ) ; $ this -> wathedPaths = $ listener -> getPaths ( ) ; } | Initialize new listener |
231,239 | public function evaluate ( ) { $ this -> tracker -> clearChangeSet ( ) ; $ this -> modified = array ( ) ; $ inEvents = inotify_read ( $ this -> inotify ) ; $ inEvents = is_array ( $ inEvents ) ? $ inEvents : array ( ) ; foreach ( $ inEvents as $ inEvent ) { $ this -> translateEvent ( $ inEvent ) ; } } | Evaluate Filesystem changes |
231,240 | public function manage ( ) { $ this -> initLoop ( ) ; $ this -> context = new Context ( $ this -> loop ) ; $ this -> initStreams ( ) ; $ this -> pmReplySocket = $ this -> context -> getSocket ( \ ZMQ :: SOCKET_REP ) ; $ this -> dtoContainer = new DtoContainer ( ) ; $ this -> dtoContainer -> setDto ( new LmStateDto ( ) ... | Send periodic signals about CPU and memory status ; total and per PID |
231,241 | public function fromFile ( $ filePath ) { $ pemString = file_get_contents ( $ filePath ) ; if ( ! $ pemString ) { throw new RuntimeException ( "Unable to read file at path '$filePath'." ) ; } try { $ certificate = $ this -> fromString ( $ pemString ) ; } catch ( Exception $ e ) { throw new RuntimeException ( "File at '... | Create a certificate from a file path . |
231,242 | private function formatKey ( $ certData ) { return X509Certificate :: PEM_HEADER . PHP_EOL . chunk_split ( $ certData , 64 , PHP_EOL ) . X509Certificate :: PEM_FOOTER . PHP_EOL ; } | Given the certData string turn it back into a proper PEM encoded certificate . |
231,243 | public function detail ( ) { $ url = $ this -> montage -> url ( 'schema-detail' , $ this -> name ) ; return $ this -> montage -> request ( 'get' , $ url ) ; } | Returns the details of a specific Montage schema . |
231,244 | protected function parseSubSelect ( $ query ) { if ( $ query instanceof self ) { $ query -> columns = [ $ query -> columns [ 0 ] ] ; return [ $ query -> toSql ( ) , $ query -> getBindings ( ) ] ; } elseif ( is_string ( $ query ) ) { return [ $ query , [ ] ] ; } else { throw new \ InvalidArgumentException ( ) ; } } | Parse the sub - select query into SQL and bindings . |
231,245 | private function loadLateLoadProperty ( ) { $ pks = $ this -> pgClass -> getPrimaryKeys ( ) ; $ this -> lateLoadProperty = ( count ( $ pks ) === 1 ) ? $ pks -> pop ( ) -> name : null ; } | Determine the lateLoadProperty |
231,246 | private function getIsZombieFunction ( ) { $ zombieTests = $ this -> pgClass -> getAttributes ( ) -> filter ( function ( $ e ) { return $ e -> isZombie ( ) ; } ) -> map ( function ( $ zombieCol ) { return sprintf ( "( null === \$this->data['%s'] )" , addslashes ( $ zombieCol -> name ) ) ; } ) ; if ( $ zombieTests ) { $... | Produce the isZombie method |
231,247 | private function getSqlInterfaceFunction ( ) { if ( count ( $ this -> keyProperties ) !== 1 ) { $ content = " throw new \LogicException('Normality can\\'t (yet) handle tables without a primary key or multi-column primary keys.\\n" . "Please extend the generator or overload {$this->pgClass->getEntityName()}->parse().... | Produce the static entity function data |
231,248 | private function generateGetSetLinksCallback ( & $ get , & $ set , $ name , $ link ) { foreach ( $ link -> foreignEntities as $ foreignEntity ) { $ nameForeignEntity = $ this -> getSetAlias ( "{$foreignEntity}s" , 'data' ) ; $ this -> additionalProperties [ ] = $ nameForeignEntity ; $ this -> class -> addUses ( 'Bond\\... | many to many references to foreign entities |
231,249 | private function generateGetSetReferenceCallback ( & $ get , & $ set , $ reference ) { if ( ! ( $ property = $ this -> getSetAlias ( $ reference , 'reference' ) ) ) { return ; } $ this -> additionalProperties [ ] = $ property ; $ this -> class -> addUses ( 'Bond\\Repository' ) ; $ this -> class -> addUses ( 'Bond\\Enti... | References to foreign entities in a 1 - > 1 or 1 - > many way . Think Contact - > ContactUser or Contact - > Addresses |
231,250 | private function generateGetSetBoolCallback ( & $ get , & $ set , $ columnName ) { $ this -> class -> classComponents [ ] = new FunctionDeclaration ( "getset.{$columnName}.get" , $ this -> generateGetCallbackForBool ( $ columnName ) ) ; $ this -> class -> classComponents [ ] = new FunctionDeclaration ( "getset.{$column... | Bool columns . |
231,251 | private function getSymfonyCompatibleGettersAndSetters ( ) { return array ( ) ; if ( ! $ this -> symfonyFormGetters ) { return array ( ) ; } $ output = explode ( "\n" , <<<PHP/*** Symfony2 compatible getters and setters.* These are __not__ to be used by Bond code. These have be depreciated.*/// /*PHP ) ; $ output = ar... | Build normality compatible getters and setters |
231,252 | private function addSymfonyFormCompatibleGetter ( $ name ) { $ fnName = "get" . \ Bond \ pascal_case ( $ name ) ; $ fnBody = sprintf ( "function %s() { return \$this->get('%s'); }" , $ fnName , addslashes ( $ name ) ) ; $ this -> class -> classComponents [ ] = new FunctionDeclaration ( $ fnName , $ fnBody ) ; } | Build a symfony2 form compatible getter |
231,253 | private function getFormChoiceTextFunction ( ) { $ columns = $ this -> pgClass -> getAttributes ( ) ; $ columnsSelected = array ( ) ; foreach ( $ columns as $ column ) { $ tags = \ Bond \ extract_tags ( $ column , 'normality' ) ; if ( isset ( $ tags [ 'form-choicetext' ] ) ) { $ columnsSelected [ ] = $ column ; } } swi... | Form choice text function |
231,254 | private function getSymfonyValidatorConstraints ( ) { $ constraints = array ( ) ; $ this -> loadUnsettableProperties ( ) ; foreach ( $ this -> dataTypes as $ column => $ type ) { if ( $ type -> isInherited ( ) ) { continue ; } if ( in_array ( $ column , $ this -> unsetableProperties ) ) { continue ; } if ( ! $ type -> ... | Get Symfony validator contraints |
231,255 | private function getOperators ( $ dataClass , $ propertyPath ) { $ metadata = $ this -> registry -> getManagerForClass ( $ dataClass ) -> getClassMetadata ( $ dataClass ) ; if ( false === strpos ( $ propertyPath , '.' ) ) { if ( $ metadata -> hasAssociation ( $ propertyPath ) ) { if ( $ metadata -> isCollectionValuedAs... | Returns the operators according to association type targeted by the property path . |
231,256 | public static function log ( \ Throwable $ throwable , LoggerInterface $ instance , array $ context = [ ] ) : \ Throwable { $ context = Collection :: cast ( $ context , [ ] ) ; $ context [ 'exception' ] = $ throwable ; $ context [ 'backtrace' ] = false ; $ severity = $ throwable instanceof Helper \ ThrowableInterface ?... | Logger the \ Throwable with the proper severity and message |
231,257 | public function finish ( InstalledFileManager $ fileManager , FinalInstallManager $ finalInstall , EnvironmentManager $ environment ) { $ finalMessages = $ finalInstall -> runFinal ( ) ; $ finalStatusMessage = $ fileManager -> update ( ) ; $ finalEnvFile = $ environment -> getEnvContent ( ) ; return view ( 'vendor.inst... | Update installed file and display finished view . |
231,258 | public function item ( $ item , $ transformer , $ model_name = '' ) { $ resource = new Item ( $ item , $ transformer , $ model_name ) ; return $ this -> manager -> createData ( $ resource ) -> toArray ( ) ; } | Fractal transform a single item |
231,259 | public static function pull ( $ key , $ default = NULL ) { if ( 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 ) ; } if ( true === isset ( static :: $ data [ $ key ] ) ) { $ default =... | Retrieve and delete an item |
231,260 | public static function get ( $ key , $ default = null ) { if ( 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 ) ; } if ( true === isset ( static :: $ data [ $ key ] ) ) { return stati... | Retrieve data based on key |
231,261 | public static function all ( ) { $ cookies = [ ] ; foreach ( static :: $ data as $ key => $ value ) { if ( rtrim ( base64_encode ( base64_decode ( $ key , true ) ) , '=' ) === $ key ) { $ cookies [ base64_decode ( $ key ) ] = Hash :: decrypt ( static :: $ data [ $ key ] , Application :: get ( 'salt' ) ) ; } else { $ co... | Get all data from current session Cookie |
231,262 | public function setAttribute ( $ key , $ val ) { if ( is_null ( $ val ) && array_key_exists ( $ key , $ this -> attributes ) ) unset ( $ this -> attributes [ $ key ] ) ; else $ this -> attributes [ $ key ] = $ val ; } | Used to set attributes of the RequestContext |
231,263 | public function validate ( $ value , & $ filtered = null ) { if ( ! $ this -> validator -> validate ( $ value , $ filtered ) ) throw new ValidationException ( $ this -> validator -> getErrorMessage ( $ value ) ) ; return true ; } | Validate the value for this column . |
231,264 | public static function parseArray ( array $ data ) { $ type = strtoupper ( $ data [ 'data_type' ] ) ; if ( ! defined ( static :: class . '::' . $ type ) ) throw new InvalidValueException ( "Invalid column type: $type" ) ; return array ( 'name' => $ data [ 'column_name' ] , 'type' => $ type , 'max_length' => $ data [ 'c... | Parse deserialized array into valid arguments for column properties . |
231,265 | public function unserialize ( $ data ) { $ data = unserialize ( $ data ) ; $ args = self :: parseArray ( $ data ) ; $ this -> __construct ( $ args [ 'name' ] ) ; foreach ( $ args as $ property => $ value ) { if ( ! empty ( $ value ) ) $ this -> set ( $ property , $ value ) ; } return $ col ; } | Restore the column from its serialize form |
231,266 | public static function factory ( array $ data ) { $ type = ucfirst ( strtolower ( $ data [ 'data_type' ] ) ) ; $ args = self :: parseArray ( $ data ) ; $ classname = __NAMESPACE__ . "\\" . ucfirst ( strtolower ( $ args [ 'type' ] ) ) ; $ params = Hook :: execute ( 'Wedeto.DB.Schema.Column.Column.FindClass' , [ 'column_... | Create a column instance from an array . |
231,267 | public function xml ( ) : ? SimpleXMLElement { return simplexml_load_string ( utf8_encode ( $ this -> response -> getBody ( ) -> getContents ( ) ) , 'SimpleXMLElement' , LIBXML_NOCDATA | LIBXML_NOBLANKS ) ; } | Gets the body of the message as XML . |
231,268 | public function headers ( ) : array { return collect ( $ this -> response -> getHeaders ( ) ) -> mapWithKeys ( function ( $ v , $ k ) { return [ $ k => $ v [ 0 ] ] ; } ) -> all ( ) ; } | Retrieves all header values . |
231,269 | public function call ( ) { if ( ! $ this -> responseShouldHaveBody ( ) ) { $ this -> next -> call ( ) ; return ; } $ negotiator = new Negotiator ( ) ; $ format = $ negotiator -> getBest ( $ this -> app -> request ( ) -> headers ( 'Accept' ) ) ; if ( $ format && in_array ( ( $ type = $ format -> getValue ( ) ) , $ this ... | Ensure the provided content type is valid and set the proper response content type |
231,270 | public function contains ( $ token ) { $ token = ( string ) $ token ; $ this -> __validate ( $ token ) ; return $ this -> __contains ( $ token ) ; } | Checks if a the list of tokens contains the provided token . |
231,271 | public function replace ( $ old_token , $ new_token ) { $ updated = false ; $ old_token = ( string ) $ old_token ; $ new_token = ( string ) $ new_token ; $ this -> __validate ( $ old_token ) ; $ this -> __validate ( $ new_token ) ; if ( $ index = array_search ( $ old_token , $ this -> tokens , true ) ) { $ this -> toke... | Replace an existing token for a new one . |
231,272 | public function toggle ( $ token , $ force = null ) { $ output = null ; $ contains = $ this -> contains ( $ token ) ; if ( $ contains ) { if ( ! $ force ) { $ this -> __remove ( [ $ token ] ) ; $ change = false ; } else { $ change = true ; } } else { if ( false === $ force ) { $ change = false ; } else { $ this -> __ad... | If the name exists within the token list it will be removed . If name does not exist it will be added . |
231,273 | protected function __modify ( $ action , $ arguments ) { $ tokens = $ arguments ; $ method = "__{$action}" ; if ( 1 === count ( $ arguments ) ) { $ tokens = reset ( $ tokens ) ; if ( is_string ( $ tokens ) ) { $ tokens = explode ( ' ' , $ tokens ) ; } } if ( is_array ( $ tokens ) ) { $ tokens = array_map ( 'strval' , $... | Alters the list of tokens . |
231,274 | public function offsetSet ( $ offset , $ value ) { $ is_offset_string = is_string ( $ offset ) ; $ is_value_string = is_string ( $ value ) ; if ( null === $ offset && $ is_value_string ) { $ this -> add ( $ value ) ; } elseif ( is_bool ( $ value ) && $ is_offset_string ) { if ( $ value ) { $ this -> add ( $ offset ) ; ... | Append a token to the list and optionally remove an existing token . |
231,275 | public function offsetUnset ( $ offset ) { if ( is_int ( $ offset ) ) { unset ( $ this -> tokens [ $ offset ] ) ; } else { $ this -> remove ( $ offset ) ; } } | Remove a token . |
231,276 | public static function init ( $ configuration = array ( ) ) { $ smConfig = isset ( $ configuration [ 'service_manager' ] ) ? $ configuration [ 'service_manager' ] : array ( ) ; $ serviceManager = new ServiceManager ( new ServiceManagerConfig ( $ smConfig ) ) ; $ serviceManager -> setService ( 'ApplicationConfig' , $ co... | Static method for quick and easy initialization of the Application . |
231,277 | public function createAction ( string $ production_slug , AuthorizationCheckerInterface $ auth , TokenStorageInterface $ token , Request $ request ) : Response { $ production_repo = $ this -> em -> getRepository ( Production :: class ) ; if ( null === $ production = $ production_repo -> findOneBy ( [ 'slug' => $ produc... | Create a new schedule which is a collection of events . |
231,278 | public function readAction ( int $ id , string $ production_slug , AuthorizationCheckerInterface $ auth , PaginatorInterface $ paginator , Request $ request ) : Response { list ( $ schedule , $ production ) = $ this -> lookupEntity ( Schedule :: class , $ id , $ production_slug ) ; if ( ! $ auth -> isGranted ( 'view' ,... | Show a single schedule . |
231,279 | public function deleteAction ( string $ production_slug , int $ id , AuthorizationCheckerInterface $ auth , Request $ request ) : Response { list ( $ schedule , $ production ) = $ this -> lookupEntity ( Schedule :: class , $ id , $ production_slug ) ; if ( ! $ auth -> isGranted ( 'edit' , $ schedule ) ) { throw new Acc... | Delete a single schedule . |
231,280 | public function archiveAction ( string $ production_slug , PaginatorInterface $ paginator , AuthorizationCheckerInterface $ auth , Request $ request ) : Response { $ production_repo = $ this -> em -> getRepository ( Production :: class ) ; if ( null === $ production = $ production_repo -> findOneBy ( [ 'slug' => $ prod... | Show a list of archived schedules . |
231,281 | public function byUsernameAction ( Request $ request ) { $ term = $ request -> get ( 'username' ) ; $ users = $ this -> get ( 'asf_user.user.manager' ) -> getRepository ( ) -> findByUsernameContains ( $ term ) ; $ search = array ( ) ; foreach ( $ users as $ user ) { $ search [ ] = array ( 'id' => $ user -> getId ( ) , ... | Return list of users according to the search by username |
231,282 | public static function apply ( string $ text , $ context , string $ skip = '' , ? callable $ callback = null ) : string { $ context = Storage :: instance ( $ context ) ; $ output = '' ; $ delimiter = null ; for ( $ i = 0 , $ length = strlen ( $ text ) ; $ i < $ length ; ++ $ i ) { if ( $ delimiter == $ text { $ i } ) $... | Insert variables to the input from insertion array used the regexp constant of class |
231,283 | public static function reduce ( string $ text , string $ chars = ' ' ) : string { $ text = preg_replace ( '/[' . $ chars . ']{2,}/' , ' ' , $ text ) ; return $ text ; } | Clear multiply occurance of chars from text and leave only one |
231,284 | public function encode ( ) { return \ pack ( 'CCnnCx' , 1 , $ this -> getType ( ) -> value ( ) , $ this -> getRequestId ( ) , $ this -> getLength ( ) , $ this -> getPaddingLength ( ) ) ; } | Returns the encoded header as a string . |
231,285 | public function verify ( $ nonce , $ action ) { $ value = $ this -> Encryption -> decryptSecureCookie ( $ nonce ) ; if ( ! $ value ) return false ; if ( strcmp ( $ value , $ action ) === 0 ) return true ; return false ; } | Verifies the validity of a nonce against the supplied action . |
231,286 | public function create ( $ action ) { $ expire = time ( ) + $ this -> timePeriod ; $ user_id = $ this -> RequestContext -> getUserRef ( ) ; if ( is_null ( $ user_id ) ) $ user_id = $ this -> Session -> getID ( ) ; return $ this -> Encryption -> encryptSecureCookie ( strtolower ( $ action ) , $ expire , ( string ) $ use... | Creates a new nonce string for the given action typically derived from the user a salt and valid only for a given amount of time |
231,287 | public function reload ( ) { $ this -> init ( array ( self :: CONFIG_KEY_FILE_PATH => $ this -> getConfigFilePath ( ) , ConfigInterface :: KEY_CONTEXT => $ this -> getContext ( ) , ) ) ; } | Reload the configuration from file . |
231,288 | protected function doSetup ( $ config = array ( ) ) { if ( isset ( $ config [ self :: CONFIG_KEY_FILE_PATH ] ) ) { $ this -> configFilePath = $ config [ self :: CONFIG_KEY_FILE_PATH ] ; } else { return $ config ; } if ( isset ( $ config [ ConfigInterface :: KEY_CONTEXT ] ) ) { $ this -> context = $ config [ ConfigInter... | Override in child if you need to override core config setup . |
231,289 | public static final function jsonEncode ( $ data , array $ options = null ) : array { $ encoder = new JsonEncoder ( $ options ) ; return [ $ encoder -> encode ( $ data ) , $ encoder -> hasError ( ) ? new EncoderException ( 'JSON Error: ' . $ encoder -> getError ( ) ) : null ] ; } | Json encode . |
231,290 | public static final function jsonDecode ( $ data , array $ options = null ) : array { $ encoder = new JsonEncoder ( $ options ) ; return [ $ encoder -> decode ( $ data ) , $ encoder -> hasError ( ) ? new EncoderException ( 'JSON Error: ' . $ encoder -> getError ( ) ) : null ] ; } | Json decode . |
231,291 | public static final function gzipEncode ( $ data , array $ options = null ) : array { $ encoder = new GzipEncoder ( $ options ) ; return [ $ encoder -> encode ( $ data ) , $ encoder -> hasError ( ) ? new EncoderException ( 'GZip Error: ' . $ encoder -> getError ( ) ) : null ] ; } | Gzip encode . |
231,292 | public static final function gzipDecode ( $ data , array $ options = null ) : array { $ encoder = new GzipEncoder ( $ options ) ; return [ $ encoder -> decode ( $ data ) , $ encoder -> hasError ( ) ? new EncoderException ( 'GZip Error: ' . $ encoder -> getError ( ) ) : null ] ; } | Gzip decode . |
231,293 | protected function getOriginDb ( OutputInterface $ output , $ now ) { $ url = $ this -> getContainer ( ) -> getParameter ( 'anime_db.ani_db.import_titles' ) ; if ( ( $ path = parse_url ( $ url , PHP_URL_PATH ) ) === false ) { throw new \ InvalidArgumentException ( 'Failed parse URL: ' . $ url ) ; } $ fs = $ this -> get... | Get original db file . |
231,294 | public function addWithIndex ( $ index , $ element ) { if ( ! is_null ( $ index ) && is_scalar ( $ index ) ) { if ( ! $ this -> hasIndex ( $ index ) ) { $ this -> set ( $ index , $ element ) ; } else { throw new ListException ( 'Element could not be added to list. Index already exist.' , E_NOTICE ) ; } } else { throw n... | add a element to a specified position of the list |
231,295 | public function removeIndex ( $ index ) { if ( $ this -> hasIndex ( $ index ) ) { unset ( $ this -> _items [ $ index ] ) ; $ this -> _iterator = null ; return true ; } return false ; } | remove element with specified position from list |
231,296 | public function set ( $ index , $ element ) { if ( ! is_null ( $ index ) && is_scalar ( $ index ) ) { $ this -> _iterator = null ; return $ this -> _items [ $ index ] = $ element ; } else { throw new ListException ( 'Element could not be added to list. Index is not valid.' , E_NOTICE ) ; } } | add or replace a element to a specified position of the list |
231,297 | protected function getDefaultValidator ( ) : ValidatorInterface { $ loaders = [ new StaticMethodLoader ( ) ] ; if ( class_exists ( AnnotationReader :: class ) && class_exists ( ArrayCache :: class ) ) { AnnotationRegistry :: registerUniqueLoader ( 'class_exists' ) ; $ loaders [ ] = new AnnotationLoader ( new CachedRead... | Get a default validator . |
231,298 | protected function getRelationWhere ( $ links , $ key = null ) { if ( is_null ( $ key ) && ! is_array ( $ links ) ) { $ key = in_array ( 'id' , $ this -> primaryKey ) ? 'id' : reset ( $ this -> primaryKey ) ; } if ( ! is_array ( $ links ) ) { $ links = [ $ links => $ key ] ; } foreach ( $ links as & $ item ) { $ item =... | GET RELATION WHERE SQL |
231,299 | public function findManifests ( ) { foreach ( $ this -> src as $ component => $ source ) { $ src = $ source [ 0 ] . "/../manifest.php" ; if ( file_exists ( $ src ) && is_readable ( $ src ) ) { $ this -> manifests [ $ component ] = $ src ; } } } | Function is used to find manifests in psr4 loaded packages |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.