idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
239,800 | protected function collectClassData ( $ item , array $ data , \ ReflectionClass $ reflector ) : array { foreach ( $ this -> getClassVariants ( $ reflector , $ item ) as $ name ) { $ key = $ this -> getItemKey ( $ name ) ; if ( ! array_key_exists ( $ key , $ data [ 'data' ] ) || $ this -> isItemGreedy ( $ data [ 'data' ... | Collect class data |
239,801 | protected function addClassData ( array $ data , string $ key , \ ReflectionClass $ reflector , $ item , $ variant ) : array { $ data [ 'data' ] [ $ key ] = $ this -> getClassData ( $ reflector , $ item , $ variant ) ; return $ data ; } | Add class data |
239,802 | protected function isItemGreedy ( array $ info , \ ReflectionClass $ reflector , $ item ) : bool { $ base = new \ ReflectionClass ( $ info [ 'class' ] ) ; if ( $ reflector -> isSubclassOf ( $ base -> getName ( ) ) ) return true ; if ( ! $ base -> isSubclassOf ( $ reflector -> getName ( ) ) ) throw new \ LogicException ... | Returns true if item is greedy |
239,803 | protected function getClassBaseNames ( $ item ) : array { $ basenames = array ( ) ; $ reflector = new \ ReflectionClass ( $ item ) ; do { if ( ! $ reflector -> isAbstract ( ) ) { $ docComment = $ reflector -> getDocComment ( ) ; if ( $ docComment && strpos ( $ docComment , '@easy-extend-base' ) !== false ) { $ basename... | Get class base names |
239,804 | protected function getClassTraits ( \ ReflectionClass $ reflector ) : array { $ class = $ reflector -> getName ( ) ; $ traits = array ( ) ; do { $ traits = array_merge ( class_uses ( $ class ) , $ traits ) ; } while ( $ class = get_parent_class ( $ class ) ) ; foreach ( $ traits as $ trait ) $ traits = array_merge ( cl... | Get class traits |
239,805 | public function getItemData ( $ name ) : array { if ( func_num_args ( ) > 1 ) $ name = func_get_args ( ) ; if ( ! $ this -> hasItemData ( $ name ) ) return $ this -> getItemDataNotFound ( $ name ) ; return $ this -> getData ( ) [ $ this -> getItemKey ( $ name ) ] ; } | Get item data |
239,806 | public function hasItemData ( $ name ) : bool { if ( func_num_args ( ) > 1 ) $ name = func_get_args ( ) ; return array_key_exists ( $ this -> getItemKey ( $ name ) , $ this -> getData ( ) ) ; } | Has item data |
239,807 | public function getItemKey ( $ name ) : string { if ( func_num_args ( ) > 1 ) $ name = func_get_args ( ) ; if ( is_array ( $ name ) ) return implode ( '|' , $ name ) ; return ( string ) $ name ; } | Returns item key |
239,808 | public function isValid ( ) { $ valid = $ this -> valid ; if ( $ this -> isMultiple ( ) ) { $ valid = $ this -> isMultipleValid ( ) ; } return $ valid ; } | Check if the value is valid |
239,809 | protected function isMultipleValid ( ) { if ( ! $ this -> isRendering ( ) ) { return empty ( $ this -> invalidInstances ) ; } return ! in_array ( $ this -> getInstance ( ) , $ this -> invalidInstances ) ; } | Validates when input is set to be multiple |
239,810 | protected function validateArray ( array $ values , $ context ) { foreach ( $ values as $ key => $ value ) { $ valid = $ this -> getValidationChain ( ) -> validates ( $ value , $ context ) ; if ( ! $ valid ) { $ this -> setInvalid ( $ key ) ; } } } | Validates input when is set to be multiple |
239,811 | public function addValidator ( $ validator , $ message = null ) { try { $ msg = $ message ; if ( is_array ( $ message ) ) { $ msg = array_shift ( $ message ) ; $ this -> context = $ message ; } $ validator = StaticValidator :: create ( $ validator , $ msg ) ; $ this -> getValidationChain ( ) -> add ( $ validator ) ; if... | Adds a validator to the validation chain |
239,812 | public function getReferer ( ) { $ referer = null ; if ( array_key_exists ( self :: REFERER_KEY , $ this -> serverData ) ) { $ referer = $ this -> serverData [ self :: REFERER_KEY ] ; } return $ referer ; } | Get the HTTP REFERER from the server data . |
239,813 | public function collect ( MvcEvent $ mvcEvent ) { $ layout = $ mvcEvent -> getViewModel ( ) ; $ blocks = [ ] ; foreach ( $ this -> layout -> getBlocks ( ) as $ blockId => $ block ) { if ( $ parentBlock = $ block -> getOption ( 'parent' ) ) { $ captureTo = $ parentBlock . '::' . $ block -> captureTo ( ) ; } else { $ cap... | collect data for zdt |
239,814 | private function resolveTemplate ( $ template ) { $ template = str_replace ( getcwd ( ) , '' , $ this -> viewResolver -> resolve ( $ template ) ) ; return $ template ; } | retrieve resolved template path |
239,815 | function meta ( ) { if ( ! $ this -> _rMetaInfo ) $ this -> _rMetaInfo = new MetaReaderOfPhpResource ( $ this -> getRHandler ( ) ) ; return $ this -> _rMetaInfo ; } | Meta Data About Handler |
239,816 | function removeFilter ( iFilterStream $ filter ) { $ filterName = $ filter -> getLabel ( ) ; if ( isset ( $ this -> attachedFilters [ $ filterName ] ) ) { $ filterRes = $ this -> attachedFilters [ $ filterName ] ; stream_filter_remove ( $ filterRes ) ; unset ( $ this -> attachedFilters [ $ filterName ] ) ; } return $ t... | Remove Given Filter From Resource |
239,817 | public function select ( array $ configs , $ options ) { $ label = ( ! empty ( $ options [ 'name' ] ) ? ucwords ( $ options [ 'name' ] ) : '' ) ; return ' <div class="input-field"> ' . parent :: plainSelect ( array_merge ( [ 'id' => $ this -> genId ( $ label ) , ] , $ configs ) , $ options ) . ( empty ( $... | Generate a select . |
239,818 | public function textarea ( array $ options , $ text = '' ) { $ label = ( ! empty ( $ options [ 'name' ] ) ? ucwords ( $ options [ 'name' ] ) : '' ) ; return ' <div class="input-field"> ' . parent :: plainTextarea ( array_merge ( [ 'class' => 'materialize-textarea' , 'id' => $ this -> genId ( $... | Generate a textarea . |
239,819 | public function input ( array $ options ) { $ label = ( ! empty ( $ options [ 'name' ] ) ? ucwords ( $ options [ 'name' ] ) : '' ) ; return ' <div class="input-field"> ' . parent :: plainInput ( array_merge ( [ 'class' => 'validate' , 'id' => $ this -> genId ( $ label ) , ] , $ options ) ) . ( emp... | Generate an input area . |
239,820 | final public function addPropertyIf ( Bool $ condition = null , String $ property , $ value = null ) { if ( $ condition == true ) { $ this -> softProperties [ $ property ] = $ value ; } } | Adds a property to list of soft properties if condition is true . |
239,821 | final public function addPropertyIfNot ( Bool $ condition = null , String $ property , $ value = null ) { if ( $ condition == false ) { $ this -> softProperties [ $ property ] = $ value ; } } | Adds a property to list of soft properties if condition is false . |
239,822 | public function hasRelation ( String $ label ) : Bool { if ( isset ( $ this -> relations [ $ label ] ) ) { return true ; } return false ; } | Checks if model is related to another model . |
239,823 | protected function toSql ( $ fields = null ) : QueryBuilder { $ queryBuilder = $ this -> queryBuilder ( ) -> select ( $ fields ) -> from ( $ this -> table ) ; $ orderBy = [ ] ; if ( isset ( Model :: $ findOptions [ 'asc' ] ) ) { $ orderBy [ ] = Model :: $ findOptions [ 'asc' ] . ' ASC' ; } if ( isset ( Model :: $ findO... | Returns a prepared query that will be used by other find methods . |
239,824 | protected function isAccessible ( String $ property ) : Bool { if ( in_array ( $ property , $ this -> accessibleProperties ( ) ) ) { return true ; } return false ; } | Checks if a property can be accessed . |
239,825 | private static function getPostfix ( Option $ Option ) { $ postfix = '' ; if ( $ Option -> getType ( ) == Option :: TYPE_STRING ) { $ postfix .= ':' ; if ( ! $ Option -> isRequired ( ) ) { $ postfix .= ':' ; } } return $ postfix ; } | Method to build getopt parameter postfix for option |
239,826 | private function getOptionsSearchStrings ( ) { if ( empty ( $ this -> searchStringsCache ) ) { $ this -> searchStringsCache = array ( 0 => '' , 1 => array ( ) , ) ; foreach ( $ this -> parameters as $ Option ) { $ postfix = self :: getPostfix ( $ Option ) ; $ this -> searchStringsCache [ 0 ] .= $ Option -> getShort ( )... | Method to get getopt parameters for command line parsing |
239,827 | public function parse ( $ panic = false ) { list ( $ shorts , $ longs ) = $ this -> getOptionsSearchStrings ( ) ; $ options = getopt ( $ shorts , $ longs ) ; $ Exception = null ; foreach ( $ this -> parameters as $ Option ) { $ short = $ Option -> getShort ( ) ; $ long = $ Option -> getLong ( ) ; switch ( true ) { case... | POSIX parse command line method |
239,828 | public function displayHelp ( ) { $ string = 'Using: ' . $ this -> script . ' ' . $ this -> command . ' ' ; $ where = array ( ) ; foreach ( $ this -> parameters as $ Option ) { $ short = $ Option -> getShort ( ) ; $ long = $ Option -> getLong ( ) ; $ temp = '-' . $ short . '|--' . $ long ; if ( ! $ Option -> isRequired... | Display command help |
239,829 | private function setOptionValue ( Option $ Option , $ value ) { $ Option -> setValue ( $ value ) ; $ long = $ Option -> getLong ( ) ; if ( isset ( $ this -> events [ $ long ] ) ) { $ Handler = $ this -> events [ $ long ] ; $ Handler ( $ long , $ value ) ; } } | Method to set option value and call event handler if needed |
239,830 | public function setAdapterAction ( $ action ) { if ( true === $ this -> isInited ) { $ this -> resetOutput ( ) ; } $ this -> __adapter_action = $ action ; return $ this ; } | Set the adapter action to process and reset the output |
239,831 | public function addContent ( $ str , $ index = null ) { if ( ! is_null ( $ index ) ) { $ this -> contents [ $ index ] = $ str ; } else { $ this -> contents [ ] = $ str ; } return $ this ; } | Add a raw content to treat |
239,832 | public function setDestinationFile ( $ destination_file ) { if ( is_string ( $ destination_file ) ) { $ this -> destination_file = $ destination_file ; } else { if ( false === $ this -> silent ) { throw new \ InvalidArgumentException ( sprintf ( '[Compressor] Destination file name must be a string (got "%s")!' , gettyp... | Set the destination file to write the result in |
239,833 | public function guessDestinationFilename ( ) { if ( ! empty ( $ this -> files_stack ) ) { $ this -> _cleanFilesStack ( ) ; $ this -> init ( ) ; $ _fs = array ( ) ; foreach ( $ this -> files_stack as $ _file ) { $ _fs [ ] = $ _file -> getFilename ( ) ; } if ( ! empty ( $ _fs ) ) { sort ( $ _fs ) ; $ this -> setDestinati... | Build a destination filename based on the files stack names |
239,834 | public function setDestinationDir ( $ destination_dir ) { if ( is_string ( $ destination_dir ) ) { $ destination_dir = realpath ( $ destination_dir ) ; if ( @ file_exists ( $ destination_dir ) && @ is_dir ( $ destination_dir ) ) { $ this -> destination_dir = rtrim ( $ destination_dir , '/' ) . '/' ; } elseif ( false ==... | Set the destination directory to write the destination file in |
239,835 | public function getDestinationWebPath ( ) { if ( ! empty ( $ this -> web_root_path ) ) { return str_replace ( $ this -> web_root_path , '' , $ this -> getDestinationRealPath ( ) ) ; } elseif ( false === $ this -> silent ) { throw new \ LogicException ( '[Compressor] Can\'t create web path because "web_root_path" is not... | Get the destination file path ready for web inclusion |
239,836 | public function mustRefresh ( ) { if ( $ this -> fileExists ( ) ) { $ this -> _cleanFilesStack ( ) ; $ _dest = new \ SplFileInfo ( $ this -> getDestinationRealPath ( ) ) ; if ( ! empty ( $ this -> files_stack ) ) { foreach ( $ this -> files_stack as $ _file ) { if ( $ _file -> getMTime ( ) > $ _dest -> getMTime ( ) ) {... | Check if a destination file already exist for the current object and if it is fresher than sources |
239,837 | public function process ( ) { $ this -> _cleanFilesStack ( ) ; $ this -> init ( ) ; if ( empty ( $ this -> destination_file ) && false === $ this -> direct_output ) { $ this -> guessDestinationFilename ( ) ; } if ( ! method_exists ( $ this -> __adapter , $ this -> __adapter_action ) ) { throw new \ RuntimeException ( s... | Process the current files stack |
239,838 | protected function _cleanFilesStack ( ) { if ( true === $ this -> isCleaned_files_stack ) { return ; } $ new_stack = array ( ) ; foreach ( $ this -> files_stack as $ _file ) { if ( is_object ( $ _file ) && ( $ _file instanceof \ SplFileInfo ) ) { $ new_stack [ ] = $ _file ; } elseif ( is_string ( $ _file ) && @ file_ex... | Rebuild the current files stack as an array of File objects |
239,839 | protected function _guessAdapterType ( ) { $ this -> _cleanFilesStack ( ) ; if ( ! empty ( $ this -> files_stack ) ) { $ _fs = $ this -> files_stack ; $ _file = array_shift ( $ _fs ) ; $ this -> setAdapterType ( $ _file -> getExtension ( ) ) ; return true ; } elseif ( false === $ this -> silent ) { throw new \ RuntimeE... | Guess the adapter type based on extension of the first file in stack |
239,840 | protected function _writeDestinationFile ( ) { if ( empty ( $ this -> destination_file ) ) { $ this -> guessDestinationFilename ( ) ; } $ content = $ this -> _getHeaderComment ( ) . "\n" . $ this -> output ; $ dest_file = $ this -> getDestinationRealPath ( ) ; if ( false !== file_put_contents ( $ dest_file , $ content ... | Writes the compressed content in the destination file |
239,841 | protected function _getHeaderComment ( ) { $ this -> init ( ) ; return $ this -> __adapter -> buildComment ( sprintf ( 'Generated by %s class on %s at %s' , __CLASS__ , date ( 'Y-m-d' ) , date ( 'H:i' ) ) ) ; } | Build the compressed content header comment information |
239,842 | protected function getRepoFromGithubConfig ( ) { $ remote = `git remote get-url origin 2> /dev/null` ; if ( ! starts_with ( $ remote , [ 'git@github.com:' , 'https://github.com/' ] ) ) { return '' ; } if ( starts_with ( $ remote , 'git@github.com:' ) ) { return explode ( '.' , explode ( ":" , $ remote ) [ 1 ] ) [ 0 ] ;... | Get github repo from github . |
239,843 | public static function encrypt ( $ sValue , $ sSecretKey , $ migration = false ) { if ( empty ( $ sValue ) ) { return "" ; } if ( true === $ migration ) { $ sSecretKey = substr ( $ sSecretKey , 0 , 30 ) . "\0\0" ; } else { $ sSecretKey = substr ( $ sSecretKey , 0 , 32 ) ; } return rtrim ( base64_encode ( mcrypt_encrypt... | Encrypt Value by Key |
239,844 | public static function decrypt ( $ sValue , $ sSecretKey , $ migration = false ) { if ( empty ( $ sValue ) ) { return "" ; } if ( true === $ migration ) { $ sSecretKey = substr ( $ sSecretKey , 0 , 30 ) . "\0\0" ; } else { $ sSecretKey = substr ( $ sSecretKey , 0 , 32 ) ; } return rtrim ( mcrypt_decrypt ( MCRYPT_RIJNDA... | Decrypt value by key |
239,845 | public function getContent ( ) { $ content = $ this -> getRawContent ( ) ; $ content = apply_filters ( 'the_content' , $ content ) ; $ content = str_replace ( ']]>' , ']]>' , $ content ) ; return $ content ; } | Get the post content formatted as HTML . |
239,846 | public function getExcerpt ( $ content = null ) { $ raw = $ exc = $ this -> base -> post_excerpt ; if ( ! strlen ( $ exc ) ) { $ exc = $ content === null ? $ this -> getRawContent ( ) : $ content ; $ exc = strip_shortcodes ( $ exc ) ; $ exc = apply_filters ( 'the_content' , $ exc ) ; $ exc = str_replace ( ']]>' , ']]&g... | Get the post excerpt . |
239,847 | public function getFeaturedImage ( ) { if ( $ this -> featuredImage === null ) { if ( $ imgId = get_post_thumbnail_id ( ( int ) $ this -> getId ( ) ) ) { $ this -> featuredImage = $ this -> postFactory -> create ( get_post ( $ imgId ) ) ; } else { $ this -> featuredImage = false ; } } return $ this -> featuredImage ; } | Get this Post s featured image . |
239,848 | public function getAuthor ( ) { if ( $ this -> author === null ) { $ this -> author = $ this -> authorFactory -> create ( $ this -> getAuthorId ( ) ) ; } return $ this -> author ; } | Get post author . |
239,849 | public function getParent ( ) { if ( $ this -> parent === null ) { if ( ( $ parentId = $ this -> getParentPostId ( ) ) !== null ) { $ this -> parent = $ this -> postFactory -> create ( get_post ( $ parentId ) ) ; } else { $ this -> parent = false ; } } return $ this -> parent ? : null ; } | Get the parent post if set . |
239,850 | public function getTermsFor ( $ taxonomy ) { if ( ! ( $ taxonomy instanceof Taxonomy ) ) { $ taxonomy = $ this -> taxonomyFactory -> create ( $ taxonomy ) ; } return $ taxonomy -> getTermsForPost ( $ this ) ; } | Get all terms for this post in the given taxonomy . |
239,851 | protected function getPostTypeObject ( ) { if ( $ this -> postTypeObj === null ) { $ this -> postTypeObj = get_post_type_object ( $ this -> getType ( ) ) ; } return $ this -> postTypeObj ; } | Get the post type object for this post . |
239,852 | public function getParams ( $ alone = false ) { if ( $ alone ) { return $ this -> params ; } else { return array_merge ( $ this -> getDefaultViewParams ( ) , $ this -> params ) ; } } | Get the parameters for the current view |
239,853 | public function getName ( ) { $ name = false ; $ sm = $ this -> themeLocator -> getServiceLocator ( ) ; $ permissionsManager = $ sm -> get ( 'yimaAuthorize.AuthServiceManager' ) ; $ permission = $ permissionsManager -> get ( 'yima_adminor' ) ; if ( ! $ permission -> identity ( ) -> hasAuthenticated ( ) ) return false ;... | Get default admin template name from merged config |
239,854 | protected function mapByte ( $ data , $ index ) { $ byte = ord ( $ data [ $ index ] ) ; if ( $ byte > 49 ) { if ( $ byte < 56 ) { return $ byte - 24 ; } if ( $ byte > 64 && $ byte < 91 ) { return $ byte - 65 ; } } throw new InvalidEncodedDataException ( $ this -> key ( ) , $ data ) ; } | Map a byte to its relevant alphabet entry . |
239,855 | public function removeTranslation ( $ locale = null ) { $ translation = $ this -> translate ( $ locale ) ; if ( ! is_null ( $ translation ) ) $ translation -> delete ( ) ; return $ this ; } | Remove translation by locale . |
239,856 | public function translate ( $ locale = null ) { $ locale = isset ( $ locale ) ? $ locale : Locale \ get_active_locale ( ) ; if ( in_array ( $ locale , Locale \ get_locales ( ) ) ) throw new TranslatableException ( _ ( 'Invalid locale' ) ) ; $ language = $ this -> getByLocale ( $ locale ) ; return $ this -> translations... | Translate attribute by locale . |
239,857 | public function save ( array $ options = [ ] ) { $ saved = parent :: save ( $ options ) ; array_walk ( $ this -> translations , function ( $ translation , $ locale ) { if ( ! array_filter ( $ translation ) ) return false ; $ this -> newTranslation ( $ locale , $ translation ) -> save ( ) ; } ) ; return $ saved ; } | Save eloquent model . |
239,858 | public function fill ( array $ attributes ) { $ locales = Locale \ get_locales ( ) ; foreach ( $ locales as $ locale => $ options ) if ( in_array ( $ locale , array_keys ( $ attributes ) ) ) $ this -> translations [ $ locale ] = array_pull ( $ attributes , $ locale ) ; return parent :: fill ( $ attributes ) ; } | Fill attributes and save locales if exists . |
239,859 | protected function newTranslation ( $ locale = null , array $ attributes ) { $ locale = isset ( $ locale ) ? $ locale : Locale \ get_active_locale ( ) ; $ language = $ this -> getByLocale ( $ locale ) ; $ class = $ this -> classTranslation ( ) ; $ update = [ 'language_id' => $ language -> id , isset ( $ this -> transla... | Get new translation instance . |
239,860 | protected function classTranslation ( ) { if ( ! $ classTranslation = $ this [ 'translationClass' ] ) $ classTranslation = sprintf ( 'App\\%s%s' , ucfirst ( str_singular ( $ this -> getModel ( ) -> getTable ( ) ) ) , 'Translations' ) ; return $ classTranslation ; } | Get Class Translations . |
239,861 | public function translatedAttributes ( ) { if ( ! $ attributes = isset ( $ this [ 'translatedAttributes' ] ) ? $ this [ 'translatedAttributes' ] : null ) { $ class = $ this -> classTranslation ( ) ; $ attributes = ( new $ class ) -> getFillable ( ) ; $ attributes = array_except ( array_flip ( $ attributes ) , [ 'langua... | Get translatedAttributes . |
239,862 | function isEntity ( string $ classFQCN ) : bool { if ( ! class_exists ( $ classFQCN ) ) { throw new ClassNotFoundException ( sprintf ( 'Given class FQCN "%s" does not exist.' , $ classFQCN ) ) ; } if ( ! is_object ( $ classFQCN ) ) { throw new EntityNotFoundException ( sprintf ( 'Given class "%s" is not a Doctrine Enti... | Tests if a received class name is in fact a Doctrine Entity |
239,863 | private function getBodyData ( string $ key , $ default = null ) { $ body = $ this -> getParsedBody ( ) ; if ( is_array ( $ body ) ) { return array_key_exists ( $ key , $ body ) ? $ body [ $ key ] : $ default ; } if ( is_object ( $ body ) ) { return property_exists ( $ body , $ key ) ? $ body -> { $ key } : $ default ;... | Gets parsed body data with specified key . |
239,864 | protected function showMessage ( OutputInterface $ output , $ instance , $ message ) { $ methodGet = $ this -> adapter -> getDisplayNameMethod ( ) ; $ output -> writeln ( [ '' , sprintf ( $ message , strtolower ( $ this -> adapter -> getShortName ( ) ) , $ instance -> $ methodGet ( ) ) , ] ) ; } | Show the message in the console output . |
239,865 | public function getGroupedTargets ( ? Application $ application = null ) : array { $ environments = $ this -> getEntityManager ( ) -> getRepository ( Environment :: class ) -> findAll ( ) ; if ( $ application ) { $ findBy = [ 'application' => $ application ] ; } else { $ findBy = [ ] ; } $ targets = $ this -> findBy ( ... | Get all targets sorted into environments . |
239,866 | private function _applyInjections ( ) { foreach ( $ this -> injections as $ head ) { $ tags = $ this -> _getInjectionString ( $ head ) ; } $ this -> template_markup = str_replace ( '</head>' , $ tags , $ this -> template_markup ) ; } | Insert the stored CSS links JS files and Meta into the HEAD |
239,867 | public function addClass ( string $ value ) : self { $ class = trim ( $ this -> attributes [ 'class' ] ) ; $ this -> attributes [ 'class' ] = trim ( $ class . ' ' . trim ( $ value ) ) ; return $ this ; } | Add the specified class to the class attribute for the form field . |
239,868 | public function setValidator ( string $ validator_class_name , array $ constraints = [ ] ) : self { $ this -> validator = $ validator_class_name ; $ this -> constraints = $ constraints ; return $ this ; } | Sets a validator for the field |
239,869 | public function setRequired ( bool $ required ) : self { $ required = ( bool ) $ required ; $ this -> required = $ required ; return $ this ; } | Set if the field is required . |
239,870 | public function setDefaultValue ( $ value ) : self { $ this -> default_value = $ value ; if ( $ this -> is_valid ) { $ this -> is_changed = ( $ this -> default_value == $ this -> user_value ) ; } return $ this ; } | Sets the default or database value for the |
239,871 | public function getSelectName ( ) : ? string { if ( null !== $ this -> select_name ) { return $ this -> select_name . ' as ' . $ this -> getDBName ( ) ; } if ( null !== $ this -> db_name ) { return $ this -> db_name ; } return $ this -> attributes [ 'name' ] ; } | Returns the db select name of the field . If none is set returns the db_name of the field if that is not set returns the base name of the field . |
239,872 | public function setUserValue ( string $ value ) : self { $ this -> user_value = $ value ; $ this -> is_valid = null ; return $ this ; } | Sets a user value to be validated |
239,873 | public function getValue ( ) { if ( null == $ this -> is_valid && null != $ this -> user_value ) { $ this -> validate ( ) ; } if ( null !== $ this -> user_value && $ this -> is_valid ) { if ( '' === $ this -> user_value && true === $ this -> null_on_empty ) { return null ; } return $ this -> user_value ; } else { if ( ... | Gets the value of the field either the user set value if valid and set or the object value . |
239,874 | public function getUserValue ( ) { if ( null == $ this -> is_valid ) { $ this -> validate ( ) ; } if ( null !== $ this -> user_value && $ this -> is_valid ) { if ( '' === $ this -> user_value && true === $ this -> null_on_empty ) { return null ; } return $ this -> user_value ; } else { return '' ; } } | Get the user set value if valid . |
239,875 | public function setError ( ? string $ message = null ) : void { $ this -> is_valid = false ; $ this -> error = ( null === $ message ) ? $ this -> default_error : $ message ; } | Allows other systems such as the form s validator to set this element as invalid . If no error message is specified the default error message will be set . |
239,876 | public function commit ( ) : void { if ( null === $ this -> is_valid ) { $ this -> validate ( ) ; } if ( $ this -> is_valid && $ this -> user_value != null ) { $ this -> default_value = $ this -> user_value ; } $ this -> user_value = null ; $ this -> is_valid = null ; $ this -> is_changed = false ; } | After the form is saved use commit to save the input values . This replaces the default value with the input value and resets isValid to null and isChanged to false . |
239,877 | public function before ( $ content ) { if ( FALSE === ( bool ) $ this ) { return $ this ; } $ me = $ this -> dom ( ) ; $ parent = $ this -> xparent ( ) -> dom ( ) ; $ new = $ this -> _contentToDom ( $ content ) ; $ parent -> insertBefore ( $ new , $ me ) ; return $ this ; } | Add the content before this node . |
239,878 | public function after ( $ content ) { if ( FALSE === ( bool ) $ this ) { return $ this ; } $ me = $ this -> dom ( ) ; $ parent = $ this -> xparent ( ) -> dom ( ) ; $ new = $ this -> _contentToDom ( $ content ) ; if ( isset ( $ me -> nextSibling ) ) { $ parent -> insertBefore ( $ new , $ me -> nextSibling ) ; } else { $... | Add the content after this node . |
239,879 | public function xpath ( $ path ) { $ results = parent :: xpath ( $ path ) ; if ( empty ( $ results ) ) { return $ this -> _getEmptyElement ( ) ; } return new QuipXmlElementIterator ( new \ ArrayIterator ( $ results ) ) ; } | Wrap the xpath results in a Quip iterator . |
239,880 | public function append ( $ name , $ value = null ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ key => $ val ) { if ( isset ( $ this -> _vars [ $ key ] ) ) { $ this -> _vars [ $ key ] .= $ val ; } else { $ this -> _vars [ $ key ] = $ val ; } } } else { if ( isset ( $ this -> _vars [ $ name ] ) ) { $ this -> _va... | concat a value in with a value of an existing template variable . |
239,881 | public function meta ( $ tpl , $ outputtype = '' , $ trusted = true ) { if ( in_array ( $ tpl , $ this -> processedMeta ) ) { return $ this -> _meta ; } $ this -> processedMeta [ ] = $ tpl ; $ md = $ this -> getTemplate ( $ tpl , $ outputtype , $ trusted ) ; $ fct = 'template_meta_' . $ md ; $ fct ( $ this ) ; return $... | process all meta instruction of a template . |
239,882 | public function display ( $ tpl , $ outputtype = '' , $ trusted = true ) { $ previousTpl = $ this -> _templateName ; $ this -> _templateName = $ tpl ; $ this -> recursiveTpl [ ] = $ tpl ; $ md = $ this -> getTemplate ( $ tpl , $ outputtype , $ trusted ) ; $ fct = 'template_' . $ md ; $ fct ( $ this ) ; array_pop ( $ th... | display the generated content from the given template . |
239,883 | public function current ( ) { return new FieldGroup ( $ this -> base [ 'sub_fields' ] , $ this -> base [ 'value' ] [ $ this -> position ] , $ this , $ this -> fieldFactory ) ; } | Get the current repeater item . |
239,884 | public function valid ( ) { return isset ( $ this -> base [ 'value' ] [ $ this -> position ] ) && is_array ( $ this -> base [ 'value' ] [ $ this -> position ] ) ; } | Check if current position is valid . |
239,885 | private function jwt ( ) { if ( ! $ this -> jwt ) { if ( ! $ this -> accessToken ) { throw new EndpointException ( "No access token was provided" ) ; } $ this -> jwt = ( new Parser ( ) ) -> parse ( $ this -> accessToken ) ; $ this -> checkSignature ( ) ; } } | Create JWT object from access token string |
239,886 | public function valid ( ) { $ this -> jwt ( ) ; $ data = new ValidationData ( ) ; if ( $ this -> leeway != 0 ) { $ data -> setCurrentTime ( time ( ) + $ this -> leeway ) ; } return $ this -> jwt -> validate ( $ data ) ; } | Return if access token is valid |
239,887 | public function getToken ( ) { if ( isset ( $ _SESSION [ $ this -> session_name ] ) ) { return $ _SESSION [ $ this -> session_name ] ; } else { $ token = uniqid ( $ this -> randomString ( ) ) ; $ _SESSION [ $ this -> session_name ] = $ token ; return $ token ; } } | Getting a token |
239,888 | public function validateToken ( $ token ) { if ( isset ( $ _SESSION [ $ this -> session_name ] ) ) { if ( $ _SESSION [ $ this -> session_name ] === $ token ) { return true ; } else { return false ; } } else { return false ; } } | Checking the token |
239,889 | private function createTable ( $ rights ) { $ table = [ ] ; foreach ( $ rights as $ flag => $ right ) { $ table [ $ flag ] = new RightGroup ( $ flag ) ; } foreach ( $ rights as $ flag => $ right ) { $ this -> parseRightGroup ( $ right , $ flag , $ table ) ; } return $ table ; } | Create the right table from the Config |
239,890 | public function js ( $ name ) { $ content = $ this -> dumpAssetsToString ( 'js' , $ name ) ; $ response = new Response ( $ content , 200 , array ( 'Content-Type' => 'text/javascript' , ) ) ; return $ this -> cacheResponse ( $ response ) ; } | Return the javascript for the PhpGit |
239,891 | public function css ( $ name ) { $ content = $ this -> dumpAssetsToString ( 'css' , $ name ) ; $ response = new Response ( $ content , 200 , array ( 'Content-Type' => 'text/css' , ) ) ; return $ this -> cacheResponse ( $ response ) ; } | Return the stylesheets for the PhpGit |
239,892 | public function getEngine ( ) { if ( null === $ this -> engine ) { $ this -> setEngine ( TemplateFactory :: getEngine ( ) ) ; } return $ this -> engine ; } | Returns the current template engine |
239,893 | public function getAttributes ( ) { $ result = [ ] ; foreach ( $ this -> element -> getAttributes ( ) as $ attribute => $ value ) { if ( null === $ value ) { $ result [ ] = $ attribute ; continue ; } $ result [ ] = "{$attribute}=\"{$value}\"" ; } return implode ( ' ' , $ result ) ; } | Returns the elements s attributes as a string |
239,894 | protected function fill ( Model $ model , object $ data ) : Model { $ mapper = new ObjectMapper ( ) ; return $ mapper -> map ( $ model ) -> fill ( $ data ) ; } | Fill the model with given data . |
239,895 | protected function setId ( Identifier $ id , Model $ model ) : void { $ prop = new ReflectionProperty ( get_class ( $ model ) , 'id' ) ; $ prop -> setAccessible ( true ) ; $ prop -> setValue ( $ model , $ id ) ; } | Set the protected id value . |
239,896 | protected function bootCommand ( ) { foreach ( $ this -> commands as $ command ) { $ this -> add ( $ this -> app -> make ( $ command ) ) ; } } | Resolve all dependencies |
239,897 | protected function getPhpMigCommands ( ) { return [ new Command \ CheckCommand ( ) , new Command \ DownCommand ( ) , new Command \ GenerateCommand ( ) , new Command \ MigrateCommand ( ) , new Command \ RedoCommand ( ) , new Command \ RollbackCommand ( ) , new Command \ StatusCommand ( ) , new Command \ UpCommand ( ) , ... | Get PHP Mig console commands |
239,898 | public function resetPath ( string $ path ) { foreach ( $ this -> cache as & $ cache ) { unset ( $ cache [ $ path ] , $ cache ) ; } } | Reset view cache from all the contexts . |
239,899 | function create ( $ txn = true ) { if ( $ txn && ! ( $ txn instanceof pq \ Transaction ) ) { $ txn = $ this -> table -> getConnection ( ) -> startTransaction ( ) ; } try { foreach ( $ this -> rows as $ row ) { $ row -> create ( ) ; } } catch ( \ Exception $ e ) { if ( $ txn ) { $ txn -> rollback ( ) ; } throw $ e ; } i... | Create all rows of this rowset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.