idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
800
public function destroy ( UserRemoverListener $ listener , $ id ) { $ user = Foundation :: make ( 'orchestra.user' ) -> findOrFail ( $ id ) ; if ( ( string ) $ user -> id === ( string ) Auth :: user ( ) -> id ) { return $ listener -> selfDeletionFailed ( ) ; } try { $ this -> fireEvent ( 'deleting' , [ $ user ] ) ; $ u...
Destroy a user .
801
protected function saving ( Eloquent $ user , $ input = [ ] , $ type = 'create' ) { $ beforeEvent = ( $ type === 'create' ? 'creating' : 'updating' ) ; $ afterEvent = ( $ type === 'create' ? 'created' : 'updated' ) ; $ user -> fullname = $ input [ 'fullname' ] ; $ user -> email = $ input [ 'email' ] ; $ this -> fireEve...
Save the user .
802
public function saveNodeValue ( NodePath $ nodePath , string $ property , $ value ) { try { $ this -> data = $ this -> storeValue ( $ nodePath , $ this -> data , $ property , $ value ) ; } catch ( InconsistentValueException $ e ) { if ( $ property == 'nodeType' ) { $ node = $ this -> getNode ( $ nodePath ) ; $ this -> ...
Save a single property value for a given node .
803
private function storeValue ( NodePath $ nodePath , array $ data , string $ property , $ value ) : array { $ nodePath = $ nodePath -> popFirst ( $ nodeName ) ; $ nodeName = $ this -> encodeNodeName ( $ nodeName ) ; if ( ! isset ( $ data [ $ nodeName ] ) ) { $ data [ $ nodeName ] = [ ] ; } if ( $ nodePath -> isEmpty ( )...
Store a particular value of a particular property for a given node .
804
private function handleUpgrade ( array $ node , NodePath $ nodePath , string $ newType ) { if ( ( ( $ node [ 'nodeType' ] == 'array' ) || ( $ newType == 'array' ) ) && $ this -> autoUpgradeToArray ) { $ this -> checkArrayUpgrade ( $ node , $ nodePath , $ newType ) ; if ( ! empty ( $ node [ self :: ARRAY_NAME ] ) ) { fo...
Upgrade a node to array
805
public function getData ( ) { foreach ( $ this -> data as $ value ) { $ this -> validateDefinitions ( $ value ) ; } return [ 'data' => $ this -> data , 'parent_aliases' => $ this -> parentAliases ] ; }
Return complete structure .
806
public function getNode ( NodePath $ nodePath , array $ data = null ) { if ( empty ( $ data ) ) { $ data = $ this -> data ; } $ nodePath = $ nodePath -> popFirst ( $ nodeName ) ; $ nodeName = $ this -> encodeNodeName ( $ nodeName ) ; if ( ! isset ( $ data [ $ nodeName ] ) ) { return null ; } if ( $ nodePath -> isEmpty ...
Get structure of a particular node .
807
public function getNodeProperty ( NodePath $ nodePath , string $ property ) { $ data = $ this -> getNode ( $ nodePath ) ; if ( isset ( $ data [ $ property ] ) ) { return $ data [ $ property ] ; } else { return null ; } }
Return a particular property of the node .
808
private function getNodeChildrenProperties ( NodePath $ nodePath , string $ property ) : array { $ nodeData = $ this -> getNode ( $ nodePath ) ; $ result = [ ] ; if ( ! empty ( $ nodeData ) ) { if ( $ nodeData [ 'nodeType' ] == 'object' ) { foreach ( $ nodeData as $ itemName => $ value ) { if ( is_array ( $ value ) ) {...
Return a particular property of a the children of the node .
809
public function getColumnTypes ( NodePath $ nodePath ) { $ values = $ this -> getNodeChildrenProperties ( $ nodePath , 'nodeType' ) ; $ result = [ ] ; foreach ( $ values as $ key => $ value ) { if ( $ key === self :: ARRAY_NAME ) { $ result [ self :: DATA_COLUMN ] = $ value ; } else { $ result [ $ key ] = $ value ; } }...
Get columns from a node and return their data types .
810
public function generateHeaderNames ( ) { foreach ( $ this -> data as $ baseType => & $ baseArray ) { foreach ( $ baseArray as $ nodeName => & $ nodeData ) { if ( is_array ( $ nodeData ) ) { $ nodeName = $ this -> decodeNodeName ( $ nodeName ) ; $ this -> generateHeaderName ( $ nodeData , new NodePath ( [ $ baseType , ...
Generate header names for the whole structure .
811
public function getParentTargetName ( string $ name ) { if ( empty ( $ this -> parentAliases [ $ name ] ) ) { return $ name ; } return $ this -> parentAliases [ $ name ] ; }
Get new name of a parent column
812
private function getSafeName ( string $ name ) : string { $ name = preg_replace ( '/[^A-Za-z0-9-]/' , '_' , $ name ) ; if ( strlen ( $ name ) > 64 ) { if ( str_word_count ( $ name ) > 1 && preg_match_all ( '/\b(\w)/' , $ name , $ m ) ) { $ short = implode ( '' , $ m [ 1 ] ) ; } else { $ short = md5 ( $ name ) ; } $ sho...
If necessary change the name to a safe to store in database .
813
private function getUniqueName ( string $ baseType , string $ headerName ) : string { if ( isset ( $ this -> headerIndex [ $ baseType ] [ $ headerName ] ) ) { $ newName = $ headerName ; $ i = 0 ; while ( isset ( $ this -> headerIndex [ $ baseType ] [ $ newName ] ) ) { $ newName = $ headerName . '_u' . $ i ; $ i ++ ; } ...
If necessary change the name to a unique one .
814
private function generateHeaderName ( array & $ data , NodePath $ nodePath , string $ parentName , string $ baseType ) { if ( empty ( $ data [ 'headerNames' ] ) ) { if ( $ parentName != self :: ARRAY_NAME ) { $ headerName = $ this -> getSafeName ( $ parentName ) ; $ headerName = $ this -> getUniqueName ( $ baseType , $...
Generate header name for a node and sub - nodes .
815
public function load ( array $ definitions ) { $ this -> data = $ definitions [ 'data' ] ?? [ ] ; $ this -> parentAliases = $ definitions [ 'parent_aliases' ] ?? [ ] ; foreach ( $ this -> data as $ value ) { $ this -> validateDefinitions ( $ value ) ; } }
Load structure data .
816
public function configure ( $ model , $ name ) { return $ this -> form -> of ( "orchestra.extension: {$name}" , function ( FormGrid $ form ) use ( $ model , $ name ) { $ form -> setup ( $ this , "orchestra::extensions/{$name}/configure" , $ model ) ; $ handles = data_get ( $ model , 'handles' , $ this -> extension -> o...
Form View Generator for Orchestra \ Extension .
817
protected function refreshApplication ( Foundation $ foundation , Memory $ memory ) : void { if ( ! $ foundation -> installed ( ) ) { $ this -> error ( 'Abort as application is not installed!' ) ; return ; } $ this -> call ( 'extension:detect' , [ '--quiet' => true ] ) ; try { Collection :: make ( $ memory -> get ( 'ex...
Refresh application for Orchestra Platform .
818
protected function optimizeApplication ( ) : void { $ this -> info ( 'Optimizing application for Orchestra Platform' ) ; $ this -> call ( 'config:clear' ) ; $ this -> call ( 'route:clear' ) ; if ( $ this -> laravel -> environment ( 'production' ) && ! $ this -> option ( 'no-cache' ) ) { $ this -> call ( 'config:cache' ...
Optimize application for Orchestra Platform .
819
protected function updateRequest ( ) { $ headers = [ ] ; foreach ( $ this -> all ( ) as $ key => $ values ) { foreach ( $ values as $ value ) { $ headers [ ] = $ key . ': ' . $ value ; } } $ this -> request -> setOption ( CURLOPT_HTTPHEADER , $ headers ) ; }
Updates the headers in the associated request .
820
protected function changePermission ( string $ path , $ mode = 0755 , bool $ recursively = false ) : void { $ filesystem = $ this -> getContainer ( ) [ 'files' ] ; $ filesystem -> chmod ( $ path , $ mode ) ; if ( $ recursively === false ) { return ; } $ lists = $ filesystem -> allFiles ( $ path ) ; $ ignoredPath = func...
Change CHMOD permission .
821
protected function prepareDirectory ( string $ path , $ mode = 0755 ) : void { $ filesystem = $ this -> getContainer ( ) [ 'files' ] ; if ( ! $ filesystem -> isDirectory ( $ path ) ) { $ filesystem -> makeDirectory ( $ path , $ mode , true ) ; } }
Prepare destination directory .
822
protected function basePath ( string $ path ) : string { if ( \ preg_match ( '/^\/(home)\/([a-zA-Z0-9]+)\/(.*)$/' , $ path , $ matches ) ) { $ path = '/' . \ ltrim ( $ matches [ 3 ] , '/' ) ; } return $ path ; }
Get base path for FTP .
823
protected function destination ( string $ name , bool $ recursively = false ) : Fluent { $ filesystem = $ this -> getContainer ( ) [ 'files' ] ; $ publicPath = $ this -> basePath ( $ this -> getContainer ( ) [ 'path.public' ] ) ; $ publicPath = \ rtrim ( $ publicPath , '/' ) . '/' ; $ workingPath = $ basePath = "{$publ...
Check upload path .
824
public static function rowcol ( $ row = 1 , $ col = 1 ) { $ row = intval ( $ row ) ; $ col = intval ( $ col ) ; if ( $ row < 0 ) { $ row = Misc :: rows ( ) + $ row + 1 ; } if ( $ col < 0 ) { $ col = Misc :: cols ( ) + $ col + 1 ; } fwrite ( self :: $ stream , "\033[{$row};{$col}f" ) ; }
Move the cursor to a specific row and column
825
protected function registerPublisher ( ) : void { $ this -> app -> singleton ( 'orchestra.publisher' , function ( Application $ app ) { $ memory = $ app -> make ( 'orchestra.platform.memory' ) ; return ( new PublisherManager ( $ app ) ) -> attach ( $ memory ) ; } ) ; }
Register the service provider for publisher .
826
public function update ( Listener $ listener , array $ input ) { $ user = Auth :: user ( ) ; if ( ! $ this -> validateCurrentUser ( $ user , $ input ) ) { return $ listener -> abortWhenUserMismatched ( ) ; } $ validation = $ this -> validator -> on ( 'update' ) -> with ( $ input ) ; if ( $ validation -> fails ( ) ) { r...
Update profile information .
827
protected function saving ( $ user , array $ input ) { $ user -> setAttribute ( 'email' , $ input [ 'email' ] ) ; $ user -> setAttribute ( 'fullname' , $ input [ 'fullname' ] ) ; $ this -> fireEvent ( 'updating' , [ $ user ] ) ; $ this -> fireEvent ( 'saving' , [ $ user ] ) ; $ user -> saveOrFail ( ) ; $ this -> fireEv...
Save user profile .
828
protected function addRequiredForSecretField ( ValidatorResolver $ resolver , $ field , $ hidden ) { $ resolver -> sometimes ( $ field , 'required' , function ( $ input ) use ( $ hidden ) { return $ input -> $ hidden == 'yes' ; } ) ; }
Add required for secret or password field .
829
public function show ( Listener $ listener ) { $ panes = $ this -> widget -> make ( 'pane.orchestra' ) ; return $ listener -> showDashboard ( [ 'panes' => $ panes ] ) ; }
View dashboard .
830
public function add ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ innerKey => $ innerValue ) { Arr :: set ( $ this -> variables , $ innerKey , $ innerValue ) ; } } elseif ( $ key instanceof Closure ) { $ this -> variables [ ] = $ key ; } else { Arr :: set ( $ this -> variables , $ key , ...
Add a variable .
831
public function render ( $ namespace = 'config' ) { foreach ( $ this -> variables as $ key => $ variable ) { if ( $ variable instanceof Closure ) { $ variable = $ variable ( ) ; if ( is_array ( $ variable ) ) { $ this -> add ( $ variable ) ; } } } $ variables = array_filter ( $ this -> variables , function ( $ variable...
Render as a HTML string .
832
public static function string ( $ str , $ row = null , $ col = null ) { if ( $ col !== null || $ row !== null ) { Cursor :: rowcol ( $ row , $ col ) ; } fwrite ( self :: $ stream , $ str ) ; }
Output a string
833
public static function line ( $ str , $ col = null , $ erase = true ) { if ( $ col !== null ) { Cursor :: rowcol ( $ col , 1 ) ; } if ( $ erase ) { Erase :: line ( ) ; } fwrite ( self :: $ stream , $ str ) ; }
Output a line erasing the line first
834
public function exist ( $ id ) { $ entity = $ this -> entityQuery -> get ( 'site_commerce_type' ) -> condition ( 'id' , $ id ) -> execute ( ) ; return ( bool ) $ entity ; }
Helper function to check whether an SiteCommerceType configuration entity exists .
835
public function begin ( ) { $ this -> current = $ this -> current instanceof Transaction ? $ this -> current -> newTransaction ( ) : new Transaction ; }
Should be called after transaction started .
836
public function commit ( ) { $ this -> assert ( ) ; $ current = $ this -> current ; $ this -> current = $ current -> getParentKeepingChildren ( ) ; if ( ! $ this -> current instanceof Transaction ) { foreach ( $ current -> flatten ( ) as $ payload ) { $ payload -> fire ( ) ; } } }
Should be called after transaction committed .
837
protected function dispatch ( DelayedEvent $ event ) { if ( $ this -> current instanceof Transaction ) { $ this -> current -> attach ( $ event ) ; } else { $ event -> fire ( ) ; } }
Dispaches payload .
838
protected function getPatternFilters ( $ route ) { $ patterns = [ ] ; foreach ( $ route -> methods ( ) as $ method ) { $ inner = $ this -> getMethodPatterns ( $ route -> uri ( ) , $ method ) ; $ patterns = array_merge ( $ patterns , array_keys ( $ inner ) ) ; } return $ patterns ; }
Get all of the pattern filters matching the route .
839
protected function getMethodPatterns ( $ uri , $ method ) { return $ this -> router -> findPatternFilters ( Request :: create ( $ uri , $ method ) ) ; }
Get the pattern filters for a given URI and method .
840
public function queue ( $ queue ) : bool { $ queue = \ array_unique ( \ array_merge ( $ this -> queued ( ) , ( array ) $ queue ) ) ; $ this -> memory -> put ( 'orchestra.publisher.queue' , $ queue ) ; return true ; }
Add a process to be queue .
841
public function widget ( string $ type ) { return ! \ is_null ( $ this -> widget ) ? $ this -> widget -> make ( "{$type}.orchestra" ) : null ; }
Get widget services by type .
842
protected function createAdminMenu ( ) : void { $ menu = $ this -> menu ( ) ; $ events = $ this -> app -> make ( 'events' ) ; $ handlers = [ UserMenuHandler :: class , ExtensionMenuHandler :: class , SettingMenuHandler :: class , ] ; $ menu -> add ( 'home' ) -> title ( \ trans ( 'orchestra/foundation::title.home' ) ) -...
Create Administration Menu for Orchestra Platform .
843
protected function registerComponents ( MemoryProvider $ memory ) : void { $ this -> app -> make ( 'orchestra.notifier' ) -> setDefaultDriver ( 'orchestra' ) ; $ this -> app -> make ( 'orchestra.mail' ) -> attach ( $ memory ) ; }
Register base application components .
844
public static function forge ( RequestInterface $ request ) { $ headerSize = $ request -> getInfo ( CURLINFO_HEADER_SIZE ) ; $ response = $ request -> getRawResponse ( ) ; $ content = ( strlen ( $ response ) === $ headerSize ) ? '' : substr ( $ response , $ headerSize ) ; $ rawHeaders = rtrim ( substr ( $ response , 0 ...
Forge a new object based on a request .
845
public function cartBlock ( $ pid ) { $ site_commerce = $ this -> entityTypeManager -> getStorage ( 'site_commerce' ) -> load ( $ pid ) ; $ position_in_cart = FALSE ; $ databaseSendOrder = \ Drupal :: service ( 'site_orders.database' ) ; if ( $ databaseSendOrder -> hasPositionInCart ( $ site_commerce -> getEntityTypeId...
Callback lazy builder for to cart block .
846
public function parametrsBlock ( $ id ) { $ databaseSendOrder = \ Drupal :: service ( 'site_orders.database' ) ; $ site_commerce = \ Drupal :: entityTypeManager ( ) -> getStorage ( 'site_commerce' ) -> load ( $ id ) ; $ items = $ site_commerce -> get ( 'field_parametrs' ) -> getValue ( ) ; $ values = [ ] ; foreach ( $ ...
Callback lazy builder for parametrs block .
847
public static function cols ( $ cache = true ) { static $ cols = false ; if ( ! $ cols || ! $ cache ) { $ cols = intval ( `tput cols`); } return $cols ? : 80; } /** * The row size of the current terminal as returned by tput * * @staticvar bool|int $rows the cached value for the number of columns * @param bool $ca...
The col size of the current terminal as returned by tput
848
public function createProfileFailed ( array $ errors ) { messages ( 'error' , trans ( 'orchestra/foundation::response.db-failed' , $ errors ) ) ; return $ this -> redirect ( $ this -> getRedirectToRegisterPath ( ) ) -> withInput ( ) ; }
Response when create a user failed .
849
public function showResetForm ( $ token = null ) { if ( is_null ( $ token ) ) { return $ this -> showLinkRequestForm ( ) ; } $ email = Request :: input ( 'email' ) ; set_meta ( 'title' , trans ( 'orchestra/foundation::title.reset-password' ) ) ; return view ( 'orchestra/foundation::forgot.reset' , compact ( 'email' , '...
Once user actually visit the reset my password page we now should be able to make the operation to create a new password .
850
public function reset ( Processor $ processor ) { $ input = Request :: only ( 'email' , 'password' , 'password_confirmation' , 'token' ) ; return $ processor -> update ( $ this , $ input ) ; }
Create a new password for the user .
851
public function passwordResetHasFailed ( $ response ) { $ message = trans ( $ response ) ; $ token = Request :: input ( 'token' ) ; return $ this -> redirectWithMessage ( handles ( "orchestra::forgot/reset/{$token}" ) , $ message , 'error' ) ; }
Response when reset password failed .
852
public function toCleanString ( ) : string { $ path = array_filter ( $ this -> path , function ( $ val ) { return $ val != Structure :: ARRAY_NAME ; } ) ; return implode ( '.' , $ path ) ; }
Convert path to user - display string .
853
public function addChild ( string $ key ) : NodePath { $ path = $ this -> path ; $ path [ ] = $ key ; return new NodePath ( $ path ) ; }
Return new path with an added child .
854
public function popFirst ( & $ first ) : NodePath { $ path = $ this -> path ; $ first = array_shift ( $ path ) ; return new NodePath ( $ path ) ; }
Remove the first item from path and return new path
855
private function getValue ( $ input , $ alternative ) { if ( empty ( $ input ) ) { $ input = Config :: get ( $ alternative ) ; } return $ input ; }
Resolve value or grab from configuration .
856
public function migrationHasSucceed ( Fluent $ extension ) { $ message = trans ( 'orchestra/foundation::response.extensions.migrate' , $ extension -> getAttributes ( ) ) ; return $ this -> redirectWithMessage ( handles ( 'orchestra::extensions' ) , $ message ) ; }
Response when extension migration has succeed .
857
protected function redirectUserTo ( string $ namespace , string $ path , ? string $ redirect = null ) : string { return \ handles ( $ this -> redirectUserPath ( $ namespace , $ path , $ redirect ) ) ; }
Get redirection handles .
858
protected function redirectUserPath ( string $ namespace , string $ path , ? string $ redirect = null ) : string { if ( ! empty ( $ redirect ) ) { $ path = $ redirect ; } $ property = \ sprintf ( 'redirect%sPath' , Str :: ucfirst ( $ namespace ) ) ; return \ property_exists ( $ this , $ property ) ? $ this -> { $ prope...
Get redirection path .
859
public static function toSerialize ( $ resource ) { if ( ! self :: isArray ( $ resource ) ) { $ resource = self :: toArray ( $ resource ) ; } return serialize ( $ resource ) ; }
Transforms a resource into a serialized form .
860
public static function utf8Encode ( $ data ) { if ( is_string ( $ data ) ) { return utf8_encode ( $ data ) ; } else if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ data [ utf8_encode ( $ key ) ] = self :: utf8Encode ( $ value ) ; } } else if ( is_object ( $ data ) ) { foreach ( $ data as $ key =...
Encode a resource object for UTF - 8 .
861
public static function utf8Decode ( $ data ) { if ( is_string ( $ data ) ) { return utf8_decode ( $ data ) ; } else if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ data [ utf8_decode ( $ key ) ] = self :: utf8Decode ( $ value ) ; } } else if ( is_object ( $ data ) ) { foreach ( $ data as $ key =...
Decode a resource object for UTF - 8 .
862
public function form ( $ model ) { return $ this -> form -> of ( 'orchestra.settings' , function ( FormGrid $ form ) use ( $ model ) { $ form -> setup ( $ this , 'orchestra::settings' , $ model ) ; $ this -> application ( $ form ) ; $ this -> mailer ( $ form , $ model ) ; } ) ; }
Form View Generator for Setting Page .
863
protected function indexStep ( $ step ) { $ text = '<h1>' . $ step -> title . '</h1> ' ; $ text .= $ step -> description . ' ' ; $ text = trim ( $ text ) ; $ language = \ Drupal :: languageManager ( ) -> getCurrentLanguage ( ) ; $ transliteration = \ Drupal :: service ( 'transliteration' ) ; $ text_transliterate .= $ t...
Indexes a single step .
864
public function table ( $ model ) { return $ this -> table -> of ( 'orchestra.users' , function ( TableGrid $ table ) use ( $ model ) { $ table -> with ( $ model ) ; $ table -> sortable ( $ this -> getSortableFields ( ) ) ; $ table -> layout ( 'orchestra/foundation::components.table' ) ; $ this -> prependTableColumns (...
Table View Generator for Orchestra \ Model \ User .
865
public function form ( $ model ) { return $ this -> form -> of ( 'orchestra.users' , function ( FormGrid $ form ) use ( $ model ) { $ form -> resource ( $ this , 'orchestra/foundation::users' , $ model ) ; $ form -> hidden ( 'id' ) ; $ form -> fieldset ( function ( Fieldset $ fieldset ) { $ fieldset -> control ( 'input...
Form View Generator for Orchestra \ Model \ User .
866
protected function getFullnameColumn ( ) { return function ( $ row ) { $ roles = $ row -> roles ; $ value = [ ] ; foreach ( $ roles as $ role ) { $ value [ ] = app ( 'html' ) -> create ( 'span' , e ( $ role -> name ) , [ 'class' => 'label label-info' , 'role' => 'role' , ] ) ; } return implode ( '' , [ app ( 'html' ) -...
Get fullname column for table builder .
867
protected function getEntityIds ( ) { $ query = $ this -> getStorage ( ) -> getQuery ( ) -> sort ( $ this -> entityType -> getKey ( 'id' ) , 'DESC' ) ; $ this -> limit = 1000 ; if ( $ this -> limit ) { $ query -> pager ( $ this -> limit ) ; } return $ query -> execute ( ) ; }
Loads entity IDs using a pager sorted by the entity id .
868
protected function getDefaultOperations ( EntityInterface $ entity ) { $ operations = [ ] ; if ( $ entity -> access ( 'update' ) && $ entity -> hasLinkTemplate ( 'edit-form' ) ) { $ operations [ 'edit' ] = [ 'title' => $ this -> t ( 'Edit' ) , 'weight' => 10 , 'url' => $ entity -> urlInfo ( 'edit-form' ) , ] ; } if ( $...
Gets this list s default operations .
869
public function store ( PasswordResetLink $ listener , array $ input ) { $ validation = $ this -> validator -> with ( $ input ) ; if ( $ validation -> fails ( ) ) { return $ listener -> resetLinkFailedValidation ( $ validation -> getMessageBag ( ) ) ; } $ response = $ this -> password -> sendResetLink ( [ 'email' => $ ...
Request to reset password .
870
protected function queueToPublisher ( Fluent $ extension ) { Publisher :: queue ( $ extension -> get ( 'name' ) ) ; return $ this -> redirect ( handles ( 'orchestra::publisher' ) ) ; }
Queue publishing asset to publisher .
871
private function checkType ( $ oldType , $ newType , NodePath $ nodePath ) : string { if ( ! is_null ( $ oldType ) && ( $ newType !== $ oldType ) && ( $ newType !== 'null' ) && ( $ oldType !== 'null' ) ) { throw new JsonParserException ( "Data in '$nodePath' contains incompatible data types '$oldType' and '$newType'." ...
Check that two types same or compatible .
872
protected function getExtension ( $ vendor , $ package = null ) { $ name = ( is_null ( $ package ) ? $ vendor : implode ( '/' , [ $ vendor , $ package ] ) ) ; return new Fluent ( [ 'name' => $ name , 'uid' => $ name ] ) ; }
Get extension information .
873
public function login ( Listener $ listener , array $ input , ThrottlesCommand $ throttles = null ) { $ validation = $ this -> validator -> on ( 'login' ) -> with ( $ input ) ; if ( $ validation -> fails ( ) ) { return $ listener -> userLoginHasFailedValidation ( $ validation -> getMessageBag ( ) ) ; } if ( $ this -> h...
Login a user .
874
protected function handleUserHasTooManyAttempts ( Listener $ listener , array $ input , ThrottlesCommand $ throttles = null ) { $ throttles -> incrementLoginAttempts ( ) ; $ throttles -> fireLockoutEvent ( ) ; return $ listener -> sendLockoutResponse ( $ input , $ throttles -> getSecondsBeforeNextAttempts ( ) ) ; }
Send the response after the user has too many attempts .
875
protected function handleUserFailedAuthentication ( Listener $ listener , array $ input , ThrottlesCommand $ throttles = null ) { if ( $ throttles ) { $ throttles -> incrementLoginAttempts ( ) ; } return $ listener -> userLoginHasFailedAuthentication ( $ input ) ; }
Send the response after the user failed authentication .
876
protected function verifyWhenFirstTimeLogin ( Eloquent $ user ) { if ( ( int ) $ user -> getAttribute ( 'status' ) === Eloquent :: UNVERIFIED ) { $ user -> activate ( ) -> save ( ) ; } return $ user ; }
Verify user account if has not been verified other this should be ignored in most cases .
877
public function setOption ( $ option , $ value = null ) { if ( is_array ( $ option ) ) { foreach ( $ option as $ opt => $ val ) { $ this -> setOption ( $ opt , $ val ) ; } return ; } if ( array_key_exists ( $ option , $ this -> defaults ) ) { throw new ProtectedOptionException ( sprintf ( 'Unable to set protected optio...
Set an option for the request .
878
protected function attachAccessPolicyEvents ( Application $ app ) { Role :: observe ( $ app -> make ( RoleObserver :: class ) ) ; Role :: setDefaultRoles ( \ config ( 'orchestra/foundation::roles' ) ) ; }
Attach access policy events .
879
public static function delete ( $ urls , $ data = null , callable $ callback = null ) { return static :: make ( 'delete' , $ urls , $ data , $ callback ) ; }
Make one or multiple DELETE requests .
880
public static function get ( $ urls , $ data = null , callable $ callback = null ) { return static :: make ( 'get' , $ urls , $ data , $ callback ) ; }
Make one or multiple GET requests .
881
public static function post ( $ urls , $ data = null , callable $ callback = null ) { return static :: make ( 'post' , $ urls , $ data , $ callback ) ; }
Make one or multiple POST requests .
882
public static function put ( $ urls , $ data = null , callable $ callback = null ) { return static :: make ( 'put' , $ urls , $ data , $ callback ) ; }
Make one or multiple PUT requests .
883
protected static function make ( $ verb , $ urls , $ data , callable $ callback = null ) { if ( ! is_array ( $ urls ) ) { $ urls = [ $ urls => $ data ] ; } elseif ( ! ( bool ) count ( array_filter ( array_keys ( $ urls ) , 'is_string' ) ) ) { foreach ( $ urls as $ key => $ url ) { $ urls [ $ url ] = null ; unset ( $ ur...
Make one or multiple requests .
884
protected function makeRequest ( callable $ callback = null ) { foreach ( $ this -> requests as $ key => $ request ) { $ data = ( isset ( $ this -> data [ $ key ] ) and $ this -> data [ $ key ] !== null ) ? $ this -> data [ $ key ] : null ; $ request -> setOption ( CURLOPT_FOLLOWLOCATION , true ) ; switch ( $ this -> v...
Prepares and sends HTTP requests .
885
protected function preparePostRequest ( RequestInterface $ request , $ data ) { if ( $ data !== null ) { $ request -> setOption ( CURLOPT_POST , true ) ; $ request -> setOption ( CURLOPT_POSTFIELDS , $ data ) ; } else { $ request -> setOption ( CURLOPT_CUSTOMREQUEST , 'POST' ) ; } }
Sets a request s HTTP verb to POST .
886
protected function preparePutRequest ( RequestInterface $ request , $ data ) { $ request -> setOption ( CURLOPT_CUSTOMREQUEST , 'PUT' ) ; if ( $ data !== null ) { $ request -> setOption ( CURLOPT_POSTFIELDS , $ data ) ; } }
Sets a request s HTTP verb to PUT .
887
protected function getUniqueLoginKey ( ) { $ key = $ this -> request -> input ( $ this -> loginKey ) ; $ ip = $ this -> request -> ip ( ) ; return \ mb_strtolower ( $ key ) . $ ip ; }
Get the login key .
888
public function upload ( string $ name ) : bool { $ app = $ this -> getContainer ( ) ; $ config = $ this -> destination ( $ name , $ recursively ) ; try { $ basePath = "{$config->basePath}{$name}/" ; $ this -> changePermission ( $ config -> workingPath , 0777 , $ config -> recursively ) ; $ this -> prepareDirectory ( $...
Upload the file .
889
public function prepare ( ) { $ id = $ this -> getAttribute ( 'id' ) ; $ menus = $ this -> menu [ 'with' ] ?? [ ] ; $ parent = $ this -> getAttribute ( 'position' ) ; $ position = Str :: startsWith ( $ parent , '^:' ) ? $ parent . '.' : '^:' ; foreach ( ( array ) $ menus as $ class ) { $ menu = $ this -> container -> m...
Prepare nested menu .
890
protected function passesAuthorization ( ) : bool { $ passes = false ; if ( \ method_exists ( $ this , 'authorize' ) ) { $ passes = $ this -> container -> call ( [ $ this , 'authorize' ] ) ; } return ( bool ) $ passes ; }
Determine if the request passes the authorization check .
891
protected function buildStacks ( ) { $ stacks = [ ] ; $ stackNo = 0 ; $ currSize = 0 ; foreach ( $ this -> requests as $ request ) { if ( $ currSize === $ this -> stackSize ) { $ currSize = 0 ; $ stackNo ++ ; } $ stacks [ $ stackNo ] [ ] = $ request ; $ currSize ++ ; } return $ stacks ; }
Builds stacks of requests .
892
protected function dispatch ( ) { list ( $ mrc , $ active ) = $ this -> process ( ) ; while ( $ active and $ mrc === CURLM_OK ) { list ( $ mrc , $ active ) = $ this -> process ( ) ; } if ( $ mrc !== CURLM_OK ) { throw new CurlErrorException ( 'cURL read error #' . $ mrc ) ; } }
Dispatches all requests in the stack .
893
protected function process ( ) { if ( curl_multi_select ( $ this -> handle ) === - 1 ) { usleep ( 100 ) ; } do { $ mrc = curl_multi_exec ( $ this -> handle , $ active ) ; } while ( $ mrc === CURLM_CALL_MULTI_PERFORM ) ; return [ $ mrc , $ active ] ; }
Processes all requests .
894
public function addPage ( ) { $ content = array ( ) ; foreach ( \ Drupal :: entityTypeManager ( ) -> getStorage ( 'site_commerce_type' ) -> loadMultiple ( ) as $ type ) { $ content [ $ type -> id ( ) ] = $ type ; } if ( ! count ( $ content ) ) { return $ this -> redirect ( 'entity.site_commerce_type.add_form' ) ; } if ...
Displays add content links for available content types .
895
public function add ( SiteCommerceTypeInterface $ site_commerce_type ) { $ site_commerce = $ this -> entityManager ( ) -> getStorage ( 'site_commerce' ) -> create ( array ( 'type' => $ site_commerce_type -> id ( ) , ) ) ; $ form = $ this -> entityFormBuilder ( ) -> getForm ( $ site_commerce ) ; return $ form ; }
Provides the site_commerce submission form .
896
public function view ( Listener $ listener ) { $ data [ 'extensions' ] = $ this -> extension -> detect ( ) ; return $ listener -> showExtensions ( $ data ) ; }
View all extension page .
897
protected function addBladeExtensions ( Application $ app ) { $ blade = $ app -> make ( 'blade.compiler' ) ; $ blade -> directive ( 'decorator' , function ( $ expression ) { return "<?php echo \app('orchestra.decorator')->render({$expression}); ?>" ; } ) ; $ blade -> directive ( 'placeholder' , function ( $ expression ...
Extends blade compiler .
898
protected function addHtmlExtensions ( Application $ app ) { $ html = $ app -> make ( 'html' ) ; $ html -> macro ( 'title' , function ( $ title = null ) use ( $ html ) { $ builder = new Title ( $ html , \ memorize ( 'site.name' ) , [ 'site' => \ get_meta ( 'html::title.format.site' , '{site.name} (Page {page.number})' ...
Add title macros for html service location .
899
private function parse ( array $ data , NodePath $ nodePath , $ parentId = null ) { $ parentId = $ this -> validateParentId ( $ parentId ) ; $ csvFile = $ this -> createCsvFile ( $ this -> structure -> getTypeFromNodePath ( $ nodePath ) , $ nodePath , $ parentId ) ; $ parentCols = array_fill_keys ( array_keys ( $ paren...
Parse data of known type