Passed
Push — develop ( a18085...de8258 )
by Francisco
14:47
created

CoursePresenter::getOrdinalSemester()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Judite\Presenters;
4
5
use NumberFormatter;
0 ignored issues
show
Bug introduced by
The type NumberFormatter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Laracasts\Presenter\Presenter;
7
8
class CoursePresenter extends Presenter
9
{
10
    /**
11
     * The year of this course in ordinal format.
12
     *
13
     * @return string
14
     */
15
    public function getOrdinalYear()
16
    {
17
        $formatter = new NumberFormatter(app()->getLocale(), NumberFormatter::SPELLOUT);
0 ignored issues
show
Bug introduced by
The method getLocale() does not exist on Illuminate\Container\Container. It seems like you code against a sub-type of Illuminate\Container\Container such as Illuminate\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        $formatter = new NumberFormatter(app()->/** @scrutinizer ignore-call */ getLocale(), NumberFormatter::SPELLOUT);
Loading history...
18
        $formatter->setTextAttribute(NumberFormatter::DEFAULT_RULESET, '%spellout-ordinal');
19
20
        return ucfirst($formatter->format($this->entity->year));
21
    }
22
23
    /**
24
     * The semester of this course in ordinal format.
25
     *
26
     * @return string
27
     */
28
    public function getOrdinalSemester()
29
    {
30
        $formatter = new NumberFormatter(app()->getLocale(), NumberFormatter::ORDINAL);
31
32
        return ucfirst($formatter->format($this->entity->semester));
33
    }
34
}
35