idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
58,900 | public function execute ( Query $ query , MapInterface $ variables ) : SetInterface { return ( $ this -> makeEntity ) ( $ this -> connection -> execute ( $ query ) , $ variables ) ; } | Execute the given query |
58,901 | private function extractIdentity ( object $ entity ) : Identity { $ identity = ( $ this -> metadata ) ( get_class ( $ entity ) ) -> identity ( ) -> property ( ) ; return ReflectionObject :: of ( $ entity ) -> extract ( $ identity ) -> get ( $ identity ) ; } | Extract the identity object from the given entity |
58,902 | public function validate ( Model $ obj ) { $ fieldset = static :: set_fields ( $ obj ) ; $ val = $ fieldset -> validation ( ) ; $ is_new = $ obj -> is_new ( ) ; $ allow_partial = $ is_new ? false : array ( ) ; $ input = array ( ) ; foreach ( array_keys ( $ obj -> properties ( ) ) as $ p ) { if ( ! in_array ( $ p , $ ob... | Validate the model |
58,903 | public function makeHelpMessage ( string $ className , string $ domain , bool $ global = false ) : void { $ domainSynop = $ this -> lHelper -> getDomainSynopsis ( $ className ) ; $ this -> helpMessageHeader ( $ domain , $ domainSynop ) ; if ( ! $ global ) { $ methodsList = $ this -> lHelper -> getClassPublicMethods ( $... | Generates different messages according to the global param |
58,904 | private function validateKey ( ) { $ app = \ Slim \ Slim :: getInstance ( ) ; $ key = $ app -> request -> params ( 'auth' ) ; if ( ! $ key ) { $ app -> redirect ( '/notkey' ) ; } else { if ( $ key != $ this -> _key ) { $ app -> redirect ( '/invalidkey' ) ; } } } | Validate Sent Key |
58,905 | public function compile ( ) { if ( $ this -> table === false || $ this -> type === false ) { throw ( new \ Exception ( 'Query compilation failure: missing table or type' ) ) ; } switch ( $ this -> type ) { case 'UPDATE' : return $ this -> generateUPDATEStatement ( ) ; case 'INSERT' : return $ this -> generateINSERTStat... | WHERE THE MAGIC HAPPENS |
58,906 | private function newUpdateEntry ( $ column , $ param ) { if ( ! empty ( $ this -> columnwhitelist ) ) { if ( ! in_array ( $ column , $ this -> columnwhitelist ) ) { throw ( new \ Exception ( 'Column in update list not found in white list' ) ) ; } } $ newupdate = new \ stdClass ( ) ; $ newupdate -> column = $ column ; $... | PARSING AND VALIDATION FUNCTIONS |
58,907 | private static function validateTimestamp ( $ timestamp ) { $ check = ( is_int ( $ timestamp ) || is_float ( $ timestamp ) ) ? $ timestamp : ( string ) ( int ) $ timestamp ; return ( $ check === $ timestamp ) AND ( ( int ) $ timestamp <= PHP_INT_MAX ) AND ( ( int ) $ timestamp >= ~ PHP_INT_MAX ) ; } | Checks if a string is a valid timestamp . |
58,908 | public function resolve ( $ tsdns ) { $ this -> getTransport ( ) -> sendLine ( $ tsdns ) ; $ repl = $ this -> getTransport ( ) -> readLine ( ) ; $ this -> getTransport ( ) -> disconnect ( ) ; if ( $ repl -> section ( ":" , 0 ) -> toInt ( ) == 404 ) { throw new TeamSpeak3_Adapter_TSDNS_Exception ( "unable to resolve TSD... | Queries the TSDNS server for a specified virtual hostname and returns the result . |
58,909 | public function get ( string $ path , MiddlewareInterface $ middleware , string $ name ) : Route { return $ this -> add ( $ path , $ middleware , $ name , 'GET' ) ; } | Add a route associate to the get http method . |
58,910 | public function url ( string $ name , array $ params = [ ] ) : string { if ( ! isset ( $ this -> namedRoutes [ $ name ] ) ) { throw new RouterException ( 'No route matches this name' ) ; } return $ this -> namedRoutes [ $ name ] -> getURl ( $ params ) ; } | Get the named route s URL and matching param s values . |
58,911 | public static function prepare ( $ view , $ data , $ closure ) { $ mailer = new self ( ) ; $ closure ( $ mailer ) ; $ mailer -> view ( $ view , $ data ) ; $ mailer -> transport ( ) ; } | The send function . |
58,912 | private function checkView ( ) { exception_if ( ( is_null ( $ this -> mailable -> get ( '_view' ) ) && is_null ( $ this -> mailable -> get ( '_text' ) ) ) , MailViewNotFoundException :: class ) ; } | Get the view to send . |
58,913 | private function transport ( ) { $ this -> transport = Transport :: newInstance ( $ this -> smtp -> get ( 'host' ) , $ this -> smtp -> get ( 'port' ) , $ this -> smtp -> get ( 'encryption' ) ) -> setUsername ( $ this -> smtp -> get ( 'username' ) ) -> setPassword ( $ this -> smtp -> get ( 'password' ) ) ; return $ this... | Set the SMTP transport . |
58,914 | private function subject ( ) { $ subject = is_null ( $ this -> mailable -> get ( '_subject' ) ) ? config ( 'mail.subject' ) : $ this -> mailable -> get ( '_subject' ) ; $ this -> message -> setSubject ( $ subject ) ; } | Set the mail subject . |
58,915 | public static function to ( ) { $ args = func_get_args ( ) ; $ receivers = [ ] ; foreach ( $ args as $ arg ) { if ( is_string ( $ arg ) ) { $ receivers [ ] = $ arg ; } elseif ( is_array ( $ arg ) ) { foreach ( $ arg as $ value ) { $ receivers [ ] = $ value ; } } } $ mail = new self ( ) ; $ mail -> setDestination ( $ re... | To add reciever adresses . |
58,916 | protected function setDestination ( array $ mails ) { $ this -> recievers = $ mails ; $ this -> message -> setTo ( $ this -> recievers ) ; return $ this ; } | Set email destination . |
58,917 | public function send ( Mailable $ mailable ) { $ this -> mailable = $ mailable ; $ this -> mailable -> build ( ) ; $ this -> checkView ( ) ; $ this -> subject ( ) ; $ view = $ this -> mailable -> get ( '_view' ) ; $ this -> message -> setBody ( $ view -> get ( ) , $ this -> mailable -> get ( '_type' ) ) ; $ this -> mes... | Set the mailable class to send . |
58,918 | private function setAttachments ( ) { $ attachments = $ this -> mailable -> get ( '_attachments' ) ; if ( ! is_null ( $ attachments ) ) { foreach ( $ attachments as $ attachment ) { if ( in_array ( 'name' ) ) { $ this -> message -> attach ( Attachment :: fromPath ( $ attachment [ 'file' ] ) -> setFilename ( $ attachmen... | Set the files on mail surface . |
58,919 | private function setCC ( ) { $ cc = $ this -> mailable -> get ( '_cc' ) ; if ( ! is_null ( $ cc ) ) { foreach ( $ cc as $ mail ) { $ this -> message -> setCC ( $ mail ) ; } } } | Set the CC mails . |
58,920 | private function setCCI ( ) { $ cci = $ this -> mailable -> get ( '_cci' ) ; if ( ! is_null ( $ cci ) ) { foreach ( $ cci as $ mail ) { $ this -> message -> setBcc ( $ mail ) ; } } } | Set the CCI mails . |
58,921 | public function addEntry ( $ filesystem , $ mountPoint , $ type , $ options = 'ro' , $ dump = null , $ pass = null ) { $ line = $ this -> lineFactory -> makeLine ( ) ; $ line -> setFileSystem ( $ filesystem ) -> setMountPoint ( $ mountPoint ) -> setFileSystemType ( $ type ) -> setOptions ( $ options ) -> setDump ( $ du... | Queue a new fstab entry or an update to an fstab entry to be later written to an fstab file . |
58,922 | public function setNetwork ( Transaction \ NetworkType $ network ) { if ( $ this -> isTransacted ( ) || $ this -> parent ) { return ; } $ this -> network = $ network ; } | Sets the network |
58,923 | public function createChild ( Transaction \ TransactionType $ type , $ amount = null ) { $ child = new Transaction ( $ this ) ; $ child -> setType ( $ type ) ; $ child -> setAmount ( $ amount ? : $ this -> amount ) ; $ this -> children -> add ( $ child ) ; return $ child ; } | Creates a new child transaction |
58,924 | public function setAccount ( AbstractAccount $ account ) { if ( $ this -> isTransacted ( ) || $ this -> parent ) { return ; } $ this -> account = $ account ; } | Sets the associated account |
58,925 | public function setCredentials ( Credentials $ credentials ) { if ( $ this -> isTransacted ( ) || $ this -> parent ) { return ; } $ this -> credentials = $ credentials ; } | Sets the associated credentials |
58,926 | public function isRefunded ( ) { if ( $ this -> parent ) { return $ this -> parent -> isRefunded ( ) ; } return $ this -> children -> exists ( function ( $ key , Transaction $ child ) { return $ child -> getType ( ) == Transaction \ TransactionType :: REFUND && $ child -> getStatus ( ) == Result \ ResultStatus :: APPRO... | Returns true if the transaction has been refunded |
58,927 | public function isVoided ( ) { if ( $ this -> parent ) { return $ this -> parent -> isVoided ( ) ; } return $ this -> children -> exists ( function ( $ key , Transaction $ child ) { return $ child -> getType ( ) == Transaction \ TransactionType :: VOID && $ child -> getStatus ( ) == Result \ ResultStatus :: APPROVED ; ... | Returns true if the transaction has been voided |
58,928 | private function getImplementations ( ) { foreach ( $ this -> _implementations as $ extension => $ loaded ) { if ( $ loaded ) { continue ; } if ( extension_loaded ( $ extension ) ) { $ this -> _implementations [ $ extension ] = true ; } } } | Finds out what implementations are available |
58,929 | public function registerPlugin ( $ pluginName , $ implementation ) { if ( ! array_key_exists ( $ pluginName , $ this -> _registry ) && $ this -> isValidImplementation ( $ implementation ) ) { $ this -> _registry [ $ pluginName ] = array ( 'loaded' => false , 'implementation' => $ implementation ) ; return true ; } retu... | Registers a plugin in the registry |
58,930 | public function getPluginRegistry ( $ implementation ) { $ returnArray = array ( ) ; foreach ( $ this -> _registry as $ plugin => $ meta ) { if ( $ meta [ 'implementation' ] == 'n/a' || $ meta [ 'implementation' ] == $ implementation ) { $ returnArray [ $ plugin ] = $ meta ; } } return $ returnArray ; } | Returns the plugin registry for the supplied implementation |
58,931 | public function getSet ( $ key , callable $ value , $ partition = null , $ time = 14400 ) { $ temp = $ this -> get ( $ key , null , $ partition ) ; if ( $ temp !== null ) { return $ temp ; } $ this -> prepare ( $ key , $ partition ) ; try { $ value = call_user_func ( $ value ) ; return $ this -> set ( $ key , $ value ,... | Get a cached value if it exists if not - invoke a callback store the result in cache and return it . |
58,932 | public function onFlush ( \ Doctrine \ ORM \ Event \ OnFlushEventArgs $ eventArgs ) { $ reCacheEntities = [ ] ; $ em = $ eventArgs -> getEntityManager ( ) ; $ uow = $ em -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityInsertions ( ) as $ entity ) { $ reCacheEntities [ get_class ( $ entity ) ] = true ; } for... | Doctrine - Event to clear cache on changes |
58,933 | public function parseElements ( array $ elements , ElementInterface $ parent = null ) { foreach ( $ elements as & $ element ) { $ element = $ this -> applyStyles ( $ element ) ; } return parent :: parseElements ( $ elements , $ parent ) ; } | Parse view elements |
58,934 | protected function applyStyles ( $ element ) { if ( ! $ this -> style ) return $ element ; if ( array_key_exists ( 'class' , $ element [ 'attributes' ] ) ) { $ classes = explode ( ' ' , $ element [ 'attributes' ] [ 'class' ] ) ; $ element = $ this -> applyStylesToElement ( $ element , $ this -> style -> getByClasses ( ... | Apply the styles to the element |
58,935 | protected function applyStylesToElement ( $ element , $ styles ) { foreach ( $ styles as $ tag => $ data ) { $ element [ 'attributes' ] [ $ tag ] = $ data ; } return $ element ; } | Apply styles to the attributes tag |
58,936 | public static function node ( $ id ) { $ id = intval ( $ id ) ; if ( empty ( $ id ) ) return null ; if ( ! static :: $ caching || empty ( static :: $ _nodes [ $ id ] ) ) { $ result = static :: findOne ( $ id ) ; if ( static :: $ caching ) { static :: $ _nodes [ $ id ] = $ result ; } else { return $ result ; } } return ... | Quick get content node without i18n |
58,937 | public static function nodePath ( $ id ) { $ node = static :: node ( $ id ) ; if ( empty ( $ node ) ) return '' ; if ( empty ( $ node -> nodePath ) ) { $ node -> nodePath = static :: nodePath ( $ node -> parent_id ) . '/' . $ node -> slug ; } return $ node -> nodePath ; } | Get node s path collected from slugs |
58,938 | public static function nodeChildren ( $ parentId ) { $ parentId = intval ( $ parentId ) ; if ( ! static :: $ caching || empty ( static :: $ _children [ $ parentId ] ) ) { $ query = static :: find ( ) -> where ( [ 'parent_id' => $ parentId ] ) -> orderBy ( static :: $ defaultOrderBy ) ; $ childList = $ query -> all ( ) ... | Get node children |
58,939 | public static function getNodePath ( $ node ) { $ result = '' ; if ( $ node instanceof static ) { $ result = $ node -> slug ; if ( ! empty ( $ node -> parent_id ) ) { $ parent = static :: node ( $ node -> parent_id ) ; if ( ! empty ( $ parent ) ) { $ result = static :: getNodePath ( $ parent ) . '/' . $ result ; } } } ... | Get path to node in content tree . |
58,940 | public function importFromUrlsXml ( ) { $ urls = $ this -> _parseUrlsXml ( ) ; foreach ( $ urls as $ url ) { $ this -> addUrl ( $ url ) ; } } | Add URLs automatically from urls . xml |
58,941 | public function ping ( $ uri ) { $ parsed_url = parse_url ( $ uri ) ; if ( ! $ parsed_url || ! is_array ( $ parsed_url ) ) { return false ; } $ http = new \ GuzzleHttp \ Client ( array ( 'base_uri' => $ parsed_url [ 'host' ] ) ) ; $ res = $ http -> get ( $ parsed_url [ 'path' ] . '?' . $ parsed_url [ 'query' ] ) ; if (... | Submitting a sitemap by sending an HTTP request |
58,942 | protected function _parseUrlsXml ( ) { $ urls = array ( ) ; $ conf = & jApp :: config ( ) -> urlengine ; $ significantFile = $ conf [ 'significantFile' ] ; $ basePath = $ conf [ 'basePath' ] ; $ epExt = ( $ conf [ 'multiview' ] ? '.php' : '' ) ; $ file = jApp :: tempPath ( 'compiled/urlsig/' . $ significantFile . '.cre... | Parse urls . xml and return pathinfo URLs |
58,943 | public function getAttribute ( $ key ) { if ( isset ( $ this -> attributes [ $ key ] ) ) { return $ this -> attributes [ $ key ] ; } else { return NULL ; } } | Devuelve un atributo si existe y si no devuelve NULL |
58,944 | public function showValidationProblems ( ConstraintViolationList $ problems , GeneratorInterface $ generator ) { if ( ! $ this -> bound ( ) ) { throw new OutputNotAvailableException ( "Tried to show validation errors, however no output channel available" ) ; } $ block = ValidationProblemFormatter :: format ( $ problems... | Displays output results of validation problems . |
58,945 | public function get ( $ handle ) { $ this -> setting = $ this -> items -> where ( 'handle' , $ handle ) -> first ( ) ; return $ this -> setting ; } | Get a setting by its handle . |
58,946 | public function label ( $ handle = null ) { if ( $ handle ) { return $ this -> get ( $ handle ) -> label ; } return $ this -> setting -> label ; } | Get setting s label . |
58,947 | public function description ( $ handle = null ) { if ( $ handle ) { return $ this -> get ( $ handle ) -> description ; } return $ this -> setting -> description ; } | Get setting s description . |
58,948 | public function value ( $ handle = null , $ default = '' ) { if ( $ handle && ! $ this -> get ( $ handle ) ) { return $ default ; } if ( $ handle ) { return $ this -> get ( $ handle ) -> value ? : $ this -> defaultValue ( $ handle ) ; } return $ this -> setting -> value ? : $ this -> setting -> default ; } | Get setting s value . |
58,949 | public function value ( $ options = [ ] , $ content = '' ) { if ( ! is_array ( $ options ) ) { $ options = [ 'value' => $ options ] ; } $ this -> values [ ] = new Option ( $ this -> form -> expression ( 'option' ) , $ options , $ content ) ; return $ this ; } | add a new option value |
58,950 | public static function googleRecaptcha ( $ value , $ context ) { $ httpClient = new Client ( ) ; $ googleReponse = $ httpClient -> post ( 'https://www.google.com/recaptcha/api/siteverify' , [ 'secret' => Configure :: read ( 'Google.Recaptcha.secret' ) , 'response' => $ value , 'remoteip' => Router :: getRequest ( ) -> ... | Validate a google recaptcha . |
58,951 | public static function source_method ( $ class , $ name ) { if ( ! method_exists ( $ class , $ name ) ) { return FALSE ; } $ refl = new ReflectionMethod ( $ class , $ name ) ; $ file = fopen ( $ refl -> getFileName ( ) , 'r' ) ; $ line = 0 ; $ range = array ( 'start' => $ refl -> getStartLine ( ) , 'end' => $ refl -> g... | Returns an HTML string highlighting a specific line of a file with some number of lines padded above and below . |
58,952 | protected function notify ( $ title , $ message , $ icon = null ) { $ icon = is_string ( $ icon ) ? $ icon : $ this -> icon ; $ this -> execute ( "notify-send -t 2000 -i {$icon} '{$title}' '$message'" ) ; } | Notify with notify - send . |
58,953 | public function callTagCompiler ( $ tag , $ args , $ param1 = null , $ param2 = null , $ param3 = null ) { if ( isset ( self :: $ _tag_objects [ $ tag ] ) ) { return self :: $ _tag_objects [ $ tag ] -> compile ( $ args , $ this , $ param1 , $ param2 , $ param3 ) ; } $ class_name = 'Smarty_Internal_Compile_' . $ tag ; i... | lazy loads internal compile plugin for tag and calls the compile methode |
58,954 | public function trigger_template_error ( $ args = null , $ line = null ) { if ( ! isset ( $ line ) ) { $ line = $ this -> lex -> line ; } $ match = preg_split ( "/\n/" , $ this -> lex -> data ) ; $ error_text = 'Syntax Error in template "' . $ this -> template -> source -> filepath . '" on line ' . $ line . ' "' . htm... | display compiler error messages without dying |
58,955 | protected function setUp ( $ baseFileDir = null ) { $ locator = new FileLocator ( $ baseFileDir ) ; $ resolver = new LoaderResolver ( array ( new PhpArrayFileLoader ( $ locator ) , new JsonFileLoader ( $ locator ) , new YamlFileLoader ( $ locator ) ) ) ; $ this -> fileLoader = new DelegatingLoader ( $ resolver ) ; } | Setup the objects that locate and load our files . |
58,956 | public function bind ( $ abstract , $ concrete = null , $ shared = false ) { if ( $ concrete == null ) { $ concrete = $ abstract ; } if ( ! ( $ concrete instanceof Closure ) ) { $ concrete = function ( $ container , $ args = [ ] ) use ( $ abstract , $ concrete ) { $ method = ( $ abstract == $ concrete || is_object ( $ ... | Bind concrete class to an abstract one |
58,957 | public function bindIf ( $ abstract , $ concrete , $ shared = false ) { if ( ! isset ( $ this -> bindings [ $ abstract ] ) && ! isset ( $ this -> instances [ $ abstract ] ) ) { $ this -> bind ( $ abstract , $ concrete , $ shared ) ; } } | Register a binding if it was not registered already |
58,958 | public function make ( $ abstract , $ args = [ ] ) { $ abstract = isset ( $ this -> aliases [ $ abstract ] ) ? $ this -> aliases [ $ abstract ] : $ abstract ; if ( isset ( $ this -> instances [ $ abstract ] ) ) { return $ this -> instances [ $ abstract ] ; } $ concrete = isset ( $ this -> bindings [ $ abstract ] ) ? $ ... | Create object by the abstract name |
58,959 | public function build ( $ concrete , $ args = [ ] ) { if ( $ concrete instanceof Closure ) { return $ concrete ( $ this , $ args ) ; } $ reflectionClass = new ReflectionClass ( $ concrete ) ; if ( ! $ reflectionClass -> isInstantiable ( ) ) { throw new Exception ( sprintf ( '`s` type is not instantiable !' , $ concrete... | Build concrete class to object |
58,960 | public function resolveMethod ( $ class , $ method , array $ args = [ ] ) { if ( ! is_object ( $ class ) ) { throw new Exception ( 'Container::makeMethod except a object as the first parameter!' ) ; } $ reflectionMethod = new ReflectionMethod ( $ class , $ method ) ; $ dependencies = $ this -> getMethodDependencies ( $... | Execute method by injecting the dependencies |
58,961 | public function resolveClosure ( Closure $ closure , array $ args = [ ] ) { $ closureRef = new ReflectionFunction ( $ closure ) ; $ dependencies = $ this -> getMethodDependencies ( $ closureRef , $ args ) ; return $ closureRef -> invokeArgs ( $ dependencies ) ; } | Resolve closure and return its result |
58,962 | protected function getMethodDependencies ( ReflectionFunctionAbstract $ method , array $ primitives = [ ] ) { $ params = $ method -> getParameters ( ) ; $ resolvedParams = [ ] ; $ i = 0 ; foreach ( $ params as $ param ) { if ( $ class = $ param -> getClass ( ) ) { $ resolvedParams [ ] = $ this -> make ( $ class -> getN... | Get dependencies for php method |
58,963 | public static function parse ( string $ uri ) : URI { if ( $ uri == '' ) { return new static ( ) ; } $ parts = parse_url ( $ uri ) ; if ( $ parts === false ) { throw new \ InvalidArgumentException ( sprintf ( 'Cannot parse malformed uri "%s".' , $ uri ) ) ; } if ( ! isset ( $ parts [ 'scheme' ] ) ) { throw new \ Invali... | Parses the given URI string and returns a new URI instance . |
58,964 | public function getAuthority ( ) : string { if ( $ this -> host == '' ) { return '' ; } $ authority = $ this -> host ; if ( $ this -> user != '' ) { $ authority = $ this -> user . '@' . $ authority ; } if ( $ this -> port !== null && ! $ this -> isDefaultPort ( $ this -> scheme , $ this -> port ) ) { $ authority .= ':'... | Returns the authority component of the URI . |
58,965 | public function getPort ( ) { return $ this -> port === null || $ this -> isDefaultPort ( $ this -> scheme , $ this -> port ) ? null : $ this -> port ; } | Returns the port component of the URI . |
58,966 | public function withScheme ( string $ scheme ) : URI { $ result = clone $ this ; $ result -> scheme = $ this -> filterScheme ( $ scheme ) ; return $ result ; } | Returns a new instance with the specified scheme . |
58,967 | public function withUserInfo ( string $ username , $ password = null ) : URI { $ result = clone $ this ; $ result -> user = $ username . ( ( string ) $ password != '' ? ':' . ( string ) $ password : '' ) ; return $ result ; } | Returns a new instance with the specified username and password . |
58,968 | public function withHost ( string $ host ) : URI { $ result = clone $ this ; $ result -> host = $ this -> filterHost ( $ host ) ; return $ result ; } | Returns a new instance with the specified host . |
58,969 | public function withPort ( $ port ) : URI { $ result = clone $ this ; $ result -> port = $ this -> filterPort ( $ port ) ; return $ result ; } | Returns a new instance with the specified port . |
58,970 | public function withPath ( string $ path ) : URI { $ result = clone $ this ; $ result -> path = $ this -> filterPath ( $ path ) ; return $ result ; } | Returns a new instance with the specified path . |
58,971 | public function withQuery ( string $ query ) : URI { $ result = clone $ this ; $ result -> query = $ this -> filterQuery ( $ query ) ; return $ result ; } | Returns a new instance with the specified query . |
58,972 | public function withFragment ( string $ fragment ) : URI { $ result = clone $ this ; $ result -> fragment = $ this -> filterFragment ( $ fragment ) ; return $ result ; } | Returns a new instance with the specified fragment . |
58,973 | private function isDefaultPort ( string $ scheme , int $ port ) : bool { return isset ( self :: $ knownPorts [ $ scheme ] ) && self :: $ knownPorts [ $ scheme ] == $ port ; } | Checks if the port is the default port for the scheme . |
58,974 | private function filterHost ( string $ host ) : string { return preg_replace_callback ( '/(?:[^' . self :: UNRESERVED . self :: SUB_DELIMS . ':%\[\]]+|%(?![A-Fa-f0-9]{2}))/' , function ( array $ match ) { return rawurlencode ( $ match [ 0 ] ) ; } , $ host ) ; } | Filters the host to ensure it is properly encoded . |
58,975 | private function filterPort ( $ port ) { if ( $ port === null ) { return $ port ; } if ( ! preg_match ( '#^[0-9]+$#' , ( string ) $ port ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid port "%s".' , $ port ) ) ; } return ( int ) $ port ; } | Filters the port to ensure it is a valid port . |
58,976 | private function filterPath ( string $ path ) : string { if ( $ path == '' ) { return $ path ; } $ result = preg_replace_callback ( '/(?:[^' . self :: UNRESERVED . self :: SUB_DELIMS . ':@%~\/]+|%(?![A-Za-f0-9]{2}))/' , function ( array $ match ) { return rawurlencode ( $ match [ 0 ] ) ; } , $ path ) ; if ( $ result [ ... | Filters the path to ensure it is properly encoded . |
58,977 | private function filterQuery ( string $ query ) : string { if ( trim ( $ query ) == '' ) { return '' ; } if ( $ query [ 0 ] == '?' ) { $ query = substr ( $ query , 1 ) ; } $ parts = explode ( '&' , $ query ) ; foreach ( $ parts as $ index => $ part ) { $ data = explode ( '=' , $ part ) ; $ key = array_shift ( $ data ) ... | Filters the query to ensure it is properly encoded . |
58,978 | private function filterFragment ( string $ fragment ) : string { if ( trim ( $ fragment ) == '' ) { return '' ; } if ( $ fragment [ 0 ] == '#' ) { $ fragment = substr ( $ fragment , 1 ) ; } return preg_replace_callback ( '/(?:[^' . self :: UNRESERVED . self :: SUB_DELIMS . ':@%~\/\[\]\?]+|%(?![A-Fa-f0-9]{2}))/' , funct... | Filters the fragment value to ensure it is properly encoded . |
58,979 | private function encodeQuery ( string $ value ) : string { return preg_replace_callback ( '/(?:[^' . self :: UNRESERVED . self :: SUB_DELIMS . ':@%~\/\[\]\?]+|%(?![A-Fa-f0-9]{2}))/' , function ( array $ match ) { return rawurlencode ( $ match [ 0 ] ) ; } , $ value ) ; } | Percent - encodes all necessary characters of the given query . |
58,980 | public function report ( $ parameters = [ ] ) { $ query = [ 'username' => $ this -> config -> get ( 'username' ) , 'password' => $ this -> config -> get ( 'password' ) , ] ; if ( isset ( $ parameters [ 'id' ] ) ) { $ query [ 'msg_id' ] = $ parameters [ 'id' ] ; } if ( isset ( $ parameters [ 'from' ] ) ) { $ query [ 'fr... | Get one or more SMS status |
58,981 | protected function isPathMatching ( SimpleXmlElement $ node , $ name ) { $ pathPattern = $ this -> getPathRegex ( ) ; $ childPath = $ node -> getPath ( ) . '/' . $ name ; if ( ! $ pathPattern ) { return false ; } return ( bool ) preg_match ( $ pathPattern , $ childPath ) ; } | Check if path is matching for the requested element |
58,982 | public function setPathRegex ( $ regex ) { if ( $ regex === null ) { $ this -> pathRegex = null ; return $ this ; } $ this -> pathRegex = $ regex ; return $ this ; } | Set path expression |
58,983 | public function getWidgetForPath ( $ path ) { $ this -> log -> info ( 'Getting widget for path: ' . $ path ) ; $ widget = null ; if ( ! isset ( $ this -> paths [ $ path ] ) ) { $ largest = 0 ; foreach ( $ this -> paths as $ pathReg => $ widgetItem ) { if ( ( $ match = strstr ( $ path , $ pathReg ) ) !== false && strpos... | Determines the Widget that should be used for the specified Http - Request by the Pathname that is called . |
58,984 | public function edit ( Request $ request ) { return view ( 'gzero-core::account.edit' , [ 'isUserEmailSet' => strpos ( $ request -> user ( ) -> email , '@' ) , 'timezones' => $ this -> timezones -> getAvailableTimezones ( ) ] ) ; } | Edit account settings |
58,985 | public function welcome ( Request $ request ) { if ( session ( ) -> has ( 'showWelcomePage' ) ) { session ( ) -> forget ( 'showWelcomePage' ) ; return view ( 'gzero-core::account.welcome' , [ 'method' => $ request -> get ( 'method' ) ] ) ; } return redirect ( ) -> to ( routeMl ( 'home' ) ) ; } | Show welcome page for registered user . |
58,986 | public function regenerateAction ( Request $ request ) { $ userSession = $ this -> get ( 'qcm_core.controller.user_session' ) -> findOr404 ( $ request ) ; $ generator = $ this -> get ( 'qcm_core.question.generator' ) ; $ userSession -> getConfiguration ( ) -> eraseQuestions ( ) ; $ generator -> generate ( $ userSession... | Regenerate questionnaire action |
58,987 | protected function encodeField ( $ label , $ value , array $ context ) { $ convertedLabel = $ this -> convertEncoding ( $ label , $ context ) ; $ strict = $ context [ 'strict' ] ; if ( $ strict ) { $ this -> assertLabel ( $ convertedLabel ) ; } if ( $ value === null ) { $ value = '' ; } if ( is_object ( $ value ) && me... | Serialize LTSV field . |
58,988 | protected function resolveEngine ( $ template ) { $ reference = $ this -> resolver -> resolve ( $ template ) ; $ engine = $ reference -> get ( 'engine' ) ; $ engineService = 'templating.engine.' . $ engine ; if ( ! $ this -> container -> has ( $ engineService ) ) { throw new \ RuntimeException ( sprintf ( 'Template eng... | Resolve template engine from name . |
58,989 | protected function getUser ( $ userId ) { $ user = $ this -> users -> read ( $ userId ) ; if ( isset ( $ user ) ) { $ user [ 'roles' ] = $ this -> getRoles ( $ userId ) ; } return $ user ; } | Return user array with roles |
58,990 | protected function getRoles ( $ userId ) { $ roles = [ ] ; $ result = $ this -> userRoles -> query ( new RqlQuery ( new EqNode ( $ this -> config [ 'userIdInUserRoles' ] , $ userId ) ) ) ; foreach ( $ result as $ item ) { $ role = $ this -> roles -> read ( $ item [ $ this -> config [ 'roleIdInUserRoles' ] ] ) ; if ( is... | Return array with user s roles |
58,991 | private function createArrayLines ( array $ data , $ prefix = '' ) { $ content = '' ; foreach ( $ data as $ key => $ value ) { $ newKey = "{$prefix}[$key]" ; if ( is_array ( $ value ) ) { $ content .= $ this -> createArrayLines ( $ value , $ newKey ) ; continue ; } $ content .= $ this -> createPropertyLine ( $ newKey ,... | Create flat data array |
58,992 | public function write ( $ file ) { $ content = '' ; if ( $ this -> section ) { $ content .= "[{$this->section}]\n" ; } foreach ( $ this -> data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ content .= $ this -> createArrayLines ( $ value , $ key ) ; continue ; } $ content .= $ this -> createPropertyLine ( $ k... | Write config file |
58,993 | public function argumentModeRequired ( $ name , $ description , $ defaultValue = null ) { $ mode = InputArgument :: REQUIRED ; return [ $ name , $ mode , $ description , $ defaultValue ] ; } | Build required argument rule |
58,994 | public function argumentModeOptional ( $ name , $ description , $ defaultValue = null ) { $ mode = InputArgument :: OPTIONAL ; return [ $ name , $ mode , $ description , $ defaultValue ] ; } | Build optional argument rule |
58,995 | public function optionModeRequired ( $ name , $ description , $ defaultValue = null ) { $ shortcut = null ; $ mode = InputOption :: VALUE_REQUIRED ; return [ $ name , $ shortcut , $ mode , $ description , $ defaultValue ] ; } | Build required option rule |
58,996 | public function optionModeOptional ( $ name , $ description , $ defaultValue = null ) { $ shortcut = null ; $ mode = InputOption :: VALUE_OPTIONAL ; return [ $ name , $ shortcut , $ mode , $ description , $ defaultValue ] ; } | Build optional option rule |
58,997 | public function setRedirect ( FormEvent $ event ) { $ targetPath = $ this -> getTargetPath ( $ event -> getRequest ( ) ) ; if ( $ targetPath ) { $ event -> setResponse ( new RedirectResponse ( $ targetPath ) ) ; return ; } $ this -> setRedirecToLogin ( $ event ) ; } | Redirect the user to the target path or default to the login . |
58,998 | protected function setRedirecToLogin ( Event $ event ) { $ url = $ this -> router -> generate ( 'fos_user_security_login' ) ; $ event -> setResponse ( new RedirectResponse ( $ url ) ) ; } | Sets the response to a redirect to the login page . |
58,999 | protected function getTargetPath ( Request $ request ) { $ targetPath = $ request -> request -> get ( 'target_path' ) ; if ( ! $ targetPath ) { $ targetPath = $ request -> query -> get ( 'target_path' ) ; } return $ targetPath ; } | Find the target path in the POST or GET . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.