Skip to content

Commit bb25933

Browse files
committed
🆙 Update Demo examples
1 parent 25f5db0 commit bb25933

File tree

4 files changed

+53
-22
lines changed

4 files changed

+53
-22
lines changed

demo/Example.php

+2-21
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,7 @@
88
* @since 1.0.0
99
* @author Nelson Martell <[email protected]>
1010
*/
11-
class Example implements IDemo
11+
class Example extends ExampleClass
1212
{
13-
/**
14-
*
15-
* @var string
16-
*/
17-
protected $example = null;
18-
19-
public function __construct($example = 'demo')
20-
{
21-
$this->example = $example;
22-
}
23-
24-
public function isReady()
25-
{
26-
return $this->example !== null;
27-
}
28-
29-
protected function isDemo()
30-
{
31-
return $this->example === 'demo';
32-
}
13+
use ExampleTrait;
3314
}

demo/ExampleClass.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace NelsonMartell\VuePress\Demo;
4+
5+
/**
6+
* Example class.
7+
*
8+
* @since 1.0.0
9+
* @author Nelson Martell <[email protected]>
10+
*/
11+
class ExampleClass implements IDemo
12+
{
13+
/**
14+
*
15+
* @var string
16+
*/
17+
protected $example = null;
18+
19+
public function __construct($example = 'demo')
20+
{
21+
$this->example = $example;
22+
}
23+
24+
public function isReady()
25+
{
26+
return $this->example !== null;
27+
}
28+
29+
final protected function isDemo()
30+
{
31+
return $this->example === 'demo';
32+
}
33+
}

demo/ExampleTrait.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace NelsonMartell\VuePress\Demo;
4+
5+
/**
6+
* Example trait.
7+
*
8+
* @since 1.0.0
9+
* @author Nelson Martell <[email protected]>
10+
*/
11+
trait ExampleTrait
12+
{
13+
protected function explain()
14+
{
15+
return 'Explanation';
16+
}
17+
}

demo/functions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* An example function.
77
*
88
* @param int $index Index.
9-
* @param string|null $name Name.
9+
* @param string|null $title Name.
1010
*
1111
* @return string
1212
*

0 commit comments

Comments
 (0)