Skip to content

Commit

Permalink
Normalize all methods from snake_case to camelCase.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzx committed Jan 19, 2018
1 parent e39d0e8 commit 2cbd5d8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/ImdbImporter/Importer.php
Expand Up @@ -57,7 +57,7 @@ public function submit(array $ratings)
{
foreach ($ratings as $rating) {
if (isset($rating['id'])) {
$tconst = $this->formatImdbID($rating['id']);
$tconst = $this->formatImdbId($rating['id']);
} else {
$this->getLogger()->debug("Searching for $rating[title]");
$tconst = $this->getIdByTitle($rating['title']);
Expand All @@ -67,9 +67,9 @@ public function submit(array $ratings)
continue;
}

$auth = $this->get_auth_token($tconst);
$auth = $this->getAuthToken($tconst);

$this->submit_rating($rating, $tconst, $auth);
$this->submitRating($rating, $tconst, $auth);
}
}

Expand Down Expand Up @@ -166,14 +166,14 @@ private function getIdByTitle($title)
* @param string $tconst
* @return string
*/
private function get_auth_token($tconst)
private function getAuthToken($tconst)
{
$cookie_details = ['id' => $this->id];

$context_options = [
'http' => [
'method' => 'GET',
'header' => 'Cookie: ' . $this->http_build_cookie($cookie_details)
'header' => 'Cookie: ' . $this->httpBuildCookie($cookie_details)
]
];
$context = stream_context_create($context_options);
Expand All @@ -197,7 +197,7 @@ private function get_auth_token($tconst)
* @param string $tconst
* @param $auth
*/
private function submit_rating(array $rating, $tconst, $auth)
private function submitRating(array $rating, $tconst, $auth)
{
$this->getLogger()->debug("Submitting rating for " . json_encode($rating) . " $tconst");

Expand All @@ -216,7 +216,7 @@ private function submit_rating(array $rating, $tconst, $auth)
$context_options = [
'http' => [
'method' => 'POST',
'header' => 'Cookie: ' . $this->http_build_cookie($cookie_details) . "\r\n" .
'header' => 'Cookie: ' . $this->httpBuildCookie($cookie_details) . "\r\n" .
'Content-type: application/x-www-form-urlencoded' . "\r\n" .
'Content-Length: ' . strlen($data),
'content' => $data
Expand All @@ -241,7 +241,7 @@ private function submit_rating(array $rating, $tconst, $auth)
* @param array $data
* @return string
*/
private function http_build_cookie(array $data)
private function httpBuildCookie(array $data)
{
$cookie_string = '';
foreach ($data as $key => $value) {
Expand All @@ -257,7 +257,7 @@ private function http_build_cookie(array $data)
* @return string
* @throws \Exception
*/
private function formatImdbID($id)
private function formatImdbId($id)
{
if (strpos($id, 'tt') === 0) {
return $id;
Expand Down

0 comments on commit 2cbd5d8

Please sign in to comment.