Completed
Push — 4.9 ( eb33e7...2df7ad )
by Mikhail
01:41
created

AbstractController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 9
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace controllers;
4
5
abstract class AbstractController
6
{
7
    protected $config;
8
    protected $terminal;
9
    protected $filesystem;
10
    protected $autocomplete;
11
    
12
    /**
13
     * Returns array of methods that can be requested
14
     */
15
    abstract public static function getAllowedMethods(): array;
16
17
    /**
18
     * Get method name from terminal arguments
19
     * 
20
     * @return string
21
     */
22
    protected function getMethodName(): string
23
    {
24
        return $this->config->get('set')
25
            ? 'set' . ucfirst(to_camel_case($this->config->get('set')))
26
            : 'remove' . ucfirst(to_camel_case($this->config->get('remove')));
27
    }
28
}
29