Passed
Push — master ( 6ae33d...022918 )
by Michael
03:45 queued 02:16
created

Utility   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 11
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A aboutmkdirs() 0 13 6
1
<?php
2
3
namespace XoopsModules\About;
4
5
/*
6
 About Utility Class Definition
7
8
 You may not change or alter any portion of this comment or credits of
9
 supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit
11
 authors.
12
13
 This program is distributed in the hope that it will be useful, but
14
 WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
18
/**
19
 * Module:  About
20
 *
21
 * @package      ::    \module\About\class
22
 * @license      http://www.fsf.org/copyleft/gpl.html GNU public license
23
 * @copyright    https://xoops.org 2001-2017 &copy; XOOPS Project
24
 * @author       ZySpec <[email protected]>
25
 * @author       Mamba <[email protected]>
26
 * @since        ::      File available since version 1.54
27
 */
28
29
use XoopsModules\About;
30
31
/**
32
 * Utility
33
 *
34
 * Static utility class to provide common functionality
35
 */
36
class Utility
37
{
38
    use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits
0 ignored issues
show
introduced by
The trait XoopsModules\About\Common\VersionChecks requires some properties which are not provided by XoopsModules\About\Utility: $tag_name, $prerelease
Loading history...
39
40
    use Common\ServerStats; // getServerStats Trait
41
42
    use Common\FilesManagement; // Files Management Trait
43
44
    //--------------- Custom module methods -----------------------------
45
46
    /**
47
     * @param       $dir
48
     * @param  int  $mode
49
     * @param  bool $recursive
50
     * @return bool
51
     */
52
    public static function aboutmkdirs($dir, $mode = 0777, $recursive = true)
53
    {
54
        if ('' === $dir || null === $dir) {
55
            return $dir;
56
        }
57
        if ('/' === $dir || is_dir($dir)) {
58
            return $dir;
59
        }
60
        if (static::aboutmkdirs(dirname($dir), $mode, $recursive)) {
61
            return mkdir($dir, $mode);
62
        }
63
64
        return $dir;
65
    }
66
}
67