idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
35,400
protected function sendDeleteRequest ( $ resource ) { $ response = $ this -> sendRequest ( 'DELETE' , $ this -> getServiceUrl ( $ resource ) , [ 'headers' => [ 'Accept' => 'application/x-yametrika+json' , 'Content-Type' => 'application/x-yametrika+json' , 'Authorization' => 'OAuth ' . $ this -> getAccessToken ( ) , ] ]...
Send DELETE request to API resource
35,401
public function getGoals ( $ counterId ) { $ resource = 'counter/' . $ counterId . '/goals' ; $ response = $ this -> sendGetRequest ( $ resource ) ; $ goalResponse = new Models \ GetGoalsResponse ( $ response ) ; return $ goalResponse -> getGoals ( ) ; }
Get counter goals
35,402
public function addGoal ( $ counterId , Models \ Goal $ goal ) { $ resource = 'counter/' . $ counterId . '/goals' ; $ response = $ this -> sendPostRequest ( $ resource , [ "goal" => $ goal -> toArray ( ) ] ) ; $ goalResponse = new Models \ AddGoalResponse ( $ response ) ; return $ goalResponse -> getGoal ( ) ; }
Add goal to counter
35,403
public function getGoal ( $ id , $ counterId ) { $ resource = 'counter/' . $ counterId . '/goal/' . $ id ; $ response = $ this -> sendGetRequest ( $ resource ) ; $ goalResponse = new Models \ GetGoalResponse ( $ response ) ; return $ goalResponse -> getGoal ( ) ; }
Get counter goal
35,404
public function updateGoal ( $ id , $ counterId , Models \ Goal $ goal ) { $ resource = 'counter/' . $ counterId . '/goal/' . $ id ; $ response = $ this -> sendPutRequest ( $ resource , [ "goal" => $ goal -> toArray ( ) ] ) ; $ goalResponse = new Models \ UpdateGoalResponse ( $ response ) ; return $ goalResponse -> get...
Update counter goal
35,405
public function deleteGoal ( $ id , $ counterId ) { $ resource = 'counter/' . $ counterId . '/goal/' . $ id ; $ response = $ this -> sendDeleteRequest ( $ resource ) ; return $ response ; }
Delete counter goal
35,406
public function add ( $ vendor ) { if ( is_array ( $ vendor ) ) { $ this -> collection [ ] = new Vendor ( $ vendor ) ; } elseif ( is_object ( $ vendor ) && $ vendor instanceof Vendor ) { $ this -> collection [ ] = $ vendor ; } return $ this ; }
Add vendor to collection
35,407
public function getLimit ( $ name ) { if ( isset ( $ this -> limits [ $ name ] ) ) { return $ this -> limits [ $ name ] ; } return false ; }
Get information about specified API limit
35,408
protected function getServiceResponse ( $ resource ) { $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; return $ decodedResponseBody ; }
Returns API service response .
35,409
protected function buildQueryString ( $ queryData , $ prefix = '' , $ argSeparator = '&' , $ encType = PHP_QUERY_RFC3986 ) { foreach ( $ queryData as $ k => & $ v ) { if ( ! is_scalar ( $ v ) ) { $ v = implode ( ',' , $ v ) ; } } $ queryString = http_build_query ( $ queryData , $ prefix , $ argSeparator , $ encType ) ;...
Returns URL - encoded query string
35,410
public function getOperations ( $ counterId , $ params = [ ] ) { $ resource = 'counter/' . $ counterId . '/operations' ; $ response = $ this -> sendGetRequest ( $ resource , $ params ) ; $ operationResponse = new Models \ GetOperationsResponse ( $ response ) ; return $ operationResponse -> getOperations ( ) ; }
Get counter operations
35,411
public function addOperation ( $ counterId , Models \ Operation $ operation ) { $ resource = 'counter/' . $ counterId . '/operations' ; $ response = $ this -> sendPostRequest ( $ resource , [ "operation" => $ operation -> toArray ( ) ] ) ; $ operationResponse = new Models \ AddOperationResponse ( $ response ) ; return ...
Add operation to counter
35,412
public function getOperation ( $ id , $ counterId , $ params = [ ] ) { $ resource = 'counter/' . $ counterId . '/operation/' . $ id ; $ response = $ this -> sendGetRequest ( $ resource , $ params ) ; $ operationResponse = new Models \ GetOperationResponse ( $ response ) ; return $ operationResponse -> getOperation ( ) ...
Get counter operation
35,413
public function updateOperation ( $ id , $ counterId , Models \ Operation $ operation ) { $ resource = 'counter/' . $ counterId . '/operation/' . $ id ; $ response = $ this -> sendPutRequest ( $ resource , [ "operation" => $ operation -> toArray ( ) ] ) ; $ operationsResponse = new Models \ UpdateOperationResponse ( $ ...
Update counter operation
35,414
public function deleteCounterOperation ( $ id , $ counterId ) { $ resource = 'counter/' . $ counterId . '/operation/' . $ id ; $ response = $ this -> sendDeleteRequest ( $ resource ) ; return $ response ; }
Delete counter operation
35,415
public function getCampaigns ( ) { $ resource = 'campaigns.json' ; $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; $ getCampaignsResponse = new GetCampaignsResponse ( $ decodedResponseBody ) ; return...
Get User Campaigns
35,416
public function getCampaignsByLogin ( $ login ) { $ resource = 'campaigns/by_login/' . $ login . '.json' ; $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; $ getCampaignsResponse = new Models \ GetCam...
Get User Campaigns by Login
35,417
public function getLoginsByCampaign ( ) { $ resource = 'campaigns/' . $ this -> campaignId . '/logins.json' ; $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; return StringCollection :: init ( $ decod...
Get logins by campaign id
35,418
public function getOutlet ( $ outletId ) { $ resource = 'campaigns/' . $ this -> campaignId . '/outlets/' . $ outletId . '.json' ; $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; $ getOrderResponse =...
Get outlet info
35,419
public function getOrdersResponse ( $ params = [ ] ) { $ resource = 'campaigns/' . $ this -> campaignId . '/orders.json' ; $ resource .= '?' . http_build_query ( $ params ) ; $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ resp...
Get information about orders by campaign id
35,420
public function getOrder ( $ orderId ) { $ resource = 'campaigns/' . $ this -> campaignId . '/orders/' . $ orderId . '.json' ; $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; $ getOrderResponse = new...
Get order info
35,421
public function getSettings ( ) { $ resource = 'campaigns/' . $ this -> campaignId . '/settings.json' ; $ response = $ this -> sendRequest ( 'GET' , $ this -> getServiceUrl ( $ resource ) ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; $ getSettingsResponse = new Models \ GetSetting...
Get Campaign settings
35,422
public function setOrderStatus ( $ orderId , $ status , $ subStatus = null ) { $ resource = 'campaigns/' . $ this -> campaignId . '/orders/' . $ orderId . '/status.json' ; $ data = [ "order" => [ "status" => $ status ] ] ; if ( $ subStatus ) { $ data [ 'order' ] [ 'substatus' ] = $ subStatus ; } $ response = $ this -> ...
Send changed status to Yandex . Market
35,423
public function updateDelivery ( $ orderId , Delivery $ delivery ) { $ resource = 'campaigns/' . $ this -> campaignId . '/orders/' . $ orderId . '/delivery.json' ; $ response = $ this -> sendRequest ( 'PUT' , $ this -> getServiceUrl ( $ resource ) , [ 'json' => [ 'delivery' => $ delivery -> toArray ( ) ] ] ) ; $ decode...
Update changed delivery parameters
35,424
public function findModels ( $ searchQuery , $ regionId , $ page = null , $ pageSize = null , $ currency = null ) { $ resource = sprintf ( 'models.%s' , self :: DECODE_TYPE_DEFAULT ) ; $ queryParams = $ this -> filterParams ( [ 'query' => $ searchQuery , 'regionId' => $ regionId , 'page' => $ page , 'pageSize' => $ pag...
Find models by query
35,425
public function getModelOffers ( $ modelId , $ regionId , $ currency = null , $ orderByPrice = null ) { $ resource = sprintf ( 'models/%s/offers.%s' , $ modelId , self :: DECODE_TYPE_DEFAULT ) ; $ queryParams = $ this -> filterParams ( [ 'regionId' => $ regionId , 'currency' => $ currency , 'orderByPrice' => $ orderByP...
Get model offers
35,426
public function getList ( $ params = array ( ) ) { $ resource = 'georegion.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ geoRegions = new Models \ ResponseGeoRegionsGet ( $ response ) ; return $ geoRegions ; }
Get geo regions
35,427
public function get ( $ regionId ) { $ resource = 'georegion/' . $ regionId . '.json' ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ geoRegion = new Models \ ResponseGeoRegionGet ( $ response ) ; return $ geoRegion ; }
Get geo region information
35,428
public function getChildren ( $ regionId , $ params = array ( ) ) { $ resource = 'georegion/' . $ regionId . '/children.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ geoRegionChildren = new Models \ ResponseGeoRegionChildrenGet ( $ res...
Get children of geo region
35,429
public function getMatch ( $ params = array ( ) ) { $ resource = 'georegion/suggest.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ geoRegionsSuggest = new Models \ ResponseGeoRegionSuggestGet ( $ response ) ; return $ geoRegionsSuggest ...
Get suggests of geo region
35,430
public function getShopsSummary ( $ regionId , $ params = array ( ) ) { $ resource = 'regions/' . $ regionId . '/shops/summary.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ regionShopsSummary = new Models \ ResponseGeoRegionShopsSummar...
Get shops summary in geo region
35,431
public function getModels ( $ params = array ( ) ) { $ resource = 'popular.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getPopularModelsResponse = new Models \ ResponsePopularModelsGet ( $ response ) ; return $ getPopularModelsRespons...
Get popular models
35,432
public function getCategoryModels ( $ categoryId , $ params = array ( ) ) { $ resource = 'popular/' . $ categoryId . '.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getPopularCategoryModelsResponse = new Models \ ResponsePopularCategor...
Get popular category models
35,433
public function add ( $ method ) { if ( is_array ( $ method ) ) { $ this -> collection [ ] = new DeliveryMethod ( $ method ) ; } elseif ( is_object ( $ method ) && $ method instanceof DeliveryMethod ) { $ this -> collection [ ] = $ method ; } return $ this ; }
Add method to collection
35,434
public function add ( $ fact ) { if ( is_string ( $ fact ) ) { $ this -> collection [ ] = new Fact ( array ( 'fact' => $ fact ) ) ; } elseif ( is_object ( $ fact ) && $ fact instanceof Fact ) { $ this -> collection [ ] = $ fact ; } return $ this ; }
Add fact to collection
35,435
public function add ( $ offer ) { if ( is_array ( $ offer ) ) { $ this -> collection [ ] = new MarketModelOffer ( $ offer ) ; } elseif ( $ offer instanceof MarketModelOffer ) { $ this -> collection [ ] = $ offer ; } return $ this ; }
Add model offer
35,436
public function get ( $ shopId ) { $ resource = 'shop/' . $ shopId . '.json' ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getShopResponse = new Models \ ResponseShopGet ( $ response ) ; return $ getShopResponse -> getShop ( ) ; }
Get shop information
35,437
public function getOutlets ( $ shopId , $ params = array ( ) ) { $ resource = 'shop/' . $ shopId . '/outlets.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ shopOutlets = new Models \ ResponseShopOutletsGet ( $ response ) ; return $ shop...
Get outlets of shop
35,438
public function getOpinions ( $ shopId , $ params = array ( ) ) { $ resource = 'shop/' . $ shopId . '/opinion.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ shopOpinions = new Models \ ResponseShopOpinionsGet ( $ response ) ; return $ s...
Get opinions of shop
35,439
public function get ( $ vendorId ) { $ resource = 'vendor/' . $ vendorId . '.json' ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getVendorResponse = new Models \ ResponseVendorGet ( $ response ) ; return $ getVendorResponse ; }
Get vendor information
35,440
public function getLookupUrl ( $ url = '' ) { $ pVer = '3.5' ; return $ this -> serviceScheme . '://' . $ this -> serviceDomain . '/' . 'lookup?client=api&apikey=' . $ this -> apiKey . '&pver=' . $ pVer . '&url=' . $ url ; }
Get url to service Lookup resource with parameters
35,441
public function getFilters ( $ counterId ) { $ resource = 'counter/' . $ counterId . '/filters' ; $ response = $ this -> sendGetRequest ( $ resource ) ; $ filterResponse = new Models \ GetFiltersResponse ( $ response ) ; return $ filterResponse -> getFilters ( ) ; }
Get counter filters
35,442
public function addFilter ( $ counterId , Models \ Filter $ filter ) { $ resource = 'counter/' . $ counterId . '/filters' ; $ response = $ this -> sendPostRequest ( $ resource , [ "filter" => $ filter -> toArray ( ) ] ) ; $ filterResponse = new Models \ AddFilterResponse ( $ response ) ; return $ filterResponse -> getF...
Add filter to counter
35,443
public function getFilter ( $ id , $ counterId , $ params = [ ] ) { $ resource = 'counter/' . $ counterId . '/filter/' . $ id ; $ response = $ this -> sendGetRequest ( $ resource , $ params ) ; $ filterResponse = new Models \ GetFilterResponse ( $ response ) ; return $ filterResponse -> getFilter ( ) ; }
Get counter filter
35,444
public function updateFilter ( $ id , $ counterId , Models \ Filter $ filter ) { $ resource = 'counter/' . $ counterId . '/filter/' . $ id ; $ response = $ this -> sendPutRequest ( $ resource , [ "filter" => $ filter -> toArray ( ) ] ) ; $ filterResponse = new Models \ UpdateFilterResponse ( $ response ) ; return $ fil...
Update counter filter
35,445
public function deleteFilter ( $ id , $ counterId ) { $ resource = 'counter/' . $ counterId . '/filter/' . $ id ; $ response = $ this -> sendDeleteRequest ( $ resource ) ; return $ response ; }
Delete counter filter
35,446
public function getGaData ( Models \ Params $ params ) { $ resource = 'ga' ; $ response = $ this -> sendGetRequest ( $ resource , $ params -> toArray ( ) ) ; $ responseObj = new Models \ Ga ( $ response ) ; return $ responseObj ; }
Get google analytics data
35,447
public function getGrants ( $ counterId , $ params = [ ] ) { $ resource = 'counter/' . $ counterId . '/grants' ; $ response = $ this -> sendGetRequest ( $ resource , $ params ) ; $ grantResponse = new Models \ GetGrantsResponse ( $ response ) ; return $ grantResponse -> getGrants ( ) ; }
Get counter grants
35,448
public function addGrant ( $ counterId , Models \ Grant $ grant ) { $ resource = 'counter/' . $ counterId . '/grants' ; $ response = $ this -> sendPostRequest ( $ resource , [ "grant" => $ grant -> toArray ( ) ] ) ; $ grantResponse = new Models \ AddGrantResponse ( $ response ) ; return $ grantResponse -> getGrant ( ) ...
Add grant to counter
35,449
public function getGrant ( $ counterId , $ userLogin , $ params = [ ] ) { $ resource = 'counter/' . $ counterId . '/grant/' . $ userLogin ; $ response = $ this -> sendGetRequest ( $ resource , $ params ) ; $ grantResponse = new Models \ GetGrantResponse ( $ response ) ; return $ grantResponse -> getGrant ( ) ; }
Get counter grant
35,450
public function updateGrant ( $ counterId , $ userLogin , Models \ Grant $ grant ) { $ resource = 'counter/' . $ counterId . '/grant/' . $ userLogin ; $ response = $ this -> sendPutRequest ( $ resource , [ "grant" => $ grant -> toArray ( ) ] ) ; $ grantResponse = new Models \ UpdateGrantResponse ( $ response ) ; return...
Update counter grant
35,451
public function deleteGrant ( $ counterId , $ userLogin ) { $ resource = 'counter/' . $ counterId . '/grant/' . $ userLogin ; $ response = $ this -> sendDeleteRequest ( $ resource ) ; return $ response ; }
Delete counter grant
35,452
public function get ( $ offerId , $ params = array ( ) ) { $ resource = 'offer/' . $ offerId . '.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getOfferResponse = new Models \ ResponseOfferGet ( $ response ) ; return $ getOfferResponse ...
Get offer information
35,453
public function lookup ( $ text ) { $ url = $ this -> getLookupUrl ( $ text ) ; $ response = $ this -> sendRequest ( 'GET' , $ url , [ 'version' => $ this -> serviceProtocolVersion ] ) ; if ( $ response -> getStatusCode ( ) === 200 ) { $ definitions = $ this -> parseLookupResponse ( $ response ) ; return $ definitions ...
Looks up a text in the dictionary
35,454
public function get ( $ params = array ( ) ) { $ resource = 'search.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getSearchResponse = new Models \ ResponseSearchGet ( $ response ) ; return $ getSearchResponse ; }
Get models & offers search result
35,455
public function getFilterCategory ( $ categoryId , $ params = array ( ) ) { $ resource = 'filter/' . $ categoryId . '.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getFilterCategoryResponse = new Models \ ResponseFilterCategoryGet ( $ ...
Get models & offers search by filters result
35,456
public function get ( $ categoryId , $ params = array ( ) ) { $ resource = 'category/' . $ categoryId . '.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getCategoryResponse = new Models \ ResponseCategoryGet ( $ response ) ; return $ ge...
Get category information
35,457
public function getChildren ( $ categoryId , $ params = array ( ) ) { $ resource = 'category/' . $ categoryId . '/children.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getCategoryResponse = new Models \ ResponseCategoryGetList ( $ res...
Get children categories
35,458
public function getModels ( $ categoryId , $ params = array ( ) ) { $ resource = 'category/' . $ categoryId . '/models.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getCategoryModelsResponse = new Models \ ResponseCategoryGetModels ( $...
Get models in category
35,459
public function getFilters ( $ categoryId , $ params = array ( ) ) { $ resource = 'category/' . $ categoryId . '/filters.json' ; $ resource .= '?' . $ this -> buildQueryString ( $ params ) ; $ response = $ this -> getServiceResponse ( $ resource ) ; $ getCategoryFiltersResponse = new Models \ ResponseCategoryGetFilters...
Get filters in category
35,460
public function authRedirect ( $ exit = true , $ type = self :: CODE_AUTH_TYPE , $ state = null ) { header ( 'Location: ' . $ this -> getAuthUrl ( $ type , $ state ) ) ; return $ exit ? exit ( ) : true ; }
Sends a redirect to the Yandex authentication page .
35,461
public function requestAccessToken ( $ code ) { $ client = $ this -> getClient ( ) ; try { $ response = $ client -> request ( 'POST' , '/token' , [ 'auth' => [ $ this -> clientId , $ this -> clientSecret ] , 'form_params' => [ 'grant_type' => 'authorization_code' , 'code' => $ code , 'client_id' => $ this -> clientId ,...
Exchanges a temporary code for an access token .
35,462
public function getDrillDown ( Models \ TableParams $ params , array $ parentId = [ ] ) { $ resource = 'drilldown' ; $ params = $ params -> toArray ( ) ; if ( ! empty ( $ parentId ) ) { $ params [ 'parent_id' ] = json_encode ( $ parentId ) ; } $ response = $ this -> sendGetRequest ( $ resource , $ params ) ; $ dataResp...
Get drill down
35,463
public function getByTime ( Models \ ByTimeParams $ params ) { $ resource = 'bytime' ; $ response = $ this -> sendGetRequest ( $ resource , $ params -> toArray ( ) ) ; $ dataResponse = new Models \ ByTimeData ( $ response ) ; return $ dataResponse ; }
Get data by time
35,464
public function getComparisonDrillDown ( Models \ DrillDownComparisonParams $ params ) { $ resource = 'comparison/drilldown' ; $ response = $ this -> sendGetRequest ( $ resource , $ params -> toArray ( ) ) ; $ dataResponse = new Models \ DrillDownComparison ( $ response ) ; return $ dataResponse ; }
Comparison drill down
35,465
public function add ( $ comment ) { if ( is_array ( $ comment ) ) { $ this -> collection [ ] = new Comment ( $ comment ) ; } elseif ( is_object ( $ comment ) && $ comment instanceof Comment ) { $ this -> collection [ ] = $ comment ; } return $ this ; }
Add comment to collection
35,466
public function add ( $ childModel ) { if ( is_array ( $ childModel ) ) { $ this -> collection [ ] = new ModelChild ( $ childModel ) ; } elseif ( is_object ( $ childModel ) && $ childModel instanceof ModelChild ) { $ this -> collection [ ] = $ childModel ; } return $ this ; }
Add childModel to collection
35,467
public function add ( $ shop ) { if ( is_array ( $ shop ) ) { $ this -> collection [ ] = new Shop ( $ shop ) ; } elseif ( is_object ( $ shop ) && $ shop instanceof Shop ) { $ this -> collection [ ] = $ shop ; } return $ this ; }
Add shop to collection
35,468
public function add ( $ migrationData , array $ fields ) { if ( ! isset ( $ migrationData [ 'method' ] ) ) { $ migrationData [ 'method' ] = 'table' ; } $ compiled = $ this -> compiler -> compile ( $ this -> getTemplate ( ) , $ migrationData ) ; return $ this -> replaceFieldsWith ( $ this -> addColumns ( $ fields ) , $ ...
Add syntax for table addition
35,469
protected function addColumns ( $ fields ) { $ schema = [ ] ; foreach ( $ fields as $ field ) { $ schema [ ] = $ this -> addColumn ( $ field ) ; } return $ schema ; }
Return string for adding all columns
35,470
public function up ( array $ migrationData , array $ fields = [ ] ) { $ this -> guardAction ( $ migrationData [ 'action' ] ) ; $ method = $ migrationData [ 'action' ] . 'Factory' ; return $ this -> $ method ( $ migrationData , $ fields ) ; }
Build the string for the migration file up method
35,471
public function down ( array $ migrationData , $ fields = [ ] ) { $ this -> guardAction ( $ migrationData [ 'action' ] ) ; $ opposites = [ 'delete' => 'create' , 'create' => 'delete' , 'remove' => 'add' , 'add' => 'remove' ] ; $ method = $ opposites [ $ migrationData [ 'action' ] ] . 'Factory' ; return $ this -> $ meth...
Build the string for the migration file down method
35,472
public function remove ( $ migrationData , array $ fields ) { $ migrationData [ 'method' ] = 'table' ; $ compiled = $ this -> compiler -> compile ( $ this -> getTemplate ( ) , $ migrationData ) ; return $ this -> replaceFieldsWith ( $ this -> dropColumns ( $ fields ) , $ compiled ) ; }
Compile and return string for removing columns
35,473
protected function dropColumns ( array $ fields ) { $ schema = [ ] ; foreach ( $ fields as $ field ) { $ schema [ ] = $ this -> dropColumn ( $ field ) ; } return $ schema ; }
Return string for dropping all columns
35,474
public function fire ( ) { list ( $ tableOne , $ tableTwo ) = $ this -> sortDesiredTables ( ) ; $ this -> call ( 'generate:migration' , [ 'migrationName' => "create_{$tableOne}_{$tableTwo}_table" , '--fields' => $ this -> getMigrationFields ( $ tableOne , $ tableTwo ) ] ) ; }
Create a pivot table migration
35,475
public function fetch ( ) { return [ 'name' => $ this -> getName ( $ this -> controllerName ) , 'collection' => $ this -> getCollection ( ) , 'resource' => $ this -> getResource ( ) , 'model' => $ this -> getModel ( ) , 'namespace' => $ this -> getNamespace ( ) ] ; }
Fetch the template data for the controller .
35,476
protected function registerModel ( ) { $ this -> app [ 'generate.model' ] = $ this -> app -> share ( function ( $ app ) { $ generator = $ this -> app -> make ( 'Way\Generators\Generator' ) ; return new ModelGeneratorCommand ( $ generator ) ; } ) ; $ this -> commands ( 'generate.model' ) ; }
Register the model generator
35,477
protected function registerView ( ) { $ this -> app [ 'generate.view' ] = $ this -> app -> share ( function ( $ app ) { $ generator = $ this -> app -> make ( 'Way\Generators\Generator' ) ; return new ViewGeneratorCommand ( $ generator ) ; } ) ; $ this -> commands ( 'generate.view' ) ; }
Register the view generator
35,478
protected function registerController ( ) { $ this -> app [ 'generate.controller' ] = $ this -> app -> share ( function ( $ app ) { $ generator = $ this -> app -> make ( 'Way\Generators\Generator' ) ; return new ControllerGeneratorCommand ( $ generator ) ; } ) ; $ this -> commands ( 'generate.controller' ) ; }
Register the controller generator
35,479
protected function registerMigration ( ) { $ this -> app [ 'generate.migration' ] = $ this -> app -> share ( function ( $ app ) { return $ this -> app -> make ( 'Way\Generators\Commands\MigrationGeneratorCommand' ) ; } ) ; $ this -> commands ( 'generate.migration' ) ; }
Register the migration generator
35,480
protected function registerSeeder ( ) { $ this -> app [ 'generate.seeder' ] = $ this -> app -> share ( function ( $ app ) { $ generator = $ this -> app -> make ( 'Way\Generators\Generator' ) ; return new SeederGeneratorCommand ( $ generator ) ; } ) ; $ this -> commands ( 'generate.seeder' ) ; }
Register the seeder generator
35,481
protected function registerPivot ( ) { $ this -> app [ 'generate.pivot' ] = $ this -> app -> share ( function ( $ app ) { return new PivotGeneratorCommand ; } ) ; $ this -> commands ( 'generate.pivot' ) ; }
Register the pivot generator
35,482
protected function registerResource ( ) { $ this -> app [ 'generate.resource' ] = $ this -> app -> share ( function ( $ app ) { $ generator = $ this -> app -> make ( 'Way\Generators\Generator' ) ; return new ResourceGeneratorCommand ( $ generator ) ; } ) ; $ this -> commands ( 'generate.resource' ) ; }
Register the resource generator
35,483
public function registerpublisher ( ) { $ this -> app [ 'generate.publish-templates' ] = $ this -> app -> share ( function ( $ app ) { return new publishtemplatescommand ; } ) ; $ this -> commands ( 'generate.publish-templates' ) ; }
register command for publish templates
35,484
public function registerScaffold ( ) { $ this -> app [ 'generate.scaffold' ] = $ this -> app -> share ( function ( $ app ) { return new ScaffoldGeneratorCommand ; } ) ; $ this -> commands ( 'generate.scaffold' ) ; }
register scaffold command
35,485
public function fetch ( ) { $ parsedName = $ this -> getParsedMigrationName ( ) ; $ parsedFields = $ this -> getParsedMigrationFields ( ) ; return [ 'class' => $ this -> getClass ( ) , 'up' => $ this -> getMigrationUp ( $ parsedName , $ parsedFields ) , 'down' => $ this -> getMigrationDown ( $ parsedName , $ parsedFiel...
Fetch the template data for a migration generation .
35,486
protected function getTableName ( array $ pieces ) { $ tableName = [ ] ; foreach ( array_reverse ( $ pieces ) as $ piece ) { if ( in_array ( $ piece , [ 'to' , 'for' , 'on' , 'from' , 'into' ] ) ) break ; $ tableName [ ] = $ piece ; } return implode ( '_' , array_reverse ( $ tableName ) ) ; }
Determine what the table name should be
35,487
public function make ( $ templatePath , $ templateData , $ filePathToGenerate ) { $ template = $ this -> compile ( $ templatePath , $ templateData , new TemplateCompiler ) ; $ this -> file -> make ( $ filePathToGenerate , $ template ) ; }
Run the generator
35,488
public function compile ( $ templatePath , array $ data , TemplateCompiler $ compiler ) { return $ compiler -> compile ( $ this -> file -> get ( $ templatePath ) , $ data ) ; }
Compile the file
35,489
public function fire ( ) { $ directoryPath = dirname ( $ this -> getFileGenerationPath ( ) ) ; if ( ! File :: exists ( $ directoryPath ) ) { File :: makeDirectory ( $ directoryPath , 0777 , true ) ; } parent :: fire ( ) ; }
Create directory tree for views and fire the generator .
35,490
public function fire ( ) { $ filePathToGenerate = $ this -> getFileGenerationPath ( ) ; try { $ this -> generator -> make ( $ this -> getTemplatePath ( ) , $ this -> getTemplateData ( ) , $ filePathToGenerate ) ; $ this -> info ( "Created: {$filePathToGenerate}" ) ; } catch ( FileAlreadyExists $ e ) { $ this -> error (...
Compile and generate the file .
35,491
protected function getPathByOptionOrConfig ( $ option , $ configName ) { if ( $ path = $ this -> option ( $ option ) ) return $ path ; return Config :: get ( "generators::config.{$configName}" ) ; }
Get a directory path through a command option or from the configuration .
35,492
public function fire ( ) { $ resource = $ this -> argument ( 'resource' ) ; $ this -> callModel ( $ resource ) ; $ this -> callView ( $ resource ) ; $ this -> callController ( $ resource ) ; $ this -> callMigration ( $ resource ) ; $ this -> callSeeder ( $ resource ) ; $ this -> callMigrate ( ) ; $ this -> info ( sprin...
Generate a resource
35,493
protected function callView ( $ resource ) { $ collection = $ this -> getTableName ( $ resource ) ; $ modelName = $ this -> getModelName ( $ resource ) ; if ( $ this -> confirm ( "Do you want me to create views for this $modelName resource? [yes|no]" ) ) { foreach ( [ 'index' , 'show' , 'create' , 'edit' ] as $ viewNam...
Call view generator if user confirms
35,494
protected function callMigration ( $ resource ) { $ migrationName = $ this -> getMigrationName ( $ resource ) ; if ( $ this -> confirm ( "Do you want me to create a '$migrationName' migration and schema for this resource? [yes|no]" ) ) { $ this -> call ( 'generate:migration' , [ 'migrationName' => $ migrationName , '--...
Call migration generator if user confirms
35,495
protected function callSeeder ( $ resource ) { $ tableName = str_plural ( $ this -> getModelName ( $ resource ) ) ; if ( $ this -> confirm ( "Would you like a '$tableName' table seeder? [yes|no]" ) ) { $ this -> call ( 'generate:seed' , compact ( 'tableName' ) ) ; } }
Call seeder generator if user confirms
35,496
protected function pointConfigFileTemplatesToNewLocation ( ) { $ configPath = app_path ( 'config/packages/way/generators/config.php' ) ; $ updated = str_replace ( 'vendor/way/generators/src/Way/Generators/templates' , $ this -> option ( 'path' ) , File :: get ( $ configPath ) ) ; File :: put ( $ configPath , $ updated ...
Update config file to point to the new templates directory
35,497
public function create ( $ migrationData , $ fields ) { $ migrationData = [ 'method' => 'create' , 'table' => $ migrationData [ 'table' ] ] ; array_unshift ( $ fields , [ 'field' => 'id' , 'type' => 'increments' ] ) ; array_push ( $ fields , [ 'field' => '' , 'type' => 'timestamps' ] ) ; return ( new AddToTable ( $ thi...
Build string for creating a table and columns
35,498
public static function nested ( $ to = 1 ) { static :: $ to = $ to ; static :: $ nested = is_numeric ( $ to ) ? $ to : false ; return new self ( ) ; }
Set the nest type .
35,499
public function get ( ) { if ( static :: $ _instance instanceof Builder ) { $ this -> source = static :: $ _instance -> get ( ) ; } else { $ this -> source = parent :: all ( ) ; } if ( ! static :: $ nested ) { return $ this -> source ; } return $ this -> to ( static :: $ to ) ; }
Get the data from db to collection or default return .