idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
33,600 | public function getOrder ( $ objectOrKey ) { $ key = $ objectOrKey instanceof GObject ? $ objectOrKey -> getKey ( ) : $ objectOrKey ; return array_search ( $ key , $ this -> order ) ; } | Returns the position of the object in the collection |
33,601 | protected function getPreviewLink ( $ scheme , $ alias , $ encryptedId , $ aliasId ) { $ previewLink = array ( 'name' => $ alias -> getDomain ( ) , 'link' => '' ) ; if ( is_null ( $ scheme ) || SchemeableInterface :: SCHEME_DEFAULT == $ scheme ) { $ scheme = $ alias -> getScheme ( ) ; } $ domain = $ scheme . '://' . $ alias -> getDomain ( ) ; $ routeName = 'open_orchestra_base_node_preview' ; $ parameters = array ( 'token' => $ encryptedId , 'aliasId' => $ aliasId ) ; $ previewLink [ 'link' ] = $ domain . $ this -> generateRoute ( $ routeName , $ parameters , UrlGeneratorInterface :: ABSOLUTE_PATH ) ; return $ this -> getContext ( ) -> transform ( 'link' , $ previewLink ) ; } | Get a preview link |
33,602 | protected function generateStatusesPropertiesMap ( array $ statusCollection ) { $ statusMap = array ( ) ; foreach ( $ statusCollection as $ index => $ status ) { if ( $ status -> isInitialState ( ) ) { $ statusMap [ $ index ] [ 'initialState' ] = '1' ; } if ( $ status -> isTranslationState ( ) ) { $ statusMap [ $ index ] [ 'translationState' ] = '1' ; } if ( $ status -> isPublishedState ( ) ) { $ statusMap [ $ index ] [ 'publishedState' ] = '1' ; } if ( $ status -> isAutoPublishFromState ( ) ) { $ statusMap [ $ index ] [ 'autoPublishFromState' ] = '1' ; } if ( $ status -> isAutoUnpublishToState ( ) ) { $ statusMap [ $ index ] [ 'autoUnpublishToState' ] = '1' ; } } return $ statusMap ; } | Generate a properties map of available properties by status |
33,603 | public function parseId ( $ nId ) { if ( ! is_numeric ( $ nId ) || $ nId <= 0 ) { return null ; } $ nId = intval ( $ nId ) ; $ nCenter = ( ( $ nId & 0x00000000003E0000 ) >> 17 ) ; $ nNode = ( ( $ nId & 0x000000000001F000 ) >> 12 ) ; $ nTime = ( ( $ nId & 0x7FFFFFFFFFC00000 ) >> 22 ) ; $ nRand = ( ( $ nId & 0x0000000000000FFF ) >> 0 ) ; return [ 'center' => $ nCenter , 'node' => $ nNode , 'time' => $ nTime , 'rand' => $ nRand , ] ; } | Parse an unique id |
33,604 | public function isValidId ( $ nVal ) { $ bRet = false ; $ arrD = $ this -> parseId ( $ nVal ) ; if ( is_array ( $ arrD ) && array_key_exists ( 'center' , $ arrD ) && array_key_exists ( 'node' , $ arrD ) && array_key_exists ( 'time' , $ arrD ) && array_key_exists ( 'rand' , $ arrD ) ) { if ( $ this -> isValidCenterId ( $ arrD [ 'center' ] ) && $ this -> isValidNodeId ( $ arrD [ 'node' ] ) && $ this -> isValidTime ( $ arrD [ 'time' ] ) && $ this -> isValidRand ( $ arrD [ 'rand' ] ) ) { $ bRet = true ; } } return $ bRet ; } | Verify whether the id is valid |
33,605 | protected function determineMediaType ( ) { return is_null ( $ this -> getTypeKey ( ) ) ? $ this -> getModelDeterminer ( ) -> getMediaType ( $ this -> getAttribute ( $ this -> getMimeKeyName ( ) ) ) : $ this -> getTypeKey ( ) ; } | Determines the media type |
33,606 | protected function determineModelName ( array $ attributes ) { $ keyName = $ this -> getTypeKeyName ( ) ; return isset ( $ attributes [ $ keyName ] ) ? $ this -> getModelDeterminer ( ) -> getMediaModelName ( $ attributes [ $ keyName ] ) : $ this -> getModelDeterminer ( ) -> getDefaultMediaModelName ( ) ; } | Determines the model name by type |
33,607 | public function configure ( \ OtherCode \ Rest \ Core \ Configuration $ configuration = null ) { if ( isset ( $ configuration ) ) { $ this -> configuration = $ configuration ; } else { $ this -> configuration = new \ OtherCode \ Rest \ Core \ Configuration ( ) ; } $ this -> request -> setHeaders ( $ this -> configuration -> httpheader ) ; return $ this ; } | Configure main options |
33,608 | protected function setError ( $ code , $ message ) { $ this -> error = new \ OtherCode \ Rest \ Core \ Error ( $ code , $ message ) ; } | Set the error code and message if exists |
33,609 | private function dispatchModules ( $ hook ) { foreach ( $ this -> modules [ $ hook ] as $ module ) { if ( method_exists ( $ module , 'run' ) ) { $ module -> run ( ) ; } } } | Run all the registered modules |
33,610 | protected function registerModule ( $ moduleName , \ OtherCode \ Rest \ Modules \ BaseModule $ moduleInstance , $ hook ) { if ( ! in_array ( $ hook , array_keys ( $ this -> modules ) ) ) { return false ; } if ( ! array_key_exists ( $ moduleName , $ this -> modules [ $ hook ] ) ) { $ this -> modules [ $ hook ] [ $ moduleName ] = $ moduleInstance ; return true ; } return false ; } | Register a new module instance |
33,611 | public function getModules ( $ hook = null ) { if ( isset ( $ hook ) && in_array ( $ hook , array_keys ( $ this -> modules ) ) ) { return $ this -> modules [ $ hook ] ; } return $ this -> modules ; } | Return the list of registered modules . |
33,612 | public static function resolve ( callable $ provider , $ type , $ service , $ version ) { $ result = $ provider ( $ type , $ service , $ version ) ; if ( is_array ( $ result ) ) { return $ result ; } if ( ! isset ( self :: $ typeMap [ $ type ] ) ) { $ msg = "The type must be one of: " . implode ( ', ' , self :: $ typeMap ) ; } elseif ( $ service ) { $ msg = "The {$service} service does not have version: {$version}." ; } else { $ msg = "You must specify a service name to retrieve its API data." ; } throw new UnresolvedApiException ( $ msg ) ; } | Resolves an API provider and ensures a non - null return value . |
33,613 | public static function validation ( Service $ api ) { $ validator = new Validator ( ) ; return function ( callable $ handler ) use ( $ api , $ validator ) { return function ( CommandInterface $ command , RequestInterface $ request = null ) use ( $ api , $ validator , $ handler ) { $ operation = $ api -> getOperation ( $ command -> getName ( ) ) ; $ validator -> validate ( $ command -> getName ( ) , $ operation -> getInput ( ) , $ command -> toArray ( ) ) ; return $ handler ( $ command , $ request ) ; } ; } ; } | Adds a middleware that uses client - side validation . |
33,614 | protected function checkFiles ( InputInterface $ input , array $ files ) : int { $ filesPerLine = TypeCast :: castInt ( $ input -> getOption ( 'files-per-line' ) ) ; $ totalFiles = count ( $ files ) ; $ chunkFiles = array_chunk ( $ files , $ filesPerLine ) ; $ this -> processFiles ( $ chunkFiles , $ filesPerLine , $ totalFiles ) ; return $ totalFiles ; } | Check files . |
33,615 | protected function processFiles ( array $ files , int $ filesPerLine , int $ totalFiles ) : int { $ fileCountLength = strlen ( ( string ) $ totalFiles ) ; $ processed = 0 ; while ( ! empty ( $ files ) ) { $ chunk = array_shift ( $ files ) ; $ chunkFiles = count ( $ chunk ) ; $ processed += $ this -> processJunks ( $ chunk ) ; if ( $ this -> format !== 'json' ) { $ this -> output -> write ( str_pad ( '' , $ filesPerLine - $ chunkFiles ) ) ; $ this -> output -> writeln ( ' ' . str_pad ( ( string ) $ processed , $ fileCountLength , ' ' , STR_PAD_LEFT ) . '/' . $ totalFiles . ' (' . floor ( ( 100 / $ totalFiles ) * $ processed ) . '%)' ) ; } } return $ totalFiles ; } | Process files . |
33,616 | protected function processJunks ( array $ chunk ) : int { $ processed = 0 ; while ( ! empty ( $ chunk ) ) { $ processed ++ ; $ file = array_shift ( $ chunk ) ; list ( $ errors , $ warnings ) = $ this -> processFile ( $ file ) ; if ( $ this -> format !== 'json' ) { $ this -> printLegend ( $ errors , $ warnings ) ; } } return $ processed ; } | Process chunk files . |
33,617 | protected function processOptions ( InputInterface $ input , OutputInterface $ output ) : void { $ exclude = TypeCast :: castString ( $ input -> getOption ( 'exclude' ) ) ; $ format = $ input -> getOption ( 'format' ) ; $ this -> format = is_string ( $ format ) ? $ format : null ; $ basePath = $ input -> getOption ( 'directory' ) ; $ this -> basePath = is_string ( $ basePath ) ? $ basePath : './' ; if ( substr ( $ this -> basePath , - 1 ) !== '/' ) { $ this -> basePath .= '/' ; } $ this -> verbose = $ output -> isVerbose ( ) ; $ this -> output = $ output ; $ this -> skipClasses = ( bool ) $ input -> getOption ( 'skip-classes' ) ; $ this -> skipMethods = ( bool ) $ input -> getOption ( 'skip-methods' ) ; $ this -> skipSignatures = ( bool ) $ input -> getOption ( 'skip-signatures' ) ; if ( ! empty ( $ exclude ) ) { $ this -> exclude = array_map ( 'trim' , explode ( ',' , $ exclude ) ) ; } } | Process options . |
33,618 | protected function printApplicationTitle ( OutputInterface $ output ) : void { $ output -> writeln ( '' ) ; $ output -> writeln ( 'DocBlock Checker' ) ; $ output -> writeln ( '' ) ; } | Print application name . |
33,619 | protected function printLegend ( bool $ errors , bool $ warnings ) : void { if ( $ errors ) { $ this -> output -> write ( '<fg=red>F</>' ) ; } elseif ( $ warnings ) { $ this -> output -> write ( '<fg=yellow>W</>' ) ; } else { $ this -> output -> write ( '<info>.</info>' ) ; } } | Print legend . |
33,620 | protected function printLogResult ( InputInterface $ input , float $ startTime , int $ totalFiles ) : void { $ time = round ( microtime ( true ) - $ startTime , 2 ) ; $ this -> output -> writeln ( '' ) ; $ this -> output -> writeln ( '' ) ; $ this -> output -> writeln ( 'Checked ' . number_format ( $ totalFiles ) . ' files in ' . $ time . ' seconds.' ) ; $ this -> output -> write ( '<info>' . number_format ( $ this -> passed ) . ' Passed</info>' ) ; $ this -> output -> write ( ' / <fg=red>' . number_format ( count ( $ this -> errors ) ) . ' Errors</>' ) ; $ this -> output -> write ( ' / <fg=yellow>' . number_format ( count ( $ this -> warnings ) ) . ' Warnings</>' ) ; $ this -> output -> writeln ( '' ) ; if ( ! empty ( $ this -> errors ) && ! $ input -> getOption ( 'info-only' ) ) { $ this -> printErrors ( ) ; } if ( ! empty ( $ this -> warnings ) && ! $ input -> getOption ( 'info-only' ) ) { $ this -> printWarnings ( ) ; } $ this -> output -> writeln ( '' ) ; } | Print verbose result . |
33,621 | protected function printErrors ( ) : void { $ this -> output -> writeln ( '' ) ; $ this -> output -> writeln ( '' ) ; foreach ( $ this -> errors as $ error ) { $ this -> output -> write ( '<fg=red>ERROR </> ' . $ error [ 'file' ] . ':' . $ error [ 'line' ] . ' - ' ) ; if ( $ error [ 'type' ] == 'class' ) { $ this -> output -> write ( 'Class <info>' . $ error [ 'class' ] . '</info> is missing a docblock.' ) ; } if ( $ error [ 'type' ] == 'method' ) { $ this -> output -> write ( 'Method <info>' . $ error [ 'method' ] . '</info> is missing a docblock.' ) ; } $ this -> output -> writeln ( '' ) ; } } | Print errors . |
33,622 | protected function printWarnings ( ) : void { foreach ( $ this -> warnings as $ error ) { $ this -> output -> write ( '<fg=yellow>WARNING </> ' ) ; if ( $ error [ 'type' ] == 'param-missing' ) { $ this -> output -> write ( '<info>' . $ error [ 'method' ] . '</info> - @param <fg=cyan>' . $ error [ 'param' ] . '</> missing.' ) ; } if ( $ error [ 'type' ] == 'param-mismatch' ) { $ paramType = implode ( '|' , ( array ) $ error [ 'param-type' ] ) ; $ this -> output -> write ( '<info>' . $ error [ 'method' ] . '</info> - @param <fg=cyan>' . $ error [ 'param' ] . '</> (' . $ error [ 'doc-type' ] . ') does not match method signature (' . $ paramType . ').' ) ; } if ( $ error [ 'type' ] == 'return-missing' ) { $ this -> output -> write ( '<info>' . $ error [ 'method' ] . '</info> - @return missing.' ) ; } if ( $ error [ 'type' ] == 'return-mismatch' ) { $ this -> output -> write ( '<info>' . $ error [ 'method' ] . '</info> - @return <fg=cyan>' . $ error [ 'doc-type' ] . '</> does not match method signature (' . $ error [ 'return-type' ] . ').' ) ; } $ this -> output -> writeln ( '' ) ; } } | Print warnings . |
33,623 | protected function processFile ( SplFileInfo $ file ) : array { $ realPath = $ file -> getRealPath ( ) ; if ( $ this -> output -> isDebug ( ) ) { $ this -> output -> writeln ( 'Process file: ' . $ realPath ) ; } if ( $ realPath === false ) { throw new RuntimeException ( sprintf ( 'File not found: %s' , $ file ) ) ; } $ processor = new FileProcessor ( $ realPath ) ; $ check = new FileCheck ( ) ; if ( ! $ this -> skipClasses ) { $ check -> processFileClasses ( $ processor -> getClasses ( ) , $ realPath ) ; } if ( ! $ this -> skipMethods ) { $ check -> processFileMethods ( $ processor -> getMethods ( ) , $ realPath ) ; } if ( ! $ this -> skipSignatures ) { $ check -> processFileSignatues ( $ processor -> getMethods ( ) , $ realPath ) ; } foreach ( $ check -> getErrors ( ) as $ errorItem ) { if ( $ this -> output -> isDebug ( ) ) { $ this -> output -> writeln ( 'Error in line: ' . var_export ( $ errorItem , true ) ) ; } $ this -> errors [ ] = $ errorItem ; } foreach ( $ check -> getWarnings ( ) as $ warningEntry ) { if ( $ this -> output -> isDebug ( ) ) { $ this -> output -> writeln ( 'Warning in line: ' . var_export ( $ warningEntry , true ) ) ; } $ this -> warnings [ ] = $ warningEntry ; } $ hasErrors = ! empty ( $ errorItem ) ; $ hasWarnings = ! empty ( $ warningEntry ) ; if ( ! $ hasErrors ) { $ this -> passed ++ ; } return [ $ hasErrors , $ hasWarnings ] ; } | Check a specific PHP file for errors . |
33,624 | public static function getInstance ( ) { $ sClass = get_called_class ( ) ; if ( ! isset ( self :: $ _aInstances [ $ sClass ] ) ) { self :: $ _aInstances [ $ sClass ] = new $ sClass ( ) ; } return self :: $ _aInstances [ $ sClass ] ; } | Get a Textmaster instance already instanciated |
33,625 | protected function parseAttr ( $ text ) { $ atts = [ ] ; $ pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/' ; $ text = preg_replace ( "/[\x{00a0}\x{200b}]+/u" , " " , $ text ) ; if ( preg_match_all ( $ pattern , $ text , $ match , PREG_SET_ORDER ) ) { foreach ( $ match as $ m ) { if ( ! empty ( $ m [ 1 ] ) ) $ atts [ strtolower ( $ m [ 1 ] ) ] = stripcslashes ( $ m [ 2 ] ) ; elseif ( ! empty ( $ m [ 3 ] ) ) $ atts [ strtolower ( $ m [ 3 ] ) ] = stripcslashes ( $ m [ 4 ] ) ; elseif ( ! empty ( $ m [ 5 ] ) ) $ atts [ strtolower ( $ m [ 5 ] ) ] = stripcslashes ( $ m [ 6 ] ) ; elseif ( isset ( $ m [ 7 ] ) and strlen ( $ m [ 7 ] ) ) $ atts [ ] = stripcslashes ( $ m [ 7 ] ) ; elseif ( isset ( $ m [ 8 ] ) ) $ atts [ ] = stripcslashes ( $ m [ 8 ] ) ; } } else { $ atts = ltrim ( $ text ) ; } return $ atts ; } | Parse string to attributes array . |
33,626 | public function extract ( $ content ) { $ pattern = $ this -> getRegex ( ) ; preg_match_all ( "/$pattern/s" , $ content , $ matches ) ; $ objects = [ ] ; foreach ( $ matches as $ key => $ match ) { $ name = null ; if ( $ key == 0 ) { $ name = 'original' ; } elseif ( $ key == 2 ) { $ name = 'name' ; } elseif ( $ key == 3 ) { $ name = 'attributes' ; } elseif ( $ key == 5 ) { $ name = 'content' ; } if ( ! is_null ( $ name ) ) { foreach ( $ match as $ k => $ v ) { if ( ! isset ( $ objects [ $ k ] ) ) { $ objects [ $ k ] = [ ] ; } if ( $ name == 'attributes' ) { $ attributes = $ this -> parseAttr ( $ v ) ; if ( ! is_array ( $ attributes ) ) { $ attributes = [ ] ; } $ objects [ $ k ] [ $ name ] = $ attributes ; } elseif ( $ name == 'content' ) { if ( $ this -> hasShortcode ( $ v ) ) { $ objects [ $ k ] [ $ name ] = $ this -> extract ( $ v ) ; } else { $ objects [ $ k ] [ $ name ] = $ v ; } } else { $ objects [ $ k ] [ $ name ] = $ v ; } } } } return $ objects ; } | Return an array of shortcodes associative array |
33,627 | public function compile ( $ content ) { if ( ! $ this -> count ( ) ) return $ content ; $ pattern = $ this -> getRegex ( ) ; return preg_replace_callback ( "/{$pattern}/s" , [ & $ this , 'render' ] , $ content ) ; } | Compile the gived content . |
33,628 | protected function getCallback ( $ name ) { $ callback = $ this -> shortcodes [ $ name ] ; if ( is_string ( $ callback ) ) { if ( \ Str :: contains ( $ callback , '@' ) ) { $ parsedCallback = \ Str :: parseCallback ( $ callback , 'register' ) ; $ instance = $ this -> container -> make ( $ parsedCallback [ 0 ] ) ; return [ $ instance , $ parsedCallback [ 1 ] ] ; } elseif ( class_exists ( $ callback ) ) { $ instance = $ this -> container -> make ( $ callback ) ; return [ $ instance , 'register' ] ; } else { return $ callback ; } } return $ callback ; } | Get callback from given shortcode name . |
33,629 | public function getMessageCount ( ) { if ( $ this -> getResultCode ( ) === self :: RC_SUCCESS_NO_MESSAGES ) { return 0 ; } $ node = $ this -> getFirst ( '//epp:epp/epp:response/epp:msgQ' ) ; if ( $ node === null ) { return null ; } return ( int ) $ node -> getAttribute ( 'count' ) ; } | Number of messages that exist in the queue . |
33,630 | public function getEnqueuedDate ( $ format = null ) { $ node = $ this -> getFirst ( '//epp:epp/epp:response/epp:msgQ/epp:qDate' ) ; if ( $ node === null ) { return null ; } if ( $ format === null ) { return $ node -> nodeValue ; } return date_create_from_format ( $ format , $ node -> nodeValue ) ; } | Date and time that the message was enqueued . |
33,631 | public function getOrganization ( ) { $ node = $ this -> response -> getFirst ( 'contact:org' , $ this -> node ) ; if ( $ node === null ) { return null ; } return $ node -> nodeValue ; } | The name of the organization . |
33,632 | public function getStreet ( ) { $ nodes = $ this -> response -> get ( 'contact:addr/contact:street' , $ this -> node ) ; if ( $ nodes -> length === 0 ) { return null ; } foreach ( $ nodes as $ node ) { yield $ node -> nodeValue ; } } | The contact s street address . |
33,633 | public function getState ( ) { $ node = $ this -> response -> getFirst ( 'contact:addr/contact:sp' , $ this -> node ) ; if ( $ node === null ) { return null ; } return $ node -> nodeValue ; } | The contact s state or province . |
33,634 | public function getPostalCode ( ) { $ node = $ this -> response -> getFirst ( 'contact:addr/contact:pc' , $ this -> node ) ; if ( $ node === null ) { return null ; } return $ node -> nodeValue ; } | The contact s postal code . |
33,635 | public function getProxyTarget ( $ class ) { if ( ! isset ( $ this -> registry [ $ class ] ) ) { throw new \ RuntimeException ( $ class . ' not registered as a static proxy.' ) ; } if ( $ id = $ this -> registry [ $ class ] [ 'id' ] ) { return call_user_func_array ( $ this -> registry [ $ class ] [ 'target' ] , array ( $ id ) ) ; } else { if ( $ closure = $ this -> registry [ $ class ] [ 'closure' ] ) { $ this -> registry [ $ class ] [ 'target' ] = $ closure ( ) ; $ this -> registry [ $ class ] [ 'closure' ] = null ; } return $ this -> registry [ $ class ] [ 'target' ] ; } } | Returns the target instance of the static proxy . |
33,636 | protected function addProxy ( $ proxy , $ id , $ target ) { $ callee = $ target instanceof \ Closure ? null : $ target ; $ closure = $ callee ? null : $ target ; $ this -> registry [ $ proxy ] = array ( 'id' => $ id , 'target' => $ callee , 'closure' => $ closure ) ; } | Adds a proxy to the registry array |
33,637 | public function registerPrefixes ( array $ classes ) { foreach ( $ classes as $ prefix => $ locations ) { $ this -> prefixes [ $ prefix ] = ( array ) $ locations ; } } | Registers an array of classes using the PEAR naming convention . |
33,638 | public static function start ( $ name , $ key = null ) { if ( $ key ) { $ GLOBALS [ ARX_HOOK ] [ $ name ] [ $ key ] = '' ; } else { $ GLOBALS [ ARX_HOOK ] [ $ name ] = '' ; } ob_start ( ) ; } | Start method put your output in memory cache until you end |
33,639 | public static function end ( $ name , $ key = null ) { if ( $ key ) { $ GLOBALS [ ARX_HOOK ] [ $ name ] [ $ key ] = ob_get_contents ( ) ; } else { $ GLOBALS [ ARX_HOOK ] [ $ name ] = ob_get_contents ( ) ; } ob_end_clean ( ) ; } | End your cached data and save it in a globals |
33,640 | public function set ( $ options = [ 'icon' => null , 'title' => null , 'message' => '' , 'url' => null , 'target' => null ] , $ settings = [ ] ) { $ settings = Arr :: merge ( $ this -> settings , $ settings ) ; $ this -> session -> flash ( 'notify.options' , $ options ) ; $ this -> session -> flash ( 'notify.settings' , $ settings ) ; $ this -> hook -> put ( '__app.notify.options' , $ options ) ; $ this -> hook -> put ( '__app.notify.settings' , $ settings ) ; return $ this ; } | Set the flash element |
33,641 | public function getDefaultConfiguration ( BlockInterface $ block ) { foreach ( $ this -> strategies as $ strategy ) { if ( $ strategy -> support ( $ block ) ) { return $ strategy -> getMergedDefaultConfiguration ( ) ; } } throw new MissingGenerateFormStrategyException ( ) ; } | Get the default configuration for the block |
33,642 | public function getRequiredUriParameter ( BlockInterface $ block ) { foreach ( $ this -> strategies as $ strategy ) { if ( $ strategy -> support ( $ block ) ) { return $ strategy -> getRequiredUriParameter ( ) ; } } throw new MissingGenerateFormStrategyException ( ) ; } | Get the required Uri parameters for the block |
33,643 | private function parseNumber ( $ number ) { try { $ this -> numberParsed = $ this -> instance -> parse ( $ number , $ this -> defaultRegion ) ; } catch ( \ libphonenumber \ NumberParseException $ e ) { $ this -> numberParsed = null ; } } | Parses the phone number |
33,644 | public static function js ( array $ array , $ params = array ( 'attributes' => array ( ) , 'secure' => null ) ) { Arr :: mergeWithDefaultParams ( $ params ) ; if ( ! $ params [ 'secure' ] ) { try { $ params [ 'secure' ] = Utils :: isHTTPS ( ) ; } catch ( Exception $ e ) { } } $ out = "\n" ; foreach ( $ array as $ key => $ item ) { if ( is_array ( $ item ) ) { $ out .= Html :: script ( $ item [ 0 ] , $ item [ 1 ] , $ item [ 2 ] ) . "\n" ; } else { $ out .= Html :: script ( $ item , $ params [ 'attributes' ] ? : [ ] , $ params [ 'secure' ] ) . "\n" ; } } return $ out ; } | Load and output a js script tag from array |
33,645 | public static function css ( array $ array , $ params = array ( 'attributes' => [ ] , 'secure' => null ) ) { Arr :: mergeWithDefaultParams ( $ params ) ; if ( ! $ params [ 'secure' ] ) { try { $ params [ 'secure' ] = Utils :: isHTTPS ( ) ; } catch ( Exception $ e ) { } } $ out = "\n" ; foreach ( $ array as $ key => $ item ) { if ( is_array ( $ item ) ) { $ out .= Html :: style ( $ item [ 0 ] , $ item [ 1 ] , $ item [ 2 ] ) . "\n" ; } else { $ out .= Html :: style ( $ item , $ params [ 'attributes' ] , $ params [ 'secure' ] ) . "\n" ; } } return $ out ; } | Load and output a css link tag from array |
33,646 | public static function image ( array $ array , $ param = array ( ) ) { $ out = "\n" ; foreach ( $ array as $ key => $ item ) { if ( is_array ( $ item ) ) { $ out .= Html :: image ( $ item [ 0 ] , $ item [ 1 ] ) . "\n" ; } else { $ out .= Html :: image ( $ item ) . "\n" ; } } return $ out ; } | Output HTML image tag from array |
33,647 | public function connect ( ) { $ readWriteTimeout = max ( $ this -> read_timeout , $ this -> write_timeout ) ; try { $ this -> connection = new AMQPStreamConnection ( $ this -> host , $ this -> port , $ this -> login , $ this -> password , $ this -> vhost , false , 'AMQPLAIN' , null , 'en_US' , $ this -> connect_timeout , $ readWriteTimeout , null , $ this -> keepalive , $ this -> heartbeat ) ; } catch ( Exception $ e ) { throw new AMQPConnectionException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> getPrevious ( ) ) ; } } | Establish a transient connection with the AMQP broker . |
33,648 | public function disconnect ( ) { if ( ! $ this -> isConnected ( ) ) return false ; try { $ this -> connection -> close ( ) ; } catch ( Exception $ e ) { return false ; } return true ; } | Closes the transient connection with the AMQP broker . |
33,649 | public function preSubmit ( FormEvent $ event ) { $ form = $ event -> getForm ( ) ; $ data = $ form -> getData ( ) ; if ( is_array ( $ event -> getData ( ) ) ) { $ order = array_flip ( array_keys ( $ event -> getData ( ) ) ) ; if ( is_null ( $ data ) ) { $ data = array ( ) ; } if ( $ data instanceof Collection ) { $ dataClone = $ data -> toArray ( ) ; $ data -> clear ( ) ; foreach ( $ order as $ key => $ value ) { $ data -> set ( $ key , array_key_exists ( $ key , $ dataClone ) ? $ dataClone [ $ key ] : null ) ; } } elseif ( is_array ( $ data ) ) { $ oldData = array_merge ( array ( ) , $ data ) ; $ data = array ( ) ; foreach ( $ order as $ key => $ value ) { $ data [ $ key ] = array_key_exists ( $ key , $ oldData ) ? $ oldData [ $ key ] : null ; } } $ form -> setData ( $ data ) ; } } | Triggered when a collection is submitted |
33,650 | public function renderTitle ( ) { return Html :: tag ( 'span' , $ this -> encodeTitle ? Html :: encode ( $ this -> title ) : $ this -> title , [ 'class' => 'card-title' ] ) ; } | Renders the title . |
33,651 | public function renderAction ( ) { return Html :: tag ( 'div' , $ this -> encodeAction ? Html :: encode ( $ this -> action ) : $ this -> action , [ 'class' => 'card-action' ] ) ; } | Renders the action . |
33,652 | public function getFor ( $ class , $ strict = false ) { if ( isset ( $ this -> items [ $ class ] ) ) { return $ this -> items [ $ class ] ; } elseif ( ! $ strict ) { foreach ( $ this -> items as $ blueprint ) { if ( is_subclass_of ( $ class , $ blueprint -> class , true ) ) { return $ blueprint ; } } } return null ; } | Returns blueprint for specified class if exists in collection . |
33,653 | public function fromJson ( $ json ) { Helpers :: checkType ( 'json' , 'string' , $ json ) ; $ decoded_value = json_decode ( $ json ) ; if ( $ decoded_value === null && ( $ json !== 'null' || $ json !== '' ) ) { throw new \ Exception ( 'Invalid JSON.' ) ; } return $ this -> setValue ( $ decoded_value ) ; } | Adds properties from JSON . |
33,654 | public static function fire ( $ job , $ data ) { \ Log :: info ( 'Queue job called #' . $ job -> getJobId ( ) , Arr :: toArray ( $ data ) ) ; $ method = $ data [ '@method' ] ; unset ( $ data [ '@method' ] ) ; $ t = self :: getInstance ( ) ; call_user_func_array ( array ( $ t , $ method ) , $ data ) ; $ job -> delete ( ) ; } | Fire a task in background using Beanstalkd |
33,655 | public function install ( $ reservedMemory = 1048576 ) { if ( $ this -> isEnabled ) { throw new AlreadyInstalledException ( ) ; } if ( ! $ this -> isRegistered ) { $ this -> reservedMemory = $ this -> isolator -> str_repeat ( ' ' , $ reservedMemory ) ; $ this -> isolator -> class_exists ( 'Eloquent\Asplode\Error\FatalErrorException' ) ; $ this -> isolator -> register_shutdown_function ( $ this ) ; $ this -> isRegistered = true ; } $ this -> isEnabled = true ; } | Installs this fatal error handler . |
33,656 | public function handle ( ) { if ( ! $ this -> isEnabled ) { return ; } $ this -> reservedMemory = '' ; $ error = $ this -> isolator -> error_get_last ( ) ; if ( null === $ error ) { return ; } $ handler = $ this -> stack -> handler ( ) ; if ( null === $ handler ) { return ; } $ handler ( new FatalErrorException ( $ error [ 'message' ] , $ error [ 'type' ] , $ error [ 'file' ] , $ error [ 'line' ] ) ) ; } | Handles PHP shutdown and produces exceptions for any detected fatal error . |
33,657 | public static function setAceScript ( Controller $ controller , $ theme = 'chrome' ) { $ view = $ controller -> getView ( ) ; AceAsset :: register ( $ view ) ; $ view -> registerJs ( "$('textarea[data-editor]').each(function(index, element) { var textarea = $(this); var editDiv = $('<div>', { width: textarea.width(), height: textarea.height(), class: textarea.attr('class') }).insertBefore(textarea); textarea.addClass('hidden'); var editor = ace.edit(editDiv[0]); var mode = (textarea.data('editor')).trim(); var theme = ('{$theme}').trim(); editor.setReadOnly(textarea.data('read-only')); editor.getSession().setValue(textarea.val()); if (mode.length !== 0) { editor.getSession().setMode('ace/mode/' + mode); } if (theme.length !== 0) { editor.setTheme('ace/theme/' + theme); } editor.getSession().on('change', function() { textarea.val(editor.getSession().getValue()); }); });" ) ; } | converts all textarea with attribute data - editor in the ace text editor |
33,658 | public function generateFileExtension ( UploadedFile $ uploadedFile ) { $ filePath = $ uploadedFile -> getClientOriginalName ( ) ; $ fileInfo = pathinfo ( $ filePath ) ; if ( ! empty ( $ fileInfo [ 'extension' ] ) ) { return strtolower ( $ fileInfo [ 'extension' ] ) ; } throw ( new AssetsBadRequestException ( 'Cannot detect file extension, provide it before uploading.' ) ) -> setStatusCode ( 400 ) ; } | Generate file extension . |
33,659 | public function transform ( $ data ) { if ( ! is_null ( $ data ) ) { return array ( $ this -> formTypeName => $ this -> entityDbMapper -> fromDbToEntity ( $ data ) -> getId ( ) ) ; } return null ; } | Take a embed document array representation to return associative array formType id |
33,660 | public function reverseTransform ( $ data ) { if ( is_array ( $ data ) ) { $ id = current ( $ data ) ; $ document = $ this -> objectManager -> find ( $ this -> documentClass , $ id ) ; return $ this -> entityDbMapper -> fromEntityToDb ( $ document ) ; } return null ; } | Take an array with document id to turn it into embed document |
33,661 | public function injectResponse ( ViewEvent $ e ) { $ renderer = $ e -> getRenderer ( ) ; if ( $ renderer !== $ this -> renderer ) { return ; } $ result = $ e -> getResult ( ) ; $ response = $ e -> getResponse ( ) ; $ response -> setContent ( $ result ) ; } | Inject the response from the renderer . |
33,662 | public function validateCache ( $ xml ) { $ tz = date_default_timezone_get ( ) ; date_default_timezone_set ( 'UTC' ) ; $ xml = @ new \ SimpleXMLElement ( $ xml ) ; $ dt = ( int ) strtotime ( $ xml -> cachedUntil ) ; $ time = time ( ) ; date_default_timezone_set ( $ tz ) ; return ( bool ) ( $ dt > $ time ) ; } | Validate the cached xml if it is still valid . This contains a name hack to work arround EVE API giving wrong cachedUntil values |
33,663 | public function setFlags ( $ flags ) { if ( ! is_int ( $ flags ) ) { throw new InvalidArgumentException ( 'integer' , 0 ) ; } if ( ( $ flags & FORCE_USE_PROC_OPEN ) && ( $ flags & FORCE_USE_EXEC ) ) { throw new DomainException ( "Invalid flags: FORCE_USE_PROC_OPEN and FORCE_USE_EXEC cannot be set at the same time" ) ; } $ this -> flags = $ flags ; return $ this ; } | Set the flags for this Command |
33,664 | public function removeArgument ( Argument $ argument ) { $ key = array_search ( $ argument , $ this -> arguments , true ) ; unset ( $ this -> arguments [ $ key ] ) ; return $ this ; } | Remove an Argument from Command |
33,665 | public function getBuiltCommand ( ) { $ cmd = $ this -> command ; foreach ( $ this -> arguments as $ argument ) { $ os = $ argument -> getOs ( ) ; if ( $ os && ! ( $ os & $ this -> os -> getType ( ) ) ) { continue ; } $ key = $ argument -> getKey ( ) ; $ prefix = $ argument -> getPrefix ( ) ; if ( $ argument -> willEscape ( ) === true || ( $ argument -> willEscape ( ) === null && ( $ this -> flags & ESCAPE ) ) ) { $ key = $ this -> escapeshellarg ( $ key ) ; } $ key = $ prefix . $ key ; $ values = $ argument -> getValues ( ) ; if ( empty ( $ values ) ) { $ cmd .= " $key" ; continue ; } foreach ( $ values as $ val ) { $ cmd .= " $key" ; $ cmd .= ( $ this -> flags & DONT_ADD_SPACE_BEFORE_VALUE ) ? '' : ' ' ; if ( $ argument -> willEscape ( ) === true || ( $ argument -> willEscape ( ) === null && ( $ this -> flags & ESCAPE ) ) ) { $ val = $ this -> escapeshellarg ( $ val ) ; } $ cmd .= $ val ; } } return trim ( $ cmd ) ; } | Get the built command |
33,666 | public function run ( Result $ result = null ) { $ cmd = $ this -> getBuiltCommand ( ) ; $ result = ( $ result ) ? $ result : new Result ( ) ; if ( ( $ this -> os -> isWindowsLike ( ) && ! ( $ this -> flags & FORCE_USE_PROC_OPEN ) ) || ( $ this -> flags & FORCE_USE_EXEC ) ) { return $ this -> exec ( $ cmd , $ result ) ; } else { return $ this -> procOpen ( $ cmd , $ result ) ; } } | Runs the command and returns a result object |
33,667 | public function chain ( Chain $ chain = null ) { $ chain = ( $ chain ) ? $ chain : new Chain ( ) ; $ chain -> add ( $ this ) ; return $ chain ; } | Start the command chaining process . This command will become the first command in the chain |
33,668 | public function chdir ( $ dir , $ check = true ) { if ( ! is_string ( $ dir ) ) { throw new InvalidArgumentException ( "string" , 0 ) ; } if ( $ check && ! is_dir ( $ dir ) ) { throw new Exception ( "No such directory $dir" ) ; } $ this -> cwd = $ dir ; return $ this ; } | Set the command s new working directory |
33,669 | protected function exec ( $ cmd , Result $ result ) { $ tempStdErr = tempnam ( $ this -> tmpDir , 'cmr' ) ; if ( ! $ tempStdErr ) { throw new Exception ( "Could not create temporary file on $tempStdErr" ) ; } $ otp = array ( ) ; $ exitCode = null ; if ( $ this -> stdIn !== null ) { $ filename = $ this -> createFauxStdIn ( $ this -> stdIn ) ; if ( $ this -> os -> isWindowsLike ( ) ) { $ cat = "type $filename" ; } else { $ cat = "cat $filename" ; } $ cmd = "$cat | $cmd" ; } $ prevCwd = getcwd ( ) ; if ( $ this -> cwd ) { chdir ( $ this -> cwd ) ; } $ result -> setLastLine ( trim ( exec ( "$cmd 2> $tempStdErr" , $ otp , $ exitCode ) ) ) ; $ result -> setStdIn ( $ this -> stdIn ) -> setStdOut ( implode ( PHP_EOL , $ otp ) ) -> setStdErr ( file_get_contents ( $ tempStdErr ) ) -> setExitCode ( $ exitCode ) ; chdir ( $ prevCwd ) ; return $ result ; } | Method to run the command using exec |
33,670 | protected function procOpen ( $ cmd , Result $ result ) { $ spec = array ( 0 => array ( "pipe" , "r" ) , 1 => array ( "pipe" , "w" ) , 2 => array ( "pipe" , "w" ) , ) ; $ pipes = array ( ) ; $ process = proc_open ( $ cmd , $ spec , $ pipes , $ this -> cwd ) ; if ( is_resource ( $ process ) ) { $ result -> setStdIn ( $ this -> stdIn ) ; if ( $ this -> stdIn !== null ) { fwrite ( $ pipes [ 0 ] , $ this -> stdIn ) ; } fclose ( $ pipes [ 0 ] ) ; $ result -> setStdOut ( trim ( stream_get_contents ( $ pipes [ 1 ] ) ) ) ; fclose ( $ pipes [ 1 ] ) ; $ result -> setStdErr ( trim ( stream_get_contents ( $ pipes [ 2 ] ) ) ) ; fclose ( $ pipes [ 2 ] ) ; $ result -> setExitCode ( proc_close ( $ process ) ) ; $ lLine = explode ( PHP_EOL , $ result -> getStdOut ( ) ) ; $ result -> setLastLine ( trim ( array_pop ( $ lLine ) ) ) ; } return $ result ; } | Method to run the command using proc_open |
33,671 | public function create ( GClass $ gClass , $ overwrite = FALSE , File $ file = NULL ) { $ file = $ file ? : $ this -> mapper -> getFile ( $ gClass -> getFQN ( ) ) ; $ file -> getDirectory ( ) -> create ( ) ; try { $ this -> elevator -> elevateParent ( $ gClass ) ; } catch ( ClassFileNotFoundException $ e ) { } catch ( \ ReflectionException $ e ) { } try { $ this -> elevator -> elevateInterfaces ( $ gClass ) ; } catch ( ClassFileNotFoundException $ e ) { } catch ( \ ReflectionException $ e ) { } $ gClass -> createAbstractMethodStubs ( ) ; $ this -> writer -> write ( $ gClass , $ file , $ overwrite ) ; return $ file ; } | Creates a new Class and writes it to a file |
33,672 | public function createNewVersionNode ( NodeInterface $ originalNode , $ versionName = '' ) { $ status = $ this -> statusRepository -> findOneByInitial ( ) ; $ newNode = clone $ originalNode ; $ newNode -> setStatus ( $ status ) ; $ newNode -> setVersion ( $ this -> uniqueIdGenerator -> generateUniqueId ( ) ) ; $ this -> duplicateArea ( $ originalNode , $ newNode ) ; $ newNode -> setVersionName ( $ versionName ) ; if ( empty ( $ versionName ) ) { $ newNode = $ this -> setVersionName ( $ newNode ) ; } return $ newNode ; } | Duplicate a node |
33,673 | public function define ( string $ resource , $ versionOrClosure , $ closureOrDescription = null , string $ description = null ) { $ version = $ this -> version ; $ closure = $ closureOrDescription ; if ( $ versionOrClosure instanceof \ Closure ) { $ version = $ this -> version ; $ closure = $ versionOrClosure ; $ description = $ closureOrDescription ; } if ( is_numeric ( $ versionOrClosure ) ) { $ version = intval ( $ versionOrClosure ) ; } $ this -> definitions -> push ( new ResourceDefinition ( $ version , $ resource , $ description ) ) ; $ resourceDefinition = $ this -> definition ( $ resource , $ version ) ; call_user_func_array ( $ closure , [ $ resourceDefinition ] ) ; return $ this ; } | defines a new resource |
33,674 | public function definition ( string $ resource , int $ version = null ) : ResourceDefinition { $ version = $ version ?? $ this -> version ; if ( str_contains ( $ resource , '.' ) ) { list ( $ resource , $ related ) = explode ( '.' , $ resource ) ; $ definition = $ this -> definition ( $ resource , $ version ) ; $ relatedDefinition = $ definition -> relations -> filter ( function ( ResourceDefinition $ definition ) use ( $ related , $ version ) { return $ definition -> version === $ version && $ definition -> resource === $ related ; } ) ; if ( $ relatedDefinition -> isEmpty ( ) ) throw ResourceNotDefinedException :: resource ( $ resource , 'version ' . $ version ) ; return $ relatedDefinition -> first ( ) ; } $ found = $ this -> definitions -> filter ( function ( ResourceDefinition $ definition ) use ( $ resource , $ version ) { return $ definition -> version === $ version && $ definition -> resource === $ resource ; } ) ; if ( $ found -> isEmpty ( ) ) { throw ResourceNotDefinedException :: resource ( $ resource , 'version ' . $ version ) ; } return $ found -> first ( ) ; } | returns definition for resource and version |
33,675 | public function resources ( int $ version = null ) { $ version = $ version ?? $ this -> version ; return $ this -> definitions -> filter ( function ( ResourceDefinition $ definition ) use ( $ version ) { return $ definition -> version === $ version ; } ) -> pluck ( 'resource' ) ; } | returns all resources |
33,676 | public function resolve ( string $ type , string $ resource , array $ parameters = [ ] , $ version = null ) { $ version = $ version ?? $ this -> version ; if ( str_contains ( $ resource , '.' ) ) { list ( $ resource , $ related ) = explode ( '.' , $ resource ) ; $ resourceDefinition = $ this -> loadRelatedDefinition ( $ version , $ resource , $ related , $ type ) ; } else { $ resourceDefinition = $ this -> loadDefinition ( $ version , $ resource , $ type ) ; } return $ this -> app -> make ( $ resourceDefinition , $ parameters ) ; } | resolves a definition or related definition |
33,677 | public function resolveSerializer ( $ resource , array $ parameters = [ ] , $ version = null ) { return $ this -> resolve ( 'serializer' , $ resource , $ parameters , $ version ) ; } | resolves a serializer |
33,678 | public function resolveRepository ( $ resource , array $ parameters = [ ] , $ version = null ) { return $ this -> resolve ( 'repository' , $ resource , $ parameters , $ version ) ; } | resolves a repository |
33,679 | public function resolveRequestHandler ( $ resource , array $ parameters = [ ] , $ version = null , $ resolveDefaultRequestHandler = true ) { try { return $ this -> resolve ( 'requestHandler' , $ resource , $ parameters , $ version ) ; } catch ( ResourceNotDefinedException $ e ) { if ( $ resolveDefaultRequestHandler ) { return $ this -> app -> make ( DefaultRequestHandler :: class , $ parameters ) ; } throw $ e ; } } | resolves a controller |
33,680 | public function resolveFilterFactory ( $ resource , array $ parameters = [ ] , $ version = null ) { try { return $ this -> resolve ( 'filterFactory' , $ resource , $ parameters , $ version ) ; } catch ( ResourceNotDefinedException $ e ) { return $ this -> app -> make ( ArrayFilterFactory :: class , $ parameters ) ; } } | resolves a filter factory |
33,681 | private function loadDefinition ( $ version , $ resource , $ type , $ key = null ) : string { $ definition = $ this -> definition ( $ resource , $ version ) ; $ classPath = $ definition -> $ type ; if ( is_array ( $ classPath ) && array_key_exists ( $ key , $ classPath ) ) { $ classPath = $ classPath [ $ key ] ; } if ( $ classPath === null ) { throw ResourceNotDefinedException :: resource ( $ resource , $ type ) ; } return $ classPath ; } | loads a definition |
33,682 | private function loadRelatedDefinition ( $ version , $ resource , $ related , $ type , $ key = null ) : string { $ definition = $ this -> definition ( $ resource , $ version ) ; $ relationDefinition = $ definition -> relation ( $ related ) ; $ classPath = $ relationDefinition -> $ type ; if ( is_array ( $ classPath ) && array_key_exists ( $ key , $ classPath ) ) { $ classPath = $ classPath [ $ key ] ; } if ( $ classPath === null ) { throw ResourceNotDefinedException :: resource ( $ resource , $ type ) ; } return $ classPath ; } | loads a related definition |
33,683 | static public function stop ( ) { $ sample = self :: $ sample ; self :: $ sample = null ; if ( ! $ sample instanceof XhprofSample ) { throw new \ RuntimeException ( 'The profiler has not been started' ) ; } $ sample -> setData ( xhprof_disable ( ) ) ; return $ sample ; } | Stop the Xhprof runs |
33,684 | public static function castInt ( $ value ) : int { if ( $ value !== null && ! is_scalar ( $ value ) ) { throw new InvalidArgumentException ( 'Value could not be parsed to integer' ) ; } return ( int ) $ value ; } | Converts the representation of a number to its integer equivalent . |
33,685 | public static function castString ( $ value ) : string { if ( $ value !== null && ! is_scalar ( $ value ) ) { throw new InvalidArgumentException ( 'Value could not be parsed to string' ) ; } return ( string ) $ value ; } | Converts the representation of a string to its string equivalent . |
33,686 | public function getCurrentPath ( ) { if ( ! static :: $ filepath ) { static :: $ filepath = "files/" . $ this -> getTable ( ) ; } static :: $ currentPath = public_path ( static :: $ filepath . '/' . $ this -> id ) ; if ( ! is_dir ( static :: $ currentPath ) ) { try { @ mkdir ( static :: $ currentPath , 0777 , true ) ; } catch ( Exception $ e ) { Api :: handleError ( $ e ) ; } } return static :: $ currentPath ; } | Check if folders exists |
33,687 | public function setData ( $ data , $ encoding = self :: ENCODING_URL_ENCODED_OCTETS ) { switch ( $ encoding ) { case self :: ENCODING_URL_ENCODED_OCTETS : $ this -> encoding = self :: ENCODING_URL_ENCODED_OCTETS ; $ this -> encodedData = rawurlencode ( $ data ) ; break ; case self :: ENCODING_BASE64 : $ this -> encoding = self :: ENCODING_BASE64 ; $ this -> encodedData = base64_encode ( $ data ) ; break ; default : throw new \ InvalidArgumentException ( 'Unsupported encoding scheme' ) ; break ; } } | Sets the data for the data URI which it stores in encoded form using the encoding scheme provided . |
33,688 | public function tryDecodeData ( & $ decodedData ) { $ hasOutput = false ; switch ( $ this -> getEncoding ( ) ) { case self :: ENCODING_URL_ENCODED_OCTETS : $ decodedData = rawurldecode ( $ this -> getEncodedData ( ) ) ; $ hasOutput = true ; break ; case self :: ENCODING_BASE64 : $ b64Decoded = base64_decode ( $ this -> getEncodedData ( ) , true ) ; if ( $ b64Decoded !== false ) { $ decodedData = $ b64Decoded ; $ hasOutput = true ; } break ; default : break ; } return $ hasOutput ; } | Tries to decode the URI s data using the encoding scheme set . |
33,689 | public function toString ( ) { $ output = 'data:' ; if ( ( $ this -> getMediaType ( ) !== self :: DEFAULT_TYPE ) || ( $ this -> getEncoding ( ) !== self :: ENCODING_URL_ENCODED_OCTETS ) ) { $ output .= $ this -> getMediaType ( ) ; if ( $ this -> getEncoding ( ) === self :: ENCODING_BASE64 ) { $ output .= ';' . self :: BASE64_KEYWORD ; } } $ output .= ',' . $ this -> getEncodedData ( ) ; return $ output ; } | Generates a data URI string representation of the object . |
33,690 | public static function tryParse ( $ dataUriString , & $ out ) { $ hasOutput = false ; if ( self :: isParsable ( $ dataUriString ) ) { $ matches = null ; if ( preg_match_all ( self :: $ REGEX_URI , $ dataUriString , $ matches , PREG_SET_ORDER ) !== false ) { $ mediatype = isset ( $ matches [ 0 ] [ 1 ] ) ? $ matches [ 0 ] [ 1 ] : self :: DEFAULT_TYPE ; $ matchedEncoding = isset ( $ matches [ 0 ] [ 2 ] ) ? $ matches [ 0 ] [ 2 ] : '' ; $ encoding = ( strtolower ( $ matchedEncoding ) === self :: BASE64_KEYWORD ) ? self :: ENCODING_BASE64 : self :: ENCODING_URL_ENCODED_OCTETS ; $ data = isset ( $ matches [ 0 ] [ 3 ] ) ? $ matches [ 0 ] [ 3 ] : '' ; $ dataUri = new self ( ) ; $ dataUri -> setMediaType ( $ mediatype ) ; $ dataUri -> setEncodedData ( $ encoding , $ data ) ; $ out = $ dataUri ; $ hasOutput = true ; } } return $ hasOutput ; } | Parses a string data URI into an instance of a DataUri object . |
33,691 | protected function buildPrefix ( ) { if ( $ this -> currentLevel === false ) { return "" ; } else { $ prefix = $ this -> currentLevel ; $ this -> currentLevel = false ; return $ prefix . "." ; } } | Creates a prefix |
33,692 | protected function addToChain ( $ name ) { $ dot = ( $ this -> currentLevel === false ) ? '' : '.' ; $ this -> currentLevel .= $ dot . $ name ; return $ this ; } | Adds to the chain |
33,693 | private function isCachable ( Request $ request ) { if ( $ this -> cachable === null ) { $ this -> cachable = $ request -> method ( ) === 'GET' && ! app ( ) -> environment ( 'local' ) && $ this -> minutesToCache > 0 ; } return $ this -> cachable ; } | is current request cachable? |
33,694 | protected function voteForReadAction ( $ node , TokenInterface $ token ) { return $ this -> hasRole ( $ token , ContributionRoleInterface :: NODE_CONTRIBUTOR ) && $ this -> isSubjectInPerimeter ( $ this -> getPath ( $ node ) , $ token -> getUser ( ) , NodeInterface :: ENTITY_TYPE ) ; } | Vote for Read action A user can read a node if it is in his perimeter |
33,695 | public function toMembers ( $ members ) { if ( $ members instanceof Member ) { $ this -> members = new ArrayList ( array ( $ members ) ) ; } elseif ( is_array ( $ members ) || $ members instanceof SS_List ) { $ this -> members = $ members ; } return $ this ; } | Send the email to a list of members |
33,696 | protected function doSend ( $ messageID = null , $ plain = false ) { $ this -> extend ( 'onBeforeDoSend' , $ this ) ; if ( ! $ this -> Subject ( ) && $ this -> getUserTemplate ( ) ) { $ this -> setSubject ( $ this -> getUserTemplate ( ) -> Subject ) ; } $ from = $ this -> From ( ) ; $ config = Config :: inst ( ) -> forClass ( 'Email' ) ; if ( ! $ from ) { if ( $ this -> getUserTemplate ( ) ) { $ from = $ this -> getUserTemplate ( ) -> From ; } if ( ! $ from ) { $ from = $ config -> send_all_emails_from ? : $ config -> admin_email ; } $ this -> setFrom ( $ from ) ; } if ( $ this -> members ) { foreach ( $ this -> members as $ m ) { $ this -> setTo ( $ m -> Email ) ; $ this -> populateTemplate ( array ( 'RecipientMember' => $ m ) ) ; } } if ( $ this -> config ( ) -> test_mode ) { $ this -> parseVariables ( $ plain ) ; } else { if ( $ plain ) { parent :: sendPlain ( $ messageID ) ; } else { parent :: send ( $ messageID ) ; } } $ this -> extend ( 'onAfterDoSend' , $ this ) ; $ this -> persist ( ) ; } | Sends the a plain or HTML version of the email |
33,697 | public function setUserTemplate ( $ identifier ) { $ template = PermamailTemplate :: get_by_identifier ( $ identifier ) ; if ( ! $ template ) { $ template = PermamailTemplate :: create ( array ( 'Identifier' => $ identifier , ) ) ; $ template -> write ( ) ; } $ this -> userTemplate = $ identifier ; return $ this ; } | Sets the user - defined template to use |
33,698 | public function isAvailable ( $ host ) { $ hostcdNode = $ this -> getHostcd ( $ host ) ; $ node = $ this -> getFirst ( 'host:name' , $ hostcdNode ) ; return in_array ( $ node -> getAttribute ( 'avail' ) , [ '1' , 'true' ] ) ; } | Host is available for creating . |
33,699 | public function getReason ( $ host ) { $ hostcdNode = $ this -> getHostcd ( $ host ) ; $ node = $ this -> getFirst ( 'host:reason' , $ hostcdNode ) ; return $ node === null ? null : $ node -> nodeValue ; } | The reason why a host is not available for creation . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.