@@ -41,9 +41,11 @@ |
||
| 41 | 41 | return self::getInstance()->scriptFilter->output(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public static function do() |
|
| 44 | + public static function do { |
|
| 45 | + () |
|
| 45 | 46 | { |
| 46 | 47 | $action = getenv('timer_action'); |
| 48 | + } |
|
| 47 | 49 | |
| 48 | 50 | if ($timerId = getenv('timer_id')) { |
| 49 | 51 | return Timer::$action($timerId); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $serviceEnabled = Workflow::serviceEnabled(); |
| 24 | 24 | |
| 25 | - if (! $serviceEnabled) { |
|
| 25 | + if (!$serviceEnabled) { |
|
| 26 | 26 | return; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | private static function startTimer() |
| 47 | 47 | { |
| 48 | - if (! empty(Workflow::serviceEnabled())) { |
|
| 48 | + if (!empty(Workflow::serviceEnabled())) { |
|
| 49 | 49 | return Item::create() |
| 50 | 50 | ->uid('start_timer') |
| 51 | 51 | ->title('Start "' . self::userInput() . '"') |
@@ -35,8 +35,8 @@ |
||
| 35 | 35 | private static function credentialsFound() |
| 36 | 36 | { |
| 37 | 37 | return ( |
| 38 | - ! empty(Workflow::getConfig()->read('harvest.api_token')) |
|
| 39 | - || ! empty(Workflow::getConfig()->read('harvest.account_id')) |
|
| 38 | + !empty(Workflow::getConfig()->read('harvest.api_token')) |
|
| 39 | + || !empty(Workflow::getConfig()->read('harvest.account_id')) |
|
| 40 | 40 | ); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | protected static function stateSubtitle() |
| 44 | 44 | { |
| 45 | - return (self::toEnable() ? 'Other services disabled. ': '') . 'You may press enter to quit the workflow'; |
|
| 45 | + return (self::toEnable() ? 'Other services disabled. ' : '') . 'You may press enter to quit the workflow'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | private static function back() |
@@ -5,7 +5,9 @@ |
||
| 5 | 5 | use Godbout\Alfred\Time\Workflow; |
| 6 | 6 | |
| 7 | 7 | if (getenv('action') === 'do') { |
| 8 | - $result = Workflow::do(); |
|
| 8 | + $result = Workflow::do { |
|
| 9 | + (); |
|
| 10 | + } |
|
| 9 | 11 | |
| 10 | 12 | if (getenv('timer_action') !== 'exit') { |
| 11 | 13 | print Workflow::notify($result); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'created_with' => 'Alfred Time' |
| 53 | 53 | ]); |
| 54 | 54 | |
| 55 | - if (! isset($timer->id)) { |
|
| 55 | + if (!isset($timer->id)) { |
|
| 56 | 56 | return false; |
| 57 | 57 | } |
| 58 | 58 | } catch (Exception $e) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | if ($timerId = $this->runningTimer()) { |
| 68 | 68 | $response = $this->client->stopTimeEntry($timerId); |
| 69 | 69 | |
| 70 | - if (! isset($response->id)) { |
|
| 70 | + if (!isset($response->id)) { |
|
| 71 | 71 | throw new Exception("Can't stop current running timer.", 1); |
| 72 | 72 | |
| 73 | 73 | return false; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $data = $this->getData(); |
| 112 | 112 | |
| 113 | - if (! isset($data->$needle)) { |
|
| 113 | + if (!isset($data->$needle)) { |
|
| 114 | 114 | return []; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | private function filterOutServerwiseDeletedItemsFromData($items = []) |
| 132 | 132 | { |
| 133 | 133 | return array_filter($items, function ($item) { |
| 134 | - return ! isset($item->server_deleted_at); |
|
| 134 | + return !isset($item->server_deleted_at); |
|
| 135 | 135 | }); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $timer = json_decode($response->getBody()->getContents()); |
| 82 | 82 | |
| 83 | - if (! isset($timer->status) || $timer->status !== 'active') { |
|
| 83 | + if (!isset($timer->status) || $timer->status !== 'active') { |
|
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | } catch (\Exception $e) { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $timer = json_decode($response->getBody()->getContents()); |
| 99 | 99 | |
| 100 | - if (! isset($timer->taskTime) || $timer->status !== 'stopped') { |
|
| 100 | + if (!isset($timer->taskTime) || $timer->status !== 'stopped') { |
|
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | 103 | } catch (\Exception $e) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $timer = json_decode($response->getBody()->getContents()); |
| 116 | 116 | |
| 117 | - if (! isset($timer->duration) || $timer->status !== 'active') { |
|
| 117 | + if (!isset($timer->duration) || $timer->status !== 'active') { |
|
| 118 | 118 | return false; |
| 119 | 119 | } |
| 120 | 120 | } catch (\Exception $e) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | 'spent_date' => date('Y-m-d') |
| 77 | 77 | ]); |
| 78 | 78 | |
| 79 | - if (! isset($timer['id'])) { |
|
| 79 | + if (!isset($timer['id'])) { |
|
| 80 | 80 | return false; |
| 81 | 81 | } |
| 82 | 82 | } catch (ValidationFailedException $e) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if ($timerId = $this->runningTimer()) { |
| 92 | 92 | $timer = $this->client->timeEntries()->stop($timerId); |
| 93 | 93 | |
| 94 | - if (! isset($timer['id'])) { |
|
| 94 | + if (!isset($timer['id'])) { |
|
| 95 | 95 | throw new \Exception("Can't stop current running timer.", 1); |
| 96 | 96 | } |
| 97 | 97 | |