Completed
Pull Request — master (#84)
by Robbert
76:25 queued 66:51
created

ISBN_For_PINP::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 3
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 5 and the first side effect is on line 2.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
	require_once("mod_isbn/ISBN.php");
3
4
5
	class ISBN_For_PINP extends ISBN {
6
7
		function __construct($groups_csv, $isbn, $ver) {
8
			ISBN::ISBN($isbn, $ver);
0 ignored issues
show
Coding Style introduced by
PHP4 style calls to parent constructors are not allowed; use "parent::__construct()" instead
Loading history...
Bug introduced by
The method ISBN() does not seem to exist on object<ISBN>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
9
			$this->groups_csv = $groups_csv;
0 ignored issues
show
Bug introduced by
The property groups_csv cannot be accessed from this context as it is declared private in class ISBN.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
10
		}
11
12
		function _convert($isbnin, $verfrom = ISBN_VERSION_ISBN_10, $verto = ISBN_VERSION_ISBN_13) {
13
			return $this->convert($isbnin, $verfrom, $verto);
14
		}
15
16
		function _getCheckdigit() {
17
			return $this->getCheckdigit();
18
		}
19
20
		function _getEAN() {
21
			return $this->getEAN();
22
		}
23
24
		function _getGroup() {
25
			return $this->getGroup();
26
		}
27
28
		function _getISBN() {
29
			return $this->getISBN();
30
		}
31
32
		function _getISBNDisplayable($format = '') {
33
			return $this->getISBNDisplayable($format);
34
		}
35
36
		function _setISBN($isbn) {
37
			return $this->setISBN($isbn);
38
		}
39
40
		function _getPublisher() {
41
			return $this->getPublisher();
42
		}
43
44
		function _getTitle() {
45
			return $this->getTitle();
46
		}
47
48
		function _isValid() {
49
			return $this->isValid();
50
		}
51
52
		function _validate($isbn, $ver = ISBN_DEFAULT_INPUTVERSION) {
53
			return $this->validate($isbn, $ver);
54
		}
55
56
		function _getVersion() {
57
			return $this->getVersion();
58
		}
59
60
		function _guessVersion($isbn) {
61
			return $this->guessVersion($isbn);
62
		}
63
64
	}
65
66
	class pinp_ISBN  {
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...
Coding Style introduced by
Expected 1 space after class name; 2 found
Loading history...
67
68
		function _create($isbn = '', $ver = ISBN_DEFAULT_INPUTVERSION) {
69
			$groups_csv = $this->store->get_config("code")."modules/mod_isbn/data/groups.csv";
0 ignored issues
show
Bug introduced by
The property store does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
70
			return new ISBN_For_PINP($groups_csv, $isbn, $ver);
71
		}
72
73
	}
74