diff --git a/.travis.yml b/.travis.yml
index 59b9baf..adf73f0 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
+ - php temp/coding-standard/ecs check . --config temp/coding-standard/coding-standard-php56.neon
sudo: false
diff --git a/Books/composer.json b/Books/composer.json
new file mode 100644
index 0000000..bcc3a26
--- /dev/null
+++ b/Books/composer.json
@@ -0,0 +1,8 @@
+{
+ "require": {
+ "php": ">=5.6",
+ "nette/database": "^2.4",
+ "nette/bootstrap": "^2.4",
+ "tracy/tracy": "^2.4"
+ }
+}
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..d7a4bf4
--- /dev/null
+++ b/Books/demo/demo.php
@@ -0,0 +1,46 @@
+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..f02862c 100644
--- a/CD-collection/app/bootstrap.php
+++ b/CD-collection/app/bootstrap.php
@@ -26,7 +26,7 @@
$container = $configurator->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..1bb848f 100644
--- a/CD-collection/app/model/AlbumRepository.php
+++ b/CD-collection/app/model/AlbumRepository.php
@@ -38,5 +38,4 @@ public function insert($values)
{
return $this->findAll()->insert($values);
}
-
}
diff --git a/CD-collection/app/model/Authenticator.php b/CD-collection/app/model/Authenticator.php
index 7464f5d..1acbc0e 100644
--- a/CD-collection/app/model/Authenticator.php
+++ b/CD-collection/app/model/Authenticator.php
@@ -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..e7c5bbb 100644
--- a/CD-collection/app/presenters/DashboardPresenter.php
+++ b/CD-collection/app/presenters/DashboardPresenter.php
@@ -150,5 +150,4 @@ public function formCancelled()
{
$this->redirect('default');
}
-
}
diff --git a/CD-collection/app/presenters/SignPresenter.php b/CD-collection/app/presenters/SignPresenter.php
index eb66202..dde9a66 100644
--- a/CD-collection/app/presenters/SignPresenter.php
+++ b/CD-collection/app/presenters/SignPresenter.php
@@ -53,5 +53,4 @@ public function actionOut()
$this->flashMessage('You have been signed out.');
$this->redirect('in');
}
-
}
diff --git a/Fifteen/app/components/FifteenControl.php b/Fifteen/app/components/FifteenControl.php
index 3890962..e672e04 100644
--- a/Fifteen/app/components/FifteenControl.php
+++ b/Fifteen/app/components/FifteenControl.php
@@ -67,30 +67,30 @@ public function getRound()
}
- public function isClickable($x, $y, &$rel = NULL)
+ public function isClickable($x, $y, &$rel = null)
{
- $rel = NULL;
+ $rel = null;
$pos = $x + $y * $this->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 +105,7 @@ private function move($x, $y)
private function searchEmpty()
{
- return array_search(0, $this->order);
+ return array_search(0, $this->order, true);
}
@@ -126,7 +126,7 @@ public function render()
public function loadState(array $params)
{
if (isset($params['order'])) {
- $params['order'] = explode('.', (string) $params['order']);
+ $params['order'] = array_map('intval', explode('.', (string) $params['order']));
// validate
$copy = $params['order'];
@@ -152,5 +152,4 @@ public function saveState(array &$params)
$params['order'] = implode('.', $params['order']);
}
}
-
}
diff --git a/Fifteen/app/presenters/DefaultPresenter.php b/Fifteen/app/presenters/DefaultPresenter.php
index 9263514..9dd3bad 100644
--- a/Fifteen/app/presenters/DefaultPresenter.php
+++ b/Fifteen/app/presenters/DefaultPresenter.php
@@ -3,8 +3,6 @@
class DefaultPresenter extends Nette\Application\UI\Presenter
{
-
-
public function renderDefault()
{
$this->redrawControl('round');
@@ -29,5 +27,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..637e53f 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",
diff --git a/Micro-blog/www/data/TemplateRouter.php b/Micro-blog/www/data/TemplateRouter.php
index df0b9fa..aa2d4bd 100644
--- a/Micro-blog/www/data/TemplateRouter.php
+++ b/Micro-blog/www/data/TemplateRouter.php
@@ -8,23 +8,22 @@
*/
class TemplateRouter extends Routers\RouteList
{
-
public function __construct($path, $cachePath)
{
if (is_file($cacheFile = $cachePath . '/routes.php')) {
$routes = require $cacheFile;
} else {
$routes = $this->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 +38,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/Modules-Usage/app/bootstrap.php b/Modules-Usage/app/bootstrap.php
index 2423a3f..69f9039 100644
--- a/Modules-Usage/app/bootstrap.php
+++ b/Modules-Usage/app/bootstrap.php
@@ -27,7 +27,7 @@
$container = $configurator->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..c5733bd 100644
--- a/Modules-Usage/app/modules/Admin/DefaultPresenter.php
+++ b/Modules-Usage/app/modules/Admin/DefaultPresenter.php
@@ -4,5 +4,4 @@
class DefaultPresenter extends \DemoApp\Module\Base\Presenters\BasePresenter
{
-
}
diff --git a/Modules-Usage/app/modules/Base/BasePresenter.php b/Modules-Usage/app/modules/Base/BasePresenter.php
index df643e7..9ea8280 100644
--- a/Modules-Usage/app/modules/Base/BasePresenter.php
+++ b/Modules-Usage/app/modules/Base/BasePresenter.php
@@ -7,14 +7,13 @@
abstract class BasePresenter extends Nette\Application\UI\Presenter
{
-
protected function beforeRender()
{
$this->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 +21,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..e3ae94e 100644
--- a/Modules-Usage/app/modules/Front.Export/DefaultPresenter.php
+++ b/Modules-Usage/app/modules/Front.Export/DefaultPresenter.php
@@ -4,5 +4,4 @@
class DefaultPresenter extends \DemoApp\Module\Base\Presenters\BasePresenter
{
-
}
diff --git a/Modules-Usage/app/modules/Front/CatalogListPresenter.php b/Modules-Usage/app/modules/Front/CatalogListPresenter.php
index f828a6d..6228eeb 100644
--- a/Modules-Usage/app/modules/Front/CatalogListPresenter.php
+++ b/Modules-Usage/app/modules/Front/CatalogListPresenter.php
@@ -4,5 +4,4 @@
class CatalogListPresenter extends \DemoApp\Module\Base\Presenters\BasePresenter
{
-
}
diff --git a/Modules-Usage/app/modules/Front/DefaultPresenter.php b/Modules-Usage/app/modules/Front/DefaultPresenter.php
index 2291434..7457412 100644
--- a/Modules-Usage/app/modules/Front/DefaultPresenter.php
+++ b/Modules-Usage/app/modules/Front/DefaultPresenter.php
@@ -4,5 +4,4 @@
class DefaultPresenter extends \DemoApp\Module\Base\Presenters\BasePresenter
{
-
}