tap()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * Copyright (c) 2017 Salah Alkhwlani <[email protected]>
5
 *
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
if (!\function_exists('tap')) {
11
    /**
12
     * "Tap" a method on the provided instance either by callback or proxy.
13
     *
14
     * @param $instance
15
     * @param callable|null $callback
16
     *
17
     * @return mixed
18
     */
19
    function tap($instance, $callback = null)
20
    {
21
        $callback($instance);
22
23
        return $instance;
24
    }
25
}
26