idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
54,500 | public function is ( $ filter ) : bool { if ( $ filter instanceof Entity ) { return $ this -> isSameAsEntity ( $ filter ) ; } if ( is_associative_array ( $ filter ) ) { return $ this -> matchesFilter ( $ filter ) ; } return $ this -> matchedId ( $ filter ) ; } | Check if entity is the same as the provided entity or matches id or filter . For a filter scalars are compared as string . |
54,501 | public static function display ( \ Exception $ e , $ title = 'Application Error' ) { @ ob_get_clean ( ) ; echo ' <html> <head> <title>' . $ title . '</title> <style> body{margin:0;padding:30px;font:14px/1.5 Helvetica,Arial,Verdana,sa... | Format an exception and show it . |
54,502 | protected static function getSnippetFromFile ( $ file , $ line ) { $ defaultSnippet = '<code><strong>Snippet not available</strong></code>' ; if ( file_exists ( $ file ) ) { $ start = $ line ; if ( $ start > 21 ) { $ start = $ line - 20 ; } $ end = $ start + 40 ; $ highlight = highlight_file ( $ file , true ) ; if ( ! ... | Get a snippet of the file |
54,503 | public static function getMoreInformationFromException ( \ Exception $ e ) { $ default = 'No further information available.' ; if ( ! property_exists ( $ e , 'additionalData' ) ) { return $ default ; } if ( ! is_array ( $ e -> additionalData ) ) { return $ default ; } if ( empty ( $ e -> additionalData ) ) { return $ d... | Get further information from Exception if it has the property additionalData |
54,504 | protected function createDefaultDDL ( $ default ) { $ dataType = $ this -> getDataType ( ) ; if ( is_array ( $ default ) ) { foreach ( $ default as $ k => $ option ) { $ default [ $ k ] = $ this -> getDataType ( ) -> quote ( $ option ) ; } $ default = '(' . implode ( ',' , $ default ) . ')' ; } elseif ( $ dataType inst... | Creates the portion of DDL for the column default value . |
54,505 | protected function createOnUpdateCurrentTimestampDDL ( ) { $ onUpdateDDL = null ; $ dataType = $ this -> getDataType ( ) ; if ( $ this -> isOnUpdateCurrentTimestamp ( ) ) { $ precision = null ; if ( $ dataType instanceof TimeTypeInterface && $ dataType -> hasPrecision ( ) ) { $ precision = '(' . $ dataType -> getPrecis... | Creates the portion of DDL for setting column value to the current time on update . |
54,506 | protected function handleAssetRequest ( array $ params ) { $ response = new Response ( ) ; $ assetsConf = $ this -> config -> getSection ( 'asset_resolv' ) ; $ assetsDir = $ this -> config -> get ( 'app.public_dir' ) . '/assets' ; if ( ! empty ( $ assetsConf [ 'current' ] ) ) { $ file = $ assetsDir . '/' . $ assetsConf... | Handle a asset request |
54,507 | protected function handleMetaUi ( array $ data , $ annotation , $ targetView , Request $ request = null ) { if ( empty ( $ annotation ) ) { return $ targetView ; } $ annotation -> prepare ( ) ; $ metaPath = $ this -> config -> get ( 'app.meta_dir' ) ; $ elementName = $ annotation -> name ; $ metaFile = $ annotation -> ... | This method handle a Meta - UI |
54,508 | protected function handleView ( $ class , $ method , $ data , $ annotation ) { if ( empty ( $ annotation ) ) { return null ; } $ annotation -> prepare ( ) ; $ template = $ annotation -> template ; if ( empty ( $ template ) ) { $ nsSepPos = strrpos ( $ class , '\\' ) ; $ class = preg_replace ( '/([A-Z])/' , '_$1' , subs... | handle the view layer |
54,509 | protected function prepareRequestParams ( array $ data ) { $ params = array ( ) ; foreach ( $ data as $ listParams ) { $ params = array_merge ( $ params , $ listParams ) ; } $ params [ '_controllerClass' ] = $ params [ '_controller' ] ; $ params [ '_controllerMethod' ] = $ params [ '_action' ] ; $ params [ '_controller... | This method prepares the request parameters to be consumed by Controller Resolver |
54,510 | public function getUserNames ( $ entity ) { $ users = $ this -> getDoctrine ( ) -> getRepository ( $ entity ) -> findBy ( [ 'enabled' => true , ] , [ 'id' => 'asc' , ] ) ; return CollectionUtility :: get ( 'username' , $ users ) ; } | Get Usernames as array |
54,511 | private function validate ( $ uri ) { try { $ validate = [ ] ; if ( strpos ( $ uri , self :: VALIDATION_PREFIX ) === false && strpos ( $ uri , $ this -> getDelimiter ( ) ) === false ) { return false ; } $ parts = explode ( $ this -> _delimiter , $ uri ) ; for ( $ i = 0 , $ c = count ( $ parts ) ; $ i < $ c ; $ i ++ ) {... | validates a url and adds the validator to the mapping part |
54,512 | private function init ( $ uri , $ callback ) { try { $ this -> validate ( $ uri ) ; switch ( true ) { case ( is_array ( $ callback ) || ( is_object ( $ callback ) && ! is_callable ( $ callback ) ) ) : $ this -> setType ( self :: TYPE_O ) ; $ this -> strategy = StrategyFactory :: make ( self :: TYPE_O , $ callback , new... | initlializes the mapping |
54,513 | public function deleteSalesDiscount ( int $ id ) : bool { Assert :: that ( $ id ) -> greaterThan ( 0 , '$id must be positive' ) ; return ( bool ) $ this -> master -> doRequest ( 'DELETE' , sprintf ( '/admin/WEBAPI/Endpoints/v1_0/DiscountService/{KEY}/salesDiscount/%d' , $ id ) ) ; } | Deletes a sales discount |
54,514 | public function process ( $ cmd , $ descriptors , $ cwd = null , $ env = null , $ options = null ) { $ this -> beginProcess ( $ cmd , $ descriptors , $ cwd , $ env , $ options ) ; return $ this -> endProcess ( ) ; } | Runs a process . |
54,515 | public function beginProcess ( $ cmd , $ descriptors , $ cwd = null , $ env = null , $ options = null ) { if ( isset ( $ this -> _process ) ) { throw new CException ( 'Failed to start process. Process is already running.' ) ; } echo "Running command: $cmd ... " ; $ this -> _process = proc_open ( $ cmd , $ descriptors ,... | Opens a process . |
54,516 | public function endProcess ( ) { if ( isset ( $ this -> _process ) ) { $ error = $ this -> getError ( ) ; foreach ( array_keys ( $ this -> _pipes ) as $ descriptor ) { $ this -> closeResource ( $ descriptor ) ; } $ return = proc_close ( $ this -> _process ) ; if ( $ return !== 0 ) { throw new CException ( sprintf ( 'Pr... | Closes all open pipes and ends the current process . |
54,517 | public function writeToResource ( $ index , $ string , $ length = null ) { return isset ( $ this -> _pipes [ $ index ] ) ? fwrite ( $ this -> _pipes [ $ index ] , $ string , $ length ) : false ; } | Writes to a specific resource . |
54,518 | public function readFromResource ( $ descriptor , $ close = true ) { if ( isset ( $ this -> _pipes [ $ descriptor ] ) ) { $ contents = stream_get_contents ( $ this -> _pipes [ $ descriptor ] ) ; if ( $ close ) { $ this -> closeResource ( $ descriptor ) ; } return $ contents ; } return false ; } | Reads from a specific resource . |
54,519 | public function closeResource ( $ descriptor ) { if ( isset ( $ this -> _pipes [ $ descriptor ] ) ) { $ success = fclose ( $ this -> _pipes [ $ descriptor ] ) ; unset ( $ this -> _pipes [ $ descriptor ] ) ; return $ success ; } return false ; } | Closes a specific resource . |
54,520 | public function getResource ( $ descriptor ) { return isset ( $ this -> _pipes [ $ descriptor ] ) ? $ this -> _pipes [ $ descriptor ] : null ; } | Returns a specific resource . |
54,521 | public function apply ( $ testable , array $ config = array ( ) ) { $ tokens = $ testable -> tokens ( ) ; $ lines = $ testable -> lines ( ) ; $ typeCache = $ testable -> typeCache ( ) ; $ matches = array ( ) ; if ( ! isset ( $ typeCache [ T_USE ] ) ) { return ; } foreach ( $ typeCache [ T_USE ] as $ tokenId ) { $ token... | Iterates over T_USE tokens gets the aliased name into an array and validates it was used within the script . |
54,522 | protected function setPathInfo ( ) { $ query = $ this -> server -> get ( 'QUERY_STRING' , '' ) ; $ script = $ this -> server -> get ( 'SCRIPT_NAME' , '' ) ; $ uri = $ this -> server -> get ( 'REQUEST_URI' , '/' ) ; $ path = preg_replace ( [ '/\A' . preg_quote ( $ script , '/' ) . '/' , '/\A' . preg_quote ( dirname ( $ ... | Set path_info based on QUERY_STRING SCRIPT_NAME and REQUEST_URI . |
54,523 | protected function getCached ( string $ playerName , string $ cacheKey ) { $ playerCacheKey = strtolower ( $ playerName ) ; if ( ! isset ( $ this -> cache [ $ cacheKey ] [ $ playerCacheKey ] ) ) { return null ; } return $ this -> cache [ $ cacheKey ] [ $ playerCacheKey ] ; } | Returns an object from cache or null if it isn t cached . |
54,524 | protected function fetch ( string $ playerName , string $ cacheKey , array $ fetchStrategies ) { $ playerCacheKey = strtolower ( $ playerName ) ; if ( isset ( $ this -> cache [ $ cacheKey ] [ $ playerCacheKey ] ) ) { return $ this -> cache [ $ cacheKey ] [ $ playerCacheKey ] ; } $ firstException = null ; foreach ( $ fe... | Fetches an item from cache or obtains it freshly using the given functions . |
54,525 | protected function fetchUrl ( string $ url ) : string { $ curl = curl_init ( $ url ) ; curl_setopt_array ( $ curl , [ CURLOPT_RETURNTRANSFER => true , CURLOPT_TIMEOUT => $ this -> timeOut ] ) ; $ data = curl_exec ( $ curl ) ; $ statusCode = curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) ; $ error = curl_error ( $ curl ) ... | Fetches data from the given URL . |
54,526 | public function getControllerName ( ) { if ( null === $ this -> _controller ) { $ this -> _controller = $ this -> getParam ( $ this -> getControllerKey ( ) ) ; } return $ this -> _controller ; } | Retrieve the controller name |
54,527 | public function setActionName ( $ value ) { $ this -> _action = $ value ; if ( null === $ value ) { $ this -> setParam ( $ this -> getActionKey ( ) , $ value ) ; } return $ this ; } | Set the action name |
54,528 | public function getParam ( $ key , $ default = null ) { $ key = ( string ) $ key ; if ( isset ( $ this -> _params [ $ key ] ) ) { return $ this -> _params [ $ key ] ; } return $ default ; } | Get an action parameter |
54,529 | public function setParams ( array $ array ) { $ this -> _params = $ this -> _params + ( array ) $ array ; foreach ( $ array as $ key => $ value ) { if ( null === $ value ) { unset ( $ this -> _params [ $ key ] ) ; } } return $ this ; } | Set action parameters en masse ; does not overwrite |
54,530 | public function fetchAssociatedRepository ( $ entity_property ) { $ entity_class = $ this -> getClassName ( ) ; $ class_meta_data = $ this -> getEntityManager ( ) -> getClassMetaData ( $ entity_class ) ; $ associated_mapping = $ class_meta_data -> getAssociationMapping ( $ entity_property ) ; return $ this -> getEntity... | Fetch an associated repository by property name |
54,531 | private function makeComparison ( $ builder , $ field , $ operator , $ value , $ pcount = NULL ) { $ method_translations = [ '=' => 'eq' , '<' => 'lt' , '>' => 'gt' , '!' => 'neq' , '~' => 'like' , 'in' => 'in' , '!in' => 'notIn' , '==' => 'eq' , '!=' => 'neq' , '<>' => 'neq' , '<=' => 'lte' , '>=' => 'gte' ] ; if ( ! ... | Makes a comparison based on shortened operators |
54,532 | final protected function createSelectQuery ( Query $ query ) { $ select = $ this -> getDatabase ( ) -> select ( 'node' , 'n' ) -> fields ( 'n' , [ 'nid' ] ) -> addTag ( 'node_access' ) ; if ( $ this -> addGroupby ( ) ) { $ select -> groupBy ( 'n.nid' ) ; } return $ select ; } | Create node select query override this to change it |
54,533 | final protected function process ( \ SelectQuery $ select , Query $ query ) { $ sortOrder = Query :: SORT_DESC === $ query -> getSortOrder ( ) ? 'desc' : 'asc' ; if ( $ query -> hasSortField ( ) ) { $ select -> orderBy ( $ query -> getSortField ( ) , $ sortOrder ) ; } $ select -> orderBy ( $ this -> getPredictibleOrder... | Implementors must set the node table with n as alias and call this method for the datasource to work correctly . |
54,534 | protected function generateImage ( $ id , $ word ) { $ font = $ this -> getFont ( ) ; if ( empty ( $ font ) ) { throw new Exception \ NoFontProvidedException ( 'Image CAPTCHA requires font' ) ; } $ w = $ this -> getWidth ( ) ; $ h = $ this -> getHeight ( ) ; $ fsize = $ this -> getFontSize ( ) ; $ img_file = $ this -> ... | Generate image captcha |
54,535 | public function appendParameter ( Parameter $ Parameter , $ Handler = null ) { switch ( true ) { case $ Parameter instanceof Option : $ this -> parameters [ $ Parameter -> getLong ( ) ] = $ Parameter ; if ( ! is_null ( $ Handler ) ) { if ( $ Handler instanceof Closure ) { $ this -> setEvent ( $ Parameter , $ Handler ) ... | Append parameter method |
54,536 | public function appendHelpParameter ( $ description ) { $ Option = new HelpOption ( $ description ) ; $ Self = $ this ; $ this -> appendParameter ( $ Option , function ( ) use ( $ Self ) { $ Self -> displayHelp ( ) ; } ) ; } | Append help parameter |
54,537 | public function setEvent ( Parameter $ Parameter , Closure $ Handler ) { switch ( true ) { case $ Parameter instanceof Option : $ long = $ Parameter -> getLong ( ) ; if ( isset ( $ this -> parameters [ $ long ] ) ) { $ this -> events [ $ long ] = $ Handler ; } else { throw new ParameterNotFoundException ( ) ; } break ;... | Set event for added parameter |
54,538 | public function content ( $ index = 0 ) { if ( isset ( $ this -> _contentView [ $ index ] ) ) { $ this -> _contentView [ $ index ] -> render ( ) ; } } | Show the content in the layout |
54,539 | public function addAndTerm ( $ term , $ value ) { $ value = trim ( $ value ) ; if ( $ this -> query !== '' ) { $ this -> query .= ' AND ' ; } $ this -> query .= $ term . ':' . $ value ; } | Adds a query term to the query with AND . This should only be used by Arachnid as it takes a term of ANDS and hands it to everyman index - > query . |
54,540 | public function create ( $ name , $ type , array $ options ) { if ( is_string ( $ type ) ) { $ type = $ this -> registry -> getType ( $ type ) ; } if ( ! $ type instanceof WidgetTypeInterface ) { throw new \ InvalidArgumentException ( 'Unexpected widget type.' ) ; } $ options [ 'name' ] = $ name ; $ resolver = new Opti... | Creates the widget . |
54,541 | public function guardar ( $ llave , $ valor , $ expiracion = 0 ) { return $ this -> gestor -> set ( $ llave , $ valor , $ expiracion ) ; } | Guarda los datos de la llave en el servidor cache . |
54,542 | public function connect ( array $ parameters = null ) : Connection { if ( is_null ( $ parameters ) ) { $ parameters = $ this -> data ; } $ config = new Configuration ( ) ; $ this -> connection = DriverManager :: getConnection ( $ parameters , $ config ) ; return $ this -> connection ; } | Connects into database . |
54,543 | private function identifyIndexes ( string $ rute ) { $ array = explode ( '/' , substr ( $ rute , 1 , strlen ( $ rute ) ) ) ; for ( $ index = 0 ; $ index < count ( $ array ) ; $ index ++ ) { if ( preg_match ( '/[:][a-z]/' , $ array [ $ index ] ) ) { $ this -> indexes -> add ( $ index ) ; } } } | Identificar el indice de los paramatros contenidos en la ruta . |
54,544 | private function clean ( string $ actual , string $ peticion ) { $ this -> buffer1 -> addAll ( explode ( '/' , substr ( $ actual , 1 , strlen ( $ actual ) ) ) ) ; $ this -> buffer2 -> addAll ( explode ( '/' , substr ( $ peticion , 1 , strlen ( $ peticion ) ) ) ) ; $ this -> indexes -> each ( function ( $ number ) { $ t... | Limpiar las ruta de los parametros . |
54,545 | public function compareRute ( string $ actual , string $ peticion ) : bool { $ this -> identifyIndexes ( $ actual ) ; $ this -> clean ( $ actual , $ peticion ) ; return $ this -> actual === $ this -> peticion ; } | Permite haser una comparacion de las rutas al detalle . |
54,546 | public function existRutes ( $ actual , $ peticion ) : bool { $ this -> buffer1 -> addAll ( explode ( '/' , substr ( $ actual , 1 , strlen ( $ actual ) ) ) ) ; $ this -> buffer2 -> addAll ( explode ( '/' , substr ( $ peticion , 1 , strlen ( $ peticion ) ) ) ) ; $ temp = $ this -> buffer1 -> lenght ( ) === $ this -> buf... | Verifica si existe alguna ruta que se pueda ejecutar |
54,547 | public function isRoot ( string $ actual , string $ peticion ) : bool { $ temp = false ; if ( $ actual === $ peticion || $ actual . '/' === $ peticion ) { $ temp = true ; } return $ temp ; } | Saber si es la heme page o no . |
54,548 | public static function validateConstructorArgs ( $ name , $ globalThreshold , $ metric , $ metricFactor , $ componentThreshold , $ components , $ validMetrics ) { if ( ! self :: validateName ( $ name ) ) throw new \ Franzip \ Throttler \ Exceptions \ InvalidArgumentException ( 'Invalid Throttler $name: please supply a ... | Validate Throttler constructor args . |
54,549 | protected function addOptimizableClasses ( ) { $ collection = $ this -> compiler -> run ( ) ; $ this -> displayAddedFiles ( $ collection ) ; $ this -> displayMissingFiles ( $ collection ) ; } | Add list of classes to be optimized . |
54,550 | protected function displayAddedFiles ( Fluent $ collection ) { if ( $ this -> getOutput ( ) -> getVerbosity ( ) >= OutputInterface :: VERBOSITY_VERY_VERBOSE ) { foreach ( $ collection -> get ( 'added' ) as $ file ) { $ this -> info ( "File added: [{$file}]" ) ; } } } | Display added files . |
54,551 | protected function displayMissingFiles ( Fluent $ collection ) { if ( $ this -> getOutput ( ) -> getVerbosity ( ) >= OutputInterface :: VERBOSITY_VERBOSE ) { foreach ( $ collection -> get ( 'missing' ) as $ file ) { $ this -> comment ( "File not found: [{$file}]" ) ; } } } | Display missing files . |
54,552 | public function reset ( $ name = null ) { if ( $ name === 'violations' ) { $ this -> _violations = array ( ) ; } elseif ( $ name === 'warnings' ) { $ this -> _warnings = array ( ) ; } else { $ this -> _violations = array ( ) ; $ this -> _warnings = array ( ) ; } } | Will reset the current list of violations |
54,553 | public function handle ( ) { $ whoops = new \ Whoops \ Run ( ) ; $ whoops -> pushHandler ( new \ Whoops \ Handler \ PlainTextHandler ( ) ) ; $ whoops -> pushHandler ( new \ Whoops \ Handler \ PrettyPageHandler ( ) ) ; $ whoops -> allowQuit ( false ) ; $ whoops -> writeToOutput ( false ) ; return $ whoops -> handleExcep... | Handle an error with Whoops |
54,554 | protected function _setTemplate ( $ template ) { if ( $ template !== null && ! ( $ template instanceof TemplateInterface ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Invalid template' ) , null , null , $ template ) ; } $ this -> template = $ template ; } | Assigns the template to this instance .. |
54,555 | public function init ( ) { if ( ! Yii :: app ( ) -> hasModule ( 'user' ) ) { return false ; } if ( ! Yii :: app ( ) -> getModule ( 'user' ) -> user ( ) ) { return false ; } Yii :: app ( ) -> urlManager -> parseUrl ( Yii :: app ( ) -> getRequest ( ) ) ; $ preferred = null ; if ( isset ( $ _GET [ $ this -> data_key ] ) &... | Handles company detection and application setting by URL parm specified in DATA_KEY |
54,556 | public function getClientCompanies ( ) { if ( $ this -> _aUserCompanies === FALSE ) { $ sql = " SELECT DISTINCT ccmp_id, ccmp_name FROM ccuc_user_company INNER JOIN ccmp_co... | get all client companies |
54,557 | private function _setActiveCompany ( $ ccmp_id ) { if ( Yii :: app ( ) -> getModule ( 'user' ) -> user ( ) -> profile -> ccmp_id != $ ccmp_id ) { $ sSql = " UPDATE profiles SET " . $ this -> profiles_ccmp_field . " = " . $ ccmp_id . " WHERE user_id = " ... | colect active company data and set actice company in user prifle table |
54,558 | public function checkUA ( $ name ) { if ( empty ( $ this -> _auth_items ) ) { $ this -> getAuthItemChild ( ) ; } return isset ( $ this -> _auth_items [ $ name ] ) ; } | chek user access |
54,559 | public function Set ( $ name , $ value , $ expiry = self :: OneYear , $ path = '/' , $ domain = false ) { $ retval = false ; if ( ! headers_sent ( ) ) { if ( $ domain === false ) $ domain = $ _SERVER [ 'HTTP_HOST' ] ; if ( $ expiry === - 1 ) $ expiry = 1893456000 ; elseif ( is_numeric ( $ expiry ) ) $ expiry += time ( ... | Set a cookie . Silently does nothing if headers have already been sent . |
54,560 | public function execute ( $ cmd , array $ projects , BufferedOutputInterface $ output ) { foreach ( $ projects as $ name => $ data ) { $ project = new Project ( $ name , $ data [ 'path' ] ) ; if ( ! empty ( $ data [ 'foreground_color' ] ) ) { $ project -> setForegroundColor ( $ data [ 'foreground_color' ] ) ; } else { ... | Executes a shell command asynchronously in all registered projects . |
54,561 | private function getRandomColorCode ( ) { do { $ colorCode = rand ( 0 , 255 ) ; } while ( in_array ( $ colorCode , $ this -> usedColorCodes ) ) ; $ this -> usedColorCodes [ ] = $ colorCode ; return $ colorCode ; } | Returns a random not yet used color code . |
54,562 | public function copy ( $ source ) { if ( ! array_key_exists ( $ source , $ this -> getCatalog ( ) ) ) { throw new SkeletonException ( 'Invalid source file' ) ; } $ target = $ this -> getCatalog ( ) [ $ source ] ; if ( ! $ this -> canICopyTo ( $ target ) ) { throw new SkeletonException ( 'Target is not writable' ) ; } $... | Copy declared resources to Composer project |
54,563 | protected function allWarehouseContent ( ) { $ warehouseContent = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ this -> getWarehousePath ( ) ) ) ; $ warehouseContent = iterator_to_array ( $ warehouseContent ) ; $ warehouseContent = array_map ( function ( SplFileInfo $ file ) { return $ file -> getP... | Generates an array of all directories and files in warehouse dir |
54,564 | protected function toBasePath ( $ warehouseFilePath ) { $ target = $ this -> getBasePath ( ) ; $ target .= DIRECTORY_SEPARATOR ; $ target .= str_replace ( $ this -> getWarehousePath ( ) , '' , $ warehouseFilePath ) ; return $ target ; } | Replaces warehouse path to base path this allow to change a source path to a target path . |
54,565 | protected function canICopyTo ( $ target ) { $ fileExists = file_exists ( $ target ) ; $ emptyFile = $ fileExists ? filesize ( $ target ) === 0 : false ; return ( ! $ fileExists || $ emptyFile ) ; } | Returns true if target file doesn t exist or if it s empty therefore the file can be safely written or overwritten . |
54,566 | protected function retrieveWarehousePath ( ) { foreach ( self :: WAREHOUSE_DIRS as $ candidate ) { $ warehousePath = sprintf ( $ candidate , $ this -> getBasePath ( ) ) ; if ( is_dir ( $ warehousePath ) ) { return $ warehousePath ; } } throw new SkeletonException ( 'Cannot locate warehouse dir' ) ; } | Returns the location of warehouse directory |
54,567 | public static function fromArray ( array $ data ) { $ config = isset ( $ data [ 'config' ] ) ? $ data [ 'config' ] : [ ] ; return new static ( $ data [ 'name' ] , $ data [ 'pluralName' ] , $ data [ 'uri' ] , $ config ) ; } | Constructs the Taxonomy from an array of data |
54,568 | public function getGroups ( $ area , $ locale ) { return $ this -> model -> where ( 'area' , $ area ) -> whereHas ( 'language' , function ( $ query ) use ( $ locale ) { $ query -> where ( 'code' , $ locale ) ; } ) -> groupBy ( 'group' ) -> orderBy ( 'group' , 'desc' ) -> get ( ) ; } | get translation groups |
54,569 | public function getList ( $ area , $ locale ) { $ model = $ this -> app -> make ( $ this -> model ( ) ) ; $ group = str_replace ( [ "\n" , "\r" , ' ' ] , '' , $ this -> app -> make ( 'languages' ) -> getTranslationNamedGroup ( ) ) ; return $ model -> where ( 'area' , $ area ) -> where ( function ( $ query ) use ( $ loc... | get translations by type and locale |
54,570 | public function importTranslations ( $ path , $ type ) { $ separator = app ( 'config' ) -> get ( 'antares/translations::export.separator' ) ; $ content = explode ( PHP_EOL , file_get_contents ( $ path ) ) ; $ list = [ ] ; foreach ( $ content as $ index => $ line ) { if ( $ index == 0 ) { continue ; } array_push ( $ lis... | saves translations in database |
54,571 | public function deleteByCollection ( $ langId , $ area , $ list ) { if ( empty ( $ list ) ) { return ; } foreach ( $ list as $ group => $ element ) { DB :: table ( 'tbl_translations' ) -> where ( 'lang_id' , $ langId ) -> where ( 'group' , $ group ) -> where ( 'area' , $ area ) -> where ( 'key' , key ( $ element ) ) ->... | delete translations using collection |
54,572 | public function updateTranslations ( $ params , $ type ) { if ( is_null ( $ translations = array_get ( $ params , 'name' ) ) ) { return false ; } try { DB :: transaction ( function ( ) use ( $ translations , $ type ) { foreach ( $ translations as $ id => $ value ) { $ where = [ 'id' => $ id , 'area' => $ type ] ; $ mod... | mass update translations |
54,573 | public function getCategories ( $ id , $ locale ) { $ groups = $ this -> getGroups ( $ id , $ locale ) -> toArray ( ) ; $ available = antares ( 'memory' ) -> get ( 'extensions.available' ) ; $ list = [ 'all' => 'All' , 'foundation' => trans ( 'Core' ) ] ; array_walk ( $ groups , function ( $ item ) use ( $ available , ... | Gets translation categories |
54,574 | public function count ( $ area , $ locale ) { return $ this -> makeModel ( ) -> newQuery ( ) -> where ( [ 'area' => $ area , 'locale' => $ locale ] ) -> count ( ) ; } | Counts translations by area |
54,575 | public function setPageStructure ( array $ structure ) { foreach ( $ structure as $ _ref ) { HtmlHelper :: getNewId ( $ _ref , true ) ; } $ this -> registry -> setEntry ( 'page_structure' , $ structure ) ; return $ this ; } | Set the page structure |
54,576 | public function setToTemplate ( $ var , $ val ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; $ this -> templateFallback ( $ var , $ args , 'set' ) ; return $ this ; } | Set to Template object |
54,577 | public function templateFallback ( $ name , array $ args = array ( ) , $ fallback = null ) { return $ this -> _runFallbackMethod ( $ this -> template , $ name , $ args , ( $ this -> getFlags ( ) & TemplateEngine :: THROW_TEMPLATE_ERRORS ) , $ fallback ) ; } | Fallback system to call a Template object s method |
54,578 | public function setToView ( $ var , $ val ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; $ this -> viewFallback ( $ var , $ args , 'set' ) ; return $ this ; } | Set to View object |
54,579 | public function viewFallback ( $ name , array $ args = array ( ) , $ fallback = null ) { return $ this -> _runFallbackMethod ( $ this -> view , $ name , $ args , ( $ this -> getFlags ( ) & TemplateEngine :: THROW_VIEW_ERRORS ) , $ fallback ) ; } | Fallback system to call a View object s method |
54,580 | public function useAssetsPreset ( $ preset_name = null ) { $ preset = $ this -> assets_loader -> getPreset ( $ preset_name ) ; $ preset -> load ( ) ; } | Automatic assets loading from an Assets preset declare in a composer . json |
54,581 | public function includePackagesViewsFunctions ( ) { $ _assets_package = Package :: createFromAssetsLoader ( $ this -> assets_loader ) ; foreach ( $ this -> assets_loader -> getAssetsDb ( ) as $ package => $ config ) { if ( ! empty ( $ config [ 'views_functions' ] ) ) { $ assets_package = clone $ _assets_package ; $ ass... | Automatic loading of assets views functions |
54,582 | protected function _prepareRendering ( ) { $ this -> view -> addDefaultViewParam ( '_template' , $ this ) ; $ structure = $ this -> getPageStructure ( ) ; if ( empty ( $ structure ) ) { $ this -> setPageStructure ( self :: $ default_page_structure ) ; } } | Required settings before rendering |
54,583 | public function renderLayout ( $ view = null , array $ params = array ( ) , $ display = false , $ exit = false ) { if ( is_null ( $ view ) ) { $ view = $ this -> getPageLayout ( ) ; } return $ this -> render ( $ view , $ params , $ display , $ exit ) ; } | Rendering of a layout |
54,584 | protected function _getFallbackMethod ( $ varname , array $ arguments = array ( ) , $ throw_errors = false , $ fallback = null ) { $ var = $ this -> _getFallbackVarname ( $ varname ) ; $ template_val = $ this -> _runFallbackMethod ( $ this -> template , $ var , $ arguments , $ throw_errors , $ fallback ) ; if ( ! empty... | Process a fallback method on Template and View and returns the result |
54,585 | protected function _getFallbackVarname ( $ name ) { if ( false === strpos ( $ name , '_' ) ) { return $ name ; } $ parts = explode ( '_' , $ name ) ; $ str = '' ; foreach ( $ parts as $ _part ) { $ str .= strlen ( $ str ) ? ucfirst ( $ _part ) : $ _part ; } return $ str ; } | Get a variable name in CamelCase |
54,586 | protected function _runFallbackMethod ( $ object , $ varname , array $ arguments = array ( ) , $ throw_errors = false , $ fallback = null ) { if ( property_exists ( $ object , $ varname ) ) { try { $ object -> { $ varname } = $ args ; return $ object ; } catch ( \ Exception $ e ) { } } if ( method_exists ( $ object , $... | Process a fallback method on an object |
54,587 | public function offsetExists ( $ offset ) { $ val = $ this -> registry -> getEntry ( $ offset , null ) ; if ( empty ( $ val ) ) { $ val = $ this -> _getFallbackMethod ( $ offset , array ( ) , false , 'get' ) ; } return ( bool ) null !== $ val ; } | Check existence of a variable by array access to the TemplateEngine |
54,588 | public function offsetGet ( $ offset ) { $ val = $ this -> registry -> getEntry ( $ offset , null ) ; if ( empty ( $ val ) ) { $ val = $ this -> _getFallbackMethod ( $ offset , array ( ) , false , 'get' ) ; } return $ val ; } | Get a variable by array access to the TemplateEngine |
54,589 | public function setAssetsLoader ( AssetsLoader $ loader ) { $ this -> assets_loader = $ loader ; $ assets_db = $ this -> assets_loader -> getAssets ( ) ; if ( ! empty ( $ assets_db ) ) { $ _assets_package = Package :: createFromAssetsLoader ( $ this -> assets_loader ) ; foreach ( $ assets_db as $ package => $ config ) ... | Set the object Assets Loader instance |
54,590 | public function guessFromAssetsLoader ( AssetsLoader $ loader ) { $ this -> setAssetsLoader ( $ loader ) ; $ this -> setLayoutsDir ( $ this -> assets_loader -> getAssetsRealPath ( ) ) -> setToTemplate ( 'setWebRootPath' , $ this -> assets_loader -> getAssetsWebPath ( ) ) -> setToView ( 'addDefaultViewParam' , 'assets' ... | Set the object Assets Loader instance and dispatch required template envionement |
54,591 | public static function __error ( $ message = 'View error' , $ file = null , $ line = null ) { if ( ! is_null ( $ file ) ) { $ message .= sprintf ( ' in file "%s"' , $ file ) ; if ( ! is_null ( $ line ) ) { $ message .= sprintf ( ' at line %s' , $ line ) ; } } trigger_error ( $ message , E_USER_WARNING ) ; } | Write a simple error during view rendering |
54,592 | public static function __closurable ( $ value , array $ arguments = array ( ) ) { if ( is_callable ( $ value ) ) { try { $ val = call_user_func_array ( $ value , $ arguments ) ; return $ val ; } catch ( Exception $ e ) { self :: __error ( sprintf ( 'Closure error: "%s"!' , $ e -> getMessage ( ) ) , $ e -> getFile ( ) ,... | Try to execute a closure sending an error if necessary |
54,593 | public static function __string ( $ value , $ glue = ', ' ) { if ( is_object ( $ value ) ) { if ( method_exists ( $ value , '__toString' ) ) { return $ value -> __toString ( ) ; } if ( $ value instanceof ArrayAccess ) { return implode ( $ glue , $ value ) ; } return get_class ( $ value ) ; } elseif ( is_array ( $ value... | Get safely a string from any kind of variable |
54,594 | public function navigate ( ) { if ( $ this -> url ) { $ this -> session -> url ( $ this -> url ) ; } else { $ this -> session -> navigate ( $ this -> presenterName , $ this -> presenterParameters ) ; } return $ this ; } | Navigates to this page . |
54,595 | public function checkState ( ) { if ( $ this -> url ) { if ( ( $ actualUrl = $ this -> session -> url ( ) ) !== $ this -> url ) { throw new ViewStateException ( __METHOD__ . ": URL '$this->url' was expected, actual URL is '$actualUrl'." ) ; } } else { $ appRequest = $ this -> session -> appRequest ; if ( $ appRequest -... | Checks that this page is open in the browser . |
54,596 | public function run ( Job $ job ) { $ this -> logger -> info ( 'Starting Job: ' . $ job -> id . ' | ' . $ job -> command ) ; $ callback = array ( $ this , 'notifyExecutionEnd' ) ; $ runner = $ this -> getJobRunner ( $ job ) ; if ( $ this -> hasDependency ( $ job ) ) { $ job_dep = $ this -> getDependency ( $ job ) ; if ... | Runs a single command |
54,597 | private function execute ( Job $ job , JobRunner $ runner , $ callback ) { $ runner -> runIt ( $ job , $ callback ) ; } | Just run the job |
54,598 | public function Contains ( $ path = '' , $ async = FALSE , $ defer = FALSE , $ doNotMinify = FALSE ) { $ result = FALSE ; $ scriptsGroup = & $ this -> _getScriptsGroupContainer ( $ this -> actualGroupName ) ; foreach ( $ scriptsGroup as & $ item ) { if ( $ item -> path == $ path ) { if ( $ item -> async == $ async && $... | Check if script is already presented in scripts group |
54,599 | public function AppendExternal ( $ path = '' , $ async = FALSE , $ defer = FALSE , $ doNotMinify = FALSE ) { return $ this -> Append ( $ path , $ async , $ defer , $ doNotMinify , TRUE ) ; } | Append script after all group scripts for later render process with downloading external content |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.