idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
7,200 | private function getPayload ( $ perimeter , $ season , $ lineConfig , $ externalRouteId , $ stopPoint ) { $ payload = array ( ) ; $ payload [ 'pdfHash' ] = isset ( $ stopPoint -> pdfHash ) ? $ stopPoint -> pdfHash : '' ; $ payload [ 'layoutParams' ] = array ( 'orientation' => $ lineConfig -> getLayoutConfig ( ) -> getL... | construct payload for AMQP message |
7,201 | public function loadRoutes ( ) { $ routeFiles = $ this -> config [ "routeFiles" ] ; foreach ( $ routeFiles as $ file ) { $ this -> loadFile ( $ file , [ "app" => $ this ] ) ; } return $ this ; } | Load routes from files . |
7,202 | public function collection ( TableQueryIterator $ iterator , Table $ definition ) : Collection { return Collection :: from ( $ iterator ) -> map ( function ( $ v ) use ( $ definition ) { return $ this -> entity ( $ definition , $ v ) ; } ) ; } | Get a collection of entities |
7,203 | public function save ( $ entity ) { $ query = $ this -> db -> table ( $ entity -> definition ( ) -> getName ( ) ) ; $ primary = $ entity -> id ( ) ; if ( ! isset ( $ this -> objects [ $ entity -> definition ( ) -> getName ( ) ] [ base64_encode ( serialize ( $ primary ) ) ] ) ) { $ new = $ query -> insert ( $ entity -> ... | Persist all changes to an entity in the DB . Does not include modified relation collections . |
7,204 | public function delete ( $ entity ) { $ query = $ this -> db -> table ( $ entity -> definition ( ) -> getName ( ) ) ; $ primary = $ entity -> id ( ) ; if ( isset ( $ this -> objects [ $ entity -> definition ( ) -> getName ( ) ] [ base64_encode ( serialize ( $ primary ) ) ] ) ) { foreach ( $ primary as $ k => $ v ) { $ ... | Delete an entity from the database |
7,205 | private function fillBuffer ( $ length ) { $ fill = 8192 ; while ( $ this -> buffer -> getSize ( ) < $ length ) { $ read = $ this -> stream -> read ( $ fill ) ; if ( $ read === false || $ read === '' ) { break ; } $ this -> buffer -> write ( base64_decode ( $ read ) ) ; } } | Fills the internal byte buffer after reading and decoding data from the underlying stream . |
7,206 | public function write ( $ string ) { $ bytes = $ this -> remainder . $ string ; $ len = strlen ( $ bytes ) ; if ( ( $ len % 3 ) !== 0 ) { $ this -> remainder = substr ( $ bytes , - ( $ len % 3 ) ) ; $ bytes = substr ( $ bytes , 0 , $ len - ( $ len % 3 ) ) ; } else { $ this -> remainder = '' ; } $ this -> stream -> writ... | Writes the passed string to the underlying stream after encoding it to base64 . |
7,207 | private function beforeClose ( ) { if ( $ this -> isWritable ( ) && $ this -> remainder !== '' ) { $ this -> stream -> write ( base64_encode ( $ this -> remainder ) ) ; $ this -> remainder = '' ; } } | Writes out any remaining bytes at the end of the stream and closes . |
7,208 | public function setData ( array $ data ) { $ this -> data = $ data ; $ this -> resetFields ( ) ; foreach ( $ data as $ name => $ data ) $ this -> newField ( $ name , $ data ) ; $ this -> updateChilds ( ) ; return $ this ; } | Set group data . |
7,209 | public function field ( $ field = null ) { $ default_render = $ this -> default_render ; if ( $ default_render !== null ) return $ default_render ( $ field ) ; elseif ( $ field instanceof Field ) return $ field -> def ( ) ; } | Render a field or a sub - group . |
7,210 | public function renderTemplate ( $ offset = '' ) { $ randstr = \ Asgard \ Common \ Tools :: randstr ( 10 ) ; $ jq = $ this -> renderNew ( '{{' . $ randstr . '}}' ) ; $ jq = addcslashes ( ( string ) $ jq , "'" ) ; $ jq = str_replace ( "\r\n" , "\n" , $ jq ) ; $ jq = str_replace ( "\n" , "\\\n" , $ jq ) ; $ jq = str_repl... | Render the javascript template . |
7,211 | protected function newField ( $ name = null , $ data = null ) { if ( $ name !== null && isset ( $ this [ $ name ] ) ) return ; $ cb = $ this -> cb ; $ newelement = $ cb ( $ data ) ; if ( ! $ newelement ) return ; $ this -> add ( $ newelement , $ name ) ; return $ newelement ; } | Create a new field or sub - group . |
7,212 | protected function renderNew ( $ offset = null ) { $ default_render = $ this -> default_render ; if ( $ offset === null ) $ offset = $ this -> size ( ) ; if ( ! isset ( $ this [ $ offset ] ) ) $ field = $ this -> newField ( $ offset ) ; else $ field = $ this [ $ offset ] ; if ( ! $ field ) return ; if ( $ default_rende... | Render a new field or sub - group . |
7,213 | public function add ( $ rule , $ action = null ) { $ route = $ this -> di -> get ( 'route' ) ; $ route -> set ( $ rule , $ action ) ; $ this -> routes [ ] = $ route ; if ( $ rule == "*" ) { $ this -> defaultRoute = $ route ; } return $ route ; } | Add a route to the router . |
7,214 | public function handle ( ) { try { $ query = $ this -> di -> request -> getRoute ( ) ; $ parts = $ this -> di -> request -> getRouteParts ( ) ; foreach ( $ this -> routes as $ route ) { if ( $ route -> match ( $ query ) ) { return $ route -> handle ( ) ; } } $ dispatcher = $ this -> di -> dispatcher ; $ dispatcher -> s... | Handle the routes and match them towards the request dispatch them when a match is made . |
7,215 | function getColors ( ) { $ adf = new ApiDataFetcher ( PUPIQ_API_URL ) ; try { $ colors = $ adf -> get ( "image_colors/detail" , array ( "url" => $ this -> getUrl ( ) , "auth_token" => $ this -> getAuthToken ( ) , ) , array ( "acceptable_error_codes" => array ( "404" , "403" ) , "cache" => 60 * 60 * 24 * 30 , ) ) ; } ca... | Returns significant colors used in the image |
7,216 | function getImageId ( ) { $ ary = explode ( '/' , $ this -> _image_id ) ; if ( isset ( $ ary [ 1 ] ) ) { return ( int ) hexdec ( $ ary [ 1 ] ) ; } } | Returns ID of the image stored in the Pupiq database |
7,217 | public function register ( TypeInterface $ type ) { if ( isset ( $ this -> types [ $ name = $ type -> getName ( ) ] ) ) { throw new \ RuntimeException ( "Slide type '$name' is already registered." ) ; } $ this -> types [ $ name ] = $ type ; return $ this ; } | Registers the slide type . |
7,218 | public static function format ( $ string , $ format , $ separator = '/' ) { $ string = trim ( $ string , $ separator ) ; if ( $ string === '' ) { if ( $ format == self :: FORMAT_BOTH_DELIMITERS ) { return $ separator ; } else { return $ string ; } } if ( $ format & self :: FORMAT_LEFT_DELIMITER ) { $ string = $ separat... | Formats the path string according to the mode |
7,219 | public function getBasePath ( $ offset = 0 , $ format = self :: FORMAT_NO_DELIMITERS ) { $ basePathList = $ this -> basePathParts ; if ( $ offset > 0 ) { $ basePathList = array_slice ( $ basePathList , 0 , - $ offset ) ; } $ parts = new Path ( '' , $ this -> separator ) ; foreach ( $ basePathList as $ path ) { $ parts ... | Get request base path with arbitrary offset |
7,220 | protected function initConfig ( $ file ) { if ( file_exists ( $ this -> dir . '/' . $ file ) ) { if ( ! $ this -> confirm ( 'Do you want to override "' . $ file . '"?' ) ) return ; } $ config = file_get_contents ( __DIR__ . '/stubs/' . $ file . '.stub' ) ; $ key = \ Asgard \ Common \ Tools :: randStr ( 10 ) ; $ config ... | Initialize a configuration file . |
7,221 | public function resolveAssetSourcePath ( $ source , $ templateName , $ fileName , ParserInterface $ parserInterface ) { $ tpl = $ parserInterface -> getTemplateDefinition ( false ) ; return $ this -> resolveAssetSourcePathAndTemplate ( $ source , $ templateName , $ fileName , $ parserInterface , $ tpl ) ; } | Return an asset source file path . |
7,222 | public function resolveAssetSourcePathAndTemplate ( $ source , $ templateName , $ fileName , ParserInterface $ parserInterface , TemplateDefinition & $ templateDefinition ) { static $ cache = [ ] ; static $ pathOrigin = [ 'template' , 'module_override' , 'module_directory' , 'default_fallback' ] ; $ templateName = $ te... | Return an asset source file path and get the original template where it was found |
7,223 | protected function getPossibleAssetSources ( $ directories , $ templateName , $ source , & $ pathList ) { if ( $ source !== ParserInterface :: TEMPLATE_ASSETS_KEY ) { if ( isset ( $ directories [ $ templateName ] [ ParserInterface :: TEMPLATE_ASSETS_KEY ] ) ) { $ pathList [ 'module_override' ] [ ] = [ $ templateName , ... | Get all possible directories from which the asset can be found . It returns an array of directories ordered by priority . |
7,224 | public function fetchRoutes ( $ class ) { $ routes = [ ] ; $ reader = new \ Doctrine \ Common \ Annotations \ SimpleAnnotationReader ( ) ; $ reader -> addNamespace ( 'Asgard\Http\Annotation' ) ; if ( $ this -> cache ) { $ reader = new \ Doctrine \ Common \ Annotations \ CachedReader ( $ reader , $ this -> cache , $ thi... | Return the routes of a controller . |
7,225 | public function setCache ( \ Doctrine \ Common \ Cache \ Cache $ cache ) { $ this -> cache = $ cache ; return $ this ; } | Set the cache dependency . |
7,226 | protected function checkOptionalPath ( $ assetPath ) { if ( 0 === strpos ( $ assetPath , '?' ) ) { $ assetPath = ltrim ( $ assetPath , '?' ) ; $ this -> setOptional ( true ) ; } return $ assetPath ; } | Check optional asset path . |
7,227 | protected function lock ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> locks ) ) { $ this -> locks [ $ name ] = true ; return true ; } return false ; } | Lock to prevent infinite loops |
7,228 | protected function unlock ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> locks ) ) { return false ; } unset ( $ this -> locks [ $ name ] ) ; return true ; } | Unlock locked parameter |
7,229 | public function equals ( Entity $ entity = null ) { if ( $ entity === null ) { return false ; } if ( $ entity === $ this ) { return true ; } $ id = $ this -> getId ( ) ; if ( ! empty ( $ id ) && $ entity -> getId ( ) === $ id ) { return true ; } return false ; } | Are the both entity records equal in means of database record |
7,230 | public static function collectIds ( $ entities ) { $ ids = array ( ) ; foreach ( $ entities as $ entity ) { $ ids [ ] = $ entity -> getId ( ) ; } return $ ids ; } | Collects Id array from entity collection |
7,231 | protected function addUnique ( Collection $ collection , Entity $ newItem , $ uniqueField = null ) { if ( $ collection -> contains ( $ newItem ) ) { return false ; } if ( is_null ( $ uniqueField ) ) { $ collection -> add ( $ newItem ) ; } else { $ indexBy = $ newItem -> getProperty ( $ uniqueField ) ; if ( $ collection... | Adds an element to collection preserving uniqueness of fields |
7,232 | public static function generateId ( $ className = '' ) { $ timeParts = explode ( ' ' , microtime ( false ) ) ; $ timeParts [ 0 ] = substr ( $ timeParts [ 0 ] , 2 , 3 ) ; $ time = ( ( int ) $ timeParts [ 1 ] - 1324027985 ) . $ timeParts [ 0 ] ; $ time = base_convert ( $ time , 10 , 36 ) ; $ time = substr ( $ time , - 9 ... | Generates time sortable ID . |
7,233 | protected function writeOnce ( & $ property , $ value ) { $ sourceEntity = get_class ( $ this ) ; if ( empty ( $ value ) ) { $ this -> unlockAll ( ) ; throw new \ RuntimeException ( "Second argument sent to method $sourceEntity::writeOnce() cannot be empty" ) ; } if ( ! is_object ( $ value ) ) { $ this -> unlockAll ( )... | Set the property value . Return true on success false on equal parameter exception when argument not valid or different value was already set |
7,234 | public function listCurrencies ( ) { if ( is_null ( $ this -> currencyCodes ) ) { $ directory = new \ RecursiveDirectoryIterator ( $ this -> getCurrencyResourceDirectory ( ) ) ; foreach ( $ directory as $ item ) { if ( preg_match ( '#^...\.json$#' , $ item -> getFilename ( ) ) ) { $ this -> currencyCodes [ ] = substr (... | Lists all known currencies . |
7,235 | public function loadCurrency ( $ currencyCode ) { $ filePath = $ this -> getCurrencyResourceDirectory ( ) . "/$currencyCode.json" ; if ( is_readable ( $ filePath ) ) { return $ this -> createCurrencyFromJson ( file_get_contents ( $ filePath ) ) ; } else { return null ; } } | Loads a currency . |
7,236 | protected function createCurrencyFromJson ( $ json ) { $ currency_data = json_decode ( $ json ) ; $ currency = new Currency ( ) ; $ currency -> setCurrencyCode ( $ currency_data -> ISO4217Code ) ; if ( isset ( $ currency_data -> ISO4217Number ) ) { $ currency -> setCurrencyNumber ( $ currency_data -> ISO4217Number ) ; ... | Creates a currency from its JSON resource . |
7,237 | public function convert ( array $ data , $ orientation = 'vertical' , $ datetime = false ) { $ chartData = array ( ) ; if ( ! $ this -> hasMultipleSeries ( $ data ) ) { $ data = array ( $ data ) ; } foreach ( $ data as $ series ) { $ seriesData = array ( ) ; foreach ( $ series as $ key => $ value ) { if ( $ datetime ) ... | Convert an array of normal PHP data into a format that Flot can understand |
7,238 | public function templatesListAction ( ) { $ localeId = $ this -> getCurrentLocale ( ) -> getId ( ) ; $ templateLocalizations = $ this -> getEntityManager ( ) -> getRepository ( TemplateLocalization :: CN ( ) ) -> findBy ( array ( 'locale' => $ localeId ) , array ( 'title' => 'asc' ) ) ; $ responseData = array ( ) ; for... | Handles template list request . |
7,239 | public function deleteAction ( ) { $ page = $ this -> getPageLocalization ( ) -> getMaster ( ) ; $ entityManager = $ this -> getEntityManager ( ) ; $ count = ( int ) $ entityManager -> createQuery ( sprintf ( 'SELECT COUNT(p.id) FROM %s p WHERE p.template = ?0' , PageLocalization :: CN ( ) ) ) -> setParameters ( array ... | Template delete action . |
7,240 | public function saveAction ( ) { $ this -> isPostRequest ( ) ; $ this -> checkLock ( ) ; $ this -> saveLocalizationCommonAction ( ) ; $ this -> getEntityManager ( ) -> flush ( $ this -> getPageLocalization ( ) ) ; return new SupraJsonResponse ( ) ; } | Settings save action handler . Initiated when template title is changed via Sitemap . |
7,241 | protected function getUrlPathFromConfig ( $ urlConfig ) { $ urlPath = parent :: getUrlPathFromConfig ( $ urlConfig ) ; try { $ path = is_array ( $ urlPath ) ? $ urlPath [ 0 ] : $ urlPath ; $ arguments = ( is_array ( $ urlPath ) && isset ( $ urlPath [ 1 ] ) && is_array ( $ urlPath [ 1 ] ) ) ? $ urlPath [ 1 ] : [ ] ; $ u... | Build the url given the configuration data |
7,242 | public function getClient ( $ path = '/solr' ) { $ options = $ this -> options ; $ options = [ 'secure' => $ options -> isSecure ( ) , 'hostname' => $ options -> getHostname ( ) , 'port' => $ options -> getPort ( ) , 'path' => $ path , 'login' => $ options -> getUsername ( ) , 'password' => $ options -> getPassword ( )... | Get SolrClient with custom path option |
7,243 | public function getName ( ) { $ class = get_class ( $ this ) ; $ class = explode ( '\\' , $ class ) ; $ class = $ class [ count ( $ class ) - 1 ] ; $ class = str_replace ( array ( 'Supra' , 'Package' ) , '' , $ class ) ; $ inflector = new Inflector ( ) ; $ name = $ inflector -> tableize ( $ class ) ; return $ name ; } | Creates a name for a command that can be used throughout configuration files |
7,244 | public function map ( callable $ callable ) { $ keys = array_keys ( $ this -> items ) ; $ results = array_map ( $ callable , $ this -> items , $ keys ) ; return new self ( $ results ) ; } | Apply the callable to the collection items . |
7,245 | public function filter ( callable $ callable ) { $ results = [ ] ; foreach ( $ this -> items as $ key => $ item ) { if ( $ callable ( $ item , $ key ) ) { $ results [ ] = $ item ; } } return new self ( $ results ) ; } | Filter the collection items through the callable . |
7,246 | public function sortByKey ( callable $ callback = null ) { $ items = $ this -> items ; $ callback ? uksort ( $ items , $ callback ) : ksort ( $ items ) ; return new static ( $ items ) ; } | Sort the collection of item keys through a user - defined comparison function . |
7,247 | private function itemSet ( $ value , $ key = null ) { if ( is_null ( $ key ) ) { $ this -> items [ ] = $ value ; } else { $ this -> items [ $ key ] = $ value ; } } | Set the given array value with the provided key or index . |
7,248 | public static function fromMassAndVolume ( Mass $ mass , Volume $ volume ) { $ grams = $ mass -> convertTo ( UnitMass :: grams ( ) ) ; $ liters = $ volume -> convertTo ( UnitVolume :: liters ( ) ) ; $ gramsPerLiter = $ grams -> value ( ) / $ liters -> value ( ) ; return new static ( $ gramsPerLiter , UnitConcentrationM... | Returns a concentration of mass measurement computed from the specified mass and volume . |
7,249 | public function minifyQuery ( $ query ) { $ result = '' ; $ keywords = array ( ) ; $ required = 1 ; switch ( true ) { case stripos ( $ query , 'SELECT' ) !== false : $ keywords = array ( 'SELECT' , 'FROM' , 'WHERE' , 'HAVING' , 'ORDER BY' , 'LIMIT' ) ; $ required = 2 ; break ; case stripos ( $ query , 'DELETE' ) !== fa... | Minify the query |
7,250 | public static function escapeFunction ( $ parameter ) { $ result = $ parameter ; switch ( true ) { case is_string ( $ result ) : $ result = "'" . addslashes ( $ result ) . "'" ; break ; case is_array ( $ result ) : foreach ( $ result as & $ value ) { $ value = static :: escapeFunction ( $ value ) ; } $ result = implode... | Escape parameters of a SQL query DON T USE THIS FUNCTION OUTSIDE ITS INTEDED SCOPE |
7,251 | protected function handle ( NotificationInterface $ notification , NotificationHandlerInterface $ handler ) : bool { if ( ! $ handler -> supports ( $ notification ) ) { return false ; } $ cloned = clone $ notification ; $ event = new NotifyEvent ( $ cloned , $ handler ) ; $ this -> eventDispatcher -> dispatch ( Events ... | Checks if handler supports this notification and eventually send the notification . |
7,252 | public function setParameterMarkerNames ( $ raw_query_string , array $ named_parameter_markers ) { if ( $ this -> named_parameter_markers !== null ) { throw new Exception \ LogicException ( 'Parameter markers can be set only at the time of building the statement.' ) ; } $ this -> raw_query_string = $ raw_query_string ;... | When the prepared statement is using named parameter markers the query is overwritten with an equivalent query using question mark parameter markers . The raw query is used for logging purposes . |
7,253 | public function getSessionDetails ( $ path ) { global $ phpbb_root_path , $ phpEx , $ user , $ db , $ config , $ cache , $ template , $ auth ; if ( ! is_file ( "$path/webb.config" ) ) { return [ 'is_anonymous' => "No one" , 'user_acronym' => "NoOne" , 'user_email' => "noone@dbwebb.se" , 'session_id' => null , ] ; } def... | Sample function to integrate with a phpbb installation and lend some information on the authorized user . |
7,254 | public function getElementTitle ( ) { throw new \ Exception ( 'Dont use me bro.' ) ; $ title = null ; switch ( $ this -> resource ) { case self :: RESOURCE_PAGE : $ pageData = $ this -> getPage ( ) ; if ( ! is_null ( $ pageData ) ) { $ title = $ pageData -> getTitle ( ) ; } break ; case self :: RESOURCE_FILE : $ file =... | Get element title |
7,255 | public function setPageLocalization ( PageLocalization $ pageLocalization ) { $ this -> pageLocalization = $ pageLocalization ; $ this -> pageId = $ pageLocalization -> getMaster ( ) -> getId ( ) ; } | Method to override the used page localization |
7,256 | private function getPageFullPath ( Localization $ pageLocalization ) { throw new \ Exception ( 'Dont use me bro.' ) ; if ( ! $ pageLocalization instanceof PageLocalization ) { return null ; } $ path = $ pageLocalization -> getPath ( ) ; $ url = null ; if ( ! is_null ( $ path ) && ! $ path instanceof NullPath ) { $ url ... | Generates full page URL with locale prefix |
7,257 | public function getUrl ( ) { throw new \ Exception ( 'Dont use me bro.' ) ; $ url = null ; switch ( $ this -> getResource ( ) ) { case self :: RESOURCE_PAGE : $ pageData = $ this -> getPage ( ) ; if ( ! is_null ( $ pageData ) ) { $ url = $ this -> getPageFullPath ( $ pageData ) ; } break ; case self :: RESOURCE_FILE : ... | Get URL of the link |
7,258 | public function getPageLocalization ( ) { throw new \ Exception ( 'Dont use me bro.' ) ; if ( empty ( $ this -> pageId ) ) { return ; } if ( ! is_null ( $ this -> pageLocalization ) ) { return $ this -> pageLocalization ; } $ em = ObjectRepository :: getEntityManager ( $ this ) ; $ pageData = null ; $ localizationEntit... | Get link page localization |
7,259 | private function parseDateTimes ( $ datetimes ) { foreach ( $ datetimes as & $ datetime ) { $ datetime -> date_time = new \ DateTime ( $ datetime -> date_time ) ; } return $ datetimes ; } | Converts strings coming from Navitia as T230200 into php DateTime objects |
7,260 | private function prepareDateTimes ( $ datetimes ) { $ parsedDateTimes = $ this -> parseDateTimes ( $ datetimes ) ; $ sortedDateTimes = array ( ) ; foreach ( $ parsedDateTimes as $ parsedDateTime ) { $ hour = date ( 'G' , $ parsedDateTime -> date_time -> getTimestamp ( ) ) ; if ( ! isset ( $ sortedDateTimes [ $ hour ] )... | groups datetimes by hours |
7,261 | private function findCalendar ( $ calendarId , $ calendars ) { if ( isset ( $ calendars [ $ calendarId ] ) ) { return $ calendars [ $ calendarId ] ; } else { throw new \ Exception ( $ this -> translator -> trans ( 'services.calendar_manager.calendar_in_block_not_found' , array ( '%calendarId%' => $ calendarId ) , 'exce... | find a calendar or throws an exception if a calendar is not found |
7,262 | private function sortCalendars ( $ calendars ) { $ calendarsSorted = array ( ) ; foreach ( $ calendars as $ calendar ) { $ calendarsSorted [ $ calendar -> id ] = $ calendar ; $ calendarsSorted [ $ calendar -> id ] -> week_pattern = ( array ) $ calendarsSorted [ $ calendar -> id ] -> week_pattern ; } return $ calendarsS... | Index calendars by Id and cast week_patterns into array for templates |
7,263 | private function generateExceptionsValues ( $ navitiaExceptions ) { $ exceptions = array ( ) ; foreach ( $ navitiaExceptions as $ exception ) { $ date = new \ DateTime ( $ exception -> date ) ; $ exception -> value = $ this -> translator -> trans ( 'global.exceptions.' . strtolower ( $ exception -> type ) , array ( '%d... | Generate value property of exceptions to display in view |
7,264 | private function addSchedulesToCalendar ( $ calendar , $ schedules ) { $ calendar -> schedules = $ schedules ; $ calendar -> schedules -> date_times = $ this -> prepareDateTimes ( $ calendar -> schedules -> date_times ) ; return $ calendar ; } | Add schedules coming from Navitia to calendar object |
7,265 | private function generateAdditionalInformations ( $ additionalInformationsId ) { $ additionalInformations = null ; if ( ! empty ( $ additionalInformationsId ) && ! in_array ( $ additionalInformationsId , $ this -> additionalInformationsExcluded ) ) { $ additionalInformations = $ this -> translator -> trans ( 'calendar.... | Generate value propriety of exceptions to display in view |
7,266 | public function getCalendarsForStopPointAndTimetable ( $ externalCoverageId , $ timetable , $ stopPointInstance ) { $ notesComputed = array ( ) ; $ calendarsSorted = array ( ) ; $ layout = $ timetable -> getLineConfig ( ) -> getLayoutConfig ( ) ; $ calendarsData = $ this -> navitia -> getStopPointCalendarsData ( $ exte... | Returns Calendars enhanced with schedules for a stop point and a route Datetimes are parsed and response formatted for template Only calendars added to timetable are kept |
7,267 | public function getCalendarsForRoute ( $ externalCoverageId , $ externalRouteId , \ DateTime $ startDate , \ DateTime $ endDate ) { $ calendarsData = $ this -> navitia -> getRouteCalendars ( $ externalCoverageId , $ externalRouteId , $ startDate , $ endDate ) ; $ calendarsSorted = array ( ) ; if ( isset ( $ calendarsDa... | Returns Calendars for a route Datetimes are not parsed |
7,268 | public function addUserToPerimeter ( UserInterface $ user , BusinessPerimeterInterface $ perimeter ) { $ this -> perimeterManager -> addUserToPerimeter ( $ user -> getId ( ) , $ perimeter -> getId ( ) ) ; } | Add a user to a perimeter |
7,269 | public function getPerimeters ( ) { if ( null === $ this -> perimeters ) { $ perimeters = array ( ) ; foreach ( $ this -> perimeterManager -> findAll ( ) as $ network ) { $ perimeter = new BusinessPerimeter ( $ network -> getExternalPerimeterId ( ) ) ; $ perimeter -> setId ( $ network -> getId ( ) ) ; $ this -> perimet... | Get the perimeters |
7,270 | public function getUserPerimeters ( UserInterface $ user ) { $ userPerimeters = array ( ) ; foreach ( $ this -> perimeterManager -> findUserPerimeters ( $ user ) as $ network ) { foreach ( $ this -> getPerimeters ( ) as $ perimeter ) { if ( $ perimeter -> getId ( ) == $ network [ 'id' ] && $ perimeter -> getName ( ) ==... | Get a user s perimeters |
7,271 | public function getAllES ( string $ sortBy = "" , string $ sortType = "ASC" ) { $ data = $ this -> getESItems ( 10000 , 0 , $ sortBy , $ sortType ) ; return $ data [ 'items' ] ; } | Get all data from elastic index . |
7,272 | public function paginateES ( int $ size = 20 , string $ sortBy = "" , string $ sortType = "ASC" , int $ page = null ) : LengthAwarePaginator { if ( ! $ page ) { $ page = ( Input :: get ( "page" ) ? Input :: get ( "page" ) : 1 ) ; } $ from = ( ( $ page * $ size ) - $ size ) ; $ data = $ this -> getESItems ( $ size , $ f... | Get data as pagination from elastic index . |
7,273 | private function getESItems ( $ size , $ from , string $ sortBy = "" , string $ sortType = "ASC" ) { $ query = [ "match_all" => ( object ) [ ] ] ; if ( $ this -> elasticQuery ) { $ query = [ "bool" => [ "must" => $ this -> elasticQuery ] ] ; } $ params = [ "index" => $ this -> table , "type" => "_doc" , "body" => [ "si... | Used to get data and return them as Elequent . |
7,274 | public function whereMultiMatch ( string $ query , array $ fields , $ fuzziness = "auto" ) { $ param = [ "multi_match" => [ "query" => $ query , "fields" => $ fields , "fuzziness" => $ fuzziness ] ] ; $ this -> elasticQuery [ ] = $ param ; return $ this ; } | Multi match match query in multiple fields |
7,275 | public function whereMatch ( string $ field , string $ query , $ operator = "or" , $ fuzziness = 0 ) { $ param = [ "match" => [ $ field => [ "query" => $ query , "operator" => $ operator , "fuzziness" => $ fuzziness ] ] ] ; $ this -> elasticQuery [ ] = $ param ; return $ this ; } | Where query matches field |
7,276 | public function whereTerms ( string $ field , array $ query ) { $ param = [ "terms" => [ $ field => $ query ] ] ; $ this -> elasticQuery [ ] = $ param ; return $ this ; } | Where field uses multiple terms |
7,277 | public function whereTerm ( string $ field , $ term ) { $ param = [ "term" => [ $ field => $ term ] ] ; $ this -> elasticQuery [ ] = $ param ; return $ this ; } | Where field uses single term |
7,278 | public function whereRange ( string $ field , $ gt = null , $ lt = null , $ format = null , $ gtConfig = "gte" , $ ltConfig = "lte" ) { if ( $ gt && $ lt ) { $ field = [ ] ; if ( $ gt ) { $ field [ $ gtConfig ] = $ gt ; } if ( $ lt ) { $ field [ $ ltConfig ] = $ lt ; } if ( $ format ) { $ field [ "format" ] = $ format ... | Applies range search in query |
7,279 | private function toElequent ( array $ attributes ) { $ obj = new static ( ) ; $ casts = $ obj -> casts ; $ obj -> casts = [ ] ; $ obj -> setRawAttributes ( $ attributes ) ; $ obj -> casts = $ casts ; return $ obj ; } | Used to change data to the selected elequent |
7,280 | public function check ( Command $ console ) { $ this -> console = $ console ; $ this -> console -> comment ( "\nChecking system requirements" ) ; $ this -> process = new Process ( $ this -> console ) ; $ this -> versionCheck ( ) ; $ this -> extensionCheck ( ) ; $ this -> hasDatabaseDriver ( ) ; $ this -> disabledFuncti... | Checks the system meets all the requirements needed to run Deployer . |
7,281 | private function hasDatabaseDriver ( ) { if ( ! count ( $ this -> getDatabaseDrivers ( ) ) ) { $ this -> console -> error ( 'At least 1 PDO driver is required. Either sqlite, mysql or pgsql, check your php.ini file' ) ; $ this -> errors = true ; } return false ; } | Checks if a DB driver is installed . |
7,282 | private function disabledFunctionCheck ( ) { $ functions = [ 'exec' ] ; foreach ( $ functions as $ function ) { if ( ! function_exists ( $ function ) ) { $ this -> console -> error ( 'Function "' . $ function . '" is required. Is it disabled in php.ini?' ) ; $ this -> errors = true ; } } } | Checks that required PHP functions are not disabled . |
7,283 | private function requiredSystemCommands ( ) { return true ; $ required_commands = [ 'git' , 'rsync' , 'php' , 'composer' ] ; $ missing = [ ] ; foreach ( $ required_commands as $ command ) { $ this -> process -> setCommandLine ( 'which ' . $ command ) ; $ this -> process -> setTimeout ( null ) ; $ this -> process -> run... | Checks that all the required system commands are available . |
7,284 | private function nodeJsCommand ( ) { return true ; $ found = false ; foreach ( [ 'node' , 'nodejs' ] as $ command ) { $ this -> process -> setCommandLine ( 'which ' . $ command ) ; $ this -> process -> setTimeout ( null ) ; $ this -> process -> run ( ) ; if ( $ this -> process -> isSuccessful ( ) ) { $ found = true ; b... | Tests that nodejs exists in one of the two possible names . |
7,285 | private function checkPermissions ( ) { foreach ( $ this -> writableDirectories as $ path ) { if ( ! $ this -> filesystem -> isWritable ( base_path ( $ path ) ) ) { $ this -> console -> error ( $ path . ' is not writable' ) ; $ this -> errors = true ; } } } | Checks the expected paths are writable . |
7,286 | private function exportConfig ( $ connection ) { if ( ! config ( 'datasets.' . $ this -> argument ( 'dataset' ) . '.connection' ) || config ( 'datasets.' . $ this -> argument ( 'dataset' ) . '.connection' ) !== $ connection ) { config ( [ 'datasets.' . $ this -> argument ( 'dataset' ) . '.connection' => $ connection ] ... | Export config back to the config file . |
7,287 | public function write ( $ string ) { $ converted = $ this -> converter -> convert ( $ string , $ this -> stringCharset , $ this -> streamCharset ) ; $ written = $ this -> converter -> getLength ( $ converted , $ this -> streamCharset ) ; $ this -> position += $ written ; return $ this -> stream -> write ( $ converted )... | Writes the passed string to the underlying stream after converting it to the target stream encoding . |
7,288 | public function getAttribute ( $ key ) { if ( ! $ this -> _defaultTranslateLanguage ) { $ this -> setDefaultTranslateLanguage ( ) ; } if ( ! $ this -> getTranslateLanguage ( ) ) { $ this -> translate ( $ this -> _defaultTranslateLanguage ) ; } if ( method_exists ( $ this , 'isCustomField' ) && $ this -> isCustomField (... | Get class attributes . |
7,289 | public function setDefaultTranslateLanguage ( $ languageSlug = '' ) { if ( ! $ languageSlug ) { $ languageSlug = App :: getLocale ( ) ; } $ this -> _defaultTranslateLanguage = $ languageSlug ; return $ this ; } | Set default language . |
7,290 | public function isTranslatable ( $ value , $ key ) { if ( ! is_object ( $ value ) && ! is_array ( $ value ) ) { $ value = json_decode ( $ value ) ; } if ( isset ( $ value -> { $ this -> getTranslateLanguage ( ) } ) ) { return true ; } $ valueToArray = key ( ( array ) $ value ) ; if ( strlen ( $ valueToArray ) == 2 ) { ... | Check if a value has language keys . |
7,291 | public function appendLanguageKeys ( ) { $ attributes = $ this -> getAttributes ( ) ; foreach ( $ attributes as $ attrKey => $ attr ) { if ( isset ( $ this -> translatableColumns [ $ attrKey ] ) ) { if ( is_array ( $ attr ) ) { continue ; } if ( $ attr == null || $ attr == "" || $ attr == '[]' ) { $ attr = new \ stdCla... | Add language keys in translatable json columns where a key doesn t exits . |
7,292 | public function getSerializer ( ) { if ( ! $ this -> serializer ) $ this -> serializer = new \ Asgard \ Entity \ Serializer ; return $ this -> serializer ; } | Return a serializer . |
7,293 | protected function makeDefinition ( $ entityClass ) { if ( $ this -> has ( $ entityClass ) ) return $ this -> definitions [ $ entityClass ] ; $ HookManager = $ this -> getHookManager ( ) ; $ definition = false ; if ( $ cache = $ this -> getCache ( ) ) $ definition = $ cache -> fetch ( 'asgard.entityManager.' . $ entity... | Make a new entity definition . |
7,294 | public function get ( string $ key , string $ locale = null ) { $ realKey = $ this -> getRealKey ( $ key , $ locale ) ; return ArrayHelper :: get ( $ this -> messages , $ realKey ) ; } | get message data by key |
7,295 | public function findLocale ( $ segment ) : ? Locale { return isset ( $ this -> locales [ $ segment ] ) ? Locale :: from ( $ this -> locales [ $ segment ] ) : null ; } | Get the locale by segment identifier . |
7,296 | public function segment ( $ locale = null ) : ? string { if ( is_null ( $ locale ) ) { return $ this -> activeSegment ( ) ; } return ( $ key = array_search ( $ locale , $ this -> locales ) ) ? $ key : null ; } | Get the url segment which corresponds with the passed locale . |
7,297 | public function preRemove ( PageTranslationInterface $ translation ) { $ translatable = $ translation -> getTranslatable ( ) ; if ( null !== $ parentPage = $ translatable -> getParent ( ) ) { $ from = $ translation -> getPath ( ) ; $ locale = $ translation -> getLocale ( ) ; $ localePrefix = $ locale != 'fr' ? '/' . $ ... | Pre remove event handler . |
7,298 | private function updateChildrenPageTranslationPath ( PageInterface $ page , UnitOfWork $ uow , ClassMetadata $ metadata , $ from , $ to , $ locale ) { $ localePrefix = $ locale != 'fr' ? '/' . $ locale : '' ; foreach ( $ page -> getChildren ( ) as $ child ) { $ translation = $ child -> translate ( $ locale ) ; $ oldPat... | Updates the page children translation path recursively . |
7,299 | public function postFlush ( ) { foreach ( $ this -> redirections as $ redirection ) { $ redirectionEvent = new BuildRedirectionEvent ( $ redirection [ 'from' ] , $ redirection [ 'to' ] , true ) ; $ this -> dispatcher -> dispatch ( RedirectionEvents :: BUILD , $ redirectionEvent ) ; } $ this -> redirections = [ ] ; } | Post flush event handler . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.