Skip to content

Commit 9920009

Browse files
committed
Cleanup
1 parent a181aab commit 9920009

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ This is the core of [LasseRafn/php-initial-avatar-generator](http://github.com/L
33

44
It's framework agnostic, which is different from basically everything else I do, you're welcome.
55

6-
Supports UTF8 (yes.. also emojis.)
6+
Supports UTF8 (yes, also emojis.)
77

88
<p align="center">
99
<a href="https://travis-ci.org/LasseRafn/php-initials"><img src="https://img.shields.io/travis/LasseRafn/php-initials.svg?style=flat-square" alt="Build Status"></a>
@@ -16,32 +16,35 @@ Supports UTF8 (yes.. also emojis.)
1616

1717
## Installation
1818
You just require using composer and you're good to go!
19-
````bash
19+
```bash
2020
composer require lasserafn/php-initials
21-
````
21+
```
22+
2223
Rad, *and long*, package name.. huh? Sorry. I'm not very good with names.
2324

2425
## Usage
2526
As with installation, usage is quite simple. Generating a image is done by running:
26-
````php
27-
echo (string) (new LasseRafn\Initials\Initials('Lasse Rafn')); // Output: LR
28-
echo (new LasseRafn\Initials\Initials)->name('Justine Bieber')->generate(); // Output: JB
29-
echo (new LasseRafn\Initials\Initials('John Christian Doe'))->generate(); // Output: JD
30-
echo (new LasseRafn\Initials\Initials)->generate('Leonardo'); // Output: LE
31-
echo (new LasseRafn\Initials\Initials)->length(1)->generate('Camilla'); // Output: C
32-
echo (new LasseRafn\Initials\Initials)->length(3)->name('Jens Ølsted')->getUrlfriendlyInitials(); // Output: JOL
33-
````
27+
```php
28+
use LasseRafn\Initials\Initials;
29+
30+
echo (new Initials('Lasse Rafn')); // Output: LR
31+
echo (new Initials)->name('Justine Bieber')->generate(); // Output: JB
32+
echo (new Initials('John Christian Doe'))->generate(); // Output: JD
33+
echo (new Initials)->generate('Leonardo'); // Output: LE
34+
echo (new Initials)->length(1)->generate('Camilla'); // Output: C
35+
echo (new Initials)->name('Jens Ølsted')->getUrlfriendlyInitials(); // Output: JO
36+
```
3437

3538
## Supported methods and parameters
3639
### Name (initials) - default: JD
37-
````php
40+
```php
3841
$initials->name('Albert Magnum')->generate();
39-
````
42+
```
4043

4144
### Length - default: 2
42-
````php
45+
```php
4346
$initials->name('Albert Magnum')->length(3)->generate();
44-
````
47+
```
4548

4649
## Requirements
4750
* PHP 5.6, 7.0 or 7.1

tests/InitialGenerationTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,10 @@ public function testInitialsAreGeneratedFromFullname()
5656

5757
$this->assertEquals( 'JOL', $avatar->getUrlfriendlyInitials() );
5858
$this->assertEquals( 3, strlen( $avatar->getUrlfriendlyInitials() ) );
59+
60+
$avatar->length(2)->name( 'Jens Ølsted' );
61+
62+
$this->assertEquals( 'JO', $avatar->getUrlfriendlyInitials() );
63+
$this->assertEquals( 2, strlen( $avatar->getUrlfriendlyInitials() ) );
5964
}
6065
}

0 commit comments

Comments
 (0)