It seems like the GitHub access token used for retrieving details about this repository from
GitHub became invalid. This might prevent certain types of inspections from being run (in
particular,
everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
28
{
29
/**
30
* @param string $stringData
31
*
32
* @throws InvalidArgumentException If given argument is not a string
33
*/
34
public function __construct($stringData)
35
{
36
if (!is_string($stringData)) {
37
throw new InvalidArgumentException('Given data is not a string');
38
}
39
40
if (!preg_match('#^([0-9]+)/([0-9]+)s?$#', $stringData, $matches)) {
41
throw new RuntimeException('Given exposure time is not in a valid format.
42
Need: "1/<number>" or "1/<number>s"');
43
}
44
45
$numerator = (int) $matches[1];
46
$denominator = (int) $matches[2];
47
48
// normalize:
49
$denominator /= $numerator;
50
51
$this->setStringData("1/{$denominator}");
52
}
53
54
/**
55
* Creates a new instance from given ExposureTime object
56
*
57
* @param ExposureTime $exposureTime
58
*
59
* @return ExposureTime
60
*/
61
public static function fromExposureTime(ExposureTime $exposureTime)
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.