|
| 1 | +<?php |
| 2 | + |
| 3 | +/*! |
| 4 | + * Saying Class |
| 5 | + * |
| 6 | + * Copyright (c) 2016 Dave Olsen, http://dmolsen.com |
| 7 | + * Licensed under the MIT license |
| 8 | + * |
| 9 | + * Load and print sayings |
| 10 | + * |
| 11 | + */ |
| 12 | + |
| 13 | +namespace PatternLab; |
| 14 | + |
| 15 | +use \PatternLab\Config; |
| 16 | +use \PatternLab\Console; |
| 17 | +use \PatternLab\Timer; |
| 18 | + |
| 19 | +class Saying { |
| 20 | + |
| 21 | + protected $sayings; |
| 22 | + |
| 23 | + /** |
| 24 | + * Construct the sayings |
| 25 | + */ |
| 26 | + public function __construct() { |
| 27 | + |
| 28 | + // build the default sayings |
| 29 | + $sayings = array( "have fun storming the castle", |
| 30 | + "be well, do good work, and keep in touch", |
| 31 | + "may the sun shine, all day long", |
| 32 | + "smile :)", |
| 33 | + "namaste", |
| 34 | + "walk as if you are kissing the earth with your feet", |
| 35 | + "to be beautiful means to be yourself", |
| 36 | + "i was thinking of the immortal words of socrates, who said '...i drank what?'", |
| 37 | + "let me take this moment to compliment you on your fashion sense, particularly your slippers", |
| 38 | + "42", |
| 39 | + "he who controls the spice controls the universe", |
| 40 | + "the greatest thing you'll ever learn is just to love and be loved in return", |
| 41 | + "nice wand", |
| 42 | + "i don't have time for a grudge match with every poseur in a parka", |
| 43 | + "han shot first", |
| 44 | + "what we've got here is a failure to communicate", |
| 45 | + "mama always said life was like a box of chocolates. you never know what you're gonna get", |
| 46 | + "soylent green is people", |
| 47 | + "a little word of advice, my friend. sometimes you gotta let those hard-to-reach chips go", |
| 48 | + "you don't understand! i coulda had class. i coulda been a contender. i could've been somebody, instead of a bum, which is what i am", |
| 49 | + "shop smart. shop s-mart", |
| 50 | + "i see dead people", |
| 51 | + "well, nobody's perfect", |
| 52 | + "it's alive! it's alive!", |
| 53 | + "you've got to ask yourself one question: 'do I feel lucky?' well, do ya, punk?", |
| 54 | + "badges? we ain't got no badges! we don't need no badges! i don't have to show you any stinking badges!", |
| 55 | + "the holy roman empire was neither holy nor roman. discuss.", |
| 56 | + "well, here's another nice mess you've gotten me into!", |
| 57 | + "here's johnny!", |
| 58 | + "hello, gorgeous", |
| 59 | + "nobody puts baby in a corner", |
| 60 | + "life moves pretty fast. if you don't stop and look around once in a while, you could miss it", |
| 61 | + "my precious", |
| 62 | + "be yourself; everyone else is already taken", |
| 63 | + "the ships hung in the sky in much the same way that bricks don't", |
| 64 | + "klaatu barada nikto", |
| 65 | + "i am putting myself to the fullest possible use, which is all i think that any conscious entity can ever hope to do", |
| 66 | + "just what do you think you're doing, dave?", |
| 67 | + "do what i do. hold tight and pretend it's a plan!", |
| 68 | + "(╯°□°)╯︵ ┻━┻", |
| 69 | + "¸.·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º>", |
| 70 | + "@}~}~~~", |
| 71 | + "(>'.')> (>'.')> (>'.')> ", |
| 72 | + "\(^-^)/", |
| 73 | + "you've been at this awhile; perhaps it's time for a walk outside?" |
| 74 | + ); |
| 75 | + |
| 76 | + // grab user sayings |
| 77 | + $userSayings = Config::getOption("sayings"); |
| 78 | + if (is_array($userSayings)) { |
| 79 | + $sayings = array_merge($sayings, $userSayings); |
| 80 | + } |
| 81 | + |
| 82 | + // i just didn't want to indent the crap above |
| 83 | + $this->sayings = $sayings; |
| 84 | + |
| 85 | + print_r($sayings); |
| 86 | + |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * Randomly prints a saying after the generate is complete |
| 91 | + */ |
| 92 | + public function say() { |
| 93 | + |
| 94 | + // set a color |
| 95 | + $colors = array("ok","options","info","warning","error"); |
| 96 | + $randomNumber = rand(0,count($colors)-1); |
| 97 | + $color = (isset($colors[$randomNumber])) ? $colors[$randomNumber] : "desc"; |
| 98 | + |
| 99 | + // set a 1 in 3 chance that a saying is printed |
| 100 | + $randomNumber = rand(0,(count($this->sayings)-1)*3); |
| 101 | + if (isset($this->sayings[$randomNumber])) { |
| 102 | + Console::writeLine("<".$color.">".$this->sayings[$randomNumber]."...</".$color.">"); |
| 103 | + } |
| 104 | + |
| 105 | + } |
| 106 | + |
| 107 | +} |
0 commit comments