diff --git a/.travis.yml b/.travis.yml
index 59b9baf..fe225ad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,16 @@
language: php
php:
- - 5.6
+ - 7.1
-script:
- - php code-checker/src/code-checker.php
+install:
+ # Install Nette Code Checker
+ - travis_retry composer create-project nette/code-checker temp/code-checker ~2 --no-progress
+ # Install Nette Coding Standard
+ - travis_retry composer create-project nette/coding-standard temp/coding-standard --no-progress
-before_script:
- - travis_retry composer create-project nette/code-checker code-checker --no-interaction
+script:
+ - php temp/code-checker/src/code-checker.php --short-arrays --strict-types
+ - php temp/coding-standard/ecs check . --config temp/coding-standard/coding-standard-php71.neon
sudo: false
diff --git a/Books/composer.json b/Books/composer.json
new file mode 100644
index 0000000..41f22b1
--- /dev/null
+++ b/Books/composer.json
@@ -0,0 +1,9 @@
+{
+ "require": {
+ "php": ">=7.1",
+ "nette/database": "^3.0",
+ "nette/bootstrap": "^3.0",
+ "tracy/tracy": "^2.4"
+ },
+ "minimum-stability": "dev"
+}
diff --git a/Books/demo/config/mysql.neon b/Books/demo/config/mysql.neon
new file mode 100644
index 0000000..2ac672e
--- /dev/null
+++ b/Books/demo/config/mysql.neon
@@ -0,0 +1,7 @@
+parameters:
+ dumpFile: %appDir%/dump/mysql.sql
+
+database:
+ dsn: 'mysql:host=127.0.0.1;dbname=nette_test'
+ user: root
+ password:
diff --git a/Books/demo/config/postgresql.neon b/Books/demo/config/postgresql.neon
new file mode 100644
index 0000000..15a87f5
--- /dev/null
+++ b/Books/demo/config/postgresql.neon
@@ -0,0 +1,7 @@
+parameters:
+ dumpFile: %appDir%/dump/postgresql.sql
+
+database:
+ dsn: 'pgsql:host=127.0.0.1;dbname=nette_test'
+ user: postgres
+ password:
diff --git a/Books/demo/config/sqlite.neon b/Books/demo/config/sqlite.neon
new file mode 100644
index 0000000..abb9cc8
--- /dev/null
+++ b/Books/demo/config/sqlite.neon
@@ -0,0 +1,5 @@
+parameters:
+ dumpFile: %appDir%/dump/sqlite.sql
+
+database:
+ dsn: 'sqlite::memory:'
diff --git a/Books/demo/config/sqlsrv.neon b/Books/demo/config/sqlsrv.neon
new file mode 100644
index 0000000..8ea9a22
--- /dev/null
+++ b/Books/demo/config/sqlsrv.neon
@@ -0,0 +1,7 @@
+parameters:
+ dumpFile: %appDir%/dump/sqlsrv.sql
+
+database:
+ dsn: 'sqlsrv:server=127.0.0.1;database=nette_test'
+ user:
+ password:
diff --git a/Books/demo/demo.php b/Books/demo/demo.php
new file mode 100644
index 0000000..bd6ce65
--- /dev/null
+++ b/Books/demo/demo.php
@@ -0,0 +1,48 @@
+enableTracy(__DIR__ . '/log');
+
+// create DI container
+$configurator->setTempDirectory(__DIR__ . '/temp');
+$configurator->addConfig(__DIR__ . '/config/sqlite.neon'); // for SQLite
+//$configurator->addConfig(__DIR__ . '/config/mysql.neon'); // for MySQL
+//$configurator->addConfig(__DIR__ . '/config/postgresql.neon'); // for PostgreSQL
+//$configurator->addConfig(__DIR__ . '/config/sqlsrv.neon'); // for MS SQL Server
+$container = $configurator->createContainer();
+
+// get database from DI container
+// see https://doc.nette.org/en/di-configuration
+/** @var Nette\Database\Context $database */
+$database = $container->getByType(Nette\Database\Context::class);
+
+// load database dump
+Nette\Database\Helpers::loadFromFile(
+ $database->getConnection(),
+ $container->parameters['dumpFile'] // defined in config file
+);
+
+// lists the author's name for each book and all its tags:
+// see https://doc.nette.org/en/database-explorer
+$books = $database->table('book');
+
+echo PHP_SAPI === 'cli' ? '' : '
';
+
+foreach ($books as $book) {
+ echo "title: {$book->title} \n";
+ echo "written by: {$book->author->name} \n"; // $book->author is row from table 'author'
+
+ echo 'tags: ';
+ foreach ($book->related('book_tag') as $bookTag) {
+ echo $bookTag->tag->name . ', '; // $bookTag->tag is row from table 'tag'
+ }
+ echo "\n\n";
+}
+
+echo PHP_SAPI === 'cli' ? '' : '';
diff --git a/Books/demo/dump/mysql.sql b/Books/demo/dump/mysql.sql
new file mode 100644
index 0000000..b63befe
--- /dev/null
+++ b/Books/demo/dump/mysql.sql
@@ -0,0 +1,93 @@
+SET FOREIGN_KEY_CHECKS = 0;
+
+DROP TABLE IF EXISTS `author`, `book`, `book_tag`, `book_tag_alt`, `note`, `tag`;
+
+
+CREATE TABLE author (
+ id int NOT NULL AUTO_INCREMENT,
+ name varchar(30) NOT NULL,
+ web varchar(100) NOT NULL,
+ born date DEFAULT NULL,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB AUTO_INCREMENT=13;
+
+INSERT INTO author (id, name, web, born) VALUES (11, 'Jakub Vrana', 'http://www.vrana.cz/', NULL);
+INSERT INTO author (id, name, web, born) VALUES (12, 'David Grudl', 'http://davidgrudl.com/', NULL);
+INSERT INTO author (id, name, web, born) VALUES (13, 'Geek', 'http://example.com', NULL);
+
+
+
+CREATE TABLE tag (
+ id int NOT NULL AUTO_INCREMENT,
+ name varchar(20) NOT NULL,
+ PRIMARY KEY (id)
+) ENGINE=InnoDB AUTO_INCREMENT=25;
+
+INSERT INTO tag (id, name) VALUES (21, 'PHP');
+INSERT INTO tag (id, name) VALUES (22, 'MySQL');
+INSERT INTO tag (id, name) VALUES (23, 'JavaScript');
+INSERT INTO tag (id, name) VALUES (24, 'Neon');
+
+
+
+CREATE TABLE book (
+ id int NOT NULL AUTO_INCREMENT,
+ author_id int NOT NULL,
+ translator_id int,
+ title varchar(50) NOT NULL,
+ next_volume int,
+ PRIMARY KEY (id),
+ CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id),
+ CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id),
+ CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id)
+) ENGINE=InnoDB AUTO_INCREMENT=5;
+
+CREATE INDEX book_title ON book (title);
+
+INSERT INTO book (id, author_id, translator_id, title) VALUES (1, 11, 11, '1001 tipu a triku pro PHP');
+INSERT INTO book (id, author_id, translator_id, title) VALUES (2, 11, NULL, 'JUSH');
+INSERT INTO book (id, author_id, translator_id, title) VALUES (3, 12, 12, 'Nette');
+INSERT INTO book (id, author_id, translator_id, title) VALUES (4, 12, 12, 'Dibi');
+
+
+
+CREATE TABLE book_tag (
+ book_id int NOT NULL,
+ tag_id int NOT NULL,
+ PRIMARY KEY (book_id, tag_id),
+ CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO book_tag (book_id, tag_id) VALUES (1, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (3, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (4, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (1, 22);
+INSERT INTO book_tag (book_id, tag_id) VALUES (4, 22);
+INSERT INTO book_tag (book_id, tag_id) VALUES (2, 23);
+
+
+
+CREATE TABLE book_tag_alt (
+ book_id int NOT NULL,
+ tag_id int NOT NULL,
+ state varchar(30),
+ PRIMARY KEY (book_id, tag_id),
+ CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 21, 'public');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 22, 'private');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 23, 'private');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 24, 'public');
+
+
+
+CREATE TABLE note (
+ book_id int NOT NULL,
+ note varchar(100),
+ CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id)
+) ENGINE=InnoDB;
+
+SET FOREIGN_KEY_CHECKS = 1;
diff --git a/Books/demo/dump/postgresql.sql b/Books/demo/dump/postgresql.sql
new file mode 100644
index 0000000..33e4fb4
--- /dev/null
+++ b/Books/demo/dump/postgresql.sql
@@ -0,0 +1,92 @@
+DROP TABLE IF EXISTS `author`, `book`, `book_tag`, `book_tag_alt`, `note`, `tag`;
+
+
+CREATE TABLE author (
+ id serial NOT NULL,
+ name varchar(30) NOT NULL,
+ web varchar(100) NOT NULL,
+ born date DEFAULT NULL,
+ PRIMARY KEY(id)
+);
+
+INSERT INTO author (id, name, web, born) VALUES (11, 'Jakub Vrana', 'http://www.vrana.cz/', NULL);
+INSERT INTO author (id, name, web, born) VALUES (12, 'David Grudl', 'http://davidgrudl.com/', NULL);
+INSERT INTO author (id, name, web, born) VALUES (13, 'Geek', 'http://example.com', NULL);
+SELECT setval('author_id_seq', 13, TRUE);
+
+
+
+CREATE TABLE tag (
+ id serial NOT NULL,
+ name varchar(20) NOT NULL,
+ PRIMARY KEY (id)
+);
+
+INSERT INTO tag (id, name) VALUES (21, 'PHP');
+INSERT INTO tag (id, name) VALUES (22, 'MySQL');
+INSERT INTO tag (id, name) VALUES (23, 'JavaScript');
+INSERT INTO tag (id, name) VALUES (24, 'Neon');
+SELECT setval('tag_id_seq', 24, TRUE);
+
+
+
+CREATE TABLE book (
+ id serial NOT NULL,
+ author_id int NOT NULL,
+ translator_id int,
+ title varchar(50) NOT NULL,
+ next_volume INT,
+ PRIMARY KEY (id),
+ CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id),
+ CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id),
+ CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id)
+);
+
+CREATE INDEX book_title ON book (title);
+
+
+
+INSERT INTO book (id, author_id, translator_id, title) VALUES (1, 11, 11, '1001 tipu a triku pro PHP');
+INSERT INTO book (id, author_id, translator_id, title) VALUES (2, 11, NULL, 'JUSH');
+INSERT INTO book (id, author_id, translator_id, title) VALUES (3, 12, 12, 'Nette');
+INSERT INTO book (id, author_id, translator_id, title) VALUES (4, 12, 12, 'Dibi');
+SELECT setval('book_id_seq', 4, TRUE);
+
+CREATE TABLE book_tag (
+ book_id int NOT NULL,
+ tag_id int NOT NULL,
+ PRIMARY KEY (book_id, tag_id),
+ CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
+);
+
+INSERT INTO book_tag (book_id, tag_id) VALUES (1, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (3, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (4, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (1, 22);
+INSERT INTO book_tag (book_id, tag_id) VALUES (4, 22);
+INSERT INTO book_tag (book_id, tag_id) VALUES (2, 23);
+
+
+
+CREATE TABLE book_tag_alt (
+ book_id int NOT NULL,
+ tag_id int NOT NULL,
+ state varchar(30),
+ PRIMARY KEY (book_id, tag_id),
+ CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
+);
+
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 21, 'public');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 22, 'private');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 23, 'private');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 24, 'public');
+
+
+
+CREATE TABLE note (
+ book_id int NOT NULL,
+ note varchar(100),
+ CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id)
+);
diff --git a/Books/demo/dump/sqlite.sql b/Books/demo/dump/sqlite.sql
new file mode 100644
index 0000000..a9331dd
--- /dev/null
+++ b/Books/demo/dump/sqlite.sql
@@ -0,0 +1,93 @@
+DROP TABLE IF EXISTS note;
+DROP TABLE IF EXISTS book_tag_alt;
+DROP TABLE IF EXISTS book_tag;
+DROP TABLE IF EXISTS book;
+DROP TABLE IF EXISTS tag;
+DROP TABLE IF EXISTS author;
+
+
+
+
+CREATE TABLE author (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ name TEXT NOT NULL,
+ web TEXT NOT NULL,
+ born DATE
+);
+
+INSERT INTO author (id, name, web, born) VALUES (11, 'Jakub Vrana', 'http://www.vrana.cz/', NULL);
+INSERT INTO author (name, web, born) VALUES ('David Grudl', 'http://davidgrudl.com/', NULL);
+INSERT INTO author (name, web, born) VALUES ('Geek', 'http://example.com', NULL);
+
+
+
+CREATE TABLE tag (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+ name TEXT NOT NULL
+);
+
+INSERT INTO tag (id, name) VALUES (21, 'PHP');
+INSERT INTO tag (name) VALUES ('MySQL');
+INSERT INTO tag (name) VALUES ('JavaScript');
+INSERT INTO tag (name) VALUES ('Neon');
+
+
+
+CREATE TABLE book (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ author_id INTEGER NOT NULL,
+ translator_id INTEGER,
+ title TEXT NOT NULL,
+ next_volume INTEGER,
+ CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id),
+ CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id),
+ CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id)
+);
+
+CREATE INDEX book_title ON book (title);
+
+INSERT INTO book (author_id, translator_id, title) VALUES (11, 11, '1001 tipu a triku pro PHP');
+INSERT INTO book (author_id, translator_id, title) VALUES (11, NULL, 'JUSH');
+INSERT INTO book (author_id, translator_id, title) VALUES (12, 12, 'Nette');
+INSERT INTO book (author_id, translator_id, title) VALUES (12, 12, 'Dibi');
+
+
+
+CREATE TABLE book_tag (
+ book_id INTEGER NOT NULL,
+ tag_id INTEGER NOT NULL,
+ CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE,
+ PRIMARY KEY (book_id, tag_id)
+);
+
+INSERT INTO book_tag (book_id, tag_id) VALUES (1, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (3, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (4, 21);
+INSERT INTO book_tag (book_id, tag_id) VALUES (1, 22);
+INSERT INTO book_tag (book_id, tag_id) VALUES (4, 22);
+INSERT INTO book_tag (book_id, tag_id) VALUES (2, 23);
+
+
+
+CREATE TABLE book_tag_alt (
+ book_id INTEGER NOT NULL,
+ tag_id INTEGER NOT NULL,
+ state TEXT,
+ PRIMARY KEY (book_id, tag_id),
+ CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
+);
+
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 21, 'public');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 22, 'private');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 23, 'private');
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 24, 'public');
+
+
+
+CREATE TABLE note (
+ book_id int NOT NULL,
+ note varchar(100),
+ CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id)
+);
diff --git a/Books/demo/dump/sqlsrv.sql b/Books/demo/dump/sqlsrv.sql
new file mode 100644
index 0000000..23911c2
--- /dev/null
+++ b/Books/demo/dump/sqlsrv.sql
@@ -0,0 +1,101 @@
+IF OBJECT_ID('note', 'U') IS NOT NULL DROP TABLE note;
+IF OBJECT_ID('book_tag_alt', 'U') IS NOT NULL DROP TABLE book_tag_alt;
+IF OBJECT_ID('book_tag', 'U') IS NOT NULL DROP TABLE book_tag;
+IF OBJECT_ID('book', 'U') IS NOT NULL DROP TABLE book;
+IF OBJECT_ID('tag', 'U') IS NOT NULL DROP TABLE tag;
+IF OBJECT_ID('author', 'U') IS NOT NULL DROP TABLE author;
+
+
+
+CREATE TABLE author (
+ id int NOT NULL IDENTITY(11,1),
+ name varchar(30) NOT NULL,
+ web varchar(100) NOT NULL,
+ born date,
+ PRIMARY KEY(id)
+);
+
+INSERT INTO author (name, web, born) VALUES
+('Jakub Vrana', 'http://www.vrana.cz/', NULL),
+('David Grudl', 'http://davidgrudl.com/', NULL),
+('Geek', 'http://example.com', NULL);
+
+
+
+CREATE TABLE tag (
+ id int NOT NULL IDENTITY(21, 1),
+ name varchar(20) NOT NULL,
+ PRIMARY KEY (id)
+);
+
+INSERT INTO tag (name) VALUES
+('PHP'),
+('MySQL'),
+('JavaScript'),
+('Neon');
+
+
+
+CREATE TABLE book (
+ id int NOT NULL IDENTITY(1,1),
+ author_id int NOT NULL,
+ translator_id int,
+ title varchar(50) NOT NULL,
+ next_volume int,
+ PRIMARY KEY (id),
+ CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id),
+ CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id),
+ CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id)
+);
+
+CREATE INDEX book_title ON book (title);
+
+INSERT INTO book (author_id, translator_id, title) VALUES
+(11, 11, '1001 tipu a triku pro PHP'),
+(11, NULL, 'JUSH'),
+(12, 12, 'Nette'),
+(12, 12, 'Dibi');
+
+
+
+-- Add primary key manually, it is tested to name
+CREATE TABLE book_tag (
+ book_id int NOT NULL,
+ tag_id int NOT NULL,
+ CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
+);
+ALTER TABLE book_tag ADD CONSTRAINT PK_book_tag PRIMARY KEY CLUSTERED (book_id, tag_id);
+
+INSERT INTO book_tag (book_id, tag_id) VALUES
+(1, 21),
+(3, 21),
+(4, 21),
+(1, 22),
+(4, 22),
+(2, 23);
+
+
+
+CREATE TABLE book_tag_alt (
+ book_id int NOT NULL,
+ tag_id int NOT NULL,
+ state varchar(30),
+ PRIMARY KEY (book_id, tag_id),
+ CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id),
+ CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE
+);
+
+INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES
+(3, 21, 'public'),
+(3, 22, 'private'),
+(3, 23, 'private'),
+(3, 24, 'public');
+
+
+
+CREATE TABLE note (
+ book_id int NOT NULL,
+ note varchar(100),
+ CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id)
+);
diff --git a/Books/demo/log/.gitignore b/Books/demo/log/.gitignore
new file mode 100644
index 0000000..4a7528a
--- /dev/null
+++ b/Books/demo/log/.gitignore
@@ -0,0 +1,3 @@
+*
+!.*
+!*/.*
\ No newline at end of file
diff --git a/Books/demo/temp/.gitignore b/Books/demo/temp/.gitignore
new file mode 100644
index 0000000..4a7528a
--- /dev/null
+++ b/Books/demo/temp/.gitignore
@@ -0,0 +1,3 @@
+*
+!.*
+!*/.*
\ No newline at end of file
diff --git a/CD-collection/app/bootstrap.php b/CD-collection/app/bootstrap.php
index fbb5fb1..3a96fee 100644
--- a/CD-collection/app/bootstrap.php
+++ b/CD-collection/app/bootstrap.php
@@ -1,4 +1,5 @@
createContainer();
// Setup router using mod_rewrite detection
-if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) {
+if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules(), true)) {
$router = $container->getByType(Nette\Application\IRouter::class);
$router[] = new Route('index.php', 'Dashboard:default', Route::ONE_WAY);
$router[] = new Route('/[/]', 'Dashboard:default');
diff --git a/CD-collection/app/model/AlbumRepository.php b/CD-collection/app/model/AlbumRepository.php
index 2d49e0e..e8dbc80 100644
--- a/CD-collection/app/model/AlbumRepository.php
+++ b/CD-collection/app/model/AlbumRepository.php
@@ -1,4 +1,5 @@
findAll()->insert($values);
}
-
}
diff --git a/CD-collection/app/model/Authenticator.php b/CD-collection/app/model/Authenticator.php
index 7464f5d..647e548 100644
--- a/CD-collection/app/model/Authenticator.php
+++ b/CD-collection/app/model/Authenticator.php
@@ -1,4 +1,5 @@
database->table('users')->where('username', $username)->fetch();
if (!$row) {
@@ -42,7 +42,6 @@ public function authenticate(array $credentials)
$arr = $row->toArray();
unset($arr['password']);
- return new Security\Identity($row->id, NULL, $arr);
+ return new Security\Identity($row->id, null, $arr);
}
-
}
diff --git a/CD-collection/app/presenters/DashboardPresenter.php b/CD-collection/app/presenters/DashboardPresenter.php
index 1cd1fb0..a7c9e74 100644
--- a/CD-collection/app/presenters/DashboardPresenter.php
+++ b/CD-collection/app/presenters/DashboardPresenter.php
@@ -1,4 +1,5 @@
redirect('default');
}
-
}
diff --git a/CD-collection/app/presenters/SignPresenter.php b/CD-collection/app/presenters/SignPresenter.php
index eb66202..424bf6d 100644
--- a/CD-collection/app/presenters/SignPresenter.php
+++ b/CD-collection/app/presenters/SignPresenter.php
@@ -1,4 +1,5 @@
flashMessage('You have been signed out.');
$this->redirect('in');
}
-
}
diff --git a/CD-collection/composer.json b/CD-collection/composer.json
index c70d4b1..81180fb 100644
--- a/CD-collection/composer.json
+++ b/CD-collection/composer.json
@@ -14,16 +14,16 @@
}
],
"require": {
- "php": ">=5.6",
- "nette/application": "^2.4",
- "nette/bootstrap": "^2.4.2",
- "nette/database": "^2.4",
- "nette/forms": "^2.4.3",
- "nette/robot-loader": "^2.4",
- "nette/security": "^2.4",
- "nette/utils": "^2.4",
- "latte/latte": "^2.4",
+ "php": ">=7.1",
+ "nette/application": "^3.0",
+ "nette/bootstrap": "^3.0",
+ "nette/database": "^3.0",
+ "nette/forms": "^3.0",
+ "nette/robot-loader": "^3.0",
+ "nette/security": "^3.0",
+ "nette/utils": "^3.0",
+ "latte/latte": "^3.0",
"tracy/tracy": "^2.4"
},
- "minimum-stability": "stable"
+ "minimum-stability": "dev"
}
diff --git a/CD-collection/www/index.php b/CD-collection/www/index.php
index c48a619..0e13d58 100644
--- a/CD-collection/www/index.php
+++ b/CD-collection/www/index.php
@@ -1,4 +1,5 @@
width;
$empty = $this->searchEmpty();
$y = (int) ($empty / $this->width);
$x = $empty % $this->width;
if ($x > 0 && $pos === $empty - 1) {
$rel = '-1,';
- return TRUE;
+ return true;
}
if ($x < $this->width - 1 && $pos === $empty + 1) {
$rel = '+1,';
- return TRUE;
+ return true;
}
if ($y > 0 && $pos === $empty - $this->width) {
$rel = ',-1';
- return TRUE;
+ return true;
}
if ($y < $this->width - 1 && $pos === $empty + $this->width) {
$rel = ',+1';
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
@@ -105,7 +106,7 @@ private function move($x, $y)
private function searchEmpty()
{
- return array_search(0, $this->order);
+ return array_search(0, $this->order, true);
}
@@ -119,14 +120,12 @@ public function render()
/**
- * Loads params
- * @param array
- * @return void
+ * Loads params.
*/
- public function loadState(array $params)
+ public function loadState(array $params): void
{
if (isset($params['order'])) {
- $params['order'] = explode('.', (string) $params['order']);
+ $params['order'] = array_map('intval', explode('.', (string) $params['order']));
// validate
$copy = $params['order'];
@@ -141,16 +140,13 @@ public function loadState(array $params)
/**
- * Save params
- * @param array
- * @return void
+ * Save params.
*/
- public function saveState(array &$params)
+ public function saveState(array &$params): void
{
parent::saveState($params);
if (isset($params['order'])) {
$params['order'] = implode('.', $params['order']);
}
}
-
}
diff --git a/Fifteen/app/presenters/DefaultPresenter.php b/Fifteen/app/presenters/DefaultPresenter.php
index 9263514..f7394b2 100644
--- a/Fifteen/app/presenters/DefaultPresenter.php
+++ b/Fifteen/app/presenters/DefaultPresenter.php
@@ -1,10 +1,9 @@
redrawControl('round');
@@ -29,5 +28,4 @@ public function gameOver($sender, $round)
$this->template->flash = 'Congratulations!';
$this->redrawControl('flash');
}
-
}
diff --git a/Fifteen/composer.json b/Fifteen/composer.json
index 95aabe6..136cc85 100644
--- a/Fifteen/composer.json
+++ b/Fifteen/composer.json
@@ -1,5 +1,5 @@
{
- "name": "nette-examples/cd-collection",
+ "name": "nette-examples/fifteen",
"type": "project",
"description": "A simple example showing components as the reusable stand-alone units.",
"license": "BSD-3-Clause",
@@ -14,12 +14,12 @@
}
],
"require": {
- "php": ">=5.6",
- "nette/application": "^2.4",
- "nette/bootstrap": "^2.4.2",
- "nette/robot-loader": "^2.4",
- "latte/latte": "^2.4",
+ "php": ">=7.1",
+ "nette/application": "^3.0",
+ "nette/bootstrap": "^3.0",
+ "nette/robot-loader": "^3.0",
+ "latte/latte": "^3.0",
"tracy/tracy": "^2.4"
},
- "minimum-stability": "stable"
+ "minimum-stability": "dev"
}
diff --git a/Fifteen/www/index.php b/Fifteen/www/index.php
index c48a619..0e13d58 100644
--- a/Fifteen/www/index.php
+++ b/Fifteen/www/index.php
@@ -1,4 +1,5 @@
=5.6",
- "nette/application": "^2.4",
- "nette/bootstrap": "^2.4.2",
- "nette/database": "^2.4",
- "nette/robot-loader": "^2.4",
- "latte/latte": "^2.4",
+ "php": ">=7.1",
+ "nette/application": "^3.0",
+ "nette/bootstrap": "^3.0",
+ "nette/database": "^3.0",
+ "nette/robot-loader": "^3.0",
+ "latte/latte": "^3.0",
"tracy/tracy": "^2.4"
},
- "minimum-stability": "stable",
+ "minimum-stability": "dev",
"config": {
"vendor-dir": "www/data/vendor"
}
diff --git a/Micro-blog/www/data/TemplateRouter.php b/Micro-blog/www/data/TemplateRouter.php
index df0b9fa..43b77fc 100644
--- a/Micro-blog/www/data/TemplateRouter.php
+++ b/Micro-blog/www/data/TemplateRouter.php
@@ -1,4 +1,5 @@
scanRoutes($path);
- file_put_contents($cacheFile, ' $file) {
$this[] = new Routers\Route($mask, function ($presenter) use ($file, $cachePath) {
- return $presenter->createTemplate(NULL, function () use ($cachePath) {
+ return $presenter->createTemplate(null, function () use ($cachePath) {
$latte = new Latte\Engine;
$latte->setTempDirectory($cachePath . '/cache');
$macroSet = new Latte\Macros\MacroSet($latte->getCompiler());
- $macroSet->addMacro('url', function () {}, NULL, NULL, $macroSet::ALLOWED_IN_HEAD); // ignore
+ $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore
return $latte;
})->setFile($file);
});
@@ -39,11 +39,10 @@ public function scanRoutes($path)
$macroSet = new Latte\Macros\MacroSet($latte->getCompiler());
$macroSet->addMacro('url', function ($node) use (&$routes, &$file) {
$routes[$node->args] = (string) $file;
- }, NULL, NULL, $macroSet::ALLOWED_IN_HEAD);
+ }, null, null, $macroSet::ALLOWED_IN_HEAD);
foreach (Nette\Utils\Finder::findFiles('*.latte')->from($path) as $file) {
$latte->compile($file);
}
return $routes;
}
-
}
diff --git a/Micro-blog/www/index.php b/Micro-blog/www/index.php
index 44d247e..4b9ac65 100644
--- a/Micro-blog/www/index.php
+++ b/Micro-blog/www/index.php
@@ -1,4 +1,5 @@
createContainer();
// Setup router using mod_rewrite detection
-if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) {
+if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules(), true)) {
$router = $container->getByType(Nette\Application\IRouter::class);
$router[] = new Route('index.php', 'Front:Default:default', Route::ONE_WAY);
diff --git a/Modules-Usage/app/modules/Admin/DefaultPresenter.php b/Modules-Usage/app/modules/Admin/DefaultPresenter.php
index d3e2885..2bed5cb 100644
--- a/Modules-Usage/app/modules/Admin/DefaultPresenter.php
+++ b/Modules-Usage/app/modules/Admin/DefaultPresenter.php
@@ -1,8 +1,8 @@
template->viewName = $this->getView();
- $this->template->root = isset($_SERVER['SCRIPT_FILENAME']) ? realpath(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) : NULL;
+ $this->template->root = isset($_SERVER['SCRIPT_FILENAME']) ? realpath(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) : null;
$a = strrpos($this->getName(), ':');
- if ($a === FALSE) {
+ if ($a === false) {
$this->template->moduleName = '';
$this->template->presenterName = $this->getName();
} else {
@@ -22,5 +22,4 @@ protected function beforeRender()
$this->template->presenterName = substr($this->getName(), $a + 1);
}
}
-
}
diff --git a/Modules-Usage/app/modules/Front.Export/DefaultPresenter.php b/Modules-Usage/app/modules/Front.Export/DefaultPresenter.php
index d47cfd8..86956f0 100644
--- a/Modules-Usage/app/modules/Front.Export/DefaultPresenter.php
+++ b/Modules-Usage/app/modules/Front.Export/DefaultPresenter.php
@@ -1,8 +1,8 @@
=5.6",
- "nette/application": "^2.4",
- "nette/bootstrap": "^2.4.2",
- "nette/robot-loader": "^2.4",
- "latte/latte": "^2.4",
+ "php": ">=7.1",
+ "nette/application": "^3.0",
+ "nette/bootstrap": "^3.0",
+ "nette/robot-loader": "^3.0",
+ "latte/latte": "^3.0",
"tracy/tracy": "^2.4"
},
- "minimum-stability": "stable"
+ "minimum-stability": "dev"
}
diff --git a/Modules-Usage/www/index.php b/Modules-Usage/www/index.php
index c48a619..0e13d58 100644
--- a/Modules-Usage/www/index.php
+++ b/Modules-Usage/www/index.php
@@ -1,4 +1,5 @@