1
0
mirror of https://github.com/restoreddev/phpapprentice.git synced 2025-08-03 05:18:11 +02:00

Merge pull request #32 from restoreddev/develop

Small changes in preparation for adding new sections
This commit is contained in:
Andrew
2019-01-12 15:42:55 -06:00
committed by GitHub
21 changed files with 31 additions and 31 deletions

View File

@@ -44,116 +44,116 @@ return [
* *
*/ */
'pages' => [ 'pages' => [
Page::create('index', 'index.phtml'), Page::create('index', null, [], 'index.phtml'),
Page::create('installing-php', 'installing-php.phtml'), Page::create('installing-php', null, [], 'installing-php.phtml'),
Page::create('credits', 'credits.phtml'), Page::create('credits', null, [], 'credits.phtml'),
Page::create('404', '404.phtml'), Page::create('404', null, [], '404.phtml'),
Page::create('basics', null, 'basics.md', [ Page::create('basics', 'basics/01-basics.md', [
'title' => 'Basics', 'title' => 'Basics',
'subtitle' => 'Getting started', 'subtitle' => 'Getting started',
'next' => 'variables', 'next' => 'variables',
]), ]),
Page::create('variables', null, 'variables.md', [ Page::create('variables', 'basics/02-variables.md', [
'title' => 'Variables', 'title' => 'Variables',
'subtitle' => 'The building blocks of PHP', 'subtitle' => 'The building blocks of PHP',
'previous' => 'basics', 'previous' => 'basics',
'next' => 'arithmetic', 'next' => 'arithmetic',
]), ]),
Page::create('arithmetic', null, 'arithmetic.md', [ Page::create('arithmetic', 'basics/03-arithmetic.md', [
'title' => 'Arithmetic', 'title' => 'Arithmetic',
'subtitle' => 'Doing math like a pro', 'subtitle' => 'Doing math like a pro',
'previous' => 'variables', 'previous' => 'variables',
'next' => 'strings', 'next' => 'strings',
]), ]),
Page::create('strings', null, 'strings.md', [ Page::create('strings', 'basics/04-strings.md', [
'title' => 'Strings', 'title' => 'Strings',
'subtitle' => 'Working with text', 'subtitle' => 'Working with text',
'previous' => 'arithmetic', 'previous' => 'arithmetic',
'next' => 'comparisons', 'next' => 'comparisons',
]), ]),
Page::create('comparisons', null, 'comparisons.md', [ Page::create('comparisons', 'basics/05-comparisons.md', [
'title' => 'Comparisons', 'title' => 'Comparisons',
'subtitle' => 'Equality checking', 'subtitle' => 'Equality checking',
'previous' => 'strings', 'previous' => 'strings',
'next' => 'boolean-logic', 'next' => 'boolean-logic',
]), ]),
Page::create('boolean-logic', null, 'boolean-logic.md', [ Page::create('boolean-logic', 'basics/06-boolean-logic.md', [
'title' => 'Boolean Logic', 'title' => 'Boolean Logic',
'subtitle' => 'Is it a yes or a no?', 'subtitle' => 'Is it a yes or a no?',
'previous' => 'comparisons', 'previous' => 'comparisons',
'next' => 'conditionals', 'next' => 'conditionals',
]), ]),
Page::create('conditionals', null, 'conditionals.md', [ Page::create('conditionals', 'basics/07-conditionals.md', [
'title' => 'Conditionals', 'title' => 'Conditionals',
'subtitle' => 'Checking the if before the what', 'subtitle' => 'Checking the if before the what',
'previous' => 'boolean-logic', 'previous' => 'boolean-logic',
'next' => 'loops', 'next' => 'loops',
]), ]),
Page::create('loops', null, 'loops.md', [ Page::create('loops', 'basics/08-loops.md', [
'title' => 'Loops', 'title' => 'Loops',
'subtitle' => 'Increase your repetitions', 'subtitle' => 'Increase your repetitions',
'previous' => 'conditionals', 'previous' => 'conditionals',
'next' => 'arrays', 'next' => 'arrays',
]), ]),
Page::create('arrays', null, 'arrays.md', [ Page::create('arrays', 'basics/09-arrays.md', [
'title' => 'Arrays', 'title' => 'Arrays',
'subtitle' => 'Time to make a list', 'subtitle' => 'Time to make a list',
'previous' => 'loops', 'previous' => 'loops',
'next' => 'functions', 'next' => 'functions',
]), ]),
Page::create('functions', null, 'functions.md', [ Page::create('functions', 'basics/10-functions.md', [
'title' => 'Functions', 'title' => 'Functions',
'subtitle' => 'Reusable code', 'subtitle' => 'Reusable code',
'previous' => 'arrays', 'previous' => 'arrays',
'next' => 'classes', 'next' => 'classes',
]), ]),
Page::create('classes', null, 'classes.md', [ Page::create('classes', 'basics/11-classes.md', [
'title' => 'Classes', 'title' => 'Classes',
'subtitle' => 'Object-oriented programming', 'subtitle' => 'Object-oriented programming',
'previous' => 'functions', 'previous' => 'functions',
'next' => 'classes-inheritance', 'next' => 'classes-inheritance',
]), ]),
Page::create('classes-inheritance', null, 'classes-inheritance.md', [ Page::create('classes-inheritance', 'basics/12-classes-inheritance.md', [
'title' => 'Classes: Inheritance', 'title' => 'Classes: Inheritance',
'subtitle' => 'Extend your objects', 'subtitle' => 'Extend your objects',
'previous' => 'classes', 'previous' => 'classes',
'next' => 'classes-visibility', 'next' => 'classes-visibility',
]), ]),
Page::create('classes-visibility', null, 'classes-visibility.md', [ Page::create('classes-visibility', 'basics/13-classes-visibility.md', [
'title' => 'Classes: Visibility', 'title' => 'Classes: Visibility',
'subtitle' => 'Privatizing your objects', 'subtitle' => 'Privatizing your objects',
'previous' => 'classes-inheritance', 'previous' => 'classes-inheritance',
'next' => 'classes-constructor', 'next' => 'classes-constructor',
]), ]),
Page::create('classes-constructor', null, 'classes-constructor.md', [ Page::create('classes-constructor', 'basics/14-classes-constructor.md', [
'title' => 'Classes: Constructor', 'title' => 'Classes: Constructor',
'subtitle' => 'Construct your objects', 'subtitle' => 'Construct your objects',
'previous' => 'classes-visibility', 'previous' => 'classes-visibility',
'next' => 'static', 'next' => 'static',
]), ]),
Page::create('static', null, 'static.md', [ Page::create('static', 'basics/15-static.md', [
'title' => 'Static', 'title' => 'Static',
'subtitle' => 'Class properties and methods', 'subtitle' => 'Class properties and methods',
'previous' => 'classes-constructor', 'previous' => 'classes-constructor',
'next' => 'interfaces', 'next' => 'interfaces',
]), ]),
Page::create('interfaces', null, 'interfaces.md', [ Page::create('interfaces', 'basics/16-interfaces.md', [
'title' => 'Interfaces', 'title' => 'Interfaces',
'subtitle' => 'Writing code contracts', 'subtitle' => 'Writing code contracts',
'previous' => 'static', 'previous' => 'static',
'next' => 'abstract', 'next' => 'abstract',
]), ]),
Page::create('abstract', null, 'abstract.md', [ Page::create('abstract', 'basics/17-abstract.md', [
'title' => 'Abstract Classes', 'title' => 'Abstract Classes',
'subtitle' => 'Inheriting an interface', 'subtitle' => 'Inheriting an interface',
'previous' => 'interfaces', 'previous' => 'interfaces',
'next' => 'exceptions', 'next' => 'exceptions',
]), ]),
Page::create('exceptions', null, 'exceptions.md', [ Page::create('exceptions', 'basics/18-exceptions.md', [
'title' => 'Exceptions', 'title' => 'Exceptions',
'subtitle' => 'Throwing errors', 'subtitle' => 'Throwing errors',
'previous' => 'abstract', 'previous' => 'abstract',
'next' => '', 'next' => 'web-http',
]), ]),
], ],
]; ];

