Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| activeExecutionsMetrics | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| collect | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; under version 2 |
| 8 | * of the License (non-upgradable). |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | * Copyright (c) 2018 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\ltiDeliveryProvider\model\metrics\implementation; |
| 24 | |
| 25 | use oat\ltiDeliveryProvider\model\actions\GetActiveDeliveryExecution; |
| 26 | use oat\tao\model\metrics\implementations\abstractMetrics; |
| 27 | |
| 28 | class activeExecutionsMetrics extends abstractMetrics |
| 29 | { |
| 30 | /** |
| 31 | * Collect values, caches |
| 32 | * @param bool $force |
| 33 | * @return mixed |
| 34 | * @throws \common_Exception |
| 35 | * @throws \oat\oatbox\service\exception\InvalidServiceManagerException |
| 36 | */ |
| 37 | public function collect($force = false) |
| 38 | { |
| 39 | $active = $this->getPersistence()->get(self::class); |
| 40 | if (!$active || $force) { |
| 41 | $action = new GetActiveDeliveryExecution(); |
| 42 | $this->propagate($action); |
| 43 | $active = $action->getNumberOfActiveActions(); |
| 44 | $this->getPersistence()->set(self::class, $active, $this->getOption(self::OPTION_TTL)); |
| 45 | } |
| 46 | return $active; |
| 47 | } |
| 48 | } |