Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Try to refactor the methodForAction but i'm struggling!
Browse files Browse the repository at this point in the history
refactoring the method is ok but i have issues with the properties
  • Loading branch information
godbout committed Jun 17, 2017
1 parent 1da5950 commit a43799f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
13 changes: 13 additions & 0 deletions src/Harvest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ public function getTags($data)
return $this->getItems('tasks', $data);
}

/**
* @param $action
* @return mixed
*/
protected function methodForAction($action)
{
if (isset($this->methods[$action]) === false) {
return;
}

return $this->methods[$action];
}

/**
* @param string $action
* @param string $apiUri
Expand Down
15 changes: 2 additions & 13 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ protected function __construct($baseUri, $credentials)
*/
abstract protected function apiDeleteUrl($timerId);

abstract protected function methodForAction($action);

/**
* @param $timerId
*/
Expand All @@ -102,17 +104,4 @@ abstract protected function getRecentTimers();
* @param $data
*/
abstract protected function getTags($data);

/**
* @param $action
* @return mixed
*/
protected function methodForAction($action)
{
if (isset($this->methods[$action]) === false) {
return;
}

return $this->methods[$action];
}
}
13 changes: 13 additions & 0 deletions src/Toggl.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ public function getTags($data)
return $this->getItems('tags', $data);
}

/**
* @param $action
* @return mixed
*/
protected function methodForAction($action)
{
if (isset($this->methods[$action]) === false) {
return;
}

return $this->methods[$action];
}

/**
* @param string $action
* @param string $apiUri
Expand Down

0 comments on commit a43799f

Please sign in to comment.