idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
8,500 | public function run ( $ queue = 'queue' ) { echo ' * Worker online. waiting for tasks.' , "\n" ; $ callback = function ( $ message ) { echo " * a task is received" , "\n" ; $ data = json_decode ( $ message -> body , true ) ; $ app = ucfirst ( $ data [ 'APPLICATION' ] ) ; $ app = substr ( $ app , 1 ) . '\\Job\\' ; $ tas... | Run the jobs |
8,501 | public function getResourceName ( ) { return $ this -> name !== null ? $ this -> name : str_replace ( '_' , '-' , ( new Inflector ( ) ) -> tableize ( $ this -> getManager ( ) -> getName ( ) ) ) ; } | Retrieve resource name . |
8,502 | public function parseKey ( $ key ) { $ keys = explode ( '.' , $ key ) ; if ( count ( $ keys ) === 1 ) { $ keys = [ $ this -> getManager ( ) -> getRepository ( ) -> newEntity ( ) -> getTable ( ) , $ keys [ 0 ] ] ; } return DB :: raw ( '`' . implode ( '.' , array_slice ( $ keys , 0 , - 1 ) ) . '`.' . $ keys [ count ( $ k... | Parse the key before using it in the query . |
8,503 | public function getFractalTransformer ( EntityContract $ entity = null , Request $ request ) : TransformerAbstract { $ classTransformer = $ this -> transformerClass ; return new $ classTransformer ( $ this -> getManager ( ) , $ request ) ; } | Create a new instance of fractal transformer . |
8,504 | public function getResourceBaseUrl ( Request $ request ) : string { return $ request -> getSchemeAndHttpHost ( ) . Config :: get ( 'amethyst.api.http.' . explode ( '.' , Route :: getCurrentRoute ( ) -> getName ( ) ) [ 0 ] . '.router.prefix' ) ; } | Retrieve url base . |
8,505 | public function getFractalManager ( Request $ request ) { $ manager = new Fractal \ Manager ( ) ; $ manager -> setSerializer ( new JsonApiSerializer ( $ this -> getResourceBaseUrl ( $ request ) ) ) ; if ( $ request -> input ( 'include' ) !== null ) { $ manager -> parseIncludes ( $ request -> input ( 'include' ) ) ; } r... | Retrieve fractal manager . |
8,506 | public function setVerticalAlign ( $ verticalAlign ) { if ( ! in_array ( $ verticalAlign , [ static :: TOP , static :: CENTER , static :: BOTTOM ] , true ) ) { throw new \ InvalidArgumentException ( '$verticalAlign argument must be one of: ImagesGroupConfig::TOP, ImagesGroupConfig::CENTER, ImagesGroupConfig::BOTTOM' ) ... | Set vertical align for images with fit mode CONTAIN and COVER |
8,507 | public function setImageType ( $ mimeType ) { if ( ! in_array ( $ mimeType , [ self :: SAME_AS_ORIGINAL , self :: GIF , self :: PNG , self :: JPEG , self :: SVG ] , true ) ) { throw new \ InvalidArgumentException ( "\$mimeType '{$mimeType}' is not supported" ) ; } $ this -> alterImageType = $ mimeType ; return $ this ;... | Change image type |
8,508 | public function messagesFor ( ParamError $ error ) : array { return $ error -> fillMessages ( $ this -> properties ( ) -> section ( $ error -> id ( ) ) ) ; } | creates a list of message for given param error |
8,509 | public function messageFor ( ParamError $ error , string $ locale = null ) : LocalizedMessage { $ usedLocale = $ this -> selectLocale ( $ error -> id ( ) , $ locale ) ; return $ error -> fillMessage ( $ this -> properties ( ) -> value ( $ error -> id ( ) , $ usedLocale , '' ) , $ usedLocale ) ; } | creates message for given param error in given locale |
8,510 | private function selectLocale ( string $ errorId , string $ requestedLocale = null ) : string { $ properties = $ this -> properties ( ) ; if ( null !== $ requestedLocale ) { if ( $ properties -> containValue ( $ errorId , $ requestedLocale ) ) { return $ requestedLocale ; } $ baseLocale = substr ( $ requestedLocale , 0... | selects locale based on availability of translations |
8,511 | private function properties ( ) : Properties { static $ properties = null ; if ( null === $ properties ) { $ properties = new Properties ( ) ; foreach ( $ this -> resourceLoader -> availableResourceUris ( 'input/error/message.ini' ) as $ resourceUri ) { $ properties = $ properties -> merge ( Properties :: fromFile ( $ ... | parses properties from property files |
8,512 | private function getHeaders ( ) { $ result = [ ] ; foreach ( $ this -> headers as $ name => $ value ) { $ result [ ] = sprintf ( "%s: %s" , $ name , $ value ) ; } return $ result ; } | Convert name = > value headers to strings |
8,513 | public function unsetOption ( $ key ) { if ( isset ( $ this -> options [ $ key ] ) ) { unset ( $ this -> options [ $ key ] ) ; } return $ this ; } | Unset a single curl option |
8,514 | public function reset ( ) { if ( $ this -> curl !== null ) { curl_close ( $ this -> curl ) ; } $ this -> unsetOptions ( ) ; $ this -> curl = null ; $ this -> response = null ; $ this -> responseCode = null ; return $ this ; } | Total reset of options responses etc . |
8,515 | public function getOption ( $ key ) { $ mergesOptions = $ this -> getOptions ( ) ; return isset ( $ mergesOptions [ $ key ] ) ? $ mergesOptions [ $ key ] : false ; } | Return a single option |
8,516 | public function getOptions ( ) { $ options = [ ] ; if ( sizeof ( $ this -> headers ) > 0 ) { $ options = [ CURLOPT_HTTPHEADER => $ this -> getHeaders ( ) ] ; } return $ options + $ this -> options + $ this -> getDefaultOptions ( ) ; } | Return merged curl options and keep keys! |
8,517 | protected function getAuth ( Request $ request ) : Auth { $ auth = $ request -> getAttribute ( $ this -> authAttribute ) ; if ( ! $ auth instanceof Auth ) { throw new \ InvalidArgumentException ( 'Auth attribute not available in request' ) ; } return $ auth ; } | Get auth from request |
8,518 | private function checkValueTime ( int $ value ) { if ( $ value > - 1 && $ value < 60 ) { if ( ! isset ( $ this -> data [ 'h' ] ) && $ value < 24 ) { return "h" ; } elseif ( ! isset ( $ this -> data [ 'i' ] ) ) { return "i" ; } else { return "s" ; } } return null ; } | Verifica qual tempo utilizar |
8,519 | private function checkNameHour ( string $ time ) { if ( preg_match ( '/\s*\d{1,2}\s*(h|hour|hora|hs|hr|hrs)\s*/i' , $ time ) ) { $ this -> setCerteza ( "h" , $ time ) ; } if ( preg_match ( '/\s*\d{1,2}\s*(m|min|minuto)\s*/i' , $ time ) ) { $ this -> setCerteza ( "i" , $ time ) ; } if ( preg_match ( '/\s*\d{1,2}\s*(s|se... | Verifica Se a string encontrada diz respeito a uma hora minuto ou segundo |
8,520 | public function pass ( DataBagInterface $ dataBag ) : DataBagInterface { $ first = $ dataBag [ $ this -> first ] ?? null ; $ second = $ dataBag [ $ this -> second ] ?? null ; $ dataBag [ $ this -> first ] = $ second ; $ dataBag [ $ this -> second ] = $ first ; return $ dataBag ; } | Swap one key with another . |
8,521 | public function pass ( DataBagInterface $ dataBag ) : DataBagInterface { if ( ! ( $ this -> callback ) ( $ dataBag ) ) { throw new FlowTerminationException ( sprintf ( 'Flow was terminated by Filter (%s) for data %s.' , $ this -> getIdentifier ( ) , json_encode ( $ dataBag ) ) ) ; } return $ dataBag ; } | Filtering handler . Terminate data flow based on a callback applied to DataBag . |
8,522 | public function add ( ) { $ record = $ this -> addNewModel ( ) ; $ form = $ this -> addGetForm ( $ record ) ; if ( $ form -> execute ( ) ) { $ this -> addRedirect ( $ record ) ; } $ this -> getView ( ) -> set ( 'item' , $ record ) ; $ this -> getView ( ) -> set ( 'form' , $ form ) ; $ this -> getView ( ) -> set ( 'titl... | Add item method |
8,523 | public function duplicate ( ) { $ record = $ this -> initExistingItem ( ) ; $ record -> duplicate ( ) ; $ url = $ this -> getAfterUrl ( "after-duplicate" , $ this -> getModelManager ( ) -> getURL ( ) ) ; $ flashName = $ this -> getAfterFlashName ( "after-duplicate" , $ this -> getModelManager ( ) -> getController ( ) )... | Duplicate item action |
8,524 | protected static function getNamespaced ( $ name ) { $ baseNamespace = app ( 'app' ) -> getRootNamespace ( ) . 'Models\\' ; if ( strpos ( $ name , '\\' ) === false ) { $ name = $ name . '\\' . $ name ; } $ class = $ baseNamespace . $ name ; if ( class_exists ( $ class ) ) { return self :: initClass ( $ class ) ; } retu... | Get ModelManager from namespaced class |
8,525 | public function getImageExtensions ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_EXTENSION_IMAGE ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return preg_split ( "/,/" , $ prop ) ; } return $ default ; } | Returns the extensions allowed for images . |
8,526 | public function getVideoExtensions ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_EXTENSION_VIDEO ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return preg_split ( "/,/" , $ prop ) ; } return $ default ; } | Returns the extensions allowed for videos . |
8,527 | public function getAudioExtensions ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_EXTENSION_AUDIO ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return preg_split ( "/,/" , $ prop ) ; } return $ default ; } | Returns the extensions allowed for music and audio . |
8,528 | public function getDocumentExtensions ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_EXTENSION_DOCUMENT ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return preg_split ( "/,/" , $ prop ) ; } return $ default ; } | Returns the extensions allowed for documents . |
8,529 | public function getCompressedExtensions ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_EXTENSION_COMPRESSED ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return preg_split ( "/,/" , $ prop ) ; } return $ default ; } | Returns the extensions allowed for compressed documents . |
8,530 | public function isGenerateName ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_NAME_GENERATE ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Check whether name must be auto generated while storing the file . The given file name will be stored in title . |
8,531 | public function isPrettyName ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_NAME_PRETTY ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Check whether pretty names must be generated by hyphenating the given file name . The given file name will be stored in title . |
8,532 | public function getMaxSize ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_MAX_SIZE ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Returns the maximum size allowed for file . |
8,533 | public function getMaxResolution ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_MAX_RESOLUTION ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Returns the maximum resolution allowed for image . |
8,534 | public function isGenerateMedium ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_GENERATE_MEDIUM ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Check whether medium image must be generated while storing the image file . |
8,535 | public function getMediumWidth ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_MEDIUM_WIDTH ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Returns the width of medium image . |
8,536 | public function isGenerateThumb ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_GENERATE_THUMB ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Check whether thumb image must be generated while storing the image file . |
8,537 | public function getThumbWidth ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_THUMB_WIDTH ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Returns the width of thumb image . |
8,538 | public function isUpload ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_UPLOAD ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Checks whether file upload is allowed . |
8,539 | public function getUploadDir ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_UPLOAD_DIR ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Returns the uploads directory path to which files will be stored . |
8,540 | public function getUploadUrl ( $ default = null ) { $ prop = $ this -> properties [ self :: PROP_UPLOAD_URL ] ; if ( isset ( $ prop ) && strlen ( $ prop ) > 0 ) { return $ prop ; } return $ default ; } | Returns the uploads URL path to access file via URL . |
8,541 | public function getEventStreamObject ( ) : EventStreamObject { $ eventStreamObject = new EventStreamObject ( ) ; $ eventStreamObject -> setUuid ( $ this -> getUuid ( ) ) ; $ eventStreamObject -> setCommandUuid ( $ this -> getCommandUuid ( ) ) ; $ eventStreamObject -> setVersion ( $ this -> getVersion ( ) ) ; $ eventStr... | Transforms the EventQeueObject into an EventStreamObject and returns it . |
8,542 | public function setDados ( $ dados = null , $ default ) { if ( ! empty ( $ dados ) ) { if ( ! $ default ) $ default = json_decode ( file_get_contents ( PATH_HOME . VENDOR . "entity-form/public/entity/input_type.json" ) , true ) [ 'default' ] ; foreach ( array_replace_recursive ( $ default , $ dados ) as $ dado => $ val... | Informa dados a esta Meta |
8,543 | public function sendMessage ( Request $ request ) { $ messageHelper = $ this -> container -> get ( 'sopinet_chatbundle_messagehelper' ) ; $ apiHelper = $ this -> container -> get ( 'sopinet_apihelperbundle_apihelper' ) ; try { $ messageClassObject = $ messageHelper -> getMessageClassObject ( $ request -> get ( 'type' )... | Manda un mensaje a un Chat |
8,544 | public function delete ( bool $ recursive = true ) : bool { $ this -> each ( function ( AbstractObject $ item ) use ( $ recursive ) { if ( $ item -> isFolder ( ) ) { $ item -> delete ( $ recursive ) ; } else { $ item -> delete ( ) ; } } ) ; return true ; } | Delete all files and folders . |
8,545 | protected function createRelations ( ) { foreach ( $ this -> schema [ 'relations' ] as $ table => $ many ) { $ this -> database -> query ( 'DROP TABLE IF EXISTS `' . $ this -> schema [ 'name' ] . '_' . $ table . '`' ) ; $ this -> database -> query ( 'CREATE TABLE `' . $ this -> schema [ 'name' ] . '_' . $ table . '` ( ... | Create the relational tables |
8,546 | protected function insertFixtures ( ) { foreach ( $ this -> schema [ 'fixture' ] as $ row ) { $ model = $ this -> database -> model ( $ row ) -> save ( $ this -> schema [ 'name' ] ) ; foreach ( $ this -> schema [ 'relations' ] as $ table => $ many ) { if ( isset ( $ row [ $ this -> schema [ 'name' ] . '_' . $ table . '... | Insert fixtures while we are at it |
8,547 | private function fillSearchField ( DocumentElement $ page , $ field , $ value ) { $ driver = $ this -> getSession ( ) -> getDriver ( ) ; if ( 'Behat\Mink\Driver\Selenium2Driver' === get_class ( $ driver ) ) { $ element = $ page -> find ( 'css' , '.select2-container--open .select2-search__field' ) ; $ xpath = $ element ... | Fill Select2 search field |
8,548 | public function getForm ( $ type = null ) { if ( ! isset ( $ this -> forms [ $ type ] ) ) { $ form = $ this -> getManager ( ) -> newForm ( $ type ) ; $ this -> forms [ $ type ] = $ this -> initForm ( $ form ) ; } return $ this -> forms [ $ type ] ; } | Get Form object by name |
8,549 | public function getLocationInformation ( ) { if ( $ this -> locationInfo === null ) { $ locationInfo = array ( ) ; $ trace = debug_backtrace ( ) ; $ prevHop = null ; $ hop = array_pop ( $ trace ) ; while ( $ hop !== null ) { if ( isset ( $ hop [ 'class' ] ) ) { $ className = strtolower ( $ hop [ 'class' ] ) ; if ( ! em... | Set the location information for this logging event . The collected information is cached for future use . |
8,550 | public function getRenderedMessage ( ) { if ( $ this -> renderedMessage === null and $ this -> message !== null ) { if ( is_string ( $ this -> message ) ) { $ this -> renderedMessage = $ this -> message ; } else { $ rendererMap = \ n2n \ log4php \ Logger :: getHierarchy ( ) -> getRendererMap ( ) ; $ this -> renderedMes... | Render message . |
8,551 | public function getTime ( ) { $ eventTime = $ this -> getTimeStamp ( ) ; $ eventStartTime = LoggingEvent :: getStartTime ( ) ; return number_format ( ( $ eventTime - $ eventStartTime ) * 1000 , 0 , '' , '' ) ; } | Returns the time in milliseconds passed from the beginning of execution to the time the event was constructed . |
8,552 | public function findOneByOrderIdNotFinished ( $ orderId ) { $ qb = $ this -> createQueryBuilder ( 'p' ) ; $ qb -> select ( 'p' ) -> where ( 'p.orderId = :orderId' ) -> andWhere ( 'p.finished is NULL' ) -> setParameter ( 'orderId' , strtoupper ( $ orderId ) ) ; return $ qb -> getQuery ( ) -> getOneOrNullResult ( ) ; } | Finds Payment not finished with its orderId |
8,553 | public function getBuilder ( $ group , array $ options , array $ model , $ editMode ) { if ( ! isset ( $ options [ 'attr' ] ) ) { $ options [ 'attr' ] = array ( ) ; } $ options [ 'attr' ] [ 'class' ] = 'ucs-fieldgroup' ; $ builder = $ this -> formFactory -> createNamedBuilder ( $ group , 'form' , null , $ options ) ; $... | Create a form builder for the given group |
8,554 | public function addFromModel ( FormBuilderInterface $ builder , array $ model , $ editMode ) { foreach ( $ model as $ property => $ parameters ) { if ( isset ( $ parameters [ 'type' ] ) && $ parameters [ 'type' ] == 'group' ) { $ options = array ( ) ; if ( isset ( $ parameters [ 'options' ] ) ) { $ options = $ paramete... | Add fields to the builder from the given model |
8,555 | public function buildField ( FormBuilderInterface $ builder , $ property , array $ widget , $ editMode ) { if ( ! isset ( $ widget [ 'options' ] ) ) { $ widget [ 'options' ] = array ( ) ; } if ( ! isset ( $ widget [ 'attr' ] ) ) { $ widget [ 'attr' ] = array ( ) ; } if ( ! isset ( $ widget [ 'type' ] ) ) { throw new \ ... | Add the field to the given widget |
8,556 | protected function buildConstraints ( $ original ) { $ constraints = array ( ) ; foreach ( $ constraints as $ name => $ params ) { $ constraints [ ] = $ this -> constraintFactory -> buildConstraint ( $ name , $ params ) ; } return $ constraints ; } | Build the final constraints array frmp the original one |
8,557 | public function onSubscribe ( ConnectionInterface $ connection , Topic $ topic , WampRequest $ request ) { $ topic -> broadcast ( [ 'msg' => $ connection -> resourceId . " has joined " . $ topic -> getId ( ) ] ) ; } | This will receive any Subscription requests for this topic . |
8,558 | public function onPublish ( ConnectionInterface $ connection , Topic $ topic , WampRequest $ request , $ event , array $ exclude , array $ eligible ) { $ topic -> broadcast ( [ 'msg' => $ event ] ) ; } | This will receive any Publish requests for this topic . |
8,559 | public static function humanSize ( $ size , $ max = null , $ system = 'si' , $ retstring = '%01.2f %s' ) { $ systems = array ( ) ; $ systems [ 'si' ] [ 'suffix' ] = array ( 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' ) ; $ systems [ 'si' ] [ 'size' ] = 1000 ; $ systems [ 'bi' ] [ 'suffix' ] = array ( 'B' , 'KiB' , 'MiB' , '... | Return human readable sizes . |
8,560 | protected function setMeta ( ) { $ this -> getView ( ) -> Meta ( ) -> populateFromConfig ( $ this -> getConfig ( ) -> get ( 'meta' ) ) ; $ favicon = new Favicon ( ) ; $ favicon -> setBaseDir ( asset ( 'images/favicon' ) ) ; $ favicon -> addAll ( ) ; $ this -> getView ( ) -> set ( 'favicon' , $ favicon ) ; } | Set meta information |
8,561 | static public function valueDeleteExtender ( RecordValue $ valueContainer , $ deleteFiles ) { if ( $ deleteFiles ) { $ column = $ valueContainer -> getColumn ( ) ; $ fileConfig = $ column -> getConfiguration ( ) ; $ pkValue = $ valueContainer -> getRecord ( ) -> getPrimaryKeyValue ( ) ; \ File :: cleanDirectory ( $ fil... | Additional actions after record deleted from DB |
8,562 | public function append ( \ n2n \ log4php \ logging \ LoggingEvent $ event ) { try { if ( $ this -> collection != null ) { $ this -> collection -> insert ( $ this -> format ( $ event ) ) ; } } catch ( MongoCursorException $ ex ) { $ this -> warn ( sprintf ( 'Error while writing to mongo collection: %s' , $ ex -> getMess... | Appends a new event to the mongo database . |
8,563 | protected function format ( \ n2n \ log4php \ logging \ LoggingEvent $ event ) { $ timestampSec = ( int ) $ event -> getTimestamp ( ) ; $ timestampUsec = ( int ) ( ( $ event -> getTimestamp ( ) - $ timestampSec ) * 1000000 ) ; $ document = array ( 'timestamp' => new MongoDate ( $ timestampSec , $ timestampUsec ) , 'lev... | Converts the logging event into an array which can be logged to mongodb . |
8,564 | public function htmlDetails ( $ type , $ level , $ class , $ file , $ line , $ message , $ trace , $ offset ) { $ history = array ( ) ; for ( ; isset ( $ trace [ $ offset ] ) ; $ offset ++ ) { $ row = $ trace [ $ offset ] ; $ method = $ row [ 'function' ] . '()' ; if ( isset ( $ row [ 'class' ] ) ) { $ method = $ row [... | Output the error details in HTML |
8,565 | public function jsonDetails ( $ type , $ level , $ class , $ file , $ line , $ message , $ trace , $ offset ) { $ history = array ( ) ; for ( ; isset ( $ trace [ $ offset ] ) ; $ offset ++ ) { $ row = $ trace [ $ offset ] ; $ method = $ row [ 'function' ] . '()' ; if ( isset ( $ row [ 'class' ] ) ) { $ method = $ row [... | Output the error details in JSON |
8,566 | public function jsonGeneric ( $ type , $ level , $ class , $ file , $ line , $ message , $ trace , $ offset ) { return json_encode ( array ( 'error' => true , 'message' => 'A server Error occurred' ) , JSON_PRETTY_PRINT ) ; } | Output the generic error in JSON |
8,567 | public function save ( $ queue = 'queue' ) { $ this -> channel -> queue_declare ( $ queue , false , $ this -> durable , false , false , false , [ 'x-max-priority' => [ 'I' , 10 ] ] ) ; $ message = new AMQPMessage ( json_encode ( $ this -> message ) , $ this -> setOptions ( ) ) ; if ( ! $ this -> delay ) { $ this -> cha... | Process the add queue request |
8,568 | public function withContent ( Readable $ content ) : self { $ file = clone $ this ; $ file -> content = $ content ; return $ file ; } | New file reference with a different content |
8,569 | public static function createFromArray ( array $ array ) { self :: $ instance = new Collector ; self :: $ instance -> buffer = null ; $ spreadsheet = new Spreadsheet ( ) ; $ spreadsheet -> getActiveSheet ( ) -> fromArray ( $ array , NULL ) ; self :: $ instance -> buffer = $ spreadsheet ; self :: $ instance -> debug_inf... | Cria uma planilha a partir de um array |
8,570 | private function setupBody ( ) { $ ended_row = $ this -> getLastRow ( ) ; $ ended_col = $ this -> getLastColumn ( ) ; for ( $ row = 1 ; $ row <= $ ended_row ; $ row ++ ) { for ( $ col = 1 ; $ col <= $ ended_col ; $ col ++ ) { $ this -> applyStyles ( 'body' , $ row , $ col ) ; } } } | Prepara e configura o corpo da planilha . |
8,571 | public function toArray ( ) { $ list = [ ] ; $ array = $ this -> getActiveSheet ( ) -> toArray ( ) ; foreach ( $ array as $ row_id => $ rows ) { $ line = array_filter ( $ rows , function ( $ v ) { return ! is_null ( $ v ) ; } ) ; if ( ! empty ( $ line ) ) { $ list [ ] = $ line ; } } return $ list ; } | Devolve os dados da planilha em forma de array . |
8,572 | public function toXml ( ) { $ data = $ this -> toArray ( ) ; $ writer = new \ SimpleXMLElement ( '<Table/>' ) ; $ headers = [ ] ; foreach ( $ data as $ index => $ item ) { if ( $ index == 0 ) { $ headers = $ item ; } $ child = $ writer -> addChild ( 'Row' ) ; foreach ( $ headers as $ k => $ name ) { $ child -> addChild... | Devolve os dados da planilha em forma de xml . |
8,573 | public function uploadImage ( ) { $ image = $ this -> getTempImage ( ) ; $ file = $ _FILES [ 'Filedata' ] ; $ uploadError = Nip_File_System :: instance ( ) -> getUploadError ( $ file , $ image -> extensions ) ; if ( ! $ uploadError ) { $ image -> setResourceFromUpload ( $ file ) ; if ( $ image -> validate ( ) ) { $ ima... | Uploads image to temporary directory |
8,574 | public function cropImages ( $ request ) { $ path = $ request [ 'path' ] ; $ coords = $ this -> getCropCoordinates ( $ request ) ; $ images = $ this -> getNewImages ( ) ; $ full = reset ( $ this -> _imageTypes ) ; $ cropperImage = $ this -> getTempImage ( ) ; $ cropperImage -> setResourceFromFile ( UPLOADS_PATH . 'tmp/... | Saves cropped images |
8,575 | public function initI18N ( $ dir = '' , $ cat = '' ) { if ( empty ( $ cat ) && empty ( $ this -> _msgCat ) ) { return ; } if ( empty ( $ cat ) ) { $ cat = $ this -> _msgCat ; } if ( empty ( $ dir ) ) { $ reflector = new \ ReflectionClass ( get_class ( $ this ) ) ; $ dir = dirname ( $ reflector -> getFileName ( ) ) ; } ... | Yii i18n messages configuration for generating translations |
8,576 | private function checkDefaultType ( \ Closure $ isCorrectType , string $ expectedType ) { if ( ! $ isCorrectType ( ) ) { throw new \ LogicException ( 'Default value is not of type ' . $ expectedType . ' but of type ' . typeOf ( $ this -> default ) ) ; } } | checks type of default value |
8,577 | public static function combine ( string $ uri1 , string $ uri2 ) : string { $ parts2 = parse_url ( $ uri2 ) ; if ( isset ( $ parts2 [ 'scheme' ] ) || isset ( $ parts2 [ 'host' ] ) ) { $ combined_uri_parts = $ parts2 ; if ( ! isset ( $ combined_uri_parts [ 'scheme' ] ) ) $ combined_uri_parts [ 'scheme' ] = 'http' ; } el... | Combines two URIs to a single URL . In most cases the first URI will the an absolute URL and the second URI a path and optionally a query . |
8,578 | public static function isRelative ( string $ url ) : bool { if ( $ url !== '' ) { return ( ( mb_substr ( $ url , 0 , 1 ) == '/' && ( mb_strlen ( $ url ) == 1 || ( mb_substr ( $ url , 1 , 1 ) != '/' && mb_substr ( $ url , 1 , 1 ) != '\\' ) ) ) || ( mb_strlen ( $ url ) > 1 && mb_substr ( $ url , 0 , 2 ) == '~/' ) ) ; } r... | Returns true if and only if an URL is a relative URL . |
8,579 | public static function normalizePath ( ? string $ path ) : string { if ( $ path === null || $ path === '' ) { return '' ; } $ normalized_path = $ path ; $ normalized_path = preg_replace ( '`//+`' , '/' , $ normalized_path , - 1 , $ c0 ) ; $ normalized_path = preg_replace ( '`^/\\.\\.?/`' , '/' , $ normalized_path , - 1... | Normalize path to format with slashes only . |
8,580 | public function addRenderer ( $ renderedClass , $ renderingClass ) { if ( ! class_exists ( $ renderingClass ) ) { throw new \ n2n \ log4php \ LoggerException ( "log4php: Failed adding renderer. Rendering class [$renderingClass] not found." ) ; return ; } $ renderer = new $ renderingClass ( ) ; if ( ! ( $ renderer insta... | Adds a renderer to the map . |
8,581 | public function setDefaultRenderer ( $ renderingClass ) { if ( ! class_exists ( $ renderingClass ) ) { throw new \ n2n \ log4php \ LoggerException ( "log4php: Failed setting default renderer. Rendering class [$renderingClass] not found." ) ; return ; } $ renderer = new $ renderingClass ( ) ; if ( ! ( $ renderer instanc... | Sets a custom default renderer class . |
8,582 | public function reset ( ) { $ this -> defaultRenderer = new \ n2n \ log4php \ renderer \ RendererDefault ( ) ; $ this -> clear ( ) ; $ this -> addRenderer ( 'Exception' , '\n2n\log4php\renderer\RendererException' ) ; } | Resets the renderer map to it s default configuration . |
8,583 | public function createLegend ( $ type = 'legend' ) { switch ( $ type ) { case 'legend' : $ tmp = new Legend ( ) ; break ; default : $ tmp = new $ type ( ) ; } $ this -> legend = $ tmp ; return $ tmp ; } | Creates a legend for this fieldset . |
8,584 | protected function getHtmlLegend ( ) : string { if ( $ this -> legend ) { $ ret = $ this -> legend -> getHtml ( ) ; } else { $ ret = '' ; } return $ ret ; } | Returns the legend for this fieldset . |
8,585 | public static function meta ( Meta $ m ) { if ( $ m -> getColumn ( ) !== "id" ) { self :: checkDefaultSet ( $ m ) ; if ( ! empty ( $ m -> getValue ( ) ) && ! in_array ( $ m -> getKey ( ) , [ "extend" , "extend_add" , "list" , "selecao" , "checkbox_rel" ] ) ) { self :: checkRegular ( $ m ) ; self :: convertValues ( $ m ... | Valida valor a ser inserido na meta |
8,586 | public function isClean ( ) { if ( $ this -> getConfigFileAge ( ) > max ( $ this -> getSassMaxAge ( ) , $ this -> getStylesheetsMaxAge ( ) ) ) { return false ; } return $ this -> getSassMaxAge ( ) <= $ this -> getStylesheetsMaxAge ( ) ; } | return true if the project do not need to be recompiled |
8,587 | private function checkPaths ( ) { if ( ! is_dir ( $ this -> sassPath ) ) { throw new \ RuntimeException ( sprintf ( 'The path %s do not exists' , $ this -> sassPath ) ) ; } if ( ! is_dir ( $ this -> cssPath ) ) { try { mkdir ( $ this -> cssPath ) ; } catch ( \ Exception $ e ) { throw new \ RuntimeException ( sprintf ( ... | check if sass and stylesheets paths are writable |
8,588 | private function findPaths ( ) { $ configFilename = $ this -> projectPath . DIRECTORY_SEPARATOR . $ this -> configFile ; $ handle = fopen ( $ configFilename , 'r' ) ; if ( false === $ handle ) { throw new \ FileNotFoundException ( $ configFilename . ' could not be found' ) ; } $ contents = fread ( $ handle , filesize (... | find sass and stylesheets files parsing the config file |
8,589 | private function getStylesheetsMaxAge ( ) { if ( is_null ( $ this -> cssPath ) ) { $ this -> findPaths ( ) ; $ this -> checkPaths ( ) ; } return $ this -> getFilesMaxAge ( $ this -> cssPath , array ( '*.css' ) ) ; } | Get the max_age of stylesheets files |
8,590 | public function getParent ( ) { $ pageClass = Yii :: $ app -> cms -> getPageClass ( $ this -> type ) ; return $ this -> hasOne ( $ pageClass , [ 'id' => 'parentId' ] ) ; } | Returns the immediate parent . |
8,591 | public static function instance ( ) : Filter { if ( null === self :: $ instance ) { self :: $ instance = new self ( ) ; } return self :: $ instance ; } | returns reusable filter instance |
8,592 | protected function getMappedContext ( $ contextName ) { $ this -> checkMappedContext ( $ contextName ) ; $ mappingList = $ this -> getMappingList ( ) ; return $ mappingList [ $ contextName ] ; } | Return the mapped context class |
8,593 | public function registerMessage ( string $ domain , string $ string , bool $ resolveDomain = true ) { if ( $ resolveDomain ) { $ domain = $ this -> config -> resolveDomain ( $ domain ) ; } $ this -> catalogue -> set ( $ domain , $ string , $ string ) ; $ this -> getLogger ( ) -> debug ( sprintf ( "[%s]: `%s`" , $ domai... | Register string in active translator . |
8,594 | public function indexClasses ( ClassesInterface $ locator ) { foreach ( $ locator -> getClasses ( TranslatorTrait :: class ) as $ class ) { $ strings = $ this -> fetchMessages ( $ class , true ) ; foreach ( $ strings as $ string ) { $ this -> registerMessage ( $ class -> getName ( ) , $ string ) ; } } } | Index and register i18n string located in default properties which belongs to TranslatorTrait classes . |
8,595 | private function registerInvocations ( array $ invocations ) { foreach ( $ invocations as $ invocation ) { if ( $ invocation -> getArgument ( 0 ) -> getType ( ) != ReflectionArgument :: STRING ) { continue ; } $ string = $ invocation -> getArgument ( 0 ) -> stringValue ( ) ; $ string = $ this -> prepareMessage ( $ stri... | Register found invocations in translator bundles . |
8,596 | private function fetchMessages ( \ ReflectionClass $ reflection , bool $ inherit = false ) { $ target = $ reflection -> getDefaultProperties ( ) + $ reflection -> getConstants ( ) ; foreach ( $ reflection -> getProperties ( ) as $ property ) { if ( is_string ( $ property -> getDocComment ( ) ) && strpos ( $ property ->... | Fetch default string values from class and merge it with parent strings if requested . |
8,597 | private function invocationDomain ( ReflectionInvocation $ invocation ) : string { $ domain = $ this -> config -> getDefaultDomain ( ) ; if ( $ invocation -> getName ( ) === 'say' ) { $ domain = $ this -> config -> resolveDomain ( $ invocation -> getClass ( ) ) ; } $ argument = null ; switch ( strtolower ( $ invocation... | Get associated domain . |
8,598 | public static function addRow ( DetailTable $ table , $ header , ? int $ value ) : void { if ( $ value !== null && $ value !== '' ) { $ table -> addRow ( $ header , [ 'class' => 'integer' ] , Cast :: toOptString ( $ value ) ) ; } else { $ table -> addRow ( $ header ) ; } } | Adds a row with an integer value to a detail table . |
8,599 | public function delete ( bool $ recursive = true ) : bool { $ this -> each ( function ( Folder $ item ) use ( $ recursive ) { $ item -> delete ( $ recursive ) ; } ) ; return true ; } | Delete all folders . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.