idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
236,300 | public function exclude ( array $ patterns ) { return $ this -> reject ( function ( $ file ) use ( $ patterns ) { foreach ( $ patterns as $ pattern ) { if ( Str :: is ( $ pattern , $ file [ 'name' ] ) ) return true ; } return false ; } ) ; } | ExcludePattern files with the given patterns . |
236,301 | private function setField ( $ tableSource , $ dtl , $ features , $ fieldLabel ) { if ( $ dtl [ 'COLUMN_NAME' ] == 'host' ) { $ inVl = gethostbyaddr ( $ this -> tCmnRequest -> server -> get ( 'REMOTE_ADDR' ) ) ; return [ 'label' => '<label for="' . $ dtl [ 'COLUMN_NAME' ] . '">Numele calculatorului</label>' , 'input' =>... | Builds field output w . special column name |
236,302 | private function setFieldInput ( $ tableSource , $ dtl , $ features ) { if ( $ dtl [ 'COLUMN_NAME' ] == 'ChoiceId' ) { return '<input type="text" name="ChoiceId" value="' . $ this -> tCmnRequest -> request -> get ( $ dtl [ 'COLUMN_NAME' ] ) . '" />' ; } return $ this -> setNeededFieldByType ( $ tableSource , $ dtl , $ ... | Builds field output w . another special column name |
236,303 | protected function setFormGenericSingleRecord ( $ tblSrc , $ feat , $ hdnInf = [ ] ) { echo $ this -> setStringIntoTag ( '' , 'div' , [ 'id' => 'loading' ] ) ; $ this -> setTableCache ( $ tblSrc ) ; if ( strpos ( $ tblSrc , '.' ) !== false ) { $ tblSrc = explode ( '.' , str_replace ( '`' , '' , $ tblSrc ) ) [ 1 ] ; } $... | Returns a generic form based on a given table |
236,304 | private function setNeededField ( $ tableSource , $ details , $ features ) { if ( isset ( $ features [ 'hidden' ] ) ) { if ( in_array ( $ details [ 'COLUMN_NAME' ] , $ features [ 'hidden' ] ) ) { return null ; } } $ fieldLabel = $ this -> getFieldNameForDisplay ( $ details ) ; if ( $ fieldLabel == 'hidden' ) { return n... | Analyse the field and returns the proper line 2 use in forms |
236,305 | private function setNeededFieldByType ( $ tblName , $ dtls , $ features ) { if ( isset ( $ features [ 'special' ] ) && isset ( $ features [ 'special' ] [ $ dtls [ 'COLUMN_NAME' ] ] ) ) { $ sOpt = $ this -> setMySQLquery2Server ( $ features [ 'special' ] [ $ dtls [ 'COLUMN_NAME' ] ] , 'array_key_value' ) ; return $ this... | Analyse the field type and returns the proper lines 2 use in forms |
236,306 | protected function setViewModernDelete ( $ tbl , $ idn ) { $ tMsg = $ this -> setViewDeleteFeedbacks ( ) ; if ( $ tbl == '' ) { $ sReturn = $ this -> setFeedbackModern ( 'error' , $ tMsg [ 'Confirmation' ] , $ tMsg [ 'Impossible' ] ) ; } else { $ this -> initializeSprGlbAndSession ( ) ; $ idFldVal = $ this -> tCmnSuper... | Automatic handler for Record deletion |
236,307 | protected function findConfiguration ( $ value , \ Closure $ func ) { foreach ( $ this -> all ( ) as $ configuration ) { if ( $ func ( $ configuration , $ value ) ) { return $ configuration ; } } return null ; } | Find a configuration matching custom criteria |
236,308 | public function injectDebugBar ( ResponseInterface $ response ) { $ content = $ response -> getContent ( ) ; $ renderer = $ this -> getJavascriptRenderer ( ) ; $ renderedContent = $ this -> generateAssetsContent ( ) . $ renderer -> render ( ) ; $ pos = strripos ( $ content , '</body>' ) ; if ( false !== $ pos ) { $ con... | Injects the web debug toolbar |
236,309 | public static function environment ( int $ severity , array $ configuration = [ ] ) { $ reporting = ~ E_ALL ; foreach ( self :: SEVERITY as $ key => $ value ) { if ( $ key <= $ severity ) $ reporting |= $ value ; } error_reporting ( $ reporting ) ; if ( isset ( $ configuration [ 'locale' ] ) ) { setlocale ( LC_ALL , $ ... | Global setup of the PHP environment |
236,310 | public function getImageSetBySlug ( $ slug ) { $ imageSet = $ this -> getImageSet ( ) ; foreach ( $ imageSet as $ set ) { if ( $ set -> slug == $ slug ) { return $ set ; } } return null ; } | Get Image by slug |
236,311 | public function addImageSet ( $ postValues ) { $ imageSetObject = ImageSetFactory :: createImageSetFromPostValues ( $ postValues ) ; $ imageSet = $ this -> repository -> imageSet ; $ imageSet [ ] = $ imageSetObject ; $ this -> repository -> imageSet = $ imageSet ; $ this -> save ( ) ; } | Add image set |
236,312 | public function saveImageSet ( $ slug , $ postValues ) { $ imageSetObject = ImageSetFactory :: createImageSetFromPostValues ( $ postValues ) ; $ imageSet = $ this -> repository -> imageSet ; foreach ( $ imageSet as $ key => $ set ) { if ( $ set -> slug == $ slug ) { $ imageSet [ $ key ] = $ imageSetObject ; } } $ this ... | Save Image Set by it s slug |
236,313 | public function deleteImageSetBySlug ( $ slug ) { $ imageSet = $ this -> getImageSet ( ) ; foreach ( $ imageSet as $ key => $ set ) { if ( $ set -> slug == $ slug ) { unset ( $ imageSet [ $ key ] ) ; } } $ imageSet = array_values ( $ imageSet ) ; $ this -> repository -> imageSet = $ imageSet ; $ this -> save ( ) ; } | Delete Image Set by its slug |
236,314 | public function getSmallestImageSet ( ) { $ imageSet = $ this -> getImageSet ( ) ; $ returnSize = PHP_INT_MAX ; $ returnSet = null ; foreach ( $ imageSet as $ set ) { $ size = $ set -> width * $ set -> height ; if ( $ size < $ returnSize ) { $ returnSize = $ size ; $ returnSet = $ set ; } } if ( $ returnSet === null ) ... | Get the image set with the smallest size |
236,315 | public static function setError ( $ prefix = null , $ field , $ error ) { if ( null !== $ prefix && false === is_string ( $ prefix ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ prefix ) ) , E_USER_ERROR ) ; } if ( false === is_string... | Sets an error for the current field |
236,316 | public static function getMessage ( $ field , $ rule ) { if ( false === is_string ( $ field ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ field ) ) , E_USER_ERROR ) ; } if ( false === is_string ( $ rule ) ) { return trigger_error ( s... | Returns message by field and rule |
236,317 | public static function loadCustom ( $ classname , $ namespace , $ name ) { if ( false === is_string ( $ classname ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ classname ) ) , E_USER_ERROR ) ; } if ( false === is_string ( $ namespace... | Loads a custom validator class |
236,318 | public static function getErrors ( $ fullnames = false ) { if ( false === is_bool ( $ fullnames ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type boolean, "%s" given' , __METHOD__ , gettype ( $ fullnames ) ) , E_USER_ERROR ) ; } if ( true === $ fullnames ) { return static :: $ errors... | Returns all errors |
236,319 | private static function addMessage ( $ rule , $ params ) { if ( false === is_string ( $ rule ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ rule ) ) , E_USER_ERROR ) ; } if ( false === is_array ( $ params ) ) { return trigger_error ( ... | Adds a new custom message to current fieldname |
236,320 | public function append ( $ data ) { if ( $ data instanceof AbstractToken ) { $ this -> tokens [ ] = $ data ; } elseif ( $ data instanceof AbstractTokenContainer ) { $ this -> tokens = array_merge ( $ this -> tokens , $ data -> toArray ( ) ) ; } elseif ( $ data instanceof AbstractTokenCursor ) { while ( $ data -> valid ... | Append the given token or token container to the TokenBuffer . |
236,321 | public function commit ( ) { $ this -> sourceWidth = $ this -> frameWidth ; $ this -> sourceHeight = $ this -> frameHeight ; $ this -> offsetX = 0 ; $ this -> offsetY = 0 ; $ this -> scaleWidth = $ this -> frameWidth ; $ this -> scaleHeight = $ this -> frameHeight ; $ this -> getFocalPoint ( ) ; } | Resets the image metrics so as to reflect the image should the current settings be applied . |
236,322 | public function getFocalPoint ( ) { $ scale = $ this -> sourceWidth / $ this -> scaleWidth ; $ focalX = ( ( $ this -> frameWidth / 2 ) - $ this -> offsetX ) * $ scale ; $ focalY = ( ( $ this -> frameHeight / 2 ) - $ this -> offsetY ) * $ scale ; return array ( $ focalX , $ focalY ) ; } | Returns an array with the X Y co - ords of the focal point of the current crop . |
236,323 | public function setSourceDetails ( ) { if ( ! file_exists ( $ this -> sourcePath ) ) { throw new FileNotFoundException ( $ this -> sourcePath ) ; } if ( is_dir ( $ this -> sourcePath ) ) { throw new FileNotFoundException ( $ this -> sourcePath ) ; } $ imageDetails = getimagesize ( $ this -> sourcePath ) ; $ this -> sou... | Reads basic information about the metrics of the source image . |
236,324 | public function resize ( $ width , $ height , $ maintainAspect = false , $ scaleUp = true ) { $ oldFrameWidth = $ this -> frameWidth ; $ aspectRatio = $ this -> frameWidth / $ this -> frameHeight ; if ( $ maintainAspect ) { $ newHeight = round ( $ width / $ aspectRatio ) ; if ( $ newHeight > $ height ) { $ newWidth = r... | Resizes the image with the given bounds . |
236,325 | public static function tid ( ) : int { if ( ! ServerUtil :: coroutineIsEnabled ( ) ) { return - 1 ; } $ id = SwCoroutine :: getuid ( ) ; return self :: $ idMap [ $ id ] ?? $ id ; } | get top coroutine id |
236,326 | public static function create ( callable $ cb ) { if ( ! ServerUtil :: coroutineIsEnabled ( ) ) { return false ; } $ tid = self :: tid ( ) ; return SwCoroutine :: create ( function ( ) use ( $ cb , $ tid ) { $ id = SwCoroutine :: getuid ( ) ; self :: $ idMap [ $ id ] = $ tid ; PhpHelper :: call ( $ cb ) ; } ) ; } | create a child coroutine |
236,327 | protected function parseVisibility ( $ visibility ) { if ( is_null ( $ visibility ) ) return null ; switch ( $ visibility ) { case FilesystemContract :: VISIBILITY_PUBLIC : return AdapterInterface :: VISIBILITY_PUBLIC ; case FilesystemContract :: VISIBILITY_PRIVATE : return AdapterInterface :: VISIBILITY_PRIVATE ; } th... | Parse the given visibility value . |
236,328 | static function readObjectCache ( Parser & $ parser , $ key = '' ) { $ parser -> disableCache ( ) ; $ cache = \ ObjectCache :: getInstance ( CACHE_DB ) ; global $ wgDIQAAllowedObjectCacheKeys ; if ( ! isset ( $ wgDIQAAllowedObjectCacheKeys ) || ! in_array ( $ key , $ wgDIQAAllowedObjectCacheKeys ) ) { return 'not-allow... | Read key from ObjectCache |
236,329 | public static function loadClass ( $ className ) { if ( ! class_exists ( $ className ) ) { $ path = self :: getPath ( $ className ) ; $ realPath = stream_resolve_include_path ( $ path ) ; if ( file_exists ( $ realPath ) ) { require_once ( $ realPath ) ; return class_exists ( $ className ) ; } return false ; } else { re... | Loads class . |
236,330 | public static function getPath ( $ className , $ ext = "php" ) { if ( substr ( $ className , 0 , 1 ) == "\\" ) { $ className = substr ( $ className , 1 ) ; } $ delimiters = array ( "_" , "\\" ) ; foreach ( $ delimiters as $ symbol ) { $ className = str_replace ( $ symbol , "/" , $ className ) ; } return $ className . "... | Returns class path . |
236,331 | public static function getClassName ( $ prefix , $ name , $ ucfirst = false ) { if ( substr ( $ prefix , - 1 , 1 ) == "\\" ) { $ className = $ prefix ; } else { $ className = $ prefix . "_" ; } $ className .= $ name ; if ( $ ucfirst ) { $ result = "" ; $ nsPath = explode ( "\\" , $ className ) ; $ name = array_pop ( $ ... | Returns className . |
236,332 | public static function timeFunction ( $ function , $ description = null ) { $ duration = self :: time ( $ function ) ; Logger :: log ( "Code Block " . ( $ description ? '"' . $ description . '"' : "" ) . " Executed in " . $ duration . " Seconds" ) ; return $ duration ; } | Time the passed function |
236,333 | public static function recordFunctionTimingForGroup ( $ function , $ group ) { $ functionTiming = CodeTimer :: time ( $ function ) ; if ( isset ( CodeTimer :: $ groupTimings [ $ group ] ) ) { CodeTimer :: $ groupTimings [ $ group ] += $ functionTiming ; } else { CodeTimer :: $ groupTimings [ $ group ] = $ functionTimin... | Record the timing of a passed function against a group . All Timings for a group are added up . |
236,334 | public static function reportTimingsForGroup ( $ group ) { if ( isset ( CodeTimer :: $ groupTimings [ $ group ] ) ) { Logger :: log ( 'Group "' . $ group . '" Executed in ' . CodeTimer :: $ groupTimings [ $ group ] . " Seconds" ) ; return CodeTimer :: $ groupTimings [ $ group ] ; } else { Logger :: log ( 'No group timi... | Report timings for a group |
236,335 | protected function makeRepository ( ) { $ full_path = $ this -> getFullRepositoryPath ( ) ; if ( file_exists ( $ full_path ) ) { throw new RepositoryExistsException ( sprintf ( '%s file already exists' , $ full_path ) ) ; } $ contract_contents = str_replace ( [ '%%MODEL_BASENAME%%' , '%%MODEL_NAME%%' , '%%CLASS_NAME%%'... | Make repository file |
236,336 | protected function makeContract ( ) { $ full_path = $ this -> getFullContractPath ( ) ; if ( file_exists ( $ full_path ) ) { return true ; } $ contract_contents = str_replace ( [ '%%MODEL_BASENAME%%' , '%%MODEL_NAME%%' , '%%CLASS_NAME%%' , '%%NAMESPACE%%' , ] , [ $ this -> getModelBasename ( ) , $ this -> getModelName ... | Make contract file |
236,337 | public static function assetsSettings ( ) { if ( isset ( self :: $ _assetsSettings ) ) { return self :: $ _assetsSettings ; } return self :: getSettingsBlock ( self :: BLOCK_NAME ) ; } | Get assets settings |
236,338 | public static function assetsUseStatic ( ) { if ( isset ( self :: $ _useStatic ) ) { return self :: $ _useStatic ; } return self :: getSettingsItem ( self :: $ _useStatic , self :: assetsSettings ( ) , self :: USE_STATIC , self :: DEFAULT_USE_STATIC ) ; } | Get assetsUseStatic setting - use static resources |
236,339 | public static function assetsStaticEnd ( ) { if ( isset ( self :: $ _staticEnd ) ) { return self :: $ _staticEnd ; } return self :: getSettingsItem ( self :: $ _staticEnd , self :: assetsSettings ( ) , self :: STATIC_END , self :: DEFAULT_STATIC_END ) ; } | Get assetsStaticEnd setting - static application end |
236,340 | public function setCategory ( \ Innova \ LexiconBundle \ Entity \ Category $ category = null ) { $ this -> category = $ category ; return $ this ; } | Set category . |
236,341 | public function setSubcategory ( \ Innova \ LexiconBundle \ Entity \ Subcategory $ subcategory = null ) { $ this -> subcategory = $ subcategory ; return $ this ; } | Set subcategory . |
236,342 | public static function transform_sub_post_fields ( & $ field ) { if ( is_array ( $ field [ 'value' ] ) ) { $ data = [ ] ; foreach ( $ field [ 'value' ] as $ post_id ) { $ data [ ] = Acf :: get_post_field ( $ post_id ) ; } $ field [ 'value' ] = $ data ; } else { $ field [ 'value' ] = Acf :: get_post_field ( $ field [ 'v... | Transform to get the WP and ACF fields of the sub post . |
236,343 | protected function createContainer ( ContainerModuleLoader $ loader , ScopeLoader $ scopes ) { $ contextCachePath = $ this -> cacheDirectory . DIRECTORY_SEPARATOR . $ this -> contextName ; $ cacheFile = $ contextCachePath . DIRECTORY_SEPARATOR . 'container.php' ; $ containerTypeName = __NAMESPACE__ . '\\CompiledContain... | Create the DI container instance . |
236,344 | protected function createContainerBuilder ( ) { $ builder = new ContainerBuilder ( ) ; foreach ( $ this -> getContainerParams ( ) as $ k => $ v ) { $ builder -> setParameter ( $ k , $ v ) ; } return $ builder ; } | Create the DI container builder instance . |
236,345 | protected function setupInstrumentationProcessor ( ) { $ file = $ this -> cacheDirectory . '/' . $ this -> contextName . '/instrument.php' ; if ( is_file ( $ file ) ) { $ this -> instrumentationProcessor = new InstrumentationProcessor ( $ this , require $ file ) ; $ this -> instrumentationProcessor -> registertAutoload... | Setup an instrumentation processor that hooks into the autoloader . |
236,346 | protected function bindInitialInstances ( ContainerInterface $ container ) { foreach ( $ this -> komponents as $ komponent ) { $ container -> bindInstance ( get_class ( $ komponent ) , $ komponent ) ; } } | Bind initial object instances to the DI container . |
236,347 | public static function runBackups ( $ disk = null ) { try { $ backupJob = BackupJobFactory :: createFromArray ( config ( 'laravel-backup' ) ) ; if ( ! is_null ( $ disk ) ) { $ backupJob -> onlyBackupTo ( $ disk ) ; } $ backupJob -> run ( ) ; } catch ( \ Exception $ ex ) { return false ; } return true ; } | Run the backups . |
236,348 | public static function clearBackups ( ) { try { $ config = config ( 'laravel-backup' ) ; $ backupDestinations = BackupDestinationFactory :: createFromArray ( $ config [ 'backup' ] ) ; $ strategy = app ( $ config [ 'cleanup' ] [ 'strategy' ] ) ; $ disableNotification = false ; ( new CleanupJob ( $ backupDestinations , $... | Clean the backups . |
236,349 | public function get ( array $ adapters , CacheableInterface $ item ) { foreach ( $ adapters as $ adapter ) { if ( false !== $ value = $ adapter -> get ( $ item ) ) { return $ value ; } } return false ; } | Get cache from any adapter if contains |
236,350 | public function set ( array $ adapters , CacheableInterface $ item ) { foreach ( $ adapters as $ adapter ) { $ adapter -> set ( $ item ) ; } } | Set cache to all adapters |
236,351 | private function autoAssign ( $ attributes = null ) { if ( ! is_array ( $ attributes ) ) return false ; $ this -> max = isset ( $ attributes [ 0 ] ) ? $ attributes [ 0 ] : $ this -> max ; $ this -> minutes = isset ( $ attributes [ 1 ] ) ? $ attributes [ 1 ] : 1 ; $ this -> decay = isset ( $ attributes [ 1 ] ) ? strtoti... | Set request attributes |
236,352 | private function canProceed ( $ request ) : bool { $ time = $ this -> decay - date ( 's' ) ; if ( $ request -> cookies -> has ( 'clusters' ) ) { $ value = $ request -> cookie ( 'clusters' ) ; $ value = $ this -> hashids -> decode ( $ value ) [ 0 ] - 1 ; if ( $ value == 0 ) { $ this -> withHeaders ( $ request , $ value ... | Check if request can proceed |
236,353 | public function inArray ( $ values , $ args , $ do , $ strict = false ) { if ( ! is_callable ( $ do ) ) { throw new \ InvalidArgumentException ( 'Third argument must be a callable' ) ; } foreach ( $ values as $ single ) { $ result = $ do ( $ single , $ args ) ; if ( $ strict && ! $ result ) { break ; } } return $ resul... | Performs an operation in a given array . It stops if strict is set to true and the result of the operation is false . |
236,354 | public function registerLoader ( $ alias , $ loader ) { if ( $ this -> hasLoader ( $ alias ) ) { throw new \ RuntimeException ( sprintf ( 'Alias "%s" already used by another form loader' , $ alias ) ) ; } $ this -> loaders [ $ alias ] = $ loader ; } | Register a loader . |
236,355 | private function getLoader ( $ alias ) { if ( ! $ this -> hasLoader ( $ alias ) ) { throw new \ RuntimeException ( sprintf ( 'Form loader with alias "%s" not found.' , $ alias ) ) ; } return $ this -> loaders [ $ alias ] ; } | Get a loader by his alias . |
236,356 | public static function doInsert ( $ criteria , ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( C2MTableMap :: DATABASE_NAME ) ; } if ( $ criteria instanceof Criteria ) { $ criteria = clone $ criteria ; } else { $ criteria = $ criteria -> bui... | Performs an INSERT on the database given a C2M or Criteria object . |
236,357 | protected function loadQuery ( ) { if ( ! isset ( $ this -> session [ $ this -> saveID ] ) ) { return ; } $ saved = $ this -> session [ $ this -> saveID ] ; $ this -> inputs = array_merge ( $ saved [ 'inputs' ] , $ this -> inputs ) ; $ this -> perPage = $ saved [ 'perPage' ] ; if ( $ currPage = $ this -> getKey ( $ thi... | loads query information from saved session . |
236,358 | protected function saveQuery ( ) { $ this -> session [ $ this -> saveID ] = [ 'perPage' => $ this -> perPage , 'currPage' => $ this -> currPage , 'inputs' => $ this -> inputs , ] ; } | saves query information into session . |
236,359 | public function setDefaultValue ( $ defaultValue ) : FieldInterface { if ( ! is_scalar ( $ defaultValue ) && ! is_null ( $ defaultValue ) ) { throw new \ InvalidArgumentException ( "invalid value provided for 'defaultValue'; " . "expecting either a scalar or null value" ) ; } $ this -> defaultValue = $ defaultValue ; r... | Set the default value for the field |
236,360 | public function actionProfile ( ) { $ user = Yii :: $ app -> getUser ( ) -> getIdentity ( ) ; $ model = new MultiModel ( [ 'models' => [ 'user' => $ user , 'profile' => $ user -> profile , ] , ] ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> addFla... | Updates own profile . If update is successful the browser will be redirected to the view page . |
236,361 | public function cmdGetProductClass ( ) { $ result = $ this -> getListProductClass ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableProductClass ( $ result ) ; $ this -> output ( ) ; } | Callback for product - class - get command |
236,362 | public function cmdDeleteProductClass ( ) { $ id = $ this -> getParam ( 0 ) ; $ result = null ; if ( isset ( $ id ) ) { if ( empty ( $ id ) || ! is_numeric ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> product_class -> delete ( $ id ) ; } else if ( $ this -> getP... | Callback for product - class - delete command |
236,363 | public function cmdUpdateProductClass ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ ... | Callback for product - class - update command |
236,364 | protected function addProductClass ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> product_class -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } } | Add a new product class |
236,365 | protected function submitAddProductClass ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'product_class' ) ; $ this -> addProductClass ( ) ; } | Add a new product class at once |
236,366 | protected function wizardAddProductClass ( ) { $ this -> validatePrompt ( 'title' , $ this -> text ( 'Title' ) , 'product_class' ) ; $ this -> validatePrompt ( 'status' , $ this -> text ( 'Status' ) , 'product_class' , 0 ) ; $ this -> validateComponent ( 'product_class' ) ; $ this -> addProductClass ( ) ; } | Add a new product class step by step |
236,367 | final public static function getAlignedPos ( Base $ object , $ newHalign , $ newValign ) { $ newPosX = self :: getAlignedPosX ( $ object -> getPosnX ( ) , $ object -> getRealSizeX ( ) , $ object -> getHalign ( ) , $ newHalign ) ; $ newPosY = self :: getAlignedPosY ( $ object -> getPosnY ( ) , $ object -> getRealSizeY (... | Returns the position of an element in relation to another element and according to their respective alignments |
236,368 | protected function createMatchQuery ( $ expression , array $ fields = [ ] ) { if ( 0 == strlen ( $ expression ) ) { return new Query \ MatchAll ( ) ; } if ( empty ( $ fields ) ) { $ fields = $ this -> getDefaultMatchFields ( ) ; } $ query = new Query \ MultiMatch ( ) ; $ query -> setQuery ( $ expression ) -> setFields ... | Creates the match query . |
236,369 | public function writeXML ( \ XMLWriter $ w , string $ elementName = 'ImageSizeReducer' ) { $ w -> startElement ( $ elementName ) ; $ this -> writeXMLAttributes ( $ w ) ; $ w -> endElement ( ) ; } | Writes all instance options to an XML element . |
236,370 | public function writeXMLAttributes ( \ XMLWriter $ w ) { switch ( $ this -> data [ 'type' ] ) { case ImageSizeReducerType :: CROP : $ w -> writeAttribute ( 'type' , 'crop' ) ; $ w -> writeAttribute ( 'width' , $ this -> data [ 'width' ] ) ; $ w -> writeAttribute ( 'height' , $ this -> data [ 'height' ] ) ; break ; case... | Writes all instance options to XML attributes inside the opened XML element . |
236,371 | protected static function Create ( int $ type , int $ width , int $ height , int $ gravity = Gravity :: MIDDLE_CENTER , int $ portraitLength = 0 , int $ landscapeLength = 0 ) : ImageSizeReducer { switch ( $ type ) { case ImageSizeReducerType :: CROP : if ( $ width < 1 ) { throw new ArgumentError ( 'width' , $ width , '... | Init an Image size reducer . |
236,372 | public static function TryParse ( $ value , & $ refReducer = null ) : bool { if ( \ is_null ( $ value ) ) { return false ; } if ( $ value instanceof \ SimpleXMLElement ) { return static :: TryParseXmlElement ( $ value , $ refReducer ) ; } if ( \ is_string ( $ value ) && ! empty ( $ value ) && $ value [ 0 ] == '{' ) { t... | Tries to parse the defined value to an ImageSizeReducer instance |
236,373 | public function resolve ( $ databaseResult ) { $ className = $ this -> className ; try { $ object = new $ className ( ) ; $ this -> loader -> mapObjectWithOptions ( $ object , $ databaseResult ) ; $ databaseResult -> { $ this -> fieldName } = $ object ; } catch ( \ Exception $ e ) { echo $ e -> getMessage ( ) ; } } | Resolve data by splicing in the completed object |
236,374 | public function joinOn ( $ foreignKeyColumn ) { return 'join ' . $ this -> getTable ( ) . ' on ' . $ this -> loader -> getPrimaryKey ( $ this -> alias ) . ' = ' . $ foreignKeyColumn . ' ' ; } | Print out Join SQL |
236,375 | protected function prefixedResource ( $ name , $ controller , array $ options ) { list ( $ name , $ prefix ) = $ this -> getResourcePrefix ( $ name ) ; $ callback = function ( $ me ) use ( $ name , $ controller , $ options ) { $ me -> resource ( $ name , $ controller , $ options ) ; } ; $ this -> router -> group ( comp... | Build a set of prefixed resource routes . |
236,376 | protected function addResourceShow ( $ name , $ base , $ controller , $ options ) { $ uri = $ this -> getResourceUri ( $ name ) . '/{' . $ base . '' ; $ action = $ this -> getResourceAction ( $ name , $ controller , 'show' , $ options ) ; return $ this -> router -> get ( $ uri , $ action ) ; } | Add the show method for a resourceful route . |
236,377 | public static function generateRandomAlphaNumericString ( $ length ) { $ chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ; $ size = strlen ( $ chars ) ; $ randomChars = array ( ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ randomChars [ ] = $ chars [ mt_rand ( 0 , $ size - 1 ) ] ; } return ... | Generate a random string with repeatable letters . |
236,378 | public function verifyPassword ( $ name , $ pass ) { $ this -> find ( "name" , $ name ) ; return password_verify ( $ pass , $ this -> pass ) ; } | Verify the name and the pass if successful the object contains all details from the database row . |
236,379 | public function controlAuthority ( $ loggedUser , $ name ) { $ this -> find ( "name" , $ loggedUser ) ; if ( $ this -> authority != "admin" ) { return ( $ this -> name == $ name ) ; } return true ; } | Check if a post belongs to user |
236,380 | public function get ( ) { return new JSendResponse ( $ this -> status , $ this -> data , $ this -> errors , $ this -> code , $ this -> message ) ; } | Returns the built object |
236,381 | function getStatement ( $ cKey , $ sqlCallback , $ types , $ params ) { if ( ! $ this -> stmtCache [ $ cKey ] ) { if ( ! ( $ stmt = $ this -> mysqli -> prepare ( $ sqlCallback instanceof \ Closure ? $ sqlCallback ( ) : $ sqlCallback ) ) ) { throw new \ Exception ( "Statement Error: {$this->mysqli->error}" , $ this -> m... | array and returns the statement ready to execute . |
236,382 | public static function check ( $ path , $ fd , $ rw ) { if ( $ fd == 'f' ) { if ( is_file ( $ path ) != true ) { return false ; } } elseif ( $ fd == 'd' ) { if ( is_dir ( $ path ) != true ) { return false ; } } else { return false ; } if ( $ rw == 'r' ) { if ( ! is_readable ( $ path ) ) { return false ; } } elseif ( $ ... | Checks a file or directory existence and readability |
236,383 | public function loadConfig ( $ configFiles ) { if ( ! is_array ( $ configFiles ) ) { $ configFiles = array ( $ configFiles ) ; } $ this -> configFiles = $ configFiles ; foreach ( $ configFiles as $ configFile ) { $ this -> config = array_merge ( $ this -> config , $ this -> loadConfigFile ( $ configFile ) ) ; } } | Sets to the config property the merged content from all the config files . |
236,384 | public function fetch ( ) { $ keys = func_get_args ( ) ; $ config = $ this -> config ; foreach ( $ keys as $ key ) { if ( isset ( $ config [ $ key ] ) ) { $ config = $ config [ $ key ] ; } else { throw new KeyNotFoundException ( "Key $key not found." ) ; } } return $ config ; } | Fetches a single value from a key chain of N depth |
236,385 | public function flush ( ) { if ( $ this -> useCache ) { foreach ( $ this -> configFiles as $ configFile ) { if ( function_exists ( 'apc_delete' ) ) { \ apc_delete ( $ configFile ) ; } } } $ this -> config = array ( ) ; } | If cache is used flushes it . Otherwise it just empties config property . |
236,386 | private function loadConfigFile ( $ configFile ) { if ( $ this -> useCache ) { if ( function_exists ( 'apc_fetch' ) ) { $ config = apc_fetch ( $ configFile ) ; } elseif ( function_exists ( 'apcu_fetch' ) ) { $ config = apcu_fetch ( $ configFile ) ; } if ( ! empty ( $ config ) ) { return $ config ; } } if ( ! is_readabl... | Loads a config file into config property . If cache is used first check if the config file was previously loaded . |
236,387 | public function initializeRequest ( $ request = null ) { if ( empty ( $ request ) ) { $ this -> request = Request :: createFromGlobals ( ) ; } else { $ this -> request = $ request ; } $ this -> input = new Input ( $ this -> request ) ; } | Get info about the HTTP Request |
236,388 | public function jsonp ( $ content = [ ] , $ jsonCallback = 'callback' ) { $ response = new JsonResponse ( ) ; $ response -> setData ( $ content ) ; $ response -> setCallback ( $ jsonCallback ) ; $ response -> send ( ) ; } | Send a jsonp response with given content . |
236,389 | public function getRequestedController ( $ default = null ) { if ( property_exists ( $ this , 'app' ) && is_object ( $ this -> app ) && property_exists ( $ this -> app , 'controller' ) ) { return $ this -> app -> controller ; } elseif ( ! empty ( $ default ) ) { return $ default ; } else { $ reflect = new \ ReflectionC... | Which controller was requested? |
236,390 | public function getRequestedAction ( $ default = 'index' ) { if ( property_exists ( $ this , 'app' ) && is_object ( $ this -> app ) && property_exists ( $ this -> app , 'action' ) ) { return $ this -> app -> action ; } else { return $ default ; } } | Which action was requested? |
236,391 | public static function initialize ( Connection $ connection , string $ baseNamespace = "\\" ) { self :: $ _connection = $ connection ; self :: $ _baseNamespace = Str :: trailing ( $ baseNamespace , "\\" ) ; } | Initializes the class . |
236,392 | public static function find ( $ id , $ limit = - 1 , string $ table = "" , bool $ setRelations = true ) { $ query = new QueryBuilder ( self :: $ _connection ) ; $ model = new static ( ) ; $ query -> select ( "*" ) ; if ( $ table === "" ) { $ query -> from ( $ model -> getTable ( ) ) ; } else { $ query -> from ( $ table... | Finds and returns one or more record from the database . |
236,393 | public static function all ( array $ where = [ ] , string $ table = "" , bool $ setRelations = true ) : array { $ query = new QueryBuilder ( self :: $ _connection ) ; $ model = new static ( ) ; $ query -> select ( "*" ) ; if ( $ table === "" ) { $ query -> from ( $ model -> getTable ( ) ) ; } else { $ query -> from ( $... | Returns all records from database . |
236,394 | private static function _setWhere ( $ where , QueryBuilder $ query , string $ primaryKey = "id" ) : QueryBuilder { if ( ! is_array ( $ where ) ) { return $ query -> where ( [ $ primaryKey => $ where ] ) ; } $ columns = $ where ; unset ( $ columns [ "ORDER BY" ] ) ; unset ( $ columns [ "LIMIT" ] ) ; unset ( $ columns [ ... | Sets the WHERE param to the query . |
236,395 | public function set ( string $ name , $ value ) { $ this -> _data [ $ name ] = $ value ; if ( ! is_object ( $ value ) ) { $ this -> _changed [ $ name ] = $ value ; } } | Sets a column . |
236,396 | public function save ( ) { $ query = new QueryBuilder ( self :: $ _connection ) ; if ( $ this -> _isInsert ) { $ query -> insert ( $ this -> getTable ( ) ) -> values ( $ this -> _changed ) ; $ id = self :: $ _connection -> insert ( $ query -> getQuery ( ) ) ; $ this -> _data [ $ this -> _primaryKey ] = $ id ; $ this ->... | Saves the changes to the database . |
236,397 | public function getTable ( ) : string { if ( ! empty ( $ this -> _table ) ) { return $ this -> _table ; } $ class = explode ( "\\" , str_replace ( self :: $ _baseNamespace , "" , "\\" . get_called_class ( ) ) ) ; $ table = Str :: snake ( Str :: plural ( $ class ) ) ; $ this -> _table = $ table ; return $ this -> _table... | Builds and returns table name . |
236,398 | public function asArray ( bool $ decodeJSON = true ) : array { if ( ! $ decodeJSON ) { return $ this -> _data ; } $ return = [ ] ; foreach ( $ this -> _data as $ key => $ value ) { $ decoded = json_decode ( $ value ) ; $ return [ $ key ] = $ decoded ; if ( ! is_array ( $ decoded ) && ! is_object ( $ decoded ) ) { $ ret... | Returns table values . |
236,399 | public function asJSON ( ) : string { $ fields = [ ] ; foreach ( $ this -> _data as $ key => $ value ) { if ( ! is_object ( $ value ) ) { $ fields [ $ key ] = $ value ; } } return json_encode ( $ fields ) ; } | Returns values as a JSON . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.