idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
47,500
protected function addFormatter ( ServiceContainer $ container , $ name , $ class ) { $ container -> set ( 'formatter.formatters.' . $ name , function ( ServiceContainer $ c ) use ( $ class ) { $ c -> set ( 'formatter.presenter' , new StringPresenter ( $ c -> get ( 'formatter.presenter.differ' ) ) ) ; return new $ class ( $ c -> get ( 'formatter.presenter' ) , $ c -> get ( 'console.io' ) , $ c -> get ( 'event_dispatcher.listeners.stats' ) ) ; } ) ; }
Add a formatter to the service container
47,501
public function getPluginClassNames ( ) { $ plugins = array ( ) ; if ( TRUE === $ this -> isEnabled ( 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\ClonePlugin' ) ) { $ plugins [ ] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\ClonePlugin' ; } if ( TRUE === $ this -> isEnabled ( 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CheckoutPlugin' ) ) { $ plugins [ ] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CheckoutPlugin' ; } if ( TRUE === $ this -> isEnabled ( 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PullPlugin' ) ) { $ plugins [ ] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PullPlugin' ; } if ( TRUE === $ this -> isEnabled ( 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CommitPlugin' ) ) { $ plugins [ ] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\CommitPlugin' ; } if ( TRUE === $ this -> isEnabled ( 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PushPlugin' ) ) { $ plugins [ ] = 'NamelessCoder\\GizzleGitPlugins\\GizzlePlugins\\PushPlugin' ; } return $ plugins ; }
Get all class names of plugins delivered from implementer package .
47,502
protected function clientSettings ( array $ configs , ContainerBuilder $ container ) { foreach ( $ configs as $ key => $ infos ) { $ clientDefinition = new Definition ( ) ; $ clientDefinition -> setClass ( $ infos [ 'class' ] ) ; $ hostsSettings = $ this -> hostSettings ( $ infos ) ; $ logPathSettings = $ this -> logPathSettings ( $ infos ) ; $ logLevelSettings = $ this -> logLevelSettings ( $ infos ) ; $ options = array ( 'hosts' => $ hostsSettings , 'logPath' => $ logPathSettings , 'logLevel' => $ logLevelSettings ) ; $ clientDefinition -> setArguments ( array ( $ options ) ) ; $ clientServiceId = 'ushios_elastic_search_client' ; if ( $ key == 'default' ) { $ container -> setDefinition ( $ clientServiceId , $ clientDefinition ) ; $ clientServiceId = $ clientServiceId . '.default' ; } else { $ clientServiceId = $ clientServiceId . '.' . $ key ; } $ container -> setDefinition ( $ clientServiceId , $ clientDefinition ) ; } }
Reading the config . yml for aws - sdk client .
47,503
public static function Apcg ( $ date1 , $ date2 , array $ ebpv , array $ ehp , iauASTROM & $ astrom ) { $ pv = [ [ 0.0 , 0.0 , 0.0 ] , [ 0.0 , 0.0 , 0.0 ] ] ; IAU :: Apcs ( $ date1 , $ date2 , $ pv , $ ebpv , $ ehp , $ astrom ) ; }
- - - - - - - - i a u A p c g - - - - - - - -
47,504
protected function doRemoveSkills ( Group $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeSkill ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { return new ErrorsException ( $ errors ) ; } }
Interal mechanism to remove Skills from Group
47,505
protected function doUpdateSkills ( Group $ model , $ data ) { SkillGroupQuery :: create ( ) -> filterByGroup ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addSkill ( $ related ) ; } } if ( count ( $ errors ) > 0 ) { throw new ErrorsException ( $ errors ) ; } }
Internal update mechanism of Skills on Group
47,506
private function realParseErrors ( FormInterface $ form , array & $ results ) { $ errors = $ form -> getErrors ( ) ; if ( count ( $ errors ) > 0 ) { $ config = $ form -> getConfig ( ) ; $ name = $ form -> getName ( ) ; $ label = $ config -> getOption ( 'label' ) ; $ translation = $ this -> getTranslationDomain ( $ form ) ; if ( empty ( $ label ) ) { $ label = ucfirst ( trim ( strtolower ( preg_replace ( array ( '/([A-Z])/' , '/[_\s]+/' ) , array ( '_$1' , ' ' ) , $ name ) ) ) ) ; } $ results [ ] = array ( 'name' => $ name , 'label' => $ label , 'errors' => $ errors , 'translation' => $ translation , ) ; } $ children = $ form -> all ( ) ; if ( count ( $ children ) > 0 ) { foreach ( $ children as $ child ) { if ( $ child instanceof FormInterface ) { $ this -> realParseErrors ( $ child , $ results ) ; } } } return $ results ; }
This does the actual job . Method travels through all levels of form recursively and gathers errors .
47,507
private function getTranslationDomain ( FormInterface $ form ) { $ translation = $ form -> getConfig ( ) -> getOption ( 'translation_domain' ) ; if ( empty ( $ translation ) ) { $ parent = $ form -> getParent ( ) ; if ( empty ( $ parent ) ) $ translation = 'messages' ; while ( empty ( $ translation ) ) { $ translation = $ parent -> getConfig ( ) -> getOption ( 'translation_domain' ) ; $ parent = $ parent -> getParent ( ) ; if ( ! $ parent instanceof FormInterface && empty ( $ translation ) ) $ translation = 'messages' ; } } return $ translation = $ translation === 'messages' ? null : $ translation ; }
Find the Translation Domain .
47,508
public function addFieldValidators ( array $ fieldValidators ) { foreach ( $ fieldValidators as $ fieldName => $ validators ) { $ this -> fieldValidators [ $ fieldName ] = $ validators ; } }
Adds field validators to the existing ones .
47,509
public function getFieldsData ( ) { $ fieldsData = array ( ) ; foreach ( $ this -> getFields ( ) as $ field ) { $ fieldData = $ this -> $ field ; if ( $ fieldData instanceof self ) { $ fieldData = $ fieldData -> getFieldsData ( ) ; } elseif ( @ reset ( $ fieldData ) instanceof Entity ) { $ newFieldData = array ( ) ; foreach ( $ fieldData as $ key => $ entity ) { $ newFieldData [ $ key ] = $ entity -> getFieldsData ( ) ; } $ fieldData = $ newFieldData ; } $ fieldsData [ $ field ] = $ fieldData ; } return $ fieldsData ; }
Returns an array composed of all the persistable fields .
47,510
public function store ( ) { if ( $ this -> isNew ) { Logger :: get ( ) -> debug ( 'Storing new entity ' . get_class ( $ this ) . '...' ) ; $ this -> id = $ this -> getDataSource ( ) -> create ( $ this -> getFieldsData ( ) ) ; $ this -> getFactory ( ) -> registerEntity ( $ this ) ; } else { Logger :: get ( ) -> debug ( 'Updating entity ' . get_class ( $ this ) . ":{$this->id}..." ) ; $ this -> getDataSource ( ) -> update ( $ this -> id , $ this -> getFieldsData ( ) ) ; } $ this -> isNew = false ; }
Stores the object in the persistence layer .
47,511
public function destroy ( ) { $ this -> getDataSource ( ) -> destroy ( $ this -> id ) ; $ this -> getFactory ( ) -> unregisterEntity ( $ this ) ; }
Destroys all copies of the object even the persisted ones .
47,512
public function setOptions ( $ options ) { if ( ! is_array ( $ options ) && ! $ options instanceof Traversable ) { throw new Exception \ InvalidArgumentException ( sprintf ( '"%s" expects an array or Traversable; received "%s"' , __METHOD__ , ( is_object ( $ options ) ? get_class ( $ options ) : gettype ( $ options ) ) ) ) ; } foreach ( $ options as $ key => $ value ) { if ( $ key == 'options' ) { $ key = 'adapterOptions' ; } $ method = 'set' . ucfirst ( $ key ) ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( $ value ) ; } } return $ this ; }
Set filter setate
47,513
public function getAdapter ( ) { if ( $ this -> adapter instanceof Compress \ CompressionAlgorithmInterface ) { return $ this -> adapter ; } $ adapter = $ this -> adapter ; $ options = $ this -> getAdapterOptions ( ) ; if ( ! class_exists ( $ adapter ) ) { $ adapter = 'Zend\\Filter\\Compress\\' . ucfirst ( $ adapter ) ; if ( ! class_exists ( $ adapter ) ) { throw new Exception \ RuntimeException ( sprintf ( '%s unable to load adapter; class "%s" not found' , __METHOD__ , $ this -> adapter ) ) ; } } $ this -> adapter = new $ adapter ( $ options ) ; if ( ! $ this -> adapter instanceof Compress \ CompressionAlgorithmInterface ) { throw new Exception \ InvalidArgumentException ( "Compression adapter '" . $ adapter . "' does not implement Zend\\Filter\\Compress\\CompressionAlgorithmInterface" ) ; } return $ this -> adapter ; }
Returns the current adapter instantiating it if necessary
47,514
public function setAdapter ( $ adapter ) { if ( $ adapter instanceof Compress \ CompressionAlgorithmInterface ) { $ this -> adapter = $ adapter ; return $ this ; } if ( ! is_string ( $ adapter ) ) { throw new Exception \ InvalidArgumentException ( 'Invalid adapter provided; must be string or instance of Zend\\Filter\\Compress\\CompressionAlgorithmInterface' ) ; } $ this -> adapter = $ adapter ; return $ this ; }
Sets compression adapter
47,515
public function getPath ( $ userId , $ permissionName , $ params = [ ] , $ allowCaching = true ) { if ( $ allowCaching && empty ( $ params ) && isset ( $ this -> paths [ $ userId ] [ $ permissionName ] ) ) { return $ this -> paths [ $ userId ] [ $ permissionName ] ; } $ this -> checkAccess ( $ userId , $ permissionName , $ params ) ; if ( $ allowCaching && empty ( $ params ) ) { $ this -> paths [ $ userId ] [ $ permissionName ] = $ this -> currentPath ; } return $ this -> currentPath ; }
Returns a list of auth items between the one checked and the one assigned to the user .
47,516
private function loadFromLocation ( $ location ) { Logger :: get ( ) -> debug ( 'Loading settings...' ) ; if ( substr ( $ location , - 1 ) != DIRECTORY_SEPARATOR ) { $ location .= DIRECTORY_SEPARATOR ; } $ settingsLocation = $ location . 'settings.json' ; if ( ! is_readable ( $ settingsLocation ) ) { Logger :: get ( ) -> error ( 'Settings file %s cannot be read.' , $ settingsLocation ) ; throw new Settings \ Exception ( "Settings file $settingsLocation is unavailable." ) ; } $ settings = json_decode ( file_get_contents ( $ settingsLocation ) , true ) ; if ( empty ( $ settings ) ) { throw new Settings \ Exception ( 'Settings file cannot be parsed.' ) ; } $ environmentSettings = null ; $ environment = self :: getEnvironment ( ) ; if ( $ environment ) { $ environmentSettingsLocation = sprintf ( '%ssettings-%s.json' , $ location , strtolower ( $ environment ) ) ; if ( is_readable ( $ environmentSettingsLocation ) ) { $ environmentSettings = json_decode ( file_get_contents ( $ environmentSettingsLocation ) , true ) ; if ( ! empty ( $ environmentSettings ) ) { $ settings = self :: mergeSettings ( $ settings , $ environmentSettings ) ; } } } $ this -> settings = self :: objectify ( $ settings ) ; }
Load settings from a file .
47,517
private static function objectify ( array $ array ) { foreach ( $ array as & $ item ) { if ( is_array ( $ item ) ) { $ item = self :: objectify ( $ item ) ; } } return ( object ) $ array ; }
Converts an array to an object recursively .
47,518
public static function getEnvironment ( ) { if ( empty ( self :: $ environment ) ) { self :: $ environment = getenv ( self :: ENV ) ? : @ $ _SERVER [ self :: ENV ] ? : @ $ _ENV [ self :: ENV ] ; if ( empty ( self :: $ environment ) ) { self :: $ environment = self :: ENV_PRODUCTION ; } } return self :: $ environment ; }
Find out the current environment .
47,519
public static function mergeSettings ( $ generalSettings , $ environmentSettings ) { $ mergedSettings = $ generalSettings ; foreach ( $ environmentSettings as $ key => & $ value ) { if ( is_array ( $ value ) && isset ( $ mergedSettings [ $ key ] ) && is_array ( $ mergedSettings [ $ key ] ) ) { $ mergedSettings [ $ key ] = self :: mergeSettings ( $ mergedSettings [ $ key ] , $ value ) ; } else { $ mergedSettings [ $ key ] = $ value ; } } return $ mergedSettings ; }
Merges two arrays just like array_merge_recursive but the second array overwrites the first one s values if there is a match .
47,520
public static function isEqual ( EqualityInterface $ first = null , EqualityInterface $ second = null ) { $ result = false ; if ( null === $ first ) { $ result = ( null === $ second ) ? true : false ; } else { $ result = $ first -> equals ( $ second ) ; } return $ result ; }
Indicates whether the two specified objects are equal .
47,521
public static function isNotEqual ( EqualityInterface $ first = null , EqualityInterface $ second = null ) { return false === self :: isEqual ( $ first , $ second ) ; }
Indicates whether the two specified objects are not equal .
47,522
public function loadAction ( Request $ request ) { $ repository = $ this -> get ( 'phlexible_media_template.template_manager' ) ; $ templateKey = $ request -> get ( 'template_key' ) ; $ template = $ repository -> find ( $ templateKey ) ; $ parameters = $ template -> getParameters ( ) ; if ( isset ( $ parameters [ 'method' ] ) ) { $ parameters [ 'xmethod' ] = $ parameters [ 'method' ] ; unset ( $ parameters [ 'method' ] ) ; } return new JsonResponse ( [ 'success' => true , 'data' => $ parameters ] ) ; }
List variables .
47,523
public function saveAction ( Request $ request ) { $ repository = $ this -> get ( 'phlexible_media_template.template_manager' ) ; $ templateKey = $ request -> get ( 'template_key' ) ; $ params = $ request -> request -> all ( ) ; unset ( $ params [ 'template_key' ] , $ params [ 'module' ] , $ params [ 'controller' ] , $ params [ 'action' ] ) ; $ template = $ repository -> find ( $ templateKey ) ; $ params = $ this -> fixParams ( $ params ) ; foreach ( $ params as $ key => $ value ) { $ template -> setParameter ( $ key , $ value ) ; } $ repository -> updateTemplate ( $ template ) ; return new ResultResponse ( true , 'Media template "' . $ template -> getKey ( ) . '" saved.' ) ; }
Save variables .
47,524
public function hydrate ( $ value ) { if ( $ value instanceof MongoId ) { return ( string ) $ value ; } if ( $ this -> nullable && $ value === null ) { return null ; } throw new Exception \ InvalidArgumentException ( sprintf ( 'Invalid value: must be an instance of MongoId, "%s" given.' , is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ) ) ; }
Ensure the value extracted is typed as string or null
47,525
public function extract ( $ value ) { if ( is_string ( $ value ) ) { return new MongoId ( $ value ) ; } if ( $ this -> nullable && $ value === null ) { return null ; } throw new Exception \ InvalidArgumentException ( sprintf ( 'Invalid value: must be a string containing a valid mongo ID, "%s" given.' , is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ) ) ; }
Ensure the value extracted is typed as MongoId or null
47,526
public function element ( $ elementName ) { if ( Configuration :: read ( 'mvc.autoload_shared_var' ) === true && empty ( $ this -> variableList ) === false ) { foreach ( $ this -> variableList as $ varName => $ varValue ) { $ { $ varName } = $ varValue ; } } $ layoutDirectory = $ this -> getDirectory ( ) . '/' . $ this -> getName ( ) ; $ elementPath = $ layoutDirectory . '/' . $ elementName . '.' . $ this -> getExtension ( ) ; if ( ! file_exists ( $ elementPath ) ) { trigger_error ( 'Element file "' . $ elementPath . '" doesn\'t exist.' , E_USER_ERROR ) ; return false ; } ob_start ( ) ; require ( $ elementPath ) ; echo PHP_EOL ; $ bodyContent = ob_get_clean ( ) ; return $ bodyContent ; }
Load part of Layout
47,527
public function setVar ( $ varName , $ varValue , $ force = false ) { if ( isset ( $ this -> variableList [ $ varName ] ) && $ force === false ) { trigger_error ( 'Variable "' . $ varName . '" is already defined in Layout.' , E_USER_WARNING ) ; return false ; } $ this -> variableList [ $ varName ] = $ varValue ; return true ; }
Set var to Layout
47,528
static public function except ( array $ input , $ keys ) { $ keys = is_array ( $ keys ) ? $ keys : array_slice ( func_get_args ( ) , 1 ) ; foreach ( $ keys as $ key ) { unset ( $ input [ $ key ] ) ; } return $ input ; }
return except key data from array
47,529
static public function extend ( array $ to , array $ from ) { foreach ( $ from as $ key => $ value ) { if ( is_array ( $ value ) ) { $ to [ $ key ] = self :: extend ( ( array ) ( isset ( $ to [ $ key ] ) ? $ to [ $ key ] : [ ] ) , $ value ) ; } else { $ to [ $ key ] = $ value ; } } return $ to ; }
extend a array
47,530
static public function xmlToArray ( $ xml ) { libxml_disable_entity_loader ( true ) ; $ values = json_decode ( json_encode ( simplexml_load_string ( $ xml , 'SimpleXMLElement' , LIBXML_NOCDATA ) ) , true ) ; return $ values ; }
xml to array
47,531
static public function replaceArrayKey ( $ arr = [ ] , $ field = '' ) { $ newArr = [ ] ; if ( $ arr ) { foreach ( $ arr as $ value ) { $ newArr [ $ value [ $ field ] ] = $ value ; } } return $ newArr ; }
replace array key
47,532
static public function replaceArrayKeyWithArray ( $ arr = [ ] , $ field = '' ) { $ newArr = [ ] ; if ( $ arr ) { foreach ( $ arr as $ value ) { $ newArr [ $ value [ $ field ] ] [ ] = $ value ; } } return $ newArr ; }
replace array key with array
47,533
public function jsonSerialize ( ) { $ copy = [ ] ; foreach ( ( array ) $ this as $ key => $ value ) { if ( ! is_string ( $ value ) ) { $ element = $ value -> getElement ( ) ; if ( is_object ( $ element ) and method_exists ( $ element , 'name' ) and $ name = $ element -> name ( ) ) { $ copy [ $ name ] = $ value instanceof JsonSerializable ? $ value -> jsonSerialize ( ) : $ value ; } $ copy [ $ key ] = $ value instanceof JsonSerializable ? $ value -> jsonSerialize ( ) : $ value ; } else { $ copy [ $ key ] = $ value ; } } return $ copy ; }
Returns a json_encode able hash .
47,534
public function register ( ) { $ this -> singleton ( 'validation' , function ( ) { return new Validation ( ) ; } ) ; $ app = & $ this -> app ; $ this -> singleton ( 'http.request' , function ( ) use ( & $ app ) { $ request = new Request ( $ app [ 'validation' ] ) ; $ request -> header ( 'X-FRAMEWORK-NAME' , $ app -> getName ( ) ) ; $ request -> header ( 'X-FRAMEWORK-VERSION' , $ app -> getVersion ( ) ) ; return $ request ; } , true ) ; $ this -> bind ( 'http.response' , function ( ) use ( & $ app ) { return $ app -> make ( 'http.request' ) -> getResponse ( ) ; } , true ) ; }
add the request and response to container
47,535
public function setName ( $ name , $ build ) { $ this -> _name = ( string ) $ name ; if ( isset ( $ this -> _name ) && isset ( $ this -> _value ) ) { $ build -> getProperties ( ) -> set ( $ this -> _name , $ this -> _value ) ; } }
sets the name of the property .
47,536
public function setValue ( $ value , $ build ) { $ this -> _value = ( string ) $ value ; if ( isset ( $ this -> _name ) && isset ( $ this -> _value ) ) { $ build -> setProperty ( $ this -> _name , $ this -> _value ) ; } }
sets the value of the property .
47,537
public function validate ( & $ msg = null ) { if ( ! isset ( $ this -> _name ) && ! isset ( $ this -> _value ) && ! isset ( $ this -> _file ) ) { return false ; } elseif ( isset ( $ this -> _file ) && ( isset ( $ this -> _name ) || isset ( $ this -> _value ) ) ) { return false ; } elseif ( ( isset ( $ this -> _name ) && ! isset ( $ this -> _value ) ) || ( ! isset ( $ this -> _name ) && isset ( $ this -> _value ) ) ) { return false ; } else { return true ; } }
Validates if a task can run by checking configs directries and so on .
47,538
public function beforeMarshal ( Event $ event , ArrayObject $ data , ArrayObject $ options ) { $ this -> check ( ) ; $ validator = $ this -> _table -> getValidator ( ) ; $ validator -> setProvider ( 'upload' , UploadValidation :: class ) ; foreach ( $ this -> _config [ 'fields' ] as $ field => $ path ) { $ validator -> add ( $ field , [ 'isUnderPhpSizeLimit' => [ 'rule' => 'isUnderPhpSizeLimit' , 'provider' => 'upload' , 'message' => __d ( 'Unimatrix/cake' , 'This file is too large' ) ] , 'isUnderFormSizeLimit' => [ 'rule' => 'isUnderFormSizeLimit' , 'provider' => 'upload' , 'message' => __d ( 'Unimatrix/cake' , 'This file is too large' ) ] , 'isCompletedUpload' => [ 'rule' => 'isCompletedUpload' , 'provider' => 'upload' , 'message' => __d ( 'Unimatrix/cake' , 'This file was only partially uploaded' ) ] , 'isTemporaryDirectory' => [ 'rule' => 'isTemporaryDirectory' , 'provider' => 'upload' , 'message' => __d ( 'Unimatrix/cake' , 'Missing a temporary folder' ) ] , 'isSuccessfulWrite' => [ 'rule' => 'isSuccessfulWrite' , 'provider' => 'upload' , 'message' => __d ( 'Unimatrix/cake' , 'Failed to write file to disk' ) ] , 'isNotStoppedByExtension' => [ 'rule' => 'isNotStoppedByExtension' , 'provider' => 'upload' , 'message' => __d ( 'Unimatrix/cake' , 'Upload was stopped by extension' ) ] , ] ) ; if ( $ validator -> isEmptyAllowed ( $ field , false ) && isset ( $ data [ $ field ] [ 'error' ] ) && $ data [ $ field ] [ 'error' ] === UPLOAD_ERR_NO_FILE ) unset ( $ data [ $ field ] ) ; } }
If a field is allowed to be empty as defined in the validation it should be unset to prevent processing
47,539
public function newAction ( Request $ request ) { $ entity = new Plan ( ) ; $ form = $ this -> createForm ( 'EcommerceBundle\Form\PlanType' , $ entity ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ entity ) ; $ checkoutManager = $ this -> get ( 'checkout_manager' ) ; $ checkoutManager -> createPaypalPlan ( $ entity ) ; $ checkoutManager -> activePaypalPlan ( $ entity ) ; if ( $ request -> isXMLHttpRequest ( ) ) { return new JsonResponse ( array ( 'id' => $ entity -> getId ( ) , 'name' => $ entity -> getName ( ) ) ) ; } $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'plan.created' ) ; return $ this -> redirectToRoute ( 'ecommerce_plan_show' , array ( 'id' => $ entity -> getId ( ) ) ) ; } return array ( 'entity' => $ entity , 'form' => $ form -> createView ( ) , ) ; }
Creates a new Plan entity .
47,540
public function showAction ( Plan $ plan ) { $ deleteForm = $ this -> createDeleteForm ( $ plan ) ; $ paypalPlan = $ this -> get ( 'checkout_manager' ) -> getPaypalPlan ( $ plan ) ; return array ( 'entity' => $ plan , 'delete_form' => $ deleteForm -> createView ( ) , 'paypalPlan' => $ paypalPlan ) ; }
Finds and displays a Plan entity .
47,541
private function createDeleteForm ( Plan $ plan ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'ecommerce_plan_delete' , array ( 'id' => $ plan -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; }
Creates a form to delete a Plan entity .
47,542
public function getEnvFile ( ) { $ basePath = $ this -> getBasePath ( ) ; $ envFile = $ this -> get ( 'envFile' ) ; $ startsWith = substr ( $ envFile , 0 , 1 ) ; if ( ! $ startsWith !== '/' && $ startsWith !== '~' && $ startsWith !== '\\' ) { $ envFile = $ basePath . DIRECTORY_SEPARATOR . $ envFile ; } return $ envFile ; }
Get the full path to the env file .
47,543
protected function verifyExtras ( array $ extras ) { if ( ! isset ( $ extras [ 'php-env-builder' ] ) ) { throw new \ InvalidArgumentException ( 'The parameter handler needs to be configured through the ' . 'extra.php-env-builder setting.' ) ; } if ( ! is_array ( $ extras [ 'php-env-builder' ] ) ) { throw new \ InvalidArgumentException ( 'The extra.php-env-builder setting must be an array or a configuration object.' ) ; } if ( ! isset ( $ extras [ 'php-env-builder' ] [ 'questions' ] ) || ! is_array ( $ extras [ 'php-env-builder' ] [ 'questions' ] ) ) { throw new \ InvalidArgumentException ( 'The extra.php-env-builder.questions setting must be an array of questions.' ) ; } }
Verify that the extras a formatted properly and throw an exception if not .
47,544
public static function build ( Event $ event , Builder $ builder = null ) { $ runner = new ComposerScriptRunner ( $ event , $ builder ) ; $ runner -> run ( ) ; }
Build the config based on a composer s package . json file .
47,545
protected function askQuestions ( array $ questons ) { foreach ( $ questons as $ question ) { $ this -> verifyQuestion ( $ question ) ; $ name = $ question [ 'name' ] ; $ prompt = $ question [ 'prompt' ] ; $ default = isset ( $ question [ 'default' ] ) ? $ question [ 'default' ] : '' ; $ required = isset ( $ question [ 'required' ] ) ? ( bool ) $ question [ 'required' ] : false ; $ this -> builder -> ask ( $ name , $ prompt , $ default , $ required ) ; } }
Run through each of the questions and ask each one .
47,546
protected function shouldCancelOnClobber ( ) { $ fullPath = $ this -> getEnvFile ( ) ; if ( ! $ this -> get ( 'clobber' ) && file_exists ( $ fullPath ) ) { $ this -> event -> getIO ( ) -> write ( sprintf ( 'Env file `%s` already exists, skipping...' , $ fullPath ) ) ; return true ; } return false ; }
If we re clobbering and we re not supposed to should we cancel?
47,547
public function disconnect ( ) : void { if ( $ this -> connected ( ) === true ) { fclose ( $ this -> connection ) ; $ this -> connection = false ; } }
Disconnect from the server .
47,548
public function setBlocking ( int $ mode ) : bool { if ( $ this -> connected ( ) === false ) { throw new \ Exception ( 'Not connected' ) ; } return stream_set_blocking ( $ this -> connection , $ mode ) ; }
Set the mode of stream - blocking .
47,549
public function read ( ) : string { if ( $ this -> connected ( ) === false ) { throw new \ Exception ( 'Not connected' ) ; } $ response = '' ; $ continue = true ; while ( $ continue == true ) { $ data = null ; try { $ data = $ this -> readLine ( ) ; } catch ( \ Exception $ e ) { $ continue = false ; } if ( ! is_null ( $ data ) ) { $ response .= $ data ; } } return $ response ; }
Read all data from the stream .
47,550
public function readLine ( ) : string { if ( $ this -> connected ( ) === false ) { throw new \ Exception ( 'Not connected' ) ; } $ response = fgets ( $ this -> connection ) ; if ( $ response === false ) { throw new \ Exception ( 'Nothing to read' ) ; } return $ response ; }
Read a line of data from the stream .
47,551
public function readBytes ( int $ bytes ) : string { if ( $ this -> connected ( ) === false ) { throw new \ Exception ( 'Not connected' ) ; } $ response = fread ( $ this -> connection , $ bytes ) ; if ( $ response === false ) { throw new \ Exception ( 'Nothing to read' ) ; } return $ response ; }
Read a number of bytes from the stream .
47,552
public function writeLine ( string $ data ) : void { try { $ this -> write ( $ data . "\r\n" ) ; } catch ( \ Exception $ e ) { throw $ e ; } }
Write a line of data to the stream .
47,553
public function role ( $ src , $ value = '' ) { if ( isset ( $ this -> _config -> config [ 'firewall' ] [ '' . $ src . '' ] ) ) { if ( $ value == '' ) { $ role = explode ( '.' , $ this -> _config -> config [ 'firewall' ] [ '' . $ src . '' ] [ 'roles' ] [ 'name' ] ) ; return $ this -> _getSession ( $ role ) ; } else { $ role = explode ( '.' , $ this -> _config -> config [ 'firewall' ] [ '' . $ src . '' ] [ 'roles' ] [ 'name' ] ) ; $ this -> _setSession ( $ role , $ value ) ; } } else { throw new MissingConfigException ( 'the module ' . $ src . ' doesn\'t exist' ) ; } return false ; }
Get and Set the value of any role attribute
47,554
public function logged ( $ src , $ value = '' ) { if ( isset ( $ this -> _config -> config [ 'firewall' ] [ '' . $ src . '' ] ) ) { if ( $ value == '' ) { $ logged = explode ( '.' , $ this -> _config -> config [ 'firewall' ] [ '' . $ src . '' ] [ 'logged' ] [ 'name' ] ) ; $ data = $ this -> _getSession ( $ logged ) ; if ( $ data != '' ) { return $ data ; } else { return false ; } } else { $ logged = explode ( '.' , $ this -> _config -> config [ 'firewall' ] [ '' . $ src . '' ] [ 'logged' ] [ 'name' ] ) ; $ this -> _setSession ( $ logged , $ value ) ; } } else { throw new MissingConfigException ( 'the module ' . $ src . ' doesn\'t exist' ) ; } return false ; }
Get and Set the value of any logged attribute
47,555
protected function getDevicesFromSessions ( Carbon $ start , Carbon $ end ) { return $ this -> getVisitorsFilteredByDateRange ( $ start , $ end ) -> filter ( function ( Visitor $ session ) { return $ session -> hasDevice ( ) ; } ) -> transform ( function ( Visitor $ session ) { return $ session -> device ; } ) -> groupBy ( 'kind' ) -> transform ( function ( Collection $ items , $ key ) { return [ 'kind' => trans ( "tracker::devices.kinds.$key" ) , 'count' => $ items -> count ( ) , ] ; } ) ; }
Get the devices from sessions .
47,556
protected function _set_stroke_colour ( $ colour ) { $ colour [ 0 ] = round ( 255 * $ colour [ 0 ] ) ; $ colour [ 1 ] = round ( 255 * $ colour [ 1 ] ) ; $ colour [ 2 ] = round ( 255 * $ colour [ 2 ] ) ; if ( is_null ( $ this -> _last_stroke_color ) || $ color != $ this -> _last_stroke_color ) { $ this -> _pdf -> SetDrawColor ( $ color [ 0 ] , $ color [ 1 ] , $ color [ 2 ] ) ; $ this -> _last_stroke_color = $ color ; } }
Sets the stroke colour
47,557
public static function getInstance ( ) { if ( ! function_exists ( "curl_init" ) ) { Error :: throwError ( "cine" ) ; } static $ inst = null ; if ( $ inst === null ) { $ inst = new Connection ( ) ; $ inst -> client_user_agent = $ inst -> getBaseClientUserAgent ( ) ; } return $ inst ; }
Call this method to get singleton
47,558
public function createApmOrder ( $ order = array ( ) ) { $ myOrder = new APMOrder ( $ order ) ; $ response = OrderService :: createOrder ( $ myOrder ) ; if ( isset ( $ response [ "orderCode" ] ) ) { return $ response ; } else { Error :: throwError ( "apierror" ) ; } }
Create Worldpay APM order
47,559
public function createOrder ( $ order = array ( ) ) { $ myOrder = new Order ( $ order ) ; $ response = OrderService :: createOrder ( $ myOrder ) ; if ( isset ( $ response [ "orderCode" ] ) ) { return $ response ; } else { Error :: throwError ( "apierror" ) ; } }
Create Worldpay order
47,560
public function authorize3DSOrder ( $ orderCode , $ responseCode ) { if ( empty ( $ orderCode ) || ! is_string ( $ orderCode ) ) { Error :: throwError ( 'ip' , Error :: $ errors [ '3ds' ] [ 'ordercode' ] ) ; } return OrderService :: authorize3DSOrder ( $ orderCode , $ responseCode ) ; }
Authorize Worldpay 3DS Order
47,561
public function cancelAuthorizedOrder ( $ orderCode = false ) { if ( empty ( $ orderCode ) || ! is_string ( $ orderCode ) ) { Error :: throwError ( 'ip' , Error :: $ errors [ 'capture' ] [ 'ordercode' ] ) ; } OrderService :: cancelAuthorizedOrder ( $ orderCode ) ; }
Cancel Authorized Worldpay Order
47,562
public function refundOrder ( $ orderCode = false , $ amount = null ) { if ( empty ( $ orderCode ) || ! is_string ( $ orderCode ) ) { Error :: throwError ( 'ip' , Error :: $ errors [ 'refund' ] [ 'ordercode' ] ) ; } OrderService :: refundOrder ( $ orderCode , $ amount ) ; }
Refund Worldpay order
47,563
public function getOrder ( $ orderCode = false ) { if ( empty ( $ orderCode ) || ! is_string ( $ orderCode ) ) { Error :: throwError ( 'ip' , Error :: $ errors [ 'orderInput' ] [ 'orderCode' ] ) ; } $ response = OrderService :: getOrder ( $ orderCode ) ; if ( ! isset ( $ response [ "orderCode" ] ) ) { Error :: throwError ( "apierror" ) ; } return $ response ; }
Get a Worldpay order
47,564
public function getStoredCardDetails ( $ token = false ) { if ( empty ( $ token ) || ! is_string ( $ token ) ) { Error :: throwError ( 'ip' , Error :: $ errors [ 'orderInput' ] [ 'token' ] ) ; } $ response = TokenService :: getStoredCardDetails ( $ token ) ; if ( ! isset ( $ response [ 'paymentMethod' ] ) ) { Error :: throwError ( "apierror" ) ; } return $ response [ 'paymentMethod' ] ; }
Get card details from Worldpay token
47,565
public static function generateLabel ( $ field ) { $ label = Str :: title ( str_replace ( '_' , ' ' , $ field [ 'fieldName' ] ) ) ; $ template = "{!! Form::label('\$FIELD_NAME\$', '\$FIELD_NAME_TITLE\$:', ['class' => 'form-control-label $FIELD_NAME_TITLE$']) !!}" ; $ template = str_replace ( '$FIELD_NAME_TITLE$' , $ label , $ template ) ; $ template = str_replace ( '$FIELD_NAME$' , $ field [ 'fieldName' ] , $ template ) ; return $ template ; }
added bootstrap default class to the label
47,566
public static function throwHttpExceptionWithCode ( $ error_code = null , $ payload = [ ] , $ hateoas = [ ] , $ replacements = [ ] ) { $ errors = static :: getErrors ( [ $ error_code ] , [ $ error_code => $ payload ] ) ; $ error = current ( $ errors ) ; $ replacements = self :: getReplacements ( $ error [ 'system_message' ] , $ error [ 'payload' ] , $ error [ 'help' ] , $ hateoas , $ replacements ) ; app ( 'api.exception' ) -> setReplacements ( $ replacements ) ; $ exception = self :: getExceptionObject ( static :: $ errors [ $ error [ 'error_code' ] ] [ 'exception' ] , $ error ) ; throw $ exception ; }
Throw HttpException with specified or unknown error .
47,567
public static function getReplacements ( $ system_message = '' , $ payload = [ ] , $ help_link = '' , $ hateoas = [ ] , $ replacements = [ ] ) { if ( $ system_message ) { $ replacements [ ':system_message' ] = $ system_message ; } if ( ! empty ( $ payload ) ) { $ replacements [ ':payload' ] = $ payload ; } if ( $ help_link ) { $ replacements [ ':help' ] = $ help_link ; } if ( ! empty ( $ hateoas ) ) { $ replacements [ ':links' ] = $ hateoas ; } return $ replacements ; }
Get array of replacements for mixing to Exception .
47,568
public function validateRequestOrFail ( $ request , array $ rules , $ messages = [ ] , $ customAttributes = [ ] ) { $ validator = $ this -> getValidationFactory ( ) -> make ( $ request -> all ( ) , $ rules , $ messages , $ customAttributes ) ; if ( $ validator -> fails ( ) ) { throw new HttpException ( 400 , json_encode ( $ validator -> errors ( ) -> getMessages ( ) ) ) ; } }
Validate request for current resource .
47,569
private function publishAppBaseController ( ) { $ templateHelper = new TemplatesHelper ( ) ; $ templateData = $ templateHelper -> getTemplate ( 'AppBaseController' , 'controller' ) ; $ templateData = GeneratorUtils :: fillTemplate ( CommandData :: getConfigDynamicVariables ( ) , $ templateData ) ; $ fileName = 'AppBaseController.php' ; $ filePath = Config :: get ( 'generator.path_controller' , app_path ( 'Http/Controllers/' ) ) ; $ fileHelper = new FileHelper ( ) ; $ fileHelper -> writeFile ( $ filePath . $ fileName , $ templateData ) ; $ this -> comment ( 'AppBaseController generated' ) ; $ this -> info ( $ fileName ) ; }
Publishes base controller .
47,570
public function printItems ( ... $ items ) { $ args = func_get_args ( ) ; if ( count ( $ args ) == 0 ) { $ args = $ this -> items ; } for ( $ i = 0 ; $ i < sizeof ( $ args ) ; $ i ++ ) { $ data = $ args [ $ i ] ; if ( is_array ( $ data ) ) { $ this -> printLabelValuePairs ( $ data ) ; } elseif ( is_object ( $ data ) ) { print $ data ; } else { $ value = $ this -> generateValue ( $ data ) ; if ( $ value !== false && $ value !== null ) { print $ value ; } else { print $ this -> parseStringAsTemplate ( $ data ) ; } } } }
Prints the items in a layout .
47,571
private function setStreamClient ( ) { $ language = $ this -> language ?? '' ; $ keywords = $ this -> keywords ?? [ ] ; $ users = $ this -> users ?? [ ] ; if ( empty ( $ keywords ) && empty ( $ users ) ) { throw new EmptyRequiredParamsException ( 'The keywords to listen or the Users to track it mustn\'t be empty.' ) ; } $ this -> streamClient -> post ( self :: FILTER_METHOD , [ 'form_params' => [ 'language' => $ language , 'track' => implode ( ',' , $ keywords ) , 'follow' => implode ( ',' , $ users ) , ] , ] ) ; }
Set the stream connection plus set all filter params
47,572
public function post ( string $ endpoint , array $ options ) { $ this -> streamBody = $ this -> client -> post ( $ endpoint , $ options ) -> getBody ( ) ; }
API Post request
47,573
public function read ( ) : array { while ( ! $ this -> streamBody -> eof ( ) ) { $ tweet = json_decode ( $ this -> readStreamLine ( $ this -> streamBody ) , true ) ; if ( null !== $ tweet ) { return $ tweet ; } } }
Start reading the stream
47,574
public function getLabel ( ) { if ( $ this -> model -> label != "" ) { return $ this -> model -> label ; } return StringTools :: wordifyStringByUpperCase ( $ this -> getName ( ) ) ; }
Returns a label that the hosting view can use in the HTML output .
47,575
final protected function setIndex ( $ index ) { $ this -> model -> leafIndex = $ index ; $ this -> model -> updatePath ( ) ; $ this -> leafPathChanged ( ) ; }
Sets a view index for subsequent renders .
47,576
final public function leafPathChanged ( ) { foreach ( $ this -> leaves as $ leaf ) { $ leaf -> setName ( $ leaf -> getName ( ) , $ this -> model -> leafPath ) ; } }
Called by the view s leaf class when it s leaf path is changed .
47,577
final protected function getLayoutProvider ( ) { $ layout = LayoutProvider :: getProvider ( ) ; $ layout -> generateValueEvent -> attachHandler ( function ( $ elementName ) { if ( isset ( $ this -> leaves [ $ elementName ] ) ) { return $ this -> leaves [ $ elementName ] ; } return null ; } ) ; return $ layout ; }
Gets the default layout provider and binds to the generateValueEvent event
47,578
public function restoreFromState ( $ stateData ) { $ publicProperties = $ this -> getExposableModelProperties ( ) ; foreach ( $ publicProperties as $ key ) { if ( isset ( $ stateData [ $ key ] ) ) { $ this -> $ key = $ stateData [ $ key ] ; } } }
Restores the model from the passed state data .
47,579
public function toArray ( ) : array { return [ 'id' => $ this -> id , 'text' => $ this -> text , 'lang' => $ this -> lang , 'created_at' => $ this -> createdAt , 'geo' => $ this -> geo , 'coordinates' => $ this -> coordinates , 'places' => $ this -> places , 'retweet_count' => $ this -> retweetCount , 'favorite_count' => $ this -> favoriteCount , 'entities' => $ this -> entities , 'extended_entities' => $ this -> extendedEntities , 'user' => $ this -> user ] ; }
Return Tweet object to Array
47,580
final public function setName ( $ name , $ parentPath = "" ) { $ this -> model -> leafName = $ name ; if ( $ parentPath != "" ) { $ this -> model -> parentPath = $ parentPath ; $ this -> model -> isRootLeaf = false ; } else { $ this -> model -> parentPath = "" ; } $ this -> model -> updatePath ( ) ; if ( $ this -> view ) { $ this -> view -> leafPathChanged ( ) ; } }
Sets the name of the leaf .
47,581
final public function setWebRequest ( WebRequest $ request ) { if ( self :: $ csrfValidation && $ request -> server ( 'REQUEST_METHOD' ) == 'POST' ) { CsrfProtection :: singleton ( ) -> validateHeaders ( $ request ) ; CsrfProtection :: singleton ( ) -> validateCookie ( $ request ) ; } $ this -> request = $ request ; $ this -> parseRequest ( $ request ) ; $ this -> view -> setWebRequest ( $ request ) ; $ this -> model -> onAfterRequestSet ( ) ; $ this -> onStateRestored ( ) ; }
Sets the web request being used to render the tree of leaves .
47,582
protected function parseRequest ( WebRequest $ request ) { if ( $ this -> model -> isRootLeaf ) { $ eventState = $ request -> post ( "_leafEventState" ) ; if ( $ eventState !== null ) { $ eventState = json_decode ( $ eventState , true ) ; if ( $ eventState ) { $ this -> model -> restoreFromState ( $ eventState ) ; } } } $ targetWithoutIndexes = preg_replace ( '/\([^)]+\)/' , "" , $ request -> post ( "_leafEventTarget" ) ) ; if ( $ targetWithoutIndexes == $ this -> model -> leafPath ) { $ requestTargetParts = explode ( "_" , $ request -> post ( "_leafEventTarget" ) ) ; $ pathParts = explode ( "_" , $ this -> model -> leafPath ) ; if ( preg_match ( '/\(([^)]+)\)/' , $ requestTargetParts [ count ( $ pathParts ) - 1 ] , $ match ) ) { $ this -> model -> leafIndex = $ match [ 1 ] ; $ this -> model -> updatePath ( ) ; } $ eventName = $ request -> post ( "_leafEventName" ) ; $ eventTarget = $ request -> post ( "_leafEventTarget" ) ; $ eventArguments = [ ] ; if ( $ request -> post ( "_leafEventArguments" ) ) { $ args = $ request -> post ( "_leafEventArguments" ) ; foreach ( $ args as $ argument ) { $ eventArguments [ ] = json_decode ( $ argument , $ this -> objectsToAssocArrays ) ; } } if ( $ request -> post ( "_leafEventArgumentsJson" ) ) { $ jsonArguments = json_decode ( $ request -> post ( "_leafEventArgumentsJson" ) , true ) ; if ( count ( $ jsonArguments ) ) { array_push ( $ eventArguments , ... $ jsonArguments ) ; } } $ eventArguments [ ] = function ( $ response ) use ( $ eventName , $ eventTarget ) { if ( $ response === null ) { return ; } $ type = "" ; if ( is_object ( $ response ) || is_array ( $ response ) ) { $ response = json_encode ( $ response ) ; $ type = ' type="json"' ; } print '<eventresponse event="' . $ eventName . '" sender="' . $ eventTarget . '"' . $ type . '><![CDATA[' . $ response . ']]></eventresponse>' ; } ; $ this -> runBeforeRender ( function ( ) use ( $ eventName , $ eventArguments ) { $ eventProperty = $ eventName . "Event" ; if ( property_exists ( $ this -> model , $ eventProperty ) ) { $ event = $ this -> model -> $ eventProperty ; return $ event -> raise ( ... $ eventArguments ) ; } return null ; } ) ; } }
Parses the request looking for client side events .
47,583
final public function generateResponse ( $ request = null ) { while ( true ) { $ this -> setWebRequest ( $ request ) ; try { if ( $ request -> header ( "Accept" ) == "application/leaf" ) { $ response = new XmlResponse ( $ this ) ; $ response -> setContent ( $ this -> renderXhr ( ) ) ; } else { $ response = new HtmlResponse ( $ this ) ; $ response -> setContent ( $ this -> render ( ) ) ; } return $ response ; } catch ( RequiresViewReconfigurationException $ er ) { $ this -> initialiseView ( ) ; } } return null ; }
Renders the Leaf and returns an HtmlResponse to Rhubarb
47,584
public function runBeforeRenderCallbacks ( ) { $ this -> runningEventsBeforeRender = true ; foreach ( $ this -> runBeforeRenderCallbacks as $ callback ) { $ callback ( ) ; } $ this -> runBeforeRenderCallbacks = [ ] ; $ this -> view -> runBeforeRenderCallbacks ( ) ; $ this -> runningEventsBeforeRender = false ; }
Run the before render callbacks .
47,585
public function serialized ( ) : string { return serialize ( new self ( $ this -> id , $ this -> text , $ this -> lang , $ this -> createdAt , $ this -> timestampMs , $ this -> geo , $ this -> coordinates , $ this -> places , $ this -> retweetCount , $ this -> favoriteCount , $ this -> entities , $ this -> extendedEntities , $ this -> user , $ this -> retweetedStatus ) ) ; }
Return serialized Tweet object
47,586
public static function enable ( ) { Builder :: macro ( self :: MACRO_METHOD , function ( Builder $ builder ) { return new static ( $ builder -> getClassMetadata ( ) ) ; } ) ; UploadableFile :: enable ( ) ; }
Enable the Uploadable extension .
47,587
public function allow ( $ type ) { if ( ! is_array ( $ type ) ) { $ type = func_get_args ( ) ; } $ this -> allowedTypes = implode ( ',' , $ type ) ; return $ this ; }
Allow only specific types .
47,588
public function disallow ( $ type ) { if ( ! is_array ( $ type ) ) { $ type = func_get_args ( ) ; } $ this -> disallowedTypes = implode ( ',' , $ type ) ; return $ this ; }
Disallow specific types .
47,589
private function getConfiguration ( ) { return array_merge ( [ 'fileMimeTypeField' => false , 'fileNameField' => false , 'filePathField' => false , 'fileSizeField' => false , ] , $ this -> classMetadata -> getExtension ( UploadableDriver :: EXTENSION_NAME ) , [ 'uploadable' => true , 'allowOverwrite' => $ this -> allowOverwrite , 'appendNumber' => $ this -> appendNumber , 'path' => $ this -> path , 'pathMethod' => $ this -> pathMethod , 'callback' => $ this -> callback , 'filenameGenerator' => $ this -> filenameGenerator , 'maxSize' => ( float ) $ this -> maxSize , 'allowedTypes' => $ this -> allowedTypes , 'disallowedTypes' => $ this -> disallowedTypes , ] ) ; }
Build the configuration based on defaults current extension configuration and accumulated parameters .
47,590
public static function enable ( ) { Field :: macro ( self :: MACRO_METHOD , function ( Field $ field ) { return new static ( $ field -> getClassMetadata ( ) , $ field -> getName ( ) ) ; } ) ; }
Enable TreePathSource .
47,591
public function column ( $ column , $ type = 'string' , $ length = 255 ) { $ this -> builder -> setDiscriminatorColumn ( $ column , $ type , $ length ) ; return $ this ; }
Add the discriminator column .
47,592
protected function alreadyConfigured ( $ key ) { $ config = $ this -> getClassMetadata ( ) -> getExtension ( $ this -> getExtensionName ( ) ) ; return isset ( $ config [ $ key ] ) ; }
Check if a given key is already configured for this extension .
47,593
public function build ( ) { foreach ( $ this -> getJoinColumns ( ) as $ column ) { $ this -> getAssociation ( ) -> addJoinColumn ( $ column -> getJoinColumn ( ) , $ column -> getReferenceColumn ( ) , $ column -> isNullable ( ) , $ column -> isUnique ( ) , $ column -> getOnDelete ( ) , $ column -> getColumnDefinition ( ) ) ; } parent :: build ( ) ; }
Build the association .
47,594
public static function registerAll ( MappingDriverChain $ driverChain ) { self :: register ( $ driverChain , array_merge ( self :: $ abstract , self :: $ concrete ) ) ; }
Register all Gedmo classes on Fluent .
47,595
protected static function register ( MappingDriverChain $ driverChain , array $ mappings ) { $ driverChain -> addDriver ( new FluentDriver ( $ mappings ) , 'Gedmo' ) ; foreach ( self :: $ extensions as $ extension ) { $ extension :: enable ( ) ; } }
Register a new FluentDriver for the Gedmo namespace on the given chain . Adds all extensions as macros .
47,596
protected function queueMacro ( $ method , $ args ) { $ result = $ this -> callMacro ( $ method , $ args ) ; if ( $ result instanceof Buildable ) { $ this -> queue ( $ result ) ; } return $ result ; }
Intercept the Macro call and queue the result if it s a Buildable object .
47,597
public static function enable ( ) { foreach ( self :: $ validTypes as $ type ) { Field :: macro ( "asFile$type" , function ( Field $ builder ) use ( $ type ) { return new static ( $ builder -> getClassMetadata ( ) , $ builder -> getName ( ) , $ type ) ; } ) ; } }
Enable the UploadableFile extension .
47,598
private function validateType ( $ type ) { if ( ! in_array ( $ type , self :: $ validTypes ) ) { throw new InvalidMappingException ( 'Invalid uploadable field type reference. Must be one of: ' . implode ( ', ' , self :: $ validTypes ) ) ; } }
Validate the given type of file field .
47,599
protected function makeConfiguration ( ) { if ( $ this -> on == 'create' || $ this -> on == 'update' ) { return $ this -> fieldName ; } return [ 'field' => $ this -> fieldName , 'trackedField' => $ this -> trackedFields , 'value' => $ this -> value , ] ; }
Returns either the field name on create and update or the array configuration on change .