id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
234,900
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getReportScheduleCount
public function getReportScheduleCount($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportScheduleCountRequest) { require_once ('MarketplaceWebService/Model/GetReportScheduleCountRequest.php'); $request = new MarketplaceWebService_Model_GetReportScheduleCountRequest($request); } require_once ('MarketplaceWebService/Model/GetReportScheduleCountResponse.php'); $httpResponse = $this->invoke($this->convertGetReportScheduleCount($request)); $response = MarketplaceWebService_Model_GetReportScheduleCountResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getReportScheduleCount($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportScheduleCountRequest) { require_once ('MarketplaceWebService/Model/GetReportScheduleCountRequest.php'); $request = new MarketplaceWebService_Model_GetReportScheduleCountRequest($request); } require_once ('MarketplaceWebService/Model/GetReportScheduleCountResponse.php'); $httpResponse = $this->invoke($this->convertGetReportScheduleCount($request)); $response = MarketplaceWebService_Model_GetReportScheduleCountResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getReportScheduleCount", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetReportScheduleCountRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetReportScheduleCountRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetReportScheduleCountRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetReportScheduleCountResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetReportScheduleCount", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetReportScheduleCountResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Report Schedule Count returns the number of report schedules @see http://docs.amazonwebservices.com/${docPath}GetReportScheduleCount.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetReportScheduleCountRequest request or MarketplaceWebService_Model_GetReportScheduleCountRequest object itself @see MarketplaceWebService_Model_GetReportScheduleCount @return MarketplaceWebService_Model_GetReportScheduleCountResponse MarketplaceWebService_Model_GetReportScheduleCountResponse @throws MarketplaceWebService_Exception
[ "Get", "Report", "Schedule", "Count", "returns", "the", "number", "of", "report", "schedules" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L288-L299
234,901
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.updateReportAcknowledgements
public function updateReportAcknowledgements($request) { if (!$request instanceof MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest) { require_once ('MarketplaceWebService/Model/UpdateReportAcknowledgementsRequest.php'); $request = new MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest($request); } require_once ('MarketplaceWebService/Model/UpdateReportAcknowledgementsResponse.php'); $httpResponse = $this->invoke($this->convertUpdateReportAcknowledgements($request)); $response = MarketplaceWebService_Model_UpdateReportAcknowledgementsResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function updateReportAcknowledgements($request) { if (!$request instanceof MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest) { require_once ('MarketplaceWebService/Model/UpdateReportAcknowledgementsRequest.php'); $request = new MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest($request); } require_once ('MarketplaceWebService/Model/UpdateReportAcknowledgementsResponse.php'); $httpResponse = $this->invoke($this->convertUpdateReportAcknowledgements($request)); $response = MarketplaceWebService_Model_UpdateReportAcknowledgementsResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "updateReportAcknowledgements", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/UpdateReportAcknowledgementsRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/UpdateReportAcknowledgementsResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertUpdateReportAcknowledgements", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_UpdateReportAcknowledgementsResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Update Report Acknowledgements The UpdateReportAcknowledgements operation updates the acknowledged status of one or more reports. @see http://docs.amazonwebservices.com/${docPath}UpdateReportAcknowledgements.html @param mixed $request array of parameters for MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest request or MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest object itself @see MarketplaceWebService_Model_UpdateReportAcknowledgements @return MarketplaceWebService_Model_UpdateReportAcknowledgementsResponse MarketplaceWebService_Model_UpdateReportAcknowledgementsResponse @throws MarketplaceWebService_Exception
[ "Update", "Report", "Acknowledgements", "The", "UpdateReportAcknowledgements", "operation", "updates", "the", "acknowledged", "status", "of", "one", "or", "more", "reports", "." ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L338-L349
234,902
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getReportCount
public function getReportCount($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportCountRequest) { require_once ('MarketplaceWebService/Model/GetReportCountRequest.php'); $request = new MarketplaceWebService_Model_GetReportCountRequest($request); } require_once ('MarketplaceWebService/Model/GetReportCountResponse.php'); $httpResponse = $this->invoke($this->convertGetReportCount($request)); $response = MarketplaceWebService_Model_GetReportCountResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getReportCount($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportCountRequest) { require_once ('MarketplaceWebService/Model/GetReportCountRequest.php'); $request = new MarketplaceWebService_Model_GetReportCountRequest($request); } require_once ('MarketplaceWebService/Model/GetReportCountResponse.php'); $httpResponse = $this->invoke($this->convertGetReportCount($request)); $response = MarketplaceWebService_Model_GetReportCountResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getReportCount", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetReportCountRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetReportCountRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetReportCountRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetReportCountResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetReportCount", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetReportCountResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Report Count returns a count of reports matching your criteria; by default, the number of reports generated in the last 90 days, regardless of acknowledgement status @see http://docs.amazonwebservices.com/${docPath}GetReportCount.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetReportCountRequest request or MarketplaceWebService_Model_GetReportCountRequest object itself @see MarketplaceWebService_Model_GetReportCount @return MarketplaceWebService_Model_GetReportCountResponse MarketplaceWebService_Model_GetReportCountResponse @throws MarketplaceWebService_Exception
[ "Get", "Report", "Count", "returns", "a", "count", "of", "reports", "matching", "your", "criteria", ";", "by", "default", "the", "number", "of", "reports", "generated", "in", "the", "last", "90", "days", "regardless", "of", "acknowledgement", "status" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L394-L405
234,903
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getFeedSubmissionListByNextToken
public function getFeedSubmissionListByNextToken($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionListByNextTokenRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionListByNextTokenResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionListByNextToken($request)); $response = MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getFeedSubmissionListByNextToken($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionListByNextTokenRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionListByNextTokenResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionListByNextToken($request)); $response = MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getFeedSubmissionListByNextToken", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionListByNextTokenRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionListByNextTokenResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetFeedSubmissionListByNextToken", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Feed Submission List By Next Token retrieve the next batch of list items and if there are more items to retrieve @see http://docs.amazonwebservices.com/${docPath}GetFeedSubmissionListByNextToken.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest request or MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenRequest object itself @see MarketplaceWebService_Model_GetFeedSubmissionListByNextToken @return MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenResponse MarketplaceWebService_Model_GetFeedSubmissionListByNextTokenResponse @throws MarketplaceWebService_Exception
[ "Get", "Feed", "Submission", "List", "By", "Next", "Token", "retrieve", "the", "next", "batch", "of", "list", "items", "and", "if", "there", "are", "more", "items", "to", "retrieve" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L419-L430
234,904
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.cancelFeedSubmissions
public function cancelFeedSubmissions($request) { if (!$request instanceof MarketplaceWebService_Model_CancelFeedSubmissionsRequest) { require_once ('MarketplaceWebService/Model/CancelFeedSubmissionsRequest.php'); $request = new MarketplaceWebService_Model_CancelFeedSubmissionsRequest($request); } require_once ('MarketplaceWebService/Model/CancelFeedSubmissionsResponse.php'); $httpResponse = $this->invoke($this->convertCancelFeedSubmissions($request)); $response = MarketplaceWebService_Model_CancelFeedSubmissionsResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function cancelFeedSubmissions($request) { if (!$request instanceof MarketplaceWebService_Model_CancelFeedSubmissionsRequest) { require_once ('MarketplaceWebService/Model/CancelFeedSubmissionsRequest.php'); $request = new MarketplaceWebService_Model_CancelFeedSubmissionsRequest($request); } require_once ('MarketplaceWebService/Model/CancelFeedSubmissionsResponse.php'); $httpResponse = $this->invoke($this->convertCancelFeedSubmissions($request)); $response = MarketplaceWebService_Model_CancelFeedSubmissionsResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "cancelFeedSubmissions", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_CancelFeedSubmissionsRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/CancelFeedSubmissionsRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_CancelFeedSubmissionsRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/CancelFeedSubmissionsResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertCancelFeedSubmissions", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_CancelFeedSubmissionsResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Cancel Feed Submissions cancels feed submissions - by default all of the submissions of the last 30 days that have not started processing @see http://docs.amazonwebservices.com/${docPath}CancelFeedSubmissions.html @param mixed $request array of parameters for MarketplaceWebService_Model_CancelFeedSubmissionsRequest request or MarketplaceWebService_Model_CancelFeedSubmissionsRequest object itself @see MarketplaceWebService_Model_CancelFeedSubmissions @return MarketplaceWebService_Model_CancelFeedSubmissionsResponse MarketplaceWebService_Model_CancelFeedSubmissionsResponse @throws MarketplaceWebService_Exception
[ "Cancel", "Feed", "Submissions", "cancels", "feed", "submissions", "-", "by", "default", "all", "of", "the", "submissions", "of", "the", "last", "30", "days", "that", "have", "not", "started", "processing" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L445-L456
234,905
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.requestReport
public function requestReport($request) { if (!$request instanceof MarketplaceWebService_Model_RequestReportRequest) { require_once ('MarketplaceWebService/Model/RequestReportRequest.php'); $request = new MarketplaceWebService_Model_RequestReportRequest($request); } require_once ('MarketplaceWebService/Model/RequestReportResponse.php'); $httpResponse = $this->invoke($this->convertRequestReport($request)); $response = MarketplaceWebService_Model_RequestReportResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function requestReport($request) { if (!$request instanceof MarketplaceWebService_Model_RequestReportRequest) { require_once ('MarketplaceWebService/Model/RequestReportRequest.php'); $request = new MarketplaceWebService_Model_RequestReportRequest($request); } require_once ('MarketplaceWebService/Model/RequestReportResponse.php'); $httpResponse = $this->invoke($this->convertRequestReport($request)); $response = MarketplaceWebService_Model_RequestReportResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "requestReport", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_RequestReportRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/RequestReportRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_RequestReportRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/RequestReportResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertRequestReport", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_RequestReportResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Request Report requests the generation of a report @see http://docs.amazonwebservices.com/${docPath}RequestReport.html @param mixed $request array of parameters for MarketplaceWebService_Model_RequestReportRequest request or MarketplaceWebService_Model_RequestReportRequest object itself @see MarketplaceWebService_Model_RequestReport @return MarketplaceWebService_Model_RequestReportResponse MarketplaceWebService_Model_RequestReportResponse @throws MarketplaceWebService_Exception
[ "Request", "Report", "requests", "the", "generation", "of", "a", "report" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L470-L481
234,906
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getFeedSubmissionCount
public function getFeedSubmissionCount($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionCountRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionCountRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionCountRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionCountResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionCount($request)); $response = MarketplaceWebService_Model_GetFeedSubmissionCountResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getFeedSubmissionCount($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionCountRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionCountRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionCountRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionCountResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionCount($request)); $response = MarketplaceWebService_Model_GetFeedSubmissionCountResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getFeedSubmissionCount", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetFeedSubmissionCountRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionCountRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetFeedSubmissionCountRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionCountResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetFeedSubmissionCount", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetFeedSubmissionCountResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Feed Submission Count returns the number of feeds matching all of the specified criteria @see http://docs.amazonwebservices.com/${docPath}GetFeedSubmissionCount.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetFeedSubmissionCountRequest request or MarketplaceWebService_Model_GetFeedSubmissionCountRequest object itself @see MarketplaceWebService_Model_GetFeedSubmissionCount @return MarketplaceWebService_Model_GetFeedSubmissionCountResponse MarketplaceWebService_Model_GetFeedSubmissionCountResponse @throws MarketplaceWebService_Exception
[ "Get", "Feed", "Submission", "Count", "returns", "the", "number", "of", "feeds", "matching", "all", "of", "the", "specified", "criteria" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L495-L506
234,907
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getReportList
public function getReportList($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportListRequest) { require_once ('MarketplaceWebService/Model/GetReportListRequest.php'); $request = new MarketplaceWebService_Model_GetReportListRequest($request); } require_once ('MarketplaceWebService/Model/GetReportListResponse.php'); $httpResponse = $this->invoke($this->convertGetReportList($request)); $response = MarketplaceWebService_Model_GetReportListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getReportList($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportListRequest) { require_once ('MarketplaceWebService/Model/GetReportListRequest.php'); $request = new MarketplaceWebService_Model_GetReportListRequest($request); } require_once ('MarketplaceWebService/Model/GetReportListResponse.php'); $httpResponse = $this->invoke($this->convertGetReportList($request)); $response = MarketplaceWebService_Model_GetReportListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getReportList", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetReportListRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetReportListRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetReportListRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetReportListResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetReportList", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetReportListResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Report List returns a list of reports; by default the most recent ten reports, regardless of their acknowledgement status @see http://docs.amazonwebservices.com/${docPath}GetReportList.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetReportListRequest request or MarketplaceWebService_Model_GetReportListRequest object itself @see MarketplaceWebService_Model_GetReportList @return MarketplaceWebService_Model_GetReportListResponse MarketplaceWebService_Model_GetReportListResponse @throws MarketplaceWebService_Exception
[ "Get", "Report", "List", "returns", "a", "list", "of", "reports", ";", "by", "default", "the", "most", "recent", "ten", "reports", "regardless", "of", "their", "acknowledgement", "status" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L547-L558
234,908
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getFeedSubmissionResult
public function getFeedSubmissionResult($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionResultRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionResultRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionResultResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionResult($request), $request->getFeedSubmissionResult()); $response = MarketplaceWebService_Model_GetFeedSubmissionResultResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getFeedSubmissionResult($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionResultRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionResultRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionResultResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionResult($request), $request->getFeedSubmissionResult()); $response = MarketplaceWebService_Model_GetFeedSubmissionResultResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getFeedSubmissionResult", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetFeedSubmissionResultRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionResultRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetFeedSubmissionResultRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionResultResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetFeedSubmissionResult", "(", "$", "request", ")", ",", "$", "request", "->", "getFeedSubmissionResult", "(", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetFeedSubmissionResultResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Feed Submission Result retrieves the feed processing report @see http://docs.amazonwebservices.com/${docPath}GetFeedSubmissionResult.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetFeedSubmissionResultRequest request or MarketplaceWebService_Model_GetFeedSubmissionResultRequest object itself @see MarketplaceWebService_Model_GetFeedSubmissionResult @return MarketplaceWebService_Model_GetFeedSubmissionResultResponse MarketplaceWebService_Model_GetFeedSubmissionResultResponse @throws MarketplaceWebService_Exception
[ "Get", "Feed", "Submission", "Result", "retrieves", "the", "feed", "processing", "report" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L572-L583
234,909
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getFeedSubmissionList
public function getFeedSubmissionList($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionListRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionListRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionListRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionListResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionList($request)); $response = MarketplaceWebService_Model_GetFeedSubmissionListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getFeedSubmissionList($request) { if (!$request instanceof MarketplaceWebService_Model_GetFeedSubmissionListRequest) { require_once ('MarketplaceWebService/Model/GetFeedSubmissionListRequest.php'); $request = new MarketplaceWebService_Model_GetFeedSubmissionListRequest($request); } require_once ('MarketplaceWebService/Model/GetFeedSubmissionListResponse.php'); $httpResponse = $this->invoke($this->convertGetFeedSubmissionList($request)); $response = MarketplaceWebService_Model_GetFeedSubmissionListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getFeedSubmissionList", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetFeedSubmissionListRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionListRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetFeedSubmissionListRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetFeedSubmissionListResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetFeedSubmissionList", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetFeedSubmissionListResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Feed Submission List returns a list of feed submission identifiers and their associated metadata @see http://docs.amazonwebservices.com/${docPath}GetFeedSubmissionList.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetFeedSubmissionListRequest request or MarketplaceWebService_Model_GetFeedSubmissionListRequest object itself @see MarketplaceWebService_Model_GetFeedSubmissionList @return MarketplaceWebService_Model_GetFeedSubmissionListResponse MarketplaceWebService_Model_GetFeedSubmissionListResponse @throws MarketplaceWebService_Exception
[ "Get", "Feed", "Submission", "List", "returns", "a", "list", "of", "feed", "submission", "identifiers", "and", "their", "associated", "metadata" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L597-L608
234,910
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getReportRequestList
public function getReportRequestList($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportRequestListRequest) { require_once ('MarketplaceWebService/Model/GetReportRequestListRequest.php'); $request = new MarketplaceWebService_Model_GetReportRequestListRequest($request); } require_once ('MarketplaceWebService/Model/GetReportRequestListResponse.php'); $httpResponse = $this->invoke($this->convertGetReportRequestList($request)); $response = MarketplaceWebService_Model_GetReportRequestListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getReportRequestList($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportRequestListRequest) { require_once ('MarketplaceWebService/Model/GetReportRequestListRequest.php'); $request = new MarketplaceWebService_Model_GetReportRequestListRequest($request); } require_once ('MarketplaceWebService/Model/GetReportRequestListResponse.php'); $httpResponse = $this->invoke($this->convertGetReportRequestList($request)); $response = MarketplaceWebService_Model_GetReportRequestListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getReportRequestList", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetReportRequestListRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetReportRequestListRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetReportRequestListRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetReportRequestListResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetReportRequestList", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetReportRequestListResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Report Request List returns a list of report requests ids and their associated metadata @see http://docs.amazonwebservices.com/${docPath}GetReportRequestList.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetReportRequestListRequest request or MarketplaceWebService_Model_GetReportRequestListRequest object itself @see MarketplaceWebService_Model_GetReportRequestList @return MarketplaceWebService_Model_GetReportRequestListResponse MarketplaceWebService_Model_GetReportRequestListResponse @throws MarketplaceWebService_Exception
[ "Get", "Report", "Request", "List", "returns", "a", "list", "of", "report", "requests", "ids", "and", "their", "associated", "metadata" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L622-L633
234,911
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getReportScheduleListByNextToken
public function getReportScheduleListByNextToken($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest) { require_once ('MarketplaceWebService/Model/GetReportScheduleListByNextTokenRequest.php'); $request = new MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest($request); } require_once ('MarketplaceWebService/Model/GetReportScheduleListByNextTokenResponse.php'); $httpResponse = $this->invoke($this->convertGetReportScheduleListByNextToken($request)); $response = MarketplaceWebService_Model_GetReportScheduleListByNextTokenResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getReportScheduleListByNextToken($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest) { require_once ('MarketplaceWebService/Model/GetReportScheduleListByNextTokenRequest.php'); $request = new MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest($request); } require_once ('MarketplaceWebService/Model/GetReportScheduleListByNextTokenResponse.php'); $httpResponse = $this->invoke($this->convertGetReportScheduleListByNextToken($request)); $response = MarketplaceWebService_Model_GetReportScheduleListByNextTokenResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getReportScheduleListByNextToken", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetReportScheduleListByNextTokenRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetReportScheduleListByNextTokenResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetReportScheduleListByNextToken", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetReportScheduleListByNextTokenResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Report Schedule List By Next Token retrieve the next batch of list items and if there are more items to retrieve @see http://docs.amazonwebservices.com/${docPath}GetReportScheduleListByNextToken.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest request or MarketplaceWebService_Model_GetReportScheduleListByNextTokenRequest object itself @see MarketplaceWebService_Model_GetReportScheduleListByNextToken @return MarketplaceWebService_Model_GetReportScheduleListByNextTokenResponse MarketplaceWebService_Model_GetReportScheduleListByNextTokenResponse @throws MarketplaceWebService_Exception
[ "Get", "Report", "Schedule", "List", "By", "Next", "Token", "retrieve", "the", "next", "batch", "of", "list", "items", "and", "if", "there", "are", "more", "items", "to", "retrieve" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L647-L658
234,912
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getReportListByNextToken
public function getReportListByNextToken($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportListByNextTokenRequest) { require_once ('MarketplaceWebService/Model/GetReportListByNextTokenRequest.php'); $request = new MarketplaceWebService_Model_GetReportListByNextTokenRequest($request); } require_once ('MarketplaceWebService/Model/GetReportListByNextTokenResponse.php'); $httpResponse = $this->invoke($this->convertGetReportListByNextToken($request)); $response = MarketplaceWebService_Model_GetReportListByNextTokenResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getReportListByNextToken($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportListByNextTokenRequest) { require_once ('MarketplaceWebService/Model/GetReportListByNextTokenRequest.php'); $request = new MarketplaceWebService_Model_GetReportListByNextTokenRequest($request); } require_once ('MarketplaceWebService/Model/GetReportListByNextTokenResponse.php'); $httpResponse = $this->invoke($this->convertGetReportListByNextToken($request)); $response = MarketplaceWebService_Model_GetReportListByNextTokenResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getReportListByNextToken", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetReportListByNextTokenRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetReportListByNextTokenRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetReportListByNextTokenRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetReportListByNextTokenResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetReportListByNextToken", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetReportListByNextTokenResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Report List By Next Token retrieve the next batch of list items and if there are more items to retrieve @see http://docs.amazonwebservices.com/${docPath}GetReportListByNextToken.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetReportListByNextTokenRequest request or MarketplaceWebService_Model_GetReportListByNextTokenRequest object itself @see MarketplaceWebService_Model_GetReportListByNextToken @return MarketplaceWebService_Model_GetReportListByNextTokenResponse MarketplaceWebService_Model_GetReportListByNextTokenResponse @throws MarketplaceWebService_Exception
[ "Get", "Report", "List", "By", "Next", "Token", "retrieve", "the", "next", "batch", "of", "list", "items", "and", "if", "there", "are", "more", "items", "to", "retrieve" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L672-L683
234,913
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.manageReportSchedule
public function manageReportSchedule($request) { if (!$request instanceof MarketplaceWebService_Model_ManageReportScheduleRequest) { require_once ('MarketplaceWebService/Model/ManageReportScheduleRequest.php'); $request = new MarketplaceWebService_Model_ManageReportScheduleRequest($request); } require_once ('MarketplaceWebService/Model/ManageReportScheduleResponse.php'); $httpResponse = $this->invoke($this->convertManageReportSchedule($request)); $response = MarketplaceWebService_Model_ManageReportScheduleResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function manageReportSchedule($request) { if (!$request instanceof MarketplaceWebService_Model_ManageReportScheduleRequest) { require_once ('MarketplaceWebService/Model/ManageReportScheduleRequest.php'); $request = new MarketplaceWebService_Model_ManageReportScheduleRequest($request); } require_once ('MarketplaceWebService/Model/ManageReportScheduleResponse.php'); $httpResponse = $this->invoke($this->convertManageReportSchedule($request)); $response = MarketplaceWebService_Model_ManageReportScheduleResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "manageReportSchedule", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_ManageReportScheduleRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/ManageReportScheduleRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_ManageReportScheduleRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/ManageReportScheduleResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertManageReportSchedule", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_ManageReportScheduleResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Manage Report Schedule Creates, updates, or deletes a report schedule for a given report type, such as order reports in particular. @see http://docs.amazonwebservices.com/${docPath}ManageReportSchedule.html @param mixed $request array of parameters for MarketplaceWebService_Model_ManageReportScheduleRequest request or MarketplaceWebService_Model_ManageReportScheduleRequest object itself @see MarketplaceWebService_Model_ManageReportSchedule @return MarketplaceWebService_Model_ManageReportScheduleResponse MarketplaceWebService_Model_ManageReportScheduleResponse @throws MarketplaceWebService_Exception
[ "Manage", "Report", "Schedule", "Creates", "updates", "or", "deletes", "a", "report", "schedule", "for", "a", "given", "report", "type", "such", "as", "order", "reports", "in", "particular", "." ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L698-L709
234,914
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getReportScheduleList
public function getReportScheduleList($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportScheduleListRequest) { require_once ('MarketplaceWebService/Model/GetReportScheduleListRequest.php'); $request = new MarketplaceWebService_Model_GetReportScheduleListRequest($request); } require_once ('MarketplaceWebService/Model/GetReportScheduleListResponse.php'); $httpResponse = $this->invoke($this->convertGetReportScheduleList($request)); $response = MarketplaceWebService_Model_GetReportScheduleListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
php
public function getReportScheduleList($request) { if (!$request instanceof MarketplaceWebService_Model_GetReportScheduleListRequest) { require_once ('MarketplaceWebService/Model/GetReportScheduleListRequest.php'); $request = new MarketplaceWebService_Model_GetReportScheduleListRequest($request); } require_once ('MarketplaceWebService/Model/GetReportScheduleListResponse.php'); $httpResponse = $this->invoke($this->convertGetReportScheduleList($request)); $response = MarketplaceWebService_Model_GetReportScheduleListResponse::fromXML($httpResponse['ResponseBody']); $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']); return $response; }
[ "public", "function", "getReportScheduleList", "(", "$", "request", ")", "{", "if", "(", "!", "$", "request", "instanceof", "MarketplaceWebService_Model_GetReportScheduleListRequest", ")", "{", "require_once", "(", "'MarketplaceWebService/Model/GetReportScheduleListRequest.php'", ")", ";", "$", "request", "=", "new", "MarketplaceWebService_Model_GetReportScheduleListRequest", "(", "$", "request", ")", ";", "}", "require_once", "(", "'MarketplaceWebService/Model/GetReportScheduleListResponse.php'", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "invoke", "(", "$", "this", "->", "convertGetReportScheduleList", "(", "$", "request", ")", ")", ";", "$", "response", "=", "MarketplaceWebService_Model_GetReportScheduleListResponse", "::", "fromXML", "(", "$", "httpResponse", "[", "'ResponseBody'", "]", ")", ";", "$", "response", "->", "setResponseHeaderMetadata", "(", "$", "httpResponse", "[", "'ResponseHeaderMetadata'", "]", ")", ";", "return", "$", "response", ";", "}" ]
Get Report Schedule List returns the list of report schedules @see http://docs.amazonwebservices.com/${docPath}GetReportScheduleList.html @param mixed $request array of parameters for MarketplaceWebService_Model_GetReportScheduleListRequest request or MarketplaceWebService_Model_GetReportScheduleListRequest object itself @see MarketplaceWebService_Model_GetReportScheduleList @return MarketplaceWebService_Model_GetReportScheduleListResponse MarketplaceWebService_Model_GetReportScheduleListResponse @throws MarketplaceWebService_Exception
[ "Get", "Report", "Schedule", "List", "returns", "the", "list", "of", "report", "schedules" ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L749-L760
234,915
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.performRequest
private function performRequest($action, array $converted, $dataHandle = null, $contentMd5 = null) { $curlOptions = $this->configureCurlOptions($action, $converted, $dataHandle, $contentMd5); if (is_null($curlOptions[CURLOPT_RETURNTRANSFER]) || !$curlOptions[CURLOPT_RETURNTRANSFER]) { $curlOptions[CURLOPT_RETURNTRANSFER] = true; } $this->curlClient = curl_init(); curl_setopt_array($this->curlClient, $curlOptions); $this->headerContents = @fopen('php://memory', 'rw+'); $this->errorResponseBody = @fopen('php://memory', 'rw+'); $httpResponse = curl_exec($this->curlClient); rewind($this->headerContents); $header = stream_get_contents($this->headerContents); $parsedHeader = $this->parseHttpHeader($header); require_once('MarketplaceWebService/Model/ResponseHeaderMetadata.php'); $responseHeaderMetadata = new MarketplaceWebService_Model_ResponseHeaderMetadata( $parsedHeader['x-mws-request-id'], $parsedHeader['x-mws-response-context'], $parsedHeader['x-mws-timestamp']); $code = (int) curl_getinfo($this->curlClient, CURLINFO_HTTP_CODE); // Only attempt to verify the Content-MD5 value if the request was successful. if (RequestType::getRequestType($action) === RequestType::POST_DOWNLOAD) { if ($code != 200) { rewind($this->errorResponseBody); $httpResponse = stream_get_contents($this->errorResponseBody); } else { $this->verifyContentMd5($this->getParsedHeader($parsedHeader,'Content-MD5'), $dataHandle); $httpResponse = $this->getDownloadResponseDocument($action, $parsedHeader); } } // Cleanup open streams and cURL instance. @fclose($this->headerContents); @fclose($this->errorResponseBody); curl_close($this->curlClient); return array ( 'Status' => $code, 'ResponseBody' => $httpResponse, 'ResponseHeaderMetadata' => $responseHeaderMetadata); }
php
private function performRequest($action, array $converted, $dataHandle = null, $contentMd5 = null) { $curlOptions = $this->configureCurlOptions($action, $converted, $dataHandle, $contentMd5); if (is_null($curlOptions[CURLOPT_RETURNTRANSFER]) || !$curlOptions[CURLOPT_RETURNTRANSFER]) { $curlOptions[CURLOPT_RETURNTRANSFER] = true; } $this->curlClient = curl_init(); curl_setopt_array($this->curlClient, $curlOptions); $this->headerContents = @fopen('php://memory', 'rw+'); $this->errorResponseBody = @fopen('php://memory', 'rw+'); $httpResponse = curl_exec($this->curlClient); rewind($this->headerContents); $header = stream_get_contents($this->headerContents); $parsedHeader = $this->parseHttpHeader($header); require_once('MarketplaceWebService/Model/ResponseHeaderMetadata.php'); $responseHeaderMetadata = new MarketplaceWebService_Model_ResponseHeaderMetadata( $parsedHeader['x-mws-request-id'], $parsedHeader['x-mws-response-context'], $parsedHeader['x-mws-timestamp']); $code = (int) curl_getinfo($this->curlClient, CURLINFO_HTTP_CODE); // Only attempt to verify the Content-MD5 value if the request was successful. if (RequestType::getRequestType($action) === RequestType::POST_DOWNLOAD) { if ($code != 200) { rewind($this->errorResponseBody); $httpResponse = stream_get_contents($this->errorResponseBody); } else { $this->verifyContentMd5($this->getParsedHeader($parsedHeader,'Content-MD5'), $dataHandle); $httpResponse = $this->getDownloadResponseDocument($action, $parsedHeader); } } // Cleanup open streams and cURL instance. @fclose($this->headerContents); @fclose($this->errorResponseBody); curl_close($this->curlClient); return array ( 'Status' => $code, 'ResponseBody' => $httpResponse, 'ResponseHeaderMetadata' => $responseHeaderMetadata); }
[ "private", "function", "performRequest", "(", "$", "action", ",", "array", "$", "converted", ",", "$", "dataHandle", "=", "null", ",", "$", "contentMd5", "=", "null", ")", "{", "$", "curlOptions", "=", "$", "this", "->", "configureCurlOptions", "(", "$", "action", ",", "$", "converted", ",", "$", "dataHandle", ",", "$", "contentMd5", ")", ";", "if", "(", "is_null", "(", "$", "curlOptions", "[", "CURLOPT_RETURNTRANSFER", "]", ")", "||", "!", "$", "curlOptions", "[", "CURLOPT_RETURNTRANSFER", "]", ")", "{", "$", "curlOptions", "[", "CURLOPT_RETURNTRANSFER", "]", "=", "true", ";", "}", "$", "this", "->", "curlClient", "=", "curl_init", "(", ")", ";", "curl_setopt_array", "(", "$", "this", "->", "curlClient", ",", "$", "curlOptions", ")", ";", "$", "this", "->", "headerContents", "=", "@", "fopen", "(", "'php://memory'", ",", "'rw+'", ")", ";", "$", "this", "->", "errorResponseBody", "=", "@", "fopen", "(", "'php://memory'", ",", "'rw+'", ")", ";", "$", "httpResponse", "=", "curl_exec", "(", "$", "this", "->", "curlClient", ")", ";", "rewind", "(", "$", "this", "->", "headerContents", ")", ";", "$", "header", "=", "stream_get_contents", "(", "$", "this", "->", "headerContents", ")", ";", "$", "parsedHeader", "=", "$", "this", "->", "parseHttpHeader", "(", "$", "header", ")", ";", "require_once", "(", "'MarketplaceWebService/Model/ResponseHeaderMetadata.php'", ")", ";", "$", "responseHeaderMetadata", "=", "new", "MarketplaceWebService_Model_ResponseHeaderMetadata", "(", "$", "parsedHeader", "[", "'x-mws-request-id'", "]", ",", "$", "parsedHeader", "[", "'x-mws-response-context'", "]", ",", "$", "parsedHeader", "[", "'x-mws-timestamp'", "]", ")", ";", "$", "code", "=", "(", "int", ")", "curl_getinfo", "(", "$", "this", "->", "curlClient", ",", "CURLINFO_HTTP_CODE", ")", ";", "// Only attempt to verify the Content-MD5 value if the request was successful.", "if", "(", "RequestType", "::", "getRequestType", "(", "$", "action", ")", "===", "RequestType", "::", "POST_DOWNLOAD", ")", "{", "if", "(", "$", "code", "!=", "200", ")", "{", "rewind", "(", "$", "this", "->", "errorResponseBody", ")", ";", "$", "httpResponse", "=", "stream_get_contents", "(", "$", "this", "->", "errorResponseBody", ")", ";", "}", "else", "{", "$", "this", "->", "verifyContentMd5", "(", "$", "this", "->", "getParsedHeader", "(", "$", "parsedHeader", ",", "'Content-MD5'", ")", ",", "$", "dataHandle", ")", ";", "$", "httpResponse", "=", "$", "this", "->", "getDownloadResponseDocument", "(", "$", "action", ",", "$", "parsedHeader", ")", ";", "}", "}", "// Cleanup open streams and cURL instance.", "@", "fclose", "(", "$", "this", "->", "headerContents", ")", ";", "@", "fclose", "(", "$", "this", "->", "errorResponseBody", ")", ";", "curl_close", "(", "$", "this", "->", "curlClient", ")", ";", "return", "array", "(", "'Status'", "=>", "$", "code", ",", "'ResponseBody'", "=>", "$", "httpResponse", ",", "'ResponseHeaderMetadata'", "=>", "$", "responseHeaderMetadata", ")", ";", "}" ]
Setup and execute the request via cURL and return the server response. @param $action - the MWS action to perform. @param $parameters - the MWS parameters for the Action. @param $dataHandle - A stream handle to either a feed to upload, or a report/feed submission result to download. @param $contentMd5 - The Content-MD5 HTTP header value used for feed submissions. @return array
[ "Setup", "and", "execute", "the", "request", "via", "cURL", "and", "return", "the", "server", "response", "." ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L903-L953
234,916
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.verifyContentMd5
private function verifyContentMd5($receivedMd5Hash, $streamHandle) { rewind($streamHandle); $expectedMd5Hash = $this->getContentMd5($streamHandle); rewind($streamHandle); if (!($receivedMd5Hash === $expectedMd5Hash)) { require_once ('MarketplaceWebService/Exception.php'); throw new MarketplaceWebService_Exception( array( 'Message' => 'Received Content-MD5 = ' . $receivedMd5Hash . ' but expected ' . $expectedMd5Hash, 'ErrorCode' => 'ContentMD5DoesNotMatch')); } }
php
private function verifyContentMd5($receivedMd5Hash, $streamHandle) { rewind($streamHandle); $expectedMd5Hash = $this->getContentMd5($streamHandle); rewind($streamHandle); if (!($receivedMd5Hash === $expectedMd5Hash)) { require_once ('MarketplaceWebService/Exception.php'); throw new MarketplaceWebService_Exception( array( 'Message' => 'Received Content-MD5 = ' . $receivedMd5Hash . ' but expected ' . $expectedMd5Hash, 'ErrorCode' => 'ContentMD5DoesNotMatch')); } }
[ "private", "function", "verifyContentMd5", "(", "$", "receivedMd5Hash", ",", "$", "streamHandle", ")", "{", "rewind", "(", "$", "streamHandle", ")", ";", "$", "expectedMd5Hash", "=", "$", "this", "->", "getContentMd5", "(", "$", "streamHandle", ")", ";", "rewind", "(", "$", "streamHandle", ")", ";", "if", "(", "!", "(", "$", "receivedMd5Hash", "===", "$", "expectedMd5Hash", ")", ")", "{", "require_once", "(", "'MarketplaceWebService/Exception.php'", ")", ";", "throw", "new", "MarketplaceWebService_Exception", "(", "array", "(", "'Message'", "=>", "'Received Content-MD5 = '", ".", "$", "receivedMd5Hash", ".", "' but expected '", ".", "$", "expectedMd5Hash", ",", "'ErrorCode'", "=>", "'ContentMD5DoesNotMatch'", ")", ")", ";", "}", "}" ]
Compares the received Content-MD5 Hash value from the response with a locally calculated value based on the contents of the response body. If the received hash value doesn't match the locally calculated hash value, an exception is raised. @param $receivedMd5Hash @param $streamHandle @return unknown_type
[ "Compares", "the", "received", "Content", "-", "MD5", "Hash", "value", "from", "the", "response", "with", "a", "locally", "calculated", "value", "based", "on", "the", "contents", "of", "the", "response", "body", ".", "If", "the", "received", "hash", "value", "doesn", "t", "match", "the", "locally", "calculated", "hash", "value", "an", "exception", "is", "raised", "." ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L968-L980
234,917
tremendus/amazon-mws
src/MarketplaceWebService/Client.php
MarketplaceWebService_Client.getFormattedTimestamp
private function getFormattedTimestamp($dateTime) { if (!is_object($dateTime)) { if (is_string($dateTime)) { $dateTime = new DateTime($dateTime); } else { throw new Exception("Invalid date value."); } } else { if (!($dateTime instanceof DateTime)) { throw new Exception("Invalid date value."); } } return $dateTime->format(DATE_ISO8601); }
php
private function getFormattedTimestamp($dateTime) { if (!is_object($dateTime)) { if (is_string($dateTime)) { $dateTime = new DateTime($dateTime); } else { throw new Exception("Invalid date value."); } } else { if (!($dateTime instanceof DateTime)) { throw new Exception("Invalid date value."); } } return $dateTime->format(DATE_ISO8601); }
[ "private", "function", "getFormattedTimestamp", "(", "$", "dateTime", ")", "{", "if", "(", "!", "is_object", "(", "$", "dateTime", ")", ")", "{", "if", "(", "is_string", "(", "$", "dateTime", ")", ")", "{", "$", "dateTime", "=", "new", "DateTime", "(", "$", "dateTime", ")", ";", "}", "else", "{", "throw", "new", "Exception", "(", "\"Invalid date value.\"", ")", ";", "}", "}", "else", "{", "if", "(", "!", "(", "$", "dateTime", "instanceof", "DateTime", ")", ")", "{", "throw", "new", "Exception", "(", "\"Invalid date value.\"", ")", ";", "}", "}", "return", "$", "dateTime", "->", "format", "(", "DATE_ISO8601", ")", ";", "}" ]
Returns a ISO 8601 formatted string from a DateTime instance.
[ "Returns", "a", "ISO", "8601", "formatted", "string", "from", "a", "DateTime", "instance", "." ]
465312b0b75fb91ff9ae4ce63b6c299b6f7e030d
https://github.com/tremendus/amazon-mws/blob/465312b0b75fb91ff9ae4ce63b6c299b6f7e030d/src/MarketplaceWebService/Client.php#L1296-L1310
234,918
shpasser/GaeSupport
src/Shpasser/GaeSupport/Setup/Configurator.php
Configurator.replaceAppClass
protected function replaceAppClass($start_php) { $contents = file_get_contents($start_php); $modified = str_replace( 'Illuminate\Foundation\Application', 'Shpasser\GaeSupport\Foundation\Application', $contents); if ($modified === $contents) { return; } $this->createBackupFile($start_php); file_put_contents($start_php, $modified); $this->myCommand->info('Replaced the application class in "start.php".'); }
php
protected function replaceAppClass($start_php) { $contents = file_get_contents($start_php); $modified = str_replace( 'Illuminate\Foundation\Application', 'Shpasser\GaeSupport\Foundation\Application', $contents); if ($modified === $contents) { return; } $this->createBackupFile($start_php); file_put_contents($start_php, $modified); $this->myCommand->info('Replaced the application class in "start.php".'); }
[ "protected", "function", "replaceAppClass", "(", "$", "start_php", ")", "{", "$", "contents", "=", "file_get_contents", "(", "$", "start_php", ")", ";", "$", "modified", "=", "str_replace", "(", "'Illuminate\\Foundation\\Application'", ",", "'Shpasser\\GaeSupport\\Foundation\\Application'", ",", "$", "contents", ")", ";", "if", "(", "$", "modified", "===", "$", "contents", ")", "{", "return", ";", "}", "$", "this", "->", "createBackupFile", "(", "$", "start_php", ")", ";", "file_put_contents", "(", "$", "start_php", ",", "$", "modified", ")", ";", "$", "this", "->", "myCommand", "->", "info", "(", "'Replaced the application class in \"start.php\".'", ")", ";", "}" ]
Replaces the Laravel application class with the one compatible with GAE. @param string $start_php the 'bootstrap/start.php' file path.
[ "Replaces", "the", "Laravel", "application", "class", "with", "the", "one", "compatible", "with", "GAE", "." ]
7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3
https://github.com/shpasser/GaeSupport/blob/7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3/src/Shpasser/GaeSupport/Setup/Configurator.php#L57-L76
234,919
shpasser/GaeSupport
src/Shpasser/GaeSupport/Setup/Configurator.php
Configurator.replaceLaravelServiceProviders
protected function replaceLaravelServiceProviders($app_php) { $contents = file_get_contents($app_php); $strings = [ 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Queue\QueueServiceProvider' ]; // Replacement to: // - additionally support Google App Engine Queues, // - additionally support Google App Engine Mail. $replacements = [ 'Shpasser\GaeSupport\Mail\GaeMailServiceProvider', 'Shpasser\GaeSupport\Queue\QueueServiceProvider' ]; $modified = str_replace($strings, $replacements, $contents); if ($modified === $contents) { return; } $this->createBackupFile($app_php); file_put_contents($app_php, $modified); $this->myCommand->info('Replaced the service providers in "app.php".'); }
php
protected function replaceLaravelServiceProviders($app_php) { $contents = file_get_contents($app_php); $strings = [ 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Queue\QueueServiceProvider' ]; // Replacement to: // - additionally support Google App Engine Queues, // - additionally support Google App Engine Mail. $replacements = [ 'Shpasser\GaeSupport\Mail\GaeMailServiceProvider', 'Shpasser\GaeSupport\Queue\QueueServiceProvider' ]; $modified = str_replace($strings, $replacements, $contents); if ($modified === $contents) { return; } $this->createBackupFile($app_php); file_put_contents($app_php, $modified); $this->myCommand->info('Replaced the service providers in "app.php".'); }
[ "protected", "function", "replaceLaravelServiceProviders", "(", "$", "app_php", ")", "{", "$", "contents", "=", "file_get_contents", "(", "$", "app_php", ")", ";", "$", "strings", "=", "[", "'Illuminate\\Mail\\MailServiceProvider'", ",", "'Illuminate\\Queue\\QueueServiceProvider'", "]", ";", "// Replacement to:", "// - additionally support Google App Engine Queues,", "// - additionally support Google App Engine Mail.", "$", "replacements", "=", "[", "'Shpasser\\GaeSupport\\Mail\\GaeMailServiceProvider'", ",", "'Shpasser\\GaeSupport\\Queue\\QueueServiceProvider'", "]", ";", "$", "modified", "=", "str_replace", "(", "$", "strings", ",", "$", "replacements", ",", "$", "contents", ")", ";", "if", "(", "$", "modified", "===", "$", "contents", ")", "{", "return", ";", "}", "$", "this", "->", "createBackupFile", "(", "$", "app_php", ")", ";", "file_put_contents", "(", "$", "app_php", ",", "$", "modified", ")", ";", "$", "this", "->", "myCommand", "->", "info", "(", "'Replaced the service providers in \"app.php\".'", ")", ";", "}" ]
Replaces the Laravel service providers with GAE compatible ones. @param string $app_php the Laravel 'app/config/app.php' file path.
[ "Replaces", "the", "Laravel", "service", "providers", "with", "GAE", "compatible", "ones", "." ]
7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3
https://github.com/shpasser/GaeSupport/blob/7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3/src/Shpasser/GaeSupport/Setup/Configurator.php#L84-L113
234,920
shpasser/GaeSupport
src/Shpasser/GaeSupport/Setup/Configurator.php
Configurator.generateProductionConfig
protected function generateProductionConfig($productionDir) { if (file_exists($productionDir)) { $overwrite = $this->myCommand->confirm( 'Overwrite the existing production config files?', false ); if ( ! $overwrite) { return; } } else { mkdir($productionDir); } $configTemplatesPath = __DIR__.'/templates/config'; $configFiles = [ 'cache.php', 'mail.php', 'queue.php', 'session.php' ]; foreach ($configFiles as $filename) { $srcPath = "{$configTemplatesPath}/{$filename}"; $destPath = "{$productionDir}/{$filename}"; copy($srcPath, $destPath); } $this->myCommand->info('Generated production config files.'); }
php
protected function generateProductionConfig($productionDir) { if (file_exists($productionDir)) { $overwrite = $this->myCommand->confirm( 'Overwrite the existing production config files?', false ); if ( ! $overwrite) { return; } } else { mkdir($productionDir); } $configTemplatesPath = __DIR__.'/templates/config'; $configFiles = [ 'cache.php', 'mail.php', 'queue.php', 'session.php' ]; foreach ($configFiles as $filename) { $srcPath = "{$configTemplatesPath}/{$filename}"; $destPath = "{$productionDir}/{$filename}"; copy($srcPath, $destPath); } $this->myCommand->info('Generated production config files.'); }
[ "protected", "function", "generateProductionConfig", "(", "$", "productionDir", ")", "{", "if", "(", "file_exists", "(", "$", "productionDir", ")", ")", "{", "$", "overwrite", "=", "$", "this", "->", "myCommand", "->", "confirm", "(", "'Overwrite the existing production config files?'", ",", "false", ")", ";", "if", "(", "!", "$", "overwrite", ")", "{", "return", ";", "}", "}", "else", "{", "mkdir", "(", "$", "productionDir", ")", ";", "}", "$", "configTemplatesPath", "=", "__DIR__", ".", "'/templates/config'", ";", "$", "configFiles", "=", "[", "'cache.php'", ",", "'mail.php'", ",", "'queue.php'", ",", "'session.php'", "]", ";", "foreach", "(", "$", "configFiles", "as", "$", "filename", ")", "{", "$", "srcPath", "=", "\"{$configTemplatesPath}/{$filename}\"", ";", "$", "destPath", "=", "\"{$productionDir}/{$filename}\"", ";", "copy", "(", "$", "srcPath", ",", "$", "destPath", ")", ";", "}", "$", "this", "->", "myCommand", "->", "info", "(", "'Generated production config files.'", ")", ";", "}" ]
Generates the configuration files for a Laravel GAE app. @param string $productionDir the Laravel 'app/config' dir path.
[ "Generates", "the", "configuration", "files", "for", "a", "Laravel", "GAE", "app", "." ]
7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3
https://github.com/shpasser/GaeSupport/blob/7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3/src/Shpasser/GaeSupport/Setup/Configurator.php#L121-L155
234,921
shpasser/GaeSupport
src/Shpasser/GaeSupport/Setup/Configurator.php
Configurator.commentOutDefaultLogInit
protected function commentOutDefaultLogInit($global_php) { $find = "Log::useFiles(storage_path().'/logs/laravel.log');"; $replace = "/* Log initialization moved to 'app/start/local.php' and 'app/start/production.php' files. */"; $contents = file_get_contents($global_php); $modified = str_replace($find, $replace, $contents); if ($modified === $contents) { return; } $this->createBackupFile($global_php); file_put_contents($global_php, $modified); $this->myCommand->info('Commented out the default log initialization code in "global.php".'); }
php
protected function commentOutDefaultLogInit($global_php) { $find = "Log::useFiles(storage_path().'/logs/laravel.log');"; $replace = "/* Log initialization moved to 'app/start/local.php' and 'app/start/production.php' files. */"; $contents = file_get_contents($global_php); $modified = str_replace($find, $replace, $contents); if ($modified === $contents) { return; } $this->createBackupFile($global_php); file_put_contents($global_php, $modified); $this->myCommand->info('Commented out the default log initialization code in "global.php".'); }
[ "protected", "function", "commentOutDefaultLogInit", "(", "$", "global_php", ")", "{", "$", "find", "=", "\"Log::useFiles(storage_path().'/logs/laravel.log');\"", ";", "$", "replace", "=", "\"/* Log initialization moved to 'app/start/local.php' and 'app/start/production.php' files. */\"", ";", "$", "contents", "=", "file_get_contents", "(", "$", "global_php", ")", ";", "$", "modified", "=", "str_replace", "(", "$", "find", ",", "$", "replace", ",", "$", "contents", ")", ";", "if", "(", "$", "modified", "===", "$", "contents", ")", "{", "return", ";", "}", "$", "this", "->", "createBackupFile", "(", "$", "global_php", ")", ";", "file_put_contents", "(", "$", "global_php", ",", "$", "modified", ")", ";", "$", "this", "->", "myCommand", "->", "info", "(", "'Commented out the default log initialization code in \"global.php\".'", ")", ";", "}" ]
Comments out the default log initialization code. @param string $global_php the Laravel 'app/start/global.php' file path.
[ "Comments", "out", "the", "default", "log", "initialization", "code", "." ]
7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3
https://github.com/shpasser/GaeSupport/blob/7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3/src/Shpasser/GaeSupport/Setup/Configurator.php#L163-L182
234,922
shpasser/GaeSupport
src/Shpasser/GaeSupport/Setup/Configurator.php
Configurator.generateLogInit
protected function generateLogInit($startDir) { $startTemplatesPath = __DIR__.'/templates/start'; $startFiles = [ 'local.php', 'production.php' ]; foreach ($startFiles as $filename) { $srcPath = "{$startTemplatesPath}/{$filename}"; $destPath = "{$startDir}/{$filename}"; if (file_exists($destPath)) { $overwrite = $this->myCommand->confirm( "Overwrite the existing {$destPath} file?", false ); if ( ! $overwrite) { continue; } $this->createBackupFile($destPath); } copy($srcPath, $destPath); } $this->myCommand->info('Generated the log initialization files.'); }
php
protected function generateLogInit($startDir) { $startTemplatesPath = __DIR__.'/templates/start'; $startFiles = [ 'local.php', 'production.php' ]; foreach ($startFiles as $filename) { $srcPath = "{$startTemplatesPath}/{$filename}"; $destPath = "{$startDir}/{$filename}"; if (file_exists($destPath)) { $overwrite = $this->myCommand->confirm( "Overwrite the existing {$destPath} file?", false ); if ( ! $overwrite) { continue; } $this->createBackupFile($destPath); } copy($srcPath, $destPath); } $this->myCommand->info('Generated the log initialization files.'); }
[ "protected", "function", "generateLogInit", "(", "$", "startDir", ")", "{", "$", "startTemplatesPath", "=", "__DIR__", ".", "'/templates/start'", ";", "$", "startFiles", "=", "[", "'local.php'", ",", "'production.php'", "]", ";", "foreach", "(", "$", "startFiles", "as", "$", "filename", ")", "{", "$", "srcPath", "=", "\"{$startTemplatesPath}/{$filename}\"", ";", "$", "destPath", "=", "\"{$startDir}/{$filename}\"", ";", "if", "(", "file_exists", "(", "$", "destPath", ")", ")", "{", "$", "overwrite", "=", "$", "this", "->", "myCommand", "->", "confirm", "(", "\"Overwrite the existing {$destPath} file?\"", ",", "false", ")", ";", "if", "(", "!", "$", "overwrite", ")", "{", "continue", ";", "}", "$", "this", "->", "createBackupFile", "(", "$", "destPath", ")", ";", "}", "copy", "(", "$", "srcPath", ",", "$", "destPath", ")", ";", "}", "$", "this", "->", "myCommand", "->", "info", "(", "'Generated the log initialization files.'", ")", ";", "}" ]
Generates the log initialization for a Laravel GAE app. @param string $startDir the Laravel 'app/start' directory path.
[ "Generates", "the", "log", "initialization", "for", "a", "Laravel", "GAE", "app", "." ]
7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3
https://github.com/shpasser/GaeSupport/blob/7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3/src/Shpasser/GaeSupport/Setup/Configurator.php#L190-L222
234,923
shpasser/GaeSupport
src/Shpasser/GaeSupport/Setup/Configurator.php
Configurator.generateAppYaml
protected function generateAppYaml($appId, $filePath, $publicPath) { if (file_exists($filePath)) { $overwrite = $this->myCommand->confirm( 'Overwrite the existing "app.yaml" file?', false ); if ( ! $overwrite) { return; } } $contents = <<<EOT application: {$appId} version: 1 runtime: php api_version: 1 handlers: - url: /favicon\.ico static_files: public/favicon.ico upload: public/favicon\.ico EOT; $ending = <<<EOT - url: /.* script: public/index.php skip_files: - ^(.*/)?#.*#$ - ^(.*/)?.*~$ - ^(.*/)?.*\.py[co]$ - ^(.*/)?.*/RCS/.*$ - ^(.*/)?\.(?!env\.php).*$ - ^(.*/)?node_modules.*$ - ^(.*/)?_ide_helper\.php$ EOT; foreach (new \DirectoryIterator($publicPath) as $fileInfo) { if($fileInfo->isDot() || ! $fileInfo->isDir()) { continue; } $dirName = $fileInfo->getFilename(); $pathMapping = <<<EOT - url: /{$dirName} static_dir: public/{$dirName} EOT; $contents .= PHP_EOL.$pathMapping; } $contents .= PHP_EOL.$ending; file_put_contents($filePath, $contents); $this->myCommand->info('Generated the "app.yaml" file.'); }
php
protected function generateAppYaml($appId, $filePath, $publicPath) { if (file_exists($filePath)) { $overwrite = $this->myCommand->confirm( 'Overwrite the existing "app.yaml" file?', false ); if ( ! $overwrite) { return; } } $contents = <<<EOT application: {$appId} version: 1 runtime: php api_version: 1 handlers: - url: /favicon\.ico static_files: public/favicon.ico upload: public/favicon\.ico EOT; $ending = <<<EOT - url: /.* script: public/index.php skip_files: - ^(.*/)?#.*#$ - ^(.*/)?.*~$ - ^(.*/)?.*\.py[co]$ - ^(.*/)?.*/RCS/.*$ - ^(.*/)?\.(?!env\.php).*$ - ^(.*/)?node_modules.*$ - ^(.*/)?_ide_helper\.php$ EOT; foreach (new \DirectoryIterator($publicPath) as $fileInfo) { if($fileInfo->isDot() || ! $fileInfo->isDir()) { continue; } $dirName = $fileInfo->getFilename(); $pathMapping = <<<EOT - url: /{$dirName} static_dir: public/{$dirName} EOT; $contents .= PHP_EOL.$pathMapping; } $contents .= PHP_EOL.$ending; file_put_contents($filePath, $contents); $this->myCommand->info('Generated the "app.yaml" file.'); }
[ "protected", "function", "generateAppYaml", "(", "$", "appId", ",", "$", "filePath", ",", "$", "publicPath", ")", "{", "if", "(", "file_exists", "(", "$", "filePath", ")", ")", "{", "$", "overwrite", "=", "$", "this", "->", "myCommand", "->", "confirm", "(", "'Overwrite the existing \"app.yaml\" file?'", ",", "false", ")", ";", "if", "(", "!", "$", "overwrite", ")", "{", "return", ";", "}", "}", "$", "contents", "=", "\n<<<EOT\napplication: {$appId}\nversion: 1\nruntime: php\napi_version: 1\n\nhandlers:\n - url: /favicon\\.ico\n static_files: public/favicon.ico\n upload: public/favicon\\.ico\n\nEOT", ";", "$", "ending", "=", "\n<<<EOT\n - url: /.*\n script: public/index.php\n\nskip_files:\n - ^(.*/)?#.*#$\n - ^(.*/)?.*~$\n - ^(.*/)?.*\\.py[co]$\n - ^(.*/)?.*/RCS/.*$\n - ^(.*/)?\\.(?!env\\.php).*$\n - ^(.*/)?node_modules.*$\n - ^(.*/)?_ide_helper\\.php$\nEOT", ";", "foreach", "(", "new", "\\", "DirectoryIterator", "(", "$", "publicPath", ")", "as", "$", "fileInfo", ")", "{", "if", "(", "$", "fileInfo", "->", "isDot", "(", ")", "||", "!", "$", "fileInfo", "->", "isDir", "(", ")", ")", "{", "continue", ";", "}", "$", "dirName", "=", "$", "fileInfo", "->", "getFilename", "(", ")", ";", "$", "pathMapping", "=", "\n<<<EOT\n - url: /{$dirName}\n static_dir: public/{$dirName}\n\nEOT", ";", "$", "contents", ".=", "PHP_EOL", ".", "$", "pathMapping", ";", "}", "$", "contents", ".=", "PHP_EOL", ".", "$", "ending", ";", "file_put_contents", "(", "$", "filePath", ",", "$", "contents", ")", ";", "$", "this", "->", "myCommand", "->", "info", "(", "'Generated the \"app.yaml\" file.'", ")", ";", "}" ]
Generates a "app.yaml" file for a GAE app. @param string $appId the GAE app id. @param string $filePath the 'app.yaml' file path. @param string $publicPath the application public dir path.
[ "Generates", "a", "app", ".", "yaml", "file", "for", "a", "GAE", "app", "." ]
7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3
https://github.com/shpasser/GaeSupport/blob/7f37f2bf177a4e8f1cbefdf04f49b51016e85ae3/src/Shpasser/GaeSupport/Setup/Configurator.php#L231-L296
234,924
makinacorpus/drupal-ucms
ucms_search/src/Search.php
Search.createFacet
public function createFacet($field, $values = null, $operator = Query::OP_OR, $parameterName = null, $isPostFilter = false) { return $this->aggregations[] = (new TermFacet($field, $operator, $parameterName, $isPostFilter))->setSelectedValues($values); }
php
public function createFacet($field, $values = null, $operator = Query::OP_OR, $parameterName = null, $isPostFilter = false) { return $this->aggregations[] = (new TermFacet($field, $operator, $parameterName, $isPostFilter))->setSelectedValues($values); }
[ "public", "function", "createFacet", "(", "$", "field", ",", "$", "values", "=", "null", ",", "$", "operator", "=", "Query", "::", "OP_OR", ",", "$", "parameterName", "=", "null", ",", "$", "isPostFilter", "=", "false", ")", "{", "return", "$", "this", "->", "aggregations", "[", "]", "=", "(", "new", "TermFacet", "(", "$", "field", ",", "$", "operator", ",", "$", "parameterName", ",", "$", "isPostFilter", ")", ")", "->", "setSelectedValues", "(", "$", "values", ")", ";", "}" ]
Add facet aggregation @param string $field Field name if different from the name @param mixed[] $currentValues Current values for filtering if any @param boolean $filter Filter aggregation will filter the result before running the aggregation while global aggregation will always return values for the whole index priori to filtering @param string $operator Operator to use for filtering (Query::OP_OR or Query::OP_AND) @param string $parameterName Facet query parameter name if different from field name @param boolean $isPostFilter Tell if the current facet filter should apply after query @return TermFacet
[ "Add", "facet", "aggregation" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Search.php#L353-L356
234,925
makinacorpus/drupal-ucms
ucms_search/src/Search.php
Search.buildAggQueryData
private function buildAggQueryData($query) { $ret = []; foreach ($this->aggregations as $agg) { $additions = $agg->buildQueryData($this, $query); if ($additions) { $ret = array_merge($ret, $additions); } } return $ret; }
php
private function buildAggQueryData($query) { $ret = []; foreach ($this->aggregations as $agg) { $additions = $agg->buildQueryData($this, $query); if ($additions) { $ret = array_merge($ret, $additions); } } return $ret; }
[ "private", "function", "buildAggQueryData", "(", "$", "query", ")", "{", "$", "ret", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "aggregations", "as", "$", "agg", ")", "{", "$", "additions", "=", "$", "agg", "->", "buildQueryData", "(", "$", "this", ",", "$", "query", ")", ";", "if", "(", "$", "additions", ")", "{", "$", "ret", "=", "array_merge", "(", "$", "ret", ",", "$", "additions", ")", ";", "}", "}", "return", "$", "ret", ";", "}" ]
Build aggregations query data @return string[]
[ "Build", "aggregations", "query", "data" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Search.php#L409-L421
234,926
makinacorpus/drupal-ucms
ucms_search/src/Search.php
Search.prepare
private function prepare($query) { foreach ($this->aggregations as $agg) { $agg->prepareQuery($this, $query); } // Handle paging $this->setPage( $this->getQueryParam($query, $this->pageParameterName, 0) + $this->pageDelta ); }
php
private function prepare($query) { foreach ($this->aggregations as $agg) { $agg->prepareQuery($this, $query); } // Handle paging $this->setPage( $this->getQueryParam($query, $this->pageParameterName, 0) + $this->pageDelta ); }
[ "private", "function", "prepare", "(", "$", "query", ")", "{", "foreach", "(", "$", "this", "->", "aggregations", "as", "$", "agg", ")", "{", "$", "agg", "->", "prepareQuery", "(", "$", "this", ",", "$", "query", ")", ";", "}", "// Handle paging", "$", "this", "->", "setPage", "(", "$", "this", "->", "getQueryParam", "(", "$", "query", ",", "$", "this", "->", "pageParameterName", ",", "0", ")", "+", "$", "this", "->", "pageDelta", ")", ";", "}" ]
Prepare current search using the incomming query @param string[] $query
[ "Prepare", "current", "search", "using", "the", "incomming", "query" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Search.php#L428-L439
234,927
makinacorpus/drupal-ucms
ucms_search/src/Search.php
Search.fixSmartSearch
private function fixSmartSearch($value) { // // OK, this needs some bits of explaination. We have the following behavior: // // - in a site, there's a lot of city names in text, // - lots are "Saint-Something", // - when the client types "Saint A" in the search query, all // "Saint Something" will match, and "Saint" will have a higher // score than "A", // // To fix this, we convert every "any number of words" queries to: // // @todo separate with the first 2 // "any number of words"^20 or "any number"^20 or (any number of words)^1 // // Which literally means: // // "The phrase with all the words in the right order matches 10 times // more score than those with all the words placed anywhere in any // order." // // And it does seem to fix it, now "Saint A" comes first in the results // instead of being lowered than text with many times the name "Saint". // $value = trim($value); if (\preg_match('/^[^\+\(\)"]+$/ims', $value)) { return '"'.$value.'"^10 or ('.$value.')^1'; } return $value; }
php
private function fixSmartSearch($value) { // // OK, this needs some bits of explaination. We have the following behavior: // // - in a site, there's a lot of city names in text, // - lots are "Saint-Something", // - when the client types "Saint A" in the search query, all // "Saint Something" will match, and "Saint" will have a higher // score than "A", // // To fix this, we convert every "any number of words" queries to: // // @todo separate with the first 2 // "any number of words"^20 or "any number"^20 or (any number of words)^1 // // Which literally means: // // "The phrase with all the words in the right order matches 10 times // more score than those with all the words placed anywhere in any // order." // // And it does seem to fix it, now "Saint A" comes first in the results // instead of being lowered than text with many times the name "Saint". // $value = trim($value); if (\preg_match('/^[^\+\(\)"]+$/ims', $value)) { return '"'.$value.'"^10 or ('.$value.')^1'; } return $value; }
[ "private", "function", "fixSmartSearch", "(", "$", "value", ")", "{", "//", "// OK, this needs some bits of explaination. We have the following behavior:", "//", "// - in a site, there's a lot of city names in text,", "// - lots are \"Saint-Something\",", "// - when the client types \"Saint A\" in the search query, all", "// \"Saint Something\" will match, and \"Saint\" will have a higher", "// score than \"A\",", "//", "// To fix this, we convert every \"any number of words\" queries to:", "//", "// @todo separate with the first 2", "// \"any number of words\"^20 or \"any number\"^20 or (any number of words)^1", "//", "// Which literally means:", "//", "// \"The phrase with all the words in the right order matches 10 times", "// more score than those with all the words placed anywhere in any", "// order.\"", "//", "// And it does seem to fix it, now \"Saint A\" comes first in the results", "// instead of being lowered than text with many times the name \"Saint\".", "//", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "\\", "preg_match", "(", "'/^[^\\+\\(\\)\"]+$/ims'", ",", "$", "value", ")", ")", "{", "return", "'\"'", ".", "$", "value", ".", "'\"^10 or ('", ".", "$", "value", ".", "')^1'", ";", "}", "return", "$", "value", ";", "}" ]
Be smart, attempt to fix what the user wrote.
[ "Be", "smart", "attempt", "to", "fix", "what", "the", "user", "wrote", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Search.php#L444-L476
234,928
makinacorpus/drupal-ucms
ucms_search/src/Search.php
Search.doSearch
public function doSearch($query = []) { if (!$this->index) { throw new \RuntimeException("You must set an index"); } $this->prepare($query); // Only process query when there is a value, in order to avoid sending // an empty query string to ElasticSearch, its API is so weird that we // probably would end up with exceptions $value = $this->getQueryParam($query, $this->fulltextParameterName); if ($value) { $isQueryEmpty = false; $queryPart = [ 'query_string' => [ 'query' => $this->fixSmartSearch((string)$value), 'fields' => $this->fulltextFields, ], ]; if ($this->fulltextAnalyzer) { $queryPart['query_string']['analyzer'] = $this->fulltextAnalyzer; } } else { $isQueryEmpty = true; $queryPart = []; } // This must be set before filter since filter query will be altered by // the applied aggregations $aggs = $this->buildAggQueryData($query); if (count($this->filterQuery)) { if ($isQueryEmpty) { $body = [ 'query' => [ 'constant_score' => [ 'filter' => [ 'fquery' => [ 'query' => [ 'query_string' => [ 'query' => (string)$this->filterQuery ], ], // @todo Without this ElasticSearch seems to // throw exceptions... '_cache' => true, ], ], ], ], ]; } else { $body = [ 'query' => [ 'filtered' => [ 'query' => $queryPart, 'filter' => [ 'fquery' => [ 'query' => [ 'query_string' => [ 'query' => (string)$this->filterQuery ], ], // @todo Without this ElasticSearch seems to // throw exceptions... '_cache' => true, ], ], ], ], ]; } } else { if ($isQueryEmpty) { $body = [ 'query' => [ 'match_all' => [] ], ]; } else { $body = [ 'query' => $queryPart, ]; } } if (count($this->postFilterQuery)) { $body['post_filter']['query_string']['query'] = (string)$this->postFilterQuery; } if ($aggs) { $body['aggs'] = $aggs; } /* if ($this->fields) { $body['fields'] = $this->fields; }*/ if (count($this->sortFields)) { foreach ($this->sortFields as $sort) { $body['sort'][] = $sort->getSortStructure(); } } $data = [ 'index' => $this->index, 'type' => 'node', 'body' => $body, ]; if (!empty($this->limit)) { $data['size'] = $this->limit; if (!empty($this->page)) { $data['from'] = max([0, $this->page - 1]) * $this->limit; } } return new Response($this, $this->client->search($data)); }
php
public function doSearch($query = []) { if (!$this->index) { throw new \RuntimeException("You must set an index"); } $this->prepare($query); // Only process query when there is a value, in order to avoid sending // an empty query string to ElasticSearch, its API is so weird that we // probably would end up with exceptions $value = $this->getQueryParam($query, $this->fulltextParameterName); if ($value) { $isQueryEmpty = false; $queryPart = [ 'query_string' => [ 'query' => $this->fixSmartSearch((string)$value), 'fields' => $this->fulltextFields, ], ]; if ($this->fulltextAnalyzer) { $queryPart['query_string']['analyzer'] = $this->fulltextAnalyzer; } } else { $isQueryEmpty = true; $queryPart = []; } // This must be set before filter since filter query will be altered by // the applied aggregations $aggs = $this->buildAggQueryData($query); if (count($this->filterQuery)) { if ($isQueryEmpty) { $body = [ 'query' => [ 'constant_score' => [ 'filter' => [ 'fquery' => [ 'query' => [ 'query_string' => [ 'query' => (string)$this->filterQuery ], ], // @todo Without this ElasticSearch seems to // throw exceptions... '_cache' => true, ], ], ], ], ]; } else { $body = [ 'query' => [ 'filtered' => [ 'query' => $queryPart, 'filter' => [ 'fquery' => [ 'query' => [ 'query_string' => [ 'query' => (string)$this->filterQuery ], ], // @todo Without this ElasticSearch seems to // throw exceptions... '_cache' => true, ], ], ], ], ]; } } else { if ($isQueryEmpty) { $body = [ 'query' => [ 'match_all' => [] ], ]; } else { $body = [ 'query' => $queryPart, ]; } } if (count($this->postFilterQuery)) { $body['post_filter']['query_string']['query'] = (string)$this->postFilterQuery; } if ($aggs) { $body['aggs'] = $aggs; } /* if ($this->fields) { $body['fields'] = $this->fields; }*/ if (count($this->sortFields)) { foreach ($this->sortFields as $sort) { $body['sort'][] = $sort->getSortStructure(); } } $data = [ 'index' => $this->index, 'type' => 'node', 'body' => $body, ]; if (!empty($this->limit)) { $data['size'] = $this->limit; if (!empty($this->page)) { $data['from'] = max([0, $this->page - 1]) * $this->limit; } } return new Response($this, $this->client->search($data)); }
[ "public", "function", "doSearch", "(", "$", "query", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "index", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "\"You must set an index\"", ")", ";", "}", "$", "this", "->", "prepare", "(", "$", "query", ")", ";", "// Only process query when there is a value, in order to avoid sending", "// an empty query string to ElasticSearch, its API is so weird that we", "// probably would end up with exceptions", "$", "value", "=", "$", "this", "->", "getQueryParam", "(", "$", "query", ",", "$", "this", "->", "fulltextParameterName", ")", ";", "if", "(", "$", "value", ")", "{", "$", "isQueryEmpty", "=", "false", ";", "$", "queryPart", "=", "[", "'query_string'", "=>", "[", "'query'", "=>", "$", "this", "->", "fixSmartSearch", "(", "(", "string", ")", "$", "value", ")", ",", "'fields'", "=>", "$", "this", "->", "fulltextFields", ",", "]", ",", "]", ";", "if", "(", "$", "this", "->", "fulltextAnalyzer", ")", "{", "$", "queryPart", "[", "'query_string'", "]", "[", "'analyzer'", "]", "=", "$", "this", "->", "fulltextAnalyzer", ";", "}", "}", "else", "{", "$", "isQueryEmpty", "=", "true", ";", "$", "queryPart", "=", "[", "]", ";", "}", "// This must be set before filter since filter query will be altered by", "// the applied aggregations", "$", "aggs", "=", "$", "this", "->", "buildAggQueryData", "(", "$", "query", ")", ";", "if", "(", "count", "(", "$", "this", "->", "filterQuery", ")", ")", "{", "if", "(", "$", "isQueryEmpty", ")", "{", "$", "body", "=", "[", "'query'", "=>", "[", "'constant_score'", "=>", "[", "'filter'", "=>", "[", "'fquery'", "=>", "[", "'query'", "=>", "[", "'query_string'", "=>", "[", "'query'", "=>", "(", "string", ")", "$", "this", "->", "filterQuery", "]", ",", "]", ",", "// @todo Without this ElasticSearch seems to", "// throw exceptions...", "'_cache'", "=>", "true", ",", "]", ",", "]", ",", "]", ",", "]", ",", "]", ";", "}", "else", "{", "$", "body", "=", "[", "'query'", "=>", "[", "'filtered'", "=>", "[", "'query'", "=>", "$", "queryPart", ",", "'filter'", "=>", "[", "'fquery'", "=>", "[", "'query'", "=>", "[", "'query_string'", "=>", "[", "'query'", "=>", "(", "string", ")", "$", "this", "->", "filterQuery", "]", ",", "]", ",", "// @todo Without this ElasticSearch seems to", "// throw exceptions...", "'_cache'", "=>", "true", ",", "]", ",", "]", ",", "]", ",", "]", ",", "]", ";", "}", "}", "else", "{", "if", "(", "$", "isQueryEmpty", ")", "{", "$", "body", "=", "[", "'query'", "=>", "[", "'match_all'", "=>", "[", "]", "]", ",", "]", ";", "}", "else", "{", "$", "body", "=", "[", "'query'", "=>", "$", "queryPart", ",", "]", ";", "}", "}", "if", "(", "count", "(", "$", "this", "->", "postFilterQuery", ")", ")", "{", "$", "body", "[", "'post_filter'", "]", "[", "'query_string'", "]", "[", "'query'", "]", "=", "(", "string", ")", "$", "this", "->", "postFilterQuery", ";", "}", "if", "(", "$", "aggs", ")", "{", "$", "body", "[", "'aggs'", "]", "=", "$", "aggs", ";", "}", "/*\n if ($this->fields) {\n $body['fields'] = $this->fields;\n }*/", "if", "(", "count", "(", "$", "this", "->", "sortFields", ")", ")", "{", "foreach", "(", "$", "this", "->", "sortFields", "as", "$", "sort", ")", "{", "$", "body", "[", "'sort'", "]", "[", "]", "=", "$", "sort", "->", "getSortStructure", "(", ")", ";", "}", "}", "$", "data", "=", "[", "'index'", "=>", "$", "this", "->", "index", ",", "'type'", "=>", "'node'", ",", "'body'", "=>", "$", "body", ",", "]", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "limit", ")", ")", "{", "$", "data", "[", "'size'", "]", "=", "$", "this", "->", "limit", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "page", ")", ")", "{", "$", "data", "[", "'from'", "]", "=", "max", "(", "[", "0", ",", "$", "this", "->", "page", "-", "1", "]", ")", "*", "$", "this", "->", "limit", ";", "}", "}", "return", "new", "Response", "(", "$", "this", ",", "$", "this", "->", "client", "->", "search", "(", "$", "data", ")", ")", ";", "}" ]
Run the search and return the response @param string[] $query Incomming query
[ "Run", "the", "search", "and", "return", "the", "response" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/Search.php#L484-L606
234,929
index0h/yii2-phar
src/iterators/Iterator.php
Iterator.createFile
protected function createFile() { $event = new FileEvent([ 'realPath' => $this->iterator->current(), 'relativePath' => $this->iterator->getRelativePath() ]); $this->module->trigger(Module::EVENT_PROCESS_FILE, $event); $this->file = $event; }
php
protected function createFile() { $event = new FileEvent([ 'realPath' => $this->iterator->current(), 'relativePath' => $this->iterator->getRelativePath() ]); $this->module->trigger(Module::EVENT_PROCESS_FILE, $event); $this->file = $event; }
[ "protected", "function", "createFile", "(", ")", "{", "$", "event", "=", "new", "FileEvent", "(", "[", "'realPath'", "=>", "$", "this", "->", "iterator", "->", "current", "(", ")", ",", "'relativePath'", "=>", "$", "this", "->", "iterator", "->", "getRelativePath", "(", ")", "]", ")", ";", "$", "this", "->", "module", "->", "trigger", "(", "Module", "::", "EVENT_PROCESS_FILE", ",", "$", "event", ")", ";", "$", "this", "->", "file", "=", "$", "event", ";", "}" ]
Create file event and trigger in from module.
[ "Create", "file", "event", "and", "trigger", "in", "from", "module", "." ]
dc347242cca028affec78718b35fd22a34e2d3b8
https://github.com/index0h/yii2-phar/blob/dc347242cca028affec78718b35fd22a34e2d3b8/src/iterators/Iterator.php#L134-L144
234,930
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.setDbTable
private function setDbTable() { if (isset($this->table) && $this->table != null) { $this->dbTable = $this->table; } else { $classModel = get_called_class(); $classModelExplode = explode('\\', $classModel); $tableSnakePlural = Str::snakePlural(end($classModelExplode)); $this->dbTable = Config::get()['prefix'].$tableSnakePlural; } }
php
private function setDbTable() { if (isset($this->table) && $this->table != null) { $this->dbTable = $this->table; } else { $classModel = get_called_class(); $classModelExplode = explode('\\', $classModel); $tableSnakePlural = Str::snakePlural(end($classModelExplode)); $this->dbTable = Config::get()['prefix'].$tableSnakePlural; } }
[ "private", "function", "setDbTable", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "table", ")", "&&", "$", "this", "->", "table", "!=", "null", ")", "{", "$", "this", "->", "dbTable", "=", "$", "this", "->", "table", ";", "}", "else", "{", "$", "classModel", "=", "get_called_class", "(", ")", ";", "$", "classModelExplode", "=", "explode", "(", "'\\\\'", ",", "$", "classModel", ")", ";", "$", "tableSnakePlural", "=", "Str", "::", "snakePlural", "(", "end", "(", "$", "classModelExplode", ")", ")", ";", "$", "this", "->", "dbTable", "=", "Config", "::", "get", "(", ")", "[", "'prefix'", "]", ".", "$", "tableSnakePlural", ";", "}", "}" ]
Modifier table avec prefix _Si le nom de la table est précisée dans Model enfant : Récupérer manuellement nom de la table avec propriétée "table" dans Model enfant _Si non : Récupérer dynamiquement nom de la table selon nom du Model enfant (nom de la table doit être nom de la classe au pluriel)
[ "Modifier", "table", "avec", "prefix" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L136-L146
234,931
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.callFindBy
private function callFindBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 6, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); return $this->where($whereBy, '=', $arguments[0])->find(); }
php
private function callFindBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 6, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); return $this->where($whereBy, '=', $arguments[0])->find(); }
[ "private", "function", "callFindBy", "(", "string", "$", "method", ",", "array", "$", "arguments", ")", "{", "$", "whereByWithUpper", "=", "lcfirst", "(", "substr", "(", "$", "method", ",", "6", ",", "mb_strlen", "(", "$", "method", ")", ")", ")", ";", "$", "whereBy", "=", "Str", "::", "convertCamelCaseToSnakeCase", "(", "$", "whereByWithUpper", ")", ";", "return", "$", "this", "->", "where", "(", "$", "whereBy", ",", "'='", ",", "$", "arguments", "[", "0", "]", ")", "->", "find", "(", ")", ";", "}" ]
Find WHERE une condition @param string $method @param array $arguments @return $this
[ "Find", "WHERE", "une", "condition" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L185-L191
234,932
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.callFindOrFailBy
private function callFindOrFailBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 12, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); return $this->where($whereBy, '=', $arguments[0])->findOrFail(); }
php
private function callFindOrFailBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 12, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); return $this->where($whereBy, '=', $arguments[0])->findOrFail(); }
[ "private", "function", "callFindOrFailBy", "(", "string", "$", "method", ",", "array", "$", "arguments", ")", "{", "$", "whereByWithUpper", "=", "lcfirst", "(", "substr", "(", "$", "method", ",", "12", ",", "mb_strlen", "(", "$", "method", ")", ")", ")", ";", "$", "whereBy", "=", "Str", "::", "convertCamelCaseToSnakeCase", "(", "$", "whereByWithUpper", ")", ";", "return", "$", "this", "->", "where", "(", "$", "whereBy", ",", "'='", ",", "$", "arguments", "[", "0", "]", ")", "->", "findOrFail", "(", ")", ";", "}" ]
Find ou erreur HTTP 404 WHERE une condition @param string $method @param array $arguments @return $this
[ "Find", "ou", "erreur", "HTTP", "404", "WHERE", "une", "condition" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L200-L206
234,933
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.callFindAllBy
private function callFindAllBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 9, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); return $this->where($whereBy, '=', $arguments[0])->findAll(); }
php
private function callFindAllBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 9, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); return $this->where($whereBy, '=', $arguments[0])->findAll(); }
[ "private", "function", "callFindAllBy", "(", "string", "$", "method", ",", "array", "$", "arguments", ")", "{", "$", "whereByWithUpper", "=", "lcfirst", "(", "substr", "(", "$", "method", ",", "9", ",", "mb_strlen", "(", "$", "method", ")", ")", ")", ";", "$", "whereBy", "=", "Str", "::", "convertCamelCaseToSnakeCase", "(", "$", "whereByWithUpper", ")", ";", "return", "$", "this", "->", "where", "(", "$", "whereBy", ",", "'='", ",", "$", "arguments", "[", "0", "]", ")", "->", "findAll", "(", ")", ";", "}" ]
Find all WHERE une condition @param string $method @param array $arguments @return array
[ "Find", "all", "WHERE", "une", "condition" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L215-L221
234,934
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.callCountBy
private function callCountBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 7, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); $column = (isset($arguments[1])) ? $arguments[1] : '*'; return $this->where($whereBy, '=', $arguments[0])->count($column); }
php
private function callCountBy(string $method, array $arguments) { $whereByWithUpper = lcfirst(substr($method, 7, mb_strlen($method))); $whereBy = Str::convertCamelCaseToSnakeCase($whereByWithUpper); $column = (isset($arguments[1])) ? $arguments[1] : '*'; return $this->where($whereBy, '=', $arguments[0])->count($column); }
[ "private", "function", "callCountBy", "(", "string", "$", "method", ",", "array", "$", "arguments", ")", "{", "$", "whereByWithUpper", "=", "lcfirst", "(", "substr", "(", "$", "method", ",", "7", ",", "mb_strlen", "(", "$", "method", ")", ")", ")", ";", "$", "whereBy", "=", "Str", "::", "convertCamelCaseToSnakeCase", "(", "$", "whereByWithUpper", ")", ";", "$", "column", "=", "(", "isset", "(", "$", "arguments", "[", "1", "]", ")", ")", "?", "$", "arguments", "[", "1", "]", ":", "'*'", ";", "return", "$", "this", "->", "where", "(", "$", "whereBy", ",", "'='", ",", "$", "arguments", "[", "0", "]", ")", "->", "count", "(", "$", "column", ")", ";", "}" ]
Count WHERE une condition @param string $method @param array $arguments @return int
[ "Count", "WHERE", "une", "condition" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L230-L238
234,935
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.callError404
private function callError404() { list($controller, $method) = explode('@', Config::get()['error404']); if (!class_exists($controller)) { throw new OrmException('Class "'.$controller.'" not found.'); } $controllerInstantiate = new $controller(); if (!method_exists($controllerInstantiate, $method)) { throw new OrmException('Method "'.$method.'" not found in '.$controller.'.'); } return $controllerInstantiate->$method(); }
php
private function callError404() { list($controller, $method) = explode('@', Config::get()['error404']); if (!class_exists($controller)) { throw new OrmException('Class "'.$controller.'" not found.'); } $controllerInstantiate = new $controller(); if (!method_exists($controllerInstantiate, $method)) { throw new OrmException('Method "'.$method.'" not found in '.$controller.'.'); } return $controllerInstantiate->$method(); }
[ "private", "function", "callError404", "(", ")", "{", "list", "(", "$", "controller", ",", "$", "method", ")", "=", "explode", "(", "'@'", ",", "Config", "::", "get", "(", ")", "[", "'error404'", "]", ")", ";", "if", "(", "!", "class_exists", "(", "$", "controller", ")", ")", "{", "throw", "new", "OrmException", "(", "'Class \"'", ".", "$", "controller", ".", "'\" not found.'", ")", ";", "}", "$", "controllerInstantiate", "=", "new", "$", "controller", "(", ")", ";", "if", "(", "!", "method_exists", "(", "$", "controllerInstantiate", ",", "$", "method", ")", ")", "{", "throw", "new", "OrmException", "(", "'Method \"'", ".", "$", "method", ".", "'\" not found in '", ".", "$", "controller", ".", "'.'", ")", ";", "}", "return", "$", "controllerInstantiate", "->", "$", "method", "(", ")", ";", "}" ]
Appeler l'action d'erreur HTTP 404 @throws OrmException @return mixed
[ "Appeler", "l", "action", "d", "erreur", "HTTP", "404" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L516-L531
234,936
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.find
final public function find(int $id = null) { $result = $this->first($id); if (!$result) { return null; } $this->setProperties($result); return $this; }
php
final public function find(int $id = null) { $result = $this->first($id); if (!$result) { return null; } $this->setProperties($result); return $this; }
[ "final", "public", "function", "find", "(", "int", "$", "id", "=", "null", ")", "{", "$", "result", "=", "$", "this", "->", "first", "(", "$", "id", ")", ";", "if", "(", "!", "$", "result", ")", "{", "return", "null", ";", "}", "$", "this", "->", "setProperties", "(", "$", "result", ")", ";", "return", "$", "this", ";", "}" ]
Pour les requetes SQL qui retournent une seule ligne @param int|null $id @return $this|null - Object hydraté
[ "Pour", "les", "requetes", "SQL", "qui", "retournent", "une", "seule", "ligne" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L539-L550
234,937
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.findAll
final public function findAll() { $this->query->setStartSelect(); $this->query->prepare()->bindWhere()->bindLimit()->execute(); $this->setRowCount(); $collection = new Collection($this, $this->query->getSqlQuery()); $this->query->close(); return $collection(); }
php
final public function findAll() { $this->query->setStartSelect(); $this->query->prepare()->bindWhere()->bindLimit()->execute(); $this->setRowCount(); $collection = new Collection($this, $this->query->getSqlQuery()); $this->query->close(); return $collection(); }
[ "final", "public", "function", "findAll", "(", ")", "{", "$", "this", "->", "query", "->", "setStartSelect", "(", ")", ";", "$", "this", "->", "query", "->", "prepare", "(", ")", "->", "bindWhere", "(", ")", "->", "bindLimit", "(", ")", "->", "execute", "(", ")", ";", "$", "this", "->", "setRowCount", "(", ")", ";", "$", "collection", "=", "new", "Collection", "(", "$", "this", ",", "$", "this", "->", "query", "->", "getSqlQuery", "(", ")", ")", ";", "$", "this", "->", "query", "->", "close", "(", ")", ";", "return", "$", "collection", "(", ")", ";", "}" ]
Pour les requetes SQL qui retournent plusieurs lignes @return array - Un tableaux d'objets hydratés du model
[ "Pour", "les", "requetes", "SQL", "qui", "retournent", "plusieurs", "lignes" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L580-L593
234,938
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.fill
final public function fill(array $data) { // Si dans les keys de $data il les valeurs de $fillable, assigner foreach ($this->fillable as $property) { if (array_key_exists($property, $data)){ $method = 'set'.ucfirst(Str::convertSnakeCaseToCamelCase($property)); $this->assignProperty($method, $property, $data[$property]); } } }
php
final public function fill(array $data) { // Si dans les keys de $data il les valeurs de $fillable, assigner foreach ($this->fillable as $property) { if (array_key_exists($property, $data)){ $method = 'set'.ucfirst(Str::convertSnakeCaseToCamelCase($property)); $this->assignProperty($method, $property, $data[$property]); } } }
[ "final", "public", "function", "fill", "(", "array", "$", "data", ")", "{", "// Si dans les keys de $data il les valeurs de $fillable, assigner\r", "foreach", "(", "$", "this", "->", "fillable", "as", "$", "property", ")", "{", "if", "(", "array_key_exists", "(", "$", "property", ",", "$", "data", ")", ")", "{", "$", "method", "=", "'set'", ".", "ucfirst", "(", "Str", "::", "convertSnakeCaseToCamelCase", "(", "$", "property", ")", ")", ";", "$", "this", "->", "assignProperty", "(", "$", "method", ",", "$", "property", ",", "$", "data", "[", "$", "property", "]", ")", ";", "}", "}", "}" ]
Pour assigner en masse @param array $data
[ "Pour", "assigner", "en", "masse" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L699-L709
234,939
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.create
final public function create(array $data) { $this->query->setStartInsert($data); $this->query->prepare()->bindValuesForInsert($data)->execute(); $this->setRowCount(); $this->query->close(); }
php
final public function create(array $data) { $this->query->setStartInsert($data); $this->query->prepare()->bindValuesForInsert($data)->execute(); $this->setRowCount(); $this->query->close(); }
[ "final", "public", "function", "create", "(", "array", "$", "data", ")", "{", "$", "this", "->", "query", "->", "setStartInsert", "(", "$", "data", ")", ";", "$", "this", "->", "query", "->", "prepare", "(", ")", "->", "bindValuesForInsert", "(", "$", "data", ")", "->", "execute", "(", ")", ";", "$", "this", "->", "setRowCount", "(", ")", ";", "$", "this", "->", "query", "->", "close", "(", ")", ";", "}" ]
Pour les requetes SQL INSERT INTO - Insertion d'une nouvelle ligne @param array $data - Colonnes où faire le INSERT, et valeurs à insérer
[ "Pour", "les", "requetes", "SQL", "INSERT", "INTO", "-", "Insertion", "d", "une", "nouvelle", "ligne" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L750-L759
234,940
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.update
final public function update(array $data) { $this->query->setStartUpdate($data); $this->query->prepare()->bindSetForUpdate($data)->bindWhere()->bindLimit()->execute(); $this->setRowCount(); $this->query->close(); }
php
final public function update(array $data) { $this->query->setStartUpdate($data); $this->query->prepare()->bindSetForUpdate($data)->bindWhere()->bindLimit()->execute(); $this->setRowCount(); $this->query->close(); }
[ "final", "public", "function", "update", "(", "array", "$", "data", ")", "{", "$", "this", "->", "query", "->", "setStartUpdate", "(", "$", "data", ")", ";", "$", "this", "->", "query", "->", "prepare", "(", ")", "->", "bindSetForUpdate", "(", "$", "data", ")", "->", "bindWhere", "(", ")", "->", "bindLimit", "(", ")", "->", "execute", "(", ")", ";", "$", "this", "->", "setRowCount", "(", ")", ";", "$", "this", "->", "query", "->", "close", "(", ")", ";", "}" ]
Pour les requetes SQL UPDATE - Modifications sur des lignes existantes @param array $data - Colonnes où faire le UPDATE, et valeurs à insérer
[ "Pour", "les", "requetes", "SQL", "UPDATE", "-", "Modifications", "sur", "des", "lignes", "existantes" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L766-L775
234,941
stephweb/daw-php-orm
src/DawPhpOrm/Database/BaseModel.php
BaseModel.getHydratedObjects
final protected function getHydratedObjects($query): array { $collection = new Collection($this, $query); $this->query->close($query); return $collection(); }
php
final protected function getHydratedObjects($query): array { $collection = new Collection($this, $query); $this->query->close($query); return $collection(); }
[ "final", "protected", "function", "getHydratedObjects", "(", "$", "query", ")", ":", "array", "{", "$", "collection", "=", "new", "Collection", "(", "$", "this", ",", "$", "query", ")", ";", "$", "this", "->", "query", "->", "close", "(", "$", "query", ")", ";", "return", "$", "collection", "(", ")", ";", "}" ]
Hydrater des objets du Model @param mixed $query - Résultat d'une requete SQL qui récupère plusieurs lignes @return array - Collection d'objets
[ "Hydrater", "des", "objets", "du", "Model" ]
0c37e3baa1420cf9e3feff122016329de3764bcc
https://github.com/stephweb/daw-php-orm/blob/0c37e3baa1420cf9e3feff122016329de3764bcc/src/DawPhpOrm/Database/BaseModel.php#L903-L910
234,942
alexandresalome/pagination
Pager.php
Pager.setPage
public function setPage($page) { $this->offset = (max(1, (int) $page) - 1) * $this->perPage; return $this; }
php
public function setPage($page) { $this->offset = (max(1, (int) $page) - 1) * $this->perPage; return $this; }
[ "public", "function", "setPage", "(", "$", "page", ")", "{", "$", "this", "->", "offset", "=", "(", "max", "(", "1", ",", "(", "int", ")", "$", "page", ")", "-", "1", ")", "*", "$", "this", "->", "perPage", ";", "return", "$", "this", ";", "}" ]
Changes the current page. @param int $page the page to jump to. @return Pager
[ "Changes", "the", "current", "page", "." ]
bef7e290a8514baf418a57f52c879528779d75d1
https://github.com/alexandresalome/pagination/blob/bef7e290a8514baf418a57f52c879528779d75d1/Pager.php#L67-L72
234,943
alexandresalome/pagination
Pager.php
Pager.getPageRange
public function getPageRange($range = 4) { $from = max(1, $this->getPage() - $range); $to = min($this->getPageCount(), $this->getPage() + $range); return range($from, $to); }
php
public function getPageRange($range = 4) { $from = max(1, $this->getPage() - $range); $to = min($this->getPageCount(), $this->getPage() + $range); return range($from, $to); }
[ "public", "function", "getPageRange", "(", "$", "range", "=", "4", ")", "{", "$", "from", "=", "max", "(", "1", ",", "$", "this", "->", "getPage", "(", ")", "-", "$", "range", ")", ";", "$", "to", "=", "min", "(", "$", "this", "->", "getPageCount", "(", ")", ",", "$", "this", "->", "getPage", "(", ")", "+", "$", "range", ")", ";", "return", "range", "(", "$", "from", ",", "$", "to", ")", ";", "}" ]
Returns an array of page numbers for a given range. @return array
[ "Returns", "an", "array", "of", "page", "numbers", "for", "a", "given", "range", "." ]
bef7e290a8514baf418a57f52c879528779d75d1
https://github.com/alexandresalome/pagination/blob/bef7e290a8514baf418a57f52c879528779d75d1/Pager.php#L148-L154
234,944
makinacorpus/drupal-ucms
ucms_contrib/src/EventDispatcher/NodeReferenceCollectEvent.php
NodeReferenceCollectEvent.addReferences
public function addReferences($type, $nodeIdList, $field = null) { if (!is_array($nodeIdList)) { $nodeIdList = [$nodeIdList]; } $sourceId = $this->getNode()->id(); foreach ($nodeIdList as $nodeId) { $this->references[$type . $nodeId] = new NodeReference($sourceId, $nodeId, $type, $field); } }
php
public function addReferences($type, $nodeIdList, $field = null) { if (!is_array($nodeIdList)) { $nodeIdList = [$nodeIdList]; } $sourceId = $this->getNode()->id(); foreach ($nodeIdList as $nodeId) { $this->references[$type . $nodeId] = new NodeReference($sourceId, $nodeId, $type, $field); } }
[ "public", "function", "addReferences", "(", "$", "type", ",", "$", "nodeIdList", ",", "$", "field", "=", "null", ")", "{", "if", "(", "!", "is_array", "(", "$", "nodeIdList", ")", ")", "{", "$", "nodeIdList", "=", "[", "$", "nodeIdList", "]", ";", "}", "$", "sourceId", "=", "$", "this", "->", "getNode", "(", ")", "->", "id", "(", ")", ";", "foreach", "(", "$", "nodeIdList", "as", "$", "nodeId", ")", "{", "$", "this", "->", "references", "[", "$", "type", ".", "$", "nodeId", "]", "=", "new", "NodeReference", "(", "$", "sourceId", ",", "$", "nodeId", ",", "$", "type", ",", "$", "field", ")", ";", "}", "}" ]
Add one or more references @param int|int[] $nodeIdList Node identifiers list @param string $type Reference type for business purposes, 'media', 'link' or any other @param string $field Field name this reference was found into
[ "Add", "one", "or", "more", "references" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_contrib/src/EventDispatcher/NodeReferenceCollectEvent.php#L50-L61
234,945
makinacorpus/drupal-ucms
ucms_site/src/Action/AbstractWebmasterActionProvider.php
AbstractWebmasterActionProvider.createDeleteAction
protected function createDeleteAction(SiteAccessRecord $item) { $path = $this->buildWebmasterUri($item, 'delete'); return new Action($this->t("Delete from this site"), $path, 'dialog', 'remove', 100, true, true); }
php
protected function createDeleteAction(SiteAccessRecord $item) { $path = $this->buildWebmasterUri($item, 'delete'); return new Action($this->t("Delete from this site"), $path, 'dialog', 'remove', 100, true, true); }
[ "protected", "function", "createDeleteAction", "(", "SiteAccessRecord", "$", "item", ")", "{", "$", "path", "=", "$", "this", "->", "buildWebmasterUri", "(", "$", "item", ",", "'delete'", ")", ";", "return", "new", "Action", "(", "$", "this", "->", "t", "(", "\"Delete from this site\"", ")", ",", "$", "path", ",", "'dialog'", ",", "'remove'", ",", "100", ",", "true", ",", "true", ")", ";", "}" ]
Creates the action to delete a user from a site. @param SiteAccessRecord $item @return Action
[ "Creates", "the", "action", "to", "delete", "a", "user", "from", "a", "site", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/Action/AbstractWebmasterActionProvider.php#L66-L70
234,946
makinacorpus/drupal-ucms
ucms_site/src/Form/SiteRequest.php
SiteRequest.submitStepABack
public function submitStepABack(array $form, FormStateInterface $form_state) { $formData = &$form_state->getStorage(); /** @var $site Site */ $site = $formData['site']; $site->state = SiteState::REQUESTED; $site->theme = $form_state->getValue('theme'); $site->ts_created = $site->ts_changed = new \DateTime(); $site->template_id = $form_state->getValue('is_template') ? 0 : $form_state->getValue('template_id'); $site->is_template = $form_state->getValue('is_template'); $formData['step'] = 'a'; $form_state->setRebuild(true); }
php
public function submitStepABack(array $form, FormStateInterface $form_state) { $formData = &$form_state->getStorage(); /** @var $site Site */ $site = $formData['site']; $site->state = SiteState::REQUESTED; $site->theme = $form_state->getValue('theme'); $site->ts_created = $site->ts_changed = new \DateTime(); $site->template_id = $form_state->getValue('is_template') ? 0 : $form_state->getValue('template_id'); $site->is_template = $form_state->getValue('is_template'); $formData['step'] = 'a'; $form_state->setRebuild(true); }
[ "public", "function", "submitStepABack", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "formData", "=", "&", "$", "form_state", "->", "getStorage", "(", ")", ";", "/** @var $site Site */", "$", "site", "=", "$", "formData", "[", "'site'", "]", ";", "$", "site", "->", "state", "=", "SiteState", "::", "REQUESTED", ";", "$", "site", "->", "theme", "=", "$", "form_state", "->", "getValue", "(", "'theme'", ")", ";", "$", "site", "->", "ts_created", "=", "$", "site", "->", "ts_changed", "=", "new", "\\", "DateTime", "(", ")", ";", "$", "site", "->", "template_id", "=", "$", "form_state", "->", "getValue", "(", "'is_template'", ")", "?", "0", ":", "$", "form_state", "->", "getValue", "(", "'template_id'", ")", ";", "$", "site", "->", "is_template", "=", "$", "form_state", "->", "getValue", "(", "'is_template'", ")", ";", "$", "formData", "[", "'step'", "]", "=", "'a'", ";", "$", "form_state", "->", "setRebuild", "(", "true", ")", ";", "}" ]
Step B form go back submit
[ "Step", "B", "form", "go", "back", "submit" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_site/src/Form/SiteRequest.php#L366-L380
234,947
accompli/accompli
src/Utility/ProcessUtility.php
ProcessUtility.escapeArguments
public static function escapeArguments(array $arguments, $command = null) { $processedArguments = array(); foreach ($arguments as $key => $value) { if (is_string($key) && substr($key, 0, 1) === '-') { if (is_array($value) === false) { $value = array($value); } foreach ($value as $optionValue) { if ($optionValue === null) { $processedArguments[] = $key; } elseif (is_string($optionValue)) { $processedArguments[] = trim(sprintf('%s=%s', $key, $optionValue)); } } } elseif (is_scalar($value)) { $processedArguments[] = $value; } } if ($command !== null) { array_unshift($processedArguments, $command); } return implode(' ', array_map(array(__CLASS__, 'escapeArgument'), $processedArguments)); }
php
public static function escapeArguments(array $arguments, $command = null) { $processedArguments = array(); foreach ($arguments as $key => $value) { if (is_string($key) && substr($key, 0, 1) === '-') { if (is_array($value) === false) { $value = array($value); } foreach ($value as $optionValue) { if ($optionValue === null) { $processedArguments[] = $key; } elseif (is_string($optionValue)) { $processedArguments[] = trim(sprintf('%s=%s', $key, $optionValue)); } } } elseif (is_scalar($value)) { $processedArguments[] = $value; } } if ($command !== null) { array_unshift($processedArguments, $command); } return implode(' ', array_map(array(__CLASS__, 'escapeArgument'), $processedArguments)); }
[ "public", "static", "function", "escapeArguments", "(", "array", "$", "arguments", ",", "$", "command", "=", "null", ")", "{", "$", "processedArguments", "=", "array", "(", ")", ";", "foreach", "(", "$", "arguments", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "key", ")", "&&", "substr", "(", "$", "key", ",", "0", ",", "1", ")", "===", "'-'", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", "===", "false", ")", "{", "$", "value", "=", "array", "(", "$", "value", ")", ";", "}", "foreach", "(", "$", "value", "as", "$", "optionValue", ")", "{", "if", "(", "$", "optionValue", "===", "null", ")", "{", "$", "processedArguments", "[", "]", "=", "$", "key", ";", "}", "elseif", "(", "is_string", "(", "$", "optionValue", ")", ")", "{", "$", "processedArguments", "[", "]", "=", "trim", "(", "sprintf", "(", "'%s=%s'", ",", "$", "key", ",", "$", "optionValue", ")", ")", ";", "}", "}", "}", "elseif", "(", "is_scalar", "(", "$", "value", ")", ")", "{", "$", "processedArguments", "[", "]", "=", "$", "value", ";", "}", "}", "if", "(", "$", "command", "!==", "null", ")", "{", "array_unshift", "(", "$", "processedArguments", ",", "$", "command", ")", ";", "}", "return", "implode", "(", "' '", ",", "array_map", "(", "array", "(", "__CLASS__", ",", "'escapeArgument'", ")", ",", "$", "processedArguments", ")", ")", ";", "}" ]
Returns a string with escaped option values and arguments from the supplied arguments array. @param array $arguments @param string|null $command @return string
[ "Returns", "a", "string", "with", "escaped", "option", "values", "and", "arguments", "from", "the", "supplied", "arguments", "array", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/Utility/ProcessUtility.php#L20-L46
234,948
accompli/accompli
src/Utility/ProcessUtility.php
ProcessUtility.isSurroundedBy
private static function isSurroundedBy($argument, $character) { return 2 < strlen($argument) && $character === $argument[0] && $character === $argument[strlen($argument) - 1]; }
php
private static function isSurroundedBy($argument, $character) { return 2 < strlen($argument) && $character === $argument[0] && $character === $argument[strlen($argument) - 1]; }
[ "private", "static", "function", "isSurroundedBy", "(", "$", "argument", ",", "$", "character", ")", "{", "return", "2", "<", "strlen", "(", "$", "argument", ")", "&&", "$", "character", "===", "$", "argument", "[", "0", "]", "&&", "$", "character", "===", "$", "argument", "[", "strlen", "(", "$", "argument", ")", "-", "1", "]", ";", "}" ]
Returns true when the argument is surrounded by character. @param string $argument @param string $character @return bool
[ "Returns", "true", "when", "the", "argument", "is", "surrounded", "by", "character", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/Utility/ProcessUtility.php#L89-L92
234,949
makinacorpus/drupal-ucms
ucms_seo/src/Path/Redirect.php
Redirect.expiresAt
public function expiresAt() { if ($this->expires && !$this->expiresAt) { $this->expiresAt = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $this->expires); } return $this->expiresAt; }
php
public function expiresAt() { if ($this->expires && !$this->expiresAt) { $this->expiresAt = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $this->expires); } return $this->expiresAt; }
[ "public", "function", "expiresAt", "(", ")", "{", "if", "(", "$", "this", "->", "expires", "&&", "!", "$", "this", "->", "expiresAt", ")", "{", "$", "this", "->", "expiresAt", "=", "\\", "DateTimeImmutable", "::", "createFromFormat", "(", "'Y-m-d H:i:s'", ",", "$", "this", "->", "expires", ")", ";", "}", "return", "$", "this", "->", "expiresAt", ";", "}" ]
Get expiry date @return null|\DateTimeImmutable
[ "Get", "expiry", "date" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_seo/src/Path/Redirect.php#L84-L91
234,950
accompli/accompli
src/EventDispatcher/Subscriber/DataCollectorSubscriber.php
DataCollectorSubscriber.onEvent
public function onEvent(Event $event, $eventName) { foreach ($this->dataCollectors as $dataCollector) { $dataCollector->collect($event, $eventName); } }
php
public function onEvent(Event $event, $eventName) { foreach ($this->dataCollectors as $dataCollector) { $dataCollector->collect($event, $eventName); } }
[ "public", "function", "onEvent", "(", "Event", "$", "event", ",", "$", "eventName", ")", "{", "foreach", "(", "$", "this", "->", "dataCollectors", "as", "$", "dataCollector", ")", "{", "$", "dataCollector", "->", "collect", "(", "$", "event", ",", "$", "eventName", ")", ";", "}", "}" ]
Calls the collect method on all registered data collectors. @param Event $event @param string $eventName
[ "Calls", "the", "collect", "method", "on", "all", "registered", "data", "collectors", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/EventDispatcher/Subscriber/DataCollectorSubscriber.php#L65-L70
234,951
andkirby/multi-repo-composer
src/Repository/VcsNamespaceRepository.php
VcsNamespaceRepository.getTypes
public static function getTypes() { return [ self::TYPE_VCS, self::TYPE_GIT, self::TYPE_GIT_BITBACKET, self::TYPE_GITHUB, self::TYPE_GITLAB, ]; }
php
public static function getTypes() { return [ self::TYPE_VCS, self::TYPE_GIT, self::TYPE_GIT_BITBACKET, self::TYPE_GITHUB, self::TYPE_GITLAB, ]; }
[ "public", "static", "function", "getTypes", "(", ")", "{", "return", "[", "self", "::", "TYPE_VCS", ",", "self", "::", "TYPE_GIT", ",", "self", "::", "TYPE_GIT_BITBACKET", ",", "self", "::", "TYPE_GITHUB", ",", "self", "::", "TYPE_GITLAB", ",", "]", ";", "}" ]
Get "namespaced" types @return array
[ "Get", "namespaced", "types" ]
2d9fed02edf7601f56f2998f9d99e646b713aef6
https://github.com/andkirby/multi-repo-composer/blob/2d9fed02edf7601f56f2998f9d99e646b713aef6/src/Repository/VcsNamespaceRepository.php#L88-L97
234,952
andkirby/multi-repo-composer
src/Repository/VcsNamespaceRepository.php
VcsNamespaceRepository.preProcess
protected function preProcess(VcsDriverInterface $driver, array $data, $identifier) { // keep the name of the main identifier for all packages if ($this->packageName != $this->url) { $namespace = preg_replace('/([a-z0-9])([A-Z])/', '$1_$2', $data['namespace']); $namespace = strtolower($namespace); $data['name'] = $this->packageName . '-' . $namespace; } if (!isset($data['dist'])) { $data['dist'] = $driver->getDist($identifier); } if (!isset($data['source'])) { $data['source'] = $driver->getSource($identifier); $data['source']['type'] = $this->repoConfig['type']; } return $data; }
php
protected function preProcess(VcsDriverInterface $driver, array $data, $identifier) { // keep the name of the main identifier for all packages if ($this->packageName != $this->url) { $namespace = preg_replace('/([a-z0-9])([A-Z])/', '$1_$2', $data['namespace']); $namespace = strtolower($namespace); $data['name'] = $this->packageName . '-' . $namespace; } if (!isset($data['dist'])) { $data['dist'] = $driver->getDist($identifier); } if (!isset($data['source'])) { $data['source'] = $driver->getSource($identifier); $data['source']['type'] = $this->repoConfig['type']; } return $data; }
[ "protected", "function", "preProcess", "(", "VcsDriverInterface", "$", "driver", ",", "array", "$", "data", ",", "$", "identifier", ")", "{", "// keep the name of the main identifier for all packages", "if", "(", "$", "this", "->", "packageName", "!=", "$", "this", "->", "url", ")", "{", "$", "namespace", "=", "preg_replace", "(", "'/([a-z0-9])([A-Z])/'", ",", "'$1_$2'", ",", "$", "data", "[", "'namespace'", "]", ")", ";", "$", "namespace", "=", "strtolower", "(", "$", "namespace", ")", ";", "$", "data", "[", "'name'", "]", "=", "$", "this", "->", "packageName", ".", "'-'", ".", "$", "namespace", ";", "}", "if", "(", "!", "isset", "(", "$", "data", "[", "'dist'", "]", ")", ")", "{", "$", "data", "[", "'dist'", "]", "=", "$", "driver", "->", "getDist", "(", "$", "identifier", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "data", "[", "'source'", "]", ")", ")", "{", "$", "data", "[", "'source'", "]", "=", "$", "driver", "->", "getSource", "(", "$", "identifier", ")", ";", "$", "data", "[", "'source'", "]", "[", "'type'", "]", "=", "$", "this", "->", "repoConfig", "[", "'type'", "]", ";", "}", "return", "$", "data", ";", "}" ]
Make proper package data @param VcsDriverInterface $driver @param array $data @param string $identifier @return array
[ "Make", "proper", "package", "data" ]
2d9fed02edf7601f56f2998f9d99e646b713aef6
https://github.com/andkirby/multi-repo-composer/blob/2d9fed02edf7601f56f2998f9d99e646b713aef6/src/Repository/VcsNamespaceRepository.php#L284-L302
234,953
andkirby/multi-repo-composer
src/Repository/VcsNamespaceRepository.php
VcsNamespaceRepository.validateTag
protected function validateTag($version) { try { if (!strpos($version, '/')) { return false; } return $this->versionParser->normalize( $this->_getBranchWithoutNamespace($version) ); } catch (\Exception $e) { return false; } }
php
protected function validateTag($version) { try { if (!strpos($version, '/')) { return false; } return $this->versionParser->normalize( $this->_getBranchWithoutNamespace($version) ); } catch (\Exception $e) { return false; } }
[ "protected", "function", "validateTag", "(", "$", "version", ")", "{", "try", "{", "if", "(", "!", "strpos", "(", "$", "version", ",", "'/'", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "versionParser", "->", "normalize", "(", "$", "this", "->", "_getBranchWithoutNamespace", "(", "$", "version", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "return", "false", ";", "}", "}" ]
Get normalized tag name It will return an empty result if it's not valid @param string $version @return bool
[ "Get", "normalized", "tag", "name" ]
2d9fed02edf7601f56f2998f9d99e646b713aef6
https://github.com/andkirby/multi-repo-composer/blob/2d9fed02edf7601f56f2998f9d99e646b713aef6/src/Repository/VcsNamespaceRepository.php#L312-L324
234,954
andkirby/multi-repo-composer
src/Repository/VcsNamespaceRepository.php
VcsNamespaceRepository.validateBranch
protected function validateBranch($branch) { try { if (!strpos($branch, '/')) { return false; } return $this->versionParser->normalizeBranch( $this->_getBranchWithoutNamespace($branch) ); } catch (\Exception $e) { return false; } }
php
protected function validateBranch($branch) { try { if (!strpos($branch, '/')) { return false; } return $this->versionParser->normalizeBranch( $this->_getBranchWithoutNamespace($branch) ); } catch (\Exception $e) { return false; } }
[ "protected", "function", "validateBranch", "(", "$", "branch", ")", "{", "try", "{", "if", "(", "!", "strpos", "(", "$", "branch", ",", "'/'", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "versionParser", "->", "normalizeBranch", "(", "$", "this", "->", "_getBranchWithoutNamespace", "(", "$", "branch", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "return", "false", ";", "}", "}" ]
Get normalized branch name It will return an empty result if it's not valid @param string $branch @return bool
[ "Get", "normalized", "branch", "name" ]
2d9fed02edf7601f56f2998f9d99e646b713aef6
https://github.com/andkirby/multi-repo-composer/blob/2d9fed02edf7601f56f2998f9d99e646b713aef6/src/Repository/VcsNamespaceRepository.php#L334-L346
234,955
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.getIndexRealname
public function getIndexRealname($index) { if (isset($this->indexAliasMap[$index])) { return $this->indexAliasMap[$index]; } return $index; }
php
public function getIndexRealname($index) { if (isset($this->indexAliasMap[$index])) { return $this->indexAliasMap[$index]; } return $index; }
[ "public", "function", "getIndexRealname", "(", "$", "index", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "indexAliasMap", "[", "$", "index", "]", ")", ")", "{", "return", "$", "this", "->", "indexAliasMap", "[", "$", "index", "]", ";", "}", "return", "$", "index", ";", "}" ]
Get index real name for Elastic Search @param string $index @return string
[ "Get", "index", "real", "name", "for", "Elastic", "Search" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L135-L142
234,956
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.indexer
public function indexer($index = null) { if (empty($this->nodeIndexerChain)) { $list = []; foreach ($this->keys() as $existing) { $list[$existing] = new NodeIndexer( $existing, $this->client, $this->db, $this->entityManager, $this->moduleHandler, $this->eventDispatcher, $this->getIndexRealname($existing), $this->preventBulkUsage ); } $this->nodeIndexerChain = new NodeIndexerChain($list); } if ($index) { return $this->nodeIndexerChain->getIndexer($index); } return $this->nodeIndexerChain; }
php
public function indexer($index = null) { if (empty($this->nodeIndexerChain)) { $list = []; foreach ($this->keys() as $existing) { $list[$existing] = new NodeIndexer( $existing, $this->client, $this->db, $this->entityManager, $this->moduleHandler, $this->eventDispatcher, $this->getIndexRealname($existing), $this->preventBulkUsage ); } $this->nodeIndexerChain = new NodeIndexerChain($list); } if ($index) { return $this->nodeIndexerChain->getIndexer($index); } return $this->nodeIndexerChain; }
[ "public", "function", "indexer", "(", "$", "index", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "nodeIndexerChain", ")", ")", "{", "$", "list", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "keys", "(", ")", "as", "$", "existing", ")", "{", "$", "list", "[", "$", "existing", "]", "=", "new", "NodeIndexer", "(", "$", "existing", ",", "$", "this", "->", "client", ",", "$", "this", "->", "db", ",", "$", "this", "->", "entityManager", ",", "$", "this", "->", "moduleHandler", ",", "$", "this", "->", "eventDispatcher", ",", "$", "this", "->", "getIndexRealname", "(", "$", "existing", ")", ",", "$", "this", "->", "preventBulkUsage", ")", ";", "}", "$", "this", "->", "nodeIndexerChain", "=", "new", "NodeIndexerChain", "(", "$", "list", ")", ";", "}", "if", "(", "$", "index", ")", "{", "return", "$", "this", "->", "nodeIndexerChain", "->", "getIndexer", "(", "$", "index", ")", ";", "}", "return", "$", "this", "->", "nodeIndexerChain", ";", "}" ]
Get node indexer for the given index @param string $index If none is given, a passthru implementation that will work internally on all indices at once will be given @return NodeIndexerInterface
[ "Get", "node", "indexer", "for", "the", "given", "index" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L153-L177
234,957
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.save
public function save($index, $name, $param, $force = false) { $updated = false; $existing = $this->load($index); // Directly compare array structures, should be enough if (!$existing || $force || $param !== $existing) { // This was updated, then we really need to save it $updated = true; } // Adds 'node_access' table ACL system replica into elastic index // mapping so that we can query it later, this will only replicate // grants for the view operation, here is the process: // - it identifies each (realm, gid) group for the node as a raw // string such as "REALM:GID" // - it stores a string term vector of those // - of course, it only stores those with 1 as value for grant_view // - in all queries, a nice alteration will be done to force it to // have a filter query that does a term exact match in the vector // for all user grants $param['mapping']['node']['properties']['node_access']['type'] = 'string'; $this ->db ->merge('ucms_search_index') ->key(['index_key' => $index]) ->fields(['name' => $name, 'data' => serialize($param)]) ->execute() ; $this->clearDefinitionCache(); $this->moduleHandler->invokeAll(self::HOOK_DEF_SAVE, [$index, $param, $updated, !$existing]); $this->indexer(); $this->nodeIndexerChain->addIndexer( $index, new NodeIndexer( $index, $this->client, $this->db, $this->entityManager, $this->moduleHandler, $this->eventDispatcher, $this->getIndexRealname($index), $this->preventBulkUsage )); if ($updated) { $this->clear($index); } }
php
public function save($index, $name, $param, $force = false) { $updated = false; $existing = $this->load($index); // Directly compare array structures, should be enough if (!$existing || $force || $param !== $existing) { // This was updated, then we really need to save it $updated = true; } // Adds 'node_access' table ACL system replica into elastic index // mapping so that we can query it later, this will only replicate // grants for the view operation, here is the process: // - it identifies each (realm, gid) group for the node as a raw // string such as "REALM:GID" // - it stores a string term vector of those // - of course, it only stores those with 1 as value for grant_view // - in all queries, a nice alteration will be done to force it to // have a filter query that does a term exact match in the vector // for all user grants $param['mapping']['node']['properties']['node_access']['type'] = 'string'; $this ->db ->merge('ucms_search_index') ->key(['index_key' => $index]) ->fields(['name' => $name, 'data' => serialize($param)]) ->execute() ; $this->clearDefinitionCache(); $this->moduleHandler->invokeAll(self::HOOK_DEF_SAVE, [$index, $param, $updated, !$existing]); $this->indexer(); $this->nodeIndexerChain->addIndexer( $index, new NodeIndexer( $index, $this->client, $this->db, $this->entityManager, $this->moduleHandler, $this->eventDispatcher, $this->getIndexRealname($index), $this->preventBulkUsage )); if ($updated) { $this->clear($index); } }
[ "public", "function", "save", "(", "$", "index", ",", "$", "name", ",", "$", "param", ",", "$", "force", "=", "false", ")", "{", "$", "updated", "=", "false", ";", "$", "existing", "=", "$", "this", "->", "load", "(", "$", "index", ")", ";", "// Directly compare array structures, should be enough", "if", "(", "!", "$", "existing", "||", "$", "force", "||", "$", "param", "!==", "$", "existing", ")", "{", "// This was updated, then we really need to save it", "$", "updated", "=", "true", ";", "}", "// Adds 'node_access' table ACL system replica into elastic index", "// mapping so that we can query it later, this will only replicate", "// grants for the view operation, here is the process:", "// - it identifies each (realm, gid) group for the node as a raw", "// string such as \"REALM:GID\"", "// - it stores a string term vector of those", "// - of course, it only stores those with 1 as value for grant_view", "// - in all queries, a nice alteration will be done to force it to", "// have a filter query that does a term exact match in the vector", "// for all user grants", "$", "param", "[", "'mapping'", "]", "[", "'node'", "]", "[", "'properties'", "]", "[", "'node_access'", "]", "[", "'type'", "]", "=", "'string'", ";", "$", "this", "->", "db", "->", "merge", "(", "'ucms_search_index'", ")", "->", "key", "(", "[", "'index_key'", "=>", "$", "index", "]", ")", "->", "fields", "(", "[", "'name'", "=>", "$", "name", ",", "'data'", "=>", "serialize", "(", "$", "param", ")", "]", ")", "->", "execute", "(", ")", ";", "$", "this", "->", "clearDefinitionCache", "(", ")", ";", "$", "this", "->", "moduleHandler", "->", "invokeAll", "(", "self", "::", "HOOK_DEF_SAVE", ",", "[", "$", "index", ",", "$", "param", ",", "$", "updated", ",", "!", "$", "existing", "]", ")", ";", "$", "this", "->", "indexer", "(", ")", ";", "$", "this", "->", "nodeIndexerChain", "->", "addIndexer", "(", "$", "index", ",", "new", "NodeIndexer", "(", "$", "index", ",", "$", "this", "->", "client", ",", "$", "this", "->", "db", ",", "$", "this", "->", "entityManager", ",", "$", "this", "->", "moduleHandler", ",", "$", "this", "->", "eventDispatcher", ",", "$", "this", "->", "getIndexRealname", "(", "$", "index", ")", ",", "$", "this", "->", "preventBulkUsage", ")", ")", ";", "if", "(", "$", "updated", ")", "{", "$", "this", "->", "clear", "(", "$", "index", ")", ";", "}", "}" ]
Create or update index definition @param string $index Index key @param string $name Human readable title @param array $param This must contain the exact replica of the 'body' key that will be sent to ElasticSearch indices()::create() array @param boolean $force Force index to be refreshed
[ "Create", "or", "update", "index", "definition" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L192-L243
234,958
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.names
public function names() { if ($this->indexListCache) { return $this->indexListCache; } // Attempt to have a zero SQL Drupal $doCache = variable_get('ucms_search_cache_list', true); if ($doCache && ($cached = $this->cache->get(self::CID_LIST))) { $this->indexListCache = $cached->data; } else { $this->indexListCache = $this ->db ->query( "SELECT index_key, name FROM {ucms_search_index}" ) ->fetchAllKeyed() ; if ($doCache) { $this->cache->set(self::CID_LIST, $this->indexListCache); } } return $this->indexListCache; }
php
public function names() { if ($this->indexListCache) { return $this->indexListCache; } // Attempt to have a zero SQL Drupal $doCache = variable_get('ucms_search_cache_list', true); if ($doCache && ($cached = $this->cache->get(self::CID_LIST))) { $this->indexListCache = $cached->data; } else { $this->indexListCache = $this ->db ->query( "SELECT index_key, name FROM {ucms_search_index}" ) ->fetchAllKeyed() ; if ($doCache) { $this->cache->set(self::CID_LIST, $this->indexListCache); } } return $this->indexListCache; }
[ "public", "function", "names", "(", ")", "{", "if", "(", "$", "this", "->", "indexListCache", ")", "{", "return", "$", "this", "->", "indexListCache", ";", "}", "// Attempt to have a zero SQL Drupal", "$", "doCache", "=", "variable_get", "(", "'ucms_search_cache_list'", ",", "true", ")", ";", "if", "(", "$", "doCache", "&&", "(", "$", "cached", "=", "$", "this", "->", "cache", "->", "get", "(", "self", "::", "CID_LIST", ")", ")", ")", "{", "$", "this", "->", "indexListCache", "=", "$", "cached", "->", "data", ";", "}", "else", "{", "$", "this", "->", "indexListCache", "=", "$", "this", "->", "db", "->", "query", "(", "\"SELECT index_key, name FROM {ucms_search_index}\"", ")", "->", "fetchAllKeyed", "(", ")", ";", "if", "(", "$", "doCache", ")", "{", "$", "this", "->", "cache", "->", "set", "(", "self", "::", "CID_LIST", ",", "$", "this", "->", "indexListCache", ")", ";", "}", "}", "return", "$", "this", "->", "indexListCache", ";", "}" ]
Get indices names @return string[] Keys are indices machine names while values are human readables names
[ "Get", "indices", "names" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L276-L303
234,959
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.load
public function load($index) { // Minor optimization, avoid lookups for unknow indexes if (!$this->exists($index)) { return; } // Can be null if index does not exists if (array_key_exists($index, $this->indexDefinitionCache)) { return $this->indexDefinitionCache[$index]; } $param = $this ->db ->query( "SELECT data FROM {ucms_search_index} WHERE index_key = :index", ['index' => $index] ) ->fetchField() ; if ($param) { $param = unserialize($param); } return $this->indexDefinitionCache[$index] = $param; }
php
public function load($index) { // Minor optimization, avoid lookups for unknow indexes if (!$this->exists($index)) { return; } // Can be null if index does not exists if (array_key_exists($index, $this->indexDefinitionCache)) { return $this->indexDefinitionCache[$index]; } $param = $this ->db ->query( "SELECT data FROM {ucms_search_index} WHERE index_key = :index", ['index' => $index] ) ->fetchField() ; if ($param) { $param = unserialize($param); } return $this->indexDefinitionCache[$index] = $param; }
[ "public", "function", "load", "(", "$", "index", ")", "{", "// Minor optimization, avoid lookups for unknow indexes", "if", "(", "!", "$", "this", "->", "exists", "(", "$", "index", ")", ")", "{", "return", ";", "}", "// Can be null if index does not exists", "if", "(", "array_key_exists", "(", "$", "index", ",", "$", "this", "->", "indexDefinitionCache", ")", ")", "{", "return", "$", "this", "->", "indexDefinitionCache", "[", "$", "index", "]", ";", "}", "$", "param", "=", "$", "this", "->", "db", "->", "query", "(", "\"SELECT data FROM {ucms_search_index} WHERE index_key = :index\"", ",", "[", "'index'", "=>", "$", "index", "]", ")", "->", "fetchField", "(", ")", ";", "if", "(", "$", "param", ")", "{", "$", "param", "=", "unserialize", "(", "$", "param", ")", ";", "}", "return", "$", "this", "->", "indexDefinitionCache", "[", "$", "index", "]", "=", "$", "param", ";", "}" ]
Load an index definition This is uncached, never use it during normal runtime @param string $index @return array This must contain the exact replica of the 'body' key that will be sent to ElasticSearch indices()::create() array.
[ "Load", "an", "index", "definition" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L316-L342
234,960
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.delete
public function delete($index) { $this ->db ->delete('ucms_search_index') ->condition('index_key', $index) ->execute() ; $this->indexer(); $this->nodeIndexerChain->removeIndexer($index); $this->clearDefinitionCache(); $this->moduleHandler->invokeAll(self::HOOK_DEF_DELETE, [$index]); $this->deleteInClient($index); }
php
public function delete($index) { $this ->db ->delete('ucms_search_index') ->condition('index_key', $index) ->execute() ; $this->indexer(); $this->nodeIndexerChain->removeIndexer($index); $this->clearDefinitionCache(); $this->moduleHandler->invokeAll(self::HOOK_DEF_DELETE, [$index]); $this->deleteInClient($index); }
[ "public", "function", "delete", "(", "$", "index", ")", "{", "$", "this", "->", "db", "->", "delete", "(", "'ucms_search_index'", ")", "->", "condition", "(", "'index_key'", ",", "$", "index", ")", "->", "execute", "(", ")", ";", "$", "this", "->", "indexer", "(", ")", ";", "$", "this", "->", "nodeIndexerChain", "->", "removeIndexer", "(", "$", "index", ")", ";", "$", "this", "->", "clearDefinitionCache", "(", ")", ";", "$", "this", "->", "moduleHandler", "->", "invokeAll", "(", "self", "::", "HOOK_DEF_DELETE", ",", "[", "$", "index", "]", ")", ";", "$", "this", "->", "deleteInClient", "(", "$", "index", ")", ";", "}" ]
Delete an index definition @param string $index
[ "Delete", "an", "index", "definition" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L349-L366
234,961
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.clear
public function clear($index) { $this->deleteInClient($index); $this->createInClient($index); $this->indexer(); $this->nodeIndexerChain->getIndexer($index)->bulkMarkForReindex(); }
php
public function clear($index) { $this->deleteInClient($index); $this->createInClient($index); $this->indexer(); $this->nodeIndexerChain->getIndexer($index)->bulkMarkForReindex(); }
[ "public", "function", "clear", "(", "$", "index", ")", "{", "$", "this", "->", "deleteInClient", "(", "$", "index", ")", ";", "$", "this", "->", "createInClient", "(", "$", "index", ")", ";", "$", "this", "->", "indexer", "(", ")", ";", "$", "this", "->", "nodeIndexerChain", "->", "getIndexer", "(", "$", "index", ")", "->", "bulkMarkForReindex", "(", ")", ";", "}" ]
Clear an index. @param string $index
[ "Clear", "an", "index", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L373-L380
234,962
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.createInClient
protected function createInClient($index) { $param = $this->load($index); if (!$param) { throw new \InvalidArgumentException(sprintf("'%s' index definition does not exist", $index)); } $namespace = $this->client->indices(); $indexRealname = $this->getIndexRealname($index); if (!$namespace->exists(['index' => $indexRealname])) { $namespace->create([ 'index' => $indexRealname, 'body' => $param, ]); } }
php
protected function createInClient($index) { $param = $this->load($index); if (!$param) { throw new \InvalidArgumentException(sprintf("'%s' index definition does not exist", $index)); } $namespace = $this->client->indices(); $indexRealname = $this->getIndexRealname($index); if (!$namespace->exists(['index' => $indexRealname])) { $namespace->create([ 'index' => $indexRealname, 'body' => $param, ]); } }
[ "protected", "function", "createInClient", "(", "$", "index", ")", "{", "$", "param", "=", "$", "this", "->", "load", "(", "$", "index", ")", ";", "if", "(", "!", "$", "param", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", "\"'%s' index definition does not exist\"", ",", "$", "index", ")", ")", ";", "}", "$", "namespace", "=", "$", "this", "->", "client", "->", "indices", "(", ")", ";", "$", "indexRealname", "=", "$", "this", "->", "getIndexRealname", "(", "$", "index", ")", ";", "if", "(", "!", "$", "namespace", "->", "exists", "(", "[", "'index'", "=>", "$", "indexRealname", "]", ")", ")", "{", "$", "namespace", "->", "create", "(", "[", "'index'", "=>", "$", "indexRealname", ",", "'body'", "=>", "$", "param", ",", "]", ")", ";", "}", "}" ]
Ensure index exists @param string $index
[ "Ensure", "index", "exists" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L387-L404
234,963
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.deleteInClient
protected function deleteInClient($index) { $namespace = $this->client->indices(); $indexRealname = $this->getIndexRealname($index); if ($namespace->exists(['index' => $indexRealname])) { $namespace->delete(['index' => $indexRealname]); } }
php
protected function deleteInClient($index) { $namespace = $this->client->indices(); $indexRealname = $this->getIndexRealname($index); if ($namespace->exists(['index' => $indexRealname])) { $namespace->delete(['index' => $indexRealname]); } }
[ "protected", "function", "deleteInClient", "(", "$", "index", ")", "{", "$", "namespace", "=", "$", "this", "->", "client", "->", "indices", "(", ")", ";", "$", "indexRealname", "=", "$", "this", "->", "getIndexRealname", "(", "$", "index", ")", ";", "if", "(", "$", "namespace", "->", "exists", "(", "[", "'index'", "=>", "$", "indexRealname", "]", ")", ")", "{", "$", "namespace", "->", "delete", "(", "[", "'index'", "=>", "$", "indexRealname", "]", ")", ";", "}", "}" ]
Delete an index on Elastic client without removing the Drupal definition @param string $index
[ "Delete", "an", "index", "on", "Elastic", "client", "without", "removing", "the", "Drupal", "definition" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L411-L419
234,964
makinacorpus/drupal-ucms
ucms_search/src/IndexStorage.php
IndexStorage.clearDefinitionCache
protected function clearDefinitionCache() { $this->indexDefinitionCache = []; $this->indexListCache = []; $this->cache->delete(self::CID_LIST); }
php
protected function clearDefinitionCache() { $this->indexDefinitionCache = []; $this->indexListCache = []; $this->cache->delete(self::CID_LIST); }
[ "protected", "function", "clearDefinitionCache", "(", ")", "{", "$", "this", "->", "indexDefinitionCache", "=", "[", "]", ";", "$", "this", "->", "indexListCache", "=", "[", "]", ";", "$", "this", "->", "cache", "->", "delete", "(", "self", "::", "CID_LIST", ")", ";", "}" ]
Clear all index definition related cache
[ "Clear", "all", "index", "definition", "related", "cache" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_search/src/IndexStorage.php#L424-L429
234,965
anlutro/laravel-validation
src/Validator.php
Validator.getRules
protected function getRules($action, $merge = null) { $method = 'get' . ucfirst($action) . 'Rules'; if (method_exists($this, $method)) { $rules = $this->$method(); } else { $rules = []; } if ($merge === null) { $merge = $this->merge; } if ($merge) { $rules = array_merge_recursive($this->getCommonRules(), $rules); } return $rules; }
php
protected function getRules($action, $merge = null) { $method = 'get' . ucfirst($action) . 'Rules'; if (method_exists($this, $method)) { $rules = $this->$method(); } else { $rules = []; } if ($merge === null) { $merge = $this->merge; } if ($merge) { $rules = array_merge_recursive($this->getCommonRules(), $rules); } return $rules; }
[ "protected", "function", "getRules", "(", "$", "action", ",", "$", "merge", "=", "null", ")", "{", "$", "method", "=", "'get'", ".", "ucfirst", "(", "$", "action", ")", ".", "'Rules'", ";", "if", "(", "method_exists", "(", "$", "this", ",", "$", "method", ")", ")", "{", "$", "rules", "=", "$", "this", "->", "$", "method", "(", ")", ";", "}", "else", "{", "$", "rules", "=", "[", "]", ";", "}", "if", "(", "$", "merge", "===", "null", ")", "{", "$", "merge", "=", "$", "this", "->", "merge", ";", "}", "if", "(", "$", "merge", ")", "{", "$", "rules", "=", "array_merge_recursive", "(", "$", "this", "->", "getCommonRules", "(", ")", ",", "$", "rules", ")", ";", "}", "return", "$", "rules", ";", "}" ]
Get the rules for an action. @param string $action @param boolean $merge Whether or not to merge with common rules. Leave the parameter out to default to $this->merge @return array
[ "Get", "the", "rules", "for", "an", "action", "." ]
fb653cf29f230bf53beda4b35a4e1042d52faaeb
https://github.com/anlutro/laravel-validation/blob/fb653cf29f230bf53beda4b35a4e1042d52faaeb/src/Validator.php#L132-L151
234,966
anlutro/laravel-validation
src/Validator.php
Validator.replaceRuleVariables
protected function replaceRuleVariables(array $rules, array $attributes) { array_walk_recursive($rules, function(&$item, $key) use($attributes) { // don't mess with regex rules if (substr($item, 0, 6) === 'regex:') return; // replace explicit variables foreach ($this->replace as $key => $value) { if (strpos($item, "<$key>") !== false) { $item = str_replace("<$key>", $value, $item); } } // replace input variables foreach ($attributes as $key => $value) { if (strpos($item, "[$key]") !== false) { $item = str_replace("[$key]", $value, $item); } } }); return $rules; }
php
protected function replaceRuleVariables(array $rules, array $attributes) { array_walk_recursive($rules, function(&$item, $key) use($attributes) { // don't mess with regex rules if (substr($item, 0, 6) === 'regex:') return; // replace explicit variables foreach ($this->replace as $key => $value) { if (strpos($item, "<$key>") !== false) { $item = str_replace("<$key>", $value, $item); } } // replace input variables foreach ($attributes as $key => $value) { if (strpos($item, "[$key]") !== false) { $item = str_replace("[$key]", $value, $item); } } }); return $rules; }
[ "protected", "function", "replaceRuleVariables", "(", "array", "$", "rules", ",", "array", "$", "attributes", ")", "{", "array_walk_recursive", "(", "$", "rules", ",", "function", "(", "&", "$", "item", ",", "$", "key", ")", "use", "(", "$", "attributes", ")", "{", "// don't mess with regex rules", "if", "(", "substr", "(", "$", "item", ",", "0", ",", "6", ")", "===", "'regex:'", ")", "return", ";", "// replace explicit variables", "foreach", "(", "$", "this", "->", "replace", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "strpos", "(", "$", "item", ",", "\"<$key>\"", ")", "!==", "false", ")", "{", "$", "item", "=", "str_replace", "(", "\"<$key>\"", ",", "$", "value", ",", "$", "item", ")", ";", "}", "}", "// replace input variables", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "strpos", "(", "$", "item", ",", "\"[$key]\"", ")", "!==", "false", ")", "{", "$", "item", "=", "str_replace", "(", "\"[$key]\"", ",", "$", "value", ",", "$", "item", ")", ";", "}", "}", "}", ")", ";", "return", "$", "rules", ";", "}" ]
Dynamically replace variables in the rules. @param array $rules @param array $attributes @return array
[ "Dynamically", "replace", "variables", "in", "the", "rules", "." ]
fb653cf29f230bf53beda4b35a4e1042d52faaeb
https://github.com/anlutro/laravel-validation/blob/fb653cf29f230bf53beda4b35a4e1042d52faaeb/src/Validator.php#L174-L196
234,967
anlutro/laravel-validation
src/Validator.php
Validator.makeValidator
protected function makeValidator(array $rules, array $attributes) { $validator = $this->factory->make($attributes, $rules); $this->prepareValidator($this->validator); return $validator; }
php
protected function makeValidator(array $rules, array $attributes) { $validator = $this->factory->make($attributes, $rules); $this->prepareValidator($this->validator); return $validator; }
[ "protected", "function", "makeValidator", "(", "array", "$", "rules", ",", "array", "$", "attributes", ")", "{", "$", "validator", "=", "$", "this", "->", "factory", "->", "make", "(", "$", "attributes", ",", "$", "rules", ")", ";", "$", "this", "->", "prepareValidator", "(", "$", "this", "->", "validator", ")", ";", "return", "$", "validator", ";", "}" ]
Make a new validator instance. @param array $rules @param array $attributes @return \Illuminate\Validation\Validator
[ "Make", "a", "new", "validator", "instance", "." ]
fb653cf29f230bf53beda4b35a4e1042d52faaeb
https://github.com/anlutro/laravel-validation/blob/fb653cf29f230bf53beda4b35a4e1042d52faaeb/src/Validator.php#L220-L225
234,968
ARCANEDEV/Settings
src/Stores/DatabaseStore.php
DatabaseStore.setConstraint
public function setConstraint(Closure $callback) { $this->data = []; $this->loaded = false; $this->queryConstraint = $callback; return $this; }
php
public function setConstraint(Closure $callback) { $this->data = []; $this->loaded = false; $this->queryConstraint = $callback; return $this; }
[ "public", "function", "setConstraint", "(", "Closure", "$", "callback", ")", "{", "$", "this", "->", "data", "=", "[", "]", ";", "$", "this", "->", "loaded", "=", "false", ";", "$", "this", "->", "queryConstraint", "=", "$", "callback", ";", "return", "$", "this", ";", "}" ]
Set the query constraint. @param \Closure $callback @return self
[ "Set", "the", "query", "constraint", "." ]
8e08dadc29d5a47c64099454696100babb356530
https://github.com/ARCANEDEV/Settings/blob/8e08dadc29d5a47c64099454696100babb356530/src/Stores/DatabaseStore.php#L94-L101
234,969
ARCANEDEV/Settings
src/Stores/DatabaseStore.php
DatabaseStore.prepareData
private function prepareData(array $data) { $inserts = array_dot($data); $updates = []; $deletes = []; foreach ($this->model()->lists('key') as $key) { if (isset($inserts[$key])) $updates[$key] = $inserts[$key]; else $deletes[] = $key; unset($inserts[$key]); } return [$inserts, $updates, $deletes]; }
php
private function prepareData(array $data) { $inserts = array_dot($data); $updates = []; $deletes = []; foreach ($this->model()->lists('key') as $key) { if (isset($inserts[$key])) $updates[$key] = $inserts[$key]; else $deletes[] = $key; unset($inserts[$key]); } return [$inserts, $updates, $deletes]; }
[ "private", "function", "prepareData", "(", "array", "$", "data", ")", "{", "$", "inserts", "=", "array_dot", "(", "$", "data", ")", ";", "$", "updates", "=", "[", "]", ";", "$", "deletes", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "model", "(", ")", "->", "lists", "(", "'key'", ")", "as", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "inserts", "[", "$", "key", "]", ")", ")", "$", "updates", "[", "$", "key", "]", "=", "$", "inserts", "[", "$", "key", "]", ";", "else", "$", "deletes", "[", "]", "=", "$", "key", ";", "unset", "(", "$", "inserts", "[", "$", "key", "]", ")", ";", "}", "return", "[", "$", "inserts", ",", "$", "updates", ",", "$", "deletes", "]", ";", "}" ]
Prepare settings data. @param array $data @return array
[ "Prepare", "settings", "data", "." ]
8e08dadc29d5a47c64099454696100babb356530
https://github.com/ARCANEDEV/Settings/blob/8e08dadc29d5a47c64099454696100babb356530/src/Stores/DatabaseStore.php#L189-L205
234,970
ARCANEDEV/Settings
src/Stores/DatabaseStore.php
DatabaseStore.updateSettings
private function updateSettings($updates) { foreach ($updates as $key => $value) { $this->model()->where('key', $key)->update(compact('value')); } }
php
private function updateSettings($updates) { foreach ($updates as $key => $value) { $this->model()->where('key', $key)->update(compact('value')); } }
[ "private", "function", "updateSettings", "(", "$", "updates", ")", "{", "foreach", "(", "$", "updates", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "model", "(", ")", "->", "where", "(", "'key'", ",", "$", "key", ")", "->", "update", "(", "compact", "(", "'value'", ")", ")", ";", "}", "}" ]
Update settings data. @param array $updates
[ "Update", "settings", "data", "." ]
8e08dadc29d5a47c64099454696100babb356530
https://github.com/ARCANEDEV/Settings/blob/8e08dadc29d5a47c64099454696100babb356530/src/Stores/DatabaseStore.php#L212-L217
234,971
ARCANEDEV/Settings
src/Stores/DatabaseStore.php
DatabaseStore.insertSettings
private function insertSettings(array $inserts) { if (empty($inserts)) { return; } $dbData = []; foreach ($inserts as $key => $value) { $data = compact('key', 'value'); $dbData[] = empty($this->extraColumns) ? $data : array_merge($this->extraColumns, $data); } $this->model(true)->insert($dbData); }
php
private function insertSettings(array $inserts) { if (empty($inserts)) { return; } $dbData = []; foreach ($inserts as $key => $value) { $data = compact('key', 'value'); $dbData[] = empty($this->extraColumns) ? $data : array_merge($this->extraColumns, $data); } $this->model(true)->insert($dbData); }
[ "private", "function", "insertSettings", "(", "array", "$", "inserts", ")", "{", "if", "(", "empty", "(", "$", "inserts", ")", ")", "{", "return", ";", "}", "$", "dbData", "=", "[", "]", ";", "foreach", "(", "$", "inserts", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "data", "=", "compact", "(", "'key'", ",", "'value'", ")", ";", "$", "dbData", "[", "]", "=", "empty", "(", "$", "this", "->", "extraColumns", ")", "?", "$", "data", ":", "array_merge", "(", "$", "this", "->", "extraColumns", ",", "$", "data", ")", ";", "}", "$", "this", "->", "model", "(", "true", ")", "->", "insert", "(", "$", "dbData", ")", ";", "}" ]
Insert settings data. @param array $inserts
[ "Insert", "settings", "data", "." ]
8e08dadc29d5a47c64099454696100babb356530
https://github.com/ARCANEDEV/Settings/blob/8e08dadc29d5a47c64099454696100babb356530/src/Stores/DatabaseStore.php#L224-L238
234,972
accompli/accompli
src/DependencyInjection/AwarenessCompilerPass.php
AwarenessCompilerPass.process
public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $definition) { $interfaces = class_implements($definition->getClass()); foreach ($interfaces as $interface) { if (substr($interface, -14) === 'AwareInterface') { $camelCasedServiceId = substr($interface, strrpos($interface, '\\') + 1, -14); $serviceId = Container::underscore($camelCasedServiceId); if ($container->has($serviceId)) { $setterMethod = 'set'.$camelCasedServiceId; $definition->addMethodCall($setterMethod, array(new Reference($serviceId))); } } } } }
php
public function process(ContainerBuilder $container) { foreach ($container->getDefinitions() as $definition) { $interfaces = class_implements($definition->getClass()); foreach ($interfaces as $interface) { if (substr($interface, -14) === 'AwareInterface') { $camelCasedServiceId = substr($interface, strrpos($interface, '\\') + 1, -14); $serviceId = Container::underscore($camelCasedServiceId); if ($container->has($serviceId)) { $setterMethod = 'set'.$camelCasedServiceId; $definition->addMethodCall($setterMethod, array(new Reference($serviceId))); } } } } }
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "foreach", "(", "$", "container", "->", "getDefinitions", "(", ")", "as", "$", "definition", ")", "{", "$", "interfaces", "=", "class_implements", "(", "$", "definition", "->", "getClass", "(", ")", ")", ";", "foreach", "(", "$", "interfaces", "as", "$", "interface", ")", "{", "if", "(", "substr", "(", "$", "interface", ",", "-", "14", ")", "===", "'AwareInterface'", ")", "{", "$", "camelCasedServiceId", "=", "substr", "(", "$", "interface", ",", "strrpos", "(", "$", "interface", ",", "'\\\\'", ")", "+", "1", ",", "-", "14", ")", ";", "$", "serviceId", "=", "Container", "::", "underscore", "(", "$", "camelCasedServiceId", ")", ";", "if", "(", "$", "container", "->", "has", "(", "$", "serviceId", ")", ")", "{", "$", "setterMethod", "=", "'set'", ".", "$", "camelCasedServiceId", ";", "$", "definition", "->", "addMethodCall", "(", "$", "setterMethod", ",", "array", "(", "new", "Reference", "(", "$", "serviceId", ")", ")", ")", ";", "}", "}", "}", "}", "}" ]
Processes awareness interfaces by adding a setter method call to the service definition with a reference to the service. @param ContainerBuilder $container
[ "Processes", "awareness", "interfaces", "by", "adding", "a", "setter", "method", "call", "to", "the", "service", "definition", "with", "a", "reference", "to", "the", "service", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/DependencyInjection/AwarenessCompilerPass.php#L22-L39
234,973
schnittstabil/csrf-tokenservice
src/TokenGenerator.php
TokenGenerator.generatePayload
protected function generatePayload($nonce, $iat, $exp) { $payload = new \stdClass(); $payload->nonce = $nonce; $payload->iat = $iat; $payload->ttl = $exp - $iat; $payload->exp = $exp; return $payload; }
php
protected function generatePayload($nonce, $iat, $exp) { $payload = new \stdClass(); $payload->nonce = $nonce; $payload->iat = $iat; $payload->ttl = $exp - $iat; $payload->exp = $exp; return $payload; }
[ "protected", "function", "generatePayload", "(", "$", "nonce", ",", "$", "iat", ",", "$", "exp", ")", "{", "$", "payload", "=", "new", "\\", "stdClass", "(", ")", ";", "$", "payload", "->", "nonce", "=", "$", "nonce", ";", "$", "payload", "->", "iat", "=", "$", "iat", ";", "$", "payload", "->", "ttl", "=", "$", "exp", "-", "$", "iat", ";", "$", "payload", "->", "exp", "=", "$", "exp", ";", "return", "$", "payload", ";", "}" ]
Generate the payload of a CSRF token. @param string $nonce Value used to associate a client session @param int $iat The time that the token was issued, defaults to `time()` @param int $exp The expiration time @return \stdClass
[ "Generate", "the", "payload", "of", "a", "CSRF", "token", "." ]
22aefee674137e661fe439d08414b6abc1fe0d25
https://github.com/schnittstabil/csrf-tokenservice/blob/22aefee674137e661fe439d08414b6abc1fe0d25/src/TokenGenerator.php#L51-L60
234,974
loyals-online/silverstripe-tinymce4
thirdparty/tinymce/tiny_mce_gzip.php
TinyMCE4_Compressor.parseTime
private function parseTime($time) { $multipel = 1; // Hours if (strpos($time, "h") > 0) $multipel = 3600; // Days if (strpos($time, "d") > 0) $multipel = 86400; // Months if (strpos($time, "m") > 0) $multipel = 2592000; // Trim string return intval($time) * $multipel; }
php
private function parseTime($time) { $multipel = 1; // Hours if (strpos($time, "h") > 0) $multipel = 3600; // Days if (strpos($time, "d") > 0) $multipel = 86400; // Months if (strpos($time, "m") > 0) $multipel = 2592000; // Trim string return intval($time) * $multipel; }
[ "private", "function", "parseTime", "(", "$", "time", ")", "{", "$", "multipel", "=", "1", ";", "// Hours\r", "if", "(", "strpos", "(", "$", "time", ",", "\"h\"", ")", ">", "0", ")", "$", "multipel", "=", "3600", ";", "// Days\r", "if", "(", "strpos", "(", "$", "time", ",", "\"d\"", ")", ">", "0", ")", "$", "multipel", "=", "86400", ";", "// Months\r", "if", "(", "strpos", "(", "$", "time", ",", "\"m\"", ")", ">", "0", ")", "$", "multipel", "=", "2592000", ";", "// Trim string\r", "return", "intval", "(", "$", "time", ")", "*", "$", "multipel", ";", "}" ]
Parses the specified time format into seconds. Supports formats like 10h, 10d, 10m. @param String $time Time format to convert into seconds. @return Int Number of seconds for the specified format.
[ "Parses", "the", "specified", "time", "format", "into", "seconds", ".", "Supports", "formats", "like", "10h", "10d", "10m", "." ]
c0603d074ebbb6b8a429f2d2856778e3643bba34
https://github.com/loyals-online/silverstripe-tinymce4/blob/c0603d074ebbb6b8a429f2d2856778e3643bba34/thirdparty/tinymce/tiny_mce_gzip.php#L292-L309
234,975
phlib/db
src/Adapter/CrudTrait.php
CrudTrait.select
public function select($table, $where = [], array $bind = []) { $table = $this->quote()->identifier($table); $sql = "SELECT * FROM $table"; if (is_array($where)) { $where = $this->createWhereExpression($where); } $sql .= (($where) ? " WHERE {$where}" : ''); return $this->query($sql, $bind); }
php
public function select($table, $where = [], array $bind = []) { $table = $this->quote()->identifier($table); $sql = "SELECT * FROM $table"; if (is_array($where)) { $where = $this->createWhereExpression($where); } $sql .= (($where) ? " WHERE {$where}" : ''); return $this->query($sql, $bind); }
[ "public", "function", "select", "(", "$", "table", ",", "$", "where", "=", "[", "]", ",", "array", "$", "bind", "=", "[", "]", ")", "{", "$", "table", "=", "$", "this", "->", "quote", "(", ")", "->", "identifier", "(", "$", "table", ")", ";", "$", "sql", "=", "\"SELECT * FROM $table\"", ";", "if", "(", "is_array", "(", "$", "where", ")", ")", "{", "$", "where", "=", "$", "this", "->", "createWhereExpression", "(", "$", "where", ")", ";", "}", "$", "sql", ".=", "(", "(", "$", "where", ")", "?", "\" WHERE {$where}\"", ":", "''", ")", ";", "return", "$", "this", "->", "query", "(", "$", "sql", ",", "$", "bind", ")", ";", "}" ]
Select data from table. @param string $table @param array|string $where Deprecated usage of parameter as string @param array $bind Deprecated in favour of $where as array @return \PDOStatement
[ "Select", "data", "from", "table", "." ]
30c0fce5fb268766265cb03492c4209bcf916a40
https://github.com/phlib/db/blob/30c0fce5fb268766265cb03492c4209bcf916a40/src/Adapter/CrudTrait.php#L15-L25
234,976
phlib/db
src/Adapter/CrudTrait.php
CrudTrait.insert
public function insert($table, array $data) { $table = $this->quote()->identifier($table); $fields = implode(', ', array_keys($data)); $values = implode(', ', array_map([$this->quote(), 'value'], $data)); $sql = "INSERT INTO $table ($fields) VALUES ($values)"; $stmt = $this->query($sql); return $stmt->rowCount(); }
php
public function insert($table, array $data) { $table = $this->quote()->identifier($table); $fields = implode(', ', array_keys($data)); $values = implode(', ', array_map([$this->quote(), 'value'], $data)); $sql = "INSERT INTO $table ($fields) VALUES ($values)"; $stmt = $this->query($sql); return $stmt->rowCount(); }
[ "public", "function", "insert", "(", "$", "table", ",", "array", "$", "data", ")", "{", "$", "table", "=", "$", "this", "->", "quote", "(", ")", "->", "identifier", "(", "$", "table", ")", ";", "$", "fields", "=", "implode", "(", "', '", ",", "array_keys", "(", "$", "data", ")", ")", ";", "$", "values", "=", "implode", "(", "', '", ",", "array_map", "(", "[", "$", "this", "->", "quote", "(", ")", ",", "'value'", "]", ",", "$", "data", ")", ")", ";", "$", "sql", "=", "\"INSERT INTO $table ($fields) VALUES ($values)\"", ";", "$", "stmt", "=", "$", "this", "->", "query", "(", "$", "sql", ")", ";", "return", "$", "stmt", "->", "rowCount", "(", ")", ";", "}" ]
Insert data to table. @param string $table @param array $data @return int Number of affected rows
[ "Insert", "data", "to", "table", "." ]
30c0fce5fb268766265cb03492c4209bcf916a40
https://github.com/phlib/db/blob/30c0fce5fb268766265cb03492c4209bcf916a40/src/Adapter/CrudTrait.php#L34-L44
234,977
phlib/db
src/Adapter/CrudTrait.php
CrudTrait.update
public function update($table, array $data, $where = [], array $bind = []) { $table = $this->quote()->identifier($table); $fields = []; foreach ($data as $field => $value) { $fields[] = $this->quote()->into("{$field} = ?", $value); } $sql = "UPDATE $table SET " . implode(', ', $fields); if (is_array($where)) { $where = $this->createWhereExpression($where); } $sql .= (($where) ? " WHERE {$where}" : ''); $stmt = $this->query($sql, $bind); return $stmt->rowCount(); }
php
public function update($table, array $data, $where = [], array $bind = []) { $table = $this->quote()->identifier($table); $fields = []; foreach ($data as $field => $value) { $fields[] = $this->quote()->into("{$field} = ?", $value); } $sql = "UPDATE $table SET " . implode(', ', $fields); if (is_array($where)) { $where = $this->createWhereExpression($where); } $sql .= (($where) ? " WHERE {$where}" : ''); $stmt = $this->query($sql, $bind); return $stmt->rowCount(); }
[ "public", "function", "update", "(", "$", "table", ",", "array", "$", "data", ",", "$", "where", "=", "[", "]", ",", "array", "$", "bind", "=", "[", "]", ")", "{", "$", "table", "=", "$", "this", "->", "quote", "(", ")", "->", "identifier", "(", "$", "table", ")", ";", "$", "fields", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "field", "=>", "$", "value", ")", "{", "$", "fields", "[", "]", "=", "$", "this", "->", "quote", "(", ")", "->", "into", "(", "\"{$field} = ?\"", ",", "$", "value", ")", ";", "}", "$", "sql", "=", "\"UPDATE $table SET \"", ".", "implode", "(", "', '", ",", "$", "fields", ")", ";", "if", "(", "is_array", "(", "$", "where", ")", ")", "{", "$", "where", "=", "$", "this", "->", "createWhereExpression", "(", "$", "where", ")", ";", "}", "$", "sql", ".=", "(", "(", "$", "where", ")", "?", "\" WHERE {$where}\"", ":", "''", ")", ";", "$", "stmt", "=", "$", "this", "->", "query", "(", "$", "sql", ",", "$", "bind", ")", ";", "return", "$", "stmt", "->", "rowCount", "(", ")", ";", "}" ]
Update data in table. @param string $table @param array $data @param array|string $where Deprecated usage of parameter as string @param array $bind Deprecated in favour of $where as array @return int Number of affected rows
[ "Update", "data", "in", "table", "." ]
30c0fce5fb268766265cb03492c4209bcf916a40
https://github.com/phlib/db/blob/30c0fce5fb268766265cb03492c4209bcf916a40/src/Adapter/CrudTrait.php#L55-L71
234,978
phlib/db
src/Adapter/CrudTrait.php
CrudTrait.delete
public function delete($table, $where = [], array $bind = []) { $table = $this->quote()->identifier($table); $sql = "DELETE FROM $table"; if (is_array($where)) { $where = $this->createWhereExpression($where); } $sql .= (($where) ? " WHERE {$where}" : ''); $stmt = $this->query($sql, $bind); return $stmt->rowCount(); }
php
public function delete($table, $where = [], array $bind = []) { $table = $this->quote()->identifier($table); $sql = "DELETE FROM $table"; if (is_array($where)) { $where = $this->createWhereExpression($where); } $sql .= (($where) ? " WHERE {$where}" : ''); $stmt = $this->query($sql, $bind); return $stmt->rowCount(); }
[ "public", "function", "delete", "(", "$", "table", ",", "$", "where", "=", "[", "]", ",", "array", "$", "bind", "=", "[", "]", ")", "{", "$", "table", "=", "$", "this", "->", "quote", "(", ")", "->", "identifier", "(", "$", "table", ")", ";", "$", "sql", "=", "\"DELETE FROM $table\"", ";", "if", "(", "is_array", "(", "$", "where", ")", ")", "{", "$", "where", "=", "$", "this", "->", "createWhereExpression", "(", "$", "where", ")", ";", "}", "$", "sql", ".=", "(", "(", "$", "where", ")", "?", "\" WHERE {$where}\"", ":", "''", ")", ";", "$", "stmt", "=", "$", "this", "->", "query", "(", "$", "sql", ",", "$", "bind", ")", ";", "return", "$", "stmt", "->", "rowCount", "(", ")", ";", "}" ]
Delete from table. @param string $table @param array|string $where Deprecated usage of parameter as string @param array $bind Deprecated in favour of $where as array @return int Number of affected rows
[ "Delete", "from", "table", "." ]
30c0fce5fb268766265cb03492c4209bcf916a40
https://github.com/phlib/db/blob/30c0fce5fb268766265cb03492c4209bcf916a40/src/Adapter/CrudTrait.php#L81-L93
234,979
phlib/db
src/Adapter/CrudTrait.php
CrudTrait.createWhereExpression
private function createWhereExpression(array $where = []) { $criteria = []; foreach ($where as $index => $value) { if (is_int($index)) { $criteria[] = $value; } else { $criteria[] = $this->quote()->into($index, $value); } } return implode(' AND ', $criteria); }
php
private function createWhereExpression(array $where = []) { $criteria = []; foreach ($where as $index => $value) { if (is_int($index)) { $criteria[] = $value; } else { $criteria[] = $this->quote()->into($index, $value); } } return implode(' AND ', $criteria); }
[ "private", "function", "createWhereExpression", "(", "array", "$", "where", "=", "[", "]", ")", "{", "$", "criteria", "=", "[", "]", ";", "foreach", "(", "$", "where", "as", "$", "index", "=>", "$", "value", ")", "{", "if", "(", "is_int", "(", "$", "index", ")", ")", "{", "$", "criteria", "[", "]", "=", "$", "value", ";", "}", "else", "{", "$", "criteria", "[", "]", "=", "$", "this", "->", "quote", "(", ")", "->", "into", "(", "$", "index", ",", "$", "value", ")", ";", "}", "}", "return", "implode", "(", "' AND '", ",", "$", "criteria", ")", ";", "}" ]
Create WHERE expression from given criteria @param array $where @return string
[ "Create", "WHERE", "expression", "from", "given", "criteria" ]
30c0fce5fb268766265cb03492c4209bcf916a40
https://github.com/phlib/db/blob/30c0fce5fb268766265cb03492c4209bcf916a40/src/Adapter/CrudTrait.php#L127-L138
234,980
NicolasMahe/Laravel-SlackOutput
src/Helper/ExceptionHelper.php
ExceptionHelper.asArray
static function asArray(Exception $e) { return [ 'exception' => get_class($e), 'code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'hash' => self::hash($e), 'status_code' => self::statusCode($e) ]; }
php
static function asArray(Exception $e) { return [ 'exception' => get_class($e), 'code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'hash' => self::hash($e), 'status_code' => self::statusCode($e) ]; }
[ "static", "function", "asArray", "(", "Exception", "$", "e", ")", "{", "return", "[", "'exception'", "=>", "get_class", "(", "$", "e", ")", ",", "'code'", "=>", "$", "e", "->", "getCode", "(", ")", ",", "'message'", "=>", "$", "e", "->", "getMessage", "(", ")", ",", "'file'", "=>", "$", "e", "->", "getFile", "(", ")", ",", "'line'", "=>", "$", "e", "->", "getLine", "(", ")", ",", "'hash'", "=>", "self", "::", "hash", "(", "$", "e", ")", ",", "'status_code'", "=>", "self", "::", "statusCode", "(", "$", "e", ")", "]", ";", "}" ]
Return an array from an Exception @param Exception $e @return array
[ "Return", "an", "array", "from", "an", "Exception" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Helper/ExceptionHelper.php#L17-L28
234,981
NicolasMahe/Laravel-SlackOutput
src/Helper/ExceptionHelper.php
ExceptionHelper.statusCode
static function statusCode(Exception $e) { return $e instanceof \Symfony\Component\HttpKernel\Exception\HttpException ? $e->getStatusCode() : 500; }
php
static function statusCode(Exception $e) { return $e instanceof \Symfony\Component\HttpKernel\Exception\HttpException ? $e->getStatusCode() : 500; }
[ "static", "function", "statusCode", "(", "Exception", "$", "e", ")", "{", "return", "$", "e", "instanceof", "\\", "Symfony", "\\", "Component", "\\", "HttpKernel", "\\", "Exception", "\\", "HttpException", "?", "$", "e", "->", "getStatusCode", "(", ")", ":", "500", ";", "}" ]
Get the http status code of an exception @param Exception $e @return int
[ "Get", "the", "http", "status", "code", "of", "an", "exception" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Helper/ExceptionHelper.php#L38-L41
234,982
NicolasMahe/Laravel-SlackOutput
src/Helper/ExceptionHelper.php
ExceptionHelper.hash
static function hash(Exception $e) { return $e instanceof \App\Exceptions\JSONException ? $e->getHash() : null; }
php
static function hash(Exception $e) { return $e instanceof \App\Exceptions\JSONException ? $e->getHash() : null; }
[ "static", "function", "hash", "(", "Exception", "$", "e", ")", "{", "return", "$", "e", "instanceof", "\\", "App", "\\", "Exceptions", "\\", "JSONException", "?", "$", "e", "->", "getHash", "(", ")", ":", "null", ";", "}" ]
Get the hash code of an exception @param Exception $e @return null
[ "Get", "the", "hash", "code", "of", "an", "exception" ]
fc3722ba64a0ce4d833555bb1a27513e13959b34
https://github.com/NicolasMahe/Laravel-SlackOutput/blob/fc3722ba64a0ce4d833555bb1a27513e13959b34/src/Helper/ExceptionHelper.php#L51-L54
234,983
makinacorpus/drupal-ucms
ucms_tree/src/MenuAccess.php
MenuAccess.isUserWebmaster
public function isUserWebmaster(Menu $menu, AccountInterface $account) { if ($menu->hasSiteId()) { $site = $this->siteManager->getStorage()->findOne($menu->getSiteId()); return $this->siteManager->getAccess()->userIsWebmaster($account, $site); } return false; }
php
public function isUserWebmaster(Menu $menu, AccountInterface $account) { if ($menu->hasSiteId()) { $site = $this->siteManager->getStorage()->findOne($menu->getSiteId()); return $this->siteManager->getAccess()->userIsWebmaster($account, $site); } return false; }
[ "public", "function", "isUserWebmaster", "(", "Menu", "$", "menu", ",", "AccountInterface", "$", "account", ")", "{", "if", "(", "$", "menu", "->", "hasSiteId", "(", ")", ")", "{", "$", "site", "=", "$", "this", "->", "siteManager", "->", "getStorage", "(", ")", "->", "findOne", "(", "$", "menu", "->", "getSiteId", "(", ")", ")", ";", "return", "$", "this", "->", "siteManager", "->", "getAccess", "(", ")", "->", "userIsWebmaster", "(", "$", "account", ",", "$", "site", ")", ";", "}", "return", "false", ";", "}" ]
Is user webmaster in the menu site @param Menu $menu @param AccountInterface $account @return bool
[ "Is", "user", "webmaster", "in", "the", "menu", "site" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_tree/src/MenuAccess.php#L53-L62
234,984
makinacorpus/drupal-ucms
ucms_tree/src/MenuAccess.php
MenuAccess.canEditMenu
public function canEditMenu(Menu $menu, AccountInterface $account) { return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->isUserWebmaster($menu, $account); }
php
public function canEditMenu(Menu $menu, AccountInterface $account) { return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->isUserWebmaster($menu, $account); }
[ "public", "function", "canEditMenu", "(", "Menu", "$", "menu", ",", "AccountInterface", "$", "account", ")", "{", "return", "$", "account", "->", "hasPermission", "(", "self", "::", "PERM_MANAGE_ALL_MENU", ")", "||", "$", "this", "->", "isUserWebmaster", "(", "$", "menu", ",", "$", "account", ")", ";", "}" ]
Can user edit the given menu @param Menu $menu @param AccountInterface $account @return bool
[ "Can", "user", "edit", "the", "given", "menu" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_tree/src/MenuAccess.php#L72-L75
234,985
makinacorpus/drupal-ucms
ucms_tree/src/MenuAccess.php
MenuAccess.canDeleteMenu
public function canDeleteMenu(Menu $menu, AccountInterface $account) { if ($menu->isSiteMain()) { return false; } return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->isUserWebmaster($menu, $account); }
php
public function canDeleteMenu(Menu $menu, AccountInterface $account) { if ($menu->isSiteMain()) { return false; } return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->isUserWebmaster($menu, $account); }
[ "public", "function", "canDeleteMenu", "(", "Menu", "$", "menu", ",", "AccountInterface", "$", "account", ")", "{", "if", "(", "$", "menu", "->", "isSiteMain", "(", ")", ")", "{", "return", "false", ";", "}", "return", "$", "account", "->", "hasPermission", "(", "self", "::", "PERM_MANAGE_ALL_MENU", ")", "||", "$", "this", "->", "isUserWebmaster", "(", "$", "menu", ",", "$", "account", ")", ";", "}" ]
Can user delete the given menu @param Menu $menu @param AccountInterface $account @return bool
[ "Can", "user", "delete", "the", "given", "menu" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_tree/src/MenuAccess.php#L98-L105
234,986
makinacorpus/drupal-ucms
ucms_tree/src/MenuAccess.php
MenuAccess.canAccessMenuAdmin
public function canAccessMenuAdmin(AccountInterface $account, Site $site = null) { if ($account->hasPermission(self::PERM_MANAGE_ALL_MENU)) { return true; } $site = $this->ensureSiteContext($site); if ($site) { return $this->siteManager->getAccess()->userIsWebmaster($account, $site); } else { return $this->siteManager->getAccess()->userIsWebmaster($account); } return false; }
php
public function canAccessMenuAdmin(AccountInterface $account, Site $site = null) { if ($account->hasPermission(self::PERM_MANAGE_ALL_MENU)) { return true; } $site = $this->ensureSiteContext($site); if ($site) { return $this->siteManager->getAccess()->userIsWebmaster($account, $site); } else { return $this->siteManager->getAccess()->userIsWebmaster($account); } return false; }
[ "public", "function", "canAccessMenuAdmin", "(", "AccountInterface", "$", "account", ",", "Site", "$", "site", "=", "null", ")", "{", "if", "(", "$", "account", "->", "hasPermission", "(", "self", "::", "PERM_MANAGE_ALL_MENU", ")", ")", "{", "return", "true", ";", "}", "$", "site", "=", "$", "this", "->", "ensureSiteContext", "(", "$", "site", ")", ";", "if", "(", "$", "site", ")", "{", "return", "$", "this", "->", "siteManager", "->", "getAccess", "(", ")", "->", "userIsWebmaster", "(", "$", "account", ",", "$", "site", ")", ";", "}", "else", "{", "return", "$", "this", "->", "siteManager", "->", "getAccess", "(", ")", "->", "userIsWebmaster", "(", "$", "account", ")", ";", "}", "return", "false", ";", "}" ]
Can user access to the menu admin in the current context @param AccountInterface $account @param Site $site @return bool
[ "Can", "user", "access", "to", "the", "menu", "admin", "in", "the", "current", "context" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_tree/src/MenuAccess.php#L115-L130
234,987
makinacorpus/drupal-ucms
ucms_tree/src/MenuAccess.php
MenuAccess.canCreateMenu
public function canCreateMenu(AccountInterface $account, Site $site = null) { $site = $this->ensureSiteContext($site); return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->siteManager->getAccess()->userIsWebmaster($account, $site); }
php
public function canCreateMenu(AccountInterface $account, Site $site = null) { $site = $this->ensureSiteContext($site); return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->siteManager->getAccess()->userIsWebmaster($account, $site); }
[ "public", "function", "canCreateMenu", "(", "AccountInterface", "$", "account", ",", "Site", "$", "site", "=", "null", ")", "{", "$", "site", "=", "$", "this", "->", "ensureSiteContext", "(", "$", "site", ")", ";", "return", "$", "account", "->", "hasPermission", "(", "self", "::", "PERM_MANAGE_ALL_MENU", ")", "||", "$", "this", "->", "siteManager", "->", "getAccess", "(", ")", "->", "userIsWebmaster", "(", "$", "account", ",", "$", "site", ")", ";", "}" ]
Can user create a menu in the given context @param AccountInterface $account @param Site $site @return bool
[ "Can", "user", "create", "a", "menu", "in", "the", "given", "context" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_tree/src/MenuAccess.php#L140-L145
234,988
runcmf/runbb
src/RunBB/Core/AdminUtils.php
AdminUtils.deleteFolder
public static function deleteFolder($dirPath) { $it = new RecursiveDirectoryIterator($dirPath, RecursiveDirectoryIterator::SKIP_DOTS); $files = new RecursiveIteratorIterator( $it, RecursiveIteratorIterator::CHILD_FIRST ); foreach ($files as $file) { if ($file->isDir()) { rmdir($file->getRealPath()); } else { unlink($file->getRealPath()); } } rmdir($dirPath); }
php
public static function deleteFolder($dirPath) { $it = new RecursiveDirectoryIterator($dirPath, RecursiveDirectoryIterator::SKIP_DOTS); $files = new RecursiveIteratorIterator( $it, RecursiveIteratorIterator::CHILD_FIRST ); foreach ($files as $file) { if ($file->isDir()) { rmdir($file->getRealPath()); } else { unlink($file->getRealPath()); } } rmdir($dirPath); }
[ "public", "static", "function", "deleteFolder", "(", "$", "dirPath", ")", "{", "$", "it", "=", "new", "RecursiveDirectoryIterator", "(", "$", "dirPath", ",", "RecursiveDirectoryIterator", "::", "SKIP_DOTS", ")", ";", "$", "files", "=", "new", "RecursiveIteratorIterator", "(", "$", "it", ",", "RecursiveIteratorIterator", "::", "CHILD_FIRST", ")", ";", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "if", "(", "$", "file", "->", "isDir", "(", ")", ")", "{", "rmdir", "(", "$", "file", "->", "getRealPath", "(", ")", ")", ";", "}", "else", "{", "unlink", "(", "$", "file", "->", "getRealPath", "(", ")", ")", ";", "}", "}", "rmdir", "(", "$", "dirPath", ")", ";", "}" ]
Delete a folder and all its content
[ "Delete", "a", "folder", "and", "all", "its", "content" ]
d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463
https://github.com/runcmf/runbb/blob/d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463/src/RunBB/Core/AdminUtils.php#L78-L93
234,989
runcmf/runbb
src/RunBB/Core/AdminUtils.php
AdminUtils.getContent
public static function getContent($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "RunBB Marketplace"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $content = curl_exec($ch); curl_close($ch); return $content; }
php
public static function getContent($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "RunBB Marketplace"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $content = curl_exec($ch); curl_close($ch); return $content; }
[ "public", "static", "function", "getContent", "(", "$", "url", ")", "{", "$", "ch", "=", "curl_init", "(", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_URL", ",", "$", "url", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_USERAGENT", ",", "\"RunBB Marketplace\"", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_RETURNTRANSFER", ",", "true", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_TIMEOUT", ",", "30", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_FOLLOWLOCATION", ",", "true", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_HTTPGET", ",", "true", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_SSL_VERIFYHOST", ",", "0", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURLOPT_SSL_VERIFYPEER", ",", "0", ")", ";", "$", "content", "=", "curl_exec", "(", "$", "ch", ")", ";", "curl_close", "(", "$", "ch", ")", ";", "return", "$", "content", ";", "}" ]
Wrapper for cURL
[ "Wrapper", "for", "cURL" ]
d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463
https://github.com/runcmf/runbb/blob/d4f4098bcece48b78ea2d1ae5eeead7ac9a8b463/src/RunBB/Core/AdminUtils.php#L111-L128
234,990
box/shmock
src/Shmock/ClassBuilderInstanceClass.php
ClassBuilderInstanceClass.replay
public function replay() { $mockClassName = parent::replay(); $mockClassReflector = new \ReflectionClass($mockClassName); return $mockClassReflector->newInstanceArgs($this->constructor_arguments); }
php
public function replay() { $mockClassName = parent::replay(); $mockClassReflector = new \ReflectionClass($mockClassName); return $mockClassReflector->newInstanceArgs($this->constructor_arguments); }
[ "public", "function", "replay", "(", ")", "{", "$", "mockClassName", "=", "parent", "::", "replay", "(", ")", ";", "$", "mockClassReflector", "=", "new", "\\", "ReflectionClass", "(", "$", "mockClassName", ")", ";", "return", "$", "mockClassReflector", "->", "newInstanceArgs", "(", "$", "this", "->", "constructor_arguments", ")", ";", "}" ]
When this is invoked, Shmock concludes this instance's build phase, runs any policies that may have been registered, and creates a mock object in the replay phase. @return mixed an instance of a subclass of the mocked class.
[ "When", "this", "is", "invoked", "Shmock", "concludes", "this", "instance", "s", "build", "phase", "runs", "any", "policies", "that", "may", "have", "been", "registered", "and", "creates", "a", "mock", "object", "in", "the", "replay", "phase", "." ]
d207d74b9aa2c6c48621091ddc9bbba219a8c45e
https://github.com/box/shmock/blob/d207d74b9aa2c6c48621091ddc9bbba219a8c45e/src/Shmock/ClassBuilderInstanceClass.php#L132-L138
234,991
box/shmock
src/Shmock/ClassBuilderInstanceClass.php
ClassBuilderInstanceClass.shmock_class
public function shmock_class($closure) { $this->in_static_mode = true; $closure($this); $this->in_static_mode = false; }
php
public function shmock_class($closure) { $this->in_static_mode = true; $closure($this); $this->in_static_mode = false; }
[ "public", "function", "shmock_class", "(", "$", "closure", ")", "{", "$", "this", "->", "in_static_mode", "=", "true", ";", "$", "closure", "(", "$", "this", ")", ";", "$", "this", "->", "in_static_mode", "=", "false", ";", "}" ]
When mocking an object instance, it may be desirable to mock static methods as well. Because Shmock has strict rules that mock instances may only mock instance methods, to mock a static method requires dropping into the mock class context. This is made simple by the shmock_class() method on Instance. <pre> // User is an ActiveRecord-style class with finders and data members // (this is just an example, this is probably not a good way to organize this code) class User { private $id; private $userName; public function updateUserName($userName) { /// persist to db $this->userName = $userName; $handle = static::dbHandle(); $handle->update(['userName' => $this->userName]); $this->fireEvent('/users/username'); } public function fireEvent($eventType) { Notifications::fire($this->id, $eventType); } public static function dbHandle() { return new DbHandle('schema.users'); } } // In a test we want to ensure that save() will fire notifications // and correctly persist to the database. $mock = $this->shmock('User', function ($user) { // ensure that the user will fire the event $user->fireEvent('/users/username')->once(); // use shmock_class to mock the static method dbHandle() $user->shmock_class(function ($user_class) { $user_class->dbHandle()->return_value(new FakeDBHandle()); }); }); </pre> @param callable $closure @return void
[ "When", "mocking", "an", "object", "instance", "it", "may", "be", "desirable", "to", "mock", "static", "methods", "as", "well", ".", "Because", "Shmock", "has", "strict", "rules", "that", "mock", "instances", "may", "only", "mock", "instance", "methods", "to", "mock", "a", "static", "method", "requires", "dropping", "into", "the", "mock", "class", "context", "." ]
d207d74b9aa2c6c48621091ddc9bbba219a8c45e
https://github.com/box/shmock/blob/d207d74b9aa2c6c48621091ddc9bbba219a8c45e/src/Shmock/ClassBuilderInstanceClass.php#L203-L208
234,992
box/shmock
src/Shmock/ClassBuilderInstanceClass.php
ClassBuilderInstanceClass.recordMethodInvocation
protected function recordMethodInvocation($methodName) { if ($this->in_static_mode) { $this->expectedStaticMethodCalls[] = $methodName; } else { $this->expectedInstanceMethodCalls[] = $methodName; } }
php
protected function recordMethodInvocation($methodName) { if ($this->in_static_mode) { $this->expectedStaticMethodCalls[] = $methodName; } else { $this->expectedInstanceMethodCalls[] = $methodName; } }
[ "protected", "function", "recordMethodInvocation", "(", "$", "methodName", ")", "{", "if", "(", "$", "this", "->", "in_static_mode", ")", "{", "$", "this", "->", "expectedStaticMethodCalls", "[", "]", "=", "$", "methodName", ";", "}", "else", "{", "$", "this", "->", "expectedInstanceMethodCalls", "[", "]", "=", "$", "methodName", ";", "}", "}" ]
Housekeeping function to record a method invocation @param string $methodName @return void
[ "Housekeeping", "function", "to", "record", "a", "method", "invocation" ]
d207d74b9aa2c6c48621091ddc9bbba219a8c45e
https://github.com/box/shmock/blob/d207d74b9aa2c6c48621091ddc9bbba219a8c45e/src/Shmock/ClassBuilderInstanceClass.php#L231-L238
234,993
box/shmock
src/Shmock/Shmock.php
Shmock.verify
public static function verify() { $mocks = self::$outstanding_shmocks; self::$outstanding_shmocks = []; foreach ($mocks as $mock) { $mock->verify(); } }
php
public static function verify() { $mocks = self::$outstanding_shmocks; self::$outstanding_shmocks = []; foreach ($mocks as $mock) { $mock->verify(); } }
[ "public", "static", "function", "verify", "(", ")", "{", "$", "mocks", "=", "self", "::", "$", "outstanding_shmocks", ";", "self", "::", "$", "outstanding_shmocks", "=", "[", "]", ";", "foreach", "(", "$", "mocks", "as", "$", "mock", ")", "{", "$", "mock", "->", "verify", "(", ")", ";", "}", "}" ]
This will verify that all mocks so far have been satisfied. It will clear the set of outstanding mocks, regardless if any have failed. @return void
[ "This", "will", "verify", "that", "all", "mocks", "so", "far", "have", "been", "satisfied", ".", "It", "will", "clear", "the", "set", "of", "outstanding", "mocks", "regardless", "if", "any", "have", "failed", "." ]
d207d74b9aa2c6c48621091ddc9bbba219a8c45e
https://github.com/box/shmock/blob/d207d74b9aa2c6c48621091ddc9bbba219a8c45e/src/Shmock/Shmock.php#L145-L152
234,994
accompli/accompli
src/Console/Application.php
Application.getTerminalWidth
public function getTerminalWidth() { $terminalDimensions = $this->getTerminalDimensions(); $width = 120; if (isset($terminalDimensions[0]) && $terminalDimensions[0] > 0) { $width = $terminalDimensions[0]; } return $width; }
php
public function getTerminalWidth() { $terminalDimensions = $this->getTerminalDimensions(); $width = 120; if (isset($terminalDimensions[0]) && $terminalDimensions[0] > 0) { $width = $terminalDimensions[0]; } return $width; }
[ "public", "function", "getTerminalWidth", "(", ")", "{", "$", "terminalDimensions", "=", "$", "this", "->", "getTerminalDimensions", "(", ")", ";", "$", "width", "=", "120", ";", "if", "(", "isset", "(", "$", "terminalDimensions", "[", "0", "]", ")", "&&", "$", "terminalDimensions", "[", "0", "]", ">", "0", ")", "{", "$", "width", "=", "$", "terminalDimensions", "[", "0", "]", ";", "}", "return", "$", "width", ";", "}" ]
Returns the terminal width. @return int
[ "Returns", "the", "terminal", "width", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/Console/Application.php#L41-L51
234,995
accompli/accompli
src/Console/Application.php
Application.getDefaultCommands
protected function getDefaultCommands() { $commands = parent::getDefaultCommands(); $commands[] = new InitCommand(); $commands[] = new InstallReleaseCommand(); $commands[] = new DeployReleaseCommand(); return $commands; }
php
protected function getDefaultCommands() { $commands = parent::getDefaultCommands(); $commands[] = new InitCommand(); $commands[] = new InstallReleaseCommand(); $commands[] = new DeployReleaseCommand(); return $commands; }
[ "protected", "function", "getDefaultCommands", "(", ")", "{", "$", "commands", "=", "parent", "::", "getDefaultCommands", "(", ")", ";", "$", "commands", "[", "]", "=", "new", "InitCommand", "(", ")", ";", "$", "commands", "[", "]", "=", "new", "InstallReleaseCommand", "(", ")", ";", "$", "commands", "[", "]", "=", "new", "DeployReleaseCommand", "(", ")", ";", "return", "$", "commands", ";", "}" ]
Returns the array with default commands. @return array
[ "Returns", "the", "array", "with", "default", "commands", "." ]
618f28377448d8caa90d63bfa5865a3ee15e49e7
https://github.com/accompli/accompli/blob/618f28377448d8caa90d63bfa5865a3ee15e49e7/src/Console/Application.php#L58-L66
234,996
nmdimas/yii2-user-agent-parser
UserAgentParser.php
UserAgentParser.getUserAgentObject
public function getUserAgentObject($userAgent = null) { if (!$userAgent) { $userAgent = $this->getUserAgentByRequest(); } $objectData = ArrayHelper::merge( ['class' => 'yii\useragentparser\UserAgentObject','userAgent'=>$userAgent], $this->parseUserAgent($userAgent) ); return Yii::createObject($objectData); }
php
public function getUserAgentObject($userAgent = null) { if (!$userAgent) { $userAgent = $this->getUserAgentByRequest(); } $objectData = ArrayHelper::merge( ['class' => 'yii\useragentparser\UserAgentObject','userAgent'=>$userAgent], $this->parseUserAgent($userAgent) ); return Yii::createObject($objectData); }
[ "public", "function", "getUserAgentObject", "(", "$", "userAgent", "=", "null", ")", "{", "if", "(", "!", "$", "userAgent", ")", "{", "$", "userAgent", "=", "$", "this", "->", "getUserAgentByRequest", "(", ")", ";", "}", "$", "objectData", "=", "ArrayHelper", "::", "merge", "(", "[", "'class'", "=>", "'yii\\useragentparser\\UserAgentObject'", ",", "'userAgent'", "=>", "$", "userAgent", "]", ",", "$", "this", "->", "parseUserAgent", "(", "$", "userAgent", ")", ")", ";", "return", "Yii", "::", "createObject", "(", "$", "objectData", ")", ";", "}" ]
This method return UserAgentObject. @param null|string $userAgent You can set user-agent. If $userAgent will be null, user-agent will be uses default $_SERVER['HTTP_USER_AGENT'] @return UserAgentObject @throws \yii\base\InvalidConfigException
[ "This", "method", "return", "UserAgentObject", "." ]
16573a7c3555a6debfe93177c266aa461614bb4f
https://github.com/nmdimas/yii2-user-agent-parser/blob/16573a7c3555a6debfe93177c266aa461614bb4f/UserAgentParser.php#L48-L59
234,997
makinacorpus/drupal-ucms
ucms_label/src/LabelManager.php
LabelManager.loadVocabulary
public function loadVocabulary() { $entities = $this->entityManager ->getStorage('taxonomy_vocabulary') ->loadByProperties(['machine_name' => self::VOCABULARY_MACHINE_NAME]); return reset($entities); }
php
public function loadVocabulary() { $entities = $this->entityManager ->getStorage('taxonomy_vocabulary') ->loadByProperties(['machine_name' => self::VOCABULARY_MACHINE_NAME]); return reset($entities); }
[ "public", "function", "loadVocabulary", "(", ")", "{", "$", "entities", "=", "$", "this", "->", "entityManager", "->", "getStorage", "(", "'taxonomy_vocabulary'", ")", "->", "loadByProperties", "(", "[", "'machine_name'", "=>", "self", "::", "VOCABULARY_MACHINE_NAME", "]", ")", ";", "return", "reset", "(", "$", "entities", ")", ";", "}" ]
Load the labels vocabulary. @return stdClass
[ "Load", "the", "labels", "vocabulary", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/LabelManager.php#L50-L57
234,998
makinacorpus/drupal-ucms
ucms_label/src/LabelManager.php
LabelManager.isRootLabel
public function isRootLabel(\stdClass $label) { $q = $this->db ->select('taxonomy_term_hierarchy', 'h') ->condition('h.parent', 0) ->condition('h.tid', $label->tid) ->fields('h', array('tid')) ->range(0, 1) ->execute(); return !empty($q->fetch()); }
php
public function isRootLabel(\stdClass $label) { $q = $this->db ->select('taxonomy_term_hierarchy', 'h') ->condition('h.parent', 0) ->condition('h.tid', $label->tid) ->fields('h', array('tid')) ->range(0, 1) ->execute(); return !empty($q->fetch()); }
[ "public", "function", "isRootLabel", "(", "\\", "stdClass", "$", "label", ")", "{", "$", "q", "=", "$", "this", "->", "db", "->", "select", "(", "'taxonomy_term_hierarchy'", ",", "'h'", ")", "->", "condition", "(", "'h.parent'", ",", "0", ")", "->", "condition", "(", "'h.tid'", ",", "$", "label", "->", "tid", ")", "->", "fields", "(", "'h'", ",", "array", "(", "'tid'", ")", ")", "->", "range", "(", "0", ",", "1", ")", "->", "execute", "(", ")", ";", "return", "!", "empty", "(", "$", "q", "->", "fetch", "(", ")", ")", ";", "}" ]
Is the label a root term? @param stdClass $label @return boolean
[ "Is", "the", "label", "a", "root", "term?" ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/LabelManager.php#L155-L166
234,999
makinacorpus/drupal-ucms
ucms_label/src/LabelManager.php
LabelManager.saveLabel
public function saveLabel(\stdClass $label) { if (!empty($label->tid)) { // Prevents to save a label with a parent if it has children. // The labels vocabulary must have only two levels. if (!isset($label->original)) { $label->original = $this->entityManager->getStorage('taxonomy_term')->loadUnchanged($label->tid); } if (!isset($label->original->parent)) { $label->original->parent = 0; } if ($this->hasChildren($label) && $label->parent != $label->original->parent) { throw new \LogicException("Can't define a parent to a label which has children."); } } return taxonomy_term_save($label); }
php
public function saveLabel(\stdClass $label) { if (!empty($label->tid)) { // Prevents to save a label with a parent if it has children. // The labels vocabulary must have only two levels. if (!isset($label->original)) { $label->original = $this->entityManager->getStorage('taxonomy_term')->loadUnchanged($label->tid); } if (!isset($label->original->parent)) { $label->original->parent = 0; } if ($this->hasChildren($label) && $label->parent != $label->original->parent) { throw new \LogicException("Can't define a parent to a label which has children."); } } return taxonomy_term_save($label); }
[ "public", "function", "saveLabel", "(", "\\", "stdClass", "$", "label", ")", "{", "if", "(", "!", "empty", "(", "$", "label", "->", "tid", ")", ")", "{", "// Prevents to save a label with a parent if it has children.", "// The labels vocabulary must have only two levels.", "if", "(", "!", "isset", "(", "$", "label", "->", "original", ")", ")", "{", "$", "label", "->", "original", "=", "$", "this", "->", "entityManager", "->", "getStorage", "(", "'taxonomy_term'", ")", "->", "loadUnchanged", "(", "$", "label", "->", "tid", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "label", "->", "original", "->", "parent", ")", ")", "{", "$", "label", "->", "original", "->", "parent", "=", "0", ";", "}", "if", "(", "$", "this", "->", "hasChildren", "(", "$", "label", ")", "&&", "$", "label", "->", "parent", "!=", "$", "label", "->", "original", "->", "parent", ")", "{", "throw", "new", "\\", "LogicException", "(", "\"Can't define a parent to a label which has children.\"", ")", ";", "}", "}", "return", "taxonomy_term_save", "(", "$", "label", ")", ";", "}" ]
Save the label. @return integer Constant SAVED_NEW or SAVED_UPDATED. @throws \LogicException @see taxonomy_term_save().
[ "Save", "the", "label", "." ]
6b8a84305472d2cad816102672f10274b3bbb535
https://github.com/makinacorpus/drupal-ucms/blob/6b8a84305472d2cad816102672f10274b3bbb535/ucms_label/src/LabelManager.php#L176-L193