idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
37,300
public function loadConf ( $ name ) { $ options = config ( 'laravel-menu.settings' ) ; $ name = strtolower ( $ name ) ; if ( isset ( $ options [ $ name ] ) && is_array ( $ options [ $ name ] ) ) { return array_merge ( $ options [ 'default' ] , $ options [ $ name ] ) ; } return $ options [ 'default' ] ; }
Loads and merges configuration data .
37,301
public function add ( $ title , $ options = '' ) { $ id = isset ( $ options [ 'id' ] ) ? $ options [ 'id' ] : $ this -> id ( ) ; $ item = new Item ( $ this , $ id , $ title , $ options ) ; $ this -> items -> push ( $ item ) ; return $ item ; }
Adds an item to the menu .
37,302
public function group ( $ attributes , $ closure ) { $ this -> updateGroupStack ( $ attributes ) ; call_user_func ( $ closure , $ this ) ; array_pop ( $ this -> groupStack ) ; }
Create a menu group with shared attributes .
37,303
public function dispatch ( $ options ) { if ( isset ( $ options [ 'url' ] ) ) { return $ this -> getUrl ( $ options ) ; } elseif ( isset ( $ options [ 'route' ] ) ) { return $ this -> getRoute ( $ options [ 'route' ] ) ; } elseif ( isset ( $ options [ 'action' ] ) ) { return $ this -> getControllerAction ( $ options [ ...
Get the form action from the options .
37,304
public function filter ( $ callback ) { if ( is_callable ( $ callback ) ) { $ this -> items = $ this -> items -> filter ( $ callback ) ; } return $ this ; }
Filter menu items by user callbacks .
37,305
public function sortBy ( $ sort_by , $ sort_type = 'asc' ) { if ( is_callable ( $ sort_by ) ) { $ rslt = call_user_func ( $ sort_by , $ this -> items -> toArray ( ) ) ; if ( ! is_array ( $ rslt ) ) { $ rslt = array ( $ rslt ) ; } $ this -> items = new Collection ( $ rslt ) ; return $ this ; } $ this -> items = $ this -...
Sorts the menu based on user s callable .
37,306
public function spawn ( $ name , Collection $ collection ) { $ nb = new self ( $ name , $ this -> conf ) ; $ nb -> takeCollection ( $ collection ) ; return $ nb ; }
Creates a new Builder instance with the given name and collection .
37,307
public function subMenu ( ) { $ nb = $ this -> spawn ( 'subMenu' , new Collection ( ) ) ; $ subs = $ this -> active ( ) -> children ( ) ; foreach ( $ subs as $ s ) { $ nb -> add ( $ s -> title , $ s -> url ( ) ) ; } return $ nb ; }
Returns a new builder with the active items children .
37,308
public function siblingMenu ( ) { $ nb = $ this -> spawn ( 'siblingMenu' , new Collection ( ) ) ; $ parent = $ this -> active ( ) -> parent ( ) ; if ( $ parent ) { $ siblings = $ parent -> children ( ) ; } else { $ siblings = $ this -> roots ( ) ; } if ( $ siblings -> count ( ) > 1 ) { foreach ( $ siblings as $ s ) { $...
Returns a new builder with siblings of the active item .
37,309
public function crumbMenu ( ) { $ nb = $ this -> spawn ( 'crumbMenu' , new Collection ( ) ) ; $ item = $ this -> active ( ) ; $ items = [ $ item ] ; while ( $ item -> hasParent ( ) ) { $ item = $ item -> parent ( ) ; array_unshift ( $ items , $ item ) ; } foreach ( $ items as $ item ) { $ nb -> add ( $ item -> title , ...
Returns a new builder with all of the parents of the active item .
37,310
public function render ( $ type = 'ul' , $ parent = null , $ children_attributes = [ ] , $ item_attributes = [ ] , $ item_after_calback = null , $ item_after_calback_params = [ ] ) { $ items = '' ; $ item_tag = in_array ( $ type , array ( 'ul' , 'ol' ) ) ? 'li' : $ type ; foreach ( $ this -> whereParent ( $ parent ) as...
Generate the menu items as list items using a recursive function .
37,311
public function asDiv ( $ attributes = [ ] , $ children_attributes = [ ] , $ item_attributes = [ ] , $ item_after_calback = null , $ item_after_calback_params = [ ] ) { return '<div' . self :: attributes ( $ attributes ) . '>' . $ this -> render ( 'div' , null , $ children_attributes , $ item_attributes , $ item_after_...
Returns the menu as div containers .
37,312
public static function mergeStatic ( $ new = null , array $ old = [ ] ) { parse_str ( preg_replace ( '/\s*([\w-]+)\s*=\s*"([^"]+)"/' , '$1=$2&' , $ new ) , $ attrs ) ; $ attrs [ 'class' ] = self :: formatGroupClass ( $ attrs , $ old ) ; return self :: attributes ( array_merge ( Arr :: except ( $ old , array ( 'class' )...
Merge item s attributes with a static string of attributes .
37,313
public function filterRecursive ( $ attribute , $ value ) { $ collection = new Collection ( ) ; $ this -> items -> each ( function ( $ item ) use ( $ attribute , $ value , & $ collection ) { if ( ! $ this -> hasProperty ( $ attribute ) ) { return false ; } if ( $ item -> $ attribute == $ value ) { $ collection -> push ...
Filter items recursively .
37,314
public function add ( $ title , $ options = '' ) { if ( ! is_array ( $ options ) ) { $ url = $ options ; $ options = array ( ) ; $ options [ 'url' ] = $ url ; } $ options [ 'parent' ] = $ this -> id ; return $ this -> builder -> add ( $ title , $ options ) ; }
Creates a sub Item .
37,315
public function raw ( $ title , array $ options = array ( ) ) { $ options [ 'parent' ] = $ this -> id ; return $ this -> builder -> raw ( $ title , $ options ) ; }
Add a plain text item .
37,316
public function attr ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && is_array ( $ args [ 0 ] ) ) { $ this -> attributes = array_merge ( $ this -> attributes , $ args [ 0 ] ) ; return $ this ; } elseif ( isset ( $ args [ 0 ] ) && isset ( $ args [ 1 ] ) ) { $ this -> attributes [ $ args [ 0 ] ] = $ args...
Add attributes to the item .
37,317
public function url ( ) { if ( ! is_null ( $ this -> link ) ) { if ( $ this -> link -> href ) { return $ this -> link -> href ; } return $ this -> builder -> dispatch ( $ this -> link -> path ) ; } }
Generate URL for link .
37,318
public function checkActivationStatus ( ) { if ( true == $ this -> builder -> conf [ 'restful' ] ) { $ path = ltrim ( parse_url ( $ this -> url ( ) , PHP_URL_PATH ) , '/' ) ; $ rpath = ltrim ( parse_url ( Request :: path ( ) , PHP_URL_PATH ) , '/' ) ; if ( $ this -> builder -> conf [ 'rest_base' ] ) { $ base = ( is_arr...
Decide if the item should be active .
37,319
public function nickname ( $ nickname = null ) { if ( is_null ( $ nickname ) ) { return $ this -> nickname ; } $ this -> nickname = $ nickname ; return $ this ; }
Set nickname for the item manually .
37,320
public function id ( $ id = null ) { if ( is_null ( $ id ) ) { return $ this -> id ; } $ this -> id = $ id ; return $ this ; }
Set id for the item manually .
37,321
public function activate ( Item $ item = null , $ recursion = false ) { $ item = is_null ( $ item ) ? $ this : $ item ; if ( 'item' == $ this -> builder -> conf ( 'active_element' ) ) { $ item -> active ( ) ; } else { $ item -> link -> active ( ) ; } if ( false === $ recursion ) { $ item -> active = true ; } if ( true ...
Activate the item .
37,322
public function active ( $ pattern = null ) { if ( ! is_null ( $ pattern ) ) { $ pattern = ltrim ( preg_replace ( '/\/\*/' , '(/.*)?' , $ pattern ) , '/' ) ; if ( preg_match ( "@^{$pattern}\z@" , Request :: path ( ) ) ) { $ this -> activate ( ) ; } return $ this ; } $ this -> attributes [ 'class' ] = Builder :: formatG...
Make the item active .
37,323
public function data ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && is_array ( $ args [ 0 ] ) ) { $ this -> data = array_merge ( $ this -> data , array_change_key_case ( $ args [ 0 ] ) ) ; if ( $ this -> builder -> conf [ 'cascade_data' ] ) { $ this -> cascade_data ( $ args ) ; } return $ this ; } el...
Set or get items s meta data .
37,324
public function cascade_data ( $ args = array ( ) ) { if ( ! $ this -> hasChildren ( ) ) { return false ; } if ( count ( $ args ) >= 2 ) { $ this -> children ( ) -> data ( $ args [ 0 ] , $ args [ 1 ] ) ; } else { $ this -> children ( ) -> data ( $ args [ 0 ] ) ; } return true ; }
Cascade data to children .
37,325
public function hasProperty ( $ property ) { if ( property_exists ( $ this , $ property ) || ! is_null ( $ this -> data ( $ property ) ) ) { return true ; } return false ; }
Check if propery exists either in the class or the meta collection .
37,326
public function attr ( ) { $ args = func_get_args ( ) ; $ this -> each ( function ( $ item ) use ( $ args ) { if ( count ( $ args ) >= 2 ) { $ item -> attr ( $ args [ 0 ] , $ args [ 1 ] ) ; } else { $ item -> attr ( $ args [ 0 ] ) ; } } ) ; return $ this ; }
Add attributes to a collection of items .
37,327
public function data ( ) { $ args = func_get_args ( ) ; $ this -> each ( function ( $ item ) use ( $ args ) { if ( count ( $ args ) >= 2 ) { $ item -> data ( $ args [ 0 ] , $ args [ 1 ] ) ; } else { $ item -> data ( $ args [ 0 ] ) ; } } ) ; return $ this ; }
Add meta data to a collection of items .
37,328
public function append ( $ html ) { $ this -> each ( function ( $ item ) use ( $ html ) { $ item -> title .= $ html ; } ) ; return $ this ; }
Appends text or HTML to a collection of items .
37,329
public function prepend ( $ html , $ key = null ) { $ this -> each ( function ( $ item ) use ( $ html ) { $ item -> title = $ html . $ item -> title ; } ) ; return $ this ; }
Prepends text or HTML to a collection of items .
37,330
public function active ( ) { $ this -> attributes [ 'class' ] = Builder :: formatGroupClass ( array ( 'class' => $ this -> builder -> conf ( 'active_class' ) ) , $ this -> attributes ) ; $ this -> isActive = true ; return $ this ; }
Make the anchor active .
37,331
public function run ( ) : void { foreach ( $ this -> providers as $ provider ) { if ( $ provider instanceof Bootable_Provider_Interface ) { $ provider -> boot ( $ this ) ; } } }
Start Stopwatch and timing plugin load immediately then set up core events and needed hooks .
37,332
public function send_timing_header ( $ input ) { if ( headers_sent ( ) ) { return $ input ; } $ ajax = defined ( 'DOING_AJAX' ) && DOING_AJAX ; $ rest = defined ( 'REST_REQUEST' ) && REST_REQUEST ; if ( ! $ ajax && ! $ rest ) { return $ input ; } if ( ! apply_filters ( 'laps_can_see' , current_user_can ( 'manage_option...
Sends Server Timing API header with records data .
37,333
public function pre_http_request ( $ false , array $ args , string $ url ) { $ this -> start ( $ url , 'http' ) ; $ this -> callers [ $ url ] = wp_debug_backtrace_summary ( __CLASS__ , 5 ) ; return $ false ; }
Capture start time of HTTP request
37,334
public function http_api_debug ( $ response , string $ type , $ class , array $ args , string $ url ) { $ this -> stop ( $ url ) ; return $ response ; }
Capture end time of HTTP request
37,335
public function enqueue_scripts ( ) : void { $ suffix = ( \ defined ( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' ; wp_register_script ( 'laps' , plugins_url ( "public/js/laps{$suffix}.js" , dirname ( __DIR__ ) ) , [ 'jquery' ] , '3.4.0' , true ) ; wp_register_style ( 'laps' , plugins_url ( "public/css/laps{$suffi...
Registers assets and queues as necessary .
37,336
public function plugin_loaded ( string $ plugin ) : void { $ time = microtime ( true ) ; $ this -> entries [ ] = [ 'name' => $ plugin , 'origin' => $ this -> last , 'duration' => $ time - $ this -> last , ] ; $ this -> last = $ time ; }
Records time for a plugin that just finished loading .
37,337
public function admin_bar_menu ( \ WP_Admin_Bar $ wp_admin_bar ) : void { if ( ! apply_filters ( 'laps_can_see' , current_user_can ( 'manage_options' ) ) ) { return ; } global $ timestart ; $ wp_admin_bar -> add_node ( [ 'id' => 'laps' , 'title' => sprintf ( 'Lap: %ss' , round ( microtime ( true ) - $ timestart , 3 ) )...
Render interface and add to the toolbar .
37,338
public function add_events ( array $ stops ) : void { $ this -> events = array_merge ( $ this -> events , $ stops ) ; foreach ( $ stops as $ key => $ data ) { if ( is_int ( $ key ) ) { $ this -> add_event ( ... $ data ) ; continue ; } foreach ( array_keys ( $ data ) as $ priority ) { add_action ( $ key , [ $ this , 'ti...
Hook events by name and priority from array .
37,339
private function get_count_suffix ( string $ event , bool $ increment = false ) : string { if ( ! isset ( $ this -> calls [ $ event ] ) ) { $ this -> calls [ $ event ] = 0 ; } if ( $ increment ) { $ this -> calls [ $ event ] ++ ; } $ count = ( int ) $ this -> calls [ $ event ] ; return $ count > 1 ? " ({$count})" : '' ...
Get the suffix to use if event occurs multiple times .
37,340
public function after_setup_theme ( ) : void { foreach ( $ this -> event_configs as $ config ) { $ this -> add_events ( $ config -> get_events ( ) ) ; } }
When theme is done possibly add vendor - specific events .
37,341
public function tick ( $ input = null ) { global $ wp_filter ; $ filter_name = current_filter ( ) ; $ filter_instance = $ wp_filter [ $ filter_name ] ; $ priority = $ filter_instance instanceof \ WP_Hook ? $ filter_instance -> current_priority ( ) : key ( $ filter_instance ) ; if ( empty ( $ this -> events [ $ filter_n...
Mark action for the event on Stopwatch .
37,342
public function rewind ( ) : void { $ this -> total = microtime ( true ) - $ this -> origin ; $ this -> current = $ this -> iterator ; }
Rewind to a topmost record set .
37,343
public function watch ( ) { $ this -> taskWatch ( ) -> monitor ( [ 'public/css/variables.less' , 'public/css/laps.less' ] , function ( ) { $ this -> makeCss ( ) ; } ) -> monitor ( 'public/js/source.js' , function ( ) { $ this -> makeJs ( ) ; } ) -> run ( ) ; }
Watches for changes .
37,344
public function makeMustache ( ) { $ dir = __DIR__ . '/src/mustache/cache' ; $ this -> _cleanDir ( $ dir ) ; $ mustache = new \ Mustache_Engine ( array ( 'loader' => new \ Mustache_Loader_FilesystemLoader ( __DIR__ . '/src/mustache' ) , 'cache' => $ dir , ) ) ; $ mustache -> loadTemplate ( 'laps' ) ; }
Compiles plugin s mustache template
37,345
public function tag ( $ version ) { $ this -> versionSet ( $ version ) ; $ this -> taskGitStack ( ) -> stopOnFail ( ) -> add ( 'laps.php' ) -> commit ( "Updated header version to {$version}" ) -> tag ( $ version ) -> run ( ) ; }
Updates version in header and makes git version tag .
37,346
public function pre_update_option_active_plugins ( array $ plugins ) : array { $ plugin = plugin_basename ( \ dirname ( __DIR__ , 2 ) . '/laps.php' ) ; $ key = array_search ( $ plugin , $ plugins , true ) ; if ( false !== $ key && $ key > 0 ) { unset ( $ plugins [ $ key ] ) ; array_unshift ( $ plugins , $ plugin ) ; $ ...
Reorder active plugins so Laps is first and starts timing load early .
37,347
public function query ( $ query ) : string { global $ wpdb ; if ( empty ( $ this -> query_starts ) && ! empty ( $ wpdb -> queries ) ) { $ this -> query_starts [ count ( $ wpdb -> queries ) ] = microtime ( true ) ; } else { $ this -> query_starts [ ] = microtime ( true ) ; } return $ query ; }
Capture SQL queries start times
37,348
public function getPage ( $ slug = 'home' ) { $ view = parent :: getPage ( $ slug ) ; $ page = Page :: findOrFail ( ( int ) $ view -> page -> id ) ; $ view -> layout = $ page -> layout ; $ view = BladeCompiler :: getHtmlFromString ( $ view , [ ] , true ) ; return $ view ; }
Add the layout to the returned page
37,349
public function changeLayout ( Request $ request , $ id ) { $ page = Page :: findOrFail ( ( int ) $ id ) ; $ page -> layout = $ request -> layout ; $ page -> save ( ) ; return redirect ( ) -> back ( ) -> with ( [ 'message' => __ ( 'voyager::generic.successfully_updated' ) . " Page Layout" , 'alert-type' => 'success' , ...
POST - Change Page Layout
37,350
public function recentBlogPosts ( $ numPosts = 4 ) { $ posts = BlogPost :: where ( [ [ 'status' , '=' , 'PUBLISHED' ] , ] ) -> whereDate ( 'published_date' , '<=' , Carbon :: now ( ) ) -> limit ( $ numPosts ) -> orderBy ( 'created_at' , 'desc' ) -> get ( ) ; return view ( "{$this->viewPath}::modules/posts/posts-grid" ,...
Recent posts widget
37,351
public static function getSearchableModels ( ) { $ searchableModels = [ ] ; foreach ( config ( 'scout.tntsearch.searchableModels' ) as $ model ) { $ modelName = substr ( $ model , strrpos ( $ model , '\\' ) + 1 ) ; if ( count ( preg_grep ( "/$modelName/" , $ searchableModels ) ) > 0 ) { continue ; } $ searchableModels ...
Filters our duplicates and retrieves an array of searchable models from our configuration file
37,352
public static function getBreadcrumbs ( Request $ request ) { $ httpPath = $ request -> segments ( ) ; $ menuItems = self :: getMenuItems ( 'url' ) ; $ breadcrumbs = array_map ( function ( $ key , $ crumb ) use ( $ httpPath , $ menuItems ) { $ crumbPath = join ( '/' , array_slice ( $ httpPath , 0 , $ key + 1 ) ) ; $ cr...
Defines an array of breadcrumbs
37,353
public static function getNavigationalBreadcrumbs ( $ parentId , $ crumbs = [ ] ) { $ menuItems = self :: getMenuItems ( 'id' ) ; if ( in_array ( $ parentId , $ menuItems ) ) { array_unshift ( $ crumbs , [ 'link' => $ menuItems [ $ parentId ] -> url , 'text' => $ menuItems [ $ parentId ] -> title , ] ) ; if ( ! is_null...
Recursively build crumbs from menu items
37,354
public static function getLayouts ( $ module , $ directory = 'layouts' ) { $ layouts = array ( ) ; $ vendorLayoutsDir = base_path ( "vendor/pvtl/$module/resources/views/$directory" ) ; if ( is_dir ( $ vendorLayoutsDir ) ) { $ layouts = scandir ( $ vendorLayoutsDir ) ; } $ projectLayoutsDir = resource_path ( "views/vend...
Scans project directories to retrieve a list of layouts
37,355
public static function executeClass ( $ classString , $ forcedParams = null ) { list ( $ className , $ methodName ) = explode ( '::' , $ classString ) ; preg_match ( '/\(.*?\)/' , $ methodName , $ parameters ) ; if ( count ( $ parameters ) > 0 ) { $ methodName = str_replace ( $ parameters [ 0 ] , '' , $ methodName ) ; ...
Fire in the hole! Execute our custom functionality .
37,356
public function updateAccount ( Request $ request ) { $ this -> validator ( $ request -> all ( ) ) -> validate ( ) ; $ user = Auth :: user ( ) ; $ user -> name = $ request -> input ( 'name' ) ; $ user -> email = $ request -> input ( 'email' ) ; if ( $ request -> input ( 'password' ) !== null ) { $ user -> password = bc...
Update User Account
37,357
public function impersonateUser ( $ userId ) { if ( Session :: has ( 'original_user.id' ) && $ userId == Session :: get ( 'original_user.id' ) ) { Session :: forget ( 'original_user.name' ) ; Auth :: loginUsingId ( Session :: pull ( 'original_user.id' ) ) ; return redirect ( ) -> route ( 'voyager.users.index' ) ; } els...
Impersonate a user as an administrator
37,358
public function boot ( Request $ request ) { $ this -> strapEvents ( ) ; $ this -> strapRoutes ( ) ; $ this -> strapPublishers ( ) ; $ this -> strapViews ( $ request ) ; $ this -> strapHelpers ( ) ; $ this -> strapMigrations ( ) ; $ this -> strapCommands ( ) ; }
Bootstrap the application services
37,359
protected function strapViews ( Request $ request ) { View :: composer ( '*' , function ( $ view ) use ( $ request ) { $ view -> with ( 'currentUser' , \ Auth :: user ( ) ) ; $ view -> with ( 'breadcrumbs' , PageController :: getBreadcrumbs ( $ request ) ) ; } ) ; $ this -> loadViewsFrom ( self :: PACKAGE_DIR . 'resour...
Bootstrap our Views
37,360
public function is ( $ enumValue ) : bool { if ( ! static :: hasValue ( $ enumValue ) ) { throw new InvalidEnumMemberException ( $ enumValue , $ this ) ; } return $ this -> value === $ enumValue ; }
Checks the equality of the value against the enum instance .
37,361
protected static function getConstants ( ) : array { $ calledClass = get_called_class ( ) ; if ( ! array_key_exists ( $ calledClass , static :: $ constCacheArray ) ) { $ reflect = new ReflectionClass ( $ calledClass ) ; static :: $ constCacheArray [ $ calledClass ] = $ reflect -> getConstants ( ) ; } return static :: $...
Get all of the constants on the class
37,362
protected static function getLocalizedDescription ( $ value ) : ? string { if ( static :: isLocalizable ( ) ) { $ localizedStringKey = static :: getLocalizationKey ( ) . '.' . $ value ; if ( Lang :: has ( $ localizedStringKey ) ) { return __ ( $ localizedStringKey ) ; } } return null ; }
Get the localized description if localization is enabled for the enum and if the key exists in the lang file
37,363
public static function toSelectArray ( ) : array { $ array = static :: toArray ( ) ; $ selectArray = [ ] ; foreach ( $ array as $ key => $ value ) { $ selectArray [ $ value ] = static :: getDescription ( $ value ) ; } return $ selectArray ; }
Get the enum as an array formatted for a select . value = > description
37,364
public static function hasValue ( $ value , bool $ strict = true ) : bool { $ validValues = static :: getValues ( ) ; if ( $ strict ) { return in_array ( $ value , $ validValues , true ) ; } return in_array ( ( string ) $ value , array_map ( 'strval' , $ validValues ) , true ) ; }
Check that the enum contains a specific value
37,365
protected static function getFriendlyKeyName ( string $ key ) : string { if ( ctype_upper ( str_replace ( '_' , '' , $ key ) ) ) { $ key = strtolower ( $ key ) ; } return ucfirst ( str_replace ( '_' , ' ' , snake_case ( $ key ) ) ) ; }
Transform the key name into a friendly formatted version
37,366
private function bootValidators ( ) { Validator :: extend ( 'enum_key' , function ( $ attribute , $ value , $ parameters , $ validator ) { $ enum = $ parameters [ 0 ] ?? null ; return ( new EnumKey ( $ enum ) ) -> passes ( $ attribute , $ value ) ; } ) ; Validator :: extend ( 'enum_value' , function ( $ attribute , $ v...
Boot the custom validators
37,367
public function startPlaying ( $ urls , $ optionalArgs ) { return $ this -> proxyToInterface ( ) -> startPlaying ( $ this -> id , $ urls , $ optionalArgs ) ; }
Start playing audio in this call
37,368
public function startSpeaking ( $ text , $ optionalArgs ) { return $ this -> proxyToInterface ( ) -> startSpeaking ( $ this -> id , $ text , $ optionalArgs ) ; }
Start speaking text in this call
37,369
public function dtmf ( $ digits , $ leg = null ) { $ this -> proxyToInterface ( ) -> dtmf ( $ this -> id , $ digits , $ leg ) ; }
Send digits in this call
37,370
public function get ( $ number ) { if ( ArrayOperations :: checkNull ( [ $ number ] ) ) { throw new PlivoValidationException ( 'number is mandatory' ) ; } $ response = $ this -> client -> fetch ( $ this -> uri . $ number . '/' , [ ] ) ; return new Number ( $ this -> client , $ response -> getContent ( ) , $ this -> pat...
Returns a number instance
37,371
public function addNumber ( array $ numbers , $ carrier , $ region , array $ optionalArgs = [ ] ) { $ mandatoryArgs = [ 'numbers' => join ( ',' , $ numbers ) , 'carrier' => $ carrier , 'region' => $ region ] ; if ( ArrayOperations :: checkNull ( $ mandatoryArgs ) ) { throw new PlivoValidationException ( "Mandatory para...
Buy a new number
37,372
public function delete ( $ appId ) { $ response = $ this -> client -> delete ( $ this -> uri . $ appId . '/' , [ ] ) ; return new ResponseDelete ( $ response -> getStatusCode ( ) ) ; }
Delete an application
37,373
public function get ( $ appId ) { if ( ArrayOperations :: checkNull ( [ $ appId ] ) ) { throw new PlivoValidationException ( 'app id is mandatory' ) ; } $ response = $ this -> client -> fetch ( $ this -> uri . $ appId . '/' , [ ] ) ; return new Application ( $ this -> client , $ response -> getContent ( ) , $ this -> p...
Retrive an application
37,374
public function getList ( array $ optionalArgs = [ ] ) { $ response = $ this -> client -> fetch ( $ this -> uri , $ optionalArgs ) ; $ applications = [ ] ; foreach ( $ response -> getContent ( ) [ 'objects' ] as $ application ) { $ newApplication = new Application ( $ this -> client , $ application , $ this -> pathPara...
Retrieve a list of applications
37,375
public function get ( $ recordingId ) { if ( ArrayOperations :: checkNull ( [ $ recordingId ] ) ) { throw new PlivoValidationException ( 'recording id is mandatory' ) ; } $ response = $ this -> client -> fetch ( $ this -> uri . $ recordingId . '/' , [ ] ) ; return new Recording ( $ this -> client , $ response -> getCon...
Return a recording instance
37,376
public function delete ( $ recordingId ) { if ( ArrayOperations :: checkNull ( [ $ recordingId ] ) ) { throw new PlivoValidationException ( 'recording id is mandatory' ) ; } $ this -> client -> delete ( $ this -> uri . $ recordingId . '/' , [ ] ) ; }
Delete a recording
37,377
public function get ( $ countryIso ) { $ response = $ this -> client -> fetch ( $ this -> uri , [ 'country_iso' => $ countryIso ] ) ; return new Pricing ( $ this -> client , $ response -> getContent ( ) ) ; }
Return pricing for a country ISO
37,378
public function get ( ) { $ params = [ ] ; $ response = $ this -> client -> fetch ( $ this -> uri , $ params ) ; return new Account ( $ this -> client , $ response -> getContent ( ) , $ this -> pathParams [ 'authId' ] ) ; }
You can call this method to retrieve details like email address cash credits postal address auto recharge settings etc which is associated with your Plivo account . Returns an object representing your Plivo account .
37,379
public function update ( $ name , $ city , $ address ) { $ data = [ 'name' => $ name , 'city' => $ city , 'address' => $ address ] ; $ response = $ this -> client -> update ( $ this -> uri , $ data ) ; $ responseContents = $ response -> getContent ( ) ; if ( ! array_key_exists ( "error" , $ responseContents ) ) { retur...
If you would like to modify your account details you could do so with this method . You can make changes to the name city and the address fields .
37,380
public function send_request ( $ url , $ method , $ body , $ headers , $ timeOut , $ request ) { $ headers [ "Authorization" ] = "Basic " . base64_encode ( "$this->authId:$this->authToken" ) ; $ request -> setHeaders ( $ headers ) ; $ options = [ 'http_errors' => false , 'headers' => $ headers , 'body' => $ body , 'tim...
Actually sends the request to the http client
37,381
public function create ( $ username , $ password , $ alias , $ appId = null ) { $ mandatoryArgs = [ 'username' => $ username , 'password' => $ password , 'alias' => $ alias ] ; if ( ArrayOperations :: checkNull ( $ mandatoryArgs ) ) { throw new PlivoValidationException ( "Mandatory parameters cannot be null" ) ; } $ re...
This method lets you create a new endpoint on Plivo
37,382
public function getList ( $ optionalArgs = [ ] ) { $ response = $ this -> client -> fetch ( $ this -> uri , $ optionalArgs ) ; $ endpoints = [ ] ; foreach ( $ response -> getContent ( ) [ 'objects' ] as $ endpoint ) { $ newEndpoint = new Endpoint ( $ this -> client , $ endpoint , $ this -> pathParams [ 'authId' ] ) ; a...
This method lets you get details of all endpoints . This is pretty useful in use - cases where you want statuses of your endpoints and whether they have been registered using a SIP client .
37,383
public function update ( $ endpointId , array $ optionalArgs = [ ] ) { $ response = $ this -> client -> update ( $ this -> uri . $ endpointId . '/' , $ optionalArgs ) ; $ responseContents = $ response -> getContent ( ) ; if ( ! array_key_exists ( "error" , $ responseContents ) ) { return new ResponseUpdate ( $ response...
Modify an endpoint
37,384
public function delete ( $ endpointId ) { if ( ArrayOperations :: checkNull ( [ $ endpointId ] ) ) { throw new PlivoValidationException ( 'endpoint id is mandatory' ) ; } $ this -> client -> delete ( $ this -> uri . $ endpointId . '/' , [ ] ) ; }
Delete an endpoint
37,385
public function create ( $ name , $ enabled = null ) { if ( is_null ( $ name ) ) { throw new PlivoValidationException ( "Mandatory parameters cannot be null" ) ; } $ data = [ 'name' => $ name , 'enabled' => $ enabled ] ; $ response = $ this -> client -> update ( $ this -> uri , $ data ) ; $ responseContents = $ respons...
Create a new subaccount
37,386
public function update ( $ subAuthId , $ name = null , $ enabled = null ) { $ data = [ 'name' => $ name , 'enabled' => $ enabled ] ; $ response = $ this -> client -> update ( $ this -> uri . $ subAuthId . '/' , $ data ) ; $ responseContents = $ response -> getContent ( ) ; if ( ! array_key_exists ( "error" , $ response...
Modify a subaccount
37,387
public function delete ( $ subAuthId , $ cascade = null ) { $ data = [ 'cascade' => $ cascade ] ; $ response = $ this -> client -> delete ( $ this -> uri . $ subAuthId . '/' , $ data ) ; return new ResponseDelete ( $ response -> getStatusCode ( ) ) ; }
Delete a subaccount
37,388
public function get ( $ subAuthId ) { if ( ArrayOperations :: checkNull ( [ $ subAuthId ] ) ) { throw new PlivoValidationException ( 'subauth id is mandatory' ) ; } $ response = $ this -> client -> fetch ( $ this -> uri . $ subAuthId . '/' , [ ] ) ; return new SubAccount ( $ this -> client , $ response -> getContent ( ...
You can call this method to retrieve details of a subaccount like auth_id auth_token etc . Returns an object representing your Plivo subaccount .
37,389
protected function getList ( $ limit = null , $ offset = null ) { $ params = [ 'limit' => $ limit , 'offset' => $ offset ] ; $ response = $ this -> client -> fetch ( $ this -> uri , $ params ) ; $ subAccounts = [ ] ; foreach ( $ response -> getContent ( ) [ 'objects' ] as $ subAccount ) { $ newSubAccount = new SubAccou...
You can get details of all subaccounts associated with your main Plivo account . We return a list of all subaccounts .
37,390
public function get ( $ callUuid ) { if ( ArrayOperations :: checkNull ( [ $ callUuid ] ) ) { throw new PlivoValidationException ( 'call uuid is mandatory' ) ; } $ response = $ this -> client -> fetch ( $ this -> uri . $ callUuid . '/' , [ ] ) ; return new Call ( $ this -> client , $ response -> getContent ( ) , $ this...
Get details of a call
37,391
public function getLive ( $ liveCallUuid ) { if ( ArrayOperations :: checkNull ( [ $ liveCallUuid ] ) ) { throw new PlivoValidationException ( 'live call uuid is mandatory' ) ; } $ params = [ 'status' => 'live' ] ; $ response = $ this -> client -> fetch ( $ this -> uri . $ liveCallUuid . '/' , $ params ) ; return new C...
Get details of a live call
37,392
public function getQueued ( $ queuedCallUuid ) { if ( ArrayOperations :: checkNull ( [ $ queuedCallUuid ] ) ) { throw new PlivoValidationException ( 'queued call uuid is mandatory' ) ; } $ params = [ 'status' => 'queued' ] ; $ response = $ this -> client -> fetch ( $ this -> uri . $ queuedCallUuid . '/' , $ params ) ; ...
Get details of a queued call
37,393
public function getList ( array $ optionalArgs = [ ] ) { $ response = $ this -> client -> fetch ( $ this -> uri , $ optionalArgs ) ; $ calls = [ ] ; foreach ( $ response -> getContent ( ) [ 'objects' ] as $ call ) { $ newCall = new Call ( $ this -> client , $ call , $ this -> pathParams [ 'authId' ] , $ call [ 'call_uu...
Get a list of calls
37,394
public function getListLive ( array $ optionalArgs = [ ] ) { $ optionalArgs [ 'status' ] = 'live' ; $ response = $ this -> client -> fetch ( $ this -> uri , $ optionalArgs ) ; $ liveCallUuids = $ response -> getContent ( ) [ 'calls' ] ; return $ liveCallUuids ; }
Get a list of live calls
37,395
public function getListQueued ( ) { $ params = [ 'status' => 'queued' ] ; $ response = $ this -> client -> fetch ( $ this -> uri , $ params ) ; $ queuedCallUuids = $ response -> getContent ( ) [ 'calls' ] ; return $ queuedCallUuids ; }
Get a list of queued calls
37,396
public function transfer ( $ liveCallUuid , array $ optionalArgs = [ ] ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to transfer? No callUuid given" ) ; } if ( isset ( $ optionalArgs [ 'legs' ] ) ) { switch ( $ optionalArgs [ 'legs' ] ) { case 'aleg' : if ( ! isset ( $ optionalA...
Transfer a live call
37,397
public function startRecording ( $ liveCallUuid , array $ optionalArgs = [ ] ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to record? No callUuid given" ) ; } $ response = $ this -> client -> update ( $ this -> uri . $ liveCallUuid . '/Record/' , $ optionalArgs ) ; $ responseCon...
Start recording a live call
37,398
public function stopRecording ( $ liveCallUuid , $ url = null ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to stop recording? No callUuid given" ) ; } $ params = [ ] ; if ( ! empty ( $ url ) ) { $ params = [ 'URL' => $ url ] ; } $ this -> client -> delete ( $ this -> uri . $ li...
Stop recording a live call
37,399
public function startPlaying ( $ liveCallUuid , array $ urls , array $ optionalArgs = [ ] ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to play in? No callUuid given" ) ; } if ( empty ( $ urls ) ) { throw new PlivoValidationException ( "urls cannot be null" ) ; } $ response = $ ...
Start playing audio in a live call