Passed
Pull Request — develop (#912)
by Shandak
05:00
created

AbstractObserver   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 4
c 1
b 0
f 0
dl 0
loc 104
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A onAfterStore() 0 2 1
A onBeforeStore() 0 2 1
A onAfterDelete() 0 2 1
A onBeforeLoad() 0 2 1
A __construct() 0 4 1
A onAfterLoad() 0 2 1
A onBeforeDelete() 0 2 1
1
<?php
2
/**
3
 * Joomla! Content Management System
4
 *
5
 * @copyright  Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
6
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
7
 */
8
9
namespace Joomla\CMS\Table\Observer;
10
11
defined('JPATH_PLATFORM') or die;
12
13
use Joomla\CMS\Table\TableInterface;
0 ignored issues
show
Bug introduced by
The type Joomla\CMS\Table\TableInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Joomla\CMS\Table\Table;
0 ignored issues
show
Bug introduced by
The type Joomla\CMS\Table\Table was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
16
/**
17
 * Table class supporting modified pre-order tree traversal behavior.
18
 *
19
 * @since  3.1.2
20
 */
21
abstract class AbstractObserver implements \JObserverInterface
22
{
23
	/**
24
	 * The observed table
25
	 *
26
	 * @var    Table
27
	 * @since  3.1.2
28
	 */
29
	protected $table;
30
31
	/**
32
	 * Constructor: Associates to $table $this observer
33
	 *
34
	 * @param   TableInterface  $table  Table to be observed
35
	 *
36
	 * @since   3.1.2
37
	 */
38
	public function __construct(TableInterface $table)
39
	{
40
		$table->attachObserver($this);
41
		$this->table = $table;
42
	}
43
44
	/**
45
	 * Pre-processor for $table->load($keys, $reset)
46
	 *
47
	 * @param   mixed    $keys   An optional primary key value to load the row by, or an array of fields to match.  If not
48
	 *                           set the instance property value is used.
49
	 * @param   boolean  $reset  True to reset the default values before loading the new row.
50
	 *
51
	 * @return  void
52
	 *
53
	 * @since   3.1.2
54
	 */
55
	public function onBeforeLoad($keys, $reset)
0 ignored issues
show
Unused Code introduced by
The parameter $reset is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

55
	public function onBeforeLoad($keys, /** @scrutinizer ignore-unused */ $reset)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $keys is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

55
	public function onBeforeLoad(/** @scrutinizer ignore-unused */ $keys, $reset)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
	{
57
	}
58
59
	/**
60
	 * Post-processor for $table->load($keys, $reset)
61
	 *
62
	 * @param   boolean  &$result  The result of the load
63
	 * @param   array    $row      The loaded (and already binded to $this->table) row of the database table
64
	 *
65
	 * @return  void
66
	 *
67
	 * @since   3.1.2
68
	 */
69
	public function onAfterLoad(&$result, $row)
0 ignored issues
show
Unused Code introduced by
The parameter $row is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

69
	public function onAfterLoad(&$result, /** @scrutinizer ignore-unused */ $row)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $result is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

69
	public function onAfterLoad(/** @scrutinizer ignore-unused */ &$result, $row)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
70
	{
71
	}
72
73
	/**
74
	 * Pre-processor for $table->store($updateNulls)
75
	 *
76
	 * @param   boolean  $updateNulls  The result of the load
77
	 * @param   string   $tableKey     The key of the table
78
	 *
79
	 * @return  void
80
	 *
81
	 * @since   3.1.2
82
	 */
83
	public function onBeforeStore($updateNulls, $tableKey)
0 ignored issues
show
Unused Code introduced by
The parameter $tableKey is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
	public function onBeforeStore($updateNulls, /** @scrutinizer ignore-unused */ $tableKey)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $updateNulls is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
	public function onBeforeStore(/** @scrutinizer ignore-unused */ $updateNulls, $tableKey)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
84
	{
85
	}
86
87
	/**
88
	 * Post-processor for $table->store($updateNulls)
89
	 *
90
	 * @param   boolean  &$result  The result of the store
91
	 *
92
	 * @return  void
93
	 *
94
	 * @since   3.1.2
95
	 */
96
	public function onAfterStore(&$result)
0 ignored issues
show
Unused Code introduced by
The parameter $result is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

96
	public function onAfterStore(/** @scrutinizer ignore-unused */ &$result)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
97
	{
98
	}
99
100
	/**
101
	 * Pre-processor for $table->delete($pk)
102
	 *
103
	 * @param   mixed  $pk  An optional primary key value to delete.  If not set the instance property value is used.
104
	 *
105
	 * @return  void
106
	 *
107
	 * @since   3.1.2
108
	 * @throws  \UnexpectedValueException
109
	 */
110
	public function onBeforeDelete($pk)
0 ignored issues
show
Unused Code introduced by
The parameter $pk is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

110
	public function onBeforeDelete(/** @scrutinizer ignore-unused */ $pk)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
111
	{
112
	}
113
114
	/**
115
	 * Post-processor for $table->delete($pk)
116
	 *
117
	 * @param   mixed  $pk  The deleted primary key value.
118
	 *
119
	 * @return  void
120
	 *
121
	 * @since   3.1.2
122
	 */
123
	public function onAfterDelete($pk)
0 ignored issues
show
Unused Code introduced by
The parameter $pk is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

123
	public function onAfterDelete(/** @scrutinizer ignore-unused */ $pk)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
124
	{
125
	}
126
}
127