Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| StrategyFactory | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
| create | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| isFormatAsColumns | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Created by PhpStorm. |
| 5 | * User: ionut |
| 6 | * Date: 04/10/17 |
| 7 | * Time: 14:39 |
| 8 | */ |
| 9 | |
| 10 | namespace oat\taoQtiItem\model\Export\Extractor\Strategy; |
| 11 | |
| 12 | class StrategyFactory |
| 13 | { |
| 14 | /** |
| 15 | * @param array $config |
| 16 | * @param string $column |
| 17 | * @param array $metaDataProperties |
| 18 | * @return Strategy |
| 19 | */ |
| 20 | public static function create(array $config, $column, array $metaDataProperties) |
| 21 | { |
| 22 | if (static::isFormatAsColumns($config)) { |
| 23 | return new ColumnStrategy(count($metaDataProperties) === 1, $column); |
| 24 | } |
| 25 | |
| 26 | return new DefaultStrategy($column); |
| 27 | } |
| 28 | |
| 29 | |
| 30 | /** |
| 31 | * @param array $config |
| 32 | * @return bool |
| 33 | */ |
| 34 | protected static function isFormatAsColumns(array $config) |
| 35 | { |
| 36 | return isset($config['valuesAsColumns']) && $config['valuesAsColumns'] === true; |
| 37 | } |
| 38 | } |