idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
56,700 | protected function removeDeletedFsChildrenFromDb ( $ dbChildren ) { $ existingChildren = [ ] ; foreach ( $ dbChildren as $ child ) { if ( ! $ this -> filesystem -> exists ( $ child -> getPath ( ) ) ) { $ this -> nodeRepository -> delete ( $ child ) ; continue ; } $ existingChildren [ ] = $ child ; } return $ existingCh... | Delete the non existing |
56,701 | protected function absoluteToFilesystemPath ( $ filePath ) { if ( ! $ this -> isWithinFilesystem ( $ filePath ) ) { return $ filePath ; } $ fsPath = ( string ) $ this -> filesystem -> url ( ) -> path ; return str_replace ( $ fsPath , '' , $ filePath ) ; } | Cat the absolute part of a file path off to make a relative filesystem path |
56,702 | protected function isExcludedFromDb ( $ basename ) { if ( in_array ( mb_strtolower ( $ basename ) , $ this -> excludeFromDb ) ) { return true ; } return Helper :: startsWith ( $ basename , '.' ) || Helper :: startsWith ( $ basename , '_' ) ; } | Return true if the passed file should not be mirrored in the db . |
56,703 | public function createController ( $ name , SiteTreeNodeInterface $ page = null ) { $ this -> page = $ page ; $ controller = $ this -> makeController ( $ name ) ; $ this -> modifyController ( $ controller , $ page ) ; return $ controller ; } | Creates a controller while routing to a page . This method is used to configure dependencies of you controller according to a page . You can also configure your controller directly like setting a a layout |
56,704 | public function pushKey ( $ layer ) { $ this -> base .= $ this -> delimiter . str_replace ( $ this -> delimiter , $ this -> placeholder , $ layer ) ; return $ this -> getBase ( ) ; } | Add a layer of depth to the key hierarchy |
56,705 | public function popKey ( ) { if ( strlen ( $ this -> base ) ) { $ layers = explode ( $ this -> delimiter , $ this -> base ) ; $ last = count ( $ layers ) - 1 ; $ layer = $ layers [ $ last ] ; if ( $ last > 0 ) { unset ( $ layers [ $ last ] ) ; $ this -> base = implode ( $ this -> delimiter , $ layers ) ; } else { $ thi... | Remove a layer of depth from the key hierarchy |
56,706 | public function postGalleryAction ( ) { $ serializer = $ this -> get ( "tpg_extjs.phpcr_serializer" ) ; $ entity = $ serializer -> deserialize ( $ this -> getRequest ( ) -> getContent ( ) , 'Togu\MediaBundle\Document\Gallery' , 'json' , DeserializationContext :: create ( ) -> setGroups ( array ( "Default" , "post" ) ) ... | Create a new Gallery record |
56,707 | public function getBackgroundColorEscapeSequence ( $ colorName = '' ) { if ( $ this -> _isDefinedColor ( $ colorName ) === true ) { $ colors = self :: getDefinedColors ( ) ; list ( $ textColor , $ backgroundColor ) = $ colors [ $ colorName ] ; return $ backgroundColor ; } return '' ; } | Get Background color escape sequence |
56,708 | public function setIsBold ( $ isBold ) { if ( $ isBold === true ) { $ this -> _isBold = true ; } else { $ this -> _isBold = false ; } } | Set which is bold |
56,709 | public function setIsUnderlined ( $ isUnderlined ) { if ( $ isUnderlined === true ) { $ this -> _isUnderlined = true ; } else { $ this -> _isUnderlined = false ; } } | Set which is underlined |
56,710 | private function _isDefinedColor ( $ colorName ) { $ colors = self :: getDefinedColors ( ) ; $ colorNames = array_keys ( $ colors ) ; return in_array ( $ colorName , $ colorNames ) ; } | Which is defined color |
56,711 | final protected static function triggerEvent ( $ event , array $ context = array ( ) ) { if ( array_key_exists ( $ event , static :: $ registered_events ) ) { array_map ( function ( $ handler ) use ( $ context ) { call_user_func ( $ handler , $ context ) ; } , static :: $ registered_events [ $ event ] ) ; } } | Trigger an event an call its callback if any exist . Otherwise nothing |
56,712 | public function getElement ( ) { if ( $ this -> getDocblock ( ) ) { $ this -> setLines ( $ this -> getDocblock ( ) -> getElement ( ) ) ; } $ name = '' ; if ( $ this -> getName ( ) and ! is_array ( $ this -> getValue ( ) ) ) { $ name = ( $ this -> getType ( ) ? $ this -> getType ( ) . ' ' : '' ) . '$' . $ this -> getNam... | Return param content |
56,713 | public function offsetSet ( $ mOffset , $ oEntity ) { $ this -> checkClass ( $ oEntity ) ; return parent :: offsetSet ( $ mOffset , $ oEntity ) ; } | set the entity by the given offset |
56,714 | public function toArray ( ) { $ aReturn = array ( ) ; foreach ( $ this -> values as $ sKey => $ oEntity ) { $ aReturn [ $ sKey ] = $ oEntity -> toArray ( ) ; } return $ aReturn ; } | return this collection as array |
56,715 | protected function checkPropertyIncrement ( BaseProperty $ baseProperty , Profession $ profession ) { $ propertyFirstLevelModifier = static :: getBasePropertyFirstLevelModifier ( PropertyCode :: getIt ( $ baseProperty -> getCode ( ) ) , $ profession ) ; if ( $ baseProperty -> getValue ( ) !== $ propertyFirstLevelModifi... | It is only the increment based on first level of specific profession . There are other increments like race size etc . solved in different library . |
56,716 | final public static function instance ( ) { $ c = get_called_class ( ) ; if ( ! isset ( self :: $ instances [ $ c ] ) ) { self :: $ instances [ $ c ] = new $ c ; } return self :: $ instances [ $ c ] ; } | Grab an instance of the singleton . |
56,717 | public static function out ( $ line , ... $ args ) { if ( count ( $ args ) > 0 ) { $ line = call_user_func_array ( 'sprintf' , array_merge ( [ $ line ] , $ args ) ) ; } fwrite ( STDOUT , $ line . PHP_EOL ) ; } | Write line to STDOUT |
56,718 | public static function err ( $ message , ... $ args ) { if ( count ( $ args ) > 0 ) { $ message = call_user_func_array ( 'sprintf' , array_merge ( [ $ message ] , $ args ) ) ; } fwrite ( STDERR , $ message . PHP_EOL ) ; } | Write message to STDERR |
56,719 | public static function in ( $ message , ... $ args ) { if ( $ message !== '' ) { if ( count ( $ args ) > 0 ) { $ message = call_user_func_array ( 'sprintf' , array_merge ( [ $ message ] , $ args ) ) ; } $ message .= ' ' ; } fwrite ( STDERR , $ message ) ; $ input = fgets ( STDIN ) ; if ( $ input === false ) { throw new... | Read from STDIN |
56,720 | public static function validate ( $ type , $ paramName , $ data , array $ params = [ ] ) { $ data = ( array ) $ data ; switch ( $ type ) { case self :: VALIDATOR_USER : return static :: validateByCallback ( $ paramName , $ data , $ params ) ; case self :: VALIDATOR_EMAIL : return static :: validateEmail ( $ paramName ,... | Validate by type |
56,721 | public static function validateEmail ( $ paramName , array $ data ) { $ result = false ; if ( isset ( $ data [ $ paramName ] ) ) { $ result = filter_var ( $ data [ $ paramName ] , FILTER_VALIDATE_EMAIL ) !== false ; } else { throw new \ Exception ( 'Parameter is not set' ) ; } return $ result ; } | Validate e - mail |
56,722 | public static function validateByCallback ( $ paramName , array $ data , array $ params ) { if ( isset ( $ params [ 'callback' ] ) ) { return $ params [ 'callback' ] ( $ paramName , $ data ) ; } else { throw new \ Exception ( 'Callback parameter is required' ) ; } } | Validate by user function |
56,723 | public function release ( RevisionInterface $ revision , UserInterface $ user , $ comment ) { $ connection = $ this -> revisionRepository -> getDbAdapter ( ) -> getDriver ( ) -> getConnection ( ) -> beginTransaction ( ) ; try { if ( $ revision -> getReleasedAt ( ) != null ) { $ this -> revisionRepository -> remove ( $ ... | Release specified revision and create a current revision from it . If the revision had already been released the current revision should be removed first . |
56,724 | public function remove ( RevisionInterface $ revision ) { $ connection = $ this -> revisionRepository -> getDbAdapter ( ) -> getDriver ( ) -> getConnection ( ) -> beginTransaction ( ) ; try { $ this -> revisionRepository -> remove ( $ revision ) ; if ( $ revision -> getReleasedAt ( ) == null ) { $ lastReleasedRevision ... | Remove specified revision . If it s the current revision another current revision should be recreate from last released revision . |
56,725 | protected function transformPropertiesToArray ( ) { $ properties = $ this -> project -> getProperties ( ) ; foreach ( $ properties as $ propertyName => $ propertyValue ) { if ( 0 !== strpos ( $ propertyName , $ this -> propertyPrefix . '.' ) ) { continue ; } list ( , $ mainKey , $ subKey ) = $ this -> splitPropertyName... | transforms the flat property list into a local configuration array |
56,726 | protected function processRequest ( ) { $ request = $ this -> sm -> get ( 'Request' ) ; $ url = explode ( '?' , $ request -> getRequestUri ( ) ) ; $ this -> url = $ url [ 0 ] ; $ params = $ request -> getQuery ( ) ; if ( $ params -> get ( 'page' ) ) { $ this -> setPage ( ( int ) $ params -> get ( 'page' ) ) ; } if ( $ ... | Parses request and sets grid params |
56,727 | protected function countTotalRows ( ) { $ source = $ this -> getSource ( ) ; $ source -> resetDQLPart ( 'select' ) -> setFirstResult ( 0 ) -> select ( 'count(' . $ this -> entityAlias . ')' ) ; return ( int ) $ source -> getQuery ( ) -> getSingleScalarResult ( ) ; } | Get total rows in result ignoring limit |
56,728 | public function order ( $ column ) { if ( ! in_array ( $ column , $ this -> allowedOrders ) ) { return null ; } if ( isset ( $ this -> order [ $ column ] ) ) { $ order = strtolower ( $ this -> order [ $ column ] ) == self :: ORDER_ASC ? self :: ORDER_DESC : self :: ORDER_ASC ; } else { $ order = self :: ORDER_ASC ; } r... | Get url for order by column name |
56,729 | public function getServerMetadata ( Connection $ connection ) { try { $ statement = $ connection -> query ( 'SHOW DATABASES WHERE `Database` NOT IN ("information_schema", "performance_schema", "sys", "mysql");' ) ; } catch ( \ Throwable $ e ) { throw new \ RuntimeException ( 'Failed to list databases: ' . $ e -> getMes... | Query the server and build server metadata DTO . |
56,730 | public function getDatabaseMetadata ( Connection $ connection , string $ databaseName ) : DatabaseMetadata { $ tableNameStatement = $ connection -> createQueryBuilder ( ) -> select ( [ 'tables.TABLE_NAME AS name' ] ) -> from ( 'information_schema.TABLES' , 'tables' ) -> where ( 'TABLE_SCHEMA = :schema' ) -> andWhere ( ... | Query the server and build database metadata DTO . |
56,731 | public function getTableMetadata ( Connection $ connection , string $ databaseName , string $ tableName ) : TableMetadata { $ tableStatement = $ connection -> createQueryBuilder ( ) -> select ( [ 'tables.TABLE_NAME AS name' , 'tables.ENGINE AS engine' , 'tables.TABLE_COLLATION AS collation' , 'tables.TABLE_ROWS AS row_... | Query the server and build table metadata DTO . |
56,732 | public static function getCallStack ( $ asArray = false ) { $ i = 0 ; $ resp = [ ] ; if ( ! $ asArray ) { $ resp [ ] = str_repeat ( '=' , 50 ) ; } foreach ( debug_backtrace ( ) as $ node ) { $ file = Arr :: get ( $ node , 'file' , '' ) ; $ file = $ file ? : 'no_file' ; $ fn = $ node [ 'function' ] ; $ line = Arr :: get... | Prints stack trace . |
56,733 | public function add ( $ value ) : bool { if ( isset ( $ this -> hashMap [ $ value ] ) ) { return false ; } $ this -> hashMap [ $ value ] = 1 ; return true ; } | Add the given value to the set if it is not already present . |
56,734 | public function remove ( $ value ) : bool { if ( ! isset ( $ this -> hashMap [ $ value ] ) ) { return false ; } unset ( $ this -> hashMap [ $ value ] ) ; return true ; } | Remove the given value if it s present in the set . |
56,735 | protected function HasPages ( Site $ site ) { $ this -> site = $ site ; $ this -> tree = new PageTreeProvider ( $ site ) ; $ this -> page = $ this -> tree -> TopMost ( ) ; return ( bool ) $ this -> page ; } | Sets the site as current site and returns true if it has pages below |
56,736 | public function getTable ( ) { if ( false === isset ( $ this -> table ) ) { $ cl = new \ ReflectionClass ( $ this ) ; return trigger_error ( sprintf ( 'No table specified in "%s" class' , $ cl -> getFileName ( ) ) , E_USER_ERROR ) ; } return $ this -> table ; } | Returns the table |
56,737 | public function rows ( $ column = '*' , $ where = null , $ params = [ ] ) { if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( sprintf ( 'No database adapter was set in "%s"' , __METHOD__ ) , E_USER_ERROR ) ; } if ( false === is_string ( $ column ) ) { return trigger_error ( sprintf ( 'Argument 1 passed ... | Retrieve the number of rows |
56,738 | public function call ( $ function , $ params ) { if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( sprintf ( 'No database adapter was set in "%s"' , __METHOD__ ) , E_USER_ERROR ) ; } if ( null !== $ function && false === is_string ( $ function ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to... | Call stored procedure |
56,739 | public function select ( $ query , $ params = [ ] , $ type = null ) { $ type = $ type === null ? $ this -> getEntityNamespace ( $ this -> getTable ( ) ) : $ type ; if ( null === $ this -> getAdapter ( ) ) { return trigger_error ( sprintf ( 'No database adapter was set in "%s"' , __METHOD__ ) , E_USER_ERROR ) ; } return... | Execute select statement and returns a ResultSet |
56,740 | private function getEntityNamespace ( $ table ) { if ( false === is_string ( $ table ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ table ) ) , E_USER_ERROR ) ; } $ path = $ this -> getNamespace ( $ this , [ 'directory' , 'dbtable' ] ... | Loads entity table name |
56,741 | public function range ( $ min , $ max , $ steps = 1 , $ round = 0 ) { if ( false === is_numeric ( $ min ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type float or integer, "%s" given' , __METHOD__ , gettype ( $ min ) ) , E_USER_ERROR ) ; } if ( false === is_numeric ( $ max ) ) { retu... | Set the min . and max . number to iterate . The min will increase by the steps and can be formatted with the round parameter |
56,742 | protected function getProperty ( $ object , $ name ) { $ class = new \ ReflectionClass ( $ object ) ; while ( ! $ class -> hasProperty ( $ name ) ) { $ class = $ class -> getParentClass ( ) ; } return $ class -> getProperty ( $ name ) ; } | Returns the reflected property . |
56,743 | public function onPostAutoloadDump ( Event $ event ) { $ this -> io -> writeError ( '<info>Generating extensions files</info>' ) ; foreach ( $ this -> getPackages ( ) as $ package ) { if ( $ package instanceof \ Composer \ Package \ CompletePackageInterface ) { $ this -> processPackage ( $ package ) ; } } $ this -> pro... | Simply rewrites extensions file from scratch . |
56,744 | public function processPackage ( PackageInterface $ package ) { $ extra = $ package -> getExtra ( ) ; $ files = isset ( $ extra [ self :: EXTRA_OPTION_NAME ] ) ? $ extra [ self :: EXTRA_OPTION_NAME ] : null ; if ( $ package -> getType ( ) !== self :: PACKAGE_TYPE && is_null ( $ files ) ) { return ; } $ extension = [ 'n... | Scans the given package and collects extensions data . |
56,745 | protected function readExtensionConfig ( PackageInterface $ package , $ file ) { $ path = $ this -> preparePath ( $ package , $ file ) ; if ( ! file_exists ( $ path ) ) { $ this -> io -> writeError ( '<error>Non existent extension config file</error> ' . $ file . ' in ' . $ package -> getName ( ) ) ; exit ( 1 ) ; } ret... | Read extra config . |
56,746 | public function getGroup ( ) { $ groupTable = CmnTables :: getTableName ( CmnTables :: TABLE_GROUP ) ; return $ this -> hasOne ( Group :: class , [ 'id' => 'groupId' ] ) -> from ( "$groupTable group" ) ; } | Returns the corresponding group . |
56,747 | public function saveValuelist ( $ slug , $ postValues ) { $ valuelistObject = ValuelistFactory :: createValuelistFromPostValues ( $ postValues ) ; $ valuelists = $ this -> repository -> valuelists ; foreach ( $ valuelists as $ key => $ valuelist ) { if ( $ valuelist -> slug == $ slug ) { $ valuelists [ $ key ] = $ valu... | Save changes to a valuelist |
56,748 | public function getValuelistBySlug ( $ slug ) { $ valuelists = $ this -> repository -> valuelists ; foreach ( $ valuelists as $ valuelist ) { if ( $ valuelist -> slug == $ slug ) { return $ valuelist ; } } return null ; } | Get a valuelist by its slug |
56,749 | public function resetConfirmationAction ( $ uuid ) { $ em = $ this -> container -> get ( "doctrine" ) -> getEntityManager ( ) ; $ request = $ this -> container -> get ( "request" ) ; $ confirm_data = $ request -> get ( "haven_bundle_securitybundle_confirmtype" ) ; $ user_reset = $ em -> getRepository ( "HavenSecurityBu... | reset confirmation by the user |
56,750 | public function get ( $ key , $ default = null ) { $ this -> check ( ) ; $ value = $ this -> readValue ( $ key ) ; return is_null ( $ value ) ? $ default : $ value ; } | Get value from storage |
56,751 | public function has ( $ key ) { $ this -> check ( ) ; $ data = $ this -> readData ( ) ; return isset ( $ data [ $ key ] ) ; } | Check if storage has given key |
56,752 | public function destroy ( ) { if ( false === shmop_delete ( $ this -> shm ) ) { throw new RuntimeException ( sprintf ( 'Unable to destroy shared memory segment id: %s' , $ this -> shm ) ) ; } $ this -> destroyed = true ; } | Destroy shared memory segment |
56,753 | protected function setupSegment ( ) { $ this -> shm = @ shmop_open ( $ this -> getIdentifier ( ) , self :: SHM_OPEN_MODE , 0 , 0 ) ; if ( false === $ this -> shm ) { $ this -> createSegment ( ) ; } } | Create or open shared memory segment using current key |
56,754 | protected function createSegment ( ) { $ this -> shm = shmop_open ( $ this -> getIdentifier ( ) , self :: SHM_CREATE_MODE , self :: SHM_CREATE_PERMISSIONS , $ this -> size ) ; if ( false === $ this -> shm ) { throw new RuntimeException ( sprintf ( 'Unable to create shared memory segment with key: %s' , $ this -> getIde... | Create new shm segment and write base meta data |
56,755 | protected function updateSize ( $ size ) { $ size = sprintf ( '%' . self :: SHM_DATA_OFFSET . 'd' , intval ( $ size ) ) ; return ! ! $ this -> write ( 0 , $ size ) ; } | Update size field |
56,756 | protected function writeValue ( $ key , $ value ) { $ data = $ this -> readData ( ) ; $ data [ $ key ] = $ this -> encode ( $ value ) ; if ( $ this -> writeData ( $ data ) ) { return $ value ; } return false ; } | Write value to shm segment |
56,757 | protected function unsetValue ( $ key ) { $ data = $ this -> readData ( ) ; unset ( $ data [ $ key ] ) ; return $ this -> writeData ( $ data ) ; } | Removes item from storage |
56,758 | protected function readValue ( $ key ) { $ data = $ this -> readData ( ) ; return isset ( $ data [ $ key ] ) ? $ this -> decode ( $ data [ $ key ] ) : null ; } | Read value from shm segment |
56,759 | protected function writeData ( array $ data ) { $ size = $ this -> write ( self :: SHM_DATA_OFFSET , json_encode ( $ data ) ) ; return $ this -> updateSize ( $ size ) ; } | Write data to shm segment |
56,760 | protected function readData ( ) { $ used = $ this -> readSize ( ) ; return 0 === $ used ? array ( ) : json_decode ( $ this -> read ( self :: SHM_DATA_OFFSET , $ used ) , true ) ; } | Read data from shm segment |
56,761 | protected function encode ( $ val ) { switch ( true ) { case is_array ( $ val ) : return self :: T_ARRAY . json_encode ( $ val ) ; case is_int ( $ val ) : return self :: T_INT . $ val ; case is_bool ( $ val ) : return self :: T_BOOLEAN . $ val ; case is_float ( $ val ) : return self :: T_DOUBLE . $ val ; case is_object... | Serialize value with type prefix |
56,762 | protected function decode ( $ encoded ) { $ val = substr ( $ encoded , 1 ) ; switch ( $ encoded [ 0 ] ) { case self :: T_ARRAY : return json_decode ( $ val , true ) ; case self :: T_INT : return intval ( $ val ) ; case self :: T_BOOLEAN : return ! ! $ val ; case self :: T_DOUBLE : return floatval ( $ val ) ; case self ... | Unserialize value from storage |
56,763 | public function getTwilioConfig ( $ connection = 'twilio' ) { $ twilioconfig = config ( 'twilio.twilio' ) ; $ configSettings = [ ] ; $ configSettings [ 'sid' ] = $ twilioconfig [ 'connections' ] [ $ connection ] [ 'sid' ] ; $ configSettings [ 'token' ] = $ twilioconfig [ 'connections' ] [ $ connection ] [ 'token' ] ; $... | Get the Twilio config settings from the laravel - twilio package |
56,764 | public function watermarkDimensionCoords ( ) { $ watermarkInfo = $ this -> getWatermarkInfo ( ) ; $ imageInfo = $ this -> getImageInfo ( ) ; switch ( $ this -> getType ( ) ) : case self :: WATERMARK_TYPE_FULLWIDTH : default : $ resizedWatermarkWidth = number_format ( $ imageInfo [ 'width' ] , 0 , ',' , '' ) ; $ resized... | Get watermark type dimension from a type |
56,765 | public function setWatermarkTmpDir ( $ watermarkTmpDir ) { $ watermarkTmpDirCopy = $ watermarkTmpDir ; $ watermarkTmpDir = realpath ( $ watermarkTmpDir ) ; if ( empty ( $ watermarkTmpDir ) ) { throw new \ RuntimeException ( "Watermark directory is empty. This can be due to the provided directory '" . $ watermarkTmpDirC... | Set the watermark directory |
56,766 | private function check_type ( ) { $ this_class = new \ ReflectionClass ( $ this ) ; $ type = $ this_class -> getShortName ( ) ; if ( $ type == 'Thing' ) { $ type = $ this -> get_type ( ) ; unset ( $ this -> type ) ; } if ( ! is_null ( $ this -> realType ) ) { $ type = $ this -> realType ; unset ( $ this -> realType ) ;... | In most cases the name of the object withing json - ld markup will be the class name . |
56,767 | public function format ( ) { $ result = array ( ) ; $ result [ "@type" ] = $ this -> check_type ( ) ; $ values = array_filter ( get_object_vars ( $ this ) ) ; foreach ( $ values as $ key => $ value ) { if ( $ value instanceof ICanBecomeJSONLD ) { $ formatted = $ value -> format ( ) ; if ( ! empty ( $ formatted ) ) { $ ... | Creates an array of schema . org attribute ready to be json encoded . |
56,768 | protected function addPotentialAction ( ) { $ class = static :: $ helper -> get_search_action_type ( ) ; if ( class_exists ( $ class ) ) { $ class_test = new \ ReflectionClass ( $ class ) ; if ( $ class_test -> implementsInterface ( 'Lti\Seo\Generators\ICanSearch' ) ) { $ this -> potentialAction = new $ class ( static ... | Adds a search potential action if the website supports it . |
56,769 | private function charCodeAt ( $ str , $ index ) { $ char = mb_substr ( $ str , $ index , 1 , 'UTF-8' ) ; if ( mb_check_encoding ( $ char , 'UTF-8' ) ) { $ ret = mb_convert_encoding ( $ char , 'UTF-32BE' , 'UTF-8' ) ; $ result = hexdec ( bin2hex ( $ ret ) ) ; return $ result ; } return ; } | Get the Unicode of the character at the specified index in a string . |
56,770 | public function getTarget ( ) { if ( $ this -> to === NULL && $ this -> options | self :: TYPE_IMPLEMENTATION ) { return $ this -> typeName ; } return $ this -> to ; } | Get the target of this binding eighter a string or a closure . |
56,771 | public function getMarkers ( $ marker = NULL ) { if ( $ marker !== NULL && $ this -> markers !== NULL ) { $ result = [ ] ; foreach ( $ this -> markers as $ check ) { if ( $ check instanceof $ marker ) { $ result [ ] = $ check ; } } return $ result ; } return ( array ) $ this -> markers ; } | Get all markers being set for this binding . |
56,772 | public function toAlias ( $ typeName ) { $ this -> options = self :: TYPE_ALIAS ; $ this -> to = ( string ) $ typeName ; return $ this ; } | Bind to another binding specified by name . |
56,773 | public function scoped ( Scope $ scope ) { if ( $ scope instanceof Dependent ) { $ this -> scope = NULL ; } else { $ this -> scope = get_class ( $ scope ) ; } return $ this ; } | Set the scope of the binding according to the binary value of the scope . |
56,774 | public function isMarked ( $ marker ) { if ( empty ( $ this -> markers ) ) { return false ; } if ( $ marker instanceof \ ReflectionClass ) { foreach ( $ this -> markers as $ check ) { if ( $ marker -> isInstance ( $ check ) ) { return true ; } } } elseif ( $ marker instanceof Marker ) { foreach ( $ this -> markers as $... | Check if the binding has a marker of the given type . |
56,775 | public function decorate ( \ Closure $ decorator , $ priority = 0 ) { $ this -> decorators -> insert ( $ decorator , $ priority ) ; return $ this ; } | Register a decorator with this binding . |
56,776 | public function getInitializers ( ) { $ initializers = $ this -> initializers ; foreach ( clone $ this -> decorators as $ decorator ) { $ initializers [ ] = $ decorator ; } return $ initializers ; } | Get all custom initializers of this binding . |
56,777 | public static function loadAverage ( ) { $ load = 0 ; if ( stristr ( PHP_OS , 'win' ) ) { $ cmd = "wmic cpu get loadpercentage /all" ; @ exec ( $ cmd , $ output ) ; if ( $ output ) { foreach ( $ output as $ line ) { if ( $ line && preg_match ( "/^[0-9]+\$/" , $ line ) ) { $ load = $ line ; break ; } } } } else { $ sys_... | Get load average in percents . |
56,778 | protected function getLocalizedFileReference ( string $ table , string $ field ) { if ( $ this -> getSysLanguageUid ( ) > 0 ) { $ localizedFileReferences = $ this -> getLocalizedFileReferences ( $ table , $ field ) ; if ( ! empty ( $ localizedFileReferences ) ) { $ localizedFileObject = $ localizedFileReferences [ 0 ] ... | Gets a localized file reference . |
56,779 | protected function getLocalizedFileReferences ( string $ table , string $ field ) { if ( $ this -> getSysLanguageUid ( ) > 0 ) { return $ this -> fileRepository -> findByRelation ( $ table , $ field , $ this -> getLocalizedUid ( ) ) ; } return null ; } | Gets localized file references . |
56,780 | protected function printp ( $ input , $ indent = 0 ) { $ input = trim ( $ input , "\n\t\r " ) ; $ indentation = str_repeat ( ' ' , $ indent ) ; $ this -> cli -> printf ( $ indentation . wordwrap ( str_replace ( "\n" , "\n$indentation" , $ input ) , 75 - $ indent , "\n$indentation" ) . "\n" ) ; } | Print paragraph . Anything passed will be trimmed and printed so as to fit in the limit of 75 characters per line . |
56,781 | private function createNewPost ( ) { if ( ! $ this -> user -> role -> hasPermission ( 'create' ) ) throw new CHttpException ( 403 , Yii :: t ( 'Api.content' , 'You do not have permission to create new entries.' ) ) ; $ model = new Content ; $ model -> populate ( $ _POST ) ; if ( $ model -> savePrototype ( $ this -> use... | Creates a new entry |
56,782 | private function updatePost ( $ id ) { $ model = $ this -> loadModel ( $ id ) ; if ( ! $ this -> user -> role -> hasPermission ( 'modify' ) ) throw new CHttpException ( 403 , Yii :: t ( 'Api.content' , 'You do not have permission to create new entries.' ) ) ; if ( $ this -> user -> role -> isA ( 'author' ) || $ this ->... | Updates an existing entry |
56,783 | private function loadModel ( $ id = NULL ) { if ( $ id === NULL ) throw new CHttpException ( 400 , Yii :: t ( 'Api.content' , 'Missing id' ) ) ; $ model = Content :: model ( ) -> findByPk ( $ id ) ; if ( $ model === NULL ) throw new CHttpException ( 404 , Yii :: t ( 'Api.content' , 'An entry with the id of {{id}} was n... | Retrieves the model |
56,784 | public function actionUploadImagePost ( $ id = NULL , $ promote = 0 ) { $ result = new CiiFileUpload ( $ id , $ promote ) ; return $ result -> uploadFile ( ) ; } | Uploads a video to the site . |
56,785 | public function transform ( $ array ) { if ( null === $ array ) { return '' ; } if ( ! is_array ( $ array ) ) { throw new TransformationFailedException ( 'Expected an array.' ) ; } foreach ( $ array as & $ value ) { $ value = sprintf ( '%s%s%s' , str_repeat ( ' ' , $ this -> paddingLeft ) , $ value , str_repeat ( ' ' ,... | Transforms an array into a delimited string |
56,786 | public function reverseTransform ( $ string ) { if ( null !== $ string && ! is_string ( $ string ) ) { throw new TransformationFailedException ( 'Expected a string.' ) ; } $ string = trim ( $ string ) ; if ( empty ( $ string ) ) { return array ( ) ; } $ values = explode ( $ this -> delimiter , $ string ) ; if ( 0 === c... | Transforms a delimited string into an array |
56,787 | public function getPermission ( $ code ) { if ( ! isset ( $ this -> permissions [ $ code ] ) ) { throw new Exceptions \ PermissionNotDefinedException ( $ this , $ code ) ; } return $ this -> permissions [ $ code ] ; } | Retrieve a permission name given code . |
56,788 | private function getObjectPropertiesValues ( $ object ) { $ properties = Core :: get ( ) -> getGettablePropertiesOfObject ( $ object ) ; $ finalProperties = [ ] ; foreach ( $ properties as $ property ) { $ finalProperties [ $ property ] = Core :: get ( ) -> getObjectService ( ) -> getObjectProperty ( $ object , $ prope... | Will return all the accessible properties of the given object instance . |
56,789 | protected function invokeStandardCommands ( ) { return $ this -> addCommand ( 'help' , __NAMESPACE__ . '\\Command\\Help' , 'Show this help' ) -> addCommand ( 'list' , __NAMESPACE__ . '\\Command\\ListCommands' , 'List all commands' ) -> addCommand ( 'init' , __NAMESPACE__ . '\\Command\\Init' , 'Create/update user-define... | Invoke standard commands |
56,790 | protected function invokeStandardOptions ( ) { return $ this -> addOption ( 'c' , 'config' , self :: OPTION_NOT_REQUIRED ) -> addOption ( 'h' , 'help' , self :: NO_VALUE ) -> addOption ( null , 'no-colors' , self :: NO_VALUE ) -> addOption ( 'q' , 'quiet' , self :: NO_VALUE ) -> addOption ( 'v' , 'verbose' , self :: NO... | Invoke standard options |
56,791 | protected function invokeLogging ( ) { $ this -> config [ 'log' ] = [ 'colorize' => true , 'verbosity' => Log :: ALL | ~ Log :: DEBUG ] ; $ this -> log = new Log ( ) ; return $ this ; } | Initialize logger with default values |
56,792 | public function addConfigFile ( $ file , $ force = false ) { $ settings = JSONFile :: read ( $ file , $ force ) ; $ this -> addConfigSettings ( $ settings ) ; return $ this ; } | Parse a JSON file and add its content to the configuration settings |
56,793 | public function addConfigSettings ( array $ settings ) { $ this -> config = $ this -> arrayMergeRecursiveOverwrite ( $ this -> config , $ settings ) ; return $ this ; } | Add configuration settings |
56,794 | protected function satisfyUserChoice ( ) { if ( array_key_exists ( 'version' , $ this -> config [ 'options' ] ) ) { $ this -> executeCommand ( 'version' ) ; $ this -> close ( ) ; } if ( count ( $ this -> config [ 'args' ] ) === 2 && array_key_exists ( 'v' , $ this -> config [ 'options' ] ) ) { $ this -> executeCommand ... | Try to find out what the user wants |
56,795 | protected function parseArguments ( ) { $ this -> config [ 'arguments' ] = [ ] ; $ commandFound = false ; for ( $ index = 0 ; $ index < count ( $ this -> config [ 'args' ] ) ; $ index ++ ) { if ( $ index === 0 ) { continue ; } $ arg = $ this -> config [ 'args' ] [ $ index ] ; if ( array_key_exists ( $ arg , $ this -> c... | Parse given arguments |
56,796 | protected function loadAdditionalConfigFiles ( ) { $ additionalConfigFiles = [ ] ; foreach ( $ this -> config [ 'options' ] as $ option => $ value ) { if ( in_array ( $ option , [ 'c' , 'config' ] ) ) { switch ( gettype ( $ value ) ) { case 'string' : $ additionalConfigFiles [ ] = $ value ; break ; case 'array' : forea... | Parse additional configuration files given as options |
56,797 | protected function addRuntimeSettings ( ) { $ newSettings = [ ] ; foreach ( $ this -> config [ 'options' ] as $ option => $ value ) { if ( in_array ( $ option , [ 's' , 'setting' ] ) ) { switch ( gettype ( $ value ) ) { case 'string' : $ newSettings [ ] = $ value ; break ; case 'array' : foreach ( $ value as $ item ) {... | Look for additional configuration settings given as options |
56,798 | protected function buildSettings ( $ keys , $ value ) { $ result = [ ] ; $ index = array_shift ( $ keys ) ; if ( ! isset ( $ keys [ 0 ] ) ) { $ result [ $ index ] = $ value ; } else { $ result [ $ index ] = $ this -> buildSettings ( $ keys , $ value ) ; } return $ result ; } | Create associative array for settings |
56,799 | protected function configureLogger ( ) { $ appNoColor = strtoupper ( $ this -> config [ 'composer' ] [ 'extra' ] [ 'name' ] ) . '_NOCOLOR' ; if ( array_key_exists ( 'no-colors' , $ this -> config [ 'options' ] ) || getenv ( 'NO_COLOR' ) !== false || getenv ( $ appNoColor ) !== false || ( function_exists ( 'posix_isatty... | Set color handling and verbosity for used logger |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.