View File

@@ -47,14 +47,14 @@ class Page
*/ */
public function __construct( public function __construct(
string $name, string $name,
?string $template = null,
?string $chapter = null, ?string $chapter = null,
?array $variables = [] ?array $variables = [],
?string $template = null
) { ) {
$this->name = $name; $this->name = $name;
$this->template = $template;
$this->chapter = $chapter; $this->chapter = $chapter;
$this->variables = $variables; $this->variables = $variables;
$this->template = $template;
} }
/** /**
@@ -68,10 +68,10 @@ class Page
*/ */
public static function create( public static function create(
string $name, string $name,
?string $template = null,
?string $chapter = null, ?string $chapter = null,
?array $variables = [] ?array $variables = [],
?string $template = null
): Page { ): Page {
return new static($name, $template, $chapter, $variables); return new static($name, $chapter, $variables, $template);
} }
} }

View File

@@ -9,8 +9,8 @@ return [
'output_dir' => '/tmp/apprentice_output', 'output_dir' => '/tmp/apprentice_output',
'files_dir' => __DIR__ . '/files', 'files_dir' => __DIR__ . '/files',
'pages' => [ 'pages' => [
Page::create('index', 'index.phtml'), Page::create('index', null, [], 'index.phtml'),
Page::create('test', null, 'test.md', [ Page::create('test', 'test.md', [
'title' => 'Test Title', 'title' => 'Test Title',
'subtitle' => 'Test Subtitle', 'subtitle' => 'Test Subtitle',
'description' => 'Test Description', 'description' => 'Test Description',