idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
228,300 | public function sameValueAs ( ValueObjectInterface $ currency ) { if ( false === Util :: classEquals ( $ this , $ currency ) ) { return false ; } return $ this -> getCode ( ) -> toNative ( ) == $ currency -> getCode ( ) -> toNative ( ) ; } | Tells whether two Currency are equal by comparing their names |
228,301 | private function createBundleCacheWarmer ( $ warmerName ) { $ definition = new Definition ( Utility :: getBundleClass ( 'CacheWarmer\MetadataWarmer' ) , [ new Reference ( $ warmerName ) ] ) ; $ definition -> setPublic ( false ) ; $ definition -> addTag ( 'kernel.cache_warmer' ) ; return $ definition ; } | Creates the bundle cache warmer definition . |
228,302 | private function createCacheClearCommand ( $ warmerName ) { $ definition = new Definition ( Utility :: getBundleClass ( 'Command\Metadata\ClearCacheCommand' ) , [ new Reference ( $ warmerName ) ] ) ; $ definition -> addTag ( 'console.command' ) ; return $ definition ; } | Creates the cache clear command definition . |
228,303 | private function createFileCache ( $ subClassName , array $ cacheConfig , ContainerBuilder $ container ) { $ cacheDir = $ this -> getFileCacheDir ( $ cacheConfig , $ container ) ; Utility :: appendParameter ( 'dirs' , 'metadata_cache_dir' , $ cacheDir , $ container ) ; return new Definition ( Utility :: getLibraryClass... | Creates a file cache service definition . |
228,304 | private function getFileCacheDir ( array $ cacheConfig , ContainerBuilder $ container ) { $ dir = sprintf ( '%s/as3_modlr' , $ container -> getParameter ( 'kernel.cache_dir' ) ) ; if ( isset ( $ cacheConfig [ 'parameters' ] [ 'dir' ] ) ) { $ dir = $ cacheConfig [ 'parameters' ] [ 'dir' ] ; } return $ dir ; } | Gets the file cache directory . |
228,305 | private function loadCacheWarming ( ContainerBuilder $ container ) { $ warmerName = Utility :: getAliasedName ( 'metadata.cache.warmer' ) ; $ definition = $ this -> createCacheWarmer ( $ container ) ; $ container -> setDefinition ( $ warmerName , $ definition ) ; $ definition = $ this -> createBundleCacheWarmer ( $ war... | Loads cache warming services . |
228,306 | public static function has ( string $ key ) : bool { $ expect = explode ( '.' , $ key ) ; $ config = Config :: all ( ) ; foreach ( $ expect as $ setting ) { if ( ! isset ( $ config [ $ setting ] ) ) return false ; $ config = $ config [ $ setting ] ; } return true ; } | Check if setting exists |
228,307 | private function getUniqFilename ( $ path , $ filename , $ counter = 0 ) { if ( ( $ pos = mb_strrpos ( $ filename , '.' ) ) == FALSE ) { $ file = $ filename ; $ extension = '' ; } else { $ file = mb_substr ( $ filename , 0 , $ pos ) ; $ extension = mb_substr ( $ filename , $ pos ) ; } $ postfix = $ counter > 0 ? $ this... | Get uniq name for upload |
228,308 | public function getRequestedRoute ( $ basepath ) { if ( $ basepath == '/' ) { $ url = strtolower ( $ _SERVER [ 'REQUEST_URI' ] ) ; } else { $ url = explode ( $ basepath , strtolower ( $ _SERVER [ 'REQUEST_URI' ] ) ) [ 1 ] ; } return $ this -> _router -> getRoute ( $ url ) ; } | Gets the requested route for the controller . |
228,309 | public function createAction ( $ name ) { if ( ! $ this -> actions -> containsKey ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Any action registered under "%s" name, only ["%s"] are.' , $ name , implode ( '","' , $ this -> actions -> getKeys ( ) ) ) ) ; } return clone $ this -> actions -> get ( $ na... | Creates and return a new action under given name |
228,310 | public function render ( $ template , array $ data = array ( ) ) { $ data = array_merge ( $ data , $ this -> website -> helpers ( ) ) ; $ data [ 'config' ] = $ this -> website ; $ renderer = $ this -> website -> renderer ( ) ; return $ renderer -> render ( $ template , $ data ) ; } | Renders the partial template . |
228,311 | public function onKernelRequest ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( ! $ strMockedDate = $ request -> query -> get ( $ this -> mockParamName ) ) { return ; } $ this -> mock ( $ strMockedDate ) ; } | kernel request event handler |
228,312 | public function onConsoleCommand ( ConsoleCommandEvent $ event ) { $ input = $ event -> getInput ( ) ; if ( ! $ input -> hasOption ( $ this -> mockParamName ) ) { return ; } $ this -> mock ( $ input -> getOption ( $ this -> mockParamName ) ) ; } | console command event handler |
228,313 | public function sameValueAs ( ValueObjectInterface $ dateTimeWithTimeZone ) { if ( false === Util :: classEquals ( $ this , $ dateTimeWithTimeZone ) ) { return false ; } return $ this -> getDateTime ( ) -> sameValueAs ( $ dateTimeWithTimeZone -> getDateTime ( ) ) && $ this -> getTimeZone ( ) -> sameValueAs ( $ dateTime... | Tells whether two DateTimeWithTimeZone are equal by comparing their values |
228,314 | public function sameTimestampAs ( ValueObjectInterface $ dateTimeWithTimeZone ) { if ( false === Util :: classEquals ( $ this , $ dateTimeWithTimeZone ) ) { return false ; } return $ this -> toNativeDateTime ( ) == $ dateTimeWithTimeZone -> toNativeDateTime ( ) ; } | Tells whether two DateTimeWithTimeZone represents the same timestamp |
228,315 | public function toNativeDateTime ( ) { $ date = $ this -> getDateTime ( ) -> getDate ( ) ; $ time = $ this -> getDateTime ( ) -> getTime ( ) ; $ year = $ date -> getYear ( ) -> toNative ( ) ; $ month = $ date -> getMonth ( ) -> getNumericValue ( ) ; $ day = $ date -> getDay ( ) -> toNative ( ) ; $ hour = $ time -> getH... | Returns a native PHP \ DateTime version of the current DateTimeWithTimeZone |
228,316 | public function log ( $ level , $ message , array $ context = [ ] ) { if ( isset ( $ this -> psrToZendPriorityMap [ $ level ] ) ) { $ level = $ this -> psrToZendPriorityMap [ $ level ] ; } $ this -> externalLogger -> log ( $ level , $ message , $ this -> getExtraWithContextMerged ( $ context ) ) ; } | main log function |
228,317 | private function getExtraWithContextMerged ( array $ context = [ ] ) { $ extra = $ this -> getExtra ( ) ; if ( ! empty ( $ context ) ) { $ extra = array_merge ( $ extra , $ context ) ; } return $ extra ; } | merge extra with current context |
228,318 | public static function slugify ( $ slug ) { $ slug = preg_replace ( '/\xE3\x80\x80/' , ' ' , $ slug ) ; $ slug = str_replace ( '-' , ' ' , $ slug ) ; $ slug = preg_replace ( '#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#' , "\x20" , $ slug ) ; $ slug = str_replace ( '?' , '' , $ slug ) ; $ slug = trim ( mb_strtolower ( $ slug ,... | better than urlfriendly because & becomes amp then when making urls it can be translated? |
228,319 | public static function calcAverage ( $ small , $ big ) { $ average = 0 ; if ( $ big != 0 ) { $ x = 0 ; $ y = 0 ; $ average = 0 ; $ x = $ small / $ big ; $ y = $ x * 100 ; $ average = number_format ( ( float ) $ y , 2 , '.' , '' ) ; } return $ average ; } | calculates the average 0 to 100 |
228,320 | protected function getFrontendThemesSettings ( ) { $ themes = $ this -> module -> getByType ( 'theme' , true ) ; unset ( $ themes [ $ this -> theme_backend ] ) ; return $ themes ; } | Returns an array of frontend themes |
228,321 | public static function getLogger ( array $ context = array ( ) ) { $ str = \ Wedeto \ Util \ Functions :: str ( $ context ) ; if ( self :: $ logger_factory === null ) return new NullLogger ( ) ; return self :: $ logger_factory -> get ( array ( $ context [ 'class' ] ?? "Wedeto.UndefinedLogger" ) ) ; } | This function is subscribed to the Wedeto . Util . GetLogger hook to obtain their logger . |
228,322 | public function getResponse ( ) { if ( empty ( $ this -> response ) ) $ this -> response = new StringResponse ( WF :: str ( $ this -> getPrevious ( ) ?? $ this ) , "text/plain" ) ; return $ this -> response ; } | Get the formatted response representing this error |
228,323 | public function getJsonProperty ( $ property , $ key = null , $ default = null ) { $ instance = $ this -> getJsonInstance ( $ property ) ; if ( $ key !== null ) { return $ instance -> get ( $ key , $ default ) ; } return $ instance ; } | Get instance for given property . If a key is given return the value or default . |
228,324 | public function isJsonProperty ( $ property , $ throwException = false ) { if ( is_string ( $ property ) && in_array ( $ property , $ this -> properties ) ) return true ; if ( $ throwException ) throw new JsonPropertyException ( "Requested property '{$property}' is not a valid for '" . get_class ( $ this ) . "'." ) ; r... | Check if requested property is bound to the model |
228,325 | private function getJsonInstance ( $ property ) { if ( ! $ this -> isJsonProperty ( $ property ) ) throw new JsonPropertyException ( "Requested property '{$property}' is not a valid for '" . get_class ( $ this -> model ) . "'." ) ; if ( ! array_key_exists ( $ property , $ this -> jsonInstances ) ) $ this -> jsonInstanc... | Instantiate the JsonProperty object or return the existing instance |
228,326 | private function buildConfig ( Request $ request ) { $ config = array ( 'mode' => $ request -> query -> get ( 'mode' , 'browse' ) , ) ; if ( null !== $ types = $ request -> query -> get ( 'types' , array ( ) ) ) { $ config [ 'types' ] = $ types ; } return $ config ; } | Builds the browser config . |
228,327 | public function listAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ root = $ this -> getFolderRepository ( ) -> findRoot ( ) ; if ( null !== $ id = $ request -> query -> get ( 'folderId' ) ) { if ( ! $ this -> activateFolderById ( $ id , $ root ) ) {... | Lists the children folders . |
228,328 | private function activateFolderById ( $ id , FolderInterface $ folder ) { foreach ( $ folder -> getChildren ( ) as $ child ) { if ( $ child -> getId ( ) == $ id ) { $ child -> setActive ( true ) ; return true ; } if ( $ this -> activateFolderById ( $ id , $ child ) ) { return true ; } } return false ; } | Activate the folder by id . |
228,329 | public function createAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ refFolder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ repo = $ this -> getFolderRepository ( ) ; $ newFolder = $ repo -> createNew ( ) ; $ newFolder ... | Creates the folder . |
228,330 | public function renameAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ folder -> setName ( $ request -> request -> get ( 'name' ) ) ; if ( true !== $ message = $ this ->... | Renames the folder . |
228,331 | public function deleteAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ result = array ( ) ; try { $ this -> removeFolder ( $ folder ) ; } catch ( DBALException $ e ) { $... | Deletes the folder . |
228,332 | public function moveAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ result = [ ] ; $ mode = $ request -> request -> get ( 'mode' ) ; if ( ! in_array ( $ mode , array ( ... | Moves the folder . |
228,333 | public function listMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ medias = $ this -> get ( 'ekyna_media.browser' ) -> setFolder ( $ folder ) -> findMedias ( ( ar... | Lists the medias by folder . |
228,334 | public function moveMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ media = $ this -> get ( 'ekyna_media.media.repository' ) -> find ( $ request -> attributes -> g... | Moves the media to the folder . |
228,335 | public function createMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folderId = $ request -> attributes -> get ( 'id' ) ; $ folder = $ this -> findFolderById ( $ folderId ) ; $ upload = new MediaUpload ( ) ; $ form = $ this -> createForm ( 'eky... | Creates the media into the folder . |
228,336 | public function importMediaAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ modal = $ this -> createModal ( ) ; $ modal -> setTitle ( 'ekyna_media.import.title' ) ; $ folderId = $ request -> attributes -> get ( 'id' ) ; $ folder = $ this -> findFolder... | Imports the media into the folder . |
228,337 | private function persistFolder ( FolderInterface $ folder ) { $ em = $ this -> getEntityManager ( ) ; $ em -> persist ( $ folder ) ; $ em -> flush ( ) ; } | Persists the folder . |
228,338 | private function removeFolder ( FolderInterface $ folder ) { $ em = $ this -> getEntityManager ( ) ; $ em -> remove ( $ folder ) ; $ em -> flush ( ) ; } | Removes the folder . |
228,339 | private function validateFolder ( FolderInterface $ folder ) { $ errorList = $ this -> get ( 'validator' ) -> validate ( $ folder ) ; if ( $ errorList -> count ( ) ) { return $ errorList -> get ( 0 ) -> getMessage ( ) ; } return true ; } | Validates the folder . |
228,340 | private function findFolderById ( $ id ) { $ folder = $ this -> getFolderRepository ( ) -> find ( $ id ) ; if ( null === $ folder ) { throw new NotFoundHttpException ( 'Folder not found.' ) ; } return $ folder ; } | Returns the folder by id . |
228,341 | public function exec ( ARequest $ request ) { $ result = new AResponse ( ) ; $ orderId = $ request -> getSaleOrderId ( ) ; $ datePaid = $ request -> getSaleOrderDatePaid ( ) ; $ items = $ request -> getOrderItems ( ) ; $ orderTotal = 0 ; foreach ( $ items as $ item ) { $ prodId = $ item -> getProductId ( ) ; $ stockId ... | Save PV data on sale order save . |
228,342 | public static function createSmalldb ( $ config ) { $ smalldb = new \ Smalldb \ StateMachine \ JsonDirBackend ( $ config [ 'smalldb' ] , null , 'smalldb' ) ; $ flupdo = \ Smalldb \ Flupdo \ Flupdo :: createInstanceFromConfig ( $ config [ 'flupdo' ] ) ; if ( ! isset ( $ config [ 'auth' ] [ 'class' ] ) ) { throw new Inva... | Create and initialize Smalldb including Flupdo and Auth objects |
228,343 | public static function renderStateMachine ( \ Smalldb \ StateMachine \ AbstractBackend $ smalldb , $ machine , $ format ) { $ dot = $ smalldb -> getMachine ( $ machine ) -> exportDot ( ) ; if ( $ format == 'dot' ) { header ( 'Content-Type: text/plain; encoding=utf8' ) ; echo $ dot ; } else if ( $ format == 'png' || $ f... | Render state diagram |
228,344 | protected function getMysqlArguments ( $ credentials , $ appendDatabase = true ) { $ arguments = [ ] ; $ database = '' ; foreach ( $ this -> databaseArguments as $ key ) { if ( empty ( $ credentials [ $ key ] ) ) { continue ; } $ value = escapeshellarg ( $ credentials [ $ key ] ) ; if ( $ key === 'database' ) { $ datab... | Returns MySQL Arguments . |
228,345 | public static function split ( $ event ) { if ( ! is_string ( $ event ) ) { throw new InvalidArgumentException ( "invalid value provided for 'event'; expecting an event name " . "or event name and namespace as string" ) ; } list ( $ type , $ namespace ) = array_pad ( explode ( '.' , $ event , 2 ) , 2 , null ) ; return ... | Split an event in the type and namespace portions |
228,346 | public function withPredefinedColumnValues ( FieldBuilderBase $ field , array $ columnValues ) : TableRowFieldDefiner { $ this -> fieldBuilder -> attr ( TableType :: ATTR_PREDEFINED_COLUMNS , array_values ( $ columnValues ) ) ; return $ this -> withColumnKeyAs ( $ field ) ; } | Defines the columns as predefined set of values . |
228,347 | public function withColumnKeyAsField ( IField $ field ) : TableRowFieldDefiner { return new TableRowFieldDefiner ( $ this -> fieldBuilder , $ this -> cellClassName , $ field ) ; } | Defines the column field for the table . |
228,348 | public static function circularDiffKeys ( array $ left , array $ right ) { return [ array_diff_key ( $ left , $ right ) , array_intersect_key ( $ left , $ right ) , array_diff_key ( $ right , $ left ) ] ; } | Perform a circular diff between two arrays using keys . |
228,349 | public static function replaceStrict ( array $ source , array ... $ replace ) { $ replacements = [ ] ; foreach ( $ replace as $ items ) { $ replacements [ ] = array_intersect_key ( $ items , $ source ) ; } return array_merge ( $ source , ... $ replacements ) ; } | Replace items only if relative keys are actually defined in source array |
228,350 | public static function validateMeta ( array & $ array ) { foreach ( $ array as $ key => $ tag ) { if ( ! ( $ tag instanceof Meta ) ) { $ newtag = new Meta ( $ tag ) ; $ array [ $ key ] = $ newtag ; } } } | Validates that the given array contains all valid Meta entries |
228,351 | public static function truncateToMax ( $ obj , $ metaName , $ string , $ ellipsis = false ) { switch ( true ) { case $ obj instanceof Element : case $ obj instanceof Aspect : break ; case $ obj instanceof NodeRef : case $ obj instanceof Node : $ obj = $ obj -> Element ; break ; default : throw new Exception ( __CLASS__... | Returns a string truncated to fit inside a meta . |
228,352 | public final function populateObjectList ( $ input , $ deep = true ) { if ( $ this instanceof ArrayAccess == false ) throw new Exception ( "Cannot set properties on objects that are not children of 'ArrayAccess'" ) ; if ( ! is_array ( $ input ) ) { if ( $ input instanceof Traversable && method_exists ( $ input , "toArr... | Populate an object list from well anything really |
228,353 | public final function populateWithReference ( array & $ input ) { if ( $ this instanceof ObjectList == false ) throw new Exception ( "Cannot set list to reference on non-supported object types" ) ; $ this -> list = & $ input ; return $ this ; } | Populate this object with a reference |
228,354 | public function getQuery ( ) { $ query = 'SELECT ' . implode ( ', ' , $ this -> fields ) . ' FROM ' . implode ( ', ' , $ this -> from ) ; if ( count ( $ this -> conditions ) > 0 ) { $ query = $ query . ' WHERE ' . implode ( ' AND ' , $ this -> conditions ) ; } $ query = rtrim ( $ query ) . ';' ; return $ query ; } | Build query to generate a string |
228,355 | public static function explode ( $ array ) { $ results = [ ] ; foreach ( $ array as $ key => $ value ) { static :: set ( $ results , $ key , $ value ) ; } return $ results ; } | Explode a single level dots array into a multi - dimensional associative array . |
228,356 | public static function collate ( $ array , $ key , $ wildcard = null ) { if ( null === $ wildcard || strpos ( $ key , $ wildcard ) === false ) { return static :: has ( $ array , $ key ) ? [ $ key => static :: get ( $ array , $ key ) ] : [ ] ; } $ pattern = '' ; $ segments = explode ( '.' , $ key ) ; while ( ( $ segment... | Get all items from a multi - dimensional associative array using dots notation and return a flattened dots notation array . |
228,357 | public static function has ( $ array , $ keys , $ wildcard = null ) { if ( null === $ keys || empty ( $ array ) || ! Arr :: accessible ( $ array ) ) { return false ; } $ originalArray = $ array ; foreach ( ( array ) $ keys as $ key ) { $ array = $ originalArray ; if ( Arr :: exists ( $ array , $ key ) ) { continue ; } ... | Determine if an item or items exist in an multi - dimensional associative array using dots notation . |
228,358 | protected function parseUrl ( $ httpMethod , $ url ) { $ this -> server = $ _SERVER ; $ server = & $ this -> server ; if ( $ httpMethod ) { $ server [ 'REQUEST_METHOD' ] = $ httpMethod ; } elseif ( ! isset ( $ server [ 'REQUEST_METHOD' ] ) ) { $ server [ 'REQUEST_METHOD' ] = 'GET' ; } if ( empty ( $ url ) ) { $ this ->... | Parse a given URL |
228,359 | public function getAudios ( ) { $ qb = $ this -> entityManager -> createQueryBuilder ( ) ; $ qb -> select ( 'f' ) -> from ( '\Media\Entity\File' , 'f' ) -> innerJoin ( '\Media\Entity\ObjectFile' , 'obf' , Join :: WITH , 'f.id = obf.fileId' ) -> where ( 'f.type = :type' ) -> andWhere ( 'obf.entityName = :name' ) -> andW... | Returns an array of ids |
228,360 | public function router ( ) { return new Router \ Router ( $ this -> routeMap , new Router \ Resolver \ Container ( $ this -> container ) ) ; } | Routers are middleware and can be added to Tonis . |
228,361 | private function decorateRequest ( ServerRequestInterface $ request ) { if ( $ request instanceof Http \ Request ) { return $ request ; } return new Http \ Request ( $ this , $ request ) ; } | Decorates a request to add this app to it . |
228,362 | private function decorateResponse ( ResponseInterface $ response ) { if ( $ response instanceof Http \ Response ) { return $ response ; } return new Http \ Response ( $ this , $ response ) ; } | Decorates a response to add this app to it . |
228,363 | private function normalizeSpecification ( array $ input ) { $ output = [ ] ; $ mayBeChildless = null ; foreach ( $ input as $ key => $ spec ) { if ( $ key === 'attributes' ) { if ( ! is_array ( $ spec ) ) { throw new LogicException ( 'Value under key ' . $ key . ' have to be an array' ) ; } $ output [ $ key ] = [ ] ; f... | Convert simplified specification to full form used in validation . |
228,364 | public function getXML ( $ version = '1.0' , $ encoding = 'UTF-8' , $ willFormatOutput = true ) { if ( is_null ( self :: $ instance ) ) { self :: $ instance = new \ DOMDocument ( $ version , $ encoding ) ; self :: $ instance -> formatOutput = $ willFormatOutput ; } return self :: $ instance ; } | Creates the instance of DOMDocument all classes will be working with . |
228,365 | protected function addChild ( $ attribute , $ value = null , $ escape = false ) { if ( ! empty ( $ value ) ) { if ( $ escape === true ) { $ node = $ this -> XML -> createElement ( $ attribute ) ; $ node -> appendChild ( new \ DOMCdataSection ( $ value ) ) ; } else { $ node = $ this -> XML -> createElement ( $ attribute... | Adds a child node to the main node that each inherited class creates when it instantiates itself . |
228,366 | public function addStylesheet ( $ url ) { $ this -> XML -> appendChild ( $ this -> XML -> createProcessingInstruction ( 'xml-stylesheet' , sprintf ( 'type="text/xsl" href="%s"' , $ url ) ) ) ; } | Adds the XSL stylesheet to our document |
228,367 | protected function addExtraNamespaces ( $ nodeset ) { $ this -> addNamespace ( 'hasImages' , $ nodeset , 'xmlns:image' , "http://www.google.com/schemas/sitemap-image/1.1" ) ; $ this -> addNamespace ( 'hasVideos' , $ nodeset , 'xmlns:video' , "http://www.google.com/schemas/sitemap-video/1.1" ) ; $ this -> addNamespace (... | If we add nodes with special namespaces we setup a boolean in our iterator classes that switch to true so we can add the appropriate namespaces to our document . |
228,368 | protected function registerMiddleware ( $ middleware ) { $ kernel = $ this -> getContainer ( ) -> get ( KernelInterface :: class ) ; $ kernel -> prependMiddleware ( $ middleware ) ; } | Register the Debugbar Middleware |
228,369 | protected function getPlugin ( $ plugin ) { try { list ( $ vendor , $ package ) = explode ( '/' , $ plugin ) ; return $ this -> get ( 'anime_db.api.client' ) -> getPlugin ( $ vendor , $ package ) ; } catch ( \ RuntimeException $ e ) { return ; } } | Get plugin . |
228,370 | public function executeAction ( ) { if ( strpos ( php_uname ( 'v' ) , 'Windows XP' ) !== false ) { $ this -> redirect ( $ this -> generateUrl ( 'update' ) ) ; } file_put_contents ( $ this -> container -> getParameter ( 'kernel.root_dir' ) . '/../web/update.log' , '' ) ; $ this -> get ( 'anime_db.command' ) -> send ( 'p... | Execute update application . |
228,371 | public static function old ( $ value , $ fallback = '' ) { return Variable :: has ( 'form.old' ) ? ( isset ( Variable :: get ( 'form.old' ) [ $ value ] ) ? Variable :: get ( 'form.old' ) [ $ value ] : $ fallback ) : $ fallback ; } | Get old value or fallback |
228,372 | public static function is_base64 ( string $ string ) : bool { if ( base64_encode ( base64_decode ( $ string , true ) ) === $ string ) return true ; return false ; } | Check if string is base64 or not |
228,373 | public function getProvider ( $ name , $ request ) { $ class = isset ( $ this -> providers [ $ name ] ) ? $ this -> providers [ $ name ] : null ; if ( ! $ class ) { return null ; } return new $ class ( $ request , $ request -> input ( 'client_id' ) , $ request -> input ( 'client_secret' ) , $ request -> input ( 'redire... | Get provider . |
228,374 | public function signIn ( Request $ request ) { $ oauth_client = DB :: table ( 'oauth_clients' ) -> where ( 'password_client' , 1 ) -> first ( ) ; if ( ! $ oauth_client ) { return $ this -> response ( [ 'code' => 'CLIENT_NOT_FOUND' , ] , Response :: HTTP_BAD_REQUEST ) ; } $ request -> request -> add ( [ 'username' => $ ... | Sign in a user . |
228,375 | public function signInWithProvider ( $ provider_name , Request $ request ) { $ provider = $ this -> getProvider ( $ provider_name , $ request ) ; if ( ! $ provider ) { return $ this -> response ( [ 'errors' => [ 'code' => 'PROVIDER_NOT_FOUND' , 'message' => 'No provider found' , ] ] , Response :: HTTP_BAD_REQUEST ) ; }... | Request token and generate a new one . |
228,376 | public function authenticateByCode ( $ provider , string $ code ) { $ provider_user = $ provider -> user ( ) ; $ repository = $ this -> manager -> getRepository ( ) ; $ user = $ repository -> findOneByEmail ( $ provider_user -> getEmail ( ) ) ; if ( ! $ user ) { $ result = $ this -> manager -> create ( [ 'name' => $ pr... | Authenticate a user by the code of oauth2 . |
228,377 | private function constructIdentityToken ( ) { if ( isset ( $ _REQUEST [ self :: CODE ] ) ) { $ this -> requestToken ( $ _REQUEST [ self :: CODE ] , self :: IDENTITY_TOKEN ) ; $ _SESSION [ self :: SESSION ] [ self :: IS_API_TOKEN ] = false ; $ _SESSION [ self :: SESSION ] [ self :: STATE ] = self :: NEGOTIATION_COMPLETE... | Construct an OAuthNegotiator to use an access code to request an identity token |
228,378 | private function constructAPIToken ( ) { if ( isset ( $ _REQUEST [ self :: CODE ] ) ) { $ this -> requestToken ( $ _REQUEST [ self :: CODE ] , self :: API_TOKEN ) ; $ _SESSION [ self :: SESSION ] [ self :: IS_API_TOKEN ] = true ; $ _SESSION [ self :: SESSION ] [ self :: STATE ] = self :: NEGOTIATION_COMPLETE ; header (... | Construct an OAuthNegotiator to use an access code to request an API Token with matching user profile |
228,379 | private function constructNegotiationReporter ( ) { switch ( $ _SESSION [ self :: SESSION ] [ self :: STATE ] ) { case self :: NEGOTIATION_COMPLETE : case self :: NEGOTIATION_FAILED : { $ this -> ready = true ; $ this -> apiUrl = ( isset ( $ _SESSION [ self :: SESSION ] [ self :: API_URL ] ) ? $ _SESSION [ self :: SESS... | Prepare to report on the results of the OAuth negotiation |
228,380 | private function requestAuthorizationCode ( $ responseType , $ scopes , $ purpose ) { $ _SESSION [ self :: SESSION ] [ self :: STATE ] = self :: $ SCOPES [ $ scopes ] [ self :: CODE_REQUESTED ] ; if ( $ scopes === self :: IDENTITY_TOKEN ) { header ( "Location: {$_SESSION[self::SESSION][self::OAUTH_ENDPOINT]}/auth?" . h... | Request an authorization code from the OAuth server |
228,381 | private function requestToken ( $ code , $ tokenType ) { $ authApi = new PestJSON ( "{$_SESSION[self::SESSION][self::OAUTH_ENDPOINT]}" ) ; try { $ response = $ authApi -> post ( 'token' , array ( self :: CLIENT_ID => $ _SESSION [ self :: SESSION ] [ self :: CLIENT_ID ] , self :: REDIRECT_URI => $ _SESSION [ self :: SES... | Request a token from the OAuth server |
228,382 | public function addRoute ( $ route , $ callable , $ prepend = true ) { if ( $ prepend ) { $ this -> routes = array ( $ route => $ callable ) + $ this -> routes ; } else { $ this -> routes [ $ route ] = $ callable ; } $ this -> logger -> log ( 'Route added at ' . ( $ prepend ? 'top' : 'bottom' ) . ': "' . $ route . '"' ... | Add a route to the Router s routing table |
228,383 | public function route ( $ performLoading = true ) : bool { $ uri = implode ( '/' , $ this -> uri -> segments ) ; $ event = Events :: fireEvent ( 'routerRouteEvent' , $ this -> routes , $ performLoading , $ uri ) ; if ( $ event -> isCancelled ( ) ) { return false ; } $ routes = $ event -> routes ; $ performLoading = $ e... | Extracts the routing path from the URL using the routing table . |
228,384 | protected function routeDefault ( $ segments = array ( ) , $ route ) { if ( empty ( $ segments ) ) { $ segments [ 0 ] = $ this -> config -> routing -> default_controller ; } if ( $ this -> config -> routing -> translate_uri_dashes === true ) { $ segments [ 0 ] = str_replace ( '-' , '_' , $ segments [ 0 ] ) ; if ( isset... | Converts a routing string into parameters for the defaultCallable . |
228,385 | public function loadCallable ( $ matches = array ( ) , $ route ) : bool { $ this -> logger -> newLevel ( 'Loading callable' ) ; $ event = Events :: fireEvent ( 'routerLoadCallableEvent' , $ this -> callable , $ matches , $ route ) ; if ( $ event -> isCancelled ( ) ) { return false ; } $ args = $ event -> matches ; $ ar... | Load the callable to which the route matched . |
228,386 | public function defaultCallable ( $ arguments = array ( ) ) : bool { $ this -> logger -> log ( 'Default callable called!' ) ; $ controller = $ arguments [ 'controller' ] ; $ function = $ arguments [ 'function' ] ; $ parameters = empty ( $ arguments [ 'parameters' ] ) ? null : $ arguments [ 'parameters' ] ; $ class = '\... | The default callable . |
228,387 | public function withMiddleware ( MiddlewareInterface $ middleware ) { if ( ! ( $ middleware instanceof ServerMiddlewareInterface ) ) { throw new \ InvalidArgumentException ( 'ServerMiddlewareInterface request expected.' ) ; } foreach ( $ this -> middlewares as $ m ) { if ( $ m === $ middleware ) { return $ this ; } } $... | Return an instance with the specified middleware added to the stack . This method MUST be implemented in such a way as to retain the immutability of the stack and MUST return an instance that contains the specified middleware . |
228,388 | public function withoutMiddleware ( MiddlewareInterface $ middleware ) { if ( ! ( $ middleware instanceof ServerMiddlewareInterface ) ) { throw new \ InvalidArgumentException ( 'ServerMiddlewareInterface request expected.' ) ; } foreach ( $ this -> middlewares as $ k => $ m ) { if ( $ m === $ middleware ) { unset ( $ t... | Return an instance without the specified middleware . This method MUST be implemented in such a way as to retain the immutability of the stack and MUST return an instance that does not contain the specified middleware . |
228,389 | public function process ( RequestInterface $ request ) { if ( $ this -> processingStack !== null ) { throw new \ RuntimeException ( 'Middleware stack is already processing.' ) ; } if ( ! count ( $ this -> middlewares ) ) { throw new \ RuntimeException ( 'Middleware stack is empty.' ) ; } if ( ! ( $ request instanceof S... | Process the request through middleware and return the response . This method MUST be implemented in such a way as to allow the same stack to be reused for processing multiple requests in sequence . |
228,390 | public static function registerDefaultServices ( ContainerInterface $ container ) { if ( ! $ container -> has ( 'argv' ) ) { $ container [ 'argv' ] = $ _SERVER [ 'argv' ] ; } if ( ! $ container -> has ( 'Debug' ) ) { $ container [ 'Debug' ] = function ( ContainerInterface $ c ) { return new DebugMiddleware ( $ c ) ; } ... | This function registers the default services that Clim needs to work . |
228,391 | public function setState ( $ state ) { $ this -> complement [ 'state' ] = $ state ; $ this -> states [ 'state' ] = $ state ; $ this -> setStates ( ) ; return $ state ; } | Set complement state . |
228,392 | public function changeState ( ) { $ this -> getStates ( ) ; $ actualState = $ this -> getState ( ) ; $ newState = self :: $ statesHandler [ $ actualState ] [ 'state' ] ; $ action = self :: $ statesHandler [ $ actualState ] [ 'action' ] ; $ this -> setState ( $ newState ) ; $ this -> doAction ( $ action ) ; return $ new... | Change complement state . |
228,393 | public function getState ( ) { if ( isset ( $ this -> states [ 'state' ] ) ) { return $ this -> states [ 'state' ] ; } elseif ( isset ( $ this -> complement [ 'state' ] ) ) { return $ this -> complement [ 'state' ] ; } $ type = self :: getType ( ) ; return self :: $ defaultStates [ $ type ] ; } | Get complement state . |
228,394 | public function getStates ( ) { $ appID = App :: getCurrentID ( ) ; $ complementID = self :: getCurrentID ( ) ; $ states = $ this -> getStatesFromFile ( ) ; if ( isset ( $ states [ $ appID ] [ $ complementID ] ) ) { return $ this -> states = $ states [ $ appID ] [ $ complementID ] ; } return $ this -> states = [ ] ; } | Get complements states . |
228,395 | private function setStates ( ) { $ appID = App :: getCurrentID ( ) ; $ complementID = self :: getCurrentID ( ) ; if ( ! is_null ( $ this -> states ) ) { $ states = $ this -> getStatesFromFile ( ) ; if ( $ this -> stateChanged ( $ states ) ) { $ file = $ this -> getStatesFilePath ( ) ; $ states [ $ appID ] [ $ complemen... | Set complements states . |
228,396 | private function stateChanged ( $ states ) { $ appID = App :: getCurrentID ( ) ; $ complementID = self :: getCurrentID ( ) ; if ( isset ( $ states [ $ appID ] [ $ complementID ] ) ) { $ actualStates = $ states [ $ appID ] [ $ complementID ] ; if ( ! count ( array_diff_assoc ( $ actualStates , $ this -> states ) ) ) { r... | Check if complement state has changed . |
228,397 | private function getStatesFilePath ( ) { $ type = self :: getType ( ) ; $ complementType = self :: getType ( 'strtoupper' ) ; return App :: $ complementType ( ) . '.' . $ type . '-states.json' ; } | Get complements file path . |
228,398 | public function rollback ( $ transaction ) { $ status = $ this -> getStatus ( $ transaction ) ; if ( count ( $ status ) !== 1 ) { throw new \ LogicException ( "You can't rollback more than 1 transaction" ) ; } list ( $ transaction , $ transactionStatus ) = each ( $ status ) ; foreach ( $ transactionStatus as $ key => $... | Rollback a named transaction |
228,399 | public function isSuccess ( $ transaction = RecordManager :: TRANSACTIONS_ALL ) { $ output = true ; foreach ( $ this -> getStatus ( $ transaction ) as $ transaction => $ transactionStatus ) { foreach ( $ transactionStatus as $ status ) { $ output = ( $ output && $ status === self :: SUCCESS ) ; } } return $ output ; } | Has a named transaction been executed successfully |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.