idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
52,600 | public function limit ( $ limit ) { if ( ! empty ( $ limit ) ) $ this -> selectParams [ self :: LIMIT ] = $ limit ; else unset ( $ this -> selectParams [ self :: LIMIT ] ) ; return $ this ; } | Sets the LIMIT clause for the query . |
52,601 | public function offset ( $ offset ) { if ( ! empty ( $ offset ) ) $ this -> selectParams [ self :: OFFSET ] = $ offset ; return $ this ; } | Sets or clears the offset for the query . If null is specified the offset is cleared . |
52,602 | protected function setClause ( $ section , $ clause ) { if ( ! isset ( $ this -> selectParams [ $ section ] ) ) $ this -> selectParams [ $ section ] = array ( ) ; if ( empty ( $ clause ) ) unset ( $ this -> selectParams [ $ section ] ) ; else if ( is_array ( $ clause ) ) $ this -> selectParams [ $ section ] = array_mer... | The setter used internally in this function to build each clause . |
52,603 | public function validatePasswordNotUseWordPassword ( $ password ) { $ washedPassword = trim ( $ password ) ; $ washedPassword = strtolower ( $ password ) ; if ( strpos ( $ washedPassword , "password" ) !== false ) { return false ; } return true ; } | Password should not use the word password |
52,604 | public function validatePasswordNotUseUsername ( $ username , $ password ) { $ washedPassword = trim ( $ password ) ; $ washedPassword = strtolower ( $ password ) ; $ washedUsername = trim ( $ username ) ; $ washedUsername = strtolower ( $ username ) ; if ( $ washedPassword == $ washedUsername ) { return false ; } $ wa... | Password should not be the username |
52,605 | public function getPeopleIdForIndexListing ( $ id ) { if ( Schema :: hasTable ( 'peoples' ) ) { $ person = DB :: table ( 'peoples' ) -> where ( 'user_id' , '=' , $ id ) -> first ( ) ; if ( ! $ person ) return "Not in LaSalleCRM" ; $ full_url = route ( 'admin.crmpeoples.edit' , $ person -> id ) ; $ html = '<a href="' ; ... | Get the ID from the PEOPLES table |
52,606 | public function on ( $ event , $ handler , $ prepend = false ) { if ( ! is_string ( $ event ) ) { throw new InvalidArgumentException ( "invalid value provided for 'event'; " . "expecting an event name as string" ) ; } $ handler = new Handler ( $ event , $ handler ) ; if ( $ prepend === false ) { $ this -> eventHandlers... | Add an event handler |
52,607 | public function off ( $ event ) { list ( $ type , $ namespace ) = Event :: split ( $ event ) ; for ( $ i = count ( $ this -> eventHandlers ) - 1 ; $ i > - 1 ; $ i -- ) { $ h = $ this -> eventHandlers [ $ i ] ; if ( $ type !== null && $ h -> getType ( ) !== $ type ) { continue ; } else if ( $ namespace !== null && $ h -... | Remove one or more event handlers |
52,608 | public function fire ( $ event , array $ data = [ ] ) { if ( is_string ( $ event ) ) { $ event = new Event ( $ event ) ; $ event -> setData ( $ data ) ; } else if ( $ event instanceof Event ) { if ( $ data ) { $ event -> addData ( $ data ) ; } } else { throw new InvalidArgumentException ( "invalid value provided for 'e... | Call all handlers for a given event |
52,609 | protected function BeforeInit ( ) { if ( $ this -> RemoveTemplate ( ) ) { Response :: Redirect ( Request :: Uri ( ) ) ; return true ; } parent :: BeforeInit ( ) ; } | Removes the template if necessary |
52,610 | protected function InitBundles ( ) { $ bundles = PathUtil :: Bundles ( ) ; $ this -> bundles = array ( ) ; foreach ( $ bundles as $ bundle ) { if ( count ( $ this -> BundleModules ( $ bundle ) ) > 0 ) { $ this -> bundles [ ] = $ bundle ; } } } | Initializes the bundle names by fetching those containing modules with adjustable templates |
52,611 | protected function ModuleTemplates ( $ module ) { $ folder = PathUtil :: ModuleCustomTemplatesFolder ( $ module ) ; if ( ! Folder :: Exists ( $ folder ) ) { return array ( ) ; } $ templates = Folder :: GetFiles ( $ folder ) ; $ result = array ( ) ; foreach ( $ templates as $ template ) { if ( Path :: Extension ( $ temp... | Gets the module templates |
52,612 | protected function RemovalTemplateModule ( array $ idParts ) { if ( count ( $ idParts ) != 2 ) { return null ; } $ module = ClassFinder :: CreateFrontendModule ( $ idParts [ 0 ] ) ; return ( $ module instanceof FrontendModule && $ module -> AllowCustomTemplates ( ) ) ? $ module : null ; } | The removel template module |
52,613 | public function setValue ( $ value = null ) { if ( isset ( $ value ) ) { $ this -> value = array_map ( 'htmlspecialchars' , ( array ) $ value ) ; } foreach ( $ this -> options as $ o ) { $ v = $ this -> getValue ( ) ; if ( is_array ( $ v ) && in_array ( $ o -> getValue ( ) , $ v ) ) { $ o -> select ( ) ; } else { $ o -... | set value of select element value can be either a primitive or an array |
52,614 | public function init ( $ options = [ ] ) { $ auth = new Authentication ( ) ; if ( ! $ auth -> check ( ) ) { $ url = ( isset ( $ options [ 'auth_login_url' ] ) ) ? $ options [ 'auth_login_url' ] : '/auth/login' ; $ this -> redirect = $ url ; } } | Group init function . |
52,615 | public function getData ( ) { if ( $ this -> options [ 'paginate' ] ) { $ currentPage = \ Paginator :: getCurrentPage ( ) ; $ total = ( int ) $ this -> getQuery ( ) -> count ( ) ; $ slice = $ this -> getQuery ( ) -> forPage ( $ currentPage , $ this -> perPage ) -> get ( ) ; $ models = \ Paginator :: make ( $ slice -> a... | Return the data filter by the options |
52,616 | public function sameValueAs ( ValueObjectInterface $ integer ) { if ( false === Util :: classEquals ( $ this , $ integer ) ) { return false ; } return $ this -> toNative ( ) === $ integer -> toNative ( ) ; } | Tells whether two Integer are equal by comparing their values |
52,617 | public function stringValue ( string $ allowedNext = ',;)' ) : string { $ value = '' ; if ( $ this -> isEnd ( ) ) { throw $ this -> createSyntaxException ( 'StringValue' ) ; } if ( '"' === $ this -> data [ $ this -> cursor ] ) { $ this -> moveCursor ( '"' ) ; while ( "\n" !== $ c = mb_substr ( $ this -> data , $ this -... | Expect a StringValue . |
52,618 | protected function stripHtmlTags ( $ string ) { $ string = preg_replace ( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu' , '' , $ string ) ; $ string = preg_replace ( '@</(div|h[1-9]|p|pre|tr)@iu' , "\r\n\$0" , $ string ) ; $ string = preg_replace ( '@</(td|th)@iu' , " \$0" , $ string ) ; $ s... | - remove invisible elements - replace certain elements with a line - break - replace certain table elements with a space - add a placeholder for plain - text bullets to list elements - strip all remaining HTML tags |
52,619 | public static function installFromFile ( $ path , $ deleteFile = false ) { $ spa = new Tenant_SPA ( ) ; $ spa -> path = 'not/set' ; $ spa -> name = 'spa-' . rand ( ) ; $ spa -> create ( ) ; try { return self :: updateFromFile ( $ spa , $ path , $ deleteFile ) ; } catch ( Exception $ ex ) { $ spa -> delete ( ) ; throw $... | Install spa from file into the tenant . |
52,620 | public function getAddressInfo ( $ ipAddress ) { $ long = ip2long ( $ ipAddress ) ; if ( $ long == - 1 || $ long === false ) { return null ; } $ result = $ this -> gateway -> get ( 'ipv4address' , [ 'ip_address' => $ ipAddress , '_max_results' => 1 ] ) ; return ( isset ( $ result [ 0 ] ) ) ? $ result [ 0 ] : null ; } | Looks up an IP Address and returns whatever Infoblox knows about it . |
52,621 | public function getMacFilterInfo ( $ macAddress ) { $ result = $ this -> gateway -> get ( 'macfilteraddress' , [ 'filter' => $ this -> filter , 'mac' => $ macAddress , '_max_results' => 1 ] ) ; return ( isset ( $ result [ 0 ] ) ) ? $ result [ 0 ] : null ; } | Returns whatever Infoblox knows about a MAC address filter address . |
52,622 | public function getRegistrations ( $ username ) { $ params = [ ] ; $ params [ 'filter' ] = $ this -> filter ; $ params [ 'username' ] = $ username ; $ params [ '_return_fields+' ] = 'fingerprint,extattrs' ; return $ this -> gateway -> get ( 'macfilteraddress' , $ params ) ; } | Returns MAC address filter registrations for a given user . |
52,623 | public static function formatMacAddress ( $ validAddress ) { if ( strlen ( $ validAddress ) == 12 ) { $ formattedAddress = substr ( $ validAddress , 0 , 2 ) ; for ( $ i = 2 ; $ i < 12 ; $ i += 2 ) { $ formattedAddress .= ':' . substr ( $ validAddress , $ i , 2 ) ; } return $ formattedAddress ; } if ( strlen ( $ validAd... | Formats a MAC Address . |
52,624 | public static function i ( ) { $ class = get_called_class ( ) ; $ initArgs = func_get_args ( ) ; if ( count ( $ initArgs ) === 1 ) { $ initArgs = $ initArgs [ 0 ] ; } if ( ! empty ( self :: $ _baseInstances [ $ class ] ) ) { $ inst = self :: $ _baseInstances [ $ class ] ; if ( ! empty ( $ initArgs ) ) { $ inst -> initC... | Direct static constructor and singleton getter . |
52,625 | public function initConfig ( $ config ) { if ( is_string ( $ config ) ) { if ( file_exists ( ( $ configFile = $ config ) ) || file_exists ( ( $ configFile = dirname ( dirname ( __FILE__ ) ) . self :: DS . $ config ) ) ) { $ config = $ this -> loadConfig ( $ configFile ) ; } } elseif ( ! is_array ( $ config ) && ! is_ob... | Initiate class configuration |
52,626 | public function mergeConfig ( $ new = array ( ) ) { $ config = ( object ) array_merge ( ( array ) $ this -> _defaultConfiguration , ( array ) $ this -> _configuration , ( array ) $ new ) ; foreach ( $ config as $ key => $ value ) { $ this -> setConfig ( $ key , $ value ) ; } return $ this ; } | Merge new data into the current defaults and configuration |
52,627 | public function loadConfig ( $ file ) { $ config ; switch ( pathinfo ( $ file , PATHINFO_EXTENSION ) ) { case 'json' : $ config = json_decode ( file_get_contents ( $ file ) ) ; break ; case 'php' : $ config = include $ file ; break ; default : return $ this ; } $ this -> doCallback ( 'configurationLoaded' , array ( $ c... | Loads the configuration from a json or php file |
52,628 | public function getCallbackKey ( $ callback ) { if ( is_array ( $ callback ) ) { if ( is_object ( $ callback [ 0 ] ) ) { $ callback [ 0 ] = spl_object_hash ( $ callback [ 0 ] ) ; } } elseif ( ( function ( ) { } instanceof $ callback ) ) { $ callback = spl_object_hash ( $ callback ) ; } return md5 ( serialize ( $ callba... | Generates unique hashes for callback functions |
52,629 | public function doCallback ( $ name , array $ values = array ( ) , $ getResult = false ) { $ values = array_merge ( $ values , array ( $ name , $ this ) ) ; if ( $ getResult ) { $ result = $ values [ 0 ] ; } if ( $ this -> getConfig ( 'hookIntoWordpress' ) && class_exists ( '\WP' ) ) { $ result = call_user_func_array (... | Executes callbacks for a hook |
52,630 | public function addCallback ( $ name , $ callback , $ prio = 10 ) { if ( ! is_callable ( $ callback ) ) { throw new \ Exception ( "Callback not callable." , 3 ) ; return false ; } $ key = $ this -> getCallbackKey ( $ callback ) ; if ( ! isset ( self :: $ _baseRealCallbacks [ $ key ] ) ) { self :: $ _baseRealCallbacks [... | Adds a callback listener |
52,631 | public function removeCallback ( $ name , $ callback , $ prio = 10 ) { $ key = $ this -> getCallbackKey ( $ callback ) ; if ( in_array ( $ key , $ this -> _callbacks [ $ name ] [ $ prio ] ) ) { while ( false !== $ k = array_search ( $ key , $ this -> _callbacks [ $ name ] [ $ prio ] ) ) { unset ( $ this -> _callbacks [... | Removes the callback from the specific hook at the specific priority |
52,632 | public function killCallback ( $ callback ) { $ key = $ this -> getCallbackKey ( $ callback ) ; self :: $ _baseRealCallbacks [ $ key ] = false ; return $ this ; } | Globally disables the passed function from being called by any hook . |
52,633 | public function reanimateCallback ( $ callback ) { $ key = $ this -> getCallbackKey ( $ callback ) ; self :: $ _baseRealCallbacks [ $ key ] = $ callback ; return $ this ; } | Globally enables the passed function to receive callback calls . |
52,634 | public function _exit ( $ status = null , $ msg = null , $ errorCode = null ) { foreach ( array ( 'status' , 'msg' , 'errorCode' ) as $ k ) { if ( $ $ k !== null ) { self :: $ _baseR [ $ k ] = $ $ k ; } } echo serialize ( self :: $ _baseR ) ; exit ; } | Killer function stops the script and echoes the serialized response |
52,635 | public function search ( $ expression ) { return \ Aws \ flatmap ( $ this , function ( \ Aws \ ResultInterface $ result ) use ( $ expression ) { return ( array ) $ result -> search ( $ expression ) ; } ) ; } | Returns an iterator that iterates over the values of applying a JMESPath search to each wrapped \ Aws \ ResultInterface as a flat sequence . |
52,636 | public static function register ( $ debug = TRUE , $ charset = 'UTF-8' ) { if ( self :: $ handler ) { throw new \ RuntimeException ( 'Exception handler already registered.' ) ; } self :: $ handler = new static ( $ debug , $ charset ) ; set_exception_handler ( array ( self :: $ handler , 'handle' ) ) ; return self :: $ ... | register custom exception handler |
52,637 | protected function decorateException ( \ Exception $ e , $ status ) { $ headerTpl = ' <!DOCTYPE html> <html> <head> <title>Error %d</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> <table> <tr> <th colspan="4">%s</th> </tr> <tr> <th></th> ... | generate simple formatted output of exception |
52,638 | public function createParamTag ( $ type , $ name , $ description = null ) { return $ this -> createVariableTag ( 'param' , $ type , $ name , $ description ) ; } | Create a param tag for describing method arguments |
52,639 | public function createPropertyTag ( $ type , $ name , $ description = null ) { return $ this -> createVariableTag ( 'property' , $ type , $ name , $ description ) ; } | Create a property tag for describing class properties |
52,640 | public function createReturnTag ( $ type , $ description = null ) { return $ this -> internalCreateTag ( true , 'return' , $ this -> classFile -> getType ( $ type ) , $ description ) ; } | Define the return type of a method |
52,641 | public function createThrowsTag ( $ exceptionClass , $ description = null ) { return $ this -> internalCreateTag ( false , 'throws' , $ this -> classFile -> getType ( $ exceptionClass ) , $ description ) ; } | Indicates if the element throws partical exceptions |
52,642 | public function createVarTag ( $ type , $ name , $ description = null ) { return $ this -> createVariableTag ( 'var' , $ type , $ name , $ description ) ; } | Create a var tag for describing class properties |
52,643 | protected function internalCreateTag ( $ single = true , $ name , $ column1 = null , $ column2 = null , $ _ = null ) { $ arguments = func_get_args ( ) ; $ single = array_shift ( $ arguments ) ; array_unshift ( $ arguments , $ this -> maxColumnLengths ) ; foreach ( $ arguments as $ index => $ argument ) { if ( $ argumen... | Create tag with the given values |
52,644 | public function addSubscriber ( EventSubscriber $ eventSubscriber ) { $ listeners = $ eventSubscriber -> getEvents ( ) ; foreach ( $ listeners as $ listener => $ data ) { if ( is_array ( $ data ) ) { $ data = new SubscriberConfiguration ( $ data [ 0 ] , $ data [ 1 ] ?? self :: USE_ALL , $ data [ 2 ] ?? 100 ) ; } if ( !... | Adds an event subscriber that listens on the specified events . Internally this will convert all handlers to listeners . |
52,645 | public function getListeners ( string ... $ eventNames ) : array { if ( empty ( $ eventNames ) ) return [ ] ; $ key = implode ( '|' , $ eventNames ) ; return $ this -> combinationListeners [ $ key ] ?? [ ] ; } | Gets the listeners of a specific event |
52,646 | public function clean ( ) { $ fileSystem = new Filesystem ( ) ; if ( $ fileSystem -> exists ( $ this -> getCacheDir ( ) ) ) { $ fileSystem -> remove ( $ this -> getCacheDir ( ) ) ; } } | Remove the assets cache directory . |
52,647 | public function getCacheDir ( ) { $ fileSystem = new Filesystem ( ) ; $ path = 'var/cache/assets/' . $ this -> name . '/' ; if ( ! $ fileSystem -> exists ( $ path ) ) { $ fileSystem -> mkdir ( $ path ) ; } return $ path ; } | Return the assets cache dir . |
52,648 | protected function addNotification ( $ message ) { $ event = new NotificationEvent ( ) ; $ event -> setMessage ( $ message ) ; $ this -> eventDispatcher -> dispatch ( NotificationEvent :: NAME , $ event ) ; } | Add a notification to the subscriber . |
52,649 | public function convert ( $ jsonString , $ mapToClass = null ) { $ converted = json_decode ( $ jsonString , true ) ; if ( $ mapToClass ) { $ converted = SerialisableArrayUtils :: convertArrayToSerialisableObjects ( $ converted , $ mapToClass ) ; } return $ converted ; } | Convert a json string into objects . If the mapToClass member is passed the converter will attempt to map the result to an instance of that class type or array . |
52,650 | protected function getToken ( $ src ) { $ full_path = \ Yii :: getAlias ( '@webroot' ) . "/$src" ; try { $ token = hash ( 'crc32b' , '$full_path ' . filemtime ( $ full_path ) ) ; } catch ( \ Exception $ ex ) { \ Yii :: error ( $ ex ) ; return null ; } catch ( \ Throwable $ ex ) { \ Yii :: error ( $ ex ) ; return null ;... | Get a file token based on pipe configuration and source path . |
52,651 | public function url ( $ pipeline , $ src , $ scheme = false ) { $ src = ltrim ( is_array ( $ src ) ? $ src [ 0 ] : $ src , '/' ) ; $ version = $ this -> getPipelineVersion ( $ pipeline ) ; return Url :: to ( "@web/$this->path/$pipeline/$version/$src" , $ scheme ) . '?' . $ this -> getToken ( $ src ) ; } | Return a URL to render a filtered version of an image . |
52,652 | public function img ( $ pipeline , $ src , array $ options = [ ] ) { return \ yii \ helpers \ Html :: img ( $ this -> url ( $ pipeline , $ src ) , $ options ) ; } | Return an HTML IMG tag . |
52,653 | public static function ip ( ) { $ whip = new Whip ( Whip :: CLOUDFLARE_HEADERS | Whip :: REMOTE_ADDR , [ Whip :: CLOUDFLARE_HEADERS => self :: CLOUDFLARE_IP , ] ) ; return $ whip -> getValidIpAddress ( ) ; } | Get real ip address . |
52,654 | public static function contains ( $ cidr , $ ip ) { $ cidr = Range :: parse ( $ cidr ) ; $ ip = new IP ( $ ip ) ; if ( $ cidr -> getFirstIP ( ) -> getVersion ( ) !== $ ip -> getVersion ( ) ) { return false ; } return $ cidr -> contains ( $ ip ) ; } | Check if ip is within range . |
52,655 | public function getSlaveConnection ( ) { if ( null === $ this -> slaveConnection ) { $ this -> slaveConnection = new \ Redis ( ) ; $ this -> slaveConnection -> pconnect ( $ this -> config [ 'slave' ] [ 'HOST' ] , $ this -> config [ 'slave' ] [ 'PORT' ] ) ; } return $ this -> slaveConnection ; } | Get slave connection If connection is not initialized we create a new one |
52,656 | public function getIndent ( ) { $ leadingWhitespace = array ( ) ; $ n = 0 ; foreach ( $ this -> lines as $ line ) { if ( ! empty ( $ line ) ) { $ leadingWhitespace [ $ n ] = strlen ( $ line ) - strlen ( ltrim ( $ line ) ) ; } $ n ++ ; } return min ( $ leadingWhitespace ) ; } | Get the number of chars |
52,657 | public function deIndent ( ) { $ ltrim = $ this -> getIndent ( ) ; if ( $ ltrim > 0 ) { foreach ( $ this -> lines as & $ line ) { $ line = substr ( $ line , $ ltrim ) ; } } return $ this ; } | Completely deindent a string |
52,658 | public function indent ( $ indent = 4 ) { $ indent = $ this -> generateIndent ( $ indent ) ; foreach ( $ this -> lines as & $ line ) { $ line = $ indent . $ line ; } return $ this ; } | Indent a string |
52,659 | public function comment ( $ comment = '#' ) { foreach ( $ this -> lines as & $ line ) { $ line = $ comment . $ line ; } return $ this ; } | Comment out a string |
52,660 | public function docblockify ( ) { foreach ( $ this -> lines as & $ line ) { $ line = ' * ' . $ line ; } array_unshift ( $ this -> lines , '/**' ) ; array_push ( $ this -> lines , ' */' ) ; return $ this ; } | Make docblock this string |
52,661 | public function removeDuplicateEmptyLines ( ) { $ output = [ ] ; $ c = 0 ; foreach ( $ this -> lines as $ key => $ line ) { if ( strlen ( rtrim ( $ line ) ) === 0 ) { $ c ++ ; if ( $ c === 1 ) { $ output [ ] = $ line ; } } else { $ c = 0 ; $ output [ ] = $ line ; } } $ this -> lines = $ output ; return $ this ; } | Duplicate empty lines remove |
52,662 | public function addLineNumbers ( ) { $ lengthToPad = strlen ( count ( $ this -> lines ) ) ; $ c = 0 ; foreach ( $ this -> lines as & $ line ) { $ c ++ ; $ line = sprintf ( "%s %s" , str_pad ( ( string ) $ c , $ lengthToPad , ' ' , STR_PAD_LEFT ) , $ line ) ; } return $ this ; } | Add line numbers to output . Useful for debugging output . This is obviously destructive |
52,663 | private function generateIndent ( $ indent ) { if ( is_integer ( $ indent ) ) { $ indent = str_repeat ( $ this -> indentChar , $ indent ) ; } elseif ( ! is_string ( $ indent ) ) { throw new BadTypeException ( $ indent , 'int|string' ) ; } return $ indent ; } | Generate indention string from length . |
52,664 | public function filterByCategoryId ( $ categoryId = null , $ comparison = null ) { if ( is_array ( $ categoryId ) ) { $ useMinMax = false ; if ( isset ( $ categoryId [ 'min' ] ) ) { $ this -> addUsingAlias ( C2MTableMap :: COL_CATEGORY_ID , $ categoryId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } i... | Filter the query on the category_id column |
52,665 | public function filterByMediaId ( $ mediaId = null , $ comparison = null ) { if ( is_array ( $ mediaId ) ) { $ useMinMax = false ; if ( isset ( $ mediaId [ 'min' ] ) ) { $ this -> addUsingAlias ( C2MTableMap :: COL_MEDIA_ID , $ mediaId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ medi... | Filter the query on the media_id column |
52,666 | public function useCategoryQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinCategory ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Category' , '\Attogram\SharedMedia\Orm\CategoryQuery' ) ; } | Use the Category relation Category object |
52,667 | public function useMediaQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinMedia ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Media' , '\Attogram\SharedMedia\Orm\MediaQuery' ) ; } | Use the Media relation Media object |
52,668 | protected function _createInvalidArgumentException ( $ message = '' , $ code = 0 , RootException $ previous = null , $ argument = null ) { return new RootInvalidArgumentException ( $ message , $ code , $ previous ) ; } | Creates a new invalid argument exception . |
52,669 | private static function getVarName ( $ sFunction , $ sFile , $ iLine ) { $ sContent = file ( $ sFile ) ; $ sLine = $ sContent [ $ iLine - 1 ] ; preg_match ( "#$sFunction\s*\((.+)\)#" , $ sLine , $ aMatches ) ; $ iMax = strlen ( $ aMatches [ 1 ] ) ; $ sVarname = '' ; $ iNb = 0 ; for ( $ i = 0 ; $ i < $ iMax ; $ i ++ ) {... | Return the name of the first parameter of the penultimate function call . |
52,670 | function AddIndexCommands ( ) { $ condition = new RewriteCondition ( '$1' , '!^(index\\.php|files|phine|robots\\.txt)' ) ; $ this -> writer -> AddContent ( $ condition ) ; $ rule = new RewriteRule ( '(.*)$' , 'index.php' ) ; $ rule -> AddFlag ( new CommandFlag ( FlagType :: Qsa ( ) ) ) ; $ rule -> AddFlag ( new Command... | Adds the rules to rewrite anything to the index . php |
52,671 | private function SiteHostCondition ( Site $ site ) { $ siteUrl = $ site -> GetUrl ( ) ; $ host = parse_url ( $ siteUrl , PHP_URL_HOST ) ; return new RewriteCondition ( new Variable ( ServerVariable :: HttpHost ( ) ) , $ host ) ; } | Gets the host condition for a page rewrite |
52,672 | private function SiteFolderCondition ( Site $ site ) { $ siteUrl = $ site -> GetUrl ( ) ; $ siteFolder = parse_url ( $ siteUrl , PHP_URL_PATH ) ; if ( $ siteFolder != '' && $ siteFolder != '/' ) { return new RewriteCondition ( new Variable ( ServerVariable :: RequestUri ( ) ) , '^' . rtrim ( $ siteFolder , '/' ) . '/' ... | Gets the rewrite condition for the site specific folder ; if present |
52,673 | private function PageRule ( Page $ page , array $ params ) { $ lhs = $ page -> GetUrl ( ) ; foreach ( $ params as $ param ) { $ lhs = str_replace ( '{' . $ param . '}' , self :: PARAM_PATTERN , $ lhs ) ; } $ rhs = 'index.php' ; $ idx = 1 ; foreach ( $ params as $ param ) { $ rhs .= $ idx > 1 ? '&' : '?' ; $ rhs .= $ pa... | Returns the page rule |
52,674 | function PageStartComment ( Page $ page ) { $ text = str_replace ( '{0}' , $ page -> GetID ( ) , self :: START_PAGE_COMMENT ) ; return new CommentLine ( $ text ) ; } | The page start comment |
52,675 | function PageEndComment ( Page $ page ) { $ text = str_replace ( '{0}' , $ page -> GetID ( ) , self :: END_PAGE_COMMENT ) ; return new CommentLine ( $ text ) ; } | The page end comment |
52,676 | private static function & getProperty ( $ object , string $ property ) { $ value = & \ Closure :: bind ( function & ( ) use ( $ property ) { return $ this -> $ property ; } , $ object , $ object ) -> __invoke ( ) ; return $ value ; } | Returns a reference to a non static property of an object . |
52,677 | private static function & getStaticProperty ( $ object , string $ property ) { $ value = & \ Closure :: bind ( function & ( ) use ( $ property ) { return self :: $ $ property ; } , $ object , $ object ) -> __invoke ( ) ; return $ value ; } | Returns a reference to a static property of an object . |
52,678 | public function dump ( $ name , & $ value , bool $ scalarReferences = false ) : void { $ this -> seen = [ ] ; $ this -> scalarReferences = $ scalarReferences ; $ this -> gid = uniqid ( ( string ) mt_rand ( ) , true ) ; $ this -> writer -> start ( ) ; $ this -> recursiveDump ( $ value , $ name ) ; $ this -> writer -> st... | Main function for dumping . |
52,679 | private function dumpArray ( array & $ value , $ name ) : void { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; if ( $ ref === null ) { $ this -> writer -> writeArrayOpen ( $ id , $ name ) ; foreach ( $ value as $ key => & $ item ) { $ this -> recursiveDump ( $ item , $ key ) ; } $ this -> writer -> writeA... | Dumps an array . |
52,680 | private function dumpBool ( bool & $ value , $ name ) : void { if ( $ this -> scalarReferences ) { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; } else { $ id = null ; $ ref = null ; } $ this -> writer -> writeBool ( $ id , $ ref , $ value , $ name ) ; } | Dumps a boolean . |
52,681 | private function dumpFloat ( float & $ value , $ name ) : void { if ( $ this -> scalarReferences ) { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; } else { $ id = null ; $ ref = null ; } $ this -> writer -> writeFloat ( $ id , $ ref , $ value , $ name ) ; } | Dumps a float . |
52,682 | private function dumpInt ( int & $ value , $ name ) : void { if ( $ this -> scalarReferences ) { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; } else { $ id = null ; $ ref = null ; } $ this -> writer -> writeInt ( $ id , $ ref , $ value , $ name ) ; } | Dumps an integer . |
52,683 | private function dumpNull ( & $ value , $ name ) : void { if ( $ this -> scalarReferences ) { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; } else { $ id = null ; $ ref = null ; } $ this -> writer -> writeNull ( $ id , $ ref , $ name ) ; } | Dumps null . |
52,684 | private function dumpObject ( $ value , $ name ) : void { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; if ( $ ref === null ) { $ this -> writer -> writeObjectOpen ( $ id , $ name , get_class ( $ value ) ) ; if ( $ this !== $ value ) { $ reflect = new \ ReflectionClass ( $ value ) ; $ properties = $ refle... | Dumps an object . |
52,685 | private function dumpResource ( $ value , $ name ) : void { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; $ this -> writer -> writeResource ( $ id , $ ref , $ name , get_resource_type ( $ value ) ) ; } | Dumps a resource . |
52,686 | private function dumpString ( string & $ value , $ name ) : void { if ( $ this -> scalarReferences ) { list ( $ id , $ ref ) = $ this -> isReference ( $ value ) ; } else { $ id = null ; $ ref = null ; } $ this -> writer -> writeString ( $ id , $ ref , $ value , $ name ) ; } | Dumps a string . |
52,687 | private function isReference ( & $ value ) : array { switch ( true ) { case is_bool ( $ value ) : case is_null ( $ value ) : case is_int ( $ value ) : case is_string ( $ value ) : case is_double ( $ value ) : case is_resource ( $ value ) : $ ref = $ this -> testSeen ( $ value ) ; break ; case is_object ( $ value ) : $ ... | If a value has been dumped before returns the ID of the variable . Otherwise returns null . |
52,688 | private function recursiveDump ( & $ value , $ name ) : void { switch ( true ) { case is_null ( $ value ) : $ this -> dumpNull ( $ value , $ name ) ; break ; case is_bool ( $ value ) : $ this -> dumpBool ( $ value , $ name ) ; break ; case is_float ( $ value ) : $ this -> dumpFloat ( $ value , $ name ) ; break ; case i... | Dumps recursively a variable . |
52,689 | public function generateSlugSegmentationAndPath ( ) { $ this -> setSlug ( \ Gedmo \ Sluggable \ Util \ Urlizer :: urlize ( $ this -> name ) ) ; if ( $ this -> getParent ( ) ) { $ account = $ this ; $ pathSegments = array ( $ account -> getSlug ( ) ) ; $ nameSegments = array ( $ account -> getName ( ) ) ; while ( $ acco... | Generate slug segmentation and path |
52,690 | public function getPostedPostings ( ) { $ criteria = Criteria :: create ( ) -> where ( Criteria :: expr ( ) -> neq ( 'postedAt' , null ) ) -> orderBy ( array ( 'postedAt' => Criteria :: ASC ) ) ; return $ this -> getPostings ( ) -> matching ( $ criteria ) ; } | Get posted Postings |
52,691 | public function getUnpostedPostings ( ) { $ criteria = Criteria :: create ( ) -> where ( Criteria :: expr ( ) -> eq ( 'postedAt' , null ) ) ; return $ this -> getPostings ( ) -> matching ( $ criteria ) ; } | Get unposted Postings |
52,692 | public function getChildForName ( $ name ) { $ criteria = Criteria :: create ( ) -> where ( Criteria :: expr ( ) -> eq ( 'name' , $ name ) ) ; return $ this -> getChildren ( ) -> matching ( $ criteria ) -> first ( ) ; } | Get a child account by name |
52,693 | private function respondOnOptionsRequest ( int $ httpResponseCode ) : void { http_response_code ( $ httpResponseCode ) ; header ( 'Content-Type: application/json' ) ; header ( 'Access-Control-Allow-Origin: *' ) ; header ( 'Access-Control-Allow-Headers: *' ) ; exit ; } | Send confirmation for an OPTIONS request |
52,694 | private function checkFunctions ( ) { if ( ! function_exists ( 'apache_request_headers' ) ) { function apache_request_headers ( ) { $ arh = array ( ) ; $ rx_http = '/\AHTTP_/' ; foreach ( $ _SERVER as $ key => $ val ) { if ( preg_match ( $ rx_http , $ key ) ) { $ arh_key = preg_replace ( $ rx_http , '' , $ key ) ; $ rx... | Checks if a certain function exists on the server or not . I needed to add this because else the router wouldn t work on a NGINX server! |
52,695 | protected function getFeedXml ( ) { $ client = $ this -> curlFactory -> create ( ) ; $ client -> setConfig ( $ this -> getCurlConfig ( ) ) ; $ client -> write ( \ Zend_Http_Client :: GET , self :: ENDPOINT , '1.0' ) ; $ response = $ client -> read ( ) ; $ client -> close ( ) ; if ( false !== $ response ) { $ data = pre... | Retrieve feed data as XML element |
52,696 | protected function getCurlConfig ( ) { $ useragent = $ this -> productMetadata -> getName ( ) . '/' . $ this -> productMetadata -> getVersion ( ) . ' (' . $ this -> productMetadata -> getEdition ( ) . ')' ; return [ 'useragent' => $ useragent , 'timeout' => 2 ] ; } | Retrieve config for curl |
52,697 | public function getLimit ( array $ query = [ ] ) { if ( isset ( $ query [ 'limit' ] ) && is_numeric ( $ query [ 'limit' ] ) && in_array ( $ query [ 'limit' ] , self :: $ limits ) ) { return ( int ) $ query [ 'limit' ] ; } return self :: DEFAULT_LIMIT ; } | Get limit list items . |
52,698 | public function getLimits ( array $ query = [ ] ) { $ limits = [ ] ; $ current_limit = $ this -> getLimit ( $ query ) ; foreach ( self :: $ limits as $ limit ) { $ limits [ ] = [ 'link' => '?' . http_build_query ( array_merge ( $ query , [ 'limit' => $ limit ] ) ) , 'name' => $ limit ? $ limit : self :: LIMIT_ALL_NAME ... | Get list limits . |
52,699 | public static function GetByExtension ( string $ extension ) : string { $ normalizedExtension = \ strtolower ( \ ltrim ( $ extension , '.' ) ) ; if ( isset ( static :: $ mimeTypes [ $ normalizedExtension ] ) ) { return static :: $ mimeTypes [ $ normalizedExtension ] ; } return 'application/octet-stream' ; } | Returns the MIME type associated with the defined file name extension . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.