Completed
Push — master ( 79d117...cc4d96 )
by Fabrizio
02:21
created

NotifynderManager   C

Complexity

Total Complexity 48

Size/Duplication

Total Lines 629
Duplicated Lines 6.36 %

Coupling/Cohesion

Components 4
Dependencies 6

Importance

Changes 9
Bugs 2 Features 2
Metric Value
wmc 48
c 9
b 2
f 2
lcom 4
cbo 6
dl 40
loc 629
rs 6.6813

38 Methods

Rating   Name   Duplication   Size   Complexity  
A addCategory() 0 4 1
A updateCategory() 0 4 1
A __construct() 0 14 1
B category() 0 28 2
A entity() 0 6 1
A send() 10 10 2
A sendNow() 10 10 2
A sendOne() 10 10 2
A sendMultiple() 10 10 2
A sendGroup() 0 10 2
A readOne() 0 4 1
A readLimit() 0 6 1
A readAll() 0 6 1
A delete() 0 4 1
A deleteLimit() 0 6 1
A deleteAll() 0 6 1
A deleteByCategory() 0 4 1
A getNotRead() 0 6 1
A getAll() 0 6 1
A countNotRead() 0 6 1
A findNotificationById() 0 4 1
A getLastNotification() 0 10 2
A addCategoryToGroupByName() 0 4 1
A addCategoryToGroupById() 0 4 1
A addCategoriesToGroup() 0 4 1
A fire() 0 5 1
A delegate() 0 4 1
A bootListeners() 0 4 1
A builder() 0 4 1
A extend() 0 11 2
A isLazyLoaded() 0 4 1
A id() 0 4 1
A setCategoriesContainer() 0 4 1
A getCategoriesContainer() 0 4 1
A dipatchWith() 0 6 1
A __call() 0 14 3
A __set() 0 4 1
A __get() 0 4 1

How to fix   Duplicated Code    Complexity   

Duplicated Code

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:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like NotifynderManager often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use NotifynderManager, and based on these observations, apply Extract Interface, too.

1
<?php namespace Fenos\Notifynder;
2
3
use BadMethodCallException;
4
use Closure;
5
use Fenos\Notifynder\Builder\NotifynderBuilder;
6
use Fenos\Notifynder\Contracts\NotifynderCategory;
7
use Fenos\Notifynder\Contracts\NotifynderDispatcher;
8
use Fenos\Notifynder\Contracts\NotifynderGroup;
9
use Fenos\Notifynder\Contracts\NotifynderNotification;
10
use Fenos\Notifynder\Contracts\NotifynderSender;
11
use InvalidArgumentException;
12
13
/**
14
 * Class Notifynder
15
 *
16
 * Notifynder is a Facade Class that has
17
 * all the methods necesessary to use the library.
18
 *
19
 * Notifynder allow you to have a flexible notification
20
 * management. It will provide you a nice and easy API
21
 * to store, retrieve and organise your notifications.
22
 *
23
 * @package Fenos\Notifynder
24
 */
