Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
10 | class ExternalSignController extends Controller |
||
11 | { |
||
12 | /** @var \Sausin\Signere\ExternalSign */ |
||
13 | protected $extSign; |
||
14 | |||
15 | /** |
||
16 | * Create a new controller instance. |
||
17 | * |
||
18 | * @param \Sausin\Signere\ExternalSign $extSign |
||
19 | */ |
||
20 | 3 | public function __construct(ExternalSign $extSign) |
|
26 | |||
27 | /** |
||
28 | * Get the URLs to sign the Document. |
||
29 | * |
||
30 | * @param string $documentId |
||
31 | * @return \Illuminate\Http\Response |
||
32 | */ |
||
33 | 1 | public function index(string $documentId) |
|
39 | |||
40 | /** |
||
41 | * Get the URLs to view a viewerapplet in a iFrame on your site. |
||
42 | * |
||
43 | * @param string $documentId |
||
44 | * @param string $domain |
||
45 | * @param string $language |
||
46 | * @return \Illuminate\Http\Response |
||
47 | */ |
||
48 | 1 | public function show(string $documentId, string $domain, string $language) |
|
54 | |||
55 | /** |
||
56 | * Creates an externalsign request. |
||
57 | * |
||
58 | * @param Request $request |
||
59 | * @return \Illuminate\Http\Response |
||
60 | */ |
||
61 | 1 | public function store(Request $request) |
|
108 | } |
||
109 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.