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

JObserverWrapperMapper::addObserverClassToClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 3
1
<?php
2
/**
3
 * @package     Joomla.Platform
4
 * @subpackage  Observer
5
 *
6
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
7
 * @license     GNU General Public License version 2 or later; see LICENSE
8
 */
9
10
defined('JPATH_PLATFORM') or die;
11
12
/**
13
 * Wrapper class for JObserverMapper
14
 *
15
 * @package     Joomla.Platform
16
 * @subpackage  Observer
17
 * @since       3.4
18
 */
19
class JObserverWrapperMapper
20
{
21
	/**
22
	 * Helper wrapper method for addObserverClassToClass
23
	 *
24
	 * @param   string         $observerClass    The name of the observer class (implementing JObserverInterface).
25
	 * @param   string         $observableClass  The name of the observable class (implementing JObservableInterface).
26
	 * @param   array|boolean  $params           The params to give to the JObserverInterface::createObserver() function, or false to remove mapping.
27
	 *
28
	 * @return void
29
	 *
30
	 * @see     JObserverMapper::addObserverClassToClass
31
	 * @since   3.4
32
	 */
33
	public function addObserverClassToClass($observerClass, $observableClass, $params = array())
34
	{
35
		return JObserverMapper::addObserverClassToClass($observerClass, $observableClass, $params);
0 ignored issues
show
Bug introduced by
Are you sure the usage of JObserverMapper::addObse...servableClass, $params) targeting JObserverMapper::addObserverClassToClass() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
36
	}
37
38
	/**
39
	 * Helper wrapper method for attachAllObservers
40
	 *
41
	 * @param   JObservableInterface  $observableObject  The observable subject object.
42
	 *
43
	 * @return void
44
	 *
45
	 * @see     JObserverMapper::attachAllObservers
46
	 * @since   3.4
47
	 */
48
	public function attachAllObservers(JObservableInterface $observableObject)
49
	{
50
		return JObserverMapper::attachAllObservers($observableObject);
0 ignored issues
show
Bug introduced by
Are you sure the usage of JObserverMapper::attachA...vers($observableObject) targeting JObserverMapper::attachAllObservers() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
51
	}
52
}
53