idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
17,100 | public function decrement ( $ key , $ value , \ DatePeriod $ period = null ) { if ( is_null ( $ period ) ) { $ this -> repository -> decrement ( $ key , $ value ) ; } else { $ this -> decrementForPeriod ( $ key , $ value , $ period ) ; } } | Decrement value . |
17,101 | protected function decrementForPeriod ( $ key , $ value , \ DatePeriod $ period ) { $ ranges = $ this -> getRanges ( $ period ) ; if ( count ( $ ranges ) > 0 ) { foreach ( $ ranges as $ range ) { $ range instanceof DateRange ? $ this -> repository -> decrementForRange ( $ key , $ range -> getStartDate ( ) , $ range -> ... | Decrement value for a given period . |
17,102 | protected function removeForPeriod ( $ key , \ DatePeriod $ period ) { $ ranges = $ this -> getRanges ( $ period ) ; if ( count ( $ ranges ) > 0 ) { foreach ( $ ranges as $ range ) { $ range instanceof DateRange ? $ this -> repository -> removeForRange ( $ key , $ range -> getStartDate ( ) , $ range -> getEndDate ( ) )... | Remove value for a given period . |
17,103 | protected function getRanges ( \ DatePeriod $ period ) { $ ranges = array ( ) ; $ start = null ; $ end = null ; $ single = true ; foreach ( $ period as $ i => $ date ) { $ ranges [ $ i ] = $ date ; if ( $ i > 0 ) { $ ranges [ $ i - 1 ] = new DateRange ( $ ranges [ $ i - 1 ] , $ date ) ; $ single = false ; } } if ( ! $ ... | Generate date ranges from given period . |
17,104 | public function prepareFileUploadRequest ( array $ files , $ relativePath = null , array $ data = [ ] , array $ query = [ ] ) { $ request = $ this -> prepareRequest ( 'POST' , $ relativePath , [ ] , $ query ) ; $ request -> getHeaders ( ) -> removeHeader ( $ request -> getHeaders ( ) -> get ( 'Content-Type' ) ) ; $ thi... | Prepare a POST request for uploading files |
17,105 | public function registerMiddleware ( Router $ router ) { foreach ( $ this -> middleware as $ module => $ middlewares ) { foreach ( $ middlewares as $ name => $ middleware ) { $ class = "Modules\\{$module}\\Http\\Middleware\\{$middleware}" ; $ router -> middleware ( $ name , $ class ) ; } } } | Register the filters . |
17,106 | private function registerModulePermissions ( ) { foreach ( $ this -> app [ 'modules' ] -> enabled ( ) as $ module ) { if ( $ this -> app [ 'society.isInstalled' ] ) { $ permissionManager = new PermissionManager ( ) ; $ permissionManager -> registerDefault ( $ module ) ; } } } | Register the modules dependencies . |
17,107 | private function registerBindings ( ) { $ this -> app -> bind ( 'society.isInstalled' , function ( $ app ) { return file_exists ( base_path ( '.env' ) ) && file_exists ( storage_path ( 'app/installed' ) ) && Schema :: hasTable ( 'migrations' ) ; } ) ; } | Register general App - Bindings . |
17,108 | protected function unmarkedText ( $ text ) { $ newText = "" ; if ( $ this -> breaksEnabled ) { $ parts = mb_split ( '[ ]*\n' , $ text ) ; } else { $ parts = mb_split ( '(?:[ ][ ]+|[ ]*\\\\)\n' , $ text ) ; } foreach ( $ parts as $ index => & $ part ) { if ( $ index > 0 ) { $ newText .= "<br />\n" ; } $ part = mb_ereg_r... | Inject span tags for each line to indicate direction . |
17,109 | public function scan ( $ count = 50 , $ min = 0 , $ max = 0 , $ rate = 0 ) { $ iterator = new QScanIterator ( $ this -> stream , $ this -> log ) ; $ iterator -> setCount ( $ count ) -> setMin ( $ min ) -> setMax ( $ max ) -> setRate ( $ rate ) ; return $ iterator ; } | Scan all existing queues . |
17,110 | static private function getTextBackTrace ( $ backtrace ) { $ str = '' ; foreach ( $ backtrace as $ step ) { if ( $ step [ 'function' ] != 'getTextBackTrace' && $ step [ 'function' ] != 'handle_error' ) { if ( isset ( $ step [ 'file' ] ) && isset ( $ step [ 'line' ] ) ) { $ str .= "In " . $ step [ 'file' ] . " at line "... | Returns the Exception Backtrace as a text string . |
17,111 | private function add_to_po ( $ string ) { $ this -> strings [ $ string ] = '' ; $ current_strings = Util :: load ( Config :: $ po_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.po' ) ; $ untranslated = [ $ string => '' ] ; $ strings = array_merge ( $ untranslated , $ current_s... | Add a string to the po file |
17,112 | private function reload_po_file ( ) { $ po_files = [ ] ; $ po_files [ ] = Config :: $ po_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.po' ; $ packages = \ Skeleton \ Core \ Package :: get_all ( ) ; foreach ( $ packages as $ package ) { if ( file_exists ( Config :: $ po_direc... | Read the po files |
17,113 | private function load_strings ( ) { if ( file_exists ( Config :: $ cache_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.php' ) ) { require Config :: $ cache_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.php' ; $ this -> strings = $ s... | Load the strings |
17,114 | public static function get ( LanguageInterface $ language = null , $ application_name = null ) { if ( ! isset ( self :: $ translation [ $ language -> name_short ] ) OR self :: $ translation [ $ language -> name_short ] -> application_name != $ application_name ) { self :: $ translation [ $ language -> name_short ] = ne... | Get a translation object |
17,115 | public static function translate_plural ( $ string , Translation $ translation = null ) { if ( $ translation !== null ) { $ translation = self :: get ( $ translation -> language , $ translation -> application_name ) ; } else { $ translation = self :: get ( ) ; } return $ translation -> translate_string ( $ string ) ; } | Translate a plural string |
17,116 | protected function setTranslationForMessageFromService ( $ selfEdit , $ msgInstanceName , $ key , $ label , $ language , $ delete ) { if ( $ delete ) { $ translationService = new InstanceProxy ( $ msgInstanceName , $ selfEdit ) ; return $ translationService -> deleteMessage ( $ key , $ language ) ; } else { $ translati... | Saves the translation for one key and one language using CURL . |
17,117 | public function autoNewCol ( int $ nbColForThisCell = 1 , array $ classes = [ ] , array $ attrs = [ ] ) : string { ! $ this -> autoStarted && $ this -> autoStart ( ) ; $ src = '' ; $ this -> status === self :: STATUS_IN_CELL && $ src .= $ this -> endCell ( ) ; $ this -> status === self :: STATUS_OK && $ src .= $ this -... | To call before each data cell |
17,118 | public function autoStop ( ) : string { $ src = '' ; $ this -> status === self :: STATUS_IN_CELL && $ src .= $ this -> endCell ( ) ; $ this -> status === self :: STATUS_IN_ROW && $ src .= $ this -> endRow ( ) ; $ this -> status === self :: STATUS_IN_CONTAINER && $ src .= $ this -> endContainer ( $ this -> autoContainer... | To call at the end of your grid |
17,119 | public function auto ( array $ cellsData , int $ nbColsByRow = null , bool $ container = false , array $ classes = [ ] , array $ attrs = [ ] , array $ containerClasses = [ ] , bool $ fluid = true ) : string { $ nbColsByRow = $ nbColsByRow ?? count ( $ cellsData ) ; $ src = $ this -> autoStart ( $ nbColsByRow , $ contai... | Decorate automatically an array of strings with a grid |
17,120 | public function addSMIME ( string $ certificate , string $ privateKey ) : void { $ signer = new SMIMESigner ( ) ; $ signer -> certificate = $ certificate ; $ signer -> privateKey = $ privateKey ; $ this -> set ( $ signer ) ; } | Add a SMIME signer . |
17,121 | public function addDKIM ( string $ privateKey , string $ domain , string $ selector ) : void { $ signer = new DKIMSigner ( ) ; $ signer -> privateKey = $ privateKey ; $ signer -> domain = $ domain ; $ signer -> selector = $ selector ; $ this -> set ( $ signer ) ; } | Add a DKIM signer . |
17,122 | public static function getStandard ( ) { if ( self :: $ standard === null ) { $ cn = self :: $ standardCN ; if ( ! class_exists ( $ cn , true ) ) { throw new \ LogicException ( 'The standard FS implementation not installed' ) ; } if ( ! is_subclass_of ( $ cn , self :: $ interface ) ) { throw new \ LogicException ( 'OMG... | Returns the standard implementation |
17,123 | public function arg ( string $ arg ) : ProcessBuilder { if ( $ arg === '' ) { return $ this ; } $ this -> arguments [ ] = $ arg ; return $ this ; } | Adds an argument |
17,124 | public function option ( string $ option , ? string $ value = null ) : ProcessBuilder { if ( $ option === '' ) { return $ this ; } if ( strpos ( $ option , '-' ) !== 0 ) { $ option = sprintf ( '--%s' , $ option ) ; } $ this -> arguments [ ] = $ option ; if ( $ value !== null ) { $ this -> arguments [ ] = $ value ; } re... | Adds an option |
17,125 | public function input ( $ input ) : ProcessBuilder { if ( $ input === null ) { $ this -> input = null ; return $ this ; } if ( is_resource ( $ input ) ) { $ this -> input = $ input ; return $ this ; } if ( is_scalar ( $ input ) ) { $ this -> input = ( string ) $ input ; } return $ this ; } | Sets the input |
17,126 | public function timeout ( $ timeout ) : ProcessBuilder { if ( $ timeout === null ) { $ this -> timeout = null ; return $ this ; } $ timeout = ( float ) $ timeout ; if ( $ timeout < 0 ) { throw new DomainException ( 'Timeout must be a positive number' ) ; } $ this -> timeout = $ timeout ; return $ this ; } | Sets the timeout in seconds |
17,127 | public function setEnv ( string $ name , ? string $ value = null ) : ProcessBuilder { $ this -> environment [ $ name ] = $ value ; return $ this ; } | Sets an environment variable |
17,128 | public function getProcess ( ) : Process { if ( count ( $ this -> prefix ) === 0 && count ( $ this -> arguments ) === 0 ) { throw new MethodCallException ( 'You must add arguments before calling getProcess()' ) ; } $ arguments = array_merge ( $ this -> prefix , $ this -> arguments ) ; $ command = implode ( ' ' , array_... | Creates a Process instance |
17,129 | protected function fillAttributes ( $ resource , array $ attributes ) { foreach ( $ attributes as $ attribute => $ value ) { $ setter = "set" . ucfirst ( $ attribute ) ; if ( method_exists ( $ resource , $ setter ) ) { $ resource -> $ setter ( $ value ) ; } } } | Sets all the properties on the entity . |
17,130 | public function postSubmit ( FormEvent $ event ) { $ image = $ event -> getData ( ) ; if ( $ image && $ image -> hasFile ( ) ) { $ image -> setPath ( null ) ; } } | Post form submit listener |
17,131 | public function resolve ( & $ toResolve ) { if ( $ this -> config_resolver instanceof ReferenceInterface ) { $ this -> config_resolver -> deReferenceArray ( $ toResolve ) ; } return $ this ; } | Resolving use the parameter resolver |
17,132 | public function hasService ( $ id = '' ) { $ sid = $ this -> getSectionId ( $ id ) ; if ( $ this -> has ( $ sid ) ) { return true ; } if ( $ this -> autoClassName ( $ id ) ) { return true ; } if ( $ this -> serviceTranslation ( $ id ) ) { return true ; } return false ; } | Autowiring support added |
17,133 | protected function autoClassName ( $ id ) { if ( $ this -> auto && class_exists ( $ id ) && $ this -> isWritable ( ) ) { return $ this -> setService ( $ id , $ id ) ; } return false ; } | Returns true if |
17,134 | protected function getRawConfig ( $ id ) { $ this -> config_resolver -> enableDeReference ( false ) ; $ data = $ this -> config_resolver -> get ( $ id ) ; $ this -> config_resolver -> enableDeReference ( true ) ; return $ data ; } | Get not - dereferenced config from config_resolver |
17,135 | public function set ( $ name , $ value = null ) { is_null ( $ name ) or \ Arr :: set ( $ this -> data , $ name , $ value ) ; return $ this ; } | set session variables |
17,136 | public function get ( $ name , $ default = null ) { if ( is_null ( $ name ) ) { return $ this -> data ; } return \ Arr :: get ( $ this -> data , $ name , $ default ) ; } | get session variables |
17,137 | public function key ( $ name = 'session_id' ) { return isset ( $ this -> keys [ $ name ] ) ? $ this -> keys [ $ name ] : false ; } | get session key variables |
17,138 | public function rotate ( $ force = true ) { if ( ! empty ( $ this -> keys ) ) { if ( $ force or ( $ this -> config [ 'rotation_time' ] and $ this -> keys [ 'created' ] + $ this -> config [ 'rotation_time' ] <= $ this -> time -> get_timestamp ( ) ) ) { $ this -> keys [ 'previous_id' ] = $ this -> keys [ 'session_id' ] ;... | force a session_id rotation |
17,139 | public function set_flash ( $ name , $ value ) { if ( strpos ( $ name , '.' ) !== false ) { $ keys = explode ( '.' , $ name , 2 ) ; $ name = array_shift ( $ keys ) ; } else { $ keys = false ; } if ( $ keys ) { if ( isset ( $ this -> flash [ $ this -> config [ 'flash_id' ] . '::' . $ name ] [ 'value' ] ) ) { $ this -> f... | set session flash variables |
17,140 | public function keep_flash ( $ name ) { if ( is_null ( $ name ) ) { foreach ( $ this -> flash as $ key => $ value ) { $ this -> flash [ $ key ] [ 'state' ] = 'new' ; } } elseif ( isset ( $ this -> flash [ $ this -> config [ 'flash_id' ] . '::' . $ name ] ) ) { $ this -> flash [ $ this -> config [ 'flash_id' ] . '::' . ... | keep session flash variables |
17,141 | public function delete_flash ( $ name ) { if ( is_null ( $ name ) ) { $ this -> flash = array ( ) ; } elseif ( isset ( $ this -> flash [ $ this -> config [ 'flash_id' ] . '::' . $ name ] ) ) { unset ( $ this -> flash [ $ this -> config [ 'flash_id' ] . '::' . $ name ] ) ; } return $ this ; } | delete session flash variables |
17,142 | public function get_config ( $ name ) { return isset ( $ this -> config [ $ name ] ) ? $ this -> config [ $ name ] : null ; } | get a runtime config value |
17,143 | public function set_config ( $ name , $ value = null ) { if ( isset ( $ this -> config [ $ name ] ) ) $ this -> config [ $ name ] = $ value ; return $ this ; } | set a runtime config value |
17,144 | protected function _cleanup_flash ( ) { foreach ( $ this -> flash as $ key => $ value ) { if ( $ value [ 'state' ] === 'expire' ) { unset ( $ this -> flash [ $ key ] ) ; } } } | removes flash variables marked as old |
17,145 | protected function _new_session_id ( ) { $ session_id = '' ; while ( strlen ( $ session_id ) < 32 ) { $ session_id .= mt_rand ( 0 , mt_getrandmax ( ) ) ; } return md5 ( uniqid ( $ session_id , TRUE ) ) ; } | generate a new session id |
17,146 | protected function _set_cookie ( $ payload = array ( ) ) { if ( $ this -> config [ 'enable_cookie' ] ) { $ payload = $ this -> _serialize ( $ payload ) ; $ this -> config [ 'encrypt_cookie' ] and $ payload = \ Crypt :: encode ( $ payload ) ; if ( strlen ( $ payload ) > 4000 ) { throw new \ FuelException ( 'The session ... | write a cookie |
17,147 | protected function _get_cookie ( ) { $ cookie = \ Input :: post ( $ this -> config [ 'post_cookie_name' ] , false ) ; if ( $ cookie === false ) { $ cookie = \ Cookie :: get ( $ this -> config [ 'cookie_name' ] , false ) ; } if ( $ cookie === false ) { $ cookie = \ Input :: headers ( $ this -> config [ 'http_header_name... | read a cookie |
17,148 | public function physicalClass ( $ translate = false ) { $ classes = $ this -> getSNMP ( ) -> walk1d ( self :: OID_ENTITY_PHYSICAL_CLASS ) ; if ( ! $ translate ) { return $ classes ; } return $ this -> getSNMP ( ) -> translate ( $ classes , self :: $ ENTITY_PHSYICAL_CLASS ) ; } | Returns an associate array of entPhysicalClass |
17,149 | public static function compare ( $ hash1 , $ hash2 ) : bool { if ( ! is_string ( $ hash1 ) ) { $ hash1 = ( string ) $ hash1 ; } if ( ! is_string ( $ hash2 ) ) { $ hash2 = ( string ) $ hash2 ; } return hash_equals ( $ hash1 , $ hash2 ) ; } | Compare to hashes . Minimize timing attacks . |
17,150 | public function scriptsMapAction ( ) { $ scriptsBuilder = $ this -> get ( 'phlexible_gui.asset.scripts_builder' ) ; $ asset = $ scriptsBuilder -> build ( ) ; return new BinaryFileResponse ( $ asset -> getMapAsset ( ) , 200 , array ( 'Content-Type' => 'application/json;charset=UTF-8' ) ) ; } | Output scripts map . |
17,151 | public function cssAction ( Request $ request ) { $ baseUrlContentFilter = $ this -> get ( 'phlexible_gui.asset.base_url_content_filter' ) ; $ baseUrlContentFilter -> setBasePath ( $ request -> getBasePath ( ) ) ; $ baseUrlContentFilter -> setBaseUrl ( $ request -> getBaseUrl ( ) ) ; $ cssBuilder = $ this -> get ( 'phl... | Output css . |
17,152 | public function cssMapAction ( Request $ request ) { $ baseUrlContentFilter = $ this -> get ( 'phlexible_gui.asset.base_url_content_filter' ) ; $ baseUrlContentFilter -> setBasePath ( $ request -> getBasePath ( ) ) ; $ baseUrlContentFilter -> setBaseUrl ( $ request -> getBaseUrl ( ) ) ; $ cssBuilder = $ this -> get ( '... | Output css map . |
17,153 | public function iconsAction ( Request $ request ) { $ iconsBuilder = $ this -> get ( 'phlexible_gui.asset.icons_builder' ) ; $ asset = $ iconsBuilder -> build ( $ request -> getBasePath ( ) ) ; return new BinaryFileResponse ( $ asset , 200 , array ( 'Content-Type' => 'text/css;charset=UTF-8' ) ) ; } | Output icon styles . |
17,154 | public function translationsAction ( Request $ request , $ language ) { $ translationBuilder = $ this -> get ( 'phlexible_gui.asset.translations_builder' ) ; $ asset = $ translationBuilder -> build ( $ language ) ; return new BinaryFileResponse ( $ asset , 200 , array ( 'Content-Type' => 'text/javascript;charset=UTF-8'... | Output translations . |
17,155 | public function getMessage ( int $ code ) : string { return $ this -> statusExists ( $ code ) ? $ this -> statuses [ $ code ] : self :: UNDEFINED_STATUS_MESSAGE ; } | Returns relevant status message if status exists Undefined Status is returned otherwise |
17,156 | public function executeFormUpdateRequest ( WebRequest $ request , Response $ response , Form $ form ) { $ responseData = array ( 'csrf' => $ form -> generateCsrfToken ( $ request ) ) ; if ( ! $ request -> hasParam ( 'form-extended-entity-select-query' ) ) { $ responseData [ 'data' ] = array ( ) ; $ response -> setOutpu... | Executes the form update request |
17,157 | public function indexAction ( ) { $ this -> layout ( 'jaztec-admin/layout' ) ; $ sm = $ this -> getServiceLocator ( ) ; $ bootstrap = $ sm -> get ( 'kjsencha.bootstrap' ) ; return $ bootstrap -> getViewModel ( ) ; } | Fires the ExtJs application . |
17,158 | public function & addControl ( $ control , $ name = '' , $ label = '' , $ value = '' , $ description = '' , $ unbound = false ) { $ string = new CamelCase ( $ control ) ; $ control = $ this -> factory -> create ( 'FormDesigner\Controls\\' . $ string -> camelize ( ) . 'Control' ) ; $ control -> setName ( $ name ) ; if (... | Creates a formcontrol and adds it by it s name to the controls list . |
17,159 | public function & addElement ( $ element , $ args = [ ] ) { $ element = $ this -> factory -> create ( $ element , $ args ) ; $ this -> elementFactory ( 'factory' , $ element ) ; return $ element ; } | Create an new html object and adds it as new FormElement |
17,160 | public function & addGroup ( $ unshift = false ) { $ group = $ this -> factory -> create ( 'FormDesigner\FormGroup' ) ; $ this -> elementFactory ( 'group' , $ group , $ unshift ) ; $ group -> injectFormDesigner ( $ this -> fd ) ; $ group -> injectParentGroup ( $ this ) ; return $ group ; } | Creates a new FormGroup objects and adds it as new FormElement |
17,161 | private function elementFactory ( $ type , $ content , $ unshift = false ) { $ element = $ this -> factory -> create ( 'FormDesigner\FormElement' ) ; $ element -> setContent ( $ content ) ; if ( $ unshift == true ) { array_unshift ( $ this -> elements , $ element ) ; } else { $ this -> elements [ ] = $ element ; } retu... | Factory mehtod to create new FormElement object within this group object . |
17,162 | public function getGoogleTracking ( ) { $ trackingCode = $ this -> settingManager -> getParameter ( 'google.tracking_code' ) ; if ( ! $ this -> debug && 0 < strlen ( $ trackingCode -> getPropertyId ( ) ) ) { $ domain = $ trackingCode -> getDomain ( ) ; if ( 0 === strlen ( $ domain ) ) { $ domain = 'auto' ; } if ( in_ar... | Renders the google analytics tracking code . |
17,163 | public function registerObject ( $ service , $ object ) { if ( ! is_object ( $ object ) ) { throw new ResolutionException ( "Service '$service' cannot be register as it's value is invalid" ) ; } $ this -> services [ $ service ] = function ( ) use ( $ object ) { return $ object ; } ; } | Registers an object with the container . |
17,164 | public function isValid ( $ value , Constraint $ constraint ) { $ document = $ this -> parseDocument ( $ value ) ; $ fields = $ this -> parseFields ( $ constraint -> fields ) ; $ caseInsensitive = $ this -> parseCaseInsensitive ( $ constraint -> caseInsensitive ) ; $ query = $ this -> createQuery ( $ document , $ field... | Validates the document uniqueness . |
17,165 | public function findAll ( ) { $ repos = array ( ) ; foreach ( $ this -> getRows ( ) as $ row ) { $ repo = $ this -> createNew ( ) ; $ repo -> setId ( $ row [ 'id' ] ) ; $ repo -> setSlug ( $ row [ 'slug' ] ) ; $ repo -> setType ( $ row [ 'type' ] ) ; $ repo -> setQualityBadgeHash ( $ row [ 'qualityBadgeHash' ] ) ; $ re... | Retrieve all repos |
17,166 | public function find ( $ id ) { foreach ( $ this -> findAll ( ) as $ repo ) { if ( $ id == $ repo -> getId ( ) ) { return $ repo ; } } return null ; } | Find repo by ID |
17,167 | public function findBySlug ( $ slug ) { foreach ( $ this -> findAll ( ) as $ repo ) { if ( $ slug == $ repo -> getSlug ( ) ) { return $ repo ; } } return null ; } | Find repo by Slug |
17,168 | public function writeJson ( $ path , array $ config ) { $ jsonFile = new JsonFile ( $ path ) ; $ jsonFile -> write ( $ this -> prepareConfig ( $ config ) ) ; } | Saves JSON config to the given path . |
17,169 | public function hasDependencies ( ) { foreach ( $ this -> dependencies as $ key ) { if ( isset ( $ this -> config [ $ key ] ) && $ this -> config [ $ key ] ) { return true ; } } return false ; } | Returns if the package manager has nonempty dependency list . |
17,170 | protected function perform ( $ action ) { $ this -> plugin -> io -> writeError ( 'running ' . $ this -> getBin ( ) ) ; if ( $ this -> passthru ( [ $ action ] ) ) { $ this -> plugin -> io -> writeError ( '<error>failed ' . $ this -> name . ' ' . $ action . '</error>' ) ; } } | Run installation . Specific for every package manager . |
17,171 | public function prepareCommand ( array $ arguments = [ ] ) { $ result = '' ; foreach ( $ arguments as $ a ) { $ result .= ' ' . escapeshellarg ( $ a ) ; } return $ result ; } | Prepares given command arguments . |
17,172 | public function getBin ( ) { if ( $ this -> bin === null ) { $ this -> bin = $ this -> detectBin ( ) ; } return $ this -> bin ; } | Get path to the binary executable file . |
17,173 | public function detectBin ( ) { $ pathes = [ static :: buildPath ( [ $ this -> plugin -> getVendorDir ( ) , 'bin' , $ this -> phpBin ] ) , static :: buildPath ( [ $ this -> plugin -> getComposer ( ) -> getConfig ( ) -> get ( 'home' ) , 'vendor' , 'bin' , $ this -> phpBin ] ) , ] ; foreach ( $ pathes as $ path ) { if ( ... | Find path to the binary . |
17,174 | public static function registerSingletonInstance ( $ instance ) { self :: verifyInstanceNotYetRegistered ( ) ; self :: verifyInstanceType ( $ instance ) ; self :: $ instance = $ instance ; } | Registers a specific instance of the class to use as the singleton instance |
17,175 | public function putValue ( $ field , $ value ) { $ this -> validateValue ( $ field , $ value ) ; $ this -> setValue ( $ field , $ value ) ; } | Validate field value and set it |
17,176 | public static function getEntityObject ( $ objType , $ objID = null ) { if ( is_object ( $ objType ) ) { $ objID = $ objType -> entity_id ; $ objType = $ objType -> entity_type ; } $ class = isset ( static :: $ entityClasses [ $ objType ] ) ? static :: $ entityClasses [ $ objType ] : $ objType ; return $ class :: load ... | Get entity instance by type and id |
17,177 | protected static function parseFieldValue ( $ name , $ value ) { $ field = static :: $ validator -> getField ( $ name ) ; if ( $ field ) { $ field -> getType ( ) -> parseValue ( $ field , $ value ) ; } return parent :: parseFieldValue ( $ name , $ value ) ; } | Parse the value from SQL scalar to PHP type |
17,178 | protected static function formatFieldValue ( $ name , $ value ) { $ field = static :: $ validator -> getField ( $ name ) ; if ( $ field ) { $ field -> getType ( ) -> formatValue ( $ field , $ value ) ; } return parent :: formatFieldValue ( $ name , $ value ) ; } | Format the value from PHP type to SQL scalar |
17,179 | public static function listKnownEntities ( ) { $ entities = array ( ) ; foreach ( static :: $ knownEntities as $ class => & $ state ) { if ( $ state == null ) { $ state = class_exists ( $ class , true ) && is_subclass_of ( $ class , 'Orpheus\EntityDescriptor\PermanentEntity' ) ; } if ( $ state === true ) { $ entities [... | List all known entities |
17,180 | public static function Append ( $ sName , $ sDirectory ) { $ oThis = self :: CreateInstanceIfNotExists ( ) ; if ( array_key_exists ( $ sName , $ oThis -> aModules ) ) { return $ oThis -> aModules [ $ sName ] ; } else { $ oModule = new Module ( $ sName , $ sDirectory ) ; $ oThis -> aModules [ $ sName ] = $ oModule ; ret... | Function to append a module |
17,181 | public static function buildFromDateTimeInterface ( DateTimeInterface $ date ) { $ parts = explode ( '|' , $ date -> format ( 'Z|I|T' ) ) ; return new static ( ( int ) $ parts [ 0 ] , ( bool ) $ parts [ 1 ] , $ parts [ 2 ] ) ; } | Instanciates a TimeOffset from a DateTimeInterface using the format method to extract properties . |
17,182 | public function buildTimeZone ( ) { if ( null !== $ this -> value ) { $ sign = $ this -> value < 0 ? '-' : '+' ; $ value = intval ( abs ( $ this -> value ) / 60 ) ; return new DateTimeZone ( sprintf ( '%s%02d:%02d' , $ sign , intval ( $ value / 60 ) , $ value % 60 ) ) ; } } | Build a DateTimeZone object based on TimeOffset properties if possible . |
17,183 | public function faceGetter ( $ needle ) { if ( $ needle instanceof \ Face \ Core \ EntityFaceElement ) { $ element = $ needle ; } else if ( is_string ( $ needle ) ) { if ( false !== strpos ( $ needle , "." ) ) { return ( new Navigator ( $ needle ) ) -> chainGet ( $ this ) ; } else { $ element = $ this -> getEntityFace ... | take the given element and use the right way for getting the value on this instance |
17,184 | public static function faceQueryBuilder ( Config $ config = null ) { if ( null == $ config ) { return new SelectBuilder ( self :: getEntityFace ( ) ) ; } else { return new SelectBuilder ( self :: getEntityFace ( $ config -> getFaceLoader ( ) ) ) ; } } | Shortcut to construct a FQuery |
17,185 | public static function faceQueryBy ( $ item , $ itemValue , $ pdo ) { if ( self :: getEntityFace ( ) -> getDirectElement ( $ item ) ) { $ fQuery = self :: faceQueryBuilder ( ) ; if ( is_array ( $ itemValue ) ) { $ fQuery -> whereIN ( "~$item" , $ itemValue ) ; } else { $ fQuery -> where ( "~$item=:itemValue" ) -> bindV... | Fast querying by only specifying one field |
17,186 | public static function queryString ( $ string , $ options = [ ] ) { $ joins = [ ] ; $ selectedColumns = [ ] ; $ qS = new \ Face \ Sql \ Query \ QueryString ( self :: getEntityFace ( ) , $ string , $ joins , $ selectedColumns ) ; return $ qS ; } | shortcut to create a |
17,187 | protected function loadAccessControlRulesForUOID ( $ gid , $ uoid ) { $ rules = array ( ) ; if ( $ gid == '28B6TE8T9NUO202C5NZIUTNQSP88E70B8JAWH4FQ58OJOB8LIF' && $ uoid == '4802C8DE6UZZ5BICQI830A8P8BW3YB5EBPGXWNRH1EP7H838V7:a9ddbc2102bf86d1' ) { $ rules [ ] = ( new AccessControlRuleObjectBuilder ( ) ) -> owner ( Sonic ... | for demonstration purposes only one rule is created for a specific data object for a specific user |
17,188 | public static function getParentClasses ( $ className ) { $ result = array ( ) ; $ class = new \ ReflectionClass ( $ className ) ; if ( false === $ class ) { return $ result ; } do { $ name = $ class -> getName ( ) ; $ result [ ] = $ name ; $ class = $ class -> getParentClass ( ) ; } while ( false !== $ class ) ; retur... | Get all class names of passed class |
17,189 | public function update ( $ structureID = 0 ) { foreach ( $ _POST as $ key => $ val ) { $ this [ $ key ] = $ val ; } $ this -> save ( ) ; if ( dbQuery ( '\samson\cms\web\navigation\CMSNav' ) -> id ( $ structureID ) -> first ( $ cmsnav ) ) { if ( ! dbQuery ( 'structurefield' ) -> StructureID ( $ cmsnav -> id ) -> FieldID... | Updating field and creating relation with structure |
17,190 | public function setCaptureType ( $ type ) { if ( $ type === static :: SET || $ type === static :: APPEND || $ type === static :: PREPEND ) { $ this -> captureType = $ type ; return $ this ; } throw new InvalidArgumentException ( sprintf ( 'Invalid capture type provided; must be any of the capture ' . 'type constants, "... | Sets the type of capture . |
17,191 | public function attach ( $ value , $ capture = null ) { if ( null === $ capture ) { $ capture = $ this -> captureType ; } switch ( $ capture ) { case self :: APPEND : $ this -> append ( $ value ) ; break ; case self :: PREPEND : $ this -> prepend ( $ value ) ; break ; case self :: SET : $ this -> set ( $ value ) ; brea... | Attaches the value . |
17,192 | public function captureStart ( $ type = null ) { if ( $ this -> captureStarted ) { throw new RuntimeException ( 'Capture is already started.' ) ; } if ( null !== $ type ) { $ this -> setCaptureType ( $ type ) ; } $ this -> captureStarted = true ; ob_start ( ) ; return $ this ; } | Starts the capture . |
17,193 | public function captureEnd ( array $ params = [ ] ) { if ( ! $ this -> captureStarted ) { throw new RuntimeException ( 'Capture has not been started.' ) ; } $ params [ 'capture' ] = ob_get_clean ( ) ; $ this -> attach ( $ params ) ; $ this -> captureStarted = false ; return $ this ; } | Ends the capture . |
17,194 | public function toString ( $ indent = null ) { $ indent = ( $ indent !== null ) ? $ this -> getWhitespace ( $ indent ) : $ this -> getIndent ( ) ; $ return = $ this -> prefix ; $ keys = array_keys ( $ this -> container ) ; $ lastIndex = end ( $ keys ) ; foreach ( $ this -> container as $ index => $ item ) { $ item = ar... | Renders the placeholder . |
17,195 | public static function getFirstValue ( $ arr ) { if ( count ( $ arr ) ) { if ( isset ( $ arr [ 0 ] ) ) { return $ arr [ 0 ] ; } else { $ keys = array_keys ( $ arr ) ; return $ arr [ $ keys [ 0 ] ] ; } } return null ; } | Returns the first value in a given array . |
17,196 | public static function matches ( $ keys = [ ] , $ array = [ ] ) : array { if ( ! empty ( $ keys ) && ! empty ( $ array ) ) { $ matchingProperties = [ ] ; foreach ( $ keys as $ property ) { if ( $ matchedAttribute = static :: getValue ( $ array , $ property ) ) { $ matchingProperties [ $ property ] = $ matchedAttribute ... | Finds matching values from two arrays |
17,197 | public function set ( $ path , $ value ) { $ old = null ; if ( $ nodes = explode ( '.' , $ path ) ) { $ node = $ this -> data ; for ( $ i = 0 , $ n = count ( $ nodes ) - 1 ; $ i < $ n ; $ i ++ ) { if ( ! isset ( $ node -> { $ nodes [ $ i ] } ) && ( $ i != $ n ) ) { $ node -> { $ nodes [ $ i ] } = new \ stdClass ; } $ n... | Set a registry value |
17,198 | protected function bindData ( & $ parent , $ data ) { if ( is_object ( $ data ) ) { $ data = get_object_vars ( $ data ) ; } else { $ data = ( array ) $ data ; } foreach ( $ data as $ k => $ v ) { if ( ( is_array ( $ v ) && ArrayHelper :: isAssociative ( $ v ) ) || is_object ( $ v ) ) { $ parent -> $ k = new \ stdClass ... | Recursively bind data to a parent object |
17,199 | protected function asArray ( $ data ) { $ array = [ ] ; foreach ( get_object_vars ( ( object ) $ data ) as $ k => $ v ) { if ( is_object ( $ v ) ) { $ array [ $ k ] = $ this -> asArray ( $ v ) ; } else { $ array [ $ k ] = $ v ; } } return $ array ; } | Recursively convert an object of data to an array . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.