idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
8,200 | public function delete ( $ lang , $ id ) { if ( ! User :: hasAccess ( 'Language' , 'delete' ) ) { return $ this -> noPermission ( ) ; } $ language = Language :: find ( $ id ) ; if ( $ language ) { if ( $ language -> isDefault ) { return $ this -> response ( "You can't delete the default language!" , 403 ) ; } if ( $ la... | Delete language . Removes language directory used for labels . |
8,201 | public function bulkDelete ( Request $ request ) { if ( ! User :: hasAccess ( 'Language' , 'delete' ) ) { return $ this -> noPermission ( ) ; } if ( count ( $ request -> all ( ) ) <= 0 ) { return $ this -> response ( 'Please select some languages to be deleted' , 500 ) ; } $ allPostTypes = PostType :: all ( ) ; foreach... | Bulk Delete languages . |
8,202 | private function createNewLanguageLabels ( string $ slug ) { $ defaultLangPathLibrary = accioPath ( "resources/lang/" . Language :: getDefault ( ) -> slug ) ; $ defaultLangPath = base_path ( "resources/lang/" . Language :: getDefault ( ) -> slug ) ; if ( is_dir ( $ defaultLangPathLibrary ) ) { File :: copyDirectory ( $... | Copies labels from the default languages to the new language . So creates labels for new language . |
8,203 | private function readToEndOfLine ( $ length ) { $ str = $ this -> stream -> read ( $ length ) ; if ( $ str === false || $ str === '' ) { return $ str ; } while ( substr ( $ str , - 1 ) !== "\n" ) { $ chr = $ this -> stream -> read ( 1 ) ; if ( $ chr === false || $ chr === '' ) { break ; } $ str .= $ chr ; } return $ st... | Finds the next end - of - line character to ensure a line isn t broken up while buffering . |
8,204 | private function filterAndDecode ( $ str ) { $ ret = str_replace ( "\r" , '' , $ str ) ; $ ret = preg_replace ( '/[^\x21-\xf5`\n]/' , '`' , $ ret ) ; if ( $ this -> position === 0 ) { $ matches = [ ] ; if ( preg_match ( '/^\s*begin\s+[^\s+]\s+([^\r\n]+)\s*$/im' , $ ret , $ matches ) ) { $ this -> filename = $ matches [... | Removes invalid characters from a uuencoded string and BEGIN and END line headers and footers from the passed string before returning it . |
8,205 | private function writeUUHeader ( ) { $ filename = ( empty ( $ this -> filename ) ) ? 'null' : $ this -> filename ; $ this -> stream -> write ( "begin 666 $filename" ) ; } | Writes the begin UU header line . |
8,206 | private function writeEncoded ( $ bytes ) { $ encoded = preg_replace ( '/\r\n|\r|\n/' , "\r\n" , rtrim ( convert_uuencode ( $ bytes ) ) ) ; $ this -> stream -> write ( "\r\n" . rtrim ( substr ( $ encoded , 0 , - 1 ) ) ) ; } | Writes the passed bytes to the underlying stream after encoding them . |
8,207 | private function handleRemainder ( $ string ) { $ write = $ this -> remainder . $ string ; $ nRem = strlen ( $ write ) % 45 ; $ this -> remainder = '' ; if ( $ nRem !== 0 ) { $ this -> remainder = substr ( $ write , - $ nRem ) ; $ write = substr ( $ write , 0 , - $ nRem ) ; } return $ write ; } | Prepends any existing remainder to the passed string then checks if the string fits into a uuencoded line and removes and keeps any remainder from the string to write . Full lines ready for writing are returned . |
8,208 | public function write ( $ string ) { $ this -> isWriting = true ; if ( $ this -> position === 0 ) { $ this -> writeUUHeader ( ) ; } $ write = $ this -> handleRemainder ( $ string ) ; if ( $ write !== '' ) { $ this -> writeEncoded ( $ write ) ; } $ written = strlen ( $ string ) ; $ this -> position += $ written ; return... | Writes the passed string to the underlying stream after encoding it . |
8,209 | private function beforeClose ( ) { if ( ! $ this -> isWriting ) { return ; } if ( $ this -> remainder !== '' ) { $ this -> writeEncoded ( $ this -> remainder ) ; } $ this -> remainder = '' ; $ this -> isWriting = false ; $ this -> writeUUFooter ( ) ; } | Writes out any remaining bytes and the UU footer . |
8,210 | public function has ( string $ key ) : bool { $ key = $ this -> prepareKey ( $ key ) ; return Arr :: has ( $ this -> properties , $ key ) ; } | Check if key exist . |
8,211 | public function validate ( $ name ) { $ pattern = '/[\\\\\\' . implode ( '\\' , $ this -> characterList ) . ']/i' ; $ depricatedCharacters = null ; $ fistDotMatch = null ; $ fistUnderscoreMatch = null ; $ depricatedCharacters = preg_match ( $ pattern , $ name , $ depricatedCharacters ) ; $ fistDotMatch = preg_match ( '... | Validates file or folder name |
8,212 | public function getLink ( ) { if ( $ this -> get ( 'many' ) && $ this -> type ( ) == 'hasMany' ) return $ this -> reverse ( ) -> get ( 'name' ) . '_id' ; elseif ( ! $ this -> get ( 'many' ) ) return $ this -> name . '_id' ; } | Get the relation link attribute . |
8,213 | public function getLinkA ( ) { if ( $ this -> reverse ( ) -> isPolymorphic ( ) ) return $ this -> reverse ( ) -> get ( 'as' ) . '_id' ; else return $ this -> reverse ( ) -> getName ( ) . '_id' ; } | Get the link A for a HMABT relation . |
8,214 | public function getAssociationTable ( ) { if ( $ this -> type ( ) !== 'HMABT' ) throw new \ Exception ( 'Association table can only be used for HMABT relations.' ) ; if ( ! $ this -> isPolymorphic ( ) && $ this -> reverse ( ) -> isPolymorphic ( ) ) $ entityShortName = $ this -> reverse ( ) -> get ( 'as' ) ; else $ enti... | Get the table of a HMABT table . |
8,215 | public function getTargetDefinition ( ) { if ( $ this -> targetDefinition ) return $ this -> targetDefinition ; if ( isset ( $ this -> params [ 'entities' ] ) ) $ entityClass = $ this -> params [ 'entities' ] [ 0 ] ; else $ entityClass = $ this -> params [ 'entity' ] ; return $ this -> definition -> getEntityManager ( ... | Return the target entity definition . |
8,216 | public function type ( ) { if ( $ this -> get ( 'relation_type' ) ) return $ this -> get ( 'relation_type' ) ; elseif ( $ this -> get ( 'poymorphic' ) ) throw new \ Exception ( 'Parameter relation_type must be provided for polymorphic relations.' ) ; $ rev = $ this -> reverse ( ) ; if ( $ this -> get ( 'many' ) ) { if ... | Get the relation type . |
8,217 | public function reverse ( ) { if ( $ this -> reverseRelation !== null ) return $ this -> reverseRelation ; $ origEntityName = $ this -> entityClass ; $ entityName = preg_replace ( '/^\\\/' , '' , $ origEntityName ) ; $ relationDefinition = $ this -> getTargetDefinition ( ) ; $ name = $ this -> name ; $ rev_relations = ... | Get the reverse relation instance . |
8,218 | public function prepareValidator ( \ Asgard \ Validation \ ValidatorInterface $ validator ) { if ( isset ( $ this -> params [ 'validation' ] ) ) { $ validation = $ this -> params [ 'validation' ] ; foreach ( $ validation as $ name => $ params ) { if ( is_integer ( $ name ) ) { $ name = $ params ; $ params = [ ] ; } if ... | Get the relation validation rules . |
8,219 | protected function evaluate ( ) { $ prop = $ this -> props ; $ np = Parser :: NAMELESS_PROP ; $ v = isset ( $ prop -> $ np ) ? $ prop -> $ np : $ prop -> get ( 'value' ) ; $ not = $ prop -> not ; if ( exists ( $ prop -> matches ) ) return ( bool ) preg_match ( "%$prop->matches%" , $ v ) xor $ not ; if ( $ prop -> case ... | Evaluates the condition of the If clause . |
8,220 | public function getValidationErrorsByName ( $ name ) { $ errors = [ ] ; if ( $ this -> name == $ name ) { $ errors [ ] = $ this ; } $ errors = array_merge ( $ errors , $ this -> getValidationErrorsByNameRecursive ( $ name , $ this -> subErrors ) ) ; return $ errors ; } | Returns an array of validation errors for the validation name provided . |
8,221 | public function hasAmqpTasksRunning ( $ timetableId , $ taskTypeId = AmqpTask :: AREA_PDF_GENERATION_TYPE ) { $ result = $ this -> getEntityManager ( ) -> getRepository ( 'CanalTPMttBundle:AmqpTask' ) -> findBy ( array ( 'objectId' => $ timetableId , 'status' => AmqpTask :: LAUNCHED_STATUS , 'typeId' => $ taskTypeId ) ... | Does this timetable have a task under progress? |
8,222 | protected function explode ( $ commaSeparatedValues ) { if ( null === $ commaSeparatedValues ) { return array ( ) ; } $ array = explode ( ',' , $ commaSeparatedValues ) ; if ( array_walk ( $ array , function ( & $ item ) { $ item = strtoupper ( trim ( $ item ) ) ; } ) ) { return $ array ; } return array ( ) ; } | Explode a comma separated list in a array trimming all array elements |
8,223 | public function getNormalizedParam ( $ params , $ name , $ default = null ) { $ value = $ this -> getParam ( $ params , $ name , $ default ) ; if ( is_string ( $ value ) ) { $ value = strtolower ( trim ( $ value ) ) ; } return $ value ; } | Get a function or block parameter value and normalize it trimming balnks and making it lowercase |
8,224 | public function getParam ( $ params , $ name , $ default = null ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ test ) { if ( isset ( $ params [ $ test ] ) ) { return $ params [ $ test ] ; } } } elseif ( isset ( $ params [ $ name ] ) ) { return $ params [ $ name ] ; } return $ default ; } | Get a function or block parameter value |
8,225 | public static function start ( array $ database = [ ] , bool $ new_instance = false ) { if ( ! self :: $ instance instanceof self or $ new_instance ) { self :: $ instance = new self ( $ database ) ; } return self :: $ instance ; } | Starts the connection instance if it has already been declared before does not duplicate it and saves memory . |
8,226 | public static function create ( $ database = [ ] ) { try { $ driver = isset ( $ database [ 'driver' ] ) ? ucwords ( $ database [ 'driver' ] ) : "" ; $ className = __NAMESPACE__ . "\\Engines\\" . $ driver ; if ( class_exists ( $ className ) ) { return new $ className ( $ database ) ; } else { throw new \ RuntimeExceptio... | Starts database connection |
8,227 | public function escape ( $ e ) { if ( ! isset ( $ e ) ) { return '' ; } if ( is_numeric ( $ e ) and PHP_INT_MIN <= $ e and $ e <= PHP_INT_MAX ) { if ( explode ( '.' , $ e ) [ 0 ] != $ e ) { return ( float ) $ e ; } return ( int ) $ e ; } return ( string ) trim ( str_replace ( [ '\\' , "\x00" , '\n' , '\r' , "'" , '"' ,... | Heals a value to be later entered into a query |
8,228 | public function query ( string $ q ) : \ PDOStatement { try { $ _SESSION [ ' QUERY_DEBUG ' ] [ ] = ( string ) $ q ; return parent :: query ( $ q ) ; } catch ( \ Exception $ e ) { $ message = 'Error in query: <b>' . $ q . '<b/><br /><br />' . $ e -> getMessage ( ) ; } } | Performs a query and if it is in debug mode it analyzes which query was executed |
8,229 | public function delete ( string $ table , string $ where , string $ limit = 'LIMIT 1' ) : \ PDOStatement { return $ this -> query ( "DELETE FROM $table WHERE $where $limit;" ) ; } | Clears a series of items securely from a table in the database |
8,230 | public function insert ( string $ table , array $ e ) : \ PDOStatement { if ( sizeof ( $ e ) == 0 ) { trigger_error ( 'array passed in Connection::insert(...) is empty.' , E_ERROR ) ; } $ query = "INSERT INTO $table (" ; $ values = '' ; foreach ( $ e as $ campo => $ v ) { $ query .= $ campo . ',' ; $ values .= '\'' . $... | Insert a series of elements into a table in the database |
8,231 | public function getFormatter ( Column $ column ) { $ decimalDigits = $ column -> getDecimalDigits ( ) ; return function ( Model $ model , $ value ) use ( $ decimalDigits ) { return number_format ( $ value , $ decimalDigits ) ; } ; } | This method will be called with a column definition and should return a closure which takes 2 properties - a Model and a value - and returns a formatted value . |
8,232 | public function forgotPassword ( $ member ) { if ( Config :: inst ( ) -> get ( 'OpauthMemberLoginFormExtension' , 'allow_password_reset' ) ) { return null ; } $ identity = OpauthIdentity :: get ( ) -> find ( 'MemberID' , $ member -> ID ) ; if ( ! $ member -> Password && $ identity ) { $ this -> owner -> sessionMessage ... | Deny password resets |
8,233 | public function attribute ( $ attribute ) { if ( ! is_array ( $ attribute ) ) $ attribute = explode ( '.' , $ attribute ) ; $ next = array_shift ( $ attribute ) ; if ( count ( $ attribute ) === 0 ) { if ( ! isset ( $ this -> attributes [ $ next ] ) ) return ( new static ( null ) ) -> setParent ( $ this ) ; else return ... | Return an children input bag . |
8,234 | public function input ( $ attribute = null ) { if ( $ attribute ) return $ this -> attribute ( $ attribute ) -> input ( ) ; return $ this -> input ; } | Return the raw input of an attribute . |
8,235 | public function getMimeType ( ) { if ( function_exists ( 'finfo_open' ) ) { $ finfo = finfo_open ( FILEINFO_MIME ) ; if ( ! $ finfo ) { throw new \ RuntimeException ( 'Failed to open finfo' ) ; } $ actualInfo = @ finfo_file ( $ finfo , $ this -> getPathname ( ) ) ; if ( false === $ actualInfo ) { throw new \ RuntimeExc... | Returns the mime type for this file . |
8,236 | public function fread ( ) { try { $ file = $ this -> openFile ( 'r' ) ; } catch ( \ Exception $ exc ) { throw new \ RuntimeException ( 'Unable to open file' , 0 , $ exc ) ; } $ result = '' ; foreach ( $ file as $ line ) { $ result .= $ line ; } return $ result ; } | Returns the file contents as a string . |
8,237 | protected function getFilenameRelativeToRoot ( $ root_path ) { $ result = ltrim ( substr ( $ this -> getPathname ( ) , strlen ( $ root_path ) ) , DIRECTORY_SEPARATOR ) ; if ( $ result === '' ) { throw new \ InvalidArgumentException ( 'File "' . $ this -> getPathname ( ) . '" is not present in the ' . 'given root: ' . $... | Returns the filename relative to the given root . |
8,238 | public function filter ( $ content , array $ options = array ( ) ) { $ wrap = '<div id="content_%s_%s" class="su-content-inline su-input-html-inline-content">%s</div>' ; return sprintf ( $ wrap , $ this -> blockProperty -> getBlock ( ) -> getId ( ) , str_replace ( '.' , '_' , $ this -> blockProperty -> getHierarchicalN... | Filters the editable content s data adds Html Div node for CMS . |
8,239 | public static function renderBody ( array $ callable , array $ context , array $ blocks , $ lineno = - 1 , $ name = null ) { if ( 2 !== \ count ( $ callable ) || ! $ callable [ 0 ] instanceof Template || ! \ is_string ( $ callable [ 1 ] ) ) { throw new BodyTagRendererException ( 'The callable argument must be an array ... | Render the body of template tag . |
8,240 | public function findCalendarByExternalCoverageIdAndApplication ( $ externalCoverageId , $ applicationCanonicalName ) { $ qb = $ this -> createQueryBuilder ( 'cal' ) ; $ qb -> addSelect ( 'cus' ) -> addSelect ( 'ne' ) -> addSelect ( 'per' ) -> leftJoin ( 'cal.customer' , 'cus' ) -> leftJoin ( 'cus.navitiaEntity' , 'ne' ... | Get an calendars id by external coverage id |
8,241 | public function getPart ( string $ contentType ) { if ( ! isset ( $ this -> parts [ $ contentType ] ) ) { return null ; } return $ this -> parts [ $ contentType ] ; } | Get a Part object for the specified content type Returns NULL if not set . |
8,242 | public function setHtml ( string $ html ) : self { return $ this -> addPart ( Part :: create ( $ html , 'text/html' ) , true ) ; } | Add or replace the HTML part of the mail . |
8,243 | public function setText ( string $ text ) : self { return $ this -> addPart ( Part :: create ( $ text , 'text/plain' ) , true ) ; } | Add or replace the plain text part of the mail . |
8,244 | public function addVariableForRecipient ( string $ recipient , string $ name , string $ value ) : self { $ this -> recipientVariables [ $ recipient ] [ $ name ] = $ value ; return $ this ; } | Set variable for recipient . |
8,245 | public function addVariablesForRecipient ( string $ recipient , array $ variables ) : self { $ this -> recipientVariables [ $ recipient ] = $ variables ; return $ this ; } | Set variables for recipient . |
8,246 | public function removeVariableForRecipient ( string $ recipient , string $ name ) : self { unset ( $ this -> recipientVariables [ $ recipient ] [ $ name ] ) ; return $ this ; } | Remove variable for recipient . |
8,247 | private function performTokenInitialization ( ) { if ( ! empty ( $ _COOKIE [ $ this -> sessionCookieName ] ) ) { $ this -> sessionToken = $ _COOKIE [ $ this -> sessionCookieName ] ; if ( preg_match ( '#[a-f0-9]{40}#' , $ this -> sessionToken ) ) { return ; } } $ this -> sessionToken = sha1 ( uniqid ( 'slabphp' , true )... | Generate a user token or retrieve it from cookie |
8,248 | public function set ( $ variable , $ value = null ) { if ( is_array ( $ variable ) ) { $ this -> userData = array_merge ( $ this -> userData , $ variable ) ; } else if ( is_object ( $ variable ) ) { $ this -> userData = array_merge ( $ this -> userData , ( array ) $ variable ) ; } else { if ( $ value === null ) { unset... | Set user data |
8,249 | private function markFlashDataForDeletion ( ) { foreach ( $ this -> userData as $ variable => $ value ) { if ( $ variable [ 0 ] == '@' ) { $ this -> killList [ ] = $ variable ; } } } | Adds vars to the kill list these variables won t be written to the session data again but are available for reading |
8,250 | private function killMarkedFlashData ( ) { foreach ( $ this -> killList as $ killVariable ) { if ( isset ( $ this -> userData [ $ killVariable ] ) ) { unset ( $ this -> userData [ $ killVariable ] ) ; } } } | Perform actual flash data kill |
8,251 | public function commit ( ) { if ( empty ( $ this -> sessionToken ) ) return ; $ this -> handler -> write ( $ this -> sessionToken , $ this -> encode ( $ this -> userData ) ) ; } | Commit session to db |
8,252 | public function before ( \ Asgard \ Http \ Controller $ controller , \ Asgard \ Http \ Request $ request ) { if ( ! $ controller -> has ( 'layout' ) ) $ controller -> set ( 'layout' , null ) ; if ( ! $ controller -> has ( 'htmlLayout' ) ) $ controller -> set ( 'htmlLayout' , null ) ; } | To be executed before the action . |
8,253 | public function after ( \ Asgard \ Http \ Controller $ controller , \ Asgard \ Http \ Request $ request , & $ result ) { if ( ! is_string ( $ result ) || $ controller -> request -> header [ 'x-requested-with' ] == 'XMLHttpRequest' ) return ; if ( $ controller -> response -> getHeader ( 'Content-Type' ) && $ controller ... | To be executed after the action . |
8,254 | public function cacheUntil ( $ expires ) { if ( ! is_int ( $ expires ) ) { $ expires = strtotime ( $ expires ) ; } return $ this -> withHeader ( 'Pragma' , 'public' ) -> withHeader ( 'Cache-Control' , 'maxage=' . ( $ expires - time ( ) ) ) -> withHeader ( 'Expires' , gmdate ( 'D, d M Y H:i:s' , $ expires ) . ' GMT' ) ;... | Make the response cacheable . |
8,255 | public function expireCookie ( $ name , $ extra = '' ) { $ extra = implode ( '; ' , array_filter ( [ $ extra , 'Expires=' . date ( 'r' , 0 ) ] ) ) ; return $ this -> withCookie ( $ name , 'deleted' , $ extra ) ; } | Expires an existing cookie |
8,256 | protected function getCacheDir ( ) { $ cacheDir = $ this -> container -> getParameter ( "kernel.cache_dir" ) ; $ cacheDir = rtrim ( $ cacheDir , '/' ) ; $ cacheDir .= '/' . self :: SITEMAP_CACHE_DIR . '/' ; return $ cacheDir ; } | get the cache directory for sitemap |
8,257 | static function translateSimpleExpSegs ( array $ segments ) { if ( count ( $ segments ) == 1 ) { $ seg = $ segments [ 0 ] ; if ( $ seg [ 0 ] == '#' ) return sprintf ( '%s->renderBlock("%s")' , self :: BINDER_PARAM , substr ( $ seg , 1 ) ) ; PhpCode :: evalConstant ( $ seg , $ ok ) ; if ( $ ok ) return $ seg ; if ( is_c... | Pre - compiles the given simple binding expression . |
8,258 | static private function translate ( $ expression ) { list ( $ main , $ op ) = self :: translateSimpleExpression ( $ expression ) ; $ exp = $ main ; if ( $ op == '|' ) { $ filters = preg_split ( self :: PARSE_FILTER , $ expression ) ; if ( $ filters ) foreach ( $ filters as $ filter ) $ exp = self :: translateFilter ( $... | Translates a databinding expression to PHP source code . |
8,259 | static private function translateFilter ( $ filter , $ input ) { if ( preg_match ( '/^\S+\s*?\(/' , $ filter ) ) self :: filterSyntaxError ( $ filter , "Filter arguments must not be enclosed in <kbd>()</kbd>" ) ; list ( $ name , $ argsStr ) = str_extractSegment ( $ filter , '/\s+/' ) ; $ args = [ ] ; while ( $ argsStr ... | Precompiles a single filter sub - expression composed of a filter name and a list of optional comma - delimited arguments . |
8,260 | protected function guessServiceClass ( $ name ) { try { $ obj = $ this -> getContainer ( ) -> get ( $ name ) ; return gettype ( $ obj ) == 'object' ? get_class ( $ obj ) : gettype ( $ obj ) ; } catch ( \ Exception $ e ) { } catch ( \ Throwable $ e ) { } } | Guess the class of a service . |
8,261 | protected function appendWrapper ( \ DOMElement $ element , \ DOMDocument $ dom ) { $ wrapper = $ dom -> createElement ( 'div' ) ; $ wrapper -> setAttribute ( 'class' , 'cms-slide-wrapper' ) ; $ element -> appendChild ( $ wrapper ) ; return $ wrapper ; } | Appends a wrapper to the element . |
8,262 | private function initStopPoint ( $ externalCoverageId ) { $ navitiaStopPoint = $ this -> navitia -> getStopPoint ( $ externalCoverageId , $ this -> stopPoint -> getExternalId ( ) , array ( 'depth' => 1 , 'show_codes' => 'true' ) ) ; $ this -> stopPoint -> setTitle ( $ navitiaStopPoint -> stop_points [ 0 ] -> name ) ; $... | Populate stopPoint from navitia |
8,263 | public function getStopPoint ( $ externalStopPointId , $ timetable , $ externalCoverageId ) { $ this -> stopPoint = $ this -> repository -> findOneBy ( array ( 'externalId' => $ externalStopPointId , 'timetable' => $ timetable -> getId ( ) ) ) ; $ this -> timetable = $ timetable ; if ( ! empty ( $ this -> stopPoint ) )... | Return StopPoint with data from navitia |
8,264 | public function enhanceStopPoints ( $ stopPoints , $ timetable ) { $ externalStopPointIds = array ( ) ; $ stopPointsIndexed = array ( ) ; foreach ( $ stopPoints as $ stopPoint_data ) { $ externalStopPointIds [ ] = $ stopPoint_data -> stop_point -> id ; $ stopPointsIndexed [ $ stopPoint_data -> stop_point -> id ] = $ st... | Return StopPoints list with Data from navitia |
8,265 | public function generateMenus ( ) { foreach ( $ this -> config [ 'roots' ] as $ name => $ config ) { $ this -> output -> write ( sprintf ( '- <comment>%s</comment> %s ' , $ name , str_pad ( '.' , 44 - mb_strlen ( $ name ) , '.' , STR_PAD_LEFT ) ) ) ; if ( null !== $ menu = $ this -> findMenuByName ( $ name ) ) { $ this... | Generates the menus based on configuration . |
8,266 | public function transformDataFromRepository ( $ modelData ) { foreach ( $ this -> columnTransforms as $ columnName => $ transforms ) { if ( $ transforms [ 0 ] !== null ) { $ closure = $ transforms [ 0 ] ; $ modelData [ $ columnName ] = $ closure ( $ modelData ) ; } } return $ modelData ; } | Checks if raw repository data needs transformed before passing to the model . |
8,267 | protected function transformDataForRepository ( $ modelData ) { foreach ( $ this -> columnTransforms as $ columnName => $ transforms ) { if ( $ transforms [ 1 ] !== null ) { $ closure = $ transforms [ 1 ] ; $ transformedData = $ closure ( $ modelData ) ; if ( is_array ( $ transformedData ) ) { unset ( $ modelData [ $ c... | Checks if model data needs transformed into raw model data before passing it for storage . |
8,268 | public function batchCommitUpdatesFromCollection ( RepositoryCollection $ collection , $ propertyPairs ) { foreach ( $ collection as $ item ) { $ item -> mergeRawData ( $ propertyPairs ) ; $ item -> save ( ) ; } } | Commits changes to the repository in batch against a collection . |
8,269 | final protected function cacheObjectData ( Model $ object ) { $ uniqueIdentifier = $ object -> UniqueIdentifier ; if ( $ uniqueIdentifier === null ) { return ; } if ( ! isset ( $ this -> cachedObjectData [ $ uniqueIdentifier ] ) ) { $ this -> cachedObjectData [ $ uniqueIdentifier ] = $ object -> exportRawData ( ) ; } e... | Takes the model data from the data object and stores it in the repository cache . |
8,270 | final protected function deleteObjectFromCache ( Model $ object ) { $ uniqueIdentifier = $ object -> UniqueIdentifier ; if ( $ uniqueIdentifier === null ) { return ; } if ( isset ( $ this -> cachedObjectData [ $ uniqueIdentifier ] ) ) { unset ( $ this -> cachedObjectData [ $ uniqueIdentifier ] ) ; } } | Removes the model data of the data object from the repository cache . |
8,271 | final protected function fetchObjectData ( Model $ object , $ uniqueIdentifier , $ relationshipsToAutoHydrate = [ ] ) { if ( ! isset ( $ this -> cachedObjectData [ $ uniqueIdentifier ] ) ) { $ this -> cachedObjectData [ $ uniqueIdentifier ] = $ this -> fetchMissingObjectData ( $ object , $ uniqueIdentifier , $ relation... | Returns the model data for a given object . |
8,272 | final public function hydrateObject ( Model $ object , $ uniqueIdentifier , $ relationshipsToAutoHydrate = [ ] ) { $ objectData = $ this -> fetchObjectData ( $ object , $ uniqueIdentifier , $ relationshipsToAutoHydrate ) ; $ object -> importRawData ( $ objectData ) ; } | Fetches the data for an object and populates it s model data with the same . |
8,273 | final public function saveObject ( Model $ object ) { $ this -> onObjectSaved ( $ object ) ; if ( $ object -> getUniqueIdentifier ( ) === null ) { throw new ModelException ( "The object could not be saved as it has no unique identifier." , $ object ) ; } $ this -> cacheObjectData ( $ object ) ; } | save the data object . |
8,274 | final public function deleteObject ( Model $ object ) { if ( $ object -> isNewRecord ( ) ) { return ; } $ this -> onObjectDeleted ( $ object ) ; $ this -> deleteObjectFromCache ( $ object ) ; } | Delete s a model from the repository . |
8,275 | protected function render ( ) { $ prop = $ this -> props ; if ( exists ( $ prop -> src ) ) $ this -> context -> getAssetsService ( ) -> addStylesheet ( $ prop -> src , $ this -> props -> prepend ) ; else if ( $ this -> hasChildren ( ) ) $ this -> context -> getAssetsService ( ) -> addInlineCss ( self :: getRenderingOfS... | Registers a stylesheet on the Page . |
8,276 | function apply ( array $ props ) { $ this -> beingAssigned = $ props ; foreach ( $ props as $ k => $ v ) $ this -> set ( $ k , $ v ) ; } | Mass - assigns a set of properties . |
8,277 | function applyDefaults ( array $ props ) { $ this -> beingAssigned = $ props ; foreach ( $ props as $ k => $ v ) if ( ! $ this -> isModified ( $ k ) ) $ this -> set ( $ k , $ v ) ; } | Mass - assigns a set of properties but only to those properties that are not yet modified . |
8,278 | function canBeSubtag ( $ propName ) { if ( $ this -> defines ( $ propName ) ) { $ type = $ this -> getTypeOf ( $ propName ) ; switch ( $ type ) { case type :: content : case type :: collection : case type :: metadata : case type :: string : case type :: number : return true ; } } return false ; } | Checks if a property can be specified on markup as a subtag . |
8,279 | function ensurePropertyExists ( $ propName ) { if ( ! $ this -> defines ( $ propName ) ) { throw new ComponentException ( $ this -> component , sprintf ( "Invalid property <kbd>%s</kbd> specified for a %s instance." , $ propName , Debug :: typeInfoOf ( $ this ) ) ) ; } } | Throws an exception if the specified property is not available . |
8,280 | function getComputed ( $ propName , $ default = null ) { $ v = $ this -> component -> getComputedPropValue ( $ propName ) ; return exists ( $ v ) ? $ v : $ default ; } | Gets the value of the specified property performing data binding if the property is bound . |
8,281 | function getPropertiesOf ( ... $ types ) { $ result = [ ] ; $ names = $ this -> getPropertyNames ( ) ; if ( isset ( $ names ) ) foreach ( $ names as $ name ) if ( in_array ( $ this -> getTypeOf ( $ name ) , $ types ) ) $ result [ $ name ] = $ this -> get ( $ name ) ; return $ result ; } | Returns a subset of the available properties filtered by the a specific type IDs . |
8,282 | function isScalar ( $ propName ) { $ type = $ this -> getTypeOf ( $ propName ) ; return $ type == type :: bool || $ type == type :: id || $ type == type :: number || $ type == type :: string ; } | Checks if a property is of a scalar type . |
8,283 | function set ( $ propName , $ value ) { $ this -> ensurePropertyExists ( $ propName ) ; $ this -> $ propName = $ this -> typecastPropertyValue ( $ propName , $ value ) ; if ( $ this -> isModified ( $ propName ) ) $ this -> onPropertyChange ( $ propName ) ; } | Validates typecasts and assigns a value to a property . |
8,284 | function setComponent ( Component $ owner ) { $ this -> component = $ owner ; $ props = $ this -> getPropertiesOf ( type :: content ) ; foreach ( $ props as $ name => $ value ) if ( ! is_null ( $ value ) ) { $ c = clone $ value ; $ c -> attachTo ( $ owner ) ; $ this -> $ name = $ c ; } $ props = $ this -> getProperties... | Assign a new owner to the properties object . This will also do a deep clone of the component s properties . |
8,285 | function typecastPropertyValue ( $ name , $ v ) { if ( $ this -> isScalar ( $ name ) && $ this -> isEnum ( $ name ) ) $ this -> validateEnum ( $ name , $ v ) ; $ type = $ this -> getTypeOf ( $ name ) ; if ( $ type && ! type :: validate ( $ type , $ v ) ) throw new ComponentException ( $ this -> component , sprintf ( "%... | Returns the value converted to a the data type required by the specified property . |
8,286 | protected function validateEnum ( $ name , $ v ) { $ enum = $ this -> getEnumOf ( $ name ) ; if ( is_null ( $ v ) && ! $ this -> isRequired ( $ name ) ) return ; if ( array_search ( $ v , $ enum ) === false ) { $ list = implode ( '</b>, <b>' , $ enum ) ; throw new ComponentException ( $ this -> component , "Invalid val... | Throws an exception if the the specified value is not valid for the given enumerated property . |
8,287 | public function getTemplateFile ( $ template ) { $ paths = $ this -> config [ "path" ] ; $ suffix = $ this -> config [ "suffix" ] ; foreach ( $ paths as $ path ) { $ file = $ path . "/" . $ template . $ suffix ; if ( is_file ( $ file ) ) { return $ file ; } } throw new Exception ( "Could not find template file '$templa... | Convert template to path to template file . |
8,288 | public function addCallback ( $ callback , $ data = [ ] , $ region = "main" , $ sort = 0 ) { $ view = $ this -> di -> get ( "view" ) ; $ view -> set ( [ "callback" => $ callback ] , $ data , $ sort , "callback" ) ; $ view -> setDI ( $ this -> di ) ; $ this -> views [ $ region ] [ ] = $ view ; return $ this ; } | Add a callback to be rendered as a view . |
8,289 | protected function fetchMissingObjectData ( Model $ object , $ uniqueIdentifier , $ relationshipsToAutoHydrate = [ ] ) { $ schema = $ this -> getRepositorySchema ( ) ; $ table = $ schema -> schemaName ; $ data = self :: returnFirstRow ( "SELECT * FROM `" . $ table . "` WHERE `{$schema->uniqueIdentifierColumnName}` = :i... | Fetches the data for a given unique identifier . |
8,290 | private function updateObject ( Model $ object ) { $ schema = $ this -> reposSchema ; $ changes = $ object -> getModelChanges ( ) ; $ schemaColumns = $ schema -> getColumns ( ) ; $ params = [ ] ; $ columns = [ ] ; $ sql = "UPDATE `{$schema->schemaName}`" ; foreach ( $ changes as $ columnName => $ value ) { if ( $ colum... | Crafts and executes an SQL statement to update the object in MySQL |
8,291 | private function insertObject ( Model $ object ) { $ schema = $ this -> reposSchema ; $ changes = $ object -> takeChangeSnapshot ( ) ; $ params = [ ] ; $ columns = [ ] ; $ sql = "INSERT INTO `{$schema->schemaName}`" ; $ schemaColumns = $ schema -> getColumns ( ) ; foreach ( $ changes as $ columnName => $ value ) { $ ch... | Crafts and executes an SQL statement to insert the object into MySQL |
8,292 | public static function getConnection ( StemSettings $ settings ) { $ connectionHash = $ settings -> host . $ settings -> port . $ settings -> username . $ settings -> database ; if ( ! isset ( PdoRepository :: $ connections [ $ connectionHash ] ) ) { try { $ pdo = new \ PDO ( "mysql:host=" . $ settings -> host . ";port... | Gets a PDO connection . |
8,293 | public function footerAction ( $ locale ) { $ this -> get ( 'request_stack' ) -> getCurrentRequest ( ) -> setLocale ( $ locale ) ; return $ this -> render ( '@EkynaCms/Cms/Fragment/footer.html.twig' ) -> setSharedMaxAge ( 3600 ) ; } | Renders the footer fragment . |
8,294 | public function setAccessToken ( $ accessToken , $ accessTokenLimit = null ) { $ this -> setAuthConfig ( 'access_token' , $ accessToken ) ; if ( $ accessTokenLimit ) { $ this -> setAuthConfig ( 'access_token_limit' , $ accessTokenLimit ) ; } } | Set the client token for the auth class . |
8,295 | public function canBeFilteredByRepository ( ) { $ filter = $ this -> getFilter ( ) ; $ repository = $ this -> getRepository ( ) ; if ( $ filter && ! $ filter -> canFilterWithRepository ( $ this , $ repository ) ) { return false ; } foreach ( $ this -> getAggregateColumns ( ) as $ aggregateColumn ) { if ( ! $ aggregateC... | True if this repository can filter the collection entirely by itself . |
8,296 | private function setDummyReplacements ( ) { $ this -> dummyReplacements = [ 'DefaultTitle' => $ this -> getAttribute ( 'title' ) , 'DefaultTheme' => $ this -> getAttribute ( 'namespace' ) , 'DefaultOrganisation' => $ this -> getAttribute ( 'organisation' ) , 'DefaultAuthor' => $ this -> getAttribute ( 'authorName' ) , ... | Set dummy replacements . |
8,297 | private function authFunctionality ( ) { if ( $ this -> getAttribute ( 'activate' ) ) { File :: deleteDirectory ( $ this -> destinationDir . '/controllers/Auth' ) ; File :: deleteDirectory ( $ this -> destinationDir . '/views/auth' ) ; } return $ this ; } | Deletes auth controller and view if theme should not include auth functionalities . |
8,298 | public function moveTheme ( ) { $ this -> destinationDir = base_path ( 'themes' ) . '/' . $ this -> getAttribute ( 'namespace' ) ; File :: deleteDirectory ( $ this -> tmpDirectory . '/.git' ) ; File :: deleteDirectory ( $ this -> tmpDirectory . '/.idea' ) ; $ success = File :: copyDirectory ( $ this -> tmpDirectory , $... | Move theme to themes directory |
8,299 | private function replaceDummyContent ( ) { $ this -> replaceDummy ( $ this -> destinationDir . '/controllers' ) ; $ this -> replaceDummy ( $ this -> destinationDir . '/views' ) ; $ this -> replaceDummyInFile ( $ this -> destinationDir . '/config.json' ) ; return $ this ; } | Replace dummy strings |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.