Passed
Push — master ( 636052...60f6c1 )
by Julien
05:04
created

Email::send()   F

Complexity

Conditions 17
Paths 577

Size

Total Lines 83
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 306

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 17
eloc 44
c 1
b 1
f 0
nc 577
nop 1
dl 0
loc 83
ccs 0
cts 44
cp 0
crap 306
rs 1.6375

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * This file is part of the Zemit Framework.
4
 *
5
 * (c) Zemit Team <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE.txt
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zemit\Models;
12
13
use Zemit\Db\Column;
14
use Zemit\Models\Abstracts\AbstractEmail;
15
use Phalcon\Incubator\Mailer\Manager;
16
use Phalcon\Messages\Message;
17
use Phalcon\Filter\Validation\Validator\PresenceOf;
18
use Phalcon\Filter\Validation\Validator\StringLength\Max;
19
use Phalcon\Filter\Validation\Validator\Uniqueness;
20
use Phalcon\Filter\Validation\Validator\Numericality;
21
use Zemit\Models\Interfaces\EmailInterface;
22
23
/**
24
 * @property Template $TemplateEntity
25
 * @method Template getTemplateEntity(?array $params = null)
26
 * 
27
 * @property EmailFile $FileNode
28
 * @method EmailFile getFileNode(?array $params = null)
29
 * 
30
 * @property File $FileList
31
 * @method File getFileList(?array $params = null)
32
 */
33
class Email extends AbstractEmail implements EmailInterface
34
{
35
    protected $deleted = self::NO;
36
    protected $sent = self::NO;
37
    
38
    public function initialize(): void
39
    {
40
        parent::initialize();
41
        // @todo relationships
42
    }
43
    
44
    public function validation(): bool
45
    {
46
        $validator = $this->genericValidation();
47
        
48
        // @todo validations
49
        
50
        return $this->validate($validator);
51
    }
52
}
53