idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
8,400 | public function setStack ( array $ stack ) : void { $ this -> stack = [ ] ; foreach ( $ stack as $ event ) { if ( ! $ event instanceof Event ) { throw new EventException ( 'Stack elements must be instanceof froq\event\Event object' ) ; } $ this -> stack [ $ this -> normalizeName ( $ event -> getName ( ) ) ] = $ event ;... | Set stack . |
8,401 | public function validate ( Control $ control ) : bool { $ value = $ control -> getSubmittedValue ( ) ; if ( $ value === '' || $ value === null || $ value === false ) { return true ; } if ( ! is_scalar ( $ value ) ) { return false ; } $ email = filter_var ( $ value , FILTER_VALIDATE_EMAIL ) ; if ( $ email !== $ value ) ... | Returns true if the value of the form control is a valid email address . Otherwise returns false . |
8,402 | public function isEmpty ( ) { return $ this -> isNull ( ) || ( is_array ( $ this -> value ) && count ( $ this -> value ) === 0 ) || $ this -> length ( ) === 0 ; } | checks if parameter is empty |
8,403 | public function length ( ) { if ( $ this -> isNull ( ) || ( is_string ( $ this -> value ) && strlen ( $ this -> value ) === 0 ) ) { return 0 ; } if ( is_string ( $ this -> value ) ) { return strlen ( $ this -> value ) ; } return strlen ( current ( $ this -> value ) ) ; } | returns length of value |
8,404 | public function addError ( $ error , array $ details = [ ] ) { $ error = ParamError :: fromData ( $ error , $ details ) ; $ this -> errors [ $ error -> id ( ) ] = $ error ; return $ error ; } | adds error with given id |
8,405 | public function readParam ( string $ paramName ) : ValueReader { return new ValueReader ( $ this -> params -> errors ( ) , $ paramName , $ this -> params -> value ( $ paramName ) ) ; } | returns request value from params for filtering or validation |
8,406 | private function rollOver ( ) { if ( $ this -> maxBackupIndex > 0 ) { $ file = $ this -> file . '.' . $ this -> maxBackupIndex ; if ( file_exists ( $ file ) && ! unlink ( $ file ) ) { throw new \ n2n \ log4php \ LoggerException ( "Unable to delete oldest backup file from [$file]." ) ; } $ this -> renameArchievedLogs ( ... | Implements the usual roll over behaviour . |
8,407 | protected function write ( $ string ) { if ( ! isset ( $ this -> fp ) ) { if ( $ this -> openFile ( ) === false ) { return ; } } if ( \ n2n \ io \ IoUtils :: flock ( $ this -> fp , LOCK_EX ) ) { if ( \ n2n \ io \ IoUtils :: fwrite ( $ this -> fp , $ string ) === false ) { $ this -> warn ( "Failed writing to file. Closi... | Writes a string to the target file . Opens file if not already open . |
8,408 | public static function createFromStyler ( Styler $ styler ) : Writer { $ classname = \ get_called_class ( ) ; $ instance = new $ classname ; $ instance -> styler = $ styler ; $ instance -> reader = $ styler -> getReader ( ) ; return $ instance ; } | Importa os dados a partir do Styler |
8,409 | public function getStyler ( ) : Styler { if ( $ this -> styler == null ) { $ this -> styler = Styler :: createFromReader ( $ this -> getReader ( ) ) ; } return $ this -> styler ; } | Devolve a instancia do Styler . |
8,410 | public static function getMetaTags ( $ params , $ config = [ ] ) { if ( empty ( $ params [ 'model' ] ) ) { return ; } $ config [ 'model' ] = $ params [ 'model' ] ; $ config [ 'summary' ] = $ params [ 'summary' ] ; $ config [ 'homePage' ] = isset ( $ params [ 'homePage' ] ) ? $ params [ 'homePage' ] : 'home' ; $ meta = ... | Helper to generate tags |
8,411 | private function generateTwitterCard ( $ banner , $ metaContent ) { $ properties = TwitterMetaProperties :: getInstance ( ) ; if ( $ properties -> isActive ( ) ) { $ card = $ properties -> getCard ( ) ; $ site = $ properties -> getSite ( ) ; $ creator = $ properties -> getCreator ( ) ; $ model = $ this -> model ; $ sum... | Generate and return appropriate Twitter Card . |
8,412 | public function execute ( AMQPMessage $ msg ) { $ logger = $ this -> container -> get ( "logger" ) ; $ jsonBody = json_decode ( $ msg -> body ) ; if ( $ jsonBody == null ) { $ logger -> error ( "JSON NULL" ) ; return false ; } $ messagePackageId = json_decode ( $ msg -> body ) -> messagePackageId ; $ logger -> error ( ... | Process the message |
8,413 | private function load ( $ url ) { if ( ! file_exists ( $ url ) ) { throw new \ n2n \ log4php \ LoggerException ( "File [$url] does not exist." ) ; } $ properties = \ n2n \ io \ IoUtils :: parseIniFile ( $ url , true ) ; if ( $ properties === false ) { $ error = error_get_last ( ) ; throw new \ n2n \ log4php \ LoggerExc... | Loads and parses the INI configuration file . |
8,414 | private function parseAppender ( $ key , $ value ) { $ subKey = substr ( $ key , strlen ( self :: APPENDER_PREFIX ) ) ; $ parts = explode ( '.' , $ subKey ) ; $ count = count ( $ parts ) ; $ name = trim ( $ parts [ 0 ] ) ; if ( $ count == 1 ) { $ this -> config [ 'appenders' ] [ $ name ] [ 'class' ] = $ value ; return ... | Parses an configuration line pertaining to an appender . |
8,415 | final public static function nowSql ( ) { try { $ date = new \ DateTimeImmutable ( null , self :: tzUtc ( ) ) ; return $ date -> format ( 'Y-m-d H:i:s' ) ; } catch ( \ Exception $ e ) { return null ; } } | Current date in SQL format |
8,416 | final public static function asSql ( $ date ) { if ( ! empty ( $ date ) ) { if ( $ date instanceof \ DateTimeInterface ) { return $ date -> format ( 'Y-m-d H:i:sO' ) ; } else { return self :: asDateTime ( $ date ) -> format ( 'Y-m-d H:i:sO' ) ; } } else { return null ; } } | Date in SQL format |
8,417 | final public static function dateSqlUtcToIsoOffset ( $ date , $ default = null ) { if ( ! empty ( $ date ) ) { $ date = self :: asDateTime ( $ date ) ; $ date -> setTimezone ( self :: tzUtc ( ) ) ; return $ date -> format ( "Y-m-d\TH:i:sP" ) ; } else { return $ default ; } } | Convert ISO offset datetime to SQL string |
8,418 | public function contains ( $ value ) : bool { if ( null === $ value ) { return false ; } if ( $ this -> belowMinBorder ( $ value ) ) { return false ; } return ! $ this -> aboveMaxBorder ( $ value ) ; } | checks if range contains given value |
8,419 | public function errorsOf ( $ value ) : array { if ( $ this -> belowMinBorder ( $ value ) ) { return $ this -> minBorderViolation ( ) ; } if ( $ this -> aboveMaxBorder ( $ value ) ) { return $ this -> maxBorderViolation ( ) ; } return [ ] ; } | returns list of errors when range does not contain given value |
8,420 | public function get ( $ version = null , $ up = true ) { $ currentVersion = $ this -> schemaTable -> getCurrentVersion ( ) ; if ( null !== $ version && false === $ up && ( int ) $ version > ( int ) $ currentVersion ) { return null ; } $ files = $ this -> getFiles ( $ up ) ; if ( ! $ this -> fileVersionExists ( $ versio... | Gets migration files . |
8,421 | protected function initDestroyJs ( ) { if ( isset ( $ this -> pluginDestroyJs ) ) { return ; } if ( empty ( $ this -> pluginName ) ) { $ this -> pluginDestroyJs = '' ; return ; } $ id = "jQuery('#" . $ this -> options [ 'id' ] . "')" ; $ plugin = $ this -> pluginName ; $ this -> pluginDestroyJs = "if ({$id}.data('{$thi... | Generates the pluginDestroyJs script if it is not set . |
8,422 | protected function addAsset ( $ view , $ file , $ type , $ class ) { if ( $ type == 'css' || $ type == 'js' ) { $ asset = $ view -> getAssetManager ( ) ; $ bundle = $ asset -> bundles [ $ class ] ; if ( $ type == 'css' ) { $ bundle -> css [ ] = $ file ; } else { $ bundle -> js [ ] = $ file ; } $ asset -> bundles [ $ cl... | Adds an asset to the view . |
8,423 | protected function registerPluginOptions ( $ name ) { $ this -> hashPluginOptions ( $ name ) ; $ encOptions = empty ( $ this -> _encOptions ) ? '{}' : $ this -> _encOptions ; $ this -> registerWidgetJs ( "window.{$this->_hashVar} = {$encOptions};\n" , $ this -> hashVarLoadPosition ) ; } | Registers plugin options by storing within a uniquely generated javascript variable . |
8,424 | protected function getPluginScript ( $ name , $ element = null , $ callback = null , $ callbackCon = null ) { $ id = $ element ? $ element : "jQuery('#" . $ this -> options [ 'id' ] . "')" ; $ script = '' ; if ( $ this -> pluginOptions !== false ) { $ this -> registerPluginOptions ( $ name ) ; $ script = "{$id}.{$name}... | Returns the plugin registration script . |
8,425 | public function registerWidgetJs ( $ js , $ pos = View :: POS_READY , $ key = null ) { if ( empty ( $ js ) ) { return ; } $ view = $ this -> getView ( ) ; $ view -> registerJs ( $ js , $ pos , $ key ) ; if ( ! empty ( $ this -> pjaxContainerId ) && ( $ pos === View :: POS_LOAD || $ pos === View :: POS_READY ) ) { $ pja... | Registers a JS code block for the widget . |
8,426 | public function find ( ReferenceableInterface $ referenceable ) { foreach ( $ this -> generators -> all ( ) as $ generator ) { if ( $ generator -> canHandle ( $ referenceable ) ) { return $ generator ; } } return null ; } | Get the generator with the highest priority that can be applied to the given entity |
8,427 | public function findAll ( ReferenceableInterface $ referenceable ) { $ generators = new ReferenceGeneratorCollection ( ) ; foreach ( $ this -> generators -> all ( ) as $ generator ) { if ( $ generator -> canHandle ( $ referenceable ) ) { $ generators -> add ( $ generator ) ; } } return $ generators ; } | Get all generators for the given entity |
8,428 | public function sendMessage ( Message $ message ) { if ( $ this -> isDisabled ( ) ) { return false ; } $ users = $ message -> getMyDestionationUsers ( $ this -> container ) ; $ sentCount = 0 ; foreach ( $ users as $ user ) { $ sentCount += $ this -> sendMessageToUser ( $ message , $ user ) ; } return $ sentCount ; } | Manda un mensaje a los usuarios que el tipo de Mensaje indique |
8,429 | public function sendRealMessageToDevice ( Message $ message , Device $ device , $ user = null , Request $ request = null ) { if ( $ this -> isDisabled ( ) ) { return false ; } $ em = $ this -> container -> get ( 'doctrine' ) -> getManager ( ) ; $ config = $ this -> container -> getParameter ( 'sopinet_chat.config' ) ; ... | Send message to User and device It functions transform to Real message data array |
8,430 | private function sendGCMessage ( $ mes , $ text , $ to ) { $ message = new AndroidMessage ( ) ; $ message -> setMessage ( $ text ) ; $ message -> setData ( $ mes ) ; $ message -> setDeviceIdentifier ( $ to ) ; $ message -> setGCM ( true ) ; try { $ response = $ this -> container -> get ( 'rms_push_notifications' ) -> s... | Funcion que envia un mensaje con el servicio GCM de Google |
8,431 | public function sendMessageToEmail ( Message $ message , $ user ) { if ( is_object ( $ user ) ) { $ toEmail = $ user -> getEmail ( ) ; } else { $ toEmail = $ user ; } if ( $ this -> container -> hasParameter ( 'mailer_email' ) ) { $ mailer_email = $ this -> container -> getParameter ( 'mailer_email' ) ; } else if ( $ t... | Send a message to Email |
8,432 | public function iSubmitTheFormWithId ( $ arg ) { $ node = $ this -> minkContext -> getSession ( ) -> getPage ( ) -> find ( 'css' , $ arg ) ; if ( $ node ) { $ this -> minkContext -> getSession ( ) -> executeScript ( "jQuery('$arg').submit();" ) ; } else { throw new \ Exception ( 'Element not found' ) ; } } | Some forms do not have a Submit button just pass the ID |
8,433 | public function iClickOnTheText ( $ text ) { $ session = $ this -> getSession ( ) ; $ element = $ session -> getPage ( ) -> find ( 'xpath' , $ session -> getSelectorsHandler ( ) -> selectorToXpath ( 'xpath' , '*//*[text()="' . $ text . '"]' ) ) ; if ( null === $ element ) { $ element = $ session -> getPage ( ) -> find ... | Click some text |
8,434 | public function getAvailableEventClasses ( ) { $ repository = $ this -> getRepository ( ) ; return $ repository -> newQuery ( ) -> get ( ) -> map ( function ( $ v ) { return $ v -> event_class ; } ) -> toArray ( ) ; } | Retrieve all events_class available . |
8,435 | public function prepareRecordPaginator ( ) { $ page = $ this -> getRequest ( ) -> get ( 'page' , 1 ) ; $ this -> getRecordPaginator ( ) -> setPage ( intval ( $ page ) ) ; $ this -> getRecordPaginator ( ) -> setItemsPerPage ( 50 ) ; } | Prepare Record Paginator Object |
8,436 | public function activateOptions ( ) { if ( ! isset ( $ this -> pattern ) ) { throw new \ n2n \ log4php \ LoggerException ( "Mandatory parameter 'conversionPattern' is not set." ) ; } $ parser = new \ n2n \ log4php \ pattern \ PatternParser ( $ this -> pattern , $ this -> converterMap ) ; $ this -> head = $ parser -> pa... | Processes the conversion pattern and creates a corresponding chain of pattern converters which will be used to format logging events . |
8,437 | public function format ( \ n2n \ log4php \ logging \ LoggingEvent $ event ) { $ sbuf = '' ; $ converter = $ this -> head ; while ( $ converter !== null ) { $ converter -> format ( $ sbuf , $ event ) ; $ converter = $ converter -> next ; } return $ sbuf ; } | Produces a formatted string as specified by the conversion pattern . |
8,438 | public function append ( $ line , bool $ trim = true ) : void { switch ( true ) { case is_string ( $ line ) : $ this -> appendLine ( $ line , $ trim ) ; break ; case is_array ( $ line ) : $ this -> appendLines ( $ line , $ trim ) ; break ; case is_null ( $ line ) : break ; default : throw new \ InvalidArgumentException... | Appends a line or lines of code . |
8,439 | public function appendToLastLine ( string $ part ) : void { $ this -> lines [ count ( $ this -> lines ) - 1 ] .= $ part ; } | Appends a part of code to the last line of code . |
8,440 | public function getCode ( ) : string { $ lines = [ ] ; $ indentLevel = 0 ; foreach ( $ this -> lines as $ line ) { $ mode = $ this -> indentationMode ( $ line ) ; if ( $ mode & self :: C_INDENT_INCREMENT_BEFORE ) { $ indentLevel ++ ; } if ( $ mode & self :: C_INDENT_DECREMENT_BEFORE ) { $ indentLevel = max ( 0 , $ inde... | Returns the generated code properly indented as a single string . |
8,441 | private function addIndentation ( string $ line , int $ indentLevel ) : string { return ( $ line === '' ) ? '' : str_repeat ( ' ' , $ this -> indentation * $ indentLevel ) . $ line ; } | Returns a line of code with the proper amount of indentationMode . |
8,442 | private function appendLine ( ? string $ line , bool $ trim ) : void { if ( $ line === null ) return ; if ( $ trim ) $ line = trim ( $ line ) ; $ this -> lines [ ] = $ line ; } | Appends a line of code this this code . |
8,443 | private function appendLines ( array $ lines , bool $ trim ) : void { foreach ( $ lines as $ line ) { $ this -> appendLine ( $ line , $ trim ) ; } } | Appends an array with lines of code this this code . |
8,444 | public function addColumn ( TableColumn $ column ) : void { $ this -> columns [ $ this -> columnIndex ] = $ column ; $ column -> onAddColumn ( $ this , $ this -> columnIndex ) ; $ this -> columnIndex += $ column -> getColSpan ( ) ; } | Adds a column to this table . |
8,445 | public function getHtmlTable ( array $ rows ) : string { $ this -> prepare ( ) ; $ ret = $ this -> getHtmlPrefix ( ) ; $ ret .= Html :: generateTag ( 'table' , $ this -> attributes ) ; $ ret .= '<colgroup>' ; foreach ( $ this -> columns as $ column ) { if ( ! $ this -> sortable ) $ column -> notSortable ( ) ; $ ret .= ... | Returns the HTML code of this table |
8,446 | protected function getHtmlBody ( array $ rows ) : string { $ ret = '' ; $ i = 0 ; foreach ( $ rows as $ row ) { $ class = static :: $ class ; if ( $ class !== null ) $ class .= ' ' ; $ class .= ( $ i % 2 == 0 ) ? 'even' : 'odd' ; $ ret .= Html :: generateTag ( 'tr' , [ 'class' => $ class ] ) ; foreach ( $ this -> colum... | Returns the inner HTML code of the body for this table holding the rows as data . |
8,447 | protected function getHtmlHeader ( ) : string { $ ret = '' ; if ( $ this -> title ) { $ mode = 1 ; $ colspan = 0 ; $ ret .= '<tr class="title">' ; foreach ( $ this -> columns as $ column ) { $ empty = $ column -> hasEmptyHeader ( ) ; if ( $ mode == 1 ) { if ( $ empty ) { $ ret .= '<th class="empty"></th>' ; } else { $ ... | Returns the inner HTML code of the header for this table . |
8,448 | private function prepare ( ) : void { $ this -> addClass ( static :: $ class ) ; if ( static :: $ responsiveMediaQuery !== null && $ this -> getAttribute ( 'id' ) === null ) { $ this -> setAttrId ( Html :: getAutoId ( ) ) ; } } | Prepares this table for generation HTML code . |
8,449 | private function getDate ( Request $ request , Annotation $ annotation , $ type ) { $ nameMethod = 'get' . $ type . 'Name' ; return $ this -> readValue ( $ request , $ annotation -> $ nameMethod ( ) , $ annotation -> isRequired ( ) , $ this -> parseDate ( $ annotation , 'default' . $ type ) ) -> asDate ( new DateRange ... | retrieves start date |
8,450 | private function parseDate ( Annotation $ annotation , string $ field ) { if ( $ annotation -> hasValueByName ( $ field ) ) { return new Date ( $ annotation -> getValueByName ( $ field ) ) ; } return null ; } | reads default value from annotation |
8,451 | protected static function getHtmlRowHeader ( $ header ) : string { $ html = '<th>' ; $ html .= ( is_int ( $ header ) ) ? Abc :: $ babel -> getWord ( $ header ) : $ header ; $ html .= '</th>' ; return $ html ; } | Returns the HTML code for the header of the row . |
8,452 | public function getHtmlTable ( ) : string { $ this -> addClass ( static :: $ class ) ; $ ret = $ this -> getHtmlPrefix ( ) ; $ ret .= Html :: generateTag ( 'table' , $ this -> attributes ) ; $ childAttributes = [ 'class' => static :: $ class ] ; $ ret .= Html :: generateTag ( 'thead' , $ childAttributes ) ; $ ret .= $ ... | Returns the HTML code of this table . |
8,453 | public function newInstanceQuery ( array $ data , array $ selectable = [ '*' ] ) : Builder { $ tm = new TextGenerator ( ) ; $ r = $ this -> newInstanceData ( ) ; $ query = $ r -> newQuery ( ) ; if ( ! empty ( $ this -> filter ) ) { $ filter = new Filter ( $ r -> getTableName ( ) , $ selectable ) ; $ filter -> build ( $... | New query instance . |
8,454 | public function newInstanceData ( ) { $ className = $ this -> class_name ; $ arguments = ( array ) Yaml :: parse ( strval ( $ this -> class_arguments ) ) ; return new $ className ( ... $ arguments ) ; } | New instance data builder custom . |
8,455 | public function apply ( ComparableCollectionInterface $ sourceCollection , bool $ keepOriginalOrder = false ) : ComparableCollectionInterface { $ collectionClass = get_class ( $ sourceCollection ) ; $ source = $ sourceCollection -> toArray ( ) ; $ array = [ ] ; foreach ( $ this -> changes as $ key => [ $ action , $ ite... | Applies this Diff over the collection provided and returns a new one with it applied |
8,456 | public static final function toServiceMethod ( string $ serviceMethod ) : string { $ serviceMethod = ucfirst ( $ serviceMethod ) ; if ( strpos ( $ serviceMethod , '-' ) ) { $ serviceMethod = preg_replace_callback ( '~-([a-z])~i' , function ( $ match ) { return ucfirst ( $ match [ 1 ] ) ; } , $ serviceMethod ) ; } retur... | To service method . |
8,457 | private static final function isServiceExists ( string $ serviceFile , string $ serviceClass ) : bool { if ( ! file_exists ( $ serviceFile ) ) { return false ; } return class_exists ( $ serviceClass , true ) ; } | Is service exists . |
8,458 | private static final function isServiceMethodExists ( ? Service $ service , string $ serviceMethod ) : bool { return $ service && method_exists ( $ service , $ serviceMethod ) ; } | Is service method exists . |
8,459 | public static function addRow ( DetailTable $ table , $ header , ? string $ value ) : void { if ( $ value !== null && $ value !== '' ) { $ a = Html :: generateElement ( 'a' , [ 'href' => 'mailto:' . $ value ] , $ value ) ; $ table -> addRow ( $ header , [ 'class' => 'email' ] , $ a , true ) ; } else { $ table -> addRow... | Adds a row with a email address to a detail table . |
8,460 | public function registerPageMap ( ) { $ this -> pageMap [ CmsGlobal :: TYPE_PAGE ] = Page :: class ; $ this -> pageMap [ CmsGlobal :: TYPE_ARTICLE ] = Article :: class ; $ this -> pageMap [ CmsGlobal :: TYPE_POST ] = Post :: class ; } | Register page map |
8,461 | private function initializeServiceContainer ( ) { $ this -> containerManager = new ServiceContainerManager ( $ this -> dispatcher , $ this -> getLogger ( ) ) ; $ class = $ this -> getContainerClass ( ) ; $ container = $ this -> containerManager -> initializeServiceContainer ( $ class ) ; $ this -> dispatcher -> notify ... | Build a new Container or return a existing from cache |
8,462 | public function listenToMethodNotFound ( $ event ) { if ( 'getServiceContainer' == $ event [ 'method' ] ) { $ event -> setReturnValue ( $ this -> containerManager -> getServiceContainer ( ) ) ; return true ; } if ( 'getContainerBuilder' == $ event [ 'method' ] ) { $ event -> setReturnValue ( $ this -> containerManager ... | Return the Container or a Service when calling a matching method |
8,463 | public function closeModalDialog ( ScenarioEvent $ event ) { try { if ( 4 === $ event -> getResult ( ) ) { $ cmsElement = $ this -> getSession ( ) -> getPage ( ) -> find ( 'css' , '.cms' ) ; if ( $ cmsElement ) { try { $ this -> getSession ( ) -> reload ( ) ; $ this -> getSession ( ) -> getDriver ( ) -> getWebDriverSes... | Close modal dialog if test scenario fails on CMS page |
8,464 | public function cleanAssetsAfterScenario ( ScenarioEvent $ event ) { foreach ( \ File :: get ( ) as $ file ) { if ( file_exists ( $ file -> getFullPath ( ) ) ) $ file -> delete ( ) ; } } | Delete any created files and folders from assets directory |
8,465 | public function iSelectFromInputGroup ( $ value , $ labelText ) { $ page = $ this -> getSession ( ) -> getPage ( ) ; $ parent = null ; foreach ( $ page -> findAll ( 'css' , 'label' ) as $ label ) { if ( $ label -> getText ( ) == $ labelText ) { $ parent = $ label -> getParent ( ) ; } } if ( ! $ parent ) throw new \ Inv... | Select an individual input from within a group matched by the top - most label . |
8,466 | public function iSelectTheRadioButton ( $ radioLabel ) { $ session = $ this -> getSession ( ) ; $ radioButton = $ session -> getPage ( ) -> find ( 'named' , array ( 'radio' , $ this -> getSession ( ) -> getSelectorsHandler ( ) -> xpathLiteral ( $ radioLabel ) ) ) ; assertNotNull ( $ radioButton ) ; $ session -> getDriv... | Selects the specified radio button |
8,467 | public function iWaitXUntilISee ( $ wait , $ selector ) { $ page = $ this -> getSession ( ) -> getPage ( ) ; $ this -> spin ( function ( $ page ) use ( $ page , $ selector ) { $ element = $ page -> find ( 'css' , $ selector ) ; if ( empty ( $ element ) ) { return false ; } else { return $ element -> isVisible ( ) ; } }... | Wait until a certain amount of seconds till I see an element identified by a CSS selector . |
8,468 | public function iWaitUntilISee ( $ selector ) { $ page = $ this -> getSession ( ) -> getPage ( ) ; $ this -> spin ( function ( $ page ) use ( $ page , $ selector ) { $ element = $ page -> find ( 'css' , $ selector ) ; if ( empty ( $ element ) ) { return false ; } else { return ( $ element -> isVisible ( ) ) ; } } ) ; } | Wait until a particular element is visible using a CSS selector . Useful for content loaded via AJAX or only populated after JS execution . |
8,469 | public function iWaitUntilISeeText ( $ text ) { $ page = $ this -> getSession ( ) -> getPage ( ) ; $ session = $ this -> getSession ( ) ; $ this -> spin ( function ( $ page ) use ( $ page , $ session , $ text ) { $ element = $ page -> find ( 'xpath' , $ session -> getSelectorsHandler ( ) -> selectorToXpath ( "xpath" , ... | Wait until a particular string is found on the page . Useful for content loaded via AJAX or only populated after JS execution . |
8,470 | public function iScrollToField ( $ locator , $ type ) { $ page = $ this -> getSession ( ) -> getPage ( ) ; $ el = $ page -> find ( 'named' , array ( $ type , "'$locator'" ) ) ; assertNotNull ( $ el , sprintf ( '%s element not found' , $ locator ) ) ; $ id = $ el -> getAttribute ( 'id' ) ; if ( empty ( $ id ) ) { throw ... | Scroll to a certain element by label . Requires an id attribute to uniquely identify the element in the document . |
8,471 | public function iScrollToElement ( $ locator ) { $ el = $ this -> getSession ( ) -> getPage ( ) -> find ( 'css' , $ locator ) ; assertNotNull ( $ el , sprintf ( 'The element "%s" is not found' , $ locator ) ) ; $ id = $ el -> getAttribute ( 'id' ) ; if ( empty ( $ id ) ) { throw new \ InvalidArgumentException ( 'Elemen... | Scroll to a certain element by CSS selector . Requires an id attribute to uniquely identify the element in the document . |
8,472 | public function getByRegistrationToken ( $ code ) { $ builder = $ this -> createQueryBuilder ( 'u' ) ; return $ builder -> where ( 'u.registrationConfirmToken.id=:code' ) -> andWhere ( $ builder -> expr ( ) -> isNotNull ( 'u.registrationConfirmToken.id' ) ) -> setParameter ( 'code' , $ code ) -> setMaxResults ( 1 ) -> ... | Find user by registration confirmation code |
8,473 | public function find ( string $ uuid , int $ max_version = null , int $ min_version = null ) : array { return $ this -> findEventObjects ( EventStreamObject :: class , $ uuid , $ max_version , $ min_version ) ; } | Returns Event Stream Objects for a given Uuid . |
8,474 | public function findQeued ( string $ uuid , int $ max_version = null , int $ min_version = null , int $ user ) : array { $ eventQeueObjects = $ this -> findEventObjects ( EventQeueObject :: class , $ uuid , $ max_version , $ min_version , $ user ) ; return array_map ( function ( $ eventQeueObject ) { return $ eventQeue... | Returns qeued Event Stream Objects for a given Uuid and User . |
8,475 | public function findEventObjects ( string $ objectClass , string $ uuid , int $ max_version = null , int $ min_version = null , int $ user = null ) : array { $ criteria = new Criteria ( ) ; $ criteria -> where ( Criteria :: expr ( ) -> eq ( 'uuid' , $ uuid ) ) ; if ( null !== $ max_version ) { $ criteria -> andWhere ( ... | Returns Event Objects for a given Uuid . |
8,476 | public function save ( ) : void { try { $ this -> em -> flush ( ) ; } catch ( OptimisticLockException $ e ) { $ this -> messageBus -> dispatch ( new Message ( $ e -> getMessage ( ) , $ e -> getCode ( ) , null , null , $ e ) ) ; } catch ( UniqueConstraintViolationException $ e ) { $ this -> messageBus -> dispatch ( new ... | Saves the events to the Event Store . |
8,477 | public function predecessor ( ) { if ( $ this -> information & 2 ) { $ node = $ this -> left ; while ( $ node -> information & 1 ) { $ node = $ node -> right ; } return $ node ; } else { return $ this -> left ; } } | Get the predecessor |
8,478 | public function successor ( ) { if ( $ this -> information & 1 ) { $ node = $ this -> right ; while ( $ node -> information & 2 ) { $ node = $ node -> left ; } return $ node ; } else { return $ this -> right ; } } | Get the successor |
8,479 | public function find ( $ key , $ comparator , $ type = 0 ) { $ cmp = - 1 ; $ node = $ this ; while ( true ) { $ cmp = $ comparator -> compare ( $ key , $ node -> fKey ) ; if ( $ cmp < 0 && $ node -> information & 2 ) { $ node = $ node -> left ; } elseif ( $ cmp > 0 && $ node -> information & 1 ) { $ node = $ node -> ri... | Get the node for a key |
8,480 | private function rotateLeft ( ) { $ right = $ this -> right ; if ( $ right -> information & 2 ) { $ this -> right = $ right -> left ; $ right -> left = $ this ; } else { $ right -> information |= 2 ; $ this -> information &= ~ 1 ; } $ this -> information -= 4 ; if ( $ right -> information >= 4 ) { $ this -> information... | Rotate the node to the left |
8,481 | private function rotateRight ( ) { $ left = $ this -> left ; if ( $ left -> information & 1 ) { $ this -> left = $ left -> right ; $ left -> right = $ this ; } else { $ this -> information &= ~ 2 ; $ left -> information |= 1 ; } $ this -> information += 4 ; if ( $ left -> information < 0 ) { $ this -> information -= $ ... | Rotate the node to the right |
8,482 | private function incBalance ( ) { $ this -> information += 4 ; if ( $ this -> information >= 8 ) { if ( $ this -> right -> information < 0 ) { $ this -> right = $ this -> right -> rotateRight ( ) ; } return $ this -> rotateLeft ( ) ; } return $ this ; } | Increment the balance of the node |
8,483 | private function decBalance ( ) { $ this -> information -= 4 ; if ( $ this -> information < - 4 ) { if ( $ this -> left -> information >= 4 ) { $ this -> left = $ this -> left -> rotateLeft ( ) ; } return $ this -> rotateRight ( ) ; } return $ this ; } | Decrement the balance of the node |
8,484 | private function pullUpLeftMost ( ) { if ( $ this -> information & 2 ) { $ leftBalance = $ this -> left -> information & ~ 3 ; $ this -> left = $ this -> left -> pullUpLeftMost ( ) ; if ( ! ( $ this -> information & 2 ) || $ leftBalance != 0 && ( $ this -> left -> information & ~ 3 ) == 0 ) { return $ this -> incBalanc... | Pull up the left most node of a node |
8,485 | public function remove ( $ key , $ comparator ) { $ cmp = $ comparator -> compare ( $ key , $ this -> fKey ) ; if ( $ cmp < 0 ) { if ( $ this -> information & 2 ) { $ leftBalance = $ this -> left -> information & ~ 3 ; $ this -> left = $ this -> left -> remove ( $ key , $ comparator ) ; if ( ! ( $ this -> information &... | Remove a key |
8,486 | public function raw ( array $ schema , array $ data ) { $ errors = new Collection ( ) ; if ( count ( $ schema ) !== 0 ) { $ validator = IlluminateValidator :: make ( $ data , $ schema ) ; foreach ( $ validator -> errors ( ) -> getMessages ( ) as $ key => $ error ) { $ errors [ ] = new Exceptions \ DataBuilderInputExcep... | Validate input submitted . |
8,487 | protected static function mintName ( $ ver , $ node , $ ns ) : string { if ( empty ( $ node ) ) { throw new \ InvalidArgumentException ( 'A name-string is required for Version 3 or 5 UUIDs.' ) ; } $ ns = static :: makeBin ( $ ns , 16 ) ; if ( null === $ ns ) { throw new \ InvalidArgumentException ( 'A binary namespace ... | Generates a Version 3 or Version 5 UUID . These are derived from a hash of a name and its namespace in binary form . |
8,488 | protected static function mintRand ( ) : string { $ uuid = static :: randomBytes ( 16 ) ; $ uuid [ 8 ] = \ chr ( \ ord ( $ uuid [ 8 ] ) & static :: CLEAR_VAR | static :: VAR_RFC ) ; $ uuid [ 6 ] = \ chr ( \ ord ( $ uuid [ 6 ] ) & static :: CLEAR_VER | static :: VERSION_4 ) ; return $ uuid ; } | Generate a Version 4 UUID . These are derived solely from random numbers . generate random fields |
8,489 | public static function compare ( string $ a , string $ b ) : string { return static :: makeBin ( $ a , 16 ) === static :: makeBin ( $ b , 16 ) ; } | Compares the binary representations of two UUIDs . The comparison will return true if they are bit - exact or if neither is valid . |
8,490 | public static function validate ( string $ uuid ) : bool { return ( boolean ) \ preg_match ( '~' . static :: VALID_UUID_REGEX . '~' , static :: import ( $ uuid ) -> string ) ; } | Import and validate an UUID |
8,491 | public function onServerStart ( ServerEvent $ event ) { $ event = $ event -> getEventLoop ( ) ; $ em = $ this -> container -> get ( 'doctrine.orm.default_entity_manager' ) ; $ reDevice = $ em -> getRepository ( 'SopinetChatBundle:Device' ) ; $ devices = $ reDevice -> findByDeviceType ( Device :: TYPE_WEB ) ; foreach ( ... | Called whenever server start |
8,492 | public function getFieldsMap ( ) { $ formFields = $ this -> fields ; $ formFieldsMap = array ( ) ; foreach ( $ formFields as $ formField ) { $ formFieldsMap [ $ formField -> name ] = $ formField ; } return $ formFieldsMap ; } | Generate and return the map of form submit fields . |
8,493 | private function createFileAt ( string $ path , File $ file ) { if ( $ file instanceof Directory ) { $ folder = $ path . '/' . ( string ) $ file -> name ( ) ; if ( $ this -> files -> contains ( $ folder ) && $ this -> files -> get ( $ folder ) === $ file ) { return ; } $ this -> filesystem -> mkdir ( $ folder ) ; $ fil... | Create the wished file at the given absolute path |
8,494 | private function open ( string $ folder , string $ file ) : File { $ path = $ folder . '/' . $ file ; if ( is_dir ( $ path ) ) { $ object = new Directory \ Directory ( $ file , ( function ( $ folder ) { $ handle = opendir ( $ folder ) ; while ( ( $ name = readdir ( $ handle ) ) !== false ) { if ( \ in_array ( $ name , ... | Open the file in the given folder |
8,495 | public function getHtml ( ) : string { $ this -> prepareOverviewTable ( ) ; if ( ! empty ( $ this -> templateData ) ) { $ this -> setAttrData ( 'slat-name' , $ this -> submitName ) ; $ this -> templateData [ $ this -> templateKey ] = 0 ; $ row = $ this -> rowFactory -> createRow ( $ this , $ this -> templateData ) ; $ ... | Returns the HTML code of displaying the form controls of this complex form control in a table . |
8,496 | public function setFooterControl ( Control $ control ) : void { $ this -> footerControl = $ control ; $ this -> addFormControl ( $ control ) ; } | Sets the footer form control of this table form control . |
8,497 | public function setTemplate ( array $ data , string $ key ) : void { $ this -> templateData = $ data ; $ this -> templateKey = $ key ; } | Sets the template data and key of the key for dynamically adding additional rows to form . |
8,498 | protected function getHtmlBody ( ) : string { $ ret = '' ; $ i = 0 ; foreach ( $ this -> controls as $ control ) { if ( $ control !== $ this -> footerControl ) { $ control -> addClass ( OverviewTable :: $ class ) ; $ control -> addClass ( ( $ i % 2 == 0 ) ? 'even' : 'odd' ) ; $ ret .= $ control -> getHtml ( ) ; $ i ++ ... | Returns the inner HTML code of the tbody element of this table form control . |
8,499 | private function prepareOverviewTable ( ) : void { $ this -> addClass ( OverviewTable :: $ class ) ; if ( OverviewTable :: $ responsiveMediaQuery !== null && $ this -> getAttribute ( 'id' ) === null ) { $ this -> setAttrId ( Html :: getAutoId ( ) ) ; } } | Prepares the Overview table part for generation HTML code . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.