idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
58,900 | 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 |
58,901 | 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 |
58,902 | 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 |
58,903 | 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 |
58,904 | 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 |
58,905 | 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 |
58,906 | 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 |
58,907 | 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 |
58,908 | 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 |
58,909 | 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 |
58,910 | 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 |
58,911 | 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 |
58,912 | 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 . |
58,913 | 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 |
58,914 | 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 |
58,915 | 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 . |
58,916 | 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 . |
58,917 | 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 . |
58,918 | public function getAuthor ( ) { if ( $ this -> author === null ) { $ this -> author = $ this -> authorFactory -> create ( $ this -> getAuthorId ( ) ) ; } return $ this -> author ; } | Get post author . |
58,919 | 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 . |
58,920 | 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 . |
58,921 | 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 . |
58,922 | 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 |
58,923 | 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 |
58,924 | 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 . |
58,925 | public function removeTranslation ( $ locale = null ) { $ translation = $ this -> translate ( $ locale ) ; if ( ! is_null ( $ translation ) ) $ translation -> delete ( ) ; return $ this ; } | Remove translation by locale . |
58,926 | 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 . |
58,927 | 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 . |
58,928 | 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 . |
58,929 | 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 . |
58,930 | protected function classTranslation ( ) { if ( ! $ classTranslation = $ this [ 'translationClass' ] ) $ classTranslation = sprintf ( 'App\\%s%s' , ucfirst ( str_singular ( $ this -> getModel ( ) -> getTable ( ) ) ) , 'Translations' ) ; return $ classTranslation ; } | Get Class Translations . |
58,931 | 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 . |
58,932 | 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 |
58,933 | 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 . |
58,934 | 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 . |
58,935 | 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 . |
58,936 | 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 |
58,937 | 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 . |
58,938 | 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 |
58,939 | public function setRequired ( bool $ required ) : self { $ required = ( bool ) $ required ; $ this -> required = $ required ; return $ this ; } | Set if the field is required . |
58,940 | 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 |
58,941 | 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 . |
58,942 | public function setUserValue ( string $ value ) : self { $ this -> user_value = $ value ; $ this -> is_valid = null ; return $ this ; } | Sets a user value to be validated |
58,943 | 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 . |
58,944 | 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 . |
58,945 | 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 . |
58,946 | 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 . |
58,947 | 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 . |
58,948 | 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 . |
58,949 | 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 . |
58,950 | 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 . |
58,951 | 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 . |
58,952 | 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 . |
58,953 | public function current ( ) { return new FieldGroup ( $ this -> base [ 'sub_fields' ] , $ this -> base [ 'value' ] [ $ this -> position ] , $ this , $ this -> fieldFactory ) ; } | Get the current repeater item . |
58,954 | public function valid ( ) { return isset ( $ this -> base [ 'value' ] [ $ this -> position ] ) && is_array ( $ this -> base [ 'value' ] [ $ this -> position ] ) ; } | Check if current position is valid . |
58,955 | 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 |
58,956 | 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 |
58,957 | 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 |
58,958 | 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 |
58,959 | 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 |
58,960 | 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 |
58,961 | 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 |
58,962 | public function getEngine ( ) { if ( null === $ this -> engine ) { $ this -> setEngine ( TemplateFactory :: getEngine ( ) ) ; } return $ this -> engine ; } | Returns the current template engine |
58,963 | 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 |
58,964 | protected function fill ( Model $ model , object $ data ) : Model { $ mapper = new ObjectMapper ( ) ; return $ mapper -> map ( $ model ) -> fill ( $ data ) ; } | Fill the model with given data . |
58,965 | 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 . |
58,966 | protected function bootCommand ( ) { foreach ( $ this -> commands as $ command ) { $ this -> add ( $ this -> app -> make ( $ command ) ) ; } } | Resolve all dependencies |
58,967 | 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 |
58,968 | public function resetPath ( string $ path ) { foreach ( $ this -> cache as & $ cache ) { unset ( $ cache [ $ path ] , $ cache ) ; } } | Reset view cache from all the contexts . |
58,969 | 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 |
58,970 | function filter ( callable $ cb ) { $ rowset = clone $ this ; $ rowset -> index = 0 ; $ rowset -> rows = array_filter ( $ this -> rows , $ cb ) ; return $ rowset ; } | Filter by callback |
58,971 | public function actionIndex ( ) { $ searchModel = new ContactSearch ( ) ; $ dataProvider = $ searchModel -> search ( request ( ) -> queryParams ) ; $ dataProvider -> sort -> defaultOrder = [ 'id' => SORT_DESC ] ; return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , ]... | Lists all Contact models . |
58,972 | protected function findModel ( $ id ) { if ( ( $ model = Contact :: findOne ( $ id ) ) !== null ) { return $ model ; } else { throw new NotFoundHttpException ( t ( 'app' , 'The requested page does not exist.' ) ) ; } } | Finds the Contact model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
58,973 | public function insert ( $ data , $ priority = 1 ) { $ priority = ( int ) $ priority ; $ this -> items [ ] = array ( 'data' => $ data , 'priority' => $ priority , ) ; $ this -> getQueue ( ) -> insert ( $ data , $ priority ) ; return $ this ; } | Insert an item into the queue |
58,974 | protected function getQueue ( ) { if ( null === $ this -> queue ) { $ this -> queue = new $ this -> queueClass ( ) ; if ( ! $ this -> queue instanceof SplPriorityQueue ) { throw new Exception ( sprintf ( 'Queue expects an internal queue of type SplPriorityQueue; received "%s"' , get_class ( $ this -> queue ) ) ) ; } } ... | Get the inner priority queue instance |
58,975 | static public function setObjectProperties ( $ object , array $ config = [ ] ) { foreach ( static :: createSetterMethods ( $ config ) as $ method => $ value ) { if ( method_exists ( $ object , $ method ) ) { call_user_func_array ( [ $ object , $ method ] , [ $ value ] ) ; } } } | Sets object properties by a given array |
58,976 | public function validate ( ) { foreach ( $ this -> rules ( ) as $ key => $ value ) { $ this -> rules [ $ key ] = [ $ this -> input ( $ key ) , $ value ] ; } $ validate = $ this -> validator -> validate ( $ this -> rules ) ; if ( $ validate -> fails ( ) ) { if ( $ this -> isAjax ( ) ) { return $ this -> response -> json... | Validate requested form . |
58,977 | public static function prepararArchivos ( array $ archivos , $ inicio = true ) { $ final = [ ] ; foreach ( $ archivos as $ nombre => $ archivo ) { $ subNombre = $ nombre ; if ( $ inicio ) { $ subNombre = $ archivo [ 'name' ] ; } $ final [ $ nombre ] = $ archivo ; if ( is_array ( $ subNombre ) ) { foreach ( array_keys (... | Prepara el formato en que se presenta los archivos subidos . |
58,978 | public function wait ( bool $ throwExceptionOnError = true ) : PhoreProcResult { if ( $ this -> proc === null ) $ this -> exec ( ) ; $ buf = null ; if ( $ buf === null ) { $ buf = [ ] ; foreach ( $ this -> listener as $ chanId => $ listener ) { $ buf [ $ chanId ] = "" ; } } while ( true ) { $ allPipesClosed = true ; $ ... | Wait for the process to exit . |
58,979 | protected static function execute ( ) { try { $ instance = static :: getInstance ( ) ; $ reflectionMethod = new ReflectionMethod ( $ instance , static :: $ method ) ; return $ reflectionMethod -> invokeArgs ( $ instance , static :: $ arguments ) ; } catch ( Exception $ e ) { throw new Exception ( $ e -> getMessage ( ) ... | Execute method of the registered alien |
58,980 | public static function shouldReceive ( ) { if ( ! isset ( static :: $ mocked [ static :: registerAlien ( ) ] ) ) { static :: $ mocked [ static :: registerAlien ( ) ] = Mockery :: mock ( static :: registerAlien ( ) ) ; } return call_user_func_array ( [ static :: $ mocked [ static :: registerAlien ( ) ] , 'shouldReceive'... | Initiate mock expectation for the registered alien |
58,981 | private function findMeta ( $ className ) { $ class = new \ ReflectionClass ( $ className ) ; if ( $ class -> implementsInterface ( 'LRezek\\Arachnid\\Proxy\\Entity' ) ) { $ class = $ class -> getParentClass ( ) ; } $ node = $ this -> reader -> getClassAnnotation ( $ class , 'LRezek\\Arachnid\\Annotation\\Node' ) ; $ r... | Does the actual annotation parsing to get meta information for a given class . |
58,982 | public static function limitByWords ( $ str , $ wordCount = 10 ) { $ words = preg_split ( "/[\s]+/" , $ str , $ wordCount + 1 ) ; $ words = array_slice ( $ words , 0 , $ wordCount ) ; return join ( ' ' , $ words ) ; } | Returns a string limited by the word count specified logic borrowed from StackOverflow |
58,983 | public function process ( ) { $ em = $ this -> getEm ( ) ; $ cronRegistry = $ this -> getCronjobs ( ) ; $ pending = $ this -> getPending ( ) ; $ scheduleLifetime = $ this -> scheduleLifetime * 60 ; $ now = new \ DateTime ; foreach ( $ pending as $ job ) { $ scheduleTime = $ job -> getScheduleTime ( ) ; if ( $ scheduleT... | run cron jobs |
58,984 | public function cleanLog ( ) { $ em = $ this -> getEm ( ) ; $ lifetime = array ( Mapper \ Cronjob :: STATUS_SUCCESS => $ this -> getSuccessLogLifetime ( ) * 60 , Mapper \ Cronjob :: STATUS_MISSED => $ this -> getFailureLogLifetime ( ) * 60 , Mapper \ Cronjob :: STATUS_ERROR => $ this -> getFailureLogLifetime ( ) * 60 ,... | delete old cron job logs |
58,985 | public function tryLockJob ( Entity \ Cronjob $ job ) { $ em = $ this -> getEm ( ) ; $ repo = $ em -> getRepository ( 'AdfabCore\Entity\Cronjob' ) ; if ( $ job -> getStatus ( ) === Mapper \ Cronjob :: STATUS_PENDING ) { $ job -> setStatus ( Mapper \ Cronjob :: STATUS_RUNNING ) ; $ em -> persist ( $ job ) ; $ em -> flus... | try to acquire a lock on a cron job |
58,986 | public static function matchTime ( $ time , $ expr ) { $ cronExpr = preg_split ( '/\s+/' , $ expr , null , PREG_SPLIT_NO_EMPTY ) ; if ( count ( $ cronExpr ) !== 5 ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'cron expression should have exactly 5 arguments, "%s" given' , $ expr ) ) ; } if ( is_string ... | determine whether a given time falls within the given cron expr |
58,987 | public function process ( ) { if ( $ this -> _isXhtml === null ) { $ this -> _isXhtml = ( false !== strpos ( $ this -> _html , '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML' ) ) ; } $ this -> _replacementHash = 'MINIFYHTML' . md5 ( $ _SERVER [ 'REQUEST_TIME' ] ) ; $ this -> _placeholders = array ( ) ; $ this -> _html = pre... | Minify the markeup given in the constructor |
58,988 | public function sql ( $ args ) { list ( $ table_name ) = $ args ; $ rows = Model :: $ list ; if ( ! isset ( $ rows [ $ table_name ] ) ) { \ WP_CLI :: error ( sprintf ( '%s: table is not registered.' , $ table_name ) ) ; } $ model = $ rows [ $ table_name ] ; if ( ! class_exists ( $ model ) ) { \ WP_CLI :: error ( sprint... | Display table schema SQL |
58,989 | public function tables ( ) { $ table = new \ cli \ Table ( ) ; $ rows = Model :: $ list ; if ( ! $ rows ) { \ WP_CLI :: error ( 'No model is regsitered.' ) ; } $ table -> setHeaders ( [ 'Table Name' , 'Model Class' ] ) ; foreach ( $ rows as $ table_name => $ class ) { $ table -> addRow ( [ $ table_name , $ class ] ) ; ... | Get list of tables which generated by Hametuha \ Pattern \ Model |
58,990 | public function add ( $ manager ) { if ( ! is_string ( $ manager ) ) { throw new \ InvalidArgumentException ( 'ManagerList::add requires $manager to be a string.' ) ; } $ this -> managerList [ $ manager ] = $ manager ; $ this -> managerStatus [ self :: FLAG_AVAILABLE ] [ $ manager ] = $ manager ; return $ this ; } | Adds a manager dsn to the list . |
58,991 | public function toPrioritizedArray ( ) { if ( ( $ this -> resetCounter % $ this -> resetAt ) == 0 ) { $ this -> resetAvailableManagers ( ) ; } $ this -> resetCounter ++ ; $ available = & $ this -> managerStatus [ self :: FLAG_AVAILABLE ] ; $ unavailable = & $ this -> managerStatus [ self :: FLAG_UNAVAILABLE ] ; shuffle... | Returns an array or manager dsns sorted by priority . |
58,992 | protected function resetAvailableManagers ( ) { $ this -> managerStatus [ self :: FLAG_AVAILABLE ] = $ this -> managerList ; $ this -> managerStatus [ self :: FLAG_UNAVAILABLE ] = array ( ) ; } | Makes all managers available . |
58,993 | public function returnClientErrorResponse ( Zend_Http_Response $ response ) { $ status = $ response -> getStatus ( ) ; switch ( $ status ) { case 401 : $ message = self :: INVALID_API_KEY ; break ; case 403 : $ message = self :: INVALID_STORE_ID ; break ; case 408 : $ message = self :: NETWORK_TIMEOUT ; break ; default... | Return the response data for client errors - 4XX range errors . |
58,994 | public static function load ( $ path , $ file = '.env' ) { if ( ! is_string ( $ file ) ) { $ file = '.env' ; } $ filePath = rtrim ( $ path , '/' ) . '/' . $ file ; if ( ! is_readable ( $ filePath ) || ! is_file ( $ filePath ) ) { throw new \ InvalidArgumentException ( sprintf ( "Dotenv: Environment file %s not found or... | Load . env file in given directory |
58,995 | public static function required ( $ environmentVariables , array $ allowedValues = array ( ) ) { $ environmentVariables = ( array ) $ environmentVariables ; $ missingEnvironmentVariables = [ ] ; foreach ( $ environmentVariables as $ environmentVariable ) { $ value = static :: findEnvironmentVariable ( $ environmentVari... | Require specified ENV vars to be present or throw Exception . You can also pass through an set of allowed values for the environment variable . |
58,996 | protected static function sanitiseVariableValue ( $ value ) { $ value = trim ( $ value ) ; if ( ! $ value ) { return '' ; } if ( strpbrk ( $ value [ 0 ] , '"\'' ) !== false ) { $ quote = $ value [ 0 ] ; $ regexPattern = sprintf ( '/^ %1$s # match a quote at the start of the value ... | Strips quotes from the environment variable value . |
58,997 | public function handle ( $ old , $ new ) { if ( ! $ this -> canHandle ( $ old ) || ! $ this -> canHandle ( $ new ) ) { return null ; } if ( $ this -> equals ( $ old , $ new ) ) { return false ; } $ this -> lastException = new FailedConstraint ( sprintf ( '%s() body changed' , $ new -> name ) ) ; return true ; } | Check if body of function has changed . |
58,998 | protected function equals ( $ old , $ new ) { if ( is_array ( $ old ) ) { if ( array_keys ( $ old ) != array_keys ( $ new ) ) { return false ; } foreach ( array_keys ( $ old ) as $ key ) { if ( ! $ this -> equals ( $ old [ $ key ] , $ new [ $ key ] ) ) { return false ; } } return true ; } if ( ! is_object ( $ old ) ) {... | Check if two Node trees are equal . |
58,999 | final public function logError ( $ msg_code , $ data = array ( ) ) { self :: write ( self :: compileMessage ( self :: $ error_msg [ $ msg_code ] , $ data ) , PEL_ERROR ) ; } | Metodo que permite escribir un log de Error . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.