Passed
Push — master ( 9205ea...6109ae )
by Gordon
01:38
created

SluggableHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSlug() 0 9 1
1
<?php
2
3
4
namespace Suilven\Sluggable\Helper;
5
6
7
use SilverStripe\Core\Config\Config_ForClass;
0 ignored issues
show
Bug introduced by
The type SilverStripe\Core\Config\Config_ForClass 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...
8
use SilverStripe\ORM\DataExtension;
0 ignored issues
show
Bug introduced by
The type SilverStripe\ORM\DataExtension 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...
9
use SilverStripe\View\Parsers\URLSegmentFilter;
0 ignored issues
show
Bug introduced by
The type SilverStripe\View\Parsers\URLSegmentFilter 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...
10
11
class SluggableHelper
12
{
13
    /**
14
     * Convert the configured field and it's associated value into a slug
15
     * e.g. Liverpool Football Club => liverpool-football-club
16
     */
17
    public function getSlug($fieldValue)
18
    {
19
20
        // use the standard SilverStripe tool for slugging URLs.  This optionally may have a different transliterator
21
        // associated with it
22
        $slugger = new URLSegmentFilter();
23
24
        /** @var string $slug */
25
        return $slugger->filter($fieldValue);
26
    }
27
}
28