Completed
Push — master ( 21b220...14b13a )
by Martin
03:51
created

WrongArgumentException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getArgument() 0 3 1
1
<?php
2
/**
3
 * This file is part of the Yep package.
4
 * Copyright (c) 2016 Martin Zeman (Zemistr) (http://www.zemistr.eu)
5
 */
6
7
namespace Yep\Dsn;
8
9
/**
10
 * Class Exception
11
 *
12
 * @package Yep\Dsn
13
 * @author  Martin Zeman (Zemistr) <[email protected]>
14
 */
15
class Exception extends \Exception {
16
}
17
18
/**
19
 * Class EmptyArgumentException
20
 *
21
 * @package Yep\Dsn
22
 * @author  Martin Zeman (Zemistr) <[email protected]>
23
 */
24
class EmptyArgumentException extends Exception {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
25
  /** @var string */
26
  protected $argument;
27
28
  public function __construct(string $argument) {
29
    $this->argument = $argument;
30
31
    parent::__construct(sprintf('Argument "%s" can\'t be empty!', $argument));
32
  }
33
34
  /**
35
   * @return string
36
   */
37
  public function getArgument() : string {
38
    return $this->argument;
39
  }
40
}
41
42
/**
43
 * Class WrongArgumentException
44
 *
45
 * @package Yep\Dsn
46
 * @author  Martin Zeman (Zemistr) <[email protected]>
47
 */
48
class WrongArgumentException extends Exception {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
49
  /** @var string */
50
  protected $argument;
51
52
  public function __construct(string $argument, string $expected) {
53
    $this->argument = $argument;
54
55
    parent::__construct(sprintf('Argument "%s" has wrong value! %s', $argument, $expected));
56
  }
57
58
  /**
59
   * @return string
60
   */
61
  public function getArgument() : string {
62
    return $this->argument;
63
  }
64
}
65