Passed
Push — Showing-Posts ( 7973b5...d5badc )
by Stone
02:03
created

AjaxSlugify   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A slugifyString() 0 7 1
1
<?php
2
3
namespace App\Controllers\Ajax;
4
5
use Core\AjaxController;
6
use Cocur\Slugify\Slugify;
7
8
class AjaxSlugify extends AjaxController
9
{
10
    /**
11
     * @param string $string the string to slugify
12
     * @return string slugified string
13
     * @throws \Exception Cocur\Slugify\Slugify error
14
     */
15
    public function slugifyString()
16
    {
17
        $string = $this->request->getData("slugText-update");
18
        $result = array();
19
        $slugify = new Slugify();
20
        $result['slug'] = $slugify->slugify($string);
21
        echo json_encode($result);
22
    }
23
}