idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
11,600 | public function get ( $ url , $ params = null ) { $ this -> params = $ params ; $ this -> method = 'GET' ; $ this -> url = $ url ; return $ this -> request ( ) ; } | Make a GET query |
11,601 | public function getSetting ( $ key = null , $ default = null ) { return $ this -> getSettingsComponent ( ) -> get ( $ this -> getSettingsCategory ( ) , $ key , $ default ) ; } | Returns settings from current category . |
11,602 | public function add ( $ value ) { if ( ! is_string ( $ value ) ) { throw new UnexpectedTypeException ( $ value , 'string' , 'value' ) ; } if ( empty ( $ value ) ) { return ; } if ( $ this -> allowTokenize ) { $ this -> values = array_merge ( $ this -> values , explode ( $ this -> delimiter , $ value ) ) ; } else { $ th... | Requests to add new value |
11,603 | public function remove ( $ value ) { if ( ! is_string ( $ value ) ) { throw new UnexpectedTypeException ( $ value , 'string' , 'value' ) ; } if ( empty ( $ value ) ) { return ; } if ( $ this -> allowTokenize ) { $ this -> values = array_diff ( $ this -> values , explode ( $ this -> delimiter , $ value ) ) ; } else { $ ... | Requests to remove existing value |
11,604 | public function replace ( $ oldValue , $ newValue ) { if ( ! is_string ( $ oldValue ) ) { throw new UnexpectedTypeException ( $ oldValue , 'string' , 'oldValue' ) ; } if ( empty ( $ oldValue ) ) { return ; } if ( ! is_string ( $ newValue ) && null !== $ newValue ) { throw new UnexpectedTypeException ( $ newValue , 'str... | Requests to replace one value with another value |
11,605 | public function copy ( $ target ) { if ( ! parent :: copy ( $ target ) ) return false ; return copy ( $ this -> fileSource , $ target ) ; } | Copies the stored file s content to the local filesystem . |
11,606 | public function indexSearch ( $ searchText , $ maxResults ) { $ words = SearchAnalyser :: analyse ( $ searchText ) ; if ( ! $ words ) { return [ ] ; } $ query = $ this -> _em -> createQueryBuilder ( ) -> select ( 'o' ) -> from ( $ this -> _entityName , 'o' ) -> setMaxResults ( $ maxResults ) ; $ parameters = [ ] ; fore... | Find the entities that have the appropriate keywords in their searchIndex . |
11,607 | public function truncateTable ( ) { $ connection = $ this -> _em -> getConnection ( ) ; $ dbPlatform = $ connection -> getDatabasePlatform ( ) ; $ connection -> beginTransaction ( ) ; try { $ q = $ dbPlatform -> getTruncateTableSql ( $ this -> getSearchIndexTable ( ) ) ; $ connection -> executeUpdate ( $ q ) ; $ connec... | Truncates the search index table . |
11,608 | public function setAttribute ( $ key , $ value ) { if ( $ value instanceof BaseModel || $ value instanceof Collection ) $ this -> setRelationship ( $ value , $ key ) ; elseif ( ! is_array ( $ value ) ) $ this -> attributes [ $ key ] = $ value ; else $ this -> setRelationship ( $ value , $ key ) ; } | Sets the attributes for this model |
11,609 | public function setRelationship ( $ value , $ key = '' ) { if ( is_array ( $ value ) ) { $ class = __NAMESPACE__ . '\\' . str_singular ( $ key ) ; if ( class_exists ( $ class ) ) { if ( str_singular ( $ key ) == $ key ) { $ this -> addRelationship ( new $ class ( $ value ) ) ; } else { $ collection = $ class :: newColl... | Sets the relationships on this model which in fact are collections of other models |
11,610 | public function setAttributes ( array $ data ) { $ data = $ this -> stripResponseData ( $ data ) ; foreach ( $ data as $ key => $ value ) { $ this -> setAttribute ( $ key , $ value ) ; } return $ this -> getAttributes ( ) ; } | Set all the attributes from an array . |
11,611 | public static function getSingularEntityName ( ) { if ( isset ( self :: $ entity_singular ) && ! empty ( self :: $ entity_singular ) ) return self :: $ entity_singular ; return str_singular ( self :: getEntityName ( ) ) ; } | Retrieves the singular name of the entity we are querying . |
11,612 | public function request ( $ method , $ url , $ params = array ( ) , $ xml = "" , $ format = "" ) { if ( ! $ format ) $ format = $ this -> format ; $ response = $ this -> api -> request ( $ method , $ url , $ params , $ xml , $ format ) ; return $ this -> parseResponse ( $ response ) ; } | A high level request method used from static methods . |
11,613 | public static function get ( $ params = array ( ) ) { $ object = new static ; $ data = $ object -> request ( 'GET' , $ object -> getUrl ( ) , $ params ) ; $ data = $ object -> stripResponseData ( $ data ) ; $ collection = self :: newCollection ( ) ; if ( isset ( $ data [ 0 ] ) && is_array ( $ data [ 0 ] ) ) { $ collect... | Get a collection of items |
11,614 | public static function find ( $ id ) { $ object = new static ; $ response = $ object -> request ( 'GET' , sprintf ( '%s/%s' , $ object -> getUrl ( ) , $ id ) ) ; return $ response ? $ object : false ; } | Find a single element by its ID |
11,615 | public function create ( $ params = array ( ) ) { $ response = $ this -> api -> request ( 'PUT' , $ this -> getUrl ( ) , $ params , $ this -> toXML ( ) , $ this -> format ) ; return $ this -> parseResponse ( $ response ) ? true : false ; } | Creates a new entity in Xero |
11,616 | public function save ( $ params = array ( ) ) { if ( isset ( $ this -> attributes [ $ this -> primary_column ] ) ) { return $ this -> update ( $ params ) ; } else { return $ this -> create ( $ params ) ; } } | Save an entity . If it doesn t have the primary key set then it will create it otherwise it will update it . |
11,617 | public static function array_to_xml ( $ array , & $ xml ) { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { if ( ! is_numeric ( $ key ) ) { $ subnode = $ xml -> addChild ( "$key" ) ; self :: array_to_xml ( $ value , $ subnode ) ; } elseif ( $ key == 0 ) { self :: array_to_xml ( $ value , $ xml )... | Helper function to convert an array to XML |
11,618 | public function stripResponseData ( array $ data ) { if ( isset ( $ data [ self :: getEntityName ( ) ] ) && is_array ( $ data [ self :: getEntityName ( ) ] ) ) $ data = $ data [ self :: getEntityName ( ) ] ; if ( isset ( $ data [ self :: getSingularEntityName ( ) ] ) && is_array ( $ data [ self :: getSingularEntityName... | This function removes all the unecessary data from a response and leaves us with what we need when trying to populate objects or collections with data |
11,619 | protected function parseResponse ( $ response , $ setAttributes = true ) { if ( $ response [ 'code' ] == 200 ) { $ data = $ this -> api -> parseResponse ( $ response [ 'response' ] , $ response [ 'format' ] ) ; if ( $ response [ 'format' ] == 'xml' ) { $ data = json_encode ( $ data ) ; $ data = json_decode ( $ data , t... | Parses the response retrieved from Xero or throws an exception if it fails . |
11,620 | public function handleNotice ( UserEvent $ event , Queue $ queue ) { if ( strcasecmp ( $ event -> getNick ( ) , $ this -> botNick ) !== 0 ) { return ; } $ connection = $ event -> getConnection ( ) ; $ params = $ event -> getParams ( ) ; $ message = $ params [ 'text' ] ; if ( preg_match ( $ this -> identifyPattern , $ m... | Responds to authentication requests and notifications of ghost connections being killed from NickServ . |
11,621 | public function handleNick ( UserEvent $ event , Queue $ queue ) { $ connection = $ event -> getConnection ( ) ; if ( strcasecmp ( $ event -> getNick ( ) , $ connection -> getNickname ( ) ) === 0 ) { $ params = $ event -> getParams ( ) ; $ connection -> setNickname ( $ params [ 'nickname' ] ) ; } } | Changes the nick associated with the bot in local memory when a change to it is successfully registered with the server . |
11,622 | public function handleNicknameInUse ( ServerEvent $ event , Queue $ queue ) { if ( ! $ this -> ghostEnabled || $ this -> ghostNick !== null ) { return ; } $ params = $ event -> getParams ( ) ; $ this -> ghostNick = $ params [ 1 ] ; } | Kick - starts the ghost process . |
11,623 | public function handleGhost ( ServerEvent $ event , Queue $ queue ) { if ( $ this -> ghostNick === null ) { return ; } $ queue -> ircPrivmsg ( $ this -> botNick , 'GHOST ' . $ this -> ghostNick . ' ' . $ this -> password ) ; } | Completes the ghost process . |
11,624 | protected function getConfigOption ( array $ config , $ key ) { if ( empty ( $ config [ $ key ] ) || ! is_string ( $ config [ $ key ] ) ) { throw new \ DomainException ( "$key must be a non-empty string" ) ; } return $ config [ $ key ] ; } | Extracts a string from the config options map . |
11,625 | protected function message ( $ message , $ title = '' , $ type = 'info' ) { $ this -> message = $ message ; $ this -> title = $ title ; $ this -> type = $ type ; $ this -> session -> flash ( $ this -> namespace , ( array ) $ this ) ; } | Setup the flash messsage data . |
11,626 | public function actionDelete ( $ id ) { $ date = new DateTime ( 'now' ) ; $ model = $ this -> findModel ( $ id ) ; $ model -> deleted_at = $ date -> format ( "U" ) ; $ model -> save ( ) ; return $ this -> redirect ( [ 'index' ] ) ; } | Deletes an existing Address model . If deletion is successful the browser will be redirected to the index page . |
11,627 | public function lookup ( $ context , $ path , $ require = false ) { if ( empty ( $ path ) ) { throw new \ InvalidArgumentException ( "Passed lookup path is empty." ) ; } if ( empty ( $ context ) ) { throw new \ InvalidArgumentException ( "Specified context is empty while resolving path " . json_encode ( $ path ) ) ; } ... | Looks up a path in the specified context |
11,628 | public function resolve ( $ id , $ required = false ) { $ id = $ this -> path ( $ id ) ; try { if ( in_array ( $ id , $ this -> resolutionStack ) ) { $ path = array_map ( function ( $ a ) { return join ( '.' , $ a ) ; } , $ this -> resolutionStack ) ; throw new CircularReferenceException ( sprintf ( "Circular reference... | Resolve the specified path . If the resulting value is a Closure it s assumed a declaration and therefore executed |
11,629 | public function set ( $ path , $ value ) { PropertyAccessor :: setByPath ( $ this -> values , $ this -> path ( $ path ) , $ value ) ; } | Set the value at the specified path |
11,630 | public function helperExec ( $ cmd ) { if ( $ this -> resolve ( 'EXPLAIN' ) ) { $ this -> output -> writeln ( "# Task needs the following helper command:" ) ; $ this -> output -> writeln ( "# " . str_replace ( "\n" , "\\n" , $ cmd ) ) ; } $ ret = '' ; $ this -> executor -> execute ( $ cmd , $ ret ) ; return $ ret ; } | This is useful for commands that need the shell regardless of the explain value setting . |
11,631 | public function fn ( $ id , $ callable = null , $ needsContainer = false ) { if ( $ callable === null ) { $ callable = $ id ; } if ( ! is_callable ( $ callable ) ) { throw new \ InvalidArgumentException ( "Not callable" ) ; } $ this -> set ( $ id , array ( $ callable , $ needsContainer ) ) ; } | Set a function at the specified path . |
11,632 | public function decl ( $ id , $ callable ) { if ( ! is_callable ( $ callable ) ) { throw new \ InvalidArgumentException ( "Passed declaration is not callable" ) ; } $ this -> set ( $ id , function ( Container $ c ) use ( $ callable , $ id ) { Debug :: enterScope ( join ( '.' , ( array ) $ id ) ) ; if ( null !== ( $ val... | Does a declaration i . e . the first time the declaration is called it s resulting value overwrites the declaration . |
11,633 | public function has ( $ id ) { try { $ existing = $ this -> get ( $ id ) ; } catch ( \ OutOfBoundsException $ e ) { return false ; } return Util :: typeOf ( $ existing ) ; } | Checks for existence of the specified path . |
11,634 | public function isEmpty ( $ path ) { try { $ value = $ this -> get ( $ path ) ; } catch ( \ OutOfBoundsException $ e ) { return true ; } return '' === $ value || null === $ value ; } | Checks if a value is empty . |
11,635 | public function call ( ) { $ args = func_get_args ( ) ; $ service = array_shift ( $ args ) ; if ( ! is_array ( $ service ) ) { throw new \ RuntimeException ( "Expected an array" ) ; } if ( ! is_callable ( $ service [ 0 ] ) ) { throw new \ InvalidArgumentException ( "Can not use service '{$service[0]}' as a function, it... | Separate helper for calling a service as a function . |
11,636 | private function setOutputPrefix ( $ prefix ) { if ( ! ( $ this -> output -> getFormatter ( ) instanceof PrefixFormatter ) ) { return ; } $ this -> output -> getFormatter ( ) -> prefix = $ prefix ; } | Helper to set prefix if the output if PrefixFormatter |
11,637 | public function exec ( $ cmd ) { if ( trim ( $ cmd ) ) { $ this -> setOutputPrefix ( '' ) ; if ( $ this -> resolve ( 'DEBUG' ) ) { $ this -> output -> writeln ( '<comment># ' . join ( '::' , Debug :: $ scope ) . "</comment>" ) ; } if ( $ this -> resolve ( 'EXPLAIN' ) ) { if ( $ this -> resolve ( 'INTERACTIVE' ) ) { $ t... | Executes a script snippet using the executor service . |
11,638 | public function str ( $ value ) { if ( is_array ( $ value ) ) { $ allScalar = function ( $ a , $ b ) { return $ a && is_scalar ( $ b ) ; } ; if ( ! array_reduce ( $ value , $ allScalar , true ) ) { throw new UnexpectedValueException ( "Unexpected complex type " . Util :: toPhp ( $ value ) ) ; } return join ( ' ' , $ va... | Convert the value to a string . |
11,639 | public function push ( $ varName , $ tail ) { if ( false === $ this -> has ( $ varName ) ) { $ this -> set ( $ varName , null ) ; } if ( ! isset ( $ this -> varStack [ json_encode ( $ varName ) ] ) ) { $ this -> varStack [ json_encode ( $ varName ) ] = array ( ) ; } array_push ( $ this -> varStack [ json_encode ( $ var... | Push a var on a local stack by it s name . |
11,640 | public function pop ( $ varName ) { $ this -> set ( $ varName , array_pop ( $ this -> varStack [ json_encode ( $ varName ) ] ) ) ; } | Pop a var from a local var stack . |
11,641 | public function argumentsForCallback ( callable $ callback ) : array { $ definition = new ReflectionFunction ( $ callback ) ; $ arguments = [ ] ; foreach ( $ definition -> getParameters ( ) as $ parameter ) { if ( $ type = $ parameter -> getType ( ) ) { $ arguments [ ] = Phony :: emptyValue ( $ type ) ; } else { $ argu... | Returns an argument list of test doubles for the supplied callback . |
11,642 | protected function qualifyClass ( $ name ) { $ rootNamespace = $ this -> rootNamespace ( ) ; if ( Str :: startsWith ( $ name , $ rootNamespace . '\\' ) ) { return $ name ; } $ name = str_replace ( '/' , '\\' , $ name ) ; return $ this -> qualifyClass ( $ this -> getDefaultNamespace ( trim ( $ rootNamespace , '\\' ) ) .... | Parse the class name and format according to the root namespace . |
11,643 | public function get ( $ name = null ) { if ( count ( $ this -> connectors ) > 0 ) { if ( ! is_null ( $ name ) ) { if ( ! isset ( $ this -> connectors [ $ name ] ) ) throw new \ Exception ( "unknown Connector: $name" ) ; return $ this -> connectors [ $ name ] ; } return current ( $ this -> connectors ) ; } throw new \ E... | get an Connector by its name or it will return the default Connector |
11,644 | protected function registerFractal ( ) { $ this -> app -> bind ( SerializerAbstract :: class , function ( $ app ) { $ serializer = $ app -> config -> get ( 'responder.serializer' ) ; return new $ serializer ; } ) ; $ this -> app -> bind ( Manager :: class , function ( $ app ) { return ( new Manager ( ) ) -> setSerializ... | Register Fractal serializer manager and a factory to generate Fractal resource instances . |
11,645 | protected function registerResponseBuilders ( ) { $ this -> app -> bind ( SuccessResponseBuilder :: class , function ( $ app ) { $ builder = new SuccessResponseBuilder ( response ( ) , $ app [ ResourceFactory :: class ] , $ app [ Manager :: class ] ) ; if ( $ parameter = $ app -> config -> get ( 'responder.load_relatio... | Register success and error response builders . |
11,646 | protected function registerAliases ( ) { $ this -> app -> alias ( Responder :: class , 'responder' ) ; $ this -> app -> alias ( SuccessResponseBuilder :: class , 'responder.success' ) ; $ this -> app -> alias ( ErrorResponseBuilder :: class , 'responder.error' ) ; $ this -> app -> alias ( Manager :: class , 'responder.... | Set aliases for the provided services . |
11,647 | public function run ( array $ notification , array $ variables = null , array $ recipients = null ) { $ typeName = Arr :: get ( $ notification , 'type.name' ) ; switch ( $ typeName ) { case 'email' : $ instance = app ( EmailNotification :: class ) ; break ; case 'sms' : $ instance = app ( SmsNotification :: class ) ; b... | Sends notification . |
11,648 | public function getDownloaderForInstalledPackage ( PackageInterface $ package ) { $ installationSource = $ package -> getInstallationSource ( ) ; if ( 'metapackage' === $ package -> getType ( ) ) { return ; } if ( 'dist' === $ installationSource ) { $ downloader = $ this -> getDownloader ( $ package -> getDistType ( ) ... | Returns downloader for already installed package . |
11,649 | public function update ( PackageInterface $ initial , PackageInterface $ target , $ targetDir ) { $ downloader = $ this -> getDownloaderForInstalledPackage ( $ initial ) ; if ( ! $ downloader ) { return ; } $ installationSource = $ initial -> getInstallationSource ( ) ; if ( 'dist' === $ installationSource ) { $ initia... | Updates package from initial to target version . |
11,650 | public function isQueued ( $ alias ) { $ query = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.alias = :alias' ) -> andWhere ( 'c.ended is NULL' ) -> setParameter ( 'alias' , $ alias ) -> getQuery ( ) ; $ result = $ query -> setMaxResults ( 1 ) -> getOneOrNullResult ( ) ; if ( $ result ) return true ; return false... | Identify of cron command is queued |
11,651 | public function addQueued ( $ alias ) { $ query = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.alias = :alias' ) -> setParameter ( 'alias' , $ alias ) -> getQuery ( ) ; $ smileCron = $ query -> setMaxResults ( 1 ) -> getOneOrNullResult ( ) ; if ( ! $ smileCron ) { $ smileCron = new SmileCron ( ) ; $ smileCron -> ... | Add cron to queued |
11,652 | public function run ( SmileCron $ smileCron ) { $ now = new \ DateTime ( 'now' ) ; $ smileCron -> setStarted ( $ now ) ; $ this -> getEntityManager ( ) -> persist ( $ smileCron ) ; $ this -> getEntityManager ( ) -> flush ( ) ; } | Run cron command |
11,653 | public function end ( SmileCron $ smileCron , $ status = 0 ) { $ now = new \ DateTime ( 'now' ) ; $ smileCron -> setEnded ( $ now ) ; $ smileCron -> setStatus ( $ status ) ; $ this -> getEntityManager ( ) -> persist ( $ smileCron ) ; $ this -> getEntityManager ( ) -> flush ( ) ; } | End cron command |
11,654 | private function isSuccessful ( Response $ response ) : bool { if ( $ response -> statusCode ( ) -> value ( ) !== 200 ) { return false ; } $ json = Json :: decode ( ( string ) $ response -> body ( ) ) ; return count ( $ json [ 'errors' ] ) === 0 ; } | Check if the response is successful |
11,655 | public function download ( string $ projectKey , string $ localeId , string $ ext , array $ params = [ ] ) { $ params [ 'file_format' ] = $ ext ; $ response = $ this -> httpGet ( sprintf ( '/api/v2/projects/%s/locales/%s/download' , $ projectKey , $ localeId ) , $ params ) ; if ( ! $ this -> hydrator ) { return $ respo... | Download a locale . |
11,656 | protected function processFileSpecification ( $ artifact , $ fileSpecification ) { $ this -> files [ ] = fphp \ File \ StoredFile :: fromSpecification ( $ fileSpecification ) ; $ this -> tracingLinks [ ] = new fphp \ Artifact \ TracingLink ( "file" , $ artifact , $ fileSpecification -> getSourcePlace ( ) , $ fileSpecif... | Adds a stored file from a specification . Considers globally excluded files . Only exact file names are supported . |
11,657 | public function addExtension ( ExtensionInterface $ extension , $ priority = 0 ) { $ this -> extensions [ $ priority ] [ ] = $ extension ; $ this -> sorted = null ; $ this -> typeExtensions = [ ] ; } | Registers an layout extension . |
11,658 | protected function getExtensions ( ) { if ( null === $ this -> sorted ) { ksort ( $ this -> extensions ) ; $ this -> sorted = ! empty ( $ this -> extensions ) ? call_user_func_array ( 'array_merge' , $ this -> extensions ) : [ ] ; } return $ this -> sorted ; } | Returns all registered extensions sorted by priority . |
11,659 | public static function getMaxLength ( $ array , $ key ) { $ maxLen = 0 ; foreach ( $ array as $ element ) { $ str = call_user_func ( array ( $ element , $ key ) ) ; $ maxLen = strlen ( $ str ) > $ maxLen ? strlen ( $ str ) : $ maxLen ; } return $ maxLen ; } | Returns the maximum member length of an array of objects . |
11,660 | public function aliases ( array $ aliases = null ) { if ( is_null ( $ aliases ) ) { return $ this -> aliases ; } else { $ this -> aliases = array_merge ( $ this -> aliases , $ aliases ) ; } } | Set or get config aliases |
11,661 | public function alias ( $ alias , $ path = null ) { if ( is_null ( $ path ) ) { return $ this -> aliases [ $ alias ] ? : null ; } else { $ this -> aliases [ $ alias ] = $ path ; } } | Set or get a config alias |
11,662 | protected function loadConfig ( $ alias , $ configName ) { if ( isset ( $ this -> aliases [ $ alias ] ) ) { $ aliasPath = $ this -> aliases [ $ alias ] ; } else { throw new ClearException ( "Config Alias [$alias] Not Found." , 4 ) ; } $ file = $ aliasPath . $ configName . '.php' ; if ( is_file ( $ file ) ) { return $ t... | Open and load configs from a file |
11,663 | public function set ( $ mixedKey , $ value ) { list ( $ alias , $ configName , $ key ) = $ this -> parseKey ( $ mixedKey ) ; if ( is_null ( $ key ) ) { $ this -> configs [ $ alias ] [ $ configName ] = $ value ; } $ this -> configs [ $ alias ] [ $ configName ] [ $ key ] = $ value ; } | Set a config |
11,664 | protected function parseKey ( $ mixedKey ) { if ( preg_match ( '/^((?P<alias>[\w]+)::)?(?P<name>\w+)(\.(?P<key>\w+))?$/' , $ mixedKey , $ matches ) !== 1 ) { throw new ClearException ( "Invalid Config Variable Name. Name Must Be Like [alias::name.key] Or [name.key]." , 4 ) ; } $ alias = $ matches [ 'alias' ] ; $ name =... | Parse requested mixed - key and split alias name and key |
11,665 | public function db ( $ database = null ) { if ( empty ( $ database ) ) { $ database = $ this -> database ; } return $ this -> silex [ 'dbs' ] [ $ database ] ; } | Gets dbal engine . |
11,666 | public function getCurrentUser ( ) { if ( Towel :: isCli ( ) ) { return false ; } $ userRecord = $ this -> session ( ) -> get ( 'user' , false ) ; if ( ! $ userRecord ) { return false ; } $ userModel = $ this -> getInstance ( 'user_model' ) ; $ userModel -> setRecord ( $ userRecord ) ; return $ userModel ; } | Gets the current user or false if is not authenticated . |
11,667 | public function sendMail ( $ to , $ subject = '' , $ message = '' , $ headers = '' ) { if ( empty ( $ headers ) ) { $ headers = 'From: ' . APP_SYS_EMAIL ; } mail ( $ to , $ subject , $ message , $ headers ) ; } | Sends an Email . |
11,668 | public function url ( $ route , $ parameters = array ( ) ) { return $ this -> silex [ 'url_generator' ] -> generate ( $ route , $ parameters , \ Symfony \ Component \ Routing \ Generator \ UrlGeneratorInterface :: ABSOLUTE_URL ) ; } | Generates an absolute URL from the given parameters . |
11,669 | public function getCache ( ) { if ( null === self :: $ cache ) { if ( ! empty ( $ this -> appConfig [ 'cache' ] [ 'driver' ] ) ) { if ( empty ( $ this -> appConfig [ 'cache' ] [ 'options' ] ) ) { $ options = array ( ) ; } else { $ options = $ this -> appConfig [ 'cache' ] [ 'options' ] ; } if ( 'memcached' !== $ this -... | Instantiate Cache driver |
11,670 | protected function createErrorEntry ( $ error , $ parse_errors ) { $ marker_obj = new \ DOMElement ( strtolower ( $ error -> getSeverity ( ) ) ) ; $ parse_errors -> appendChild ( $ marker_obj ) ; $ message = ( $ this -> getTranslator ( ) ) ? vsprintf ( $ this -> getTranslator ( ) -> translate ( $ error -> getCode ( ) )... | Creates an entry in the ParseErrors collection of a file for a given error . |
11,671 | public function buildFunction ( \ DOMElement $ parent , FunctionDescriptor $ function , \ DOMElement $ child = null ) { if ( ! $ child ) { $ child = new \ DOMElement ( 'function' ) ; $ parent -> appendChild ( $ child ) ; } $ namespace = $ function -> getNamespace ( ) ? $ function -> getNamespace ( ) : $ parent -> getAt... | Export this function definition to the given parent DOMElement . |
11,672 | protected function buildPackageTree ( \ DOMDocument $ dom ) { $ xpath = new \ DOMXPath ( $ dom ) ; $ packages = array ( 'global' => true ) ; $ qry = $ xpath -> query ( '//@package' ) ; for ( $ i = 0 ; $ i < $ qry -> length ; $ i ++ ) { if ( isset ( $ packages [ $ qry -> item ( $ i ) -> nodeValue ] ) ) { continue ; } $ ... | Collects all packages and subpackages and adds a new section in the DOM to provide an overview . |
11,673 | protected function buildNamespaceTree ( \ DOMDocument $ dom ) { $ xpath = new \ DOMXPath ( $ dom ) ; $ namespaces = array ( ) ; $ qry = $ xpath -> query ( '//@namespace' ) ; for ( $ i = 0 ; $ i < $ qry -> length ; $ i ++ ) { if ( isset ( $ namespaces [ $ qry -> item ( $ i ) -> nodeValue ] ) ) { continue ; } $ namespace... | Collects all namespaces and sub - namespaces and adds a new section in the DOM to provide an overview . |
11,674 | protected function generateNamespaceTree ( $ namespaces ) { sort ( $ namespaces ) ; $ result = array ( ) ; foreach ( $ namespaces as $ namespace ) { if ( ! $ namespace ) { $ namespace = 'global' ; } $ namespace_list = explode ( '\\' , $ namespace ) ; $ node = & $ result ; foreach ( $ namespace_list as $ singular ) { if... | Generates a hierarchical array of namespaces with their singular name from a single level list of namespaces with their full name . |
11,675 | protected function generateNamespaceElements ( $ namespaces , $ parent_element , $ node_name = 'namespace' ) { foreach ( $ namespaces as $ name => $ sub_namespaces ) { $ node = new \ DOMElement ( $ node_name ) ; $ parent_element -> appendChild ( $ node ) ; $ node -> setAttribute ( 'name' , $ name ) ; $ fullName = $ par... | Recursive method to create a hierarchical set of nodes in the dom . |
11,676 | public function get_html ( $ theme = 'light' , $ lang = 'en' , $ type = 'image' ) { if ( $ this -> enabled ) { $ option = [ ] ; switch ( $ theme ) { case 'dark' : $ option [ 'theme' ] = $ theme ; break ; case 'red' : default : $ option [ 'theme' ] = 'light' ; break ; } switch ( $ type ) { case 'audio' : $ option [ 'typ... | Return reCaptcha s HTML |
11,677 | public function isRunning ( ) { $ runningStatuses = [ self :: SUBSCRIPTION_STATUS_ACTIVE , self :: SUBSCRIPTION_STATUS_TRIAL , ] ; return in_array ( $ this -> getStatus ( ) , $ runningStatuses , true ) ; } | Check if the current subscription is running . |
11,678 | private function add_helpers ( $ helpers ) { foreach ( $ helpers as $ helper ) { $ helper = $ this -> validate_helper_input ( $ helper ) ; if ( is_array ( $ helper ) ) { $ this -> add_helper ( $ helper ) ; } } } | Add the helpers to the Handlebars instance if validation passes . |
11,679 | private function validate_helper_input ( $ helper ) { if ( ! is_array ( $ helper ) || empty ( $ helper ) ) { return false ; } if ( ! isset ( $ helper [ 'name' ] ) || ! isset ( $ helper [ 'class' ] ) ) { return false ; } if ( ! isset ( $ helper [ 'callback' ] ) ) { $ helper [ 'callback' ] = 'helper' ; } return $ helper ... | Make sure each helper passed in is valid . |
11,680 | public function offsetGet ( $ offset ) { if ( $ this -> offsetExists ( $ offset ) ) { return parent :: offsetGet ( $ offset ) ; } else { if ( 'id' == $ offset || 'ID' == $ offset ) { $ _value = $ this -> pod -> id ( ) ; } else { $ _value = $ this -> pod -> field ( $ offset ) ; } if ( $ _value ) { parent :: offsetSet ( ... | Get an offset if already set or traverse Pod and then set plus reutrn . |
11,681 | protected function processFileSpecification ( $ artifact , $ fileSpecification ) { $ collaboration = fphp \ Collaboration \ Collaboration :: findByArtifact ( $ this -> collaborations , $ artifact ) ; if ( ! $ collaboration ) $ this -> collaborations [ ] = $ collaboration = new fphp \ Collaboration \ Collaboration ( $ a... | Adds a role from a file to a collaboration . |
11,682 | protected function _generateFiles ( ) { foreach ( $ this -> getRegisteredArtifacts ( ) as $ artifact ) { $ featureName = $ artifact -> getFeature ( ) -> getName ( ) ; if ( array_search ( $ featureName , $ this -> featureOrder ) === false ) throw new CollaborationGeneratorException ( "no feature order supplied for \"$fe... | Generates the refined files . |
11,683 | public function append ( $ string , $ length = null ) { $ this -> end ( ) ; return $ this -> write ( $ string , $ length ) ; } | Append data to the stream . |
11,684 | public function get ( $ index ) { if ( ! isset ( $ this -> _streams [ $ index ] ) ) { throw new InvalidArgumentException ( "Unexisting stream index `{$index}`." ) ; } return $ this -> _streams [ $ index ] ; } | Return a contained stream . |
11,685 | public function remove ( $ index ) { if ( ! isset ( $ this -> _streams [ $ index ] ) ) { throw new InvalidArgumentException ( "Unexisting stream index `{$index}`." ) ; } $ stream = $ this -> _streams [ $ index ] ; unset ( $ this -> _streams [ $ index ] ) ; $ this -> _streams = array_values ( $ this -> _streams ) ; retu... | Remove a stream . |
11,686 | public function detach ( ) { $ this -> _offset = $ this -> _current = 0 ; $ this -> _seekable = true ; foreach ( $ this -> _streams as $ stream ) { $ stream -> detach ( ) ; } $ this -> _streams = [ ] ; } | Detaches each attached stream . |
11,687 | private function computeEndpoint ( ) : UrlInterface { if ( ! $ this -> transactions -> isOpened ( ) ) { return Url :: fromString ( '/db/data/transaction/commit' ) ; } return $ this -> transactions -> current ( ) -> endpoint ( ) ; } | Determine the appropriate endpoint based on the transactions |
11,688 | private function computeBody ( Query $ query ) : StringStream { $ statement = [ 'statement' => $ query -> cypher ( ) , 'resultDataContents' => [ 'graph' , 'row' ] , ] ; if ( $ query -> hasParameters ( ) ) { $ parameters = [ ] ; foreach ( $ query -> parameters ( ) as $ parameter ) { $ parameters [ $ parameter -> key ( )... | Build the json payload to be sent to the server |
11,689 | public function isExpressionPath ( $ path , $ node ) { if ( is_scalar ( $ node ) ) { foreach ( $ this -> expressionPaths as $ callable ) { if ( call_user_func ( $ callable , $ path ) ) { return true ; } } } return false ; } | Decides if a node should be an expression . |
11,690 | public function build ( ) { Debug :: enterScope ( 'build' ) ; $ traverser = $ this -> createNodeCreatorTraverser ( $ this -> config ) ; $ result = $ traverser -> traverse ( ) ; $ node = new ContainerNode ( ) ; $ gatherer = $ this -> createNodeGathererTraverser ( $ result , $ node ) ; $ gatherer -> traverse ( ) ; Debug ... | Build the container node |
11,691 | public function createArgNode ( $ path , $ node ) { $ v = trim ( $ node ) ; if ( substr ( $ v , 0 , 1 ) == '?' ) { $ conditional = true ; $ v = ltrim ( substr ( $ v , 1 ) ) ; } else { $ conditional = false ; } return new ArgNode ( end ( $ path ) , $ this -> exprcompiler -> parse ( $ v ) , $ conditional ) ; } | Creates a node for the args definition of the task . |
11,692 | public function createOptNode ( $ path , $ node ) { return new OptNode ( end ( $ path ) , $ this -> exprcompiler -> parse ( $ node ) ) ; } | Creates a node for the opts definition of the task . |
11,693 | public function createSetNode ( $ path , $ node ) { return new SetNode ( end ( $ path ) , $ this -> exprcompiler -> parse ( $ node ) ) ; } | Creates a node for the set definition of the task . |
11,694 | public function createNodeCreatorTraverser ( $ config ) { $ traverser = new Traverser ( $ config ) ; $ traverser -> addVisitor ( array ( $ this , 'createArgNode' ) , function ( $ path ) { return ( count ( $ path ) == 4 && $ path [ 0 ] == 'tasks' && $ path [ 2 ] == 'args' ) ; } , Traverser :: BEFORE ) ; $ traverser -> a... | Creates the traverser that creates relevant nodes at all known paths . |
11,695 | public function hasParam ( $ param ) { $ param = ( string ) $ this -> params [ $ param ] ; return strlen ( $ param ) > 0 ? true : false ; } | Determine that route param exists . |
11,696 | public function isMatch ( $ pathInfo ) { $ this -> compile ( ) ; $ pathInfo = trim ( $ pathInfo , '/' ) ; if ( ! preg_match ( $ this -> pattern , $ pathInfo , $ paramValues ) ) { return false ; } foreach ( $ this -> paramNames as $ name ) { $ this -> params [ $ name ] = isset ( $ paramValues [ $ name ] ) ? urldecode ( ... | Determine matching route by given uri . |
11,697 | public function compile ( ) { $ this -> params = [ ] ; $ this -> paramNames = [ ] ; $ this -> conditions = [ ] ; $ this -> compiled = true ; $ uri = $ this -> normalizeUri ( $ this -> getUri ( ) ) ; $ regex = preg_replace_callback ( '#(?:(\\/)?\\{(\\w+)(\\?)?(?::((?:\\\\\\{|\\\\\\}|[^{}]|\\{\\d(?:\\,(?:\\d)?)?\\})+))?\... | Compile route uri pattern regex |
11,698 | protected function createRegex ( $ matched ) { $ startSlash = $ matched [ 1 ] ? true : false ; $ param = $ matched [ 2 ] ; $ optional = $ matched [ 3 ] ? true : false ; $ pattern = $ matched [ 4 ] ? : null ; $ pattern = $ this -> conditions [ $ param ] ? : $ pattern ? : '[^/]+' ; $ this -> paramNames [ ] = $ param ; if... | Callback for creating route param names regex |
11,699 | private function generateHtmlPart ( ) { $ result = false ; if ( $ this -> htmlText != '' ) { $ matches = array ( ) ; if ( $ this -> options -> automaticImageInclude === true ) { preg_match_all ( '( <img \\s+[^>]* src\\s*=\\s* (?: ... | Returns an ezcMailPart based on the HTML provided . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.