idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
16,600 | public function sendNewTaskEmailMessage ( Task $ task , UserInterface $ createUser , UserInterface $ assignUser , TypeInterface $ type ) { $ template = $ this -> parameters [ 'new_task' ] [ 'template' ] ; $ from = $ this -> parameters [ 'new_task' ] [ 'from_email' ] ; $ text = $ type -> getText ( $ task ) ; $ url = $ t... | Send a new task email . |
16,601 | public function sendUpdateEmailMessage ( Task $ task , UserInterface $ byUser , array $ involvedUsers , array $ changes , TypeInterface $ type ) { $ template = $ this -> parameters [ 'update' ] [ 'template' ] ; $ from = $ this -> parameters [ 'update' ] [ 'from_email' ] ; $ text = $ type -> getText ( $ task ) ; $ url =... | Send an update email . |
16,602 | public function rollBack ( ) { if ( $ this -> _transactionDepth == 0 ) { throw new PDOException ( 'Rollback error : There is no transaction started' ) ; } $ this -> _transactionDepth -- ; if ( $ this -> _transactionDepth == 0 ) { parent :: rollBack ( ) ; } else { $ this -> exec ( "ROLLBACK TO SAVEPOINT LEVEL{$this->_tr... | Rollback current transaction |
16,603 | public function publish ( $ name ) { if ( $ name instanceof Component ) { $ component = $ name ; } else { $ component = $ this -> laravel [ 'components' ] -> findOrFail ( $ name ) ; } with ( new AssetPublisher ( $ component ) ) -> setRepository ( $ this -> laravel [ 'components' ] ) -> setConsole ( $ this ) -> publish ... | Publish assets from the specified component . |
16,604 | public static function Pn ( array $ p , & $ r , array & $ u ) { $ w ; $ w = static :: Pm ( $ p ) ; if ( $ w == 0.0 ) { static :: Zp ( $ u ) ; } else { static :: Sxp ( 1.0 / $ w , $ p , $ u ) ; } $ r = $ w ; return ; } | - - - - - - i a u P n - - - - - - |
16,605 | protected function getServiceIp ( string $ serviceName , bool $ force = false ) : string { if ( ! isset ( $ this -> serviceIps [ $ serviceName ] ) || $ force ) { $ serviceIp = $ this -> discovery -> discover ( $ serviceName ) ; $ this -> serviceIps [ $ serviceName ] = $ serviceIp ; } return $ this -> serviceIps [ $ ser... | Get service IP from service discovery |
16,606 | private static function setByDotNotation ( $ dots , $ value , $ scalar = true ) { if ( $ dots == null ) { static :: $ store = $ value ; } $ exploded = explode ( '.' , $ dots ) ; $ valuePointer = & static :: $ store ; $ length = count ( $ exploded ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ key = $ exploded [ $ i ... | Sets a value in the data - store by dot notation . |
16,607 | public function delete ( $ key ) { if ( $ this -> has ( $ key ) ) { unset ( $ this -> collection [ $ this -> id_info ] [ $ key ] ) ; unset ( $ this -> collection [ $ this -> id ] [ $ key ] ) ; return true ; } return false ; } | Entfernt den gesetzten Wert sofern er bereits vorhanden ist . |
16,608 | public function load ( $ tmpFile , $ folderPath = false ) { if ( ! $ folderPath ) $ folderPath = Config :: inst ( ) -> get ( 'Upload' , 'uploads_folder' ) ; $ base = Director :: baseFolder ( ) ; $ parentFolder = Folder :: find_or_make ( $ folderPath ) ; $ fileArray = explode ( '/' , $ tmpFile ) ; $ fileName = $ fileArr... | Save an file passed from a form post into this object . |
16,609 | public function getCloudURL ( ) { if ( $ CloudUrl = Config :: inst ( ) -> get ( 'ExtendedFile' , 'cloud_url' ) ) return $ CloudUrl . $ this -> owner -> getURL ( ) ; else return $ this -> owner -> getAbsoluteURL ( ) ; } | Gets the Cloud URL accessible through the web . |
16,610 | public function init ( $ moduleManager ) { $ event = $ moduleManager -> getEvent ( ) ; $ container = $ event -> getParam ( 'ServiceManager' ) ; $ serviceListener = $ container -> get ( 'ServiceListener' ) ; $ serviceListener -> addServiceManager ( 'FilterManager' , 'filters' , 'Zend\ModuleManager\Feature\FilterProvider... | Register a specification for the FilterManager with the ServiceListener . |
16,611 | public function generate ( ) : string { $ elements = [ ] ; if ( $ this -> label != '' ) { $ elements [ ] = Tags :: legend ( $ this -> label , [ ] ) ; } foreach ( $ this -> elements as $ element ) { $ elements [ ] = $ element -> generate ( ) ; } return Tags :: fieldset ( $ elements , $ this -> attributes ) ; } | Generates from fieldset and returns it |
16,612 | public function process ( \ Controller $ controller , $ result = null ) { if ( $ controller -> getRequest ( ) -> isAjax ( ) ) { $ response = $ controller -> getResponse ( ) ; $ response -> setStatusCode ( 200 ) ; if ( is_array ( $ result ) ) { $ response -> addHeader ( 'Content-Type' , 'application/json' ) ; $ response... | Method used to determine how to handle the output based on the InputProcessor s result |
16,613 | public static function sortByCol ( array & $ array , $ column , $ sort = SORT_STRING , $ direction = SORT_ASC ) { if ( ! sizeof ( $ array ) ) { return ; } $ index = [ ] ; $ i = 0 ; foreach ( $ array as $ key => $ row ) { if ( is_array ( $ row ) ) { $ index [ 'pos' ] [ $ i ] = $ key ; $ index [ 'name' ] [ $ i ] = $ row ... | Sort two - dimensional array by column preserving row keys . |
16,614 | protected function typecastValue ( $ value , $ type ) { if ( is_scalar ( $ type ) ) { if ( is_object ( $ value ) && method_exists ( $ value , '__toString' ) ) { $ value = $ value -> __toString ( ) ; } switch ( $ type ) { case self :: TYPE_INTEGER : return ( int ) $ value ; case self :: TYPE_FLOAT : return ( float ) $ v... | Casts the given value to the specified type . |
16,615 | public function buildForm ( FormBuilderInterface $ builder , array $ options ) { $ entityTransformer = new $ options [ 'transformer' ] ( $ this -> om , $ options [ 'class' ] ) ; $ builder -> addModelTransformer ( $ entityTransformer ) ; } | Add the data transformer to the field setting the entity repository |
16,616 | private function _build_items ( array $ items ) { foreach ( $ items as $ key => $ item ) { $ this -> _items [ $ key ] = new Element_Item ( $ item , $ this , $ key ) ; } return $ this ; } | Transform Element items from an array to objects |
16,617 | protected static function _get_element_config ( $ config ) { if ( Kohana :: find_file ( 'config' . DIRECTORY_SEPARATOR . self :: CONFIG_DIR , $ config ) === FALSE ) { throw new Kohana_Exception ( 'Element configuration file ":path" not found!' , [ ':path' => APPPATH . 'config' . DIRECTORY_SEPARATOR . self :: CONFIG_DIR... | Read Element configuration file |
16,618 | public static function factory ( $ config_file = 'bootstrap' ) { if ( is_a ( $ config_file , 'Config_Group' ) ) { $ config_file -> set ( 'cfg_name' , $ config_file -> group_name ( ) ) ; $ element_config = $ config_file -> as_array ( ) ; } else { $ element_config = self :: _get_element_config ( $ config_file ) ; $ eleme... | Instantiate a new Element |
16,619 | public function render ( $ driver = 'Menu' , $ tpl = null , $ active_recursive = false ) { if ( $ this -> _active_item_index === NULL ) { $ this -> set_current ( Route :: name ( Request :: $ initial -> route ( ) ) , $ active_recursive ) ; } return Kohana_Element_Render :: factory ( $ driver , $ this , $ tpl ) -> render... | Render the Element into HTML |
16,620 | public function get_visible_items ( ) { if ( $ this -> _items === NULL ) { return array ( ) ; } $ visible_items = [ ] ; foreach ( $ this -> _items as $ key => $ item ) { if ( ! $ item -> is_visible ( ) ) { continue ; } $ visible_items [ $ key ] = $ item ; } return $ visible_items ; } | Get only visible Element items |
16,621 | public function get_item ( $ id ) { if ( count ( $ this -> _items ) === 0 ) return FALSE ; if ( array_key_exists ( $ id , $ this -> _items ) ) { return $ this -> _items [ $ id ] ; } else { $ path = $ this -> get_tree_index ( Route :: get ( $ id ) ) ; if ( $ path != false ) { $ levels = count ( $ path ) ; $ item = $ thi... | Get an instance of Element_Item based on its ID |
16,622 | public function get_tree_index ( Route $ route ) { $ name = Route :: name ( $ route ) ; if ( isset ( $ this -> routes [ $ name ] ) ) return explode ( '.' , $ this -> routes [ $ name ] ) ; return false ; } | Return an array to traverse to possibly get sibling items based on a given route |
16,623 | public static function rebuildClientServiceProxy ( Event $ event ) { $ io = $ event -> getIO ( ) ; $ extra = $ event -> getComposer ( ) -> getPackage ( ) -> getExtra ( ) ; if ( isset ( $ extra [ "initially-rpc-config-file" ] ) ) { $ rootDir = getcwd ( ) ; $ configFile = $ rootDir . "/" . $ extra [ "initially-rpc-config... | Rebuild client service proxy |
16,624 | protected function getMongoDocumentData ( $ name ) { if ( array_key_exists ( $ name , $ this -> document ) ) { return $ this -> document [ $ name ] ; } return null ; } | Gets data from the document |
16,625 | public static function getVersion ( string $ phrase , string $ ua ) : string { $ version = static :: getVersionPattern ( $ phrase ) ; $ uaString = str_replace ( ' NT' , '' , $ ua ) ; if ( preg_match ( $ version , $ uaString ) ) { preg_match ( $ version , $ uaString , $ v ) ; $ version = $ v [ 0 ] ; $ version = preg_rep... | Return version from UA string |
16,626 | public static function getWindowsVersion ( string $ version ) { $ config = static :: $ windowsConfig ; return \ array_key_exists ( $ version , $ config ) ? $ config [ $ version ] : $ version ; } | Return windows version |
16,627 | public static function runSetter ( & $ object , string $ key , $ value ) { $ methodName = static :: getMethodName ( $ key ) ; if ( method_exists ( $ object , $ methodName ) ) { $ object -> $ methodName ( $ value ) ; } } | Execute setter method |
16,628 | public static function resolvePath ( array & $ files , $ path ) { if ( is_array ( $ path ) ) { $ files = \ array_merge ( $ files , $ path ) ; } else { $ files [ ] = $ path ; } return \ array_unique ( $ files ) ; } | Add path to list |
16,629 | public function map ( callable $ converter ) { return new Enumerator ( function ( ) use ( $ converter ) { foreach ( $ this -> each ( ) as $ k => $ v ) { $ v = call_user_func ( $ converter , $ v , $ k ) ; yield $ k => $ v ; } } ) ; } | Return Enumerator which convert values |
16,630 | public function mapKeyValue ( callable $ converter ) { return new Enumerator ( function ( ) use ( $ converter ) { foreach ( $ this -> each ( ) as $ k => $ v ) { $ r = call_user_func ( $ converter , $ k , $ v ) ; yield key ( $ r ) => current ( $ r ) ; } } ) ; } | Return Enumerator which convert keys and values |
16,631 | public function transpose ( ) { return new Enumerator ( function ( ) { $ ret = [ ] ; foreach ( $ this -> each ( ) as $ row ) { foreach ( $ row as $ k => $ col ) { $ ret [ $ k ] [ ] = $ col ; } } foreach ( $ ret as $ k => $ r ) { yield $ k => $ r ; } } ) ; } | Return Enumerator which returns transposed Array |
16,632 | public function flatten ( ) { return new Enumerator ( function ( ) { foreach ( $ this -> each ( ) as $ k => $ v ) { if ( ( $ v instanceof \ Traversable ) || is_array ( $ v ) ) { yield $ k => Enumerator :: from ( $ v ) -> flatten ( ) ; } else { yield $ k => $ v ; } } } ) ; } | Return Enumerator which flatten values |
16,633 | public function unique ( callable $ func = null ) { return new Enumerator ( function ( ) use ( $ func ) { $ exists = [ ] ; foreach ( $ this -> each ( ) as $ k => $ v ) { $ comp = $ func ? $ func ( $ v ) : $ v ; if ( ! in_array ( $ comp , $ exists , true ) ) { $ exists [ ] = $ comp ; yield $ k => $ v ; } } } ) ; } | Return Enumerator which returns unique values |
16,634 | public function groupBy ( callable $ func ) { $ result = [ ] ; foreach ( $ this -> each ( ) as $ k => $ v ) { $ this -> _groupBy ( $ result , $ k , $ v , $ func ) ; } return $ result ; } | Return an array which aggregated by func |
16,635 | private function _groupBy ( & $ result , $ k , $ v , $ func ) { if ( $ v instanceof self ) { foreach ( $ v -> each ( ) as $ kk => $ vv ) { $ this -> _groupBy ( $ result , $ kk , $ vv , $ func ) ; } } else { $ aggregate_key = call_user_func ( $ func , $ v , $ k ) ; $ result [ $ aggregate_key ] [ ] = $ v ; } } | call by groupBy method |
16,636 | private function _toArray ( & $ result , $ k , $ v ) { if ( $ v instanceof self ) { foreach ( $ v -> each ( ) as $ kk => $ vv ) { $ this -> _toArray ( $ result , $ kk , $ vv ) ; } } else { $ result [ $ k ] = $ v ; } } | call by toArray method |
16,637 | private function _toArrayValues ( & $ result , $ v ) { if ( $ v instanceof self ) { foreach ( $ v -> each ( ) as $ vv ) { $ this -> _toArrayValues ( $ result , $ vv ) ; } } else { $ result [ ] = $ v ; } } | call by toArrayValues method |
16,638 | public static function filename ( $ filePath , array $ options = [ ] ) { extract ( static :: FilePathProperties ( $ filePath ) ) ; $ options = static :: ExtendOptions ( $ options ) ; $ stringOptions = static :: BuildPathOptions ( $ options ) ; return sprintf ( '%s/%s%s.%s' , $ dirname , $ filename , $ stringOptions , $... | Add string options to filename based on options |
16,639 | public static function ExtendOptions ( array $ options = [ ] ) { $ options = array_merge ( [ 'width' => null , 'height' => null , 'focusX' => 0 , 'focusY' => 0 , 'resize' => false , ] , $ options ) ; $ options [ 'width' ] = $ options [ 'width' ] ? : '_' ; $ options [ 'height' ] = $ options [ 'height' ] ? : '_' ; return... | Extend and prepare options |
16,640 | public static function couchDbClient ( $ options = array ( ) ) { $ _key = Option :: get ( $ options , 'host' , 'localhost' ) . ':' . Option :: get ( $ options , 'port' , 5984 ) ; if ( ! isset ( self :: $ _clients [ $ _key ] ) ) { self :: $ _clients [ $ _key ] = \ Doctrine \ CouchDB \ CouchDBClient :: create ( $ options... | Construct and returns a CouchDBClient |
16,641 | public static function documentManager ( $ options = array ( ) ) { $ _key = Option :: get ( $ options , 'host' , 'localhost' ) . ':' . Option :: get ( $ options , 'port' , 5984 ) ; if ( ! isset ( self :: $ _dms [ $ _key ] ) ) { self :: $ _dms [ $ _key ] = \ Doctrine \ ODM \ CouchDB \ DocumentManager :: create ( Option ... | Constructs and sets all options at once . |
16,642 | private function isTemplateDefinition ( Stream $ stream ) { if ( $ stream -> current ( ) -> equals ( Token :: TYPE_KEYWORD , 'template' ) ) { return true ; } if ( ! $ stream -> current ( ) -> equals ( Token :: TYPE_KEYWORD , 'export' ) ) { return false ; } if ( $ stream -> peek ( ) -> equals ( Token :: TYPE_KEYWORD , '... | Checks whether the current token stream is about to define a template . |
16,643 | public function getStatusAsString ( $ status ) { $ options = self :: getStatusOptions ( ) ; return isset ( $ options [ $ status ] ) ? $ options [ $ status ] : '' ; } | Returns a string representation of the model s categories |
16,644 | public function ckeditorAction ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ funcNumber = $ request -> get ( 'CKEditorFuncNum' ) ; if ( $ file = $ request -> files -> get ( 'upload' ) ) { $ supportedTypes = array ( 'image/jpeg' , 'image/png' ) ; if ( $ file -> getSize ( ) > static :: FI... | Handles ckeditor uploads |
16,645 | public static function getComposerJsonFileAndManipulator ( ) : array { $ json = new JsonFile ( Factory :: getComposerFile ( ) ) ; $ manipulator = new JsonManipulator ( \ file_get_contents ( $ json -> getPath ( ) ) ) ; return [ $ json , $ manipulator ] ; } | Return the composer json file and json manipulator . |
16,646 | public function end ( ) { if ( $ this -> getCounter ( ) === 0 ) { throw new \ RuntimeException ( "The section {$this->name} already closed." ) ; } $ this -> appendContent ( ob_get_clean ( ) ) ; $ this -> counter -- ; $ this -> closed = $ this -> isClosed ( ) ; } | Close the output buffer capturing |
16,647 | public static function exec ( $ sql ) { exception_if ( self :: $ server == 'out' , AppSetupException :: class ) ; self :: $ server -> exec ( $ sql ) ; return true ; } | run SQL query . |
16,648 | public static function read ( $ sql , $ mode = self :: KEY ) { $ vals = [ ] ; $ result = self :: query ( $ sql ) ; while ( $ row = $ result -> fetch ( $ mode ) ) { $ vals [ ] = $ row ; } return $ vals ; } | get data by SQL query . |
16,649 | public static function query ( $ sql ) { exception_if ( self :: $ server == 'out' , AppSetupException :: class ) ; return self :: $ server -> query ( $ sql ) ; } | execute SQL query . |
16,650 | public static function count ( $ sql ) { $ data = self :: query ( $ sql ) ; $ result = $ data -> fetchAll ( PDO :: FETCH_ASSOC ) ; return $ result ? count ( $ result ) : - 1 ; } | get number of rows of SQL query . |
16,651 | public static function exists ( $ name ) { $ application = Application :: get ( ) ; if ( ! in_array ( $ name , self :: $ definable_hooks ) ) { return false ; } if ( file_exists ( $ application -> path . '/config/Hook.php' ) ) { require_once $ application -> path . '/config/Hook.php' ; $ classname = 'Hook_' . ucfirst ( ... | Check if a hook exists in the current application |
16,652 | public static function call ( $ name , $ arguments = [ ] ) { if ( self :: exists ( $ name ) ) { $ application = Application :: get ( ) ; $ classname = 'Hook_' . ucfirst ( $ application -> name ) ; call_user_func_array ( [ $ classname , $ name ] , $ arguments ) ; } else { throw new \ Exception ( 'Hook is not defined' ) ... | Call a hook |
16,653 | public static function call_if_exists ( $ name , $ arguments = [ ] ) { if ( self :: exists ( $ name ) ) { $ application = Application :: get ( ) ; $ classname = 'Hook_' . ucfirst ( $ application -> name ) ; call_user_func_array ( [ $ classname , $ name ] , $ arguments ) ; } } | Call a hook if it exists fail silently if not |
16,654 | protected function getLogPath ( ) : string { if ( ! $ this -> logPath ) { $ className = str_replace ( '\\' , '' , get_class ( $ this ) ) ; $ filename = strtolower ( preg_replace ( [ '/([a-z\d])([A-Z])/' , '/([^_])([A-Z][a-z])/' ] , '$1_$2' , $ className ) ) . '.log' ; $ this -> logPath = $ this -> logsDir . '/' . $ fil... | Returns the log filename . |
16,655 | protected function getScope ( ) { if ( $ this -> annotation -> getScope ( ) instanceof AbstractResourceFile ) { return $ this -> annotation -> getScope ( ) ; } else { throw new \ Chigi \ Chiji \ Exception \ InvalidConfigException ( "Invalid Annotation interface resource." ) ; } } | Get the scope of the resource file object |
16,656 | public function setValue ( string $ value = null ) : Element { $ this -> value = $ value ; if ( isset ( $ this -> model ) ) { $ this -> model -> { $ this -> attributes [ 'name' ] } = $ value ; } return $ this ; } | Sets the current value of this element . |
16,657 | public static function fromBinaryString ( string $ bytes , bool $ twosc = false ) : math \ interfaces \ BigInt { $ sign = '' ; $ bNegative = $ twosc && ( ord ( $ bytes [ 0 ] ) & 0x80 ) ; if ( $ bNegative ) { $ bytes = ~ $ bytes ; $ sign = '-' ; } $ result = gmp_init ( $ sign . bin2hex ( $ bytes ) , 16 ) ; if ( $ bNegat... | Converts the binary string represented number into a BigInt instance representing the number in decimal format . |
16,658 | public static function fromString ( string $ number , $ base = null ) { $ sign = 0 === strpos ( $ number , '-' ) ? '-' : '' ; $ number = ltrim ( $ number , '-+' ) ; if ( null === $ base ) { if ( preg_match ( '#^(?:([1-9])\.)?([0-9]+)[eE]\+?([0-9]+)$#' , $ number , $ matches ) ) { if ( ! empty ( $ matches [ 1 ] ) ) { if... | Converts the arbitrary string represented number into a BigInt instance representing the number in decimal format . |
16,659 | protected function changeIdentity ( ) { $ uid = ( int ) $ this -> get ( 'application_uid' , 0 ) ; $ gid = ( int ) $ this -> get ( 'application_gid' , 0 ) ; $ file = $ this -> get ( 'application_pid_file' ) ; if ( $ uid && ( fileowner ( $ file ) != $ uid ) && ( ! @ chown ( $ file , $ uid ) ) ) { $ this -> getLogger ( ) ... | Method to change the identity of the daemon process and resources . |
16,660 | private function prepareAssetManager ( AssetFactory $ af , \ Twig_Environment $ twig , array $ templates ) { $ am = new LazyAssetManager ( $ af ) ; $ am -> setLoader ( 'twig' , new TwigFormulaLoader ( $ twig ) ) ; foreach ( $ templates as $ template ) { $ resource = new TwigResource ( $ twig -> getLoader ( ) , $ templa... | Prepare the LazyAssetManager |
16,661 | private function getTemplateDirs ( $ kernel ) { $ dirs = [ ] ; $ dirs [ 'core' ] = $ kernel -> getRootDir ( ) . '/views' ; foreach ( $ kernel -> getModules ( ) as $ module ) { $ dirs [ $ module -> getName ( ) ] = $ module -> getRootDir ( ) . '/module/views' ; } return $ dirs ; } | Get all standard template directories . |
16,662 | protected function findTemplates ( array $ dirs , OutputInterface $ output ) { $ filesystem = new FileSystem ( ) ; $ templates = [ ] ; foreach ( $ dirs as $ name => $ dir ) { $ output -> write ( sprintf ( 'Finding templates in "%s"' , $ name ) ) ; try { if ( $ filesystem -> exists ( $ dir ) ) { $ finder = new Finder ( ... | Find templates . Outputs status . |
16,663 | public static function create ( Event $ event ) : EventMessage { $ timestamp = DateTime :: now ( ) ; $ id = MessageId :: generate ( ) ; $ metaData = MetaData :: create ( ) ; return new static ( $ id , $ timestamp , $ event , $ metaData ) ; } | Creates instance for an event |
16,664 | protected function isValidToken ( $ text ) { if ( ! is_string ( $ text ) ) { throw new InvalidArgumentException ( '$text must be string' ) ; } $ separators = [ '(' , ')' , '<' , '>' , '@' , ',' , ';' , ':' , '\\' , '"' , '/' , '[' , ']' , '?' , '=' , '{' , '}' , 32 , 9 ] ; foreach ( $ separators as $ s ) { if ( strpos ... | Check if text is valid token |
16,665 | protected function checkAccessControlRequestHeaders ( array $ accessControlRequestHeaders ) { foreach ( $ accessControlRequestHeaders as $ h ) { if ( ! is_string ( $ h ) || $ h === '' ) { return false ; } } return true ; } | Check if Access - Control - Request - Headers is valid Section 5 . 9 |
16,666 | protected function isMethodAllowed ( $ method ) { if ( ! is_string ( $ method ) ) { throw new InvalidArgumentException ( '$method must be string' ) ; } if ( $ this -> isSimpleMethod ( $ method ) ) { return true ; } return in_array ( $ method , $ this -> config [ 'allowMethods' ] , true ) ; } | Check if request method is allowed |
16,667 | protected function isHeadersAllowed ( array $ headers ) { $ headers = array_udiff ( $ headers , $ this -> simpleHeaders , 'strcasecmp' ) ; return array_udiff ( $ headers , $ this -> config [ 'allowHeaders' ] , 'strcasecmp' ) === [ ] ; } | Check if ALL request headers are allowed |
16,668 | public static function remove ( array & $ array , $ needle , $ strict = false , $ preserve_keys = false ) { $ removed = 0 ; if ( $ keys = array_keys ( $ array , $ needle , $ strict ) ) { foreach ( $ keys as $ key ) { unset ( $ array [ $ key ] ) ; } if ( ! $ preserve_keys ) { $ array = array_values ( $ array ) ; } $ rem... | Removes zero or more elements from an array |
16,669 | public static function columnFilter ( array $ array , $ column , $ callback ) { foreach ( $ array as $ key => $ value ) { if ( ! $ callback ( $ value , $ key ) ) { unset ( $ array [ $ key ] ) ; } } return self :: column ( $ array , $ column ) ; } | Filters columns of an array using a callback function |
16,670 | public static function join ( array $ array , $ separator = self :: DEFAULT_SEPARATOR , callable $ callback = null ) { self :: swapCallable ( $ separator , $ callback , self :: DEFAULT_SEPARATOR ) ; if ( null !== $ callback ) { $ array = array_map ( $ callback , $ array ) ; } return join ( $ separator , $ array ) ; } | Joins the elements of an array using an optional callback |
16,671 | public static function conjunct ( array $ array , $ conjunction = self :: DEFAULT_CONJUNCTION , callable $ callback = null ) { self :: swapCallable ( $ conjunction , $ callback , self :: DEFAULT_CONJUNCTION , false ) ; if ( null !== $ callback ) { $ array = array_map ( $ callback , $ array ) ; } if ( count ( $ array ) ... | Joins an array of values with a final conjunction |
16,672 | public static function findString ( array $ array , $ needle , $ reverse = false ) { if ( ! is_scalar ( $ needle ) && null !== $ needle ) { trigger_error ( "Non-scalar search value; cannot cast to a string." , E_USER_WARNING ) ; } if ( $ reverse ) { $ array = array_reverse ( $ array , true ) ; } return array_search ( s... | Finds the first or last occurrence of a string within an array |
16,673 | public function ensureDir ( $ dir_name ) { if ( is_dir ( $ dir_name ) || @ mkdir ( $ dir_name ) ) { return true ; } else { $ parent_dir = dirname ( $ dir_name ) ; if ( $ parent_dir == $ dir_name ) { return true ; } return ( Auth_OpenID :: ensureDir ( $ parent_dir ) && @ mkdir ( $ dir_name ) ) ; } } | Create dir_name as a directory if it does not exist . If it exists make sure that it is in fact a directory . Returns true if the operation succeeded ; false if not . |
16,674 | public function addPrefix ( $ values , $ prefix ) { $ new_values = array ( ) ; foreach ( $ values as $ s ) { $ new_values [ ] = $ prefix . $ s ; } return $ new_values ; } | Adds a string prefix to all values of an array . Returns a new array containing the prefixed values . |
16,675 | public function toBytes ( $ str ) { $ hex = bin2hex ( $ str ) ; if ( ! $ hex ) { return array ( ) ; } $ b = array ( ) ; for ( $ i = 0 ; $ i < strlen ( $ hex ) ; $ i += 2 ) { $ b [ ] = chr ( base_convert ( substr ( $ hex , $ i , 2 ) , 16 , 10 ) ) ; } return $ b ; } | Get the bytes in a string independently of multibyte support conditions . |
16,676 | public function getLogger ( OutputInterface $ output ) { if ( $ this -> logger === null ) { $ this -> logger = new ConsoleLogger ( $ output ) ; } return $ this -> logger ; } | Get or create a logger |
16,677 | public function mediables ( ) { return $ this -> morphToMany ( config ( 'media.model' , \ Routegroup \ Media \ File :: class ) , 'mediables' , null , null , 'media_id' ) -> withTimestamps ( ) ; } | Model for image . |
16,678 | public function resolveMediableValue ( $ value ) { if ( $ value instanceof UploadedFile ) { $ value = Media :: store ( $ value ) ; } if ( $ value instanceof Model ) { $ value = $ value -> id ; } if ( $ value ) { $ value = is_array ( $ value ) ? $ value : [ $ value ] ; } else { $ value = $ this -> exists ? [ ] : null ; ... | Resolve value of given model . |
16,679 | public function scaffoldSearchFields ( $ _params = null ) { $ fields = parent :: scaffoldSearchFields ( $ _params ) ; if ( ! $ fields -> dataFieldByName ( 'ClassNameNice' ) ) { $ classMap = ClassInfo :: subclassesFor ( 'KapostObject' ) ; unset ( $ classMap [ 'KapostObject' ] ) ; foreach ( $ classMap as $ key => $ value... | Ensures the content type appears in the searchable fields |
16,680 | protected function validate ( ) { $ validator = parent :: validate ( ) ; $ kapostID = $ this -> KapostRefID ; if ( empty ( $ kapostID ) ) { $ validator -> error ( _t ( 'KapostObject.MISSING_KAPOST_ID' , '_Kapost Reference ID is missing' ) , 'missing-kapost-id' ) ; } return $ validator ; } | Validates the current object invalid objects will not be written . By default all Kapost objects are valid if they have a value in the KapostRefID |
16,681 | protected function onBeforeWrite ( ) { parent :: onBeforeWrite ( ) ; $ title = $ this -> Title ; if ( empty ( $ title ) ) { $ this -> Title = $ this -> i18n_singular_name ( ) . ': ' . $ this -> KapostRefID ; } } | Ensures a title is present for the Kapost Object before writing |
16,682 | public function execQuery ( $ query , $ valArr = array ( ) , $ queryType = self :: SELECT ) { return $ this -> exec ( $ this -> bindValues ( $ this -> prepare ( $ query ) , $ valArr ) , $ queryType ) ; } | execQuery Wrapper method which prepares the query binds values and executes it |
16,683 | public function beginTransaction ( ) { if ( $ this -> getConnection ( ) -> inTransaction ( ) ) throw new \ Exception ( "Already inside a DB transaction. You need to commit it before beginning a new one." ) ; try { $ this -> getConnection ( false ) -> beginTransaction ( ) ; } catch ( Exception $ _e ) { throw new \ Excep... | beginTransaction Begin database transaction |
16,684 | public function commitTransaction ( ) { if ( ! $ this -> getConnection ( false ) -> inTransaction ( ) ) throw new \ Exception ( "Not inside a DB transaction. Cannot commit." ) ; try { $ this -> getConnection ( false ) -> commit ( ) ; } catch ( Exception $ _e ) { throw new \ Exception ( "Error while committing DB transa... | commitTransaction Commit begun database transaction |
16,685 | public function rollBackTransaction ( ) { if ( ! $ this -> getConnection ( false ) -> inTransaction ( ) ) throw new \ Exception ( "Not inside a DB transaction. Cannot commit." ) ; try { $ this -> getConnection ( false ) -> rollBack ( ) ; } catch ( Exception $ _e ) { throw new \ Exception ( "Error while rolling back DB ... | rollBackTransaction Rollback begun database transaction |
16,686 | protected function prepare ( $ sql ) { $ this -> checkConnection ( ) ; $ sqlKey = md5 ( $ sql ) ; if ( $ this -> _statementCache -> exists ( $ sqlKey ) ) return $ this -> _statementCache -> get ( $ sqlKey ) ; try { $ statement = $ this -> getConnection ( false ) -> prepare ( $ sql ) ; } catch ( \ PDOException $ pe ) { ... | prepare Prepare query from sql query |
16,687 | protected function bindValues ( \ PDOStatement $ statement , $ valArr = array ( ) ) { if ( empty ( $ valArr ) ) return $ statement ; $ type1 = false ; if ( isset ( $ valArr [ 0 ] ) && is_array ( $ valArr [ 0 ] ) && isset ( $ valArr [ 0 ] [ 0 ] ) && isset ( $ valArr [ 0 ] [ 1 ] ) ) $ type1 = true ; foreach ( $ valArr as... | bindValues Bind values to a prepared statement |
16,688 | protected function exec ( \ PDOStatement $ statement , $ type = self :: SELECT ) { try { $ statement -> execute ( ) ; } catch ( \ PDOException $ pe ) { $ statement -> closeCursor ( ) ; throw new \ Exception ( "Error while executing query:: sql: " . $ statement -> queryString . PHP_EOL . "Message: " . $ pe -> getMessage... | exec Execute prepared statement on this database reconnects to DB if connection does not exist |
16,689 | private function _connect ( ) { if ( empty ( $ this -> _config ) ) throw new \ Exception ( 'Empty connection settings provided' ) ; $ port = $ this -> _config -> getPort ( ) ; $ port = ! empty ( $ port ) ? $ port : 3306 ; $ dsn = $ this -> _config -> getType ( ) . ':host=' . $ this -> _config -> getHost ( ) . ';port=' ... | _connect Make the PDO connection |
16,690 | public function checkConnection ( ) { try { $ st = $ this -> _conn -> query ( "SELECT 1" ) ; } catch ( \ PDOException $ pe ) { if ( ( strcasecmp ( $ pe -> getCode ( ) , 'HY000' ) !== 0 ) && ! stristr ( $ pe -> getMessage ( ) , 'server has gone away' ) ) throw $ pe ; if ( function_exists ( 'xdebug_start_trace' ) ) xdebu... | _checkConnection Checks if the PDO connection is active |
16,691 | public static function fromArray ( array $ data ) { $ ret = new FormOptions ( ) ; foreach ( $ data as $ value => $ text ) { $ ret -> add ( $ value , $ text ) ; } return $ ret ; } | Get options from assoc array . |
16,692 | static public function fromArrayCallback ( array $ data , callable $ callback ) { $ ret = new FormOptions ( ) ; foreach ( $ data as $ item ) { list ( $ value , $ text ) = $ callback ( $ item ) ; $ ret -> add ( $ value , $ text ) ; } return $ ret ; } | Get options from array applying callback to extract key and value . |
16,693 | public function get ( $ key , $ default = null ) { $ stored = static :: getValue ( $ key , false , $ this -> data ) ; if ( $ stored !== false ) { return $ stored ; } foreach ( $ this -> priorityList as $ driver ) { $ value = $ driver -> get ( $ key , false ) ; if ( $ value !== false ) { $ default = $ value ; static :: ... | Returns the value store with provided key or the default value . |
16,694 | public function add ( ConfigurationInterface $ config , $ priority = 0 ) { $ this -> priorityList -> insert ( $ config , $ priority ) ; return $ this ; } | Add a configuration driver to the chain |
16,695 | public static function tap ( $ value , $ callback = null ) { if ( is_null ( $ callback ) ) { return new HigherOrderTapProxy ( $ value ) ; } $ callback ( $ value ) ; return $ value ; } | Call the given Closure with the given value then return the value . |
16,696 | private function method ( ) : string { return isset ( $ this -> bt [ 'class' ] ) ? sprintf ( '%s::%s()' , $ this -> bt [ 'class' ] , $ this -> bt [ 'function' ] ) : $ this -> bt [ 'function' ] ; } | Return a string representation of the called function from the backtrace . |
16,697 | private function tpl ( ) : string { if ( interface_exists ( $ this -> type ) ) { return self :: $ testing ? 'Argument %s passed to x must be an array of objects implementing interface %s, %s given for key %s' : 'Argument %s passed to %s must be an array of objects implementing interface %s, %s given for key %s, called ... | Return the template of the error message accoring to the expected type and the testing mode . |
16,698 | public function log ( $ message , $ priority = Net_Notifier_Logger :: VERBOSITY_MESSAGES , $ timestamp = true ) { if ( $ priority <= $ this -> verbosity ) { $ message = ( $ timestamp ) ? '[' . date ( 'Y-m-d H:i:s' ) . '] ' . $ message : $ message ; if ( $ priority === Net_Notifier_Logger :: VERBOSITY_ERRORS ) { $ this ... | Logs a message based on the verbosity level |
16,699 | public function showAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'EcommerceBundle:Tax' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Tax entity.' ) ; } $ deleteForm = $ this -> createDeleteForm ( $ id ) ; r... | Finds and displays an Tax entity . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.