Passed
Branch master (0828fa)
by Gabor
03:19
created

GetPublicationPathTrait::getPublicationPath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2017 Gixx-web (http://www.gixx-web.com)
8
 * @license   https://opensource.org/licenses/MIT The MIT License (MIT)
9
 *
10
 * @link      http://www.gixx-web.com
11
 */
12
declare(strict_types = 1);
13
14
namespace WebHemi\Middleware\Action\Traits;
15
16
use WebHemi\Data\Entity;
17
18
/**
19
 * Trait GetPublicationPathTrait
20
 */
21
trait GetPublicationPathTrait
22
{
23
    /**
24
     * Generates the content path.
25
     *
26
     * @param Entity\Filesystem\FilesystemEntity $filesystemEntity
27
     * @return string
28
     */
29
    protected function getPublicationPath(Entity\Filesystem\FilesystemEntity $filesystemEntity) : string
30
    {
31
        $path = $filesystemEntity->getPath().'/'.$filesystemEntity->getBaseName();
32
33
        if (strpos($path, '//') !== false) {
34
            $path = str_replace('//', '/', $path);
35
        }
36
37
        return $path;
38
    }
39
}
40