idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
53,800 | public function meta ( $ name , String $ content = NULL ) { if ( ! is_array ( $ name ) ) { $ this -> outputElement .= $ this -> _singleMeta ( $ name , $ content ) ; } else { $ metas = NULL ; foreach ( $ name as $ key => $ val ) { $ metas .= $ this -> _singleMeta ( $ key , $ val ) ; } $ this -> outputElement .= $ metas ... | Gets meta tag |
53,801 | protected function _contentAttribute ( $ content = '' , $ _attributes , $ type ) { $ type = strtolower ( $ type ) ; $ perm = $ this -> settings [ 'attr' ] [ 'perm' ] ?? NULL ; $ return = '<' . $ type . $ this -> attributes ( $ _attributes ) . '>' . $ this -> stringOrCallback ( $ content ) . "</$type>" . EOL ; $ this ->... | Protected Content Attribute |
53,802 | protected function _singleElement ( $ element , $ attributes = [ ] ) { $ perm = $ this -> settings [ 'attr' ] [ 'perm' ] ?? NULL ; $ this -> outputElement .= $ this -> _perm ( $ perm , '<' . strtolower ( $ element ) . $ this -> attributes ( $ attributes ) . '>' ) ; return $ this ; } | Protected Single Element |
53,803 | protected function _singleMeta ( $ name , $ content ) { if ( stripos ( $ name , 'http:' ) === 0 ) { $ name = ' http-equiv="' . str_ireplace ( 'http:' , NULL , $ name ) . '"' ; } elseif ( stripos ( $ name , 'property:' ) === 0 ) { $ name = ' property="' . str_ireplace ( 'property:' , NULL , $ name ) . '"' ; } else { $ n... | Protected Single Meta |
53,804 | public function attach ( \ SplObserver $ job ) { if ( in_array ( $ job -> getId ( ) , array_keys ( $ this -> timeMap ) ) ) { throw new \ UnexpectedValueException ( 'Duplicated job ID. Job ID should be unique.' ) ; } $ this -> pushSchedule ( $ job ) ; $ this -> updateTimeMap ( $ job ) ; } | attach job observer |
53,805 | private function pushSchedule ( $ job ) { $ runTime = $ job -> getRunTime ( $ this -> currTime ) ; if ( array_key_exists ( $ runTime , $ this -> schedule ) ) { $ this -> schedule = [ $ runTime => $ job ] ; } else { $ this -> schedule [ $ runTime ] [ ] = $ job ; } } | Push job into schedule |
53,806 | public function getSchedule ( ) { $ list = [ ] ; foreach ( $ this -> schedule as $ time => $ jobs ) { foreach ( $ jobs as $ job ) { $ list [ $ time ] [ ] = $ job -> getId ( ) ; } } return $ list ; } | Get current schedule |
53,807 | static function register ( iFilterStream $ filter , $ label = null ) { $ name = $ filter -> getLabel ( ) ; if ( self :: has ( $ name ) ) throw new \ Exception ( sprintf ( 'Filter "%s" is registered, and cant be overwritten.' , $ name ) ) ; if ( stream_filter_register ( $ name , get_class ( $ filter ) ) === false ) thro... | Register a user defined stream filter |
53,808 | static function get ( $ filterName ) { if ( ! self :: has ( $ filterName ) ) throw new \ Exception ( sprintf ( 'Filter "%s" Not Found.' , $ filterName ) ) ; return self :: $ filters [ $ filterName ] ; } | Get Filter By Name |
53,809 | static function has ( $ filterName ) { if ( $ filterName instanceof iFilterStream ) $ filterName = $ filterName -> getLabel ( ) ; $ result = in_array ( $ filterName , self :: listFilters ( ) ) ; return $ result ; } | Has Filter ? |
53,810 | public function beforeLoad ( ) { $ event = new ModelEvent ( ) ; $ this -> trigger ( self :: EVENT_BEFORE_LOAD ( ) , $ event ) ; return $ event -> isValid ; } | This method is invoked before load data starts . The default implementation raises a beforeLoad event . You may override this method to do preliminary checks before load data . Make sure the parent implementation is invoked so that the event can be raised . |
53,811 | protected function publishItems ( $ publishableItems ) { $ published = false ; foreach ( $ publishableItems as $ source => $ destination ) { $ destination = Str :: path ( $ destination ) ; if ( ! $ this -> filesystem -> exists ( $ destination ) ) { $ this -> filesystem -> create ( $ destination , $ this -> filesystem -... | Publish service assets |
53,812 | public static function getReturnTypes ( $ className , $ methodName ) { $ methodName = Method :: from ( $ className , $ methodName ) ; list ( $ types ) = preg_split ( '~\s~' , $ methodName -> getAnnotation ( 'return' ) , 2 ) ; return explode ( '|' , $ types ) ; } | Gains possible return type from the return method annotation . |
53,813 | public static function getClassAnnotations ( $ object ) { $ classReflection = new \ ReflectionClass ( $ object ) ; $ docBlock = $ classReflection -> getDocComment ( ) ; $ lines = explode ( "\n" , $ docBlock ) ; $ annotations = array ( ) ; foreach ( $ lines as $ line ) { if ( preg_match ( '~^(((\s*\*)|/\*\*)\s*@)(?<anno... | Gets annotations of a class . Not its predecessors only of this class . |
53,814 | public function resolveRefType ( $ reference ) : ? array { if ( $ tag = $ this -> parseRefAsTag ( $ reference ) ) { return [ 'tag' , $ tag ] ; } if ( $ pull = $ this -> parseRefAsPull ( $ reference ) ) { return [ 'pr' , $ pull ] ; } if ( $ commit = $ this -> parseRefAsCommit ( $ reference ) ) { return [ 'commit' , $ co... | Resolve a git reference type in the following format . |
53,815 | private function parseRefAsTag ( $ reference ) : ? string { if ( preg_match ( self :: REGEX_TAG , $ reference , $ matches ) !== 1 ) { return null ; } return $ matches [ 1 ] ; } | Parse a git reference as a tag return null on failure . |
53,816 | private function parseRefAsPull ( $ reference ) : ? string { if ( preg_match ( self :: REGEX_PULL , $ reference , $ matches ) !== 1 ) { return null ; } return $ matches [ 1 ] ; } | Parse a git reference as a pull request return null on failure . |
53,817 | private function parseRefAsCommit ( $ reference ) : ? string { if ( preg_match ( self :: REGEX_COMMIT , $ reference , $ matches ) !== 1 ) { return null ; } return $ matches [ 0 ] ; } | Parse a git reference as a commit return null on failure . |
53,818 | private function resolveTag ( $ user , $ repo , $ reference ) { if ( ! $ tag = $ this -> parseRefAsTag ( $ reference ) ) { return null ; } $ api = $ this -> client -> api ( 'git_data' ) -> references ( ) ; $ params = [ $ user , $ repo , sprintf ( 'tags/%s' , $ tag ) ] ; $ data = $ this -> callGitHub ( [ $ api , 'show' ... | Resolve a tag reference . Returns the commit sha or null on failure . |
53,819 | private function resolvePull ( $ user , $ repo , $ reference ) { if ( ! $ pull = $ this -> parseRefAsPull ( $ reference ) ) { return null ; } $ api = $ this -> client -> api ( 'pull_request' ) ; $ params = [ $ user , $ repo , $ pull ] ; $ data = $ this -> callGitHub ( [ $ api , 'show' ] , $ params ) ; return $ data [ '... | Resolve a pull request reference . Returns the commit sha or null on failure . |
53,820 | private function resolveCommit ( $ user , $ repo , $ reference ) { if ( ! $ commit = $ this -> parseRefAsCommit ( $ reference ) ) { return null ; } $ api = $ this -> client -> api ( 'git_data' ) -> commits ( ) ; $ params = [ $ user , $ repo , $ commit ] ; $ data = $ this -> callGitHub ( [ $ api , 'show' ] , $ params ) ... | Resolve a commit reference . Returns the commit sha or null on failure . |
53,821 | private function resolveBranch ( $ user , $ repo , $ branch ) { $ api = $ this -> client -> api ( 'git_data' ) -> references ( ) ; $ params = [ $ user , $ repo , sprintf ( 'heads/%s' , $ branch ) ] ; $ data = $ this -> callGitHub ( [ $ api , 'show' ] , $ params ) ; return $ data [ 'object' ] [ 'sha' ] ?? null ; } | Resolve a branch reference . Returns the head commit sha or null on failure . |
53,822 | protected function createInsert ( $ uid ) { $ field1 = rand ( 1 , 2 ) ; $ field2 = rand ( 0 , 1 ) ; return [ 'user_id' => $ uid , 'name' => $ this -> faker -> text ( 20 ) , 'value' => '{"field_1":"' . $ field1 . '","field_2":"' . $ field2 . '"}' ] ; } | Creates insert array |
53,823 | public function getPackageVersions ( $ global = false ) { if ( $ global ) { exec ( 'php ../vendor/composer/composer/bin/composer global show --installed 2> /dev/null' , $ packages ) ; } else { exec ( 'php ../vendor/composer/composer/bin/composer show --installed --working-dir=.. 2> /dev/null' , $ packages ) ; } return ... | returns a prepared list of the packages . |
53,824 | public function InsertInto ( string $ table ) : QueryBuilder { $ this -> method = 'INSERT INTO' ; $ this -> From ( $ table ) ; return $ this ; } | INSERT INTO statement |
53,825 | public function Columns ( $ columns = '' ) : QueryBuilder { if ( empty ( $ columns ) ) { return $ this ; } if ( ! is_array ( $ columns ) ) { $ this -> fields = explode ( ',' , $ columns ) ; } $ this -> fields = array_map ( 'trim' , $ this -> fields ) ; return $ this ; } | Colums to use in query |
53,826 | public function GroupBy ( $ fields ) : QueryBuilder { if ( is_array ( $ fields ) ) { $ fields = implode ( ', ' , $ field ) ; } $ this -> group_by = $ fields ; return $ this ; } | GroupBy statement . |
53,827 | public function Limit ( int $ lower , int $ upper = null ) : QueryBuilder { $ this -> limit [ 'lower' ] = ( int ) $ lower ; if ( isset ( $ upper ) ) { $ this -> limit [ 'upper' ] = ( int ) $ upper ; } return $ this ; } | Limit statement . |
53,828 | private function buildTableName ( ) : string { $ table = '{db_prefix}' . $ this -> table ; $ no_alias_methods = [ 'REPLACE' , 'INSERT' ] ; if ( in_array ( $ this -> method , $ no_alias_methods ) ) { return $ table ; } if ( ! empty ( $ this -> alias ) ) { $ table .= ' AS ' . $ this -> alias ; } return $ table ; } | Builds table name with alias while taking care of the method of the sql create |
53,829 | private function processQueryDefinition ( array $ query_definition ) { $ this -> definition = $ query_definition ; if ( ! empty ( $ this -> definition [ 'scheme' ] ) ) { $ this -> scheme = $ this -> definition [ 'scheme' ] ; } if ( isset ( $ this -> definition [ 'method' ] ) ) { $ this -> method = strtoupper ( $ this -... | Processes the content of an array containing a query definition |
53,830 | private function processSelect ( ) { $ this -> processTableDefinition ( ) ; $ this -> processFieldDefinition ( ) ; $ this -> processFilterDefinition ( ) ; $ this -> processParamsDefinition ( ) ; $ this -> processGroupByDefinition ( ) ; $ this -> processHavingDefinition ( ) ; $ this -> processJoinDefinition ( ) ; $ this... | Processes SELECT defintion |
53,831 | private function processFieldDefinition ( ) { if ( isset ( $ this -> definition [ 'field' ] ) ) { $ this -> fields = $ this -> definition [ 'field' ] ; } elseif ( isset ( $ this -> definition [ 'fields' ] ) ) { $ this -> fields = $ this -> definition [ 'fields' ] ; } else { $ this -> fields = '*' ; } } | Processes field sdefinition |
53,832 | private function processJoinDefinition ( ) { if ( isset ( $ this -> definition [ 'join' ] ) && is_array ( $ this -> definition [ 'join' ] ) ) { foreach ( $ this -> definition [ 'join' ] as $ join ) { $ array = new IsAssoc ( $ join ) ; if ( $ array -> isAssoc ( ) ) { $ this -> join [ ] = [ 'table' => $ join [ 'table' ] ... | Processes JOIN defintion . Such definition can be an assoc or indexed array . |
53,833 | private function processLimitDefinition ( ) { if ( isset ( $ this -> definition [ 'limit' ] ) ) { if ( is_array ( $ this -> definition [ 'limit' ] ) ) { switch ( count ( $ this -> definition [ 'limit' ] ) ) { case 1 : $ this -> limit [ 'lower' ] = ( int ) $ this -> definition [ 'limit' ] [ 0 ] ; break ; case 2 : defaul... | Processes limit defintion |
53,834 | private function processParamsDefinition ( ) { $ extend = isset ( $ this -> definition [ 'params' ] ) ? 's' : '' ; if ( isset ( $ this -> definition [ 'param' . $ extend ] ) ) { $ this -> setParameter ( $ this -> definition [ 'param' . $ extend ] ) ; } } | Processes parameter definition |
53,835 | private function checkSubquery ( $ expression ) : string { if ( is_array ( $ expression ) ) { $ qb = new QueryBuilder ( $ expression ) ; $ expression = '(' . $ qb -> build ( ) . ')' ; $ this -> params += $ qb -> getParams ( ) ; } return $ expression ; } | Checks for an expression for a QB defintion |
53,836 | public function setStatus ( $ status ) { if ( ! in_array ( $ status , range ( 0 , 3 ) ) ) throw new InvalidArgumentException ( "Invalid status $status" ) ; $ this -> status = $ status ; return $ this ; } | Set current job status |
53,837 | public function mergeTrees ( $ dataTree , $ tree ) { foreach ( $ tree as $ key => $ node ) { if ( is_numeric ( $ key ) ) { $ key = uniqid ( ) ; } if ( ! isset ( $ dataTree [ $ key ] ) ) { $ dataTree [ $ key ] = $ node ; } foreach ( $ node -> getSubNodeNames ( ) as $ subNode ) { if ( ! isset ( $ dataTree [ $ key ] -> $ ... | Merge two Node trees . |
53,838 | protected function createAcl ( ) { if ( ! $ this -> getDI ( ) -> has ( 'cache' ) ) { throw new Exception ( 'Please initialize the cache service!' ) ; } $ cache = $ this -> getDI ( ) -> get ( 'cache' ) ; if ( $ cache -> get ( 'acl' ) === null ) { $ roles = $ this -> roleEntity -> find ( ) ; \ FhpPhalconHelper \ Config :... | Create acl list |
53,839 | public function run ( ) { $ this -> loader -> register ( ) ; $ result = true ; $ classMap = array_slice ( $ this -> classMap , 0 ) ; while ( $ classMap ) { $ file = reset ( $ classMap ) ; $ class = key ( $ classMap ) ; try { $ result = $ this -> tryLoadClass ( $ class , $ file ) && $ result ; } catch ( ParentClassNotFo... | Perform the load cycle . |
53,840 | private function handleParentClassNotFound ( ParentClassNotFoundException $ exception , & $ classMap ) { $ classes = array ( ) ; while ( $ exception ) { $ parentClass = $ exception -> getParentClass ( ) ; $ classes [ ] = $ parentClass ; $ exception = $ exception -> getPrevious ( ) ; unset ( $ classMap [ $ parentClass ]... | Handle the parent class not found exceptions an log the parent class hierarchy . |
53,841 | private function tryLoadClass ( $ className , $ file ) { if ( $ this -> isLoaded ( $ className ) ) { return true ; } $ this -> logger -> debug ( 'Trying to load {class} (should be located in file {file}).' , array ( 'class' => $ className , 'file' => $ file ) ) ; try { $ this -> loader -> loadClass ( $ className ) ; if... | Try to load a class . |
53,842 | public function refreshInstance ( ) { $ this -> counter = 0 ; $ this -> startedAt = microtime ( true ) ; $ this -> expiresAt = $ this -> computeExpiration ( ) ; $ this -> setUpComponents ( $ this -> components ) ; } | Restart all counters and state variables . |
53,843 | public function setName ( $ name ) { if ( ThrottlerHelper :: validateName ( $ name ) && ! $ this -> isActive ( ) ) { $ this -> name = $ name ; return true ; } return false ; } | Name setter . |
53,844 | public function setMetric ( $ metric ) { if ( ThrottlerHelper :: validateMetric ( $ metric , self :: $ timeFactor ) && ! $ this -> isActive ( ) ) { $ this -> metric = strtolower ( $ metric ) ; return true ; } return false ; } | Metric setter . |
53,845 | public function setMetricFactor ( $ times ) { if ( ThrottlerHelper :: validateMetricFactor ( $ times ) && ! $ this -> isActive ( ) ) { $ this -> metricFactor = $ times ; return true ; } return false ; } | Metric unit setter . |
53,846 | private function allowedUpdate ( $ component , $ hits ) { $ globalCheck = ( $ this -> getCounter ( ) + $ hits ) <= $ this -> getGlobalThreshold ( ) ; $ componentCheck = true ; if ( null !== $ this -> getComponentThreshold ( ) ) { $ componentCheck = ( $ this -> getComponentCounter ( $ component ) + $ hits ) <= $ this ->... | Check the tracked components to see if an update is allowed . |
53,847 | private function computeExpiration ( ) { $ delta = self :: $ timeFactor [ $ this -> getMetric ( ) ] * $ this -> getMetricFactor ( ) ; return $ this -> getTimeStart ( ) + $ delta ; } | Compute expiration date . |
53,848 | public function move ( $ deltaX , $ deltaY ) : Vector { return new self ( $ this -> x + $ deltaX , $ this -> y + $ deltaY ) ; } | Scalar displacement . |
53,849 | public function mult ( $ factor ) : Vector { return new self ( $ this -> x * $ factor , $ this -> y * $ factor ) ; } | Scalar multiplication . |
53,850 | public function add ( Vector $ other ) : Vector { return new self ( $ this -> x + $ other -> getX ( ) , $ this -> y + $ other -> getY ( ) ) ; } | Vector addition . |
53,851 | public function dot ( Vector $ other ) : float { return $ this -> x * $ other -> getX ( ) + $ this -> y * $ other -> getY ( ) ; } | Dot product . |
53,852 | public function render ( BuilderInterface $ builder ) { list ( $ code , $ name , $ symbol , $ displayFormat , $ locale , $ precision , $ value ) = array_values ( $ builder -> getResult ( ) ) ; $ tpl = file_get_contents ( __DIR__ . '/CurrencyClass.tpl' ) ; $ out = str_replace ( array ( '<namespace>' , '<name>' , '<code>... | Render Currency class definition and save to target outDir |
53,853 | public function validateSettings ( array & $ submitted , array $ options = array ( ) ) { $ this -> options = $ options ; $ this -> submitted = & $ submitted ; $ this -> validateInitialPathSettings ( ) ; $ this -> validateLimitSettings ( ) ; $ this -> validateAccessSettings ( ) ; $ this -> validateExtensionSettings ( ) ... | Validates module settings |
53,854 | protected function validateInitialPathSettings ( ) { $ field = 'initial_path' ; $ path = $ this -> getSubmitted ( $ field ) ; if ( strlen ( $ path ) > 0 && preg_match ( '/^[\w-]+[\w-\/]*[\w-]+$|^[\w-]$/' , $ path ) !== 1 ) { $ this -> setErrorInvalid ( $ field , $ this -> translation -> text ( 'Initial path' ) ) ; retu... | Validates the initial path field |
53,855 | protected function validateLimitSettings ( ) { $ field = 'limit' ; $ limit = $ this -> getSubmitted ( $ field ) ; if ( ! ctype_digit ( $ limit ) || strlen ( $ limit ) > 3 ) { $ this -> setErrorInteger ( $ field , $ this -> translation -> text ( 'Limit' ) ) ; return false ; } return true ; } | Validates limit field |
53,856 | protected function validateAccessSettings ( ) { $ field = 'access' ; $ rules = $ this -> getSubmitted ( $ field ) ; $ errors = $ converted = array ( ) ; foreach ( gplcart_string_explode_multiline ( $ rules ) as $ line => $ rule ) { $ line ++ ; $ parts = gplcart_string_explode_whitespace ( $ rule , 2 ) ; if ( count ( $ ... | Validates the path access field |
53,857 | protected function validateExtensionSettings ( ) { $ field = 'extension_limit' ; $ rules = $ this -> getSubmitted ( $ field ) ; $ errors = $ converted = array ( ) ; foreach ( gplcart_string_explode_multiline ( $ rules ) as $ line => $ rule ) { $ line ++ ; $ parts = gplcart_string_explode_whitespace ( $ rule , 2 ) ; if ... | Validates the allowed extensions field |
53,858 | protected function validateFileSizeSettings ( ) { $ field = 'filesize_limit' ; $ rules = $ this -> getSubmitted ( $ field ) ; $ errors = $ converted = array ( ) ; foreach ( gplcart_string_explode_multiline ( $ rules ) as $ line => $ rule ) { $ line ++ ; $ parts = gplcart_string_explode_whitespace ( $ rule , 2 ) ; if ( ... | Validates the file size limit field |
53,859 | private function mapLogLevel ( $ severity ) { if ( ! array_key_exists ( $ severity , $ this -> logLevelMap ) ) { throw new \ InvalidArgumentException ( 'Severity is not mapped: ' . $ severity ) ; } return $ this -> logLevelMap [ $ severity ] ; } | Map the severity to a log level . |
53,860 | private function prepareContext ( $ parameters ) { $ new = array ( ) ; foreach ( $ parameters as $ name => $ value ) { if ( is_array ( $ value ) ) { $ subNew = array ( ) ; foreach ( $ value as $ index => $ subValue ) { $ subNew [ ] = sprintf ( '<comment>%s</comment>: <comment>%s</comment>' , $ index , var_export ( $ su... | Prepare the log parameters if we are using a console logger . |
53,861 | protected static function isAssoc ( array $ array ) { if ( empty ( $ array ) ) { return false ; } if ( isset ( $ array [ 0 ] ) ) { $ n = count ( $ array ) - 1 ; return array_sum ( array_keys ( $ array ) ) != ( $ n * ( $ n + 1 ) ) / 2 ; } else { return true ; } } | Returns whether an array is index based or associative |
53,862 | public function matchGroup ( $ user ) { if ( $ this -> groups == '*' ) { return true ; } return empty ( $ this -> groups ) || in_array ( $ user -> identity -> getGroup ( ) , $ this -> groups , true ) ; } | untuk menggunakan match group user identityClass harus menggunakan class \ codeup \ models \ UserIdent |
53,863 | public function before ( $ user , $ ability ) { if ( $ ability != 'view' && User :: findOrFail ( $ user -> id ) -> superAdmin ( ) ) { return true ; } } | Filters the authoritzation . |
53,864 | public function view ( $ user , Ticket $ ticket ) { if ( $ ticket -> admin_id == $ user -> id ) { return true ; } return User :: findOrFail ( $ user -> id ) -> hasPermission ( 'laralum::tickets.view' ) ; } | Determine if the current user can view tickets . |
53,865 | public function retrieveForTemplate ( Template $ template ) { return $ this -> toEntityCollection ( $ this -> getEntityRepository ( ) -> createQueryBuilder ( 'zone' ) -> select ( 'zone' , 'components' ) -> leftJoin ( 'zone.components' , 'components' ) -> where ( 'zone.template = :template' ) -> setParameter ( ':templat... | Retrieve all zones and components for given template |
53,866 | protected function callReadMethod ( $ file , $ controller ) { if ( ! $ file -> isFile ( ) ) { return '' ; } $ extension = $ file -> getExtension ( ) ; foreach ( $ this -> getMethods ( ) as $ method => $ extensions ) { if ( in_array ( $ extension , $ extensions ) ) { return $ this -> $ method ( $ file , $ controller ) ;... | Calls a method to read a file using its extension |
53,867 | protected function viewImage ( $ file , $ controller ) { $ path = $ file -> getRealPath ( ) ; $ data = array ( 'file' => $ file , 'src' => $ controller -> image ( gplcart_file_relative ( $ path ) ) , 'exif' => function_exists ( 'exif_read_data' ) ? exif_read_data ( $ path ) : array ( ) ) ; return $ controller -> render... | Returns rendered image content |
53,868 | protected function viewText ( $ file , $ controller ) { $ data = array ( 'file' => $ file , 'content' => file_get_contents ( $ file -> getRealPath ( ) ) ) ; return $ controller -> render ( 'file_manager|readers/text' , $ data ) ; } | Returns rendered text content |
53,869 | protected function viewInfo ( $ file , $ controller ) { $ data = array ( 'file' => $ file , 'perms' => gplcart_file_perms ( $ file -> getPerms ( ) ) , 'filesize' => gplcart_file_size ( $ file -> getSize ( ) ) ) ; return $ controller -> render ( 'file_manager|readers/info' , $ data ) ; } | Returns rendered file info content |
53,870 | public function getUrl ( $ options = array ( ) ) { if ( ! is_array ( $ options ) ) { $ options = array ( self :: OPTION_EMAIL => strval ( $ options ) ) ; } $ options = array_merge ( $ options , $ this -> options ) ; $ url = $ options [ self :: OPTION_HTTPS ] ? self :: URL_HTTPS : self :: URL_HTTP ; $ url .= md5 ( \ Thi... | Fetch the URL of the gravatar image |
53,871 | public function render ( $ options = array ( ) ) { if ( ! \ Thin \ Arrays :: isArray ( $ options ) ) { $ options = [ self :: OPTION_EMAIL => strval ( $ options ) ] ; } $ options = $ options + $ this -> options ; $ attributes = new \ Thin \ Html \ Attributes ( ) ; $ attributes -> set ( $ this -> attributes ) -> set ( 's... | Render the gravatar image HTML |
53,872 | public function menuWidget ( $ data = [ ] , $ callback = false ) { $ data = array_merge ( [ 'items' => [ $ this -> owner ] , 'behavior' => $ this , 'view' => 'node' ] , $ data ) ; if ( $ callback ) { $ data = $ this -> $ callback ( $ data ) ; } $ widget = new ARTreeMenuWidget ( $ data ) ; return $ widget -> run ( ) ; } | Generates jstree menu from owner children . |
53,873 | private function deriveView ( $ view ) { if ( self :: exists ( $ view ) ) { return $ view ; } if ( $ this -> namespaces === NULL ) { $ this -> namespaces = config ( 'layout-view.namespaces' ) ; } if ( $ this -> selected_layout === NULL ) { $ this -> selected_layout = config ( 'layout-view.layout.selected' ) ; } if ( $ ... | Used to dervive the view that will be displayed . |
53,874 | protected function connect ( $ configs = null ) : void { if ( $ configs !== null ) { $ this -> configs = array_replace ( $ this -> configs , $ configs ) ; } $ dsn = "{$this->configs['type']}:dbname={$this->configs['name']};host=" . $ this -> configs [ 'host' ] ; try { $ this -> connection = new PDO ( $ dsn , $ this -> ... | Create a database connection and instantiate PDO . |
53,875 | public function execute ( $ array , $ stmt = 'stmt' ) : Database { $ this -> values = [ ] ; $ this -> lastid = null ; $ stmt = 'prepare_' . $ stmt ; try { $ sth = $ this -> $ stmt -> execute ( $ array ) ; } catch ( PDOException $ e ) { throw new CoreException ( __CLASS__ . '::execute()->PDOStatement::execute() : ' . $ ... | Excutes a prepared statement |
53,876 | public function fetchArray ( $ params = false ) { if ( \ count ( $ this -> values ) === 0 ) { return false ; } if ( \ count ( $ this -> values ) > 1 ) { return $ this -> values ; } if ( $ params === true ) { return $ this -> values ; } if ( \ is_array ( $ params ) && array_key_exists ( 'item' , $ params ) ) { $ item = ... | Get the array of values fetched from database |
53,877 | public function prepare ( $ sql , string $ stmt = 'stmt' ) : Database { $ stmt = 'prepare_' . $ stmt ; try { $ this -> $ stmt = $ this -> connection -> prepare ( $ sql ) ; } catch ( PDOException $ e ) { throw new CoreException ( __CLASS__ . '::prepare()->PDO::prepare() : ' . $ e -> getMessage ( ) ) ; } $ store_sql = $ ... | Prepare a query statement to be executed at a later time . |
53,878 | public function setConfig ( string $ name , $ value ) : void { if ( array_key_exists ( $ name , $ this -> configs ) ) { $ this -> configs [ $ name ] = $ value ; } } | Allows the user to set configurations after the object is instantiated |
53,879 | public function run ( ServerRequestInterface $ request ) : void { $ this -> emitter -> emit ( $ this -> middleware -> handle ( $ request ) ) ; } | Run the application . Triggers the requestHandler provided and when a response is returned it passes it to the emitter for final processing before sending it to the client |
53,880 | public function beforeExecution ( BeforeShellCommandExecutionEvent $ event ) { $ cmd = $ event -> getCommand ( ) ; $ cmd = str_replace ( '"' , '\'' , $ cmd ) ; $ event -> setCommand ( $ cmd ) ; } | Callback method that sanitizes the command the user entered . |
53,881 | protected function setMessagePayload ( array $ payload ) : void { $ this -> payloadOrigin = new ImmutableParameter ( $ payload ) ; $ temp = [ ] ; foreach ( $ payload as $ key => $ value ) { $ property = $ this -> toCamelCase ( $ key ) ; if ( property_exists ( $ this , $ property ) ) { $ this -> setPropValue ( $ propert... | Filter and set payload message . |
53,882 | private function toCamelCase ( string $ value ) : string { $ value = ucwords ( str_replace ( [ '-' , '_' ] , ' ' , $ value ) ) ; return lcfirst ( str_replace ( ' ' , '' , $ value ) ) ; } | Convert snake case to camel case . |
53,883 | private function setPropValue ( string $ key , $ value ) : void { $ property = new ReflectionProperty ( get_class ( $ this ) , $ key ) ; $ property -> setAccessible ( true ) ; $ property -> setValue ( $ this , $ value ) ; } | Sets value by specified key . |
53,884 | protected function parse ( $ old , $ query , Model $ model , & $ transformed ) { $ key = $ old ; $ value = $ model -> $ old ; foreach ( explode ( '|' , $ query ) as $ command ) { list ( $ function , $ args ) = explode ( ':' , $ command ) ; $ args = array_merge ( [ & $ key , & $ value , $ model ] , explode ( ',' , $ arg... | Builds up the cast query . |
53,885 | public function alsoLoad ( $ fields ) { if ( ! is_array ( $ fields ) ) { $ fields = [ $ fields ] ; } foreach ( $ fields as $ field ) { $ this -> mapping [ 'alsoLoadFields' ] [ ] = $ field ; } return $ this ; } | Adds one or more fields to the alsoLoadFields mapping . Does not overwrite existing set fields . |
53,886 | public function boot ( ) { parent :: boot ( ) ; if ( ! $ this -> app -> make ( 'antares.installed' ) ) { return ; } if ( app ( ) -> bound ( 'antares-search-row-decorator' ) ) { $ this -> app -> make ( 'antares-search-response' ) -> boot ( ) ; } } | Boot servicer provider |
53,887 | public static function file_force_contents ( $ dir , $ contents , $ flags = 0 ) { $ dir = explode ( '/' , $ dir ) ; $ file = array_pop ( $ dir ) ; $ dir = implode ( '/' , $ dir ) ; clearstatcache ( true , $ dir ) ; if ( ! file_exists ( $ dir ) ) { mkdir ( $ dir , 0705 , true ) ; } return file_put_contents ( $ dir . '/'... | Write a file with the content |
53,888 | public function getLeaderboardService ( ) { if ( ! $ this -> leaderboardService ) { $ this -> leaderboardService = $ this -> serviceLocator -> get ( 'playgroundreward_leaderboard_service' ) ; } return $ this -> leaderboardService ; } | Retrieve service Leaderboard |
53,889 | public function qpop ( $ key , $ block = false ) { return $ this -> send ( [ 'command' => 'qpop' , 'key' => $ key , 'block' => $ block , 'seq' => $ this -> getSequence ( ) ] ) ; } | Extract data from the queue |
53,890 | public function flagFilter ( Twig_Environment $ twig , $ flag ) { return sprintf ( '<img src="%s" />' , call_user_func ( $ twig -> getFunction ( 'asset' ) -> getCallable ( ) , sprintf ( "/bundles/pmtool/img/flags/%s.png" , strtolower ( $ flag ) ) ) ) ; } | Get Flag Image |
53,891 | public static function fromMessage ( Message $ msg ) { $ count = $ msg -> shift ( ) ; if ( $ count != $ msg -> count ( ) ) { throw new InvalidArgumentException ( 'The action count is not the same as the actual number of actions.' ) ; } return new self ( $ msg -> toArray ( ) ) ; } | Creates a FetchAction message from the Message . |
53,892 | public function create ( ... $ args ) : String { $ combineTransitions = $ args ; $ str = $ this -> selector . "{" ; if ( ! empty ( $ this -> attr ) ) $ str .= EOL . $ this -> attr . EOL ; $ str .= $ this -> complete ( ) ; if ( ! empty ( $ combineTransitions ) ) foreach ( $ combineTransitions as $ transition ) { $ str .... | Creates element . |
53,893 | public function new ( array $ attributes = [ ] , bool $ exists = false ) : Model { return $ this -> model -> newInstance ( $ attributes , $ exists ) ; } | Gets an instance of the current type model |
53,894 | public function applyRoutes ( App $ cdl , Slim $ app ) { $ routes = System :: getRoutesFromSettings ( $ this -> settings ) ; foreach ( $ routes as $ method => $ data ) { Dispatcher :: run ( $ cdl , $ method , $ app , $ this , $ data ) ; } } | Adds the types routes to the given Slim instance |
53,895 | public function send ( $ message , $ channel , $ username = '' , $ extraParams = array ( ) ) { $ slackMsg = $ this -> formatMessage ( $ message , $ channel , $ username , $ extraParams ) ; $ this -> sendRaw ( $ slackMsg ) ; } | Send a message to slack |
53,896 | public function formatMessage ( $ message , $ channel , $ username , $ extraParams ) { $ data = array ( "text" => $ message , "channel" => $ channel ) ; if ( ! empty ( $ username ) ) { $ data [ 'username' ] = $ username ; } $ slackMsg = json_encode ( array_merge ( $ data , $ extraParams ) ) ; return $ slackMsg ; } | Format a slack message |
53,897 | private function sendRaw ( $ slackMsg ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ this -> endpoint ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , "POST" ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ slackMsg ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_... | Send a json to slack |
53,898 | public static function getQueryBuilder ( String $ connectionId = null ) { if ( $ connectionId == null ) { $ connectionId = Repository :: $ staticConnectionId ; } return self :: getInstance ( $ connectionId ) -> provider -> queryBuilder ( new ConnectionManager ( ) , $ connectionId ) ; } | Returns instance of query builder . |
53,899 | public static function getSchema ( String $ connectionId = null ) : SchemaManagerContract { if ( $ connectionId == null ) { $ connectionId = Repository :: $ staticConnectionId ; } return self :: getInstance ( $ connectionId ) -> provider -> schemaManager ( $ connectionId , Repository :: getQueryBuilder ( $ connectionId... | Returns instance of SchemaManager . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.