├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── composer.json ├── composer.lock ├── index.php └── src ├── Mood.php ├── Soul.php └── Zalgo.php /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | We accept contributions via Pull Requests on [Github](https://github.com/mdwheele/zalgo). 6 | 7 | 8 | ## Pull Requests 9 | 10 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). 11 | 12 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 13 | 14 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 15 | 16 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. 17 | 18 | - **Create feature branches** - Don't ask us to pull from your master branch. 19 | 20 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 21 | 22 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. 23 | 24 | 25 | ## Running Tests 26 | 27 | ``` bash 28 | $ phpunit 29 | ``` 30 | 31 | 32 | **Happy coding**! 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dustin Wheeler 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zalgo 2 | 3 | [![Latest Version](https://img.shields.io/github/release/mdwheele/zalgo.svg?style=flat-square)](https://github.com/mdwheele/zalgo/releases) 4 | [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) 5 | [![Build Status](https://img.shields.io/travis/mdwheele/zalgo/master.svg?style=flat-square)](https://travis-ci.org/mdwheele/zalgo) 6 | [![Total Downloads](https://img.shields.io/packagist/dt/mdwheele/zalgo.svg?style=flat-square)](https://packagist.org/packages/mdwheele/zalgo) 7 | 8 | T̫̺̳o̬̜ ì̬͎̲̟nv̖̗̻̣̹̕o͖̗̠̜̤k͍͚̹͖̼e̦̗̪͍̪͍ ̬ͅt̕h̠͙̮͕͓e̱̜̗͙̭ ̥͔̫͙̪͍̣͝ḥi̼̦͈̼v҉̩̟͚̞͎e͈̟̻͙̦̤-m̷̘̝̱í͚̞̦̳n̝̲̯̙̮͞d̴̺̦͕̫ ̗̭̘͎͖r̞͎̜̜͖͎̫͢ep͇r̝̯̝͖͉͎̺e̴s̥e̵̖̳͉͍̩̗n̢͓̪͕̜̰̠̦t̺̞̰i͟n҉̮̦̖̟g̮͍̱̻͍̜̳ ̳c̖̮̙̣̰̠̩h̷̗͍̖͙̭͇͈a̧͎̯̹̲̺̫ó̭̞̜̣̯͕s̶̤̮̩̘.̨̻̪̖͔ 9 | ̳̭̦̭̭̦̞́I̠͍̮n͇̹̪̬v̴͖̭̗̖o̸k҉̬̤͓͚̠͍i͜n̛̩̹͉̘̹g͙ ̠̥ͅt̰͖͞h̫̼̪e̟̩̝ ̭̠̲̫͔fe̤͇̝̱e͖̮̠̹̭͖͕l͖̲̘͖̠̪i̢̖͎̮̗̯͓̩n̸̰g̙̱̘̗͚̬ͅ ͍o͍͍̩̮͢f̖͓̦̥ ̘͘c̵̫̱̗͚͓̦h͝a̝͍͍̳̣͖͉o͙̟s̤̞.̙̝̭̣̳̼͟ 10 | ̢̻͖͓̬̞̰̦W̮̲̝̼̩̝͖i͖͖͡ͅt̘̯͘h̷̬̖̞̙̰̭̳ ̭̪̕o̥̤̺̝̼̰̯͟ṳ̞̭̤t̨͚̥̗ ̟̺̫̩̤̳̩o̟̰̩̖ͅr̞̘̫̩̼d̡͍̬͎̪̺͚͔e͓͖̝̙r̰͖̲̲̻̠.̺̝̺̟͈ 11 | ̣̭T̪̩̼h̥̫̪͔̀e̫̯͜ ̨N̟e҉͔̤zp̮̭͈̟é͉͈ṛ̹̜̺̭͕d̺̪̜͇͓i̞á͕̹̣̻n͉͘ ̗͔̭͡h̲͖̣̺̺i͔̣̖̤͎̯v̠̯̘͖̭̱̯e̡̥͕-m͖̭̣̬̦͈i͖n̞̩͕̟̼̺͜d̘͉ ̯o̷͇̹͕̦f̰̱ ̝͓͉̱̪̪c͈̲̜̺h̘͚a̞͔̭̰̯̗̝o̙͍s͍͇̱͓.̵͕̰͙͈ͅ ̯̞͈̞̱̖Z̯̮̺̤̥̪̕a͏̺̗̼̬̗ḻg͢o̥̱̼.̺̜͇͡ͅ ̴͓͖̭̩͎̗ 12 | ̧̪͈̱̹̳͖͙H̵̰̤̰͕̖e̛ ͚͉̗̼̞w̶̩̥͉̮h̩̺̪̩͘ͅọ͎͉̟ ̜̩͔̦̘ͅW̪̫̩̣̲͔̳a͏͔̳͖i͖͜t͓̤̠͓͙s̘̰̩̥̙̝ͅ ̲̠̬̥Be̡̙̫̦h̰̩i̛̫͙͔̭̤̗̲n̳͞d̸ ͎̻͘T̛͇̝̲̹̠̗ͅh̫̦̝ͅe̩̫͟ ͓͖̼W͕̳͎͚̙̥ą̙l̘͚̺͔͞ͅl̳͍̙̤̤̮̳.̢ 13 | ̟̺̜̙͉Z̤̲̙̙͎̥̝A͎̣͔̙͘L̥̻̗̳̻̳̳͢G͉̖̯͓̞̩̦O̹̹̺!̙͈͎̞̬ * 14 | 15 | ## Install 16 | 17 | Via Composer 18 | 19 | ``` bash 20 | $ composer require mdwheele/zalgo 21 | ``` 22 | 23 | ## Usage 24 | 25 | ### Summoning Zalgo! 26 | 27 | There is an awesome fluent-builder coming soon! Promise! 28 | 29 | ``` php 30 | // You must forge the soul... 31 | $soul = new Soul(); 32 | 33 | // ... to create the Zalgo. 34 | $zalgo = new Zalgo($soul, Mood::soothed()); 35 | ``` 36 | 37 | ### Speaking while soothed 38 | 39 | Zalgo sometimes enjoys a warm bath in pools of blood offered by the innocent. He soothes you with his 40 | calming embrace. 41 | 42 | ``` php 43 | echo $zalgo->speaks('the magic quotes they are coming for me I live only days'); 44 | ``` 45 | 46 | ``` 47 | 48 | t͓̹̓͟h̶̻͓͠e̋͑̀̇̉ ̤̫̮̊̈̎͛ͧ̆̚m̞̟̗͎̖͍̩̼ā̘̜̗̾̂ͥͩͬ̍ģ́ȋ̧͈̹̩͉̭c̹̞͔̯̞͖̃̐͒̌̅͏͘ ̹̞̮͖͇̅͒̉̂͂͌̎̚q̘̹̬̼͉̤̜̓ŭ͈̑̓̆͗̓͂ͫ͜o̙̜̫͚̤͌͑ͅt̼̹̩͍̱̰̮e̡͎̻͔̹͎ͨͩ̅̅̽͠s̠̪̱ͬ̓ͫͭ̃ͮ̏̚ ͉̭̻̺̣̮̈́̋ͯ̑̔̚t̻̻̟͓͚͗ͯ͗ͨͦ̅͗ͅ͏ḧ̴̥̬̫̥͓̠̗ͧ̍ͬͧͧ́e̥͇͈ͣ̌͌̓̅̒̐̎y͔̺͔̹̫ ͍͚̭͚̬̫̪̳͌̕͠a̵̧̺͈̭̋̀ͭͩ͗̔ͮͩŕ͓͍̬̭͎̍̿͐̂̅e͕̻͔̚ ̻͎̞͙̩̟̖̒̽̿͂̄̒͠c̴͌͐̎͑̽o͓͙̲̰̗̍͐͆m̭̲̰̗͐̈́ͨ͌̉͛̃͡i̓̌̋͑ͧ̋ͤͦn̬̥̳͇̗ͬͣ̿g̺̬̩͊ͨ́ͬͩ̌ͪͬ̀͝ ͍̗͚̗͕f̪ͮͤ͆ͯ̽õ̗̘̹̻̜̤͚͖ͫͮͬ̽ͧ͐r̨̘̮̭͉̭̪̬͈͒̋͘ ̱̰͉̮ͦ͐ͪ̀̾ͫ̒ͅm̢̋͑ͭ̔̽eͦͨͫ̀ ͙̭̫͊ͯ̿ͬͫIͬͤ͒ ̧͓̣̄l̾͢͠i̩͍̜v͈̞̮̹͔̈́̅̓͜͠e̷͖͚̞̙̣̜̖͎̕ ̎͗͟o͉ͧ̌ͩͯͭ͋n̸̨̝̂͆ͧ͋ḽ̤̤̯̭͚̝̐ͮy̍ͪͨͮ͗͏̨ ̯͚̲̓̆͒͟͢d̷͇̙͖̹̜͈̫̆̑̾̓̋ͮ̕a͈̞̹͂͒̏̃̈́̍͋ͭy̵̡̗̪̺̺̮̪̣ͥͩ̓̇ͤs̟͎̜͍̮̣̱͒͆̄̒̓̅̾́ 49 | 50 | ``` 51 | 52 | ### Speaking while enraged 53 | 54 | HOW DARE THOU ENRAGE THE MIGHTY ZALGO?! BOW BEFORE THE THRONE, MINION! 55 | 56 | ``` php 57 | $zalgo = new Zalgo($soul, Mood::enraged()); 58 | 59 | echo $zalgo->speaks('the magic quotes they are coming for me I live only days'); 60 | ``` 61 | 62 | ``` 63 | 64 | 65 | ţ̶̨͖̼̹̯̝̫̤̝̱̗̟̘̦̭̺̰̥̥̯͔̳̦̬̪̞̲̙̜͙͈̙͓̭̼̩̳̖̲̲̹͕̺͔̦̤̪̳̰͎̭̘̜͎̬̥ͧͬ̆ͨ͆̃̽͆ͅh̵͔̳͈̦̭̗̱͉̹̖̹̣̘͇͍̑̔̆̃͒̐͆ͅ҉́e̢̞̺̤̞̼͙͚̜͖̙̘̥̱̠̘̗̣̖͚͖̜͕͇͖̪̐ͪ̋ͨ͛͛̾̑ͯͪͩ͐̏̿ͮ̒̔̉҉̡ ̸̩͉̟̮̻͖̪̣̟̪̠̗͖̜̗̝̥̠̖̪̫̖̩̺̙̳̫̫͔̝̻̞͕͎̹̱͈͙̱͖̥̍͑̆͗ͮ̅̐̍̈̅̇ͧ͂̓ͨ̊̚͘͟͡҉m̛̲͍̝̼̮̩̲̥̈́̃̒͊ͦ͒̂͂͡a̧̯͍͚͕̜̰̝̗̳̝͔̝̗͚̭͕̤̲͎͉͇͈̬̦͚͈̘̻̬̪̜̟̦̖̩͍̝̪̫̦̠̰̩̟͖̟̭̯͕̤̠̺͚̹͖͙ͯ̿͂ͫ̊̆ͪ̓͑̍ͯ̽̓̈͋ͧͣ̉͂ͅ҉͜g̨̛̫̺̱̹͓̝̳̭̗̰͉̣̘̰̦͉̬͕̮̺̦̥ͯ̓ͤ͑͌ͫ̏ͧ̑ͨ̈̂͛͒̽́͡ǐ̧̜̬̪̝͕̙̝͚̳̮͇͚̩̞̳̺̮͈̼͎̼͙̻̲̭̜͉̰̙̹̬̠̣͇̪͕͍̰͓̫͖̳̩̤͇͕͓̞̺̰͚̦̮̺͎͔͐̇̅ͫͯ̚͘͟͜͢ĉ̭̪̦͍͌̄̇ͭͮ̓ͨ̌ͯ̍͒ͩͬ̈́͡ͅ ̶̴͈̬͙̱͓͔̱̖̻̫̪̗͇̺͇̱̲̠̞̟̦̝̼̳͎̞̣͙̗̯̩͍͓̤̦̜͎͉̟̖͍͕̅͆͐̊ͤ́̂̆ͮ̀͊́͝ͅͅq̶̹̜̙̥͔̥̦̼̞͖̟̳̙͖̝̮͙͎̮̲̪̹̜͍͉̟̲͈̙̲̣̼̘͙̱̪̤̞̎ͤ̓́̐̓̌͗̄ͧ͆ͯ̍̊́̚ͅů̼͕̝̭̘͗̉͑̍̅ͧ͊́́ͅơ̳̖̝͖̙̫̟̥̖̬̦ͭ͑ͨ͌̋́̚̕͝͠ţ̦̩̺̳̩̖͓̭̞̰̞̟̤̌̓̇ͣ̌̅̏̉ͫ͛͗ͫ́͗͆̂e͓͖̤̫̜̟͍̬̱̭͙͓̭͍̤̹̥̭͍̱͇̘̠̫̹̳̮̟̯̟̹̩̜͓̤̗̯̺̲͔̳̬̦̫̻͕̺̋͋̿̓ͯͦ̃̀̕͞͠ͅs̰̦͕̣̻̱͔̥̳̲̬̩̥͇̮̹̹̖̙͙͉̟̻̈́ͮ̒̀͊ͧ̿ͣͭ̾͊̿͛ͫͥ͝ͅ ̱͈̮̱̫͙̬̺̱͖̣͎̟̥͉̦̥͔̤̗̗͔̝͓̭̟̻͔͈̞̹̞̼͚̜̗̳̺͚̳̮̝̥͇͖̲̣͉͉̗͎̺͇͚̯̝̝̜̣͕̥̳̘͙̄ͪ̌̏ͅͅ͏͘҉̀ẗ̶̼̮͍̲̫̺̻͕͍̺̣̺̲̻͔̹̳͓̳̖͉̩̤͈͔̙̮̫̬̤̖͎̗̳̱̭̞̞̩͚͉̦̳̦͙̮͕̰̥̯̱̗͉͈͍̺͎̠̣̠̯̣̅ͯ͆͆̌͛ͦ̇͆̏ͬͤ́̓ͪ̕ͅ͏͏ḣ̢̖͚̱̠̭̰̥͙̗͓͓͇̲̘̫̗̹̹͎̖̤̰͚̞̺̭̜̲̹͔̘̹͎̳͎̤̘̙̞̙͖̖͎̯̘̞̰̻̉̀́̇ͨ̌̉ͣ̾ͯ̆̌͛ͯ͗ͦ̋̕͠͞e̖̪̰̯̭̼͙̘̭̤͇̮̣̪̺̬̫͕̦̣̗̥̟̣͎̟̟̬̦̲̘̩͔̳͉̦̠͇̪̻͙̘̘͌̎͂ͯ̔̐͆͑͛̋̍͗̓̿͊ͣ͡y̝͈̘̮̥̝͈̝̰̮͕̠͉̱̝͓̳̘̤̤̫̖͉͚͈̪͓͖̰͎̼̲̤͙̼͚̘̫̯̰̤̼̥ͨ̏̓ͧ̒ͬ̾̒̉͢͠ͅͅ ̵̵̸̛̪̤̙̘͉̺̲̳̥̙͍̟͉͉̥̜̠͈̫͕̖̝͇̜̈́̒̈̈́͜ͅa̜͚͎̝̜̱̤̹̜̺͙̮̖̖̦̙̝͕͉͍̘̲̖͎̗͇ͬ̅̆̓ͣͣ͒̾ͧ͛̑̀ͥ͋̔̾͘ͅͅr̙̖̟̣͉̣̗̮̱̘̥̳͍̮̠̮͈͓͕̞̳͕͓͔̣̟͍̗̣̙̙͇̦̙̯̥̝͖͍̟̞̫͚̺̽͐̂ͦͣ͂̿͊ͯ̄ͪ̾̄̚ͅ͏̴é̷̛̠̲̦̩̻̣̹͇̯͓͓̫̻̗̲̣̖̝̳̭̰͚̣͖͕̪͈͛͗͊ͪ͒̋̓ͅ ̹̭̻̻͙̻̻̘̟̗̳̝͈̲̗̺͕͉̼͉̔̒̎̓̐ͧ̄̀̚͘͡c̸͔̩̠̹͓̥̟͈̗͓̰̝͉̼͎̥͕̜͕͓̮̱̭̟͍̹͔̼̭̺͈̥͖͚͂̽͆̈́̽̏ͧ̊͗ͣͮͪͧ̅͠o̴̧̠͖̳̩͍̊ͮ͌̉ͣ̚͠m̻̪̰̦̳̬͔͔̟̥̻̰̙̹̹̰̭̪̦͓͔̫̠̩̥̪̖̠͚͚̗̹̩̲͕͔͖͈͈̜̖̫̹̙͚̞̹̫̱͔̠̫̠̮̰͉͇͇͇̼͈̦̣̥͌ͫͨͪ̂́̅͊͐ͯ̆ͤ͛̽͛ͫ͘ͅį̧̡̟̩͕̬̣̺͚͕͔͎̙͍̬̒͂̾͛ͮ̎ͯ̄̔̊̒͐̀̾ͤ̾̔͟͠ͅͅń̴͖̮̺͈̳̣͈̟̙̲̱̞̪͕̲̗̠͍͍ͭͪͪ́̀̚ͅͅͅg̛̟̞̯͙͇̯̼͖̝̫̖͕̞̖͉͇̘͚̰͓̬̹̣̪̳͙̥̪̭̜̲̳̳̯̦̖̝̠̞̱̠͓̬̫͓̞̙͕̜̹͈̱̞͈͓͈̼̜̘̙̠̹͛̾ͨ͐ͬ͢͢͝͡ͅ ̸̨̛̥͎̱̬̬̥͖̳̣͉̦̼ͥ͊ͩ̑ͦ̽͟͡f̶̨̨̳̗̥̫̲̼͉͍̳̩͍̪̺̮̟͚̞̥͖̳̝͕͕͎̙̫̮̣̟͓̣͉͔̥̝̭͖͕̠̰̠̣͎͓̮̣͍̹̥͇̞̭̹̗̠̬̼̼̈́ͣ͗͐̽ͮͫ̃̍͜͞ͅọ̟̺̼͔̠̞̱̳̲̭̗̩̤̭̪̲̣̪̼̬͉͉̹͍̝̱̣͖̖̟͖̟͎ͫ͋̍̓̒̍̑̃̂̑͑̎͋ͯ͗ͨ́͑͏̛̕͟r̢̟̗͍̩̲͉̤̲͚̝͇͉͉͉̭̪̫̻̩̣̠̲̖̙̩̗̩͈̰̦͙̱̘̥̗͓̰̹͍̽̏̇̎ͮͨ̎͑̂̂̚̚͝ͅ ͇̣̦̟̦̤͇̫̰͉̟̣̪̣̻̻̱͚͓̙̱̙̓ͦ͌ͣ͌ͥ̉̓̇ͣͤ̏͢ͅͅm͕͈̼̜̯̖̺̠̠̺̲̟̤̞͇̠͔̳͕͚̘̣͉̤̼͍̘̗̬̺̬̥̫̗̬͎̘̖̖̦̺̳̰͔͇̠̘ͫ͋̓̏͋͜ę̴̷̞̝͚̮͉̲͖̻̤̝͇͓͕̼̫͈̺̼͎̤͉͚͔̥͇͖̖͓̣̝͍̝̦͈̳̘̥̰͇̱̺̭̪̱̙͇̤̬̘͙̞̖͍̭͈͇̭̳̳̪͓͓̙ͬ͛̓̅̔̿̐̉̀ͧ̎ͧ̆̿̐͛ͅͅ ̻͖͔̣͈͇̙̝̺̯̗̠̪̳̤̹̹̪̲͓̝͔̟͔̫̲̬̥̺̺̹̥̱̮̥̥̝̪̭͉͎̮́̍̇̎̿͛̊ͩ̈́̈́ͦ̀͊̋ͯ̅̇̓҉́҉͘͠Ị̢̘͎̤̪͚̹͈͈̬̟͇̳̟͖̦͉̯̹̞̞͈͍̥͖̻̗̼̞̭̻̤̤͕̳̠̰̂ͤ̐̔̏̋̆̾ͩͦ̋͋͡ͅ ̷̨͉̳͖̖̮̰̠͙͉̞͎̤͓̤͔̭̣̥̯̦͓̪̟̹̻̮̜͚̪͎͈̂̉̓ͦ͌̄̓̒͑̄͊ͯ͂̈̋̈́ͯ͟͠ͅͅļ̡̙̬̩̪͔̺̞̲͚̪̝̹͍̥̲̝̘̥̗͎̖̬̗͚̼̖̙͉̤̘̙̩̮̭̻̦̗͎͓̣̞͚̳͙̠̜̘̦̬̙̜̬̰̝̪̝̞̮͖̬̰̖͙̭̆̿͑͆̈́̚ͅî̷̬̼͓͔͎̟̖̣̻͖̫̜̓̄͆̇̊̿͂̒͐v̡̪̟͓̬̞̙͌̊ͨ̏͝e̲̗̱̮̜̳͉̱͓̲̗̟͈͕̳͖ͧͮ̒̽ͤͨ̽ͣ͌҉̡̧́ ̜̪͓̜̪̱̻̬̬̥̥̦̤̰̮̳͖̪̼̠͍̬̤̣͇͖̺̹̼͇͖̱̬̖͔͖̼̤̺̗̱͔̪͈̪͉̩̥̜̣̯͕̫͇͔̙̺̯̓̌ͥ̍͑͊ͤ̔ͭͦ͞ͅͅo̷̢̜̪̬͚̼̝̩̮̯̳̲̮̗̭͍ͩ̓̔̽́͂ͭ͠n̵͙̞̬̪̝̗̯̮̯͙̖̖̫̘̭̞͎̗̞̯̹͎̭͈̥͙̱̪̣̳̦̝͚̺̥̖̙͇̰̖͈̰̬͍͖̲̺̹̹͍̘̉͛̐̂̏ͨ̅̄̄́͜ͅl͓̙̼̮̼̯̰͓̘͙͈͖̪̟̜͈̟̳̥̞̼̘̜͎̹̳̣͔̰̳͙̩̻̺͈̩̘̠̝̜̝͕̖̰̘̜̠̥̯̭̪̲̲̞̝̙̞̂͗͌̍͐̋͆̿ͪ͆͒̋̌͒̊̾̏̅̕͜͟ͅy̢͕̣̗͓̘̠͓̼͖͉̲̥̩̟͙͕̗͈̹̗̮̦̱̠̝̟̥̪͇̳̗̺͕͉͎͇̭͈̰͚̖͍̝͙̼̞̥̟̝̳͇̪͕̹̫̤̋̽ͣ̓ͬͪͤͤͥ͐ͨͬͤ̎̋̐̌̚͡ͅͅͅͅͅ ̷̨̜̘̝̥̖͎̭̘̺͎̺̩̞̦̠͉̼̯̘̹͉̗̜͖͍̯͍͙̱̞̗̹̦̦̹̙͇̦̞̪̙͉̼̥̘͕̖͇̪̙̩̜̜̮̗͖͕͓͓̭̣͕̣̥̟͒ͧ̈́ͭ̐̅͊͜ͅd̙̟̘̘̘̗̪̥̻͇̞̰̤̬̮̱̦̼͓̘͕͔̟̠̠̮̻̖̣̼͉̞͇͓̤͛̊ͮ͑̈́ͨ̇̄̆̓͊̇̂ͨ̈͊̉́͠ͅa̶̛̩̹̘̲̖̲͇̟̯͓͖̩̘̯̳̘̫̟͙̯̤̥̘̳̤̽ͭ̑̎̓̔̈́͆̂͌ͬ͢͡ͅͅͅ͏y̨͈̫͚̗̮̻̱̣͔̟̻̩̭͖̫͚̝͔͖̠̼̯ͫͬ̊́̄ͅ҉̕ş̴̰̮̲̯̝̭̼͍͇̘̙̗͎͚͚̗̺̭̬̹̮̹̭͇̦̦͇̫̜͉͓̳̩̩͇͇͚̱̮̗̟̲̘̖̰̗̗̜̮̮͇͕̖̜̹̩ͥͭ̍̅ͫ̄ͅ 66 | 67 | 68 | ``` 69 | 70 | ### Speaking to Twitter 71 | 72 | When he's in the mood, Zalgo graces you with the ability to cut your puny phrase down to something less 73 | than 140-characters when disturbed. Your letters are worthless. 74 | 75 | ``` php 76 | $zalgo = new Zalgo($soul, Mood::twitter()); 77 | 78 | echo $zalgo->speaks('the magic quotes they are coming for me I live only days'); 79 | ``` 80 | 81 | ``` 82 | t̹ͬhe ͙̫ͪm̭̓a̘̬g̉i̔c͉͕ͣ ͍q̗̥ṳo͎̳t̥é̳͇s̯ ̟̈th̩͎ͪey̯̰ͭ ̝̬̀a̱r͎̓e̥͇ c͔om̔ỉ̘ng̖̞̓ f̲o̾r̳̗ m̪͙e ̗̜ͯÍ͙ ̥̞l̝͓i̝̔v̭e̞ o̺nͮl̘y ͔̙̓d̯a͎͒y̔s͓̣̐ 83 | ``` 84 | 85 | ### Zalgo soothes a previous prophecy 86 | 87 | Yeah... no role-playing here. Sometimes folks get really freaking annoyed at Zalgo text and this 88 | package gives you a way to clean prophecies spoken by **this** package, at least. Most implementations 89 | are the same as this (or use the same unicode character set) so it should work. 90 | 91 | ``` php 92 | $cleanText = $zalgo->soothe($prophecy); // Where prophecy is that crazy-looking stuff above. 93 | ``` 94 | 95 | ## Testing 96 | 97 | ``` bash 98 | $ phpunit 99 | ``` 100 | 101 | ## Contributing 102 | 103 | Please see [CONTRIBUTING](CONTRIBUTING.md) for details. 104 | 105 | ## Security 106 | 107 | If you discover any security related issues, please email mdwheele@ncsu.edu instead of using the issue tracker. 108 | 109 | ## Credits 110 | 111 | - [Dustin Wheeler](https://github.com/:author_username) 112 | - [Marak](https://github.com/Marak/zalgo.js) - Author of JS library this package is ported from. 113 | - [All Contributors](../../contributors) 114 | 115 | ## License 116 | 117 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 118 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mdwheele/zalgo", 3 | "description": "His six mouths speak in different tongues, and the seventh shall sing the song that ends the earth.", 4 | "keywords": ["help", "me", "zalgo"], 5 | "homepage": "https://github.com/mdwheele/zalgo", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Dustin Wheeler", 10 | "email": "mdwheele@gmail.com", 11 | "homepage": "https://dustinwheeler.com", 12 | "role": "Developer" 13 | } 14 | ], 15 | "require": { 16 | "php" : ">=5.4.0", 17 | "ext-json": "*", 18 | "ext-mbstring": "*" 19 | }, 20 | "require-dev": { 21 | "phpunit/phpunit" : "4.*" 22 | }, 23 | "autoload": { 24 | "psr-4": { 25 | "Zalgo\\": "src" 26 | } 27 | }, 28 | "autoload-dev": { 29 | "psr-4": { 30 | "Zalgo\\": "tests" 31 | } 32 | }, 33 | "extra": { 34 | "branch-alias": { 35 | "dev-master": "1.0-dev" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "baae686a9c67b05e85d3e083b19bccb4", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "doctrine/instantiator", 12 | "version": "1.0.4", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/doctrine/instantiator.git", 16 | "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", 21 | "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "php": ">=5.3,<8.0-DEV" 26 | }, 27 | "require-dev": { 28 | "athletic/athletic": "~0.1.8", 29 | "ext-pdo": "*", 30 | "ext-phar": "*", 31 | "phpunit/phpunit": "~4.0", 32 | "squizlabs/php_codesniffer": "2.0.*@ALPHA" 33 | }, 34 | "type": "library", 35 | "extra": { 36 | "branch-alias": { 37 | "dev-master": "1.0.x-dev" 38 | } 39 | }, 40 | "autoload": { 41 | "psr-0": { 42 | "Doctrine\\Instantiator\\": "src" 43 | } 44 | }, 45 | "notification-url": "https://packagist.org/downloads/", 46 | "license": [ 47 | "MIT" 48 | ], 49 | "authors": [ 50 | { 51 | "name": "Marco Pivetta", 52 | "email": "ocramius@gmail.com", 53 | "homepage": "http://ocramius.github.com/" 54 | } 55 | ], 56 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 57 | "homepage": "https://github.com/doctrine/instantiator", 58 | "keywords": [ 59 | "constructor", 60 | "instantiate" 61 | ], 62 | "support": { 63 | "issues": "https://github.com/doctrine/instantiator/issues", 64 | "source": "https://github.com/doctrine/instantiator/tree/master" 65 | }, 66 | "time": "2014-10-13T12:58:55+00:00" 67 | }, 68 | { 69 | "name": "phpdocumentor/reflection-docblock", 70 | "version": "2.0.4", 71 | "source": { 72 | "type": "git", 73 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 74 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" 75 | }, 76 | "dist": { 77 | "type": "zip", 78 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", 79 | "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", 80 | "shasum": "" 81 | }, 82 | "require": { 83 | "php": ">=5.3.3" 84 | }, 85 | "require-dev": { 86 | "phpunit/phpunit": "~4.0" 87 | }, 88 | "suggest": { 89 | "dflydev/markdown": "~1.0", 90 | "erusev/parsedown": "~1.0" 91 | }, 92 | "type": "library", 93 | "extra": { 94 | "branch-alias": { 95 | "dev-master": "2.0.x-dev" 96 | } 97 | }, 98 | "autoload": { 99 | "psr-0": { 100 | "phpDocumentor": [ 101 | "src/" 102 | ] 103 | } 104 | }, 105 | "notification-url": "https://packagist.org/downloads/", 106 | "license": [ 107 | "MIT" 108 | ], 109 | "authors": [ 110 | { 111 | "name": "Mike van Riel", 112 | "email": "mike.vanriel@naenius.com" 113 | } 114 | ], 115 | "support": { 116 | "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", 117 | "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/2.0.4" 118 | }, 119 | "time": "2015-02-03T12:10:50+00:00" 120 | }, 121 | { 122 | "name": "phpspec/prophecy", 123 | "version": "1.4.0", 124 | "source": { 125 | "type": "git", 126 | "url": "https://github.com/phpspec/prophecy.git", 127 | "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5" 128 | }, 129 | "dist": { 130 | "type": "zip", 131 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", 132 | "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", 133 | "shasum": "" 134 | }, 135 | "require": { 136 | "doctrine/instantiator": "^1.0.2", 137 | "phpdocumentor/reflection-docblock": "~2.0", 138 | "sebastian/comparator": "~1.1" 139 | }, 140 | "require-dev": { 141 | "phpspec/phpspec": "~2.0" 142 | }, 143 | "type": "library", 144 | "extra": { 145 | "branch-alias": { 146 | "dev-master": "1.4.x-dev" 147 | } 148 | }, 149 | "autoload": { 150 | "psr-0": { 151 | "Prophecy\\": "src/" 152 | } 153 | }, 154 | "notification-url": "https://packagist.org/downloads/", 155 | "license": [ 156 | "MIT" 157 | ], 158 | "authors": [ 159 | { 160 | "name": "Konstantin Kudryashov", 161 | "email": "ever.zet@gmail.com", 162 | "homepage": "http://everzet.com" 163 | }, 164 | { 165 | "name": "Marcello Duarte", 166 | "email": "marcello.duarte@gmail.com" 167 | } 168 | ], 169 | "description": "Highly opinionated mocking framework for PHP 5.3+", 170 | "homepage": "https://github.com/phpspec/prophecy", 171 | "keywords": [ 172 | "Double", 173 | "Dummy", 174 | "fake", 175 | "mock", 176 | "spy", 177 | "stub" 178 | ], 179 | "support": { 180 | "issues": "https://github.com/phpspec/prophecy/issues", 181 | "source": "https://github.com/phpspec/prophecy/tree/master" 182 | }, 183 | "time": "2015-03-27T19:31:25+00:00" 184 | }, 185 | { 186 | "name": "phpunit/php-code-coverage", 187 | "version": "2.0.15", 188 | "source": { 189 | "type": "git", 190 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 191 | "reference": "34cc484af1ca149188d0d9e91412191e398e0b67" 192 | }, 193 | "dist": { 194 | "type": "zip", 195 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67", 196 | "reference": "34cc484af1ca149188d0d9e91412191e398e0b67", 197 | "shasum": "" 198 | }, 199 | "require": { 200 | "php": ">=5.3.3", 201 | "phpunit/php-file-iterator": "~1.3", 202 | "phpunit/php-text-template": "~1.2", 203 | "phpunit/php-token-stream": "~1.3", 204 | "sebastian/environment": "~1.0", 205 | "sebastian/version": "~1.0" 206 | }, 207 | "require-dev": { 208 | "ext-xdebug": ">=2.1.4", 209 | "phpunit/phpunit": "~4" 210 | }, 211 | "suggest": { 212 | "ext-dom": "*", 213 | "ext-xdebug": ">=2.2.1", 214 | "ext-xmlwriter": "*" 215 | }, 216 | "type": "library", 217 | "extra": { 218 | "branch-alias": { 219 | "dev-master": "2.0.x-dev" 220 | } 221 | }, 222 | "autoload": { 223 | "classmap": [ 224 | "src/" 225 | ] 226 | }, 227 | "notification-url": "https://packagist.org/downloads/", 228 | "license": [ 229 | "BSD-3-Clause" 230 | ], 231 | "authors": [ 232 | { 233 | "name": "Sebastian Bergmann", 234 | "email": "sb@sebastian-bergmann.de", 235 | "role": "lead" 236 | } 237 | ], 238 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 239 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 240 | "keywords": [ 241 | "coverage", 242 | "testing", 243 | "xunit" 244 | ], 245 | "support": { 246 | "irc": "irc://irc.freenode.net/phpunit", 247 | "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", 248 | "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.0.15" 249 | }, 250 | "time": "2015-01-24T10:06:35+00:00" 251 | }, 252 | { 253 | "name": "phpunit/php-file-iterator", 254 | "version": "1.3.4", 255 | "source": { 256 | "type": "git", 257 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 258 | "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" 259 | }, 260 | "dist": { 261 | "type": "zip", 262 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", 263 | "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", 264 | "shasum": "" 265 | }, 266 | "require": { 267 | "php": ">=5.3.3" 268 | }, 269 | "type": "library", 270 | "autoload": { 271 | "classmap": [ 272 | "File/" 273 | ] 274 | }, 275 | "notification-url": "https://packagist.org/downloads/", 276 | "include-path": [ 277 | "" 278 | ], 279 | "license": [ 280 | "BSD-3-Clause" 281 | ], 282 | "authors": [ 283 | { 284 | "name": "Sebastian Bergmann", 285 | "email": "sb@sebastian-bergmann.de", 286 | "role": "lead" 287 | } 288 | ], 289 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 290 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 291 | "keywords": [ 292 | "filesystem", 293 | "iterator" 294 | ], 295 | "support": { 296 | "irc": "irc://irc.freenode.net/phpunit", 297 | "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", 298 | "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.3.4" 299 | }, 300 | "time": "2013-10-10T15:34:57+00:00" 301 | }, 302 | { 303 | "name": "phpunit/php-text-template", 304 | "version": "1.2.0", 305 | "source": { 306 | "type": "git", 307 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 308 | "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" 309 | }, 310 | "dist": { 311 | "type": "zip", 312 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", 313 | "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", 314 | "shasum": "" 315 | }, 316 | "require": { 317 | "php": ">=5.3.3" 318 | }, 319 | "type": "library", 320 | "autoload": { 321 | "classmap": [ 322 | "Text/" 323 | ] 324 | }, 325 | "notification-url": "https://packagist.org/downloads/", 326 | "include-path": [ 327 | "" 328 | ], 329 | "license": [ 330 | "BSD-3-Clause" 331 | ], 332 | "authors": [ 333 | { 334 | "name": "Sebastian Bergmann", 335 | "email": "sb@sebastian-bergmann.de", 336 | "role": "lead" 337 | } 338 | ], 339 | "description": "Simple template engine.", 340 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 341 | "keywords": [ 342 | "template" 343 | ], 344 | "support": { 345 | "irc": "irc://irc.freenode.net/phpunit", 346 | "issues": "https://github.com/sebastianbergmann/php-text-template/issues", 347 | "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.0" 348 | }, 349 | "time": "2014-01-30T17:20:04+00:00" 350 | }, 351 | { 352 | "name": "phpunit/php-timer", 353 | "version": "1.0.5", 354 | "source": { 355 | "type": "git", 356 | "url": "https://github.com/sebastianbergmann/php-timer.git", 357 | "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" 358 | }, 359 | "dist": { 360 | "type": "zip", 361 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", 362 | "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", 363 | "shasum": "" 364 | }, 365 | "require": { 366 | "php": ">=5.3.3" 367 | }, 368 | "type": "library", 369 | "autoload": { 370 | "classmap": [ 371 | "PHP/" 372 | ] 373 | }, 374 | "notification-url": "https://packagist.org/downloads/", 375 | "include-path": [ 376 | "" 377 | ], 378 | "license": [ 379 | "BSD-3-Clause" 380 | ], 381 | "authors": [ 382 | { 383 | "name": "Sebastian Bergmann", 384 | "email": "sb@sebastian-bergmann.de", 385 | "role": "lead" 386 | } 387 | ], 388 | "description": "Utility class for timing", 389 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 390 | "keywords": [ 391 | "timer" 392 | ], 393 | "support": { 394 | "irc": "irc://irc.freenode.net/phpunit", 395 | "issues": "https://github.com/sebastianbergmann/php-timer/issues", 396 | "source": "https://github.com/sebastianbergmann/php-timer/tree/1.0.5" 397 | }, 398 | "time": "2013-08-02T07:42:54+00:00" 399 | }, 400 | { 401 | "name": "phpunit/php-token-stream", 402 | "version": "1.4.0", 403 | "source": { 404 | "type": "git", 405 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 406 | "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74" 407 | }, 408 | "dist": { 409 | "type": "zip", 410 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db32c18eba00b121c145575fcbcd4d4d24e6db74", 411 | "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74", 412 | "shasum": "" 413 | }, 414 | "require": { 415 | "ext-tokenizer": "*", 416 | "php": ">=5.3.3" 417 | }, 418 | "require-dev": { 419 | "phpunit/phpunit": "~4.2" 420 | }, 421 | "type": "library", 422 | "extra": { 423 | "branch-alias": { 424 | "dev-master": "1.4-dev" 425 | } 426 | }, 427 | "autoload": { 428 | "classmap": [ 429 | "src/" 430 | ] 431 | }, 432 | "notification-url": "https://packagist.org/downloads/", 433 | "license": [ 434 | "BSD-3-Clause" 435 | ], 436 | "authors": [ 437 | { 438 | "name": "Sebastian Bergmann", 439 | "email": "sebastian@phpunit.de" 440 | } 441 | ], 442 | "description": "Wrapper around PHP's tokenizer extension.", 443 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 444 | "keywords": [ 445 | "tokenizer" 446 | ], 447 | "support": { 448 | "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", 449 | "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" 450 | }, 451 | "abandoned": true, 452 | "time": "2015-01-17T09:51:32+00:00" 453 | }, 454 | { 455 | "name": "phpunit/phpunit", 456 | "version": "4.5.1", 457 | "source": { 458 | "type": "git", 459 | "url": "https://github.com/sebastianbergmann/phpunit.git", 460 | "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4" 461 | }, 462 | "dist": { 463 | "type": "zip", 464 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4", 465 | "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4", 466 | "shasum": "" 467 | }, 468 | "require": { 469 | "ext-dom": "*", 470 | "ext-json": "*", 471 | "ext-pcre": "*", 472 | "ext-reflection": "*", 473 | "ext-spl": "*", 474 | "php": ">=5.3.3", 475 | "phpspec/prophecy": "~1.3,>=1.3.1", 476 | "phpunit/php-code-coverage": "~2.0,>=2.0.11", 477 | "phpunit/php-file-iterator": "~1.3.2", 478 | "phpunit/php-text-template": "~1.2", 479 | "phpunit/php-timer": "~1.0.2", 480 | "phpunit/phpunit-mock-objects": "~2.3", 481 | "sebastian/comparator": "~1.1", 482 | "sebastian/diff": "~1.1", 483 | "sebastian/environment": "~1.2", 484 | "sebastian/exporter": "~1.2", 485 | "sebastian/global-state": "~1.0", 486 | "sebastian/version": "~1.0", 487 | "symfony/yaml": "~2.0" 488 | }, 489 | "suggest": { 490 | "phpunit/php-invoker": "~1.1" 491 | }, 492 | "bin": [ 493 | "phpunit" 494 | ], 495 | "type": "library", 496 | "extra": { 497 | "branch-alias": { 498 | "dev-master": "4.5.x-dev" 499 | } 500 | }, 501 | "autoload": { 502 | "classmap": [ 503 | "src/" 504 | ] 505 | }, 506 | "notification-url": "https://packagist.org/downloads/", 507 | "license": [ 508 | "BSD-3-Clause" 509 | ], 510 | "authors": [ 511 | { 512 | "name": "Sebastian Bergmann", 513 | "email": "sebastian@phpunit.de", 514 | "role": "lead" 515 | } 516 | ], 517 | "description": "The PHP Unit Testing framework.", 518 | "homepage": "https://phpunit.de/", 519 | "keywords": [ 520 | "phpunit", 521 | "testing", 522 | "xunit" 523 | ], 524 | "support": { 525 | "irc": "irc://irc.freenode.net/phpunit", 526 | "issues": "https://github.com/sebastianbergmann/phpunit/issues", 527 | "source": "https://github.com/sebastianbergmann/phpunit/tree/4.5.1" 528 | }, 529 | "time": "2015-03-29T09:24:05+00:00" 530 | }, 531 | { 532 | "name": "phpunit/phpunit-mock-objects", 533 | "version": "2.3.1", 534 | "source": { 535 | "type": "git", 536 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 537 | "reference": "74ffb87f527f24616f72460e54b595f508dccb5c" 538 | }, 539 | "dist": { 540 | "type": "zip", 541 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/74ffb87f527f24616f72460e54b595f508dccb5c", 542 | "reference": "74ffb87f527f24616f72460e54b595f508dccb5c", 543 | "shasum": "" 544 | }, 545 | "require": { 546 | "doctrine/instantiator": "~1.0,>=1.0.2", 547 | "php": ">=5.3.3", 548 | "phpunit/php-text-template": "~1.2" 549 | }, 550 | "require-dev": { 551 | "phpunit/phpunit": "~4.4" 552 | }, 553 | "suggest": { 554 | "ext-soap": "*" 555 | }, 556 | "type": "library", 557 | "extra": { 558 | "branch-alias": { 559 | "dev-master": "2.3.x-dev" 560 | } 561 | }, 562 | "autoload": { 563 | "classmap": [ 564 | "src/" 565 | ] 566 | }, 567 | "notification-url": "https://packagist.org/downloads/", 568 | "license": [ 569 | "BSD-3-Clause" 570 | ], 571 | "authors": [ 572 | { 573 | "name": "Sebastian Bergmann", 574 | "email": "sb@sebastian-bergmann.de", 575 | "role": "lead" 576 | } 577 | ], 578 | "description": "Mock Object library for PHPUnit", 579 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 580 | "keywords": [ 581 | "mock", 582 | "xunit" 583 | ], 584 | "support": { 585 | "irc": "irc://irc.freenode.net/phpunit", 586 | "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", 587 | "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/2.3.1" 588 | }, 589 | "abandoned": true, 590 | "time": "2015-04-02T05:36:41+00:00" 591 | }, 592 | { 593 | "name": "sebastian/comparator", 594 | "version": "1.1.1", 595 | "source": { 596 | "type": "git", 597 | "url": "https://github.com/sebastianbergmann/comparator.git", 598 | "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" 599 | }, 600 | "dist": { 601 | "type": "zip", 602 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", 603 | "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", 604 | "shasum": "" 605 | }, 606 | "require": { 607 | "php": ">=5.3.3", 608 | "sebastian/diff": "~1.2", 609 | "sebastian/exporter": "~1.2" 610 | }, 611 | "require-dev": { 612 | "phpunit/phpunit": "~4.4" 613 | }, 614 | "type": "library", 615 | "extra": { 616 | "branch-alias": { 617 | "dev-master": "1.1.x-dev" 618 | } 619 | }, 620 | "autoload": { 621 | "classmap": [ 622 | "src/" 623 | ] 624 | }, 625 | "notification-url": "https://packagist.org/downloads/", 626 | "license": [ 627 | "BSD-3-Clause" 628 | ], 629 | "authors": [ 630 | { 631 | "name": "Jeff Welch", 632 | "email": "whatthejeff@gmail.com" 633 | }, 634 | { 635 | "name": "Volker Dusch", 636 | "email": "github@wallbash.com" 637 | }, 638 | { 639 | "name": "Bernhard Schussek", 640 | "email": "bschussek@2bepublished.at" 641 | }, 642 | { 643 | "name": "Sebastian Bergmann", 644 | "email": "sebastian@phpunit.de" 645 | } 646 | ], 647 | "description": "Provides the functionality to compare PHP values for equality", 648 | "homepage": "http://www.github.com/sebastianbergmann/comparator", 649 | "keywords": [ 650 | "comparator", 651 | "compare", 652 | "equality" 653 | ], 654 | "support": { 655 | "issues": "https://github.com/sebastianbergmann/comparator/issues", 656 | "source": "https://github.com/sebastianbergmann/comparator/tree/1.1.1" 657 | }, 658 | "time": "2015-01-29T16:28:08+00:00" 659 | }, 660 | { 661 | "name": "sebastian/diff", 662 | "version": "1.2.0", 663 | "source": { 664 | "type": "git", 665 | "url": "https://github.com/sebastianbergmann/diff.git", 666 | "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" 667 | }, 668 | "dist": { 669 | "type": "zip", 670 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", 671 | "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", 672 | "shasum": "" 673 | }, 674 | "require": { 675 | "php": ">=5.3.3" 676 | }, 677 | "require-dev": { 678 | "phpunit/phpunit": "~4.2" 679 | }, 680 | "type": "library", 681 | "extra": { 682 | "branch-alias": { 683 | "dev-master": "1.2-dev" 684 | } 685 | }, 686 | "autoload": { 687 | "classmap": [ 688 | "src/" 689 | ] 690 | }, 691 | "notification-url": "https://packagist.org/downloads/", 692 | "license": [ 693 | "BSD-3-Clause" 694 | ], 695 | "authors": [ 696 | { 697 | "name": "Kore Nordmann", 698 | "email": "mail@kore-nordmann.de" 699 | }, 700 | { 701 | "name": "Sebastian Bergmann", 702 | "email": "sebastian@phpunit.de" 703 | } 704 | ], 705 | "description": "Diff implementation", 706 | "homepage": "http://www.github.com/sebastianbergmann/diff", 707 | "keywords": [ 708 | "diff" 709 | ], 710 | "support": { 711 | "issues": "https://github.com/sebastianbergmann/diff/issues", 712 | "source": "https://github.com/sebastianbergmann/diff/tree/master" 713 | }, 714 | "time": "2014-08-15T10:29:00+00:00" 715 | }, 716 | { 717 | "name": "sebastian/environment", 718 | "version": "1.2.1", 719 | "source": { 720 | "type": "git", 721 | "url": "https://github.com/sebastianbergmann/environment.git", 722 | "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7" 723 | }, 724 | "dist": { 725 | "type": "zip", 726 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7", 727 | "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7", 728 | "shasum": "" 729 | }, 730 | "require": { 731 | "php": ">=5.3.3" 732 | }, 733 | "require-dev": { 734 | "phpunit/phpunit": "~4.3" 735 | }, 736 | "type": "library", 737 | "extra": { 738 | "branch-alias": { 739 | "dev-master": "1.2.x-dev" 740 | } 741 | }, 742 | "autoload": { 743 | "classmap": [ 744 | "src/" 745 | ] 746 | }, 747 | "notification-url": "https://packagist.org/downloads/", 748 | "license": [ 749 | "BSD-3-Clause" 750 | ], 751 | "authors": [ 752 | { 753 | "name": "Sebastian Bergmann", 754 | "email": "sebastian@phpunit.de" 755 | } 756 | ], 757 | "description": "Provides functionality to handle HHVM/PHP environments", 758 | "homepage": "http://www.github.com/sebastianbergmann/environment", 759 | "keywords": [ 760 | "Xdebug", 761 | "environment", 762 | "hhvm" 763 | ], 764 | "support": { 765 | "issues": "https://github.com/sebastianbergmann/environment/issues", 766 | "source": "https://github.com/sebastianbergmann/environment/tree/master" 767 | }, 768 | "time": "2014-10-25T08:00:45+00:00" 769 | }, 770 | { 771 | "name": "sebastian/exporter", 772 | "version": "1.2.0", 773 | "source": { 774 | "type": "git", 775 | "url": "https://github.com/sebastianbergmann/exporter.git", 776 | "reference": "84839970d05254c73cde183a721c7af13aede943" 777 | }, 778 | "dist": { 779 | "type": "zip", 780 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", 781 | "reference": "84839970d05254c73cde183a721c7af13aede943", 782 | "shasum": "" 783 | }, 784 | "require": { 785 | "php": ">=5.3.3", 786 | "sebastian/recursion-context": "~1.0" 787 | }, 788 | "require-dev": { 789 | "phpunit/phpunit": "~4.4" 790 | }, 791 | "type": "library", 792 | "extra": { 793 | "branch-alias": { 794 | "dev-master": "1.2.x-dev" 795 | } 796 | }, 797 | "autoload": { 798 | "classmap": [ 799 | "src/" 800 | ] 801 | }, 802 | "notification-url": "https://packagist.org/downloads/", 803 | "license": [ 804 | "BSD-3-Clause" 805 | ], 806 | "authors": [ 807 | { 808 | "name": "Jeff Welch", 809 | "email": "whatthejeff@gmail.com" 810 | }, 811 | { 812 | "name": "Volker Dusch", 813 | "email": "github@wallbash.com" 814 | }, 815 | { 816 | "name": "Bernhard Schussek", 817 | "email": "bschussek@2bepublished.at" 818 | }, 819 | { 820 | "name": "Sebastian Bergmann", 821 | "email": "sebastian@phpunit.de" 822 | }, 823 | { 824 | "name": "Adam Harvey", 825 | "email": "aharvey@php.net" 826 | } 827 | ], 828 | "description": "Provides the functionality to export PHP variables for visualization", 829 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 830 | "keywords": [ 831 | "export", 832 | "exporter" 833 | ], 834 | "support": { 835 | "issues": "https://github.com/sebastianbergmann/exporter/issues", 836 | "source": "https://github.com/sebastianbergmann/exporter/tree/master" 837 | }, 838 | "time": "2015-01-27T07:23:06+00:00" 839 | }, 840 | { 841 | "name": "sebastian/global-state", 842 | "version": "1.0.0", 843 | "source": { 844 | "type": "git", 845 | "url": "https://github.com/sebastianbergmann/global-state.git", 846 | "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" 847 | }, 848 | "dist": { 849 | "type": "zip", 850 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", 851 | "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", 852 | "shasum": "" 853 | }, 854 | "require": { 855 | "php": ">=5.3.3" 856 | }, 857 | "require-dev": { 858 | "phpunit/phpunit": "~4.2" 859 | }, 860 | "suggest": { 861 | "ext-uopz": "*" 862 | }, 863 | "type": "library", 864 | "extra": { 865 | "branch-alias": { 866 | "dev-master": "1.0-dev" 867 | } 868 | }, 869 | "autoload": { 870 | "classmap": [ 871 | "src/" 872 | ] 873 | }, 874 | "notification-url": "https://packagist.org/downloads/", 875 | "license": [ 876 | "BSD-3-Clause" 877 | ], 878 | "authors": [ 879 | { 880 | "name": "Sebastian Bergmann", 881 | "email": "sebastian@phpunit.de" 882 | } 883 | ], 884 | "description": "Snapshotting of global state", 885 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 886 | "keywords": [ 887 | "global state" 888 | ], 889 | "support": { 890 | "issues": "https://github.com/sebastianbergmann/global-state/issues", 891 | "source": "https://github.com/sebastianbergmann/global-state/tree/master" 892 | }, 893 | "time": "2014-10-06T09:23:50+00:00" 894 | }, 895 | { 896 | "name": "sebastian/recursion-context", 897 | "version": "1.0.0", 898 | "source": { 899 | "type": "git", 900 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 901 | "reference": "3989662bbb30a29d20d9faa04a846af79b276252" 902 | }, 903 | "dist": { 904 | "type": "zip", 905 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", 906 | "reference": "3989662bbb30a29d20d9faa04a846af79b276252", 907 | "shasum": "" 908 | }, 909 | "require": { 910 | "php": ">=5.3.3" 911 | }, 912 | "require-dev": { 913 | "phpunit/phpunit": "~4.4" 914 | }, 915 | "type": "library", 916 | "extra": { 917 | "branch-alias": { 918 | "dev-master": "1.0.x-dev" 919 | } 920 | }, 921 | "autoload": { 922 | "classmap": [ 923 | "src/" 924 | ] 925 | }, 926 | "notification-url": "https://packagist.org/downloads/", 927 | "license": [ 928 | "BSD-3-Clause" 929 | ], 930 | "authors": [ 931 | { 932 | "name": "Jeff Welch", 933 | "email": "whatthejeff@gmail.com" 934 | }, 935 | { 936 | "name": "Sebastian Bergmann", 937 | "email": "sebastian@phpunit.de" 938 | }, 939 | { 940 | "name": "Adam Harvey", 941 | "email": "aharvey@php.net" 942 | } 943 | ], 944 | "description": "Provides functionality to recursively process PHP variables", 945 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 946 | "support": { 947 | "issues": "https://github.com/sebastianbergmann/recursion-context/issues", 948 | "source": "https://github.com/sebastianbergmann/recursion-context/tree/1.0.0" 949 | }, 950 | "time": "2015-01-24T09:48:32+00:00" 951 | }, 952 | { 953 | "name": "sebastian/version", 954 | "version": "1.0.4", 955 | "source": { 956 | "type": "git", 957 | "url": "https://github.com/sebastianbergmann/version.git", 958 | "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b" 959 | }, 960 | "dist": { 961 | "type": "zip", 962 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b", 963 | "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b", 964 | "shasum": "" 965 | }, 966 | "type": "library", 967 | "autoload": { 968 | "classmap": [ 969 | "src/" 970 | ] 971 | }, 972 | "notification-url": "https://packagist.org/downloads/", 973 | "license": [ 974 | "BSD-3-Clause" 975 | ], 976 | "authors": [ 977 | { 978 | "name": "Sebastian Bergmann", 979 | "email": "sebastian@phpunit.de", 980 | "role": "lead" 981 | } 982 | ], 983 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 984 | "homepage": "https://github.com/sebastianbergmann/version", 985 | "support": { 986 | "issues": "https://github.com/sebastianbergmann/version/issues", 987 | "source": "https://github.com/sebastianbergmann/version/tree/master" 988 | }, 989 | "time": "2014-12-15T14:25:24+00:00" 990 | }, 991 | { 992 | "name": "symfony/yaml", 993 | "version": "v2.6.6", 994 | "target-dir": "Symfony/Component/Yaml", 995 | "source": { 996 | "type": "git", 997 | "url": "https://github.com/symfony/Yaml.git", 998 | "reference": "174f009ed36379a801109955fc5a71a49fe62dd4" 999 | }, 1000 | "dist": { 1001 | "type": "zip", 1002 | "url": "https://api.github.com/repos/symfony/Yaml/zipball/174f009ed36379a801109955fc5a71a49fe62dd4", 1003 | "reference": "174f009ed36379a801109955fc5a71a49fe62dd4", 1004 | "shasum": "" 1005 | }, 1006 | "require": { 1007 | "php": ">=5.3.3" 1008 | }, 1009 | "require-dev": { 1010 | "symfony/phpunit-bridge": "~2.7" 1011 | }, 1012 | "type": "library", 1013 | "extra": { 1014 | "branch-alias": { 1015 | "dev-master": "2.6-dev" 1016 | } 1017 | }, 1018 | "autoload": { 1019 | "psr-0": { 1020 | "Symfony\\Component\\Yaml\\": "" 1021 | } 1022 | }, 1023 | "notification-url": "https://packagist.org/downloads/", 1024 | "license": [ 1025 | "MIT" 1026 | ], 1027 | "authors": [ 1028 | { 1029 | "name": "Symfony Community", 1030 | "homepage": "http://symfony.com/contributors" 1031 | }, 1032 | { 1033 | "name": "Fabien Potencier", 1034 | "email": "fabien@symfony.com" 1035 | } 1036 | ], 1037 | "description": "Symfony Yaml Component", 1038 | "homepage": "http://symfony.com", 1039 | "support": { 1040 | "source": "https://github.com/symfony/Yaml/tree/2.6" 1041 | }, 1042 | "time": "2015-03-30T15:54:10+00:00" 1043 | } 1044 | ], 1045 | "aliases": [], 1046 | "minimum-stability": "stable", 1047 | "stability-flags": [], 1048 | "prefer-stable": false, 1049 | "prefer-lowest": false, 1050 | "platform": { 1051 | "php": ">=5.4.0", 1052 | "ext-json": "*", 1053 | "ext-mbstring": "*" 1054 | }, 1055 | "platform-dev": [], 1056 | "plugin-api-version": "2.3.0" 1057 | } 1058 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | speaks('the magic quotes they are coming for me I live only days'); 19 | echo "

$prophecy

"; 20 | #echo "

" . mb_strlen($prophecy) . "

"; 21 | 22 | ?> 23 | 24 | -------------------------------------------------------------------------------- /src/Mood.php: -------------------------------------------------------------------------------- 1 | mood = $mood; 12 | } 13 | 14 | public static function enraged() 15 | { 16 | return new Mood('enraged'); 17 | } 18 | 19 | public static function normal() 20 | { 21 | return new Mood('normal'); 22 | } 23 | 24 | public static function soothed() 25 | { 26 | return new Mood('soothed'); 27 | } 28 | 29 | public static function twitter() 30 | { 31 | return new Mood('twitter'); 32 | } 33 | 34 | public function __toString() 35 | { 36 | return $this->mood; 37 | } 38 | 39 | public function getDisturbenceLevels() 40 | { 41 | switch($this->mood) { 42 | case 'soothed': 43 | return [ 44 | 'up' => rand(0, 8), 45 | 'down' => rand(0, 8), 46 | 'mid' => rand(0, 2), 47 | ]; 48 | break; 49 | 50 | case 'enraged': 51 | return [ 52 | 'up' => rand(0, 16) + 3, 53 | 'down' => rand(0, 64) + 3, 54 | 'mid' => rand(0, 4) + 1, 55 | ]; 56 | break; 57 | 58 | case 'twitter': 59 | return [ 60 | 'up' => rand(0, 1), 61 | 'down' => rand(0, 1), 62 | 'mid' => rand(0, 0), 63 | ]; 64 | break; 65 | 66 | default: 67 | return [ 68 | 'up' => rand(0, 8) + 1, 69 | 'down' => rand(0, 6) / 2, 70 | 'mid' => rand(0, 2) + 1, 71 | ]; 72 | break; 73 | } 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /src/Soul.php: -------------------------------------------------------------------------------- 1 | soul = [ 12 | 'up' => [ 13 | 0x030d, 0x030e, 0x0304, 0x0305, 14 | 0x033f, 0x0311, 0x0306, 0x0310, 15 | 0x0352, 0x0357, 0x0351, 0x0307, 16 | 0x0308, 0x030a, 0x0342, 0x0343, 17 | 0x0344, 0x034a, 0x034b, 0x034c, 18 | 0x0303, 0x0302, 0x030c, 0x0350, 19 | 0x0300, 0x0301, 0x030b, 0x030f, 20 | 0x0312, 0x0313, 0x0314, 0x033d, 21 | 0x0309, 0x0363, 0x0364, 0x0365, 22 | 0x0366, 0x0367, 0x0368, 0x0369, 23 | 0x036a, 0x036b, 0x036c, 0x036d, 24 | 0x036e, 0x036f, 0x033e, 0x035b, 25 | 0x0346, 0x031a, 26 | ], 27 | 'down' => [ 28 | 0x0316, 0x0317, 0x0318, 0x0319, 29 | 0x031c, 0x031d, 0x031e, 0x031f, 30 | 0x0320, 0x0324, 0x0325, 0x0326, 31 | 0x0329, 0x032a, 0x032b, 0x032c, 32 | 0x032d, 0x032e, 0x032f, 0x0330, 33 | 0x0331, 0x0332, 0x0333, 0x0339, 34 | 0x033a, 0x033b, 0x033c, 0x0345, 35 | 0x0347, 0x0348, 0x0349, 0x034d, 36 | 0x034e, 0x0353, 0x0354, 0x0355, 37 | 0x0356, 0x0359, 0x035a, 0x0323, 38 | ], 39 | 'mid' => [ 40 | 0x0315, 0x031b, 0x0340, 0x0341, 41 | 0x0358, 0x0321, 0x0322, 0x0327, 42 | 0x0328, 0x0334, 0x0335, 0x0336, 43 | 0x034f, 0x035c, 0x035d, 0x035e, 44 | 0x035f, 0x0360, 0x0362, 0x0338, 45 | 0x0337, 0x0361, 0x0489, 46 | ] 47 | ]; 48 | 49 | // Convert codes to unicode. 50 | array_walk_recursive($this->soul, function(&$element) { 51 | $element = json_decode('"\u'.bin2hex(pack('n', $element)).'"'); 52 | }); 53 | } 54 | 55 | public function harvest() 56 | { 57 | return $this->soul; 58 | } 59 | 60 | public function contains($character) 61 | { 62 | $bool = false; 63 | 64 | foreach ($this->flatten($this->soul) as $c) { 65 | $bool = ($c == $character); 66 | } 67 | 68 | return $bool; 69 | } 70 | 71 | public function unleash() 72 | { 73 | return $this->flatten($this->soul); 74 | } 75 | 76 | private function flatten($array) 77 | { 78 | $return = []; 79 | array_walk_recursive($array, function($x) use (&$return) { $return[] = $x; }); 80 | 81 | return $return; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Zalgo.php: -------------------------------------------------------------------------------- 1 | soul = $soul; 25 | $this->mood = $mood; 26 | } 27 | 28 | public function speaks($phrase = 'You have awakened me too soon!') 29 | { 30 | $this->clearMind(); 31 | 32 | foreach (str_split($phrase) as $stutter) { 33 | // Nobody could possibly understand Zalgo's soul, so we must 34 | // make sure that we don't let him know. 35 | if ($this->soul->contains($stutter)) { 36 | continue; 37 | } 38 | 39 | $this->utter($stutter); 40 | $this->disturb(); 41 | } 42 | 43 | if ($this->mood == Mood::twitter()) { 44 | $this->whisper = $this->biteTongueOnTwitter($phrase); 45 | } 46 | 47 | return $this->whisper; 48 | } 49 | 50 | /** 51 | * Zalgo decides to soothe a prophecy to return the original 52 | * phrase back to caller. 53 | * 54 | * @param string $prophecy Zalgo-text! 55 | * 56 | * @return string soothed prophecy text. 57 | */ 58 | public function soothe($prophecy) 59 | { 60 | return str_replace($this->soul->unleash(), '', $prophecy); 61 | } 62 | 63 | /** 64 | * Hacky implementation detail to clamp Zalgo text to 140 characters 65 | * when it is in a mood for Twitter. 66 | * 67 | * @param $phrase 68 | * 69 | * @return string 70 | */ 71 | protected function biteTongueOnTwitter($phrase) 72 | { 73 | if (mb_strlen($this->whisper) <= 140) { 74 | return $this->whisper; 75 | } 76 | 77 | /** 78 | * We need to split by words and start removing characters from middle of word until we 79 | * get the worst-case length under 140. This will leave the word readable, hopefully. 80 | * 81 | * zalgo_len = phrase_len * (1 + 2 + 2) 82 | * pref_zalgo_len = (phrase_len - some_num_to_remove) * (1 + 2 + 2) 83 | * 140 = (35 - X) * 5 84 | * 140 / 5 = 35 - X 85 | * X = 35 - (140 / 5) = 7 86 | */ 87 | 88 | $phraseLength = mb_strlen($phrase); 89 | $numberToRemove = (int) ceil(abs($phraseLength - (140 / 3))); 90 | $removed = 0; 91 | 92 | $words = preg_split('/\s+/', $phrase); 93 | 94 | while ($removed < $numberToRemove) { 95 | foreach ($words as $index => $word) { 96 | if (mb_strlen($words[$index]) <= 3) { 97 | $removed++; 98 | continue; 99 | } 100 | 101 | // Remove a letter, at random, from the word. 102 | $words[$index] = substr_replace($words[$index], '', rand(1, mb_strlen($words[$index]) - 2), 1); 103 | $removed++; 104 | 105 | if ($removed == $numberToRemove) { 106 | break; 107 | } 108 | } 109 | } 110 | 111 | return $this->speaks(implode(' ', $words)); 112 | } 113 | 114 | protected function utter($stutter) 115 | { 116 | $this->whisper .= $stutter; 117 | } 118 | 119 | protected function clearMind() 120 | { 121 | $this->whisper = ''; 122 | } 123 | 124 | protected function disturb() 125 | { 126 | $soul = $this->soul->harvest(); 127 | $levels = $this->mood->getDisturbenceLevels(); 128 | 129 | foreach (array_keys($levels) as $direction) { 130 | for ($i = 0; $i < $levels[$direction]; $i++) { 131 | $this->whisper .= $soul[$direction][rand(0, count($soul[$direction]) - 1)]; 132 | } 133 | } 134 | } 135 | } 136 | --------------------------------------------------------------------------------