GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1ba1f4...ea41a5 )
by Alexey
05:37
created

FileBackup::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @author Alexey Tatarinov <[email protected]>
4
 * @link https://github.com/shogodev/argilla/
5
 * @copyright Copyright &copy; 2003-2016 Shogo
6
 * @license http://argilla.ru/LICENSE
7
 */
8
class FileBackup
9
{
10
  const SUFFIX_DATE_TIME = '.Y-m-d_H-i';
11
12
  public $backupPath;
13
14
  public $suffixFormat;
15
16
  public function __construct($backupPath)
17
  {
18
    $this->backupPath = $backupPath;
19
    $this->suffixFormat = self::SUFFIX_DATE_TIME;
20
  }
21
22
  public function makeBackup($file)
23
  {
24
    $fileName = basename($file);
25
    $fileName .= date($this->suffixFormat);
26
27
    if( !rename($file, $this->backupPath.$fileName) )
28
      throw new ErrorException('Не удалось создать резервную копию файла '.$file);
29
  }
30
}