idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
7,300 | function add ( $ other ) { if ( $ other instanceof self ) { $ this -> parts = array_merge ( $ this -> parts , $ other -> parts ) ; } else { $ this -> parts [ ] = $ other ; } } | Add another part to this range . |
7,301 | public function translate ( $ key , $ defaultValue = '' , $ locale = null ) { if ( $ locale === null ) { $ locale = $ this -> getlocale ( ) ; } if ( isset ( $ this -> translations [ $ locale ] [ $ key ] ) ) { return $ this -> translations [ $ locale ] [ $ key ] ; } return $ defaultValue ; } | Translate an identifier to specific value . |
7,302 | protected function readConfig ( ) { $ file = $ this -> path -> getConfigPath ( ) . '/translation.php' ; if ( file_exists ( $ file ) ) { $ config = require ( $ file ) ; if ( isset ( $ config [ 'translations' ] ) ) { $ this -> translations = $ config [ 'translations' ] ; } if ( isset ( $ config [ 'defaultLocale' ] ) ) { ... | Read configurations . |
7,303 | public function getQueueingCookie ( ) : ? QueueingFactory { if ( ! $ this -> hasQueueingCookie ( ) ) { $ this -> setQueueingCookie ( $ this -> getDefaultQueueingCookie ( ) ) ; } return $ this -> queueingCookie ; } | Get queueing cookie |
7,304 | private function buildRequestError ( PlugException $ e ) { $ data = $ e -> getResponse ( ) ? json_decode ( $ e -> getResponse ( ) -> getBody ( ) , true ) : [ 'error' => $ e -> getMessage ( ) ] ; $ message = isset ( $ data [ 'error' ] ) ? $ data [ 'error' ] : 'Server Error' ; $ status = $ e -> getResponse ( ) ? $ e -> g... | builds the error exception . |
7,305 | public function findNextEntry ( Entry $ entry ) { $ list = $ this -> findAfter ( $ entry , 1 ) ; if ( count ( $ list ) === 1 ) { return current ( $ list ) ; } return NULL ; } | Returns the element right after the given element |
7,306 | public function has ( $ class ) { if ( isset ( $ this -> singletons [ $ class ] ) ) { return true ; } if ( isset ( $ this -> aliases [ $ class ] ) ) { $ class = $ this -> aliases [ $ class ] ; } try { $ this -> getReflectionClass ( $ class ) ; } catch ( Exception $ e ) { return false ; } return true ; } | Check if the class is resolvable . |
7,307 | public function configMethod ( $ class , $ method , $ rules ) { foreach ( $ rules as $ param => $ rule ) { if ( ctype_upper ( $ param [ 0 ] ) && ( ! is_string ( $ rule ) && ! ( $ rule instanceof Closure ) ) ) { throw new InvalidRuleException ( "Type $param only allowed string or Closure as an extra rule." ) ; } } $ thi... | Configure method parameters of a class . |
7,308 | public function getMethod ( $ class , $ method , $ extraMappings = [ ] ) { if ( isset ( $ this -> aliases [ $ class ] ) ) { $ class = $ this -> aliases [ $ class ] ; } return [ $ this -> getSingleton ( $ class ) , $ this -> resolveArgs ( $ class , $ method , " when resolving method $class::$method" , $ extraMappings ) ... | Resolve a method for method injection . |
7,309 | public function getNewInstance ( $ class ) { if ( isset ( $ this -> aliases [ $ class ] ) ) { $ class = $ this -> aliases [ $ class ] ; } $ args = $ this -> resolveArgs ( $ class , '__construct' , " when constructing $class" ) ; if ( $ args ) { $ instance = new $ class ( ... $ args ) ; } else { $ instance = new $ class... | Construct an new instance of a class with its dependencies . |
7,310 | protected function getSingleton ( $ class ) { if ( isset ( $ this -> singletons [ $ class ] ) ) { return $ this -> singletons [ $ class ] ; } $ instance = $ this -> getNewInstance ( $ class ) ; $ this -> singletons [ $ class ] = $ instance ; return $ instance ; } | Get singleton of a class . |
7,311 | protected function getFactory ( $ class ) { if ( isset ( $ this -> factories [ $ class ] ) ) { return $ this -> factories [ $ class ] ; } $ factory = new $ class ( $ this ) ; $ this -> factories [ $ class ] = $ factory ; return $ factory ; } | Construct a factory instance and inject this container to the instance . |
7,312 | protected function getReflectionClass ( $ className ) { if ( isset ( $ this -> reflectionClasses [ $ className ] ) ) { return $ this -> reflectionClasses [ $ className ] ; } try { $ reflectionClass = new ReflectionClass ( $ className ) ; } catch ( ReflectionException $ e ) { throw new NotFoundException ( "Class $classN... | Create and cache a ReflectionClass . |
7,313 | protected function getReflectionMethod ( $ className , $ methodName = '__construct' ) { if ( isset ( $ this -> reflectionMethods [ $ className ] ) && array_key_exists ( $ methodName , $ this -> reflectionMethods [ $ className ] ) ) { return $ this -> reflectionMethods [ $ className ] [ $ methodName ] ; } try { $ reflec... | Create and cache a ReflectionMethod . |
7,314 | protected function resolveArgs ( $ className , $ methodName , $ errorMessageSuffix = '' , $ extraMappings = [ ] ) { $ reflectionMethod = $ this -> getReflectionMethod ( $ className , $ methodName ) ; if ( is_null ( $ reflectionMethod ) && $ methodName === '__construct' ) { return [ ] ; } $ extraMappings = ( array ) $ e... | Resolve parameters of ReflectionMethod . |
7,315 | public function setInput ( $ value ) { if ( stripos ( $ value , 'html>' ) === false ) { $ this -> input = '<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Title</title></head><body>' . $ value . '</body></html>' ; } else { $ this -> input = $ value ; } } | Ensure that HTML fragments are submitted as complete webpages . |
7,316 | public function setStatusMessage ( $ message ) { $ message = ( string ) trim ( $ message ) ; if ( $ message === '' ) { $ this -> statusMessage = $ this -> getStatusMessage ( ) ; } else { $ this -> statusMessage = $ message ; } return $ this ; } | Sets the HTTP response message |
7,317 | public function setErrorMessage ( $ message ) { switch ( gettype ( $ message ) ) { case 'string' : $ this -> errorMessage = trim ( $ message ) ; break ; case 'array' : $ this -> errorMessage = empty ( $ message ) ? '' : $ message ; break ; default : $ this -> errorMessage = '' ; break ; } return $ this ; } | Sets the error message |
7,318 | protected function setResponseHeaders ( array $ headers ) { $ this -> headers = [ ] ; $ this -> headers [ ] = 'HTTP/1.1 ' . $ this -> getStatusCode ( ) . ' ' . $ this -> getStatusText ( ) ; $ this -> headers [ 'Content-Type' ] = 'application/json' ; foreach ( $ headers as $ key => $ value ) { $ this -> headers [ $ key ... | Sets the response headers |
7,319 | protected function getSuccessResponse ( $ data , $ statusText , $ headers = [ ] ) { return $ this -> setStatusText ( $ this -> statusTexts [ $ statusText ] ) -> setStatusCode ( $ statusText ) -> setStatusMessage ( self :: SUCCESS_TEXT ) -> respondWithSuccessMessage ( $ data , $ headers ) ; } | Gets the success response |
7,320 | protected function getErrorResponse ( $ msg , $ errorCode , $ statusText , $ headers = [ ] ) { return $ this -> setStatusText ( $ this -> statusTexts [ $ statusText ] ) -> setStatusCode ( $ statusText ) -> setStatusMessage ( self :: ERROR_TEXT ) -> setErrorCode ( $ errorCode ) -> setErrorMessage ( $ msg ) -> respondWit... | Gets the error response |
7,321 | protected function respond ( $ data , $ headers = [ ] ) { $ this -> setResponseHeaders ( $ headers ) ; return response ( ) -> json ( $ data , $ this -> getStatusCode ( ) , $ this -> getResponseHeaders ( ) ) ; } | Returns JSON Encoded HTTP Reponse |
7,322 | public static function bootAppliesScopes ( ) { if ( SurveyorProvider :: isActive ( ) ) { $ repository = SurveyorProvider :: retrieve ( ) ; foreach ( $ repository [ 'scopes' ] as $ model => $ scopes ) { foreach ( $ scopes as $ scope ) { if ( get_called_class ( ) == $ model ) { static :: addGlobalScope ( new $ scope ( ) ... | Apply model global scopes given the current logged user profiles . |
7,323 | public function registerAssets ( ) { $ dirs = array ( 'css' , 'js' ) ; foreach ( $ this -> assets as $ key => $ files ) { if ( in_array ( $ key , $ dirs ) ) { $ files = is_array ( $ files ) ? $ files : array ( $ files ) ; foreach ( $ files as $ file ) { $ filePath = Foundation :: getAssetsPath ( ) . DIRECTORY_SEPARATOR... | Registers the assets . Makes sure the assets pre - existed on the published folder prior registration . |
7,324 | public static function display ( $ config = array ( ) ) { ob_start ( ) ; ob_implicit_flush ( false ) ; $ config [ 'class' ] = get_called_class ( ) ; $ widget = \ Yii :: createComponent ( $ config ) ; $ widget -> init ( ) ; $ widget -> run ( ) ; return ob_get_clean ( ) ; } | Ported from Yii2 widget s function . Creates a widget instance and runs it . We cannot use widget name as it conflicts with CBaseController component . |
7,325 | public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ pdfRenderer = $ serviceLocator -> get ( PdfRenderer :: class ) ; $ pdfStrategy = new PdfStrategy ( $ pdfRenderer ) ; return $ pdfStrategy ; } | Create and return the PDF view strategy |
7,326 | public function getArrayResponse ( ) { $ json = [ ] ; $ json [ 'jsonrpc' ] = '2.0' ; if ( $ this -> errorCode ) { $ json [ 'error' ] = [ ] ; $ json [ 'error' ] [ 'code' ] = $ this -> errorCode ; $ json [ 'error' ] [ 'message' ] = $ this -> errorMessage ; if ( ! empty ( $ this -> errorData ) ) { $ json [ 'error' ] [ 'da... | Return array response . |
7,327 | public function addColumn ( $ column , $ options ) { if ( is_string ( $ options ) ) { $ options = [ 'type' => $ options ] ; } $ options = $ options + [ 'field' => $ column , 'type' => '' , 'length' => '' , 'default' => '' , 'comment' => '' , 'charset' => '' , 'collate' => '' , 'null' => true , 'ai' => false , 'index' =... | Add a column to the table schema . |
7,328 | public function addColumns ( array $ columns ) { foreach ( $ columns as $ column => $ options ) { $ this -> addColumn ( $ column , $ options ) ; } return $ this ; } | Add multiple columns . Index is the column name the value is the array of options . |
7,329 | public function addForeign ( $ column , $ options = [ ] ) { if ( is_string ( $ options ) ) { $ options = [ 'references' => $ options ] ; } if ( empty ( $ options [ 'references' ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Foreign key for %s must reference an external table' , $ column ) ) ; } $ this -> _fore... | Add a foreign key for a column . Multiple foreign keys can exist so group by column . |
7,330 | public function addPrimary ( $ column , $ options = false ) { $ symbol = is_string ( $ options ) ? $ options : '' ; if ( empty ( $ this -> _primaryKey ) ) { $ this -> _primaryKey = [ 'constraint' => $ symbol , 'columns' => [ $ column ] ] ; } else { $ this -> _primaryKey [ 'columns' ] [ ] = $ column ; } return $ this ; ... | Add a primary key for a column . Only one primary key can exist . However multiple columns can exist in a primary key . |
7,331 | public function addUnique ( $ column , $ options = [ ] ) { $ symbol = '' ; $ index = $ column ; if ( is_array ( $ options ) ) { if ( isset ( $ options [ 'constraint' ] ) ) { $ symbol = $ options [ 'constraint' ] ; } if ( isset ( $ options [ 'index' ] ) ) { $ index = $ options [ 'index' ] ; } } else if ( is_string ( $ o... | Add a unique key for a column . Multiple unique keys can exist so group by index . |
7,332 | public function getColumn ( $ name ) { if ( $ this -> hasColumn ( $ name ) ) { return $ this -> _columns [ $ name ] ; } throw new MissingColumnException ( sprintf ( 'Repository column %s does not exist' , $ name ) ) ; } | Return column options by name . |
7,333 | public function getModel ( $ sModel ) { $ namespacedClass = $ this [ 'database.models_namespace' ] . '\\' . $ sModel ; if ( ! isset ( static :: $ models [ $ sModel ] ) ) { static :: $ models [ $ sModel ] = new $ namespacedClass ( $ this ) ; } return static :: $ models [ $ sModel ] ; } | Return the instance of specified model . |
7,334 | public function parse ( $ fm , array $ default = [ ] ) { $ pieces = [ ] ; $ parsed = [ ] ; $ regexp = '/^-{3}(?:\n|\r)(.+?)-{3}(.*)$/ms' ; if ( preg_match ( $ regexp , $ fm , $ pieces ) && $ yaml = $ pieces [ 1 ] ) { $ parsed = $ this -> yaml -> parse ( $ yaml , true ) ; if ( is_array ( $ parsed ) ) { $ parsed [ 'conte... | Parse a front matter file and return an array with its content |
7,335 | protected function fillDefault ( array $ parsed , array $ default = [ ] ) { foreach ( $ default as $ key => $ value ) { if ( ! isset ( $ parsed [ $ key ] ) ) { $ parsed [ $ key ] = $ value ; } } return $ parsed ; } | Add default value to key that are not defined in the front matter |
7,336 | public function setEntry ( Entry $ entry ) { $ entry -> setScriptEvents ( true ) -> checkId ( ) ; $ this -> entry = $ entry ; return $ this ; } | Set the Entry |
7,337 | protected function getEntrySubmitScriptText ( ) { $ url = $ this -> buildCompatibleUrl ( ) ; $ entryName = $ this -> entry -> getName ( ) ; $ link = Builder :: escapeText ( $ url . $ entryName . "=" ) ; return "declare Value = TextLib::URLEncode(Entry.Value);OpenLink({$link}^Value, CMlScript::LinkType::Goto);" ; } | Get the entry submit event script text |
7,338 | protected function buildCompatibleUrl ( ) { $ url = $ this -> url ; $ parametersIndex = stripos ( $ url , "?" ) ; if ( ! is_int ( $ parametersIndex ) || $ parametersIndex < 0 ) { $ url .= "?" ; } else { $ url .= "&" ; } return $ url ; } | Build the submit url compatible for the entry parameter |
7,339 | private function matchesHash ( $ hash , \ DateTime $ date ) { $ ordinals = array ( '1' => 'first' , '2' => 'second' , '3' => 'third' , '4' => 'fourth' , '5' => 'fifth' ) ; $ hashParts = explode ( '#' , $ hash ) ; if ( $ hashParts [ 0 ] != $ this -> getFieldValueFromDate ( $ date ) ) { return false ; } return $ this -> ... | Checks if the hash value matches the given date . |
7,340 | public function bindColumn ( $ column , & $ param , $ type = null ) { if ( $ type === null ) : $ this -> _statement -> bindColumn ( $ column , $ param ) ; else : $ this -> _statement -> bindColumn ( $ column , $ param , $ type ) ; endif ; } | Bind a value of the column or field table |
7,341 | public function bindParam ( $ column , & $ param , $ type = null ) { if ( $ type === null ) : $ this -> _statement -> bindParam ( $ column , $ param ) ; else : $ this -> _statement -> bindParam ( $ column , $ param , $ type ) ; endif ; } | Bind a value of the param SQL |
7,342 | public function pgettext ( $ context , $ message ) { if ( $ this -> reader === null ) { return $ message ; } return $ this -> reader -> pgettext ( ( string ) $ context , ( string ) $ message ) ; } | gettext with contect . |
7,343 | public function npgettext ( $ context , $ singular , $ plural , $ count ) { if ( $ this -> reader === null ) { return $ count > 1 ? $ plural : $ singular ; } return $ this -> reader -> npgettext ( ( string ) $ context , ( string ) $ singular , ( string ) $ plural , $ count ) ; } | Plural version of gettext with context . |
7,344 | public function addBaseUrlScript ( ) { $ arrJsPosHEad = empty ( $ this -> js [ static :: POS_HEAD ] ) ? [ ] : $ this -> js [ static :: POS_HEAD ] ; array_unshift ( $ arrJsPosHEad , "var absoluteBaseUrl = \"" . Yii :: $ app -> urlManager -> createAbsoluteUrl ( 'site/index' ) . "\";" ) ; array_unshift ( $ arrJsPosHEad , ... | Put javascript for base url to head |
7,345 | public function setBrowserTitle ( $ title , $ isFrontend = true , $ prefix = 'Backend' ) { $ strResult = ( $ isFrontend ? $ title : $ prefix . ' :: ' . $ title ) ; $ this -> title = $ strResult ; } | Set title for browser with prefix |
7,346 | public static function getVar ( string $ name , $ defaultValue = null ) { $ value = getenv ( $ name ) ; return $ value !== false ? $ value : $ defaultValue ; } | Returns value of environment variable or default value |
7,347 | public static function getRequiredVar ( string $ name ) { $ value = getenv ( $ name ) ; if ( $ value === false ) { throw EnvVarNotFoundException :: create ( $ name ) ; } return $ value ; } | Returns value of environment variable or throws Exception when is not defined |
7,348 | public static function getVars ( array $ schema , string $ prefix = "" ) : array { $ env = [ ] ; foreach ( $ schema as $ name => $ default ) { $ env [ $ name ] = self :: getVar ( $ prefix . $ name , $ default ) ; } return $ env ; } | Returns values of environment variables defined in schema parameter |
7,349 | public function setPosition ( $ posX , $ posY , $ posZ = null ) { $ this -> setX ( $ posX ) -> setY ( $ posY ) ; if ( $ posZ !== null ) { $ this -> setZ ( $ posZ ) ; } return $ this ; } | Set the Control position |
7,350 | public function getDataAttribute ( $ name ) { if ( isset ( $ this -> dataAttributes [ $ name ] ) ) { return $ this -> dataAttributes [ $ name ] ; } return null ; } | Get data attribute |
7,351 | public function addDataAttributes ( array $ dataAttributes ) { foreach ( $ dataAttributes as $ name => $ value ) { $ this -> addDataAttribute ( $ name , $ value ) ; } return $ this ; } | Add multiple data attributes |
7,352 | public function addScriptFeature ( ScriptFeature $ scriptFeature ) { if ( ! in_array ( $ scriptFeature , $ this -> scriptFeatures , true ) ) { array_push ( $ this -> scriptFeatures , $ scriptFeature ) ; } return $ this ; } | Add a new Script Feature |
7,353 | public function addActionTriggerFeature ( $ actionName , $ eventLabel = ScriptLabel :: MOUSECLICK ) { $ actionTrigger = new ActionTrigger ( $ actionName , $ this , $ eventLabel ) ; $ this -> addScriptFeature ( $ actionTrigger ) ; return $ this ; } | Add a dynamic Action Trigger |
7,354 | public function addMapInfoFeature ( $ eventLabel = ScriptLabel :: MOUSECLICK ) { $ mapInfo = new MapInfo ( $ this , $ eventLabel ) ; $ this -> addScriptFeature ( $ mapInfo ) ; return $ this ; } | Add a dynamic Feature opening the current map info |
7,355 | public function addPlayerProfileFeature ( $ login , $ eventLabel = ScriptLabel :: MOUSECLICK ) { $ playerProfile = new PlayerProfile ( $ login , $ this , $ eventLabel ) ; $ this -> addScriptFeature ( $ playerProfile ) ; return $ this ; } | Add a dynamic Feature to open a specific player profile |
7,356 | public function addUISoundFeature ( $ soundName , $ variant = 0 , $ eventLabel = ScriptLabel :: MOUSECLICK ) { $ uiSound = new UISound ( $ soundName , $ this , $ variant , $ eventLabel ) ; $ this -> addScriptFeature ( $ uiSound ) ; return $ this ; } | Add a dynamic Feature playing a UISound |
7,357 | public function addToggleFeature ( Control $ toggledControl , $ labelName = ScriptLabel :: MOUSECLICK , $ onlyShow = false , $ onlyHide = false ) { $ toggle = new Toggle ( $ this , $ toggledControl , $ labelName , $ onlyShow , $ onlyHide ) ; $ this -> addScriptFeature ( $ toggle ) ; return $ this ; } | Add a dynamic Feature toggling another Control |
7,358 | public function addScriptText ( $ scriptText , $ label = ScriptLabel :: MOUSECLICK ) { $ customText = new ControlScript ( $ this , $ scriptText , $ label ) ; $ this -> addScriptFeature ( $ customText ) ; return $ this ; } | Add a custom Control Script text part |
7,359 | public function saveEntity ( $ context , FormData $ requestData , $ subResource = NULL ) { $ this -> setContext ( $ context ) ; return $ this -> saveFormular ( ( array ) $ requestData ) ; } | Overrides the saving of the AbstractEntityController to just save the navigation tree from UI |
7,360 | public function createNewNode ( stdClass $ jsonNode ) { $ nodeClass = $ this -> container -> getRoleFQN ( 'NavigationNode' ) ; $ node = new $ nodeClass ( ( array ) $ jsonNode -> title ) ; $ node -> generateSlugs ( ) ; $ defaultSlug = current ( $ node -> getI18nSlug ( ) ) ; $ page = $ this -> createNewPage ( $ defaultSl... | Just create one the attributes will be set automatically |
7,361 | public function nextGeneration ( ) { Cond :: broadcast ( $ this -> cond ) ; $ this -> count = $ this -> parties ; $ this -> generation = new Generation ( ) ; } | Updates state on barrier trip and wakes up everyone . Called only while holding lock . |
7,362 | public function breakBarrier ( ) { $ this -> generation -> broken = true ; $ this -> count = $ this -> parties ; Cond :: broadcast ( $ this -> cond ) ; } | Sets current barrier generation as broken and wakes up everyone . Called only while holding lock . |
7,363 | public function storeDebugNode ( NodeInterface $ node ) { $ nodeId = count ( $ this -> debugNodes ) ; $ this -> debugNodes [ ] = $ node ; return $ nodeId ; } | Store a node in a debug list and return the allocated index for it . |
7,364 | public function getDebugError ( $ error , $ code , $ path = null ) { $ line = $ this -> getSourceLine ( $ error ) ; if ( $ line === false ) { return $ error ; } $ source = explode ( "\n" , $ code , max ( 2 , $ line ) ) ; array_pop ( $ source ) ; $ source = implode ( "\n" , $ source ) ; $ pos = mb_strrpos ( $ source , '... | Return a formatted error linked to pug source . |
7,365 | public function setFormatHandler ( $ doctype , $ format ) { if ( ! is_a ( $ format , FormatInterface :: class , true ) ) { throw new \ InvalidArgumentException ( "Passed format class $format must " . 'implement ' . FormatInterface :: class ) ; } $ this -> setOption ( [ 'formats' , $ doctype ] , $ format ) ; return $ th... | Set the format handler for a given doctype identifier . |
7,366 | public function initFormats ( ) { $ this -> dependencies = new DependencyInjection ( ) ; $ this -> mixins = new DependencyInjection ( ) ; $ this -> destructors = new SplObjectStorage ( ) ; $ this -> formats = [ ] ; return $ this ; } | Initialize the formats list and dependencies . |
7,367 | public function getFormatInstance ( $ format = null ) { $ format = $ format ? : $ this -> format ; if ( ! ( $ format instanceof FormatInterface ) ) { if ( ! isset ( $ this -> formats [ $ format ] ) ) { $ event = new NewFormatEvent ( $ this , new $ format ( $ this ) ) ; $ this -> trigger ( $ event ) ; $ this -> formats ... | Return current format as instance of FormatInterface . |
7,368 | public function setFormat ( $ doctype ) { $ formats = $ this -> getOption ( 'formats' ) ; $ this -> format = empty ( $ formats [ $ doctype ] ) ? $ this -> getOption ( 'default_format' ) : $ formats [ $ doctype ] ; return $ this ; } | Set a format name as the current or fallback to default if not available . |
7,369 | public function format ( ElementInterface $ element , $ format = null ) { if ( $ element instanceof DoctypeElement ) { $ formats = $ this -> getOption ( 'formats' ) ; $ doctype = $ element -> getValue ( ) ; $ this -> setFormat ( $ doctype ) ; if ( isset ( $ formats [ $ doctype ] ) ) { $ element -> setValue ( null ) ; }... | Entry point of the Formatter typically waiting for a DocumentElement and a format to return a string with HTML and PHP nested . |
7,370 | public function create ( $ type , array $ properties = [ ] ) { $ type = ( string ) $ type ; if ( isset ( $ this -> classes [ $ type ] ) ) { $ class = $ this -> classes [ $ type ] ; return new $ class ( $ properties ) ; } else if ( class_exists ( $ type ) ) { $ class = new $ type ( $ properties ) ; if ( $ class instance... | Creates and returns a new filter instance of the given type . |
7,371 | public function match ( ) { $ result = false ; $ this -> matchedStatus = $ this -> result -> getStatus ( ) ; if ( $ this -> result -> hasHandler ( ) ) { $ result = true ; $ this -> matchedHandler = $ this -> result -> getHandler ( ) ; } else { $ this -> matchedHandler = $ this -> notFoundHandler ; } return $ result ; } | Match current HTTP request . |
7,372 | public function register_autoload_filter ( $ namespace , $ filter ) { if ( is_callable ( $ filter ) ) { if ( ! isset ( $ this -> filters [ $ namespace ] ) ) { $ this -> filters [ $ namespace ] = array ( ) ; } $ this -> filters [ $ namespace ] [ ] = $ filter ; } } | Autoload filters are functions that are used to autoload classes . These functions accept a class name as an argument and return the appropriate file path to that class . Autoload filters are applied per namespace . Each namespace can have multiple autoload filters . The class loader will loop through all the filters u... |
7,373 | public function getCanonicalName ( ) { if ( mb_strpos ( $ this -> name , 'i18n' ) === 0 ) { return mb_strtolower ( mb_substr ( $ this -> name , 4 , 1 ) ) . mb_substr ( $ this -> name , 5 ) ; } return $ this -> name ; } | Returns the name of the property but cannonical |
7,374 | public function getFiles ( $ file = null ) { if ( $ file !== null ) { $ return = array ( ) ; foreach ( $ this -> _files as $ name => $ content ) { if ( $ name === $ file ) { $ return [ $ file ] = $ this -> _files [ $ name ] ; } if ( $ content [ 'name' ] === $ file ) { $ return [ $ name ] = $ this -> _files [ $ name ] ;... | Returns the array of set files |
7,375 | public function setFiles ( $ files = array ( ) ) { if ( count ( $ files ) === 0 ) { $ this -> _files = $ _FILES ; } else { $ this -> _files = $ files ; } foreach ( $ this -> _files as $ file => $ content ) { if ( ! isset ( $ content [ 'error' ] ) ) { unset ( $ this -> _files [ $ file ] ) ; } } return $ this ; } | Sets the files to be checked |
7,376 | public function set ( $ key , $ value ) { $ result = $ this -> allowed ( $ value ) ; if ( $ this -> passes ( $ result ) ) { parent :: set ( $ key , $ this -> normalize ( $ value ) ) ; } else { throw new \ UnexpectedValueException ( sprintf ( 'Value of type "%s" forbidden in this instance of %s' , gettype ( $ value ) , ... | Set the value at a given key provided that the value passes the defined guard . Optionally normalize the value before setting . |
7,377 | public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof RoleQuery ) { return $ criteria ; } $ query = new RoleQuery ( null , null , $ modelAlias ) ; if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ query ; } | Returns a new RoleQuery object . |
7,378 | public function filterByRole ( $ role = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ role ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ role ) ) { $ role = str_replace ( '*' , '%' , $ role ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsi... | Filter the query on the role column |
7,379 | public function send ( $ command , $ host = '' ) { $ host = $ host ? : $ this -> host ; if ( ! $ host ) { throw new \ InvalidArgumentException ( 'Unknown host that will run the command' ) ; } $ content = 'command=' . urlencode ( $ command ) ; $ fp = fsockopen ( $ this -> host , 80 , $ errno , $ errstr , self :: TIMEOUT... | Send the command to perform in a new thread . |
7,380 | public function onRequestComplete ( Event $ event ) { if ( $ body = $ event [ 'response' ] -> getBody ( ) ) { if ( substr ( $ body , 0 , 3 ) === "\xef\xbb\xbf" ) { $ event [ 'response' ] -> setBody ( substr ( $ body , 3 ) ) ; } else if ( substr ( $ body , 0 , 4 ) === "\xff\xfe\x00\x00" || substr ( $ body , 0 , 4 ) === ... | When the request is complete check the message body and strip any BOMs if they exist . |
7,381 | public function REJECT ( int $ http_code = 403 , string $ message = "Access denied" ) : self { $ this -> rejectHttpCode = $ http_code ; $ this -> rejectMessage = $ message ; $ this -> action = self :: ACTION_REJECT ; return $ this ; } | Reject the Request |
7,382 | function placehold ( $ rules ) { if ( 'development' == WP_ENV || 'staging' == WP_ENV ) { $ dir = wp_upload_dir ( ) ; $ uploads_rel_path = str_replace ( trailingslashit ( home_url ( ) ) , '' , $ dir [ 'baseurl' ] ) ; $ tp_images_rules = array ( '' , '# BEGIN TP Development uploads' , 'RewriteCond %{REQUEST_FILENAME} !-f... | Redirect images from uploads to placehold . it on develop and release environments if they don t exist |
7,383 | public function storeLead ( LeadData $ lead_data , $ notification_email = '' ) { $ form_params = [ 'debug' => $ this -> debug , 'action' => 'create' , 'appkey' => $ this -> getAppKey ( ) , ] ; $ form_params = array_merge ( $ form_params , $ lead_data -> toArray ( ) ) ; if ( ! empty ( $ notification_email ) ) { $ form_p... | Stores a lead |
7,384 | public static function addSectionMediaElement ( $ src , $ type , PHPWord_Section_MemoryImage $ memoryImage = null ) { $ mediaId = md5 ( $ src ) ; $ key = ( $ type == 'image' ) ? 'images' : 'embeddings' ; if ( ! array_key_exists ( $ mediaId , self :: $ _sectionMedia [ $ key ] ) ) { $ cImg = self :: countSectionMediaElem... | Add new Section Media Element |
7,385 | public static function addSectionLinkElement ( $ linkSrc ) { $ rID = self :: countSectionMediaElements ( ) + 7 ; $ link = array ( ) ; $ link [ 'target' ] = $ linkSrc ; $ link [ 'rID' ] = $ rID ; $ link [ 'type' ] = 'hyperlink' ; self :: $ _sectionMedia [ 'links' ] [ ] = $ link ; return $ rID ; } | Add new Section Link Element |
7,386 | public static function getSectionMediaElements ( $ key = null ) { if ( ! is_null ( $ key ) ) { return self :: $ _sectionMedia [ $ key ] ; } else { $ arrImages = self :: $ _sectionMedia [ 'images' ] ; $ arrObjects = self :: $ _sectionMedia [ 'embeddings' ] ; $ arrLinks = self :: $ _sectionMedia [ 'links' ] ; return arra... | Get Section Media Elements |
7,387 | public static function countSectionMediaElements ( $ key = null ) { if ( ! is_null ( $ key ) ) { return count ( self :: $ _sectionMedia [ $ key ] ) ; } else { $ cImages = count ( self :: $ _sectionMedia [ 'images' ] ) ; $ cObjects = count ( self :: $ _sectionMedia [ 'embeddings' ] ) ; $ cLinks = count ( self :: $ _sect... | Get Section Media Elements Count |
7,388 | public static function addHeaderMediaElement ( $ headerCount , $ src , PHPWord_Section_MemoryImage $ memoryImage = null ) { $ mediaId = md5 ( $ src ) ; $ key = 'header' . $ headerCount ; if ( ! array_key_exists ( $ key , self :: $ _headerMedia ) ) { self :: $ _headerMedia [ $ key ] = array ( ) ; } if ( ! array_key_exis... | Add new Header Media Element |
7,389 | public static function addFooterMediaElement ( $ footerCount , $ src , PHPWord_Section_MemoryImage $ memoryImage = null ) { $ mediaId = md5 ( $ src ) ; $ key = 'footer' . $ footerCount ; if ( ! array_key_exists ( $ key , self :: $ _footerMedia ) ) { self :: $ _footerMedia [ $ key ] = array ( ) ; } if ( ! array_key_exis... | Add new Footer Media Element |
7,390 | public static function database_dump_structure ( $ dump_directory ) { if ( is_dir ( $ dump_directory ) == false ) { $ exception = bootstrap :: get_library ( 'exception' ) ; throw new $ exception ( 'directory not found' ) ; } $ mysql = bootstrap :: get_library ( 'mysql' ) ; $ tables = $ mysql :: select ( $ mysql :: AS_A... | dumps create table statements per table in the specified path |
7,391 | public static function check_composer_updates ( ) { $ composer_json = file_get_contents ( ROOT_DIR . '/composer.json' ) ; $ composer_json = json_decode ( $ composer_json , true ) ; if ( empty ( $ composer_json [ 'require' ] ) ) { $ exception = bootstrap :: get_library ( 'exception' ) ; throw new $ exception ( 'there ar... | checks composer packages for new releases since the installed version |
7,392 | public function getConfig ( $ module ) { if ( ! isset ( $ this -> cache [ 'paths' ] [ $ module ] ) ) { $ path = $ this -> getPath ( $ module ) ; $ file = $ path . DIRECTORY_SEPARATOR . 'slender.yml' ; $ parsed = $ this -> parser -> parseFile ( $ file ) ; $ parsed [ 'path' ] = $ path ; $ this -> cache [ 'paths' ] [ $ mo... | Return parsed config file for module |
7,393 | public function getHttpVersion ( ) { if ( ! isset ( $ this -> httpVersion ) ) { $ serverProtocol = $ _SERVER [ 'SERVER_PROTOCOL' ] ; $ this -> httpVersion = substr ( $ serverProtocol , strpos ( $ serverProtocol , '/' ) + 1 ) ; } return $ this -> httpVersion ; } | Get request HTTP version . |
7,394 | public function getHost ( ) { if ( ! is_null ( $ this -> host ) ) { return $ this -> host ; } if ( $ _SERVER [ 'HTTP_X_FORWARDED_HOST' ] ) { $ elements = explode ( ',' , $ value ) ; $ host = trim ( end ( $ elements ) ) ; } else if ( $ _SERVER [ 'HTTP_HOST' ] ) { $ host = $ _SERVER [ 'HTTP_HOST' ] ; } else if ( $ _SERVE... | Get HTTP host . |
7,395 | public function getContentType ( ) { if ( ! isset ( $ this -> contentType ) ) { $ numOfMatches = preg_match ( '/^([^;]*)/' , $ this -> getHeader ( 'Content-Type' ) , $ matches ) ; if ( $ numOfMatches ) { $ this -> contentType = trim ( $ matches [ 1 ] ) ; } else { $ this -> contentType = '' ; } } return $ this -> conten... | Get content type . |
7,396 | public function getInput ( ) { if ( ! isset ( $ this -> input ) ) { switch ( $ this -> method ) { case 'POST' : switch ( $ this -> getContentType ( ) ) { case 'application/x-www-form-urlencoded' : case 'multipart/form-data' : $ this -> input = $ _POST ; break ; default : $ this -> input = $ this -> getParamsFromInput (... | Return HTTP POST PUT or DELETE variables . |
7,397 | public function getDiRequirements ( $ className ) { if ( ! isset ( $ this -> classCache [ $ className ] ) ) { $ reflectionClass = new \ ReflectionClass ( $ className ) ; $ injects = [ ] ; $ props = $ reflectionClass -> getProperties ( ) ; foreach ( $ props as $ prop ) { $ inject = $ this -> annotationReader -> getPrope... | Interrogate a class and see what dependencies it wants to be passed into its constructor |
7,398 | public function prepare ( & $ instance ) { $ requirements = $ this -> getDiRequirements ( get_class ( $ instance ) ) ; foreach ( $ requirements as $ propertyName => $ property ) { $ dependencyIdentifier = $ property [ 'identifier' ] ; $ dependency = $ this -> container [ $ dependencyIdentifier ] ; if ( ! isset ( $ this... | Scan a class instance for injectable dependencies and inject them if found then return prepared instance . |
7,399 | public function getAuthFactory ( ) : ? Factory { if ( ! $ this -> hasAuthFactory ( ) ) { $ this -> setAuthFactory ( $ this -> getDefaultAuthFactory ( ) ) ; } return $ this -> authFactory ; } | Get auth factory |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.