25
class NotifynderManager extends NotifynderBuilder implements Notifynder
26
{
27
28
    /**
29
     * Version Notifynder
30
     *
31
     * @var string
32
     */
33
    const VERSION = '3.1.0';
34
35
    /**
36
     * @var NotifynderCategory
37
     */
38
    protected $notifynderCategory;
39
40
    /**
41
     * @var array
42
     */
43
    protected $categoriesContainer = [];
44
45
    /**
46
     * @var Models\NotificationCategory|null
47
     */
48
    protected $defaultCategory;
49
50
    /**
51
     * @var NotifynderSender
52
     */
53
    protected $notifynderSender;
54
55
    /**
56
     * @var NotifynderNotification
57
     */
58
    protected $notification;
59
60
    /**
61
     * @var NotifynderDispatcher
62
     */
63
    protected $notifynderDispatcher;
64
65
    /**
66
     * This sender method
67
     * will be used on the dispatcher
68
     *
69
     * @var string
70
     */
71
    protected $eventSender = 'send';
72
73
    /**
74
     * @var NotifynderGroup
75
     */
76
    protected $notifynderGroup;
77
78
    /**
79
     * @var string | null
80
     */
81
    protected $entity;
82
83
    /**
84
     * @param NotifynderCategory     $notifynderCategory
85
     * @param NotifynderSender       $notifynderSender
86
     * @param NotifynderNotification $notification
87
     * @param NotifynderDispatcher   $notifynderDispatcher
88
     * @param NotifynderGroup        $notifynderGroup
89
     */
90
    public function __construct(NotifynderCategory $notifynderCategory,
91
                         NotifynderSender $notifynderSender,
92
                         NotifynderNotification $notification,
93
                         NotifynderDispatcher $notifynderDispatcher,
94
                         NotifynderGroup $notifynderGroup)
95
    {
96
        $this->notifynderCategory = $notifynderCategory;
97
        $this->notifynderSender = $notifynderSender;
98
        $this->notification = $notification;
99
        $this->notifynderDispatcher = $notifynderDispatcher;
100
        $this->notifynderGroup = $notifynderGroup;
101
102
        parent::__construct($notifynderCategory);
103
    }
104
105
    /**
106
     * Set the category of the
107
     * notification
108
     *
109
     * @param $name
110
     * @return $this
111
     */
112
    public function category($name)
113
    {
114
        // Check if the category is lazy loaded
115
        if ($this->isLazyLoaded($name)) {
116
            // Yes it is, split out the value from the array
117
            $this->defaultCategory = $this->getCategoriesContainer($name);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getCategoriesContainer($name) of type array is incompatible with the declared type object<Fenos\Notifynder\...ificationCategory>|null of property $defaultCategory.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
118
119
            // set category on the builder
120
            parent::category($this->defaultCategory->id);
121
122
            return $this;
123
        }
124
125
        // Otherwise ask to the db and give me the right category
126
        // associated with this name. If the category is not found
127
        // it throw CategoryNotFoundException
128
        $category = $this->notifynderCategory->findByName($name);
129
130
        $this->defaultCategory = $category;
131
132
        // Set the category on the array
133
        $this->setCategoriesContainer($name, $category);
134
135
        // set category on the builder
136
        parent::category($category->id);
137
138
        return $this;
139
    }
140
141
    /**
142
     * Define an entity when Notifynder is
143
     * used Polymorpically
144
     *
145
     * @param $name
146
     * @return $this
147
     */
148
    public function entity($name)
149
    {
150
        $this->entity = $name;
151
152
        return $this;
153
    }
154
155
    /**
156
     * Add a category
157
     *
158
     * @param $name
159
     * @param $text
160
     * @return static
161
     */
162
    public function addCategory($name, $text)
163
    {
164
        return $this->notifynderCategory->add($name, $text);
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->notifynder...ory->add($name, $text); (Fenos\Notifynder\Models\NotificationCategory) is incompatible with the return type declared by the interface Fenos\Notifynder\Notifynder::addCategory of type Fenos\Notifynder\Notifynder.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
165
    }
166
167
    /**
168
     * Update a category
169
     *
170
     * @param  array $updates
171
     * @param        $id
172
     * @return mixed
173
     */
174
    public function updateCategory(array $updates, $id)
175
    {
176
        return $this->notifynderCategory->update($updates, $id);
177
    }
178
179
    /**
180
     * Send notifications
181
     * Both multiple and single
182
     *
183
     * @param  array $info
184
     * @return mixed
185
     */
186 View Code Duplication
    public function send($info = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
187
    {
188
        $info = (count($info) > 0) ? $info : $this->toArray();
189
190
        $notificationSent = $this->notifynderSender->send($info, $this->defaultCategory);
0 ignored issues
show
Bug introduced by
It seems like $this->defaultCategory can also be of type object<Fenos\Notifynder\...s\NotificationCategory>; however, Fenos\Notifynder\Contrac...otifynderSender::send() does only seem to accept null, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
191
192
        $this->refresh();
193
194
        return $notificationSent;
195
    }
196
197
    /**
198
     * Send immediately the notification
199
     * even if the queue is enabled
200
     *
201
     * @param  array $info
202
     * @return mixed
203
     */
204 View Code Duplication
    public function sendNow($info = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
205
    {
206
        $info = (count($info) > 0) ? $info : $this->toArray();
207
208
        $notificationsSent = $this->notifynderSender->sendNow($info, $this->defaultCategory);
209
210
        $this->refresh();
211
212
        return $notificationsSent;
213
    }
214
215
    /**
216
     * Send One notification
217
     *
218
     * @param  array $info
219
     * @return mixed
220
     */
221 View Code Duplication
    public function sendOne($info = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
222
    {
223
        $info = (count($info) > 0) ? $info : $this->toArray();
224
225
        $notificationSent = $this->notifynderSender->sendOne($info, $this->defaultCategory);
226
227
        $this->refresh();
228
229
        return $notificationSent;
230
    }
231
232
    /**
233
     * Send multiple notifications
234
     *
235
     * @param  array                $info
236
     * @return Senders\SendMultiple
237
     */
238 View Code Duplication
    public function sendMultiple($info = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
239
    {
240
        $info = (count($info) > 0) ? $info : $this->toArray();
241
242
        $notificationsSent = $this->notifynderSender->sendMultiple($info, $this->defaultCategory);
0 ignored issues
show
Unused Code introduced by
The call to NotifynderSender::sendMultiple() has too many arguments starting with $this->defaultCategory.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
243
244
        $this->refresh();
245
246
        return $notificationsSent;
247
    }
248
249
    /**
250
     * Send a group of notifications
251
     *
252
     * @param $group_name
253
     * @param $info
254
     * @return mixed
255
     */
256
    public function sendGroup($group_name, $info = [])
257
    {
258
        $info = (count($info) > 0) ? $info : $this->toArray();
259
260
        $notificationsSent = $this->notifynderSender->sendGroup($this, $group_name, $info);
0 ignored issues
show
Unused Code introduced by
The call to NotifynderSender::sendGroup() has too many arguments starting with $info.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
261
262
        $this->refresh();
263
264
        return $notificationsSent;
265
    }
266
267
    /**
268
     * Read one notification
269
     *
270
     * @param $notification_id
271
     * @return bool|Models\Notification
272
     */
273
    public function readOne($notification_id)
274
    {
275
        return $this->notification->readOne($notification_id);
276
    }
277
278
    /**
279
     * Read notification in base the number
280
     * Given
281
     *
282
     * @param         $to_id
283
     * @param         $numbers
284
     * @param  string $order
285
     * @return mixed
286
     */
287
    public function readLimit($to_id, $numbers, $order = "ASC")
288
    {
289
        $notification = $this->notification->entity($this->entity);
290
291
        return $notification->readLimit($to_id, $numbers, $order);
292
    }
293
294
    /**
295
     * Read all notifications of the given
296
     * entity
297
     *
298
     * @param $to_id
299
     * @return Number
300
     */
301
    public function readAll($to_id)
302
    {
303
        $notifications = $this->notification->entity($this->entity);
304
305
        return $notifications->readAll($to_id);
306
    }
307
308
    /**
309
     * Delete a single notification
310
     *
311
     * @param $notification_id
312
     * @return Bool
313
     */
314
    public function delete($notification_id)
315
    {
316
        return $this->notification->delete($notification_id);
317
    }
318
319
    /**
320
     * Delete number of notifications
321
     * secified of the given entity
322
     *
323
     * @param         $to_id
324
     * @param         $number
325
     * @param  string $order
326
     * @return mixed
327
     */
328
    public function deleteLimit($to_id, $number, $order = "ASC")
329
    {
330
        $notifications = $this->notification->entity($this->entity);
331
332
        return $notifications->deleteLimit($to_id, $number, $order);
333
    }
334
335
    /**
336
     * Delete all notifications
337
     * of the the given entity
338
     *
339
     * @param $to_id
340
     * @return Bool
341
     */
342
    public function deleteAll($to_id)
343
    {
344
        $notifications = $this->notification->entity($this->entity);
345
346
        return $notifications->deleteAll($to_id);
347
    }
348
349
    /**
350
     * Delete All notifications from a
351
     * defined category
352
     *
353
     * @param $category_name string
354
     * @param $expired Bool
355
     * @return Bool
356
     */
357
    public function deleteByCategory($category_name, $expired = false)
358
    {
359
        return $this->notification->deleteByCategory($category_name, $expired);
360
    }
361
362
    /**
363
     * Get Notifications not read
364
     * of the given entity
365
     *
366
     * @param           $to_id
367
     * @param  null     $limit
368
     * @param  null|int $paginate
369
     * @param  string   $order
370
     * @param Closure   $filterScope
371
     * @return mixed
372
     */
373
    public function getNotRead($to_id, $limit = null, $paginate = null, $order = "desc", Closure $filterScope = null)
374
    {
375
        $notifications = $this->notification->entity($this->entity);
376
377
        return $notifications->getNotRead($to_id, $limit, $paginate, $order, $filterScope);
378
    }
379
380
    /**
381
     * Get all notifications of the
382
     * given entity
383
     *
384
     * @param           $to_id
385
     * @param  null     $limit
386
     * @param  int|null $paginate
387
     * @param  string   $order
388
     * @param Closure   $filterScope
389
     * @return mixed
390
     */
391
    public function getAll($to_id, $limit = null, $paginate = null, $order = "desc", Closure $filterScope = null)
392
    {
393
        $notifications = $this->notification->entity($this->entity);
394
395
        return $notifications->getAll($to_id, $limit, $paginate,$order, $filterScope);
396
    }
397
398
    /**
399
     * Get number of notification not read
400
     * of the given entity
401
     *
402
     * @param         $to_id
403
     * @param Closure $filterScope
404
     * @return mixed
405
     */
406
    public function countNotRead($to_id,Closure $filterScope = null)
407
    {
408
        $notifications = $this->notification->entity($this->entity);
409
410
        return $notifications->countNotRead($to_id,$filterScope);
411
    }
412
413
    /**
414
     * Find Notification by ID
415
     *
416
     * @param $notification_id
417
     * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|static
418
     */
419
    public function findNotificationById($notification_id)
420
    {
421
        return $this->notification->find($notification_id);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->notification->find($notification_id); of type Illuminate\Database\Eloq...\NotifynderNotification adds the type Fenos\Notifynder\Contracts\NotifynderNotification to the return on line 421 which is incompatible with the return type declared by the interface Fenos\Notifynder\Notifynder::findNotificationById of type Illuminate\Database\Eloq...s\Notifynder\Notifynder.
Loading history...
422
    }
423
424
    /**
425
     * Get last notification of the given
426
     * entity, second parameter can filter by
427
     * category
428
     *
429
     * @param         $to_id
430
     * @param null    $category
431
     * @param Closure $filterScope
432
     * @return mixed
433
     */
434
    public function getLastNotification($to_id,$category = null,Closure $filterScope = null)
435
    {
436
        $notification = $this->notification->entity($this->entity);
437
438
        if ( is_null($category)) {
439
            return $notification->getLastNotification($to_id,$filterScope);
440
        }
441
442
        return $notification->getLastNotificationByCategory($category,$to_id,$filterScope);
443
    }
444
445
    /**
446
     * Add category to a group
447
     * giving the names of them
448
     *
449
     * @param $gorup_name
450
     * @param $category_name
451
     * @return mixed
452
     */
453
    public function addCategoryToGroupByName($gorup_name, $category_name)
454
    {
455
        return $this->notifynderGroup->addCategoryToGroupByName($gorup_name, $category_name);
456
    }
457
458
    /**
459
     * Add category to a group
460
     * giving the ids of them
461
     *
462
     * @param $gorup_id
463
     * @param $category_id
464
     * @return mixed
465
     */
466
    public function addCategoryToGroupById($gorup_id, $category_id)
467
    {
468
        return $this->notifynderGroup->addCategoryToGroupById($gorup_id, $category_id);
469
    }
470
471
    /**
472
     * Add categories to a group having as first parameter
473
     * the name of the group, and others as name
474
     * categories
475
     *
476
     * @return mixed
477
     */
478
    public function addCategoriesToGroup()
479
    {
480
        return $this->notifynderGroup->addMultipleCategoriesToGroup(func_get_args());
0 ignored issues
show
Unused Code introduced by
The call to NotifynderGroup::addMultipleCategoriesToGroup() has too many arguments starting with func_get_args().

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
481
    }
482
483
    /**
484
     * Fire method for fire listeners
485
     * of logic
486
     *
487
     * @param  string     $key
488
     * @param  string     $category_name
489
     * @param  mixed|null $values
490
     * @return mixed|null
491
     */
492
    public function fire($key, $category_name, $values = [])
493
    {
494
        return $this->notifynderDispatcher->sendWith($this->eventSender)
495
                    ->fire($this, $key, $category_name, $values);
496
    }
497
498
    /**
499
     * Associate events to categories
500
     *
501
     * @param        $data
502
     * @param  array $delegation
503
     * @return mixed
504
     */
505
    public function delegate(array $delegation, $data = [])
506
    {
507
        return $this->notifynderDispatcher->delegate($this, $data, $delegation);
508
    }
509
510
    /**
511
     * Boot Listeners
512
     *
513
     * @param array $listeners
514
     */
515
    public function bootListeners(array $listeners)
516
    {
517
        $this->notifynderDispatcher->boot($listeners);
518
    }
519
520
    /**
521
     * Get instance of the notifynder builder
522
     *
523
     * @return NotifynderBuilder
524
     */
525
    public function builder()
526
    {
527
        return new parent($this->notifynderCategory);
528
    }
529
530
    /**
531
     * Extend a custom sender method
532
     *
533
     * @param           $name
534
     * @param  callable $registrar
535
     * @return $this
536
     */
537
    public function extend($name, $registrar)
538
    {
539
        if (! starts_with($name, 'send')) {
540
            $error = "The sender method must start with [send]";
541
            throw new InvalidArgumentException($error);
542
        }
543
544
        $this->notifynderSender->extend($name, $registrar);
545
546
        return $this;
547
    }
548
549
    /**
550
     * Check if the category is eager Loaded
551
     *
552
     * @param $name
553
     * @return bool
554
     */
555
    protected function isLazyLoaded($name)
556
    {
557
        return array_key_exists($name, $this->categoriesContainer);
558
    }
559
560
    /**
561
     * Return the Id of the category
562
     *
563
     * @return mixed
564
     */
565
    public function id()
566
    {
567
        return $this->defaultCategory->id;
568
    }
569
570
    /**
571
     * Push a category in the categoriesContainer
572
     * property
573
     *
574
     * @param       $name
575
     * @param array $categoriesContainer
576
     */
577
    protected function setCategoriesContainer($name, $categoriesContainer)
578
    {
579
        $this->categoriesContainer[$name] = $categoriesContainer;
580
    }
581
582
    /**
583
     * Get the categoriesContainer property
584
     *
585
     * @param $name
586
     * @return array
587
     */
588
    public function getCategoriesContainer($name)
589
    {
590
        return $this->categoriesContainer[$name];
591
    }
592
593
    /**
594
     * Define which method
595
     * the event dispatcher has
596
     * to send the notifications
597
     *
598
     * @param $customSenderName
599
     * @return $this
600
     */
601
    public function dipatchWith($customSenderName)
602
    {
603
        $this->eventSender = $customSenderName;
604
605
        return $this;
606
    }
607
608
    /**
609
     * Call the custom sender method
610
     *
611
     * @param $name
612
     * @param $arguments
613
     * @return void|mixed
614
     */
615
    public function __call($name, $arguments)
616
    {
617
        if (starts_with($name, 'send')) {
618
619
            $arguments = (isset($arguments[0])) ? $arguments[0] : $this->toArray();
620
621
            $notificationsSent = $this->notifynderSender->customSender($name,$arguments);
622
            $this->refresh();
623
            return $notificationsSent;
624
        }
625
626
        $error = "method [$name] not found in the class ".self::class;
627
        throw new BadMethodCallException($error);
628
    }
629
630
    /**
631
     * Set builder properties
632
     * When setting dynamic properties
633
     *
634
     * @param $name
635
     * @param $value
636
     */
637
    function __set($name, $value)
638
    {
639
        $this->offsetSet($name,$value);
640
    }
641
642
    /**
643
     * Get property from the
644
     * builder
645
     *
646
     * @param $name
647
     * @return mixed
648
     */
649
    function __get($name)
650
    {
651
        return $this->offsetGet($name);
652
    }
653
}
654