Completed
Push — master ( d26d47...09d849 )
by Chris
01:05
created

QuoteFactory::quotes()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 82

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 82
rs 8.3927
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

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
namespace Cion\InspirationalQuotes;
4
5
use Illuminate\Support\Collection;
6
7
class QuoteFactory
8
{
9
    public function quotes()
10
    {
11
        return [
12
            [
13
                'quote' => 'When there is no desire, all things are at peace.',
14
                'by' => 'Laozi',
15
                'avatar' => 'https://i.imgur.com/hcfQHVk.png',
16
            ], [
17
                'quote' => 'Simplicity is the ultimate sophistication.',
18
                'by' => 'Leonardo da Vinci',
19
                'avatar' => 'https://i.imgur.com/fk7VpK6.png',
20
            ], [
21
                'quote' => 'Simplicity is the essence of happiness.',
22
                'by' => 'Cedric Bledsoe',
23
                'avatar' => '',
24
            ], [
25
                'quote' => 'Smile, breathe, and go slowly.',
26
                'by' => 'Thich Nhat Hanh',
27
                'avatar' => 'https://i.imgur.com/5dGaFFm.png',
28
            ], [
29
                'quote' => 'Simplicity is an acquired taste.',
30
                'by' => 'Katharine Gerould',
31
                'avatar' => 'https://i.imgur.com/kw0NM6i.png',
32
            ], [
33
                'quote' => 'Well begun is half done.',
34
                'by' => 'Aristotle',
35
                'avatar' => 'https://i.imgur.com/rdA2eXg.jpg',
36
            ], [
37
                'quote' => 'He who is contented is rich.',
38
                'by' => 'Laozi',
39
                'avatar' => 'https://i.imgur.com/hcfQHVk.png',
40
            ], [
41
                'quote' => 'Very little is needed to make a happy life.',
42
                'by' => 'Marcus Antoninus',
43
                'avatar' => 'https://i.imgur.com/3pzscGh.png',
44
            ], [
45
                'quote' => 'It is quality rather than quantity that matters.',
46
                'by' => 'Lucius Annaeus Seneca',
47
                'avatar' => 'https://i.imgur.com/wPZwH3H.png',
48
            ], [
49
                'quote' => 'Genius is one percent inspiration and ninety-nine percent perspiration.',
50
                'by' => 'Thomas Edison',
51
                'avatar' => 'https://i.imgur.com/djylt3R.png',
52
            ], [
53
                'quote' => 'Computer science is no more about computers than astronomy is about telescopes.',
54
                'by' => 'Edsger Dijkstra',
55
                'avatar' => 'https://i.imgur.com/GBvkWlP.png',
56
            ], [
57
                'quote' => 'It always seems impossible until it is done.',
58
                'by' => 'Nelson Mandela',
59
                'avatar' => 'https://i.imgur.com/o8d2eiJ.png',
60
            ], [
61
                'quote' => 'Act only according to that maxim whereby you can, at the same time, will that it should become a universal law.',
62
                'by' => 'Immanuel Kant',
63
                'avatar' => 'https://i.imgur.com/D9MZScY.png',
64
            ], [
65
                'quote' => 'Don’t judge each day by the harvest you reap but by the seeds that you plant.',
66
                'by' => 'Robert Louis Stevenson',
67
                'avatar' => 'https://i.imgur.com/I9GMkBS.png',
68
            ], [
69
                'quote' => 'Write it on your heart that every day is the best day in the year.',
70
                'by' => 'Ralph Waldo Emerson',
71
                'avatar' => 'https://i.imgur.com/1v1U8O2.jpg',
72
            ], [
73
                'quote' => 'Every moment is a fresh beginning.',
74
                'by' => 'T.S. Eliot',
75
                'avatar' => 'https://i.imgur.com/AjK9HKF.png',
76
            ], [
77
                'quote' => 'Without His love I can do nothing, with His love there is nothing I cannot do.',
78
                'by' => 'Unknown',
79
                'avatar' => '',
80
            ], [
81
                'quote' => 'Everything you’ve ever wanted is on the other side of fear.',
82
                'by' => 'George Addair',
83
                'avatar' => 'https://i.imgur.com/0YdRYJm.png',
84
            ], [
85
                'quote' => 'Begin at the beginning... and go on till you come to the end: then stop.',
86
                'by' => 'Lewis Carroll',
87
                'avatar' => 'https://i.imgur.com/s4RfIHa.png',
88
            ],
89
        ];
90
    }
91
92
    public function getRandomQuote()
93
    {
94
        return Collection::make($this->quotes())->random();
95
    }
96
}
97