idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
236,200
public function getFirstParent ( $ parentClassName ) { $ foundParent = null ; $ this -> alongParents ( function ( $ parent ) use ( $ parentClassName , & $ foundParent ) { if ( $ parent instanceof $ parentClassName ) { $ foundParent = $ parent ; return false ; } return true ; } ) ; if ( null === $ foundParent ) { throw ...
Returns the first found instance of the desired parent .
236,201
public function setView ( $ viewName ) { $ view = $ this -> pathToView . DIRECTORY_SEPARATOR . strtolower ( $ viewName ) . '.php' ; if ( ! file_exists ( $ view ) ) { throw new Exception \ LookupException ( 'View: "' . $ view . '" could not be found.' ) ; } $ this -> viewQueue [ $ viewName ] = $ view ; }
formats and prepares view for inclusion
236,202
public function fetchCSS ( ) { $ string = "" ; if ( empty ( $ this -> queuedCSS ) ) { return $ string ; } foreach ( $ this -> queuedCSS as $ sheet ) { $ string .= '<link rel="stylesheet" href="' . $ sheet . '">' . "\r\n" ; } return $ string ; }
Helper method for grabbing aggregated css files
236,203
public function fetchJS ( ) { $ string = "<script>baseURL = '" . $ this -> router -> baseURL ( ) . "/'</script>\r\n" ; if ( empty ( $ this -> queuedJS ) ) { return $ string ; } foreach ( $ this -> queuedJS as $ script ) { $ string .= '<script src="' . $ script . '"></script>' . "\r\n" ; } return $ string ; }
Helper method for grabbing aggregated JS files
236,204
public function isExists ( ) { clearstatcache ( true , ( string ) $ this -> resource ) ; return is_file ( ( string ) $ this -> resource ) ; }
Returns true if the resource exists in the filesystem .
236,205
public function saveAction ( Request $ request ) { $ json_nodes = $ request -> get ( 'nodes' ) ; if ( $ json_nodes ) { $ this -> em = $ this -> getDoctrine ( ) -> getManager ( ) ; foreach ( $ json_nodes as $ id => $ obj ) { $ contentNode = $ this -> em -> find ( ContentNode :: class , $ id ) ; if ( $ contentNode ) { $ ...
AJAX save endpoint not related to the CRUD
236,206
public function simpleUpdateAction ( Request $ request , ContentNode $ contentNode ) { return $ this -> updateAction ( $ request , $ contentNode , true ) ; }
validates the simple ContentNode Form
236,207
public function updateAction ( Request $ request , ContentNode $ contentNode , $ isSimpleForm = false ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ repository = $ this -> getDoctrine ( ) -> getRepository ( 'MMCmfNodeBundle:Node' ) ; $ rootNode = null ; if ( ( int ) $ request -> get ( 'root_node' ) ) { $ ro...
validates the general ContentNode Form
236,208
public function createSimpleEditForm ( ContentNode $ contentNode , Node $ rootNode = null ) { $ contentNodeClassName = get_class ( $ contentNode ) ; $ contentNodeParser = $ this -> get ( 'mm_cmf_content.content_parser' ) ; $ simpleFormData = $ contentNodeParser -> getSimpleForm ( $ contentNodeClassName ) ; if ( isset (...
Returns the configured Simple Form for Frontend Editing purpose
236,209
public function createFromId ( AbstractPageRouteConfiguration $ routeConfiguration , $ pageId ) { $ page = $ this -> repository -> find ( $ pageId ) ; return $ this -> create ( $ routeConfiguration , $ page ) ; }
Create a new route instance from a page id
236,210
protected function buildUrlFromPath ( array $ path ) { array_shift ( $ path ) ; if ( count ( $ path ) === 0 && $ this -> treeStrategy -> isHomeTreeRoot ( ) ) { return '/' ; } return array_reduce ( $ path , function ( $ carry , NestedSetRoutingPageInterface $ item ) { $ carry .= '/' . $ item -> getSlug ( ) ; return $ ca...
Build an url from a path
236,211
public function process ( array $ input ) { if ( $ this -> v -> validate ( $ input ) ) { Event :: fire ( "form.processing" , array ( $ input ) ) ; return $ this -> callRepository ( $ input ) ; } else { $ this -> errors = $ this -> v -> getErrors ( ) ; throw new ValidationException ; } }
Process the input and calls the repository
236,212
protected function isUpdate ( $ input ) { return ( isset ( $ input [ $ this -> id_field_name ] ) && ! empty ( $ input [ $ this -> id_field_name ] ) ) ; }
Check if the operation is update or create
236,213
public function delete ( array $ input ) { if ( isset ( $ input [ $ this -> id_field_name ] ) && ! empty ( $ input [ $ this -> id_field_name ] ) ) { try { $ this -> r -> delete ( $ input [ $ this -> id_field_name ] ) ; } catch ( ModelNotFoundException $ e ) { $ this -> errors = new MessageBag ( array ( "model" => "Elem...
Run delete on the repository
236,214
public function getQNVarName ( ) { return \ lyquidity \ xml \ qname ( $ this -> _varName -> ToString ( ) , $ this -> getContext ( ) -> NamespaceManager -> getNamespaces ( ) , true ) ; }
Get the VarName as a QName
236,215
public function setCallback ( $ callback = NULL ) { if ( NULL !== $ callback ) { $ pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u' ; foreach ( explode ( '.' , $ callback ) as $ part ) { if ( ! preg_match ( $ pattern , $ part ) ) { throw new \ InvalidArgumentException ( sprintf ( "The callb...
set the JSONP callback pass NULL for not using a callback
236,216
public function setEncodingOptions ( $ encodingOptions ) { $ this -> encodingOptions = ( int ) $ encodingOptions ; return $ this -> setPayload ( json_decode ( $ this -> data ) ) ; }
set options used while encoding data to JSON re - encodes payload with new encoding setting
236,217
protected function update ( ) { if ( ! is_null ( $ this -> callback ) ) { $ this -> headers -> set ( 'Content-Type' , 'text/javascript' ) ; return $ this -> setContent ( sprintf ( '/**/%s(%s);' , $ this -> callback , $ this -> data ) ) ; } if ( ! $ this -> headers -> has ( 'Content-Type' ) || $ this -> headers -> get (...
update content and headers according to the JSON data and a set callback
236,218
public function getPluginsThatCanFillItem ( Item $ item , $ field ) { $ plugins = [ ] ; foreach ( $ this -> plugins as $ plugin ) { if ( $ plugin -> isCanRefill ( $ item , $ field ) || $ plugin -> isCanSearch ( $ item , $ field ) ) { $ plugins [ ] = $ plugin ; } } return $ plugins ; }
Get list of plugins that can fill item .
236,219
public function add_listener ( $ event_name , $ listener , $ priority = self :: PRIORITY , $ accepted_args = self :: ACCEPTED ) { if ( ! is_callable ( $ listener , true ) ) { throw new InvalidListenerException ( '$listener must be callable.' ) ; } if ( ! is_int ( $ priority ) ) { throw new \ InvalidArgumentException ( ...
Add an event listener that listens for a given event .
236,220
public function remove_listener ( $ event_name , $ listener , $ priority = self :: PRIORITY ) { if ( ! is_callable ( $ listener , true ) ) { throw new InvalidListenerException ( '$listener must be callable.' ) ; } if ( ! is_int ( $ priority ) ) { throw new \ InvalidArgumentException ( '$priority must be an int.' ) ; } ...
Remove an event listener for a given event .
236,221
public function add_subscriber ( EventSubscriber $ subscriber ) { foreach ( $ subscriber -> get_subscribed_events ( ) as $ event => $ params ) { if ( is_string ( $ params ) ) { $ this -> add_listener ( $ event , array ( $ subscriber , $ params ) ) ; } elseif ( is_array ( $ params ) && isset ( $ params [ 0 ] ) ) { $ met...
Add an event subscriber .
236,222
public function remove_subscriber ( EventSubscriber $ subscriber ) { foreach ( $ subscriber -> get_subscribed_events ( ) as $ event => $ params ) { if ( is_string ( $ params ) ) { $ this -> add_listener ( $ event , $ params ) ; } elseif ( is_array ( $ params ) && isset ( $ params [ 0 ] ) ) { $ method = $ params [ 0 ] ;...
Remove an event subscriber .
236,223
public function get_listener_priority ( $ event_name , $ listener ) { if ( ! is_callable ( $ listener , true ) ) { throw new InvalidListenerException ( '$listener must be callable.' ) ; } $ priority = has_filter ( $ event_name , $ listener ) ; if ( false === $ priority ) { return null ; } return $ priority ; }
Get the listener priority for a given event .
236,224
protected function loadConfigFile ( string $ key ) { $ key = strtolower ( $ key ) ; $ filename = $ this -> path . DIRECTORY_SEPARATOR . ucfirst ( $ key ) . Config :: CONFIG_FILE_EXTENSION ; if ( file_exists ( $ filename ) ) { $ this -> configuration [ $ key ] = require $ filename ; return ; } throw new ConfigException ...
Loads a configuration file in to memory
236,225
public function get ( string $ key ) { $ key = strtolower ( $ key ) ; if ( empty ( $ this -> configuration [ $ key ] ) ) { $ this -> loadConfigFile ( $ key ) ; } return $ this -> configuration [ $ key ] ; }
Get Configuration Item
236,226
public function addDashboardIcon ( $ dashboardRoleId , $ appTemplateId ) { $ url = sprintf ( '%s://%s%s/api/v1/dashboard/%s/application' , $ this -> scheme , $ this -> domain , $ this -> sufix , $ dashboardRoleId ) ; if ( $ this -> logger ) { $ this -> logger -> info ( 'Appsco.AppscoClient.addDashboardIcon' , array ( '...
Creates a dashboard icon
236,227
public function evaluateArgs ( array $ args ) : void { array_shift ( $ args ) ; if ( count ( $ args ) < 2 ) { $ this -> out -> red ( "Not enough arguments: expects 2, got " . ( count ( $ args ) - 1 ) . "." ) ; return ; } $ this -> setName ( $ args [ 0 ] ) ; $ this -> setLocation ( $ args [ 1 ] ) ; if ( isset ( $ args [...
Take in an array of args and evalutate them
236,228
public function additionalArgs ( array $ args ) : void { foreach ( $ args as $ a ) { if ( substr ( $ a , 0 , strlen ( "--extends=" ) ) == "--extends=" ) { $ this -> extends = explode ( "=" , $ a ) ; $ this -> extends = $ this -> extends [ 1 ] ; continue ; } if ( $ a == "--no-factory" ) { $ this -> createFactory = false...
Evaluate optional additional args
236,229
protected function getStateFormatted ( Document $ document ) { switch ( $ document -> getState ( ) ) { case Document :: DOCUMENT_STATE_ACTIVE : $ this -> stateClass = 'success' ; return 'Attivo' ; break ; case Document :: DOCUMENT_STATE_DEACTIVE : $ this -> stateClass = 'warning' ; return 'Disattivo' ; break ; case Doc...
This will fill the stateClass as well
236,230
protected function getIsExpired ( Document $ document ) { $ date = null === $ document -> getDateEdit ( ) ? $ document -> getDateInsert ( ) : $ document -> getDateEdit ( ) ; $ now = new \ Datetime ( "now" ) ; $ interval = $ date -> diff ( $ now ) ; if ( $ interval -> y > 0 ) { return true ; } return $ interval -> m >= ...
If the classified is > = 6 months old is expired
236,231
protected function getUserHashId ( Document $ document , $ sm ) { $ user = $ document -> getUser ( ) ; $ main = $ sm -> get ( 'neobazaar.service.main' ) ; $ userRepository = $ main -> getUserEntityRepository ( ) ; return $ userRepository -> getEncryptedId ( $ user -> getUserId ( ) ) ; }
Return the user hash id for the classified . It s an sha1 hash . Also fill userIdNoHash
236,232
protected function getEditAddress ( Document $ document ) { $ key = null === $ this -> hashId ? $ this -> getHashId ( $ document ) : $ this -> hashId ; return '/edit-classified/' . $ key . '.html' ; }
Get the address to be called to edit classified
236,233
protected function getHashId ( Document $ document , $ sm ) { $ main = $ sm -> get ( 'neobazaar.service.main' ) ; $ documentRepository = $ main -> getDocumentEntityRepository ( ) ; return $ documentRepository -> getEncryptedId ( $ document -> getDocumentId ( ) ) ; }
Return the classified hash id . It s an sha1 hash
236,234
protected function getAddress ( Document $ document , $ sm ) { $ firstCategory = null === $ this -> category ? $ this -> getCategory ( $ document ) : $ this -> category ; $ key = null === $ this -> hashId ? $ this -> getHashId ( $ document , $ sm ) : $ this -> hashId ; $ slug = null === $ this -> slug ? $ this -> getSl...
Get the classified full adress
236,235
protected function getCategory ( Document $ document ) { $ obj = new CategoriesToRender ( ) ; $ categories = $ obj ( $ document , true , true ) ; $ firstCategory = reset ( $ categories ) ; return $ firstCategory ; }
The first category as slug
236,236
protected function getLocation ( Document $ document , $ sm ) { $ main = $ sm -> get ( 'neobazaar.service.main' ) ; $ location = $ document -> getGeoname ( ) ; if ( null !== $ location ) { if ( 'ADM3' == $ location -> getFeatureCode ( ) ) { $ location = $ main -> getGeonamesEntityRepository ( ) -> getParent ( $ locatio...
Get the classified location . To make the ADM2 select populated it will use the parent entity if the location is an ADM3
236,237
protected function getPurpose ( Document $ document ) { $ value = '' ; foreach ( $ document -> getMetadata ( ) as $ meta ) { if ( 'finalita' == $ meta -> getKey ( ) ) { $ value = $ meta -> getValue ( ) ; break ; } } return $ value ; }
Get the classified purpose
236,238
protected function getHideMobile ( Document $ document ) { foreach ( $ document -> getMetadata ( ) as $ meta ) { if ( 'hidemobile' == $ meta -> getKey ( ) ) { $ v = $ meta -> getValue ( ) ; return $ v ; break ; } } return false ; }
Get the classified hidemobile meta value
236,239
public function add ( array $ data , $ preserveArray = false , $ preserveKeyOnly = null ) { foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) && ( ! $ preserveArray || ( $ preserveArray && $ preserveKeyOnly && $ key !== $ preserveKeyOnly ) ) ) { $ this -> $ key = ( array_key_exists ( 0 , $ value ) ) ? ...
Adds data to the object
236,240
public function toArray ( $ recursive = false ) { $ return = get_object_vars ( $ this ) ; if ( $ recursive ) { foreach ( $ return as $ ppt => & $ val ) { if ( $ ppt === 'integerkeys' ) continue ; if ( is_object ( $ val ) && method_exists ( $ val , 'toArray' ) ) { $ val = $ val -> toArray ( true ) ; } } } unset ( $ retu...
Returns array of properties
236,241
public function getBodyWeight ( GenderCode $ genderCode , Tables $ tables ) : int { $ weightInKg = $ this -> getWeightInKg ( $ genderCode , $ tables ) ; return ( new Weight ( $ weightInKg , Weight :: KG , $ tables -> getWeightTable ( ) ) ) -> getBonus ( ) -> getValue ( ) ; }
Bonus of body weight
236,242
public static function any ( string $ path , $ handler ) : array { return [ static :: get ( $ path , $ handler ) , static :: post ( $ path , $ handler ) , static :: put ( $ path , $ handler ) , static :: patch ( $ path , $ handler ) , static :: delete ( $ path , $ handler ) , ] ; }
Add a route that matches any HTTP verb
236,243
public static function match ( array $ verbs , string $ path , $ handler ) : array { $ routes = [ ] ; foreach ( $ verbs as $ verb ) { switch ( strtolower ( $ verb ) ) { case 'get' : $ routes [ ] = static :: get ( $ path , $ handler ) ; break ; case 'post' : $ routes [ ] = static :: post ( $ path , $ handler ) ; break ;...
Add a route that matches the given HTTP verbs
236,244
protected static function add ( string $ verb , string $ path , $ handler ) : Route { $ router = static :: getRouterInstance ( ) ; $ route = new static ( $ router , $ verb , $ path , $ handler ) ; Router :: addRoute ( $ verb , $ route ) ; return $ route ; }
Creates a new route
236,245
public function createRegex ( ) { $ parts = explode ( '/' , ltrim ( $ this -> path , '/' ) ) ; $ regex = '/^' ; foreach ( $ parts as $ part ) { $ regex .= '\/' ; if ( stripos ( $ part , '{' ) === false && stripos ( $ part , '}' ) === false ) { $ regex .= $ part ; continue ; } $ name = str_ireplace ( [ '{' , '}' ] , '' ...
Creates a regular expression to match the route
236,246
private function runMultiLanguage ( ) : void { if ( ! App :: $ Properties -> get ( 'multiLanguage' ) ) { $ this -> language = App :: $ Properties -> get ( 'singleLanguage' ) ; return ; } if ( Any :: isArray ( App :: $ Properties -> get ( 'languageDomainAlias' ) ) ) { $ domainAlias = App :: $ Properties -> get ( 'langua...
Build multi language pathway binding .
236,247
private function setLanguageFromBrowser ( ) : void { $ userLang = App :: $ Properties -> get ( 'singleLanguage' ) ; $ browserAccept = $ this -> getLanguages ( ) ; if ( Any :: isArray ( $ browserAccept ) && count ( $ browserAccept ) > 0 ) { foreach ( $ browserAccept as $ bLang ) { if ( Arr :: in ( $ bLang , App :: $ Pro...
Set language from browser headers
236,248
private function composeSnapItem ( $ customerId , $ parentId , $ dsChanged , $ snap ) { $ result = new ESnap ( ) ; $ result -> setCustomerRef ( $ customerId ) ; $ result -> setParentRef ( $ parentId ) ; $ result -> setDate ( $ dsChanged ) ; if ( $ customerId == $ parentId ) { $ newDepth = Cfg :: INIT_DEPTH ; $ newPath ...
Compose snapshot item .
236,249
final protected function getArrayValue ( string $ key ) : array { $ value = $ this -> getConfigValue ( $ key ) ; if ( ! $ value || ! \ is_array ( $ value ) ) { return [ ] ; } return $ value ; }
Returns an array value .
236,250
final protected function getStringValue ( string $ key , string $ default = '' ) : string { $ value = $ this -> getConfigValue ( $ key ) ; if ( ! $ value ) { return $ default ; } return strval ( $ value ) ; }
Retrieves a string configuration parameter .
236,251
final protected function getBooleanValue ( string $ key , bool $ default = false ) : bool { $ value = $ this -> getConfigValue ( $ key ) ; if ( ! $ value ) { return $ default ; } return \ boolval ( $ value ) ; }
Retrieves a boolean configuration parameter .
236,252
private function isBaseConfigPropertiesSet ( ) : bool { return isset ( $ this -> config [ ConfigurationInterface :: KEY_APP_ROOT ] , $ this -> config [ ConfigurationInterface :: KEY_CONFIG_ROOT ] , $ this -> config [ ConfigurationInterface :: KEY_CACHE_ROOT ] , $ this -> config [ ConfigurationInterface :: KEY_THEMES_RO...
Checks that all the mandatory properties are set .
236,253
public function _pre_wp_nav_menu ( $ output , $ args ) { if ( is_customize_preview ( ) ) { return $ output ; } if ( ! $ args -> theme_location ) { return $ output ; } if ( ! $ this -> _is_caching_nav_menus ( ) ) { return $ output ; } if ( ! $ this -> _is_caching_nav_menu ( $ args -> theme_location ) ) { return $ output...
Output nav menu
236,254
public function _remove_current_classes ( $ items , $ args ) { if ( is_customize_preview ( ) ) { return $ items ; } if ( ! static :: _is_caching_nav_menus ( ) ) { return $ items ; } if ( ! $ this -> _is_caching_nav_menu ( $ args -> theme_location ) ) { return $ items ; } foreach ( $ items as $ items_index => $ item ) {...
Remove current classes
236,255
public static function enable ( $ reportingLevel = NULL , $ displayErrors = NULL ) { if ( ! static :: $ enabled ) { static :: $ enabled = true ; error_reporting ( E_ALL ) ; ErrorHandler :: register ( $ reportingLevel , $ displayErrors ) ; if ( PHP_SAPI !== 'cli' ) { ExceptionHandler :: register ( $ reportingLevel , $ d...
activate custom debugging registers error handler and exception handler
236,256
public function sql ( $ sql , array $ values = array ( ) ) { $ this -> whereSqlConditions [ ] = $ sql ; $ this -> arguments = array_merge ( $ this -> arguments , $ values ) ; return $ this ; }
Adds sql statement into where statement
236,257
public function like ( $ field , $ value ) { $ operator = ' ' . $ this -> executable -> provideSqlDialect ( ) -> likeOperator ( ) . ' ' ; return $ this -> setTwoArgsOperator ( $ field , $ value , $ operator ) ; }
Adds LIKE statement into where statement
236,258
protected function SaveElement ( ) { $ this -> register -> SetConfirmUrl ( $ this -> selectorConfirm -> Save ( $ this -> register -> GetConfirmUrl ( ) ) ) ; $ this -> register -> SetNextUrl ( $ this -> selectorNext -> Save ( $ this -> register -> GetNextUrl ( ) ) ) ; $ this -> register -> SetMailFrom ( $ this -> Value ...
Saves the simple register element
236,259
function prepareHtml ( ) { $ this -> html = trim ( preg_replace ( '/\t\n/' , '' , $ this -> html ) ) ; $ this -> html = preg_replace ( '/\s+/' , ' ' , $ this -> html ) ; $ this -> html = $ this -> replaceSpecialCharacters ( $ this -> html ) ; }
Prepares HTML for processing
236,260
function parseDocument ( ) { $ this -> prepareHtml ( ) ; $ current = libxml_use_internal_errors ( true ) ; $ disableEntities = libxml_disable_entity_loader ( true ) ; $ charset = 'UTF-8' ; $ this -> doc = new \ DOMDocument ( '1.0' , $ charset ) ; $ this -> doc -> strictErrorChecking = false ; @ $ this -> doc -> loadHTM...
Parses the HTML document
236,261
private function generateTmlTags ( $ node ) { $ buffer = "" ; foreach ( $ node -> childNodes as $ child ) { if ( $ child -> nodeType == 3 ) { $ buffer = $ buffer . $ child -> wholeText ; } else { $ buffer = $ buffer . $ this -> generateTmlTags ( $ child ) ; } } $ token_context = $ this -> generateHtmlToken ( $ node ) ;...
TML nodes can be nested - but they CANNOT contain non - inline nodes
236,262
private function resetContext ( ) { $ this -> debug_tokens = $ this -> tokens ; $ this -> tokens = array_merge ( array ( ) , $ this -> context ) ; }
Resets context of the current translation
236,263
function send ( ) { if ( ! headers_sent ( ) ) { extract ( $ this -> toArray ( ) ) ; setcookie ( $ name , $ value , $ expires , $ path , $ domain , $ secure , $ httponly ) ; } }
Sets the cookie to be sent by the headers
236,264
public function addError ( Error $ error ) { $ this -> result -> addError ( $ error ) ; $ this -> setObjectType ( self :: OBJECT_TYPE_NONE ) ; }
Adds an error to the processor which may then be merged with the errors of the property being currently mapped .
236,265
public static function key ( $ key , $ value = null ) { if ( $ value == null ) return $ _SESSION [ $ key ] ; $ _SESSION [ $ key ] = $ value ; }
Set or get session key
236,266
public static function flash ( string $ key , $ value = null ) { return $ _SESSION [ 'application' ] [ 'with' ] = array_merge ( isset ( $ _SESSION [ 'application' ] [ 'with' ] ) ? $ _SESSION [ 'application' ] [ 'with' ] : [ ] , [ $ key => $ value ] ) ; }
Create a flash message
236,267
public function register ( array $ definitions ) : self { foreach ( $ definitions as $ name => $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ InvalidArgumentException ( 'Values passed to register must be callable' ) ; } $ this -> definitions [ $ name ] = $ callback ; } return $ this ; }
Registers rule definitions .
236,268
public function alias ( string $ name , $ rules , ? string $ error = null ) : self { $ this -> definitions [ $ name ] = function ( ) use ( $ rules , $ error ) { return $ this -> parser -> parse ( $ rules ) -> setError ( $ error ) ; } ; return $ this ; }
Registers an alias for a ruleset .
236,269
public function aliasDefinition ( $ definition ) : self { if ( is_object ( $ definition ) ) { $ definition = ( array ) $ definition ; } if ( ! is_array ( $ definition ) ) { throw new \ InvalidArgumentException ( "Invalid alias definition: must be an object or an associative array" ) ; } if ( ! isset ( $ definition [ 'n...
Registers an alias for a ruleset using a LIVR - compliant definition .
236,270
public function factory ( string $ name , $ arg = null ) : Rule { if ( ! array_key_exists ( $ name , $ this -> definitions ) ) { throw new \ InvalidArgumentException ( "No rule registered with name: $name" ) ; } $ vrule = is_array ( $ arg ) ? call_user_func_array ( $ this -> definitions [ $ name ] , $ arg ) : call_user...
Constructs a validation rule .
236,271
public static function populateEnvironment ( Event $ event ) { $ url = getenv ( 'CLEARDB_DATABASE_URL' ) ; if ( $ url ) { $ url = parse_url ( $ url ) ; putenv ( "SYMFONY_DATABASE_HOST={$url['host']}" ) ; putenv ( "SYMFONY_DATABASE_USER={$url['user']}" ) ; putenv ( "SYMFONY_DATABASE_PASSWORD={$url['pass']}" ) ; $ db = s...
Populate Heroku environment
236,272
public function putQuoteId ( $ data ) { if ( $ this -> registry -> registry ( self :: QUOTE_ID ) ) { $ this -> registry -> unregister ( self :: QUOTE_ID ) ; } $ this -> registry -> register ( self :: QUOTE_ID , $ data ) ; }
Quote ID for newly created orders .
236,273
protected function findTags ( ContainerBuilder $ container , $ tagName , $ argumentPosition , $ ext = false ) : void { $ services = [ ] ; foreach ( $ container -> findTaggedServiceIds ( $ tagName ) as $ serviceId => $ tag ) { $ class = isset ( $ tag [ 0 ] [ 'class' ] ) ? $ this -> getRealClassName ( $ container , $ tag...
Find service tags .
236,274
protected function getRealClassName ( ContainerBuilder $ container , $ classname ) { return 0 === strpos ( $ classname , '%' ) ? $ container -> getParameter ( trim ( $ classname , '%' ) ) : $ classname ; }
Get the real class name .
236,275
protected function getClassName ( ContainerBuilder $ container , $ serviceId , $ tagName ) { $ type = $ container -> getDefinition ( $ serviceId ) ; $ interfaces = class_implements ( $ type -> getClass ( ) ) ; if ( \ in_array ( ObjectTypeExtensionInterface :: class , $ interfaces , true ) ) { throw new InvalidConfigura...
Get the class name of default value type .
236,276
protected function buildInstanceType ( Definition $ type , $ serviceId , $ tagName ) { $ parents = class_parents ( $ type -> getClass ( ) ) ; $ args = $ type -> getArguments ( ) ; $ ref = new \ ReflectionClass ( $ type ) ; if ( \ in_array ( AbstractSimpleType :: class , $ parents , true ) && ( 0 === \ count ( $ args ) ...
Build the simple default type instance .
236,277
private function findResolveTarget ( ContainerBuilder $ container , $ class ) { $ resolveTargets = $ this -> getResolveTargets ( $ container ) ; if ( isset ( $ resolveTargets [ $ class ] ) ) { $ class = $ resolveTargets [ $ class ] ; } return $ class ; }
Find the resolve target of class .
236,278
private function replaceResolveTargetClass ( ContainerBuilder $ container , $ tagName , $ serviceId , $ class ) : void { $ def = $ container -> getDefinition ( $ serviceId ) ; $ this -> replaceClassInArguments ( $ container , $ def , $ class ) ; $ this -> replaceClassInTags ( $ def , $ tagName , $ class ) ; }
Replace the resolve target class .
236,279
protected function deleteLocaleData ( $ localeCode , OutputInterface $ output ) { $ entityManager = $ this -> getDoctrineHelper ( ) -> getEntityManager ( ) ; $ metadata = $ this -> getDoctrineHelper ( ) -> getAllMetadata ( ) ; $ locale = $ this -> getLocaleRepository ( ) -> findOneBy ( [ 'code' => $ localeCode ] ) ; if...
Deletes the locale
236,280
public function setSeedFarm ( \ Librinfo \ SeedBatchBundle \ Entity \ SeedFarm $ seedFarm = null ) { $ this -> seedFarm = $ seedFarm ; return $ this ; }
Set seedFarm .
236,281
private function createErrorHandler ( ) { return function ( $ errno , $ errstr , $ errfile , $ errline ) { if ( ! ( error_reporting ( ) & $ errno ) ) { return ; } throw new \ ErrorException ( $ errstr , 0 , $ errno , $ errfile , $ errline ) ; } ; }
Creates and returns a callable error handler that raises exceptions .
236,282
public function build ( $ aConnection , array $ mappingsPaths = [ ] , $ isDevMode = true ) { if ( empty ( $ mappingsPaths ) ) { $ mappingsPaths = [ __DIR__ . '/Mapping' ] ; } Type :: addType ( 'user_id' , UserIdType :: class ) ; Type :: addType ( 'user_roles' , UserRolesType :: class ) ; return EntityManager :: create ...
Creates an entity manager instance enabling mappings and custom types .
236,283
public function get ( string $ type , string $ id ) { if ( $ this -> shouldCacheEntity ( $ type , $ id ) ) { $ key = $ this -> getKey ( $ type , $ id ) ; $ this -> logger -> debug ( 'Fetching from cache' , [ 'type' => $ type , 'id' => $ id , 'key' => $ key , ] ) ; if ( $ item = $ this -> cache -> fetch ( $ key ) ) { re...
Get single entity .
236,284
private function getFreshDataWithCache ( QueueItem $ item ) { $ sdk = $ this -> getSdk ( $ item ) ; $ entity = $ sdk -> get ( $ item -> getId ( ) ) -> wait ( true ) ; if ( false === $ this -> shouldCacheEntity ( $ item -> getType ( ) , $ item -> getId ( ) ) ) { return $ entity ; } if ( $ entity ) { $ this -> logger -> ...
Get fresh data with cache .
236,285
public function run ( Task $ task ) { $ filters = $ task -> getConfiguration ( ) -> getParameter ( 'filters' ) ; $ sources = $ this -> fetchSources ( $ task ) ; $ destinations = $ this -> fetchDestinations ( $ task ) ; foreach ( $ filters as $ filterName ) { $ filter = $ this -> getFilter ( $ filterName ) ; $ filteredS...
Run a task load its sources before and call the clean method on the filter .
236,286
protected function getFilter ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> filters ) ) { throw new Exception ( 'Invalid filter ' . $ name . '. Check your mapping configuration' ) ; } return $ this -> filters [ $ name ] ; }
Return a filter by its name . Throw an exception if it is not exists .
236,287
protected function fetchSources ( Task $ task ) { $ sources = [ ] ; foreach ( $ task -> getSources ( ) as $ source ) { $ sources = array_merge ( $ sources , $ this -> locator -> locate ( $ source ) ) ; } return $ sources ; }
Fetch the source files from the task and return and array of SplInfo .
236,288
protected function fetchDestinations ( Task $ task ) { $ sources = [ ] ; foreach ( $ task -> getDestinations ( ) as $ source ) { $ sources [ ] = new SplFileInfo ( $ source ) ; } return $ sources ; }
Fetch the destination files from the task and return and array of SplInfo .
236,289
protected function filterSources ( array $ sources , FilterInterface $ filter ) { $ filteredSources = [ ] ; if ( ! is_array ( $ filter -> getSupportedExtensions ( ) ) || ! count ( $ filter -> getSupportedExtensions ( ) ) ) { throw new Exception ( 'No supported extensions found for the filter ' . $ filter -> getName ( )...
Filter only the sources supported by the current filter .
236,290
protected function updateSources ( array $ originalSources , array $ filteredSources , array $ updatedSources ) { $ sources = [ ] ; $ filteredPath = [ ] ; foreach ( $ filteredSources as $ filteredSource ) { $ filteredPath [ ] = $ filteredSource -> getPath ( ) ; } foreach ( $ originalSources as $ originalSource ) { if (...
Remove the filtered files from the sources and merge with the new ones .
236,291
public function urlOfImage ( $ filename , $ width = 300 , $ height = 300 ) { $ url = Config :: get ( 'app.url' ) ; $ url .= '/' ; $ url .= Config :: get ( 'lasallecmsfrontend.images_folder_resized' ) ; $ url .= '/' ; $ url .= $ this -> parseFilenameIntoResizedFilename ( $ filename , $ width , $ height ) ; return $ url ...
Put together the URL of the image .
236,292
public function parseFilenameIntoResizedFilename ( $ filename , $ width = 300 , $ height = 300 ) { $ fileNameWithNoExtension = $ this -> filenameWithNoExtension ( $ filename ) ; $ fileNameExtension = $ this -> filenameWithExtensionOnly ( $ filename ) ; $ parsedFilename = "" ; $ parsedFilename .= $ fileNameWithNoExtensi...
Take an image s filename and return the name of the resized file .
236,293
public function categoryImageResizedFilename ( $ categoryFeaturedImage ) { $ imageSizes = Config :: get ( 'lasallecmsfrontend.category_featured_image_size' ) ; $ fileNameWithNoExtension = $ this -> filenameWithNoExtension ( $ categoryFeaturedImage ) ; $ fileNameExtension = $ this -> filenameWithExtensionOnly ( $ catego...
What is the name of the resized category featured image that the view will use?
236,294
public function createCategoryResizedImageFiles ( $ filename ) { $ filename = $ this -> categoryImageDefaultOrSpecified ( $ filename ) ; $ imageSizes = Config :: get ( 'lasallecmsfrontend.category_featured_image_size' ) ; foreach ( $ imageSizes as $ width => $ height ) { if ( ! $ this -> isFileExist ( $ this -> pathFil...
Create resized image files for the category featured image
236,295
public function tagImageResizedFilename ( $ defaultTagImage ) { $ imageSizes = Config :: get ( 'lasallecmsfrontend.default_tag_image_image_size' ) ; $ fileNameWithNoExtension = $ this -> filenameWithNoExtension ( $ defaultTagImage ) ; $ fileNameExtension = $ this -> filenameWithExtensionOnly ( $ defaultTagImage ) ; for...
What is the name of the resized tag default image that the view will use?
236,296
public function tagResizedImageFiles ( $ defaultTagImage ) { $ imageSizes = Config :: get ( 'lasallecmsfrontend.default_tag_image_image_size' ) ; foreach ( $ imageSizes as $ width => $ height ) { if ( ! $ this -> isFileExist ( $ this -> pathFilenameOfResizedImage ( $ defaultTagImage , $ width , $ height ) ) ) { $ this ...
Create resized image files for the tag default image
236,297
public function resize ( $ filename , $ width , $ height ) { $ img = Image :: make ( $ this -> pathOfImagesUploadFolder ( ) . '/' . $ filename ) ; $ img -> resize ( $ width , $ height , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; $ constraint -> upsize ( ) ; } ) ; $ img -> save ( $ this -> pathFilenam...
Resize the image using the terrific Intervention package
236,298
public function pathFilenameOfResizedImage ( $ filename , $ width , $ height ) { $ path = $ this -> pathOfImagesResizedFolder ( ) ; $ filenameWithNoExtension = $ this -> filenameWithNoExtension ( $ filename ) ; $ filenameWithExtensionOnly = $ this -> filenameWithExtensionOnly ( $ filename ) ; $ resizedFilename = $ path...
Put together the path + name of the resized imaged .
236,299
public function getServiceProfile ( $ service ) { if ( isset ( $ this -> serviceProfiles [ $ service ] ) ) { return $ this -> serviceProfiles [ $ service ] ; } return null ; }
Get service profile data