idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
56,800 | public function getConfigModel ( $ store = null ) { return Mage :: getModel ( 'radial_core/config_registry' ) -> setStore ( $ store ) -> addConfigModel ( Mage :: getSingleton ( 'radial_order/config' ) ) ; } | Gets a combined configuration model from core and order |
56,801 | public function removeOrderIncrementPrefix ( $ incrementId ) { $ stores = $ this -> _getAllStores ( ) ; foreach ( $ stores as $ store ) { $ prefix = $ this -> _coreHelper -> getConfigModel ( $ store -> getId ( ) ) -> clientOrderIdPrefix ; if ( strpos ( $ incrementId , $ prefix ) === 0 ) { return substr ( $ incrementId ... | Remove a client order id prefix from the increment id . As the prefix on the increment id may have been any of the configured order id prefixes need to check through all possible prefixes configured to find the one to remove . |
56,802 | public function setup ( Model $ Model , $ config = array ( ) ) { parent :: setup ( $ Model , $ config ) ; $ this -> config [ $ Model -> alias ] = $ config + ( array ) Configure :: read ( 'Serializable' ) + array ( 'fields' => array ( ) , 'serialize' => 'serialize' , 'unserialize' => 'unserialize' , 'aliases' => array (... | Initialize Serializable Behavior |
56,803 | public function afterFind ( Model $ Model , $ results , $ primary = false ) { foreach ( $ results as $ key => & $ result ) { foreach ( $ this -> config [ $ Model -> alias ] [ 'fields' ] as $ field ) { $ this -> _unserializeFindField ( $ field , $ key , $ result , $ Model ) ; } } unset ( $ result ) ; return $ results ; ... | After find callback . Unserializes all specified fields in each result |
56,804 | public function beforeSave ( Model $ Model , $ options = array ( ) ) { $ currentData = false ; if ( $ this -> config [ $ Model -> alias ] [ 'merge' ] && ( isset ( $ Model -> data [ $ Model -> alias ] [ $ Model -> primaryKey ] ) || isset ( $ Model -> data [ $ Model -> primaryKey ] ) ) ) { $ Model -> recursive = - 1 ; $ ... | Before save callback . Serializes all specified fields in model data |
56,805 | public function afterSave ( Model $ model , $ created , $ options = array ( ) ) { $ model -> data = $ this -> afterFind ( $ model , $ model -> data ) ; } | After save callback . Unserializes all specified fields in each result |
56,806 | protected function _unserializeFindField ( $ field , $ key , & $ result , Model $ Model ) { if ( isset ( $ result [ $ field ] ) ) { $ result [ $ field ] = $ this -> _unserialize ( $ Model -> alias , $ result [ $ field ] ) ; } elseif ( $ key === $ field ) { $ result = $ this -> _unserialize ( $ Model -> alias , $ result... | Unserialize one field after find |
56,807 | protected function _unserialize ( $ alias , $ data ) { if ( ! is_string ( $ data ) ) { return $ data ; } return call_user_func ( $ this -> config [ $ alias ] [ 'unserialize' ] , $ data ) ; } | Invokes unserialization . Unserialization function is set by globall config model config or defaults to unserialize |
56,808 | private function path2action ( $ s ) { $ s = strtolower ( $ s ) ; $ s = preg_replace ( '#-(?=[a-z])#' , ' ' , $ s ) ; $ s = substr ( ucwords ( 'x' . $ s ) , 1 ) ; $ s = str_replace ( ' ' , '' , $ s ) ; return $ s ; } | dash - separated - > camelCaseAction name . |
56,809 | public function start ( string $ id , string $ name = 'PHPSESSID' , array $ options = [ ] ) : self { if ( $ this -> disabled ( ) ) { throw new \ RuntimeException ( 'PHP sessions are disabled' ) ; } if ( $ this -> active ( ) ) { throw new \ RuntimeException ( 'Failed to start the session: already started by PHP.' ) ; } ... | Starts session with specific id name and options . |
56,810 | public function save ( ) : void { if ( $ this -> active ( ) && session_name ( ) == $ this -> name ( ) ) { $ _SESSION = $ this -> all ( ) ; session_write_close ( ) ; } } | Save and close session . |
56,811 | public function decode ( $ hash ) { $ binary = "" ; $ hl = strlen ( $ hash ) ; for ( $ i = 0 ; $ i < $ hl ; $ i ++ ) { $ binary .= $ this -> codingMap [ substr ( $ hash , $ i , 1 ) ] ; } $ bl = strlen ( $ binary ) ; $ blat = "" ; $ blong = "" ; for ( $ i = 0 ; $ i < $ bl ; $ i ++ ) { if ( $ i % 2 ) $ blat = $ blat . su... | Decode a geohash and return an array with decimal lat long in it |
56,812 | public function encode ( $ lat , $ long ) { $ plat = $ this -> precision ( $ lat ) ; $ latbits = 1 ; $ err = 45 ; while ( $ err > $ plat ) { $ latbits ++ ; $ err /= 2 ; } $ plong = $ this -> precision ( $ long ) ; $ longbits = 1 ; $ err = 90 ; while ( $ err > $ plong ) { $ longbits ++ ; $ err /= 2 ; } $ bits = max ( $ ... | Encode a hash from given lat and long |
56,813 | public static function setOption ( $ key , $ val ) { self :: init ( ) ; return self :: $ instance -> setOption ( $ key , $ val ) ; } | set log option for all future executions of makeLog |
56,814 | public function refreshProfile ( array $ userProfile = [ ] ) { if ( count ( $ userProfile ) == 0 ) { $ userProfile = $ this -> getProfileFromApi ( ) ; } $ success = false ; if ( is_array ( $ userProfile ) ) { $ info = $ this -> mapPropertiesFromApi ( $ userProfile ) ; $ this -> grantAllPermissions ( ) ; $ success = $ t... | Refreshes this profile using the API of the social network . |
56,815 | public static function refreshProfiles ( ) { $ profile = new static ( ) ; $ staleDate = time ( ) - ( $ profile -> daysUntilStale ( ) * 86400 ) ; $ profiles = static :: findAll ( [ 'where' => [ 'access_token <> ""' , 'last_refreshed < ' . $ staleDate , ] , 'limit' => $ profile -> numProfilesToRefresh ( ) , 'sortBy' => '... | Refreshes stale twitter profiles . One call currently only refreshes 180 profiles to minimize bumping into twitter s rate limiting . |
56,816 | protected function mapPropertiesFromApi ( array $ user_profile ) { $ info = [ ] ; foreach ( $ this -> apiPropertyMapping ( ) as $ modelProperty => $ apiProperty ) { $ info [ $ modelProperty ] = U :: array_value ( $ user_profile , $ apiProperty ) ; } return $ info ; } | Maps the properties of the user profile from the API to the properties in our model . |
56,817 | protected static function is_numeric ( $ type ) { switch ( $ type ) { case self :: INT : case self :: TINYINT : case self :: MEDIUMINT : case self :: BIGINT : case self :: DOUBLE : case self :: FLOAT : case self :: REAL : case self :: DECIMAL : return true ; break ; default : return false ; break ; } } | Type is numeric |
56,818 | public function getServiceSpecification ( $ entity ) { if ( ! is_object ( $ entity ) ) { if ( ( is_string ( $ entity ) && ( ! class_exists ( $ entity ) ) ) || ( ! is_string ( $ entity ) ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( '%s expects an object or valid class name; received "%s"' , __METHOD_... | Creates and returns service definition as an array object |
56,819 | protected function parseClassSpecifications ( ClassReflection $ class , ArrayObject $ serviceSpec ) { if ( $ class -> getParentClass ( ) ) { $ this -> parseClassSpecifications ( $ class -> getParentClass ( ) , $ serviceSpec ) ; } $ annotationManager = $ this -> getAnnotationManager ( ) ; $ annotations = $ class -> getA... | Parse class level specs for service |
56,820 | public function getAnnotationManager ( ) { if ( $ this -> annotationManager ) { return $ this -> annotationManager ; } $ this -> setAnnotationManager ( new AnnotationManager ( ) ) ; return $ this -> annotationManager ; } | Retrieve annotation manager |
56,821 | public function setAnnotationManager ( AnnotationManager $ annotationManager ) { $ parser = new Parser \ DoctrineAnnotationParser ( ) ; foreach ( $ this -> defaultAnnotations as $ annotationName ) { $ class = __NAMESPACE__ . '\\' . $ annotationName ; $ parser -> registerAnnotation ( $ class ) ; } $ annotationManager ->... | Set annotation manager to use when building form from annotations |
56,822 | public function setEventManager ( EventManagerInterface $ events ) { $ events -> setIdentifiers ( array ( __CLASS__ , get_class ( $ this ) , ) ) ; $ events -> attach ( new OperationAnnotationsListener ( ) ) ; $ events -> attach ( new ServiceAnnotationsListener ( ) ) ; $ this -> events = $ events ; return $ this ; } | Set event manager instance |
56,823 | protected function configureService ( AnnotationCollection $ annotations , ClassReflection $ reflection , ArrayObject $ serviceSpec ) { $ events = $ this -> getEventManager ( ) ; foreach ( $ annotations as $ annotation ) { $ events -> trigger ( __FUNCTION__ , $ this , array ( 'annotation' => $ annotation , 'name' => $ ... | Configure service based on annotations |
56,824 | protected function configureOperation ( AnnotationCollection $ annotations , MethodReflection $ method , ArrayObject $ serviceSpec ) { if ( ! $ annotations -> count ( ) && isset ( $ serviceSpec [ 'operations' ] [ $ method -> getName ( ) ] ) ) { return ; } $ operationSpec = new ArrayObject ( array ( 'events' => array ( ... | Configure operation based on annotations |
56,825 | public function parse ( ) { return $ this -> setDescription ( ) -> setArray ( 'IS_ARRAY' ) -> setOptional ( ) -> setDefault ( ) -> setRequired ( ) -> calculateMode ( InputArgument :: class ) -> setName ( ) ; } | Parse the set argument string . |
56,826 | protected function setOptional ( ) { if ( substr ( $ this -> input , - 1 ) === '?' ) { $ this -> modeArray [ ] = 'OPTIONAL' ; $ this -> input = str_replace ( '?' , '' , $ this -> input ) ; } return $ this ; } | Set optional argument mode . |
56,827 | protected function setDefault ( ) { if ( strpos ( $ this -> input , '=' ) ) { list ( $ this -> input , $ this -> default ) = explode ( '=' , $ this -> input ) ; $ this -> modeArray [ ] = 'OPTIONAL' ; } return $ this ; } | Set default option value . |
56,828 | public function add ( $ method = 'GET' , $ uri = '/' , $ pattern = '' , array $ options = [ ] ) { $ this -> method [ ] = $ method ; $ this -> uri [ ] = $ uri ; $ this -> pattern [ ] = $ pattern ; $ this -> filter [ $ uri ] [ $ method ] = ( isset ( $ options [ 'filter' ] ) ) ? $ options [ 'filter' ] : '' ; } | To add route |
56,829 | public function register ( ) { $ route = new RouteCollector ( new Std ( ) , new DataGenerator ( ) ) ; for ( $ i = 0 ; $ i < count ( $ this -> uri ) ; $ i ++ ) { $ route -> addRoute ( $ this -> method [ $ i ] , $ this -> uri [ $ i ] , $ this -> pattern [ $ i ] ) ; } $ this -> dispatcher = new Dispatcher ( $ route -> get... | To register route |
56,830 | public function dispatch ( $ method , $ uri ) { $ routeInfo = $ this -> dispatcher -> dispatch ( $ method , $ uri ) ; if ( $ routeInfo [ 0 ] === Dispatcher :: NOT_FOUND ) { $ this -> filterRequest ( '*' , $ method ) ; $ routeInfo = $ this -> dispatcher -> dispatch ( $ method , '*' ) ; if ( ! $ routeInfo [ 0 ] ) { throw... | To dispatch a route |
56,831 | protected function methodDispatcher ( $ handler , $ params ) { if ( is_callable ( $ handler ) ) { $ resolving = $ this -> container -> resolveCallback ( $ handler , $ params ) ; $ this -> validateForm ( $ resolving ) ; return call_user_func_array ( $ handler , $ resolving ) ; } list ( $ controller , $ method ) = explod... | To execute route handler |
56,832 | protected function invoke ( $ controller , $ method , $ params ) { if ( ! class_exists ( $ controller ) ) { throw new Exception ( "Controller [ $controller ] does not exist." ) ; } try { $ instance = $ this -> container -> make ( $ controller ) ; $ resolving = $ this -> container -> resolveMethod ( $ controller , $ met... | To execute handler |
56,833 | protected function filterRequest ( $ uri , $ method ) { if ( ! empty ( $ filtersPattern = $ this -> filter [ $ uri ] [ $ method ] ) ) { $ filters = explode ( '|' , $ filtersPattern ) ; foreach ( $ filters as $ filter ) { list ( $ className , $ params ) = $ this -> getClassNameWithParams ( $ filter ) ; $ name = app ( ) ... | To filter http request |
56,834 | protected function getClassNameWithParams ( $ filter ) { $ pattern = explode ( ':' , $ filter ) ; $ className = trim ( $ pattern [ 0 ] ) ; $ params = [ ] ; if ( isset ( $ pattern [ 1 ] ) ) { $ params = array_map ( 'trim' , explode ( ',' , $ pattern [ 1 ] ) ) ; } return [ $ className , $ params ] ; } | Get filterable class name and params |
56,835 | protected function signInUser ( UserInterface $ user , $ remember = false ) { return $ this -> auth -> signInUser ( $ user , $ this -> getId ( ) , $ remember ) ; } | Helper method to start a new user session from this strategy . |
56,836 | public function getServiceDescription ( ) { if ( null === $ this -> serviceDescription ) { $ serviceDescription = static :: loadServiceDescription ( ) ; $ serviceDescription [ 'ravelry.access_key' ] = $ this -> authentication -> getAccessKey ( ) ; $ serviceDescription [ 'operations' ] [ 'upload_image' ] [ 'parameters' ... | Create our service description from the schema file . We inject a few runtime - specific values into the description . |
56,837 | public function getAvailableRollbacksByTarget ( Target $ target , $ limit = 50 , $ page = 0 ) { $ dql = sprintf ( self :: DQL_ROLLBACKS , Release :: class ) ; $ params = [ 'target' => $ target , 'release_status' => JobStatusEnum :: TYPE_SUCCESS , 'build_status' => JobStatusEnum :: TYPE_SUCCESS , ] ; return $ this -> ge... | Get all releases that can be used as a rollback paged . |
56,838 | public function getByTarget ( Target $ target , $ limit = 50 , $ page = 0 ) { $ dql = sprintf ( self :: DQL_BY_TARGET , Release :: class ) ; $ params = [ 'target' => $ target ] ; return $ this -> getPaginator ( $ dql , $ limit , $ page , $ params ) ; } | Get all releases to a target paged . |
56,839 | public function getByApplication ( Application $ application , $ limit = 50 , $ page = 0 , $ filter = '' ) { $ template = ( $ filter ) ? self :: DQL_BY_APPLICATION_WITH_REF_FILTER : self :: DQL_BY_APPLICATION ; $ dql = sprintf ( $ template , Release :: class ) ; $ params = [ 'application' => $ application ] ; if ( $ fi... | Get all releases for an application paged . |
56,840 | public function requestingHelpInformation ( ) { $ validHelpTokens = [ '-h' , '--help' ] ; foreach ( $ this -> tokens as $ token ) { if ( in_array ( $ token , $ validHelpTokens ) ) { return true ; } } return false ; } | Determines if a user is requesting help information . |
56,841 | public function getTemplateName ( ) { if ( $ this -> templateName == null ) { $ this -> templateName = $ this -> tokens [ 1 ] ; } return $ this -> templateName ; } | Gets the template name from the input tokens . |
56,842 | private function initializeTemplatePath ( ) { $ this -> customTemplatePath = null ; foreach ( $ this -> tokens as $ token ) { if ( str_is ( '--newup-directory*' , $ token ) ) { $ this -> customTemplatePath = substr ( $ token , 18 ) ; break ; } } } | Initializes the custom template path variable . |
56,843 | private function getPackageClass ( ) { if ( $ this -> packageClass !== null ) { return $ this -> packageClass ; } $ includePath = $ this -> getPackageClassPath ( ) ; if ( ! file_exists ( $ includePath ) ) { Application :: getOutput ( ) -> writeln ( "<comment>{$this->getTemplateName()} is not installed. Attempting to in... | Gets the package class . |
56,844 | public function bind ( InputDefinition $ definition ) { $ this -> arguments = array ( ) ; $ this -> options = array ( ) ; $ this -> definition = $ definition ; $ packageClass = $ this -> getPackageClass ( ) ; $ options = $ packageClass :: getOptions ( ) ; $ arguments = $ packageClass :: getArguments ( ) ; foreach ( $ o... | Binds the current Input instance with the given arguments and options . |
56,845 | private function getNamespacedPackageName ( ) { $ path = $ this -> getTemplateArgumentPath ( ) ; $ templateName = json_decode ( file_get_contents ( $ path . 'composer.json' ) ) -> name ; $ parts = explode ( '/' , $ templateName ) ; return package_vendor_namespace ( $ parts [ 0 ] , $ parts [ 1 ] ) . '\Package' ; } | Gets the namespaced package name . |
56,846 | private function getTemplateArgumentPath ( ) { if ( $ this -> customTemplatePath !== null ) { return str_finish ( $ this -> customTemplatePath , '/' ) ; } return str_finish ( find_tse_template ( $ this -> getTemplateName ( ) ) , '/' ) ; } | Determines the template path . |
56,847 | public function translate ( $ sentence ) { $ key = Inflector :: slug ( $ sentence ) ; $ translate = $ this -> db ( ) -> select ( "entity_name = 'translation_" . $ this -> language . "' AND table_name = '" . $ key . "'" , true ) ; if ( null !== $ translate ) { return unserialize ( $ translate -> getData ( ) ) ; } return... | Retrieve an item from the translation driver . |
56,848 | static function removeIdentity ( \ Db \ Connection $ db , User $ user , $ openid ) { if ( ! $ user ) { throw new \ InvalidArgumentException ( "No user provided." ) ; } $ q = $ db -> prepare ( "DELETE FROM user_openid_identities WHERE user_id=? AND identity=? LIMIT 1" ) ; return $ q -> execute ( array ( $ user -> getId ... | Remove the given OpenID identity from the given user . |
56,849 | public function toString ( $ type = 'jpg' , $ quality = 75 ) { ob_start ( ) ; if ( $ type == 'jpg' && ( imagetypes ( ) & IMG_JPG ) ) imagejpeg ( $ this -> im , null , $ quality ) ; elseif ( $ type == 'png' && ( imagetypes ( ) & IMG_PNG ) ) imagepng ( $ this -> im ) ; elseif ( $ type == 'gif' && ( imagetypes ( ) & IMG_G... | Is there a way to do this without using output buffering? |
56,850 | public function scale ( $ new_width = null , $ new_height = null ) { if ( ! is_null ( $ new_width ) && is_null ( $ new_height ) ) $ new_height = $ new_width * $ this -> height / $ this -> width ; elseif ( is_null ( $ new_width ) && ! is_null ( $ new_height ) ) $ new_width = $ this -> width / $ this -> height * $ new_he... | Resizes an image and maintains aspect ratio . |
56,851 | public function resize ( $ new_width , $ new_height ) { $ dest = imagecreatetruecolor ( $ new_width , $ new_height ) ; imagealphablending ( $ dest , false ) ; imagesavealpha ( $ dest , true ) ; if ( imagecopyresampled ( $ dest , $ this -> im , 0 , 0 , 0 , 0 , $ new_width , $ new_height , $ this -> width , $ this -> hei... | Resizes an image to an exact size |
56,852 | public static function isSupportedShell ( ) { if ( isset ( $ _ENV [ 'TERM' ] ) ) { if ( isset ( self :: $ _supportedShells [ $ _ENV [ 'TERM' ] ] ) ) { return true ; } } elseif ( isset ( $ _SERVER [ 'TERM' ] ) ) { if ( isset ( self :: $ _supportedShells [ $ _SERVER [ 'TERM' ] ] ) ) { return true ; } } elseif ( isset ( $... | Identify if console supports colors . |
56,853 | public static function warningLine ( $ msg ) { return self :: colorize ( $ msg , Console :: FG_RED , Console :: AT_BOLD ) . PHP_EOL . PHP_EOL ; } | Get warning line message . |
56,854 | public static function infoLine ( $ msg , $ lineBefore = true , $ afterLinesCount = 2 , $ color = Console :: FG_GREEN ) { $ out = '' ; if ( $ lineBefore ) { $ out .= PHP_EOL ; } $ out .= self :: colorize ( $ msg , $ color , Console :: AT_BOLD ) ; if ( $ afterLinesCount ) { for ( $ i = 0 ; $ i < $ afterLinesCount ; $ i ... | Get info line message . |
56,855 | public static function commandLine ( $ cmd , $ comment = '' , $ commentColor = Console :: FG_BROWN , $ cmdColor = Console :: FG_GREEN ) { $ messageLength = strlen ( $ cmd ) + 3 ; $ startPosition = self :: COMMENT_START_POSITION ; return self :: colorize ( ' ' . $ cmd , $ cmdColor ) . self :: tab ( $ startPosition , $ ... | Get command line message . |
56,856 | public function set ( $ name , $ value ) { $ this -> instance -> unlock ( ) ; $ result = $ this -> instance -> set ( $ name , $ value ) ; $ this -> instance -> lock ( ) ; return $ result ; } | Set a key value in the standard session |
56,857 | public function remove ( $ name ) { $ this -> instance -> unlock ( ) ; $ result = $ this -> instance -> remove ( $ name ) ; $ this -> instance -> lock ( ) ; return $ result ; } | Remove a single value from the session |
56,858 | public function removeAll ( ) { $ this -> instance -> unlock ( ) ; $ result = $ this -> instance -> removeAll ( ) ; $ this -> instance -> lock ( ) ; return $ result ; } | Clear all session values outside of the namespace . |
56,859 | public function toArrayParent ( $ chaine_parent = 'parent_id' , $ chaine_id = 'id' , array $ indices = array ( ) , $ unset_indice = false ) { $ array = $ this -> toArray ( ) ; $ num = 0 ; $ final = array ( ) ; do { $ is_present = false ; foreach ( $ array as $ key => $ row ) { if ( $ row [ $ chaine_parent ] == $ num ) ... | To Array by parent id . |
56,860 | protected function execute ( InputInterface $ input , OutputInterface $ output ) { if ( $ root = $ input -> getArgument ( 'root-dir' ) ) { chdir ( realpath ( $ root ) ) ; } $ rootDir = realpath ( getcwd ( ) ) ; $ logger = new ConsoleLogger ( $ output ) ; $ composerJson = $ rootDir . '/composer.json' ; if ( ! file_exist... | Execute the tests . |
56,861 | private function prepareReport ( InputInterface $ input , LoggerInterface $ logger ) { $ reportMap = array ( ) ; if ( $ input -> getOption ( 'strict' ) ) { $ reportMap = array ( DestinationInterface :: SEVERITY_ERROR => DestinationInterface :: SEVERITY_ERROR , DestinationInterface :: SEVERITY_WARNING => DestinationInte... | Prepare the report . |
56,862 | private function prepareLoader ( EnumeratingClassLoader $ enumLoader , AutoloadValidator $ autoloadValidator ) { $ loaders = $ autoloadValidator -> getLoaders ( ) ; foreach ( $ loaders as $ name => $ loader ) { $ enumLoader -> add ( $ loader , $ name ) ; } } | Create a class loader that contains the classes found by us and the classes from the real composer installation . |
56,863 | private function prepareComposerFallbackLoader ( EnumeratingClassLoader $ enumLoader , $ baseDir , $ composer ) { $ vendorDir = $ baseDir . DIRECTORY_SEPARATOR . 'vendor' ; if ( isset ( $ composer [ 'extra' ] [ 'vendor-dir' ] ) ) { $ vendorDir = $ baseDir . DIRECTORY_SEPARATOR . $ composer [ 'extra' ] [ 'vendor-dir' ] ... | Prepare the composer fallback loader . |
56,864 | private function getIgnoredFiles ( $ composer , $ fileList ) { $ ignored = $ fileList ; foreach ( array ( 'autoload' , 'autoload-dev' ) as $ sectionName ) { if ( array_key_exists ( $ sectionName , $ composer ) ) { if ( array_key_exists ( 'exclude-from-classmap' , $ composer [ $ sectionName ] ) ) { $ ignored = array_mer... | Retrieve the list of ignored files . |
56,865 | public function configure ( array $ configs , $ prefix , ConfigurationInterface $ configuration , ContainerBuilder $ container ) { $ config = $ this -> processConfiguration ( $ configuration , $ configs ) ; $ loader = new XmlFileLoader ( $ container , new FileLocator ( $ this -> getConfigurationDirectory ( ) ) ) ; $ th... | Configures the pool builder and returns the bundle processed configuration . |
56,866 | protected function loadConfigurationFile ( array $ config , XmlFileLoader $ loader ) { foreach ( $ config as $ filename ) { if ( file_exists ( $ file = sprintf ( '%s/%s.xml' , $ this -> getConfigurationDirectory ( ) , $ filename ) ) ) { $ loader -> load ( $ file ) ; } } } | Loads bundle configuration files . |
56,867 | public function handleOpen ( string $ fileName ) : void { if ( strpos ( $ fileName , '..' . DIRECTORY_SEPARATOR ) !== false ) { throw new InvalidArgumentException ; } $ file = $ this -> getFileInfo ( $ fileName ) ; if ( $ file -> isDir ) { $ path = $ this -> getPath ( ) ; $ path [ ] = $ fileName ; $ this -> setPath ( $... | Otevreni souboru nebo adresare |
56,868 | public function handleFile ( string $ fileName ) : void { $ file = $ this -> getFileInfo ( $ fileName ) ; if ( strpos ( $ file -> type , 'image' ) !== false ) { $ response = new FileResponse ( $ this -> getFullPath ( $ file -> name ) , $ file -> name , $ file -> type , false ) ; $ this -> presenter -> sendResponse ( $ ... | Zobrazeni pouze souboru |
56,869 | private function getFiles ( ) : array { $ result = [ ] ; $ files = Finder :: find ( '*' ) -> in ( $ this -> getFullPath ( ) ) ; foreach ( $ files as $ file ) { $ result [ ] = new FileInfo ( $ file ) ; } usort ( $ result , function ( $ a , $ b ) { if ( $ a -> isDir == $ b -> isDir ) { return strcmp ( $ a -> name , $ b -... | Vrati polozky v adresari |
56,870 | private function getFileInfo ( string $ fileName , bool $ withSize = false ) : FileInfo { $ file = new SplFileInfo ( $ this -> getFullPath ( $ fileName ) ) ; return new FileInfo ( $ file , $ withSize ) ; } | Vrati informace o souboru nebo adresari |
56,871 | public function reverseTransform ( $ string ) { if ( $ string === null ) { return null ; } $ rClass = new \ ReflectionClass ( $ this -> specificationClass ) ; $ args = $ this -> constructorArgs ; array_unshift ( $ args , $ string ) ; return $ rClass -> newInstanceArgs ( $ args ) ; } | Transforms a string into a specification . |
56,872 | protected function doLoadMetadata ( $ metaType , $ key ) { if ( isset ( $ this -> arrayCache [ $ metaType ] [ $ key ] ) ) { return $ this -> arrayCache [ $ metaType ] [ $ key ] ; } $ path = $ this -> getFilePath ( $ metaType , $ key ) ; if ( null === $ path ) { return null ; } $ loadMethod = $ this -> getLoadMethod ( $... | Loads the metadata instance for a model or a mixin . |
56,873 | protected function getFilePath ( $ metaType , $ key ) { $ method = $ this -> getFindMethod ( $ metaType ) ; $ path = $ this -> fileLocator -> $ method ( $ key , $ this -> getExtension ( ) ) ; if ( null === $ path ) { throw MetadataException :: fatalDriverError ( $ key , sprintf ( 'No mapping file was found.' , $ path )... | Returns the file path for an entity type or mixin name . |
56,874 | public static function recursiveImplode ( $ glue , array $ array ) { $ return = '' ; $ index = 0 ; $ count = count ( $ array ) ; foreach ( $ array as $ piece ) { if ( is_array ( $ piece ) ) { $ return .= self :: recursiveImplode ( $ glue , $ piece ) ; } else { $ return .= $ piece ; } if ( $ index < $ count - 1 ) { $ re... | Return an imploded string from a multi dimensional array . |
56,875 | protected function getPreferredLanguage ( $ default = 'en-US' ) { $ acceptedLanguages = $ this -> getServerCollection ( ) -> get ( 'HTTP_ACCEPT_LANGUAGE' ) ; preg_match_all ( '/([a-z]{1,8}(-[a-z]{1,8})*)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i' , $ acceptedLanguages , $ lang_parse ) ; $ langs = $ lang_parse [ 1 ] ; $ ranks = ... | If default is set to null will return the whatever value was found |
56,876 | public function client ( $ id ) { if ( isset ( $ this -> clients [ $ id ] ) ) { return $ this -> clients [ $ id ] ; } return new Client ( $ this , $ id ) ; } | Creates an instance of client . |
56,877 | public function refresh ( Client $ client ) { $ clientId = $ client -> getId ( ) ; $ this -> clients [ $ clientId ] = $ client ; $ this -> removeClientForRequest ( $ clientId , $ client -> getPreviousRequest ( ) ) ; $ requestId = $ client -> getRequest ( ) ; if ( $ requestId !== null ) { if ( ! isset ( $ this -> reques... | Removes and re - adds the client to the bucket . This way the requests array does not get outdated and the clients are sorted by time . |
56,878 | public function remove ( Client $ client ) { $ clientId = $ client -> getId ( ) ; if ( ! isset ( $ this -> clients [ $ clientId ] ) ) { return $ this ; } $ requestId = $ client -> getRequest ( ) ; $ this -> removeClientForRequest ( $ clientId , $ requestId ) ; unset ( $ this -> clients [ $ clientId ] ) ; return $ this ... | Removes the client from the clients and the requests array . |
56,879 | public function get ( $ clientId ) { if ( ! isset ( $ this -> clients [ $ clientId ] ) ) { throw new \ RuntimeException ( 'Client with id ' . $ clientId . ' does not exist.' ) ; } return $ this -> clients [ $ clientId ] ; } | Gets a single client by id . |
56,880 | public function getExpired ( $ timeout ) { $ expired = array ( ) ; $ timeoutAt = microtime ( true ) - ( $ timeout / 1000 ) ; foreach ( $ this -> clients as $ client ) { if ( $ client -> getTime ( ) > $ timeoutAt ) { break ; } $ expired [ ] = $ client ; } return $ expired ; } | Gets all expired clients based on a timeout in microseconds . |
56,881 | public function add ( $ name , $ content = '' , $ http_equiv = false , $ condition = null ) { $ this -> __template -> registry -> addEntry ( array ( 'name' => $ name , 'content' => $ content , 'http-equiv' => $ http_equiv , 'condition' => $ condition ) , 'meta_tags' ) ; return $ this ; } | Add a meta tag in meta stack |
56,882 | public function set ( array $ tags ) { if ( ! empty ( $ tags ) ) { foreach ( $ tags as $ _tag ) { if ( is_array ( $ _tag ) && isset ( $ _tag [ 'name' ] ) && isset ( $ _tag [ 'content' ] ) ) { $ this -> add ( $ _tag [ 'name' ] , $ _tag [ 'content' ] , isset ( $ _tag [ 'http-equiv' ] ) && true === $ _tag [ 'http-equiv' ]... | Set a full array of tags |
56,883 | public static function script_runner ( $ script , $ args = null ) { if ( ! $ args ) $ args = array ( ) ; array_unshift ( $ args , $ script ) ; return array ( 'Jar' => 's3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar' , 'Args' => $ args ) ; } | Runs a specified script on the master node of your cluster . |
56,884 | public static function hive_pig_script ( $ type , $ args = null ) { if ( ! $ args ) $ args = array ( ) ; $ args = is_array ( $ args ) ? $ args : array ( $ args ) ; $ args = array_merge ( array ( '--base-path' , 's3://us-east-1.elasticmapreduce/libs/' . $ type . '/' ) , $ args ) ; return self :: script_runner ( 's3://us... | Prepares a Hive or Pig script before passing it to the script runner . |
56,885 | private function formatMessage ( $ level , $ message , $ context ) { $ level = strtoupper ( $ level ) ; if ( ! empty ( $ context ) ) { $ message .= PHP_EOL . $ this -> indent ( $ this -> contextToString ( $ context ) ) ; } return "[{$this->getTimestamp()}] [{$level}] {$message}" . PHP_EOL ; } | Formats the message for logging . |
56,886 | static public function getDefaultCacheHandler ( ) { if ( ! isset ( self :: $ defaultCacheHandler ) ) { global $ container ; if ( self :: BACKWORDS_COMPATIBLE && isset ( $ container ) && isset ( $ container [ 'memcache' ] ) ) { if ( class_exists ( "Memcache" ) && is_a ( $ container [ 'memcache' ] , "Memcache" ) ) { self... | Specify the default mechanism to use for fetching and retrieving tag values . |
56,887 | static public function getGlobalPrefix ( ) { if ( ! isset ( self :: $ globalPrefix ) ) { global $ container ; if ( self :: BACKWORDS_COMPATIBLE ) { if ( isset ( $ container ) && isset ( $ container [ 'memcachePrefix' ] ) ) { self :: $ globalPrefix = $ container [ 'memcachePrefix' ] ; } else { self :: $ globalPrefix = "... | Get the global prefix added to all keys by FragementedKeySystem . |
56,888 | public static function negate ( $ a ) { self :: assertInteger ( $ a ) ; if ( $ a === self :: MIN_INT ) { return $ a ; } return - $ a ; } | Returns the negation of the argument . |
56,889 | public static function add ( $ a , $ b ) { self :: assertInteger ( $ a ) ; self :: assertInteger ( $ b ) ; if ( ( $ b > 0 ) && ( $ a <= ( PHP_INT_MAX - $ b ) ) ) { return $ a + $ b ; } if ( ( $ b < 0 ) && ( $ a >= ( PHP_INT_MIN - $ b ) ) ) { return $ a + $ b ; } while ( $ b !== 0 ) { $ carry = $ a & $ b ; $ a ^= $ b ; ... | Returns the sum of the arguments . |
56,890 | public static function subtract ( $ a , $ b ) { self :: assertInteger ( $ a ) ; self :: assertInteger ( $ b ) ; return self :: add ( ( int ) $ a , self :: negate ( $ b ) ) ; } | Returns the difference of the arguments . |
56,891 | public static function multiply ( $ a , $ b ) { self :: assertInteger ( $ a ) ; self :: assertInteger ( $ b ) ; if ( $ a === 0 || $ b === 0 ) { return 0 ; } if ( $ a === self :: MIN_INT ) { return $ b & 0x01 ? $ a : 0 ; } if ( $ b === self :: MIN_INT ) { return $ a & 0x01 ? $ b : 0 ; } $ max = self :: MIN_INT ; if ( $ ... | Returns the product of the arguments . |
56,892 | public static function divide ( $ a , $ b ) { self :: assertInteger ( $ a ) ; self :: assertInteger ( $ b ) ; if ( 0 === $ b ) { throw new DivisionByZeroException ( 'Division by zero.' ) ; } if ( $ a === self :: MIN_INT && $ b === - 1 ) { return $ a ; } return ( $ a - ( $ a % $ b ) ) / $ b ; } | Returns the quotient of the arguments . |
56,893 | private static function identify ( $ value ) { if ( ! is_numeric ( $ value ) || ! is_float ( $ value ) ) { return gettype ( $ value ) ; } if ( is_infinite ( $ value ) ) { return $ value < 0 ? '-INF' : 'INF' ; } if ( is_nan ( $ value ) ) { return 'NAN' ; } return 'float' ; } | Returns a string that identifies the specified value . |
56,894 | protected function skipIfEnvVarIsAlreadyInstalled ( $ env_var ) { if ( fp_env ( $ env_var , null ) != null ) { $ this -> info ( "The environment variable $env_var already exists in your environment (check .env file)." ) ; $ this -> info ( "Please remove the $env_var an re-execute command. Skipping..." ) ; die ( ) ; } } | Skip if token is already installed . |
56,895 | public function download ( $ fileClass , $ q ) { try { $ file = $ this -> handlers [ $ fileClass ] -> __invoke ( new FileOfIdQuery ( $ q ) ) ; $ filename = $ file [ 'file_name' ] ; } catch ( FileDoesNotExistException $ exception ) { $ filename = $ q ; } return $ this -> urlGenerator -> generate ( 'bengor_file_' . $ fil... | Generates the url that returns the file of given file type and file . |
56,896 | public function preview ( $ file_name ) { if ( ! \ Entrust :: can ( 'preview-logs' ) ) { abort ( 403 , 'Unauthorized access - you do not have the necessary permission to preview logs.' ) ; } $ disk = Storage :: disk ( 'local' ) ; if ( $ disk -> exists ( 'logs/' . $ file_name ) ) { $ this -> data [ 'log' ] = [ 'file_pat... | Previews a log file . |
56,897 | public function download ( $ file_name ) { if ( ! \ Entrust :: can ( 'download-logs' ) ) { abort ( 403 , 'Unauthorized access - you do not have the necessary permission to download logs.' ) ; } $ disk = Storage :: disk ( 'local' ) ; if ( $ disk -> exists ( 'logs/' . $ file_name ) ) { return response ( ) -> download ( s... | Downloads a log file . |
56,898 | protected function makeOptionsDDL ( array $ options ) { $ escapedOptions = [ ] ; foreach ( $ options as $ option ) { $ escapedOptions [ ] = $ this -> quote ( ( string ) $ option ) ; } return implode ( ',' , $ escapedOptions ) ; } | Make just the portion of the DDL that describes the options |
56,899 | function activate ( ) { if ( ! defined ( 'WP_DEBUG' ) || ! WP_DEBUG ) return ; activate_plugin ( 'debug-bar/debug-bar.php' , null , is_multisite ( ) ) ; activate_plugin ( 'debug-bar-slow-actions/debug-bar-slow-actions.php' , null , is_multisite ( ) ) ; activate_plugin ( 'kint-debugger/Kint.class.php' , null , is_multis... | Activate debug tools |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.