From 38b2e78d6adb58c927fae9614284f4b273eff36c Mon Sep 17 00:00:00 2001 From: dr-matt-smith Date: Wed, 15 Feb 2017 12:11:14 +0000 Subject: [PATCH] ready for packagist --- CHANGELOG.md | 2 +- LICENSE.md | 2 +- public/index.php | 48 ------------- reader2.txt | 0 src/evote/Dvd.php | 136 ------------------------------------ src/evote/DvdRepository.php | 34 --------- 6 files changed, 2 insertions(+), 220 deletions(-) delete mode 100644 public/index.php delete mode 100644 reader2.txt delete mode 100644 src/evote/Dvd.php delete mode 100644 src/evote/DvdRepository.php diff --git a/CHANGELOG.md b/CHANGELOG.md index a4bd5a3..70f1a08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -All Notable changes to `pdo-crud-for-free` will be documented in this file. +All Notable changes to `pdo-crud-for-free-repositories` will be documented in this file. Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. diff --git a/LICENSE.md b/LICENSE.md index e0c0b3e..6ddeae3 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # The MIT License (MIT) -Copyright (c) 2016 Matt Smith +Copyright (c) 2017 Matt Smith > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal diff --git a/public/index.php b/public/index.php deleted file mode 100644 index a9c8c55..0000000 --- a/public/index.php +++ /dev/null @@ -1,48 +0,0 @@ -getAll(); - -foreach($dvds as $dvd){ - /** - * @var $dvd Dvd - */ - print PHP_EOL . 'id = ' . $dvd->getId(); - print PHP_EOL . '
'; - print PHP_EOL . 'title = ' . $dvd->getTitle(); - print PHP_EOL . '
'; - print PHP_EOL . 'category = ' . $dvd->getCategory(); - print PHP_EOL . '

'; - -} - -print '


'; - -$dvdsSearch = $dvdRepository->searchByTitleOrCategory('man'); - - -foreach($dvdsSearch as $dvd){ - /** - * @var $dvd Dvd - */ - print PHP_EOL . 'id = ' . $dvd->getId(); - print PHP_EOL . '
'; - print PHP_EOL . 'title = ' . $dvd->getTitle(); - print PHP_EOL . '
'; - print PHP_EOL . 'category = ' . $dvd->getCategory(); - print PHP_EOL . '

'; - -} \ No newline at end of file diff --git a/reader2.txt b/reader2.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/evote/Dvd.php b/src/evote/Dvd.php deleted file mode 100644 index 8712daf..0000000 --- a/src/evote/Dvd.php +++ /dev/null @@ -1,136 +0,0 @@ - ID - title - category - price - vote average - num votes - stars - * - */ -class Dvd -{ - /** - * the objects unique ID - * @var int - */ - private $id; - - /** - * @var string $title - */ - private $title; - - /** - * (should become ID of separate CATEGORY class ...) - * @var string $category - */ - private $category; - - /** - * @var float - */ - private $price; - - /** - * integer value from 0 .. 100 - * @var integer - */ - private $voteAverage; - - /** - * @var integer - */ - private $numVotes; - - - /** - * @return int - */ - public function getId() - { - return $this->id; - } - - public function getTitle() - { - return $this->title; - } - - public function getCategory() - { - return $this->category; - } - - public function getPrice() - { - return $this->price; - } - - public function getVoteAverage() - { - return $this->voteAverage; - } - - public function getNumVotes() - { - return $this->numVotes; - } - - public function getNumVotes2() - { - return 2 * $this->numVotes; - } - - /** - * function will exit with first return - * so conditions ordered strongest test first, down to weakest test ... - * - * @return string - */ - public function getStarImageHTML() - { - $message = 'num votes = ' . $this->numVotes; - die($message); - - if ($this->numVotes < 1){ - return '(no votes yet)'; - } - - if ($this->voteAverage > 80){ - return 'five starts star'; - } - - if ($this->voteAverage > 60){ - return 'four star'; - } - - if ($this->voteAverage > 45){ - return 'three star'; - } - - if ($this->voteAverage > 25){ - return 'two star'; - } - - if ($this->voteAverage > 10){ - return 'one star'; - } - - // if get here, just give half a star - return 'half star'; - - } - -} \ No newline at end of file diff --git a/src/evote/DvdRepository.php b/src/evote/DvdRepository.php deleted file mode 100644 index 541cdef..0000000 --- a/src/evote/DvdRepository.php +++ /dev/null @@ -1,34 +0,0 @@ -getDbh(); - - // wrap wildcard '%' around the serach text for the SQL query - $searchText = '%' . $searchText . '%'; - $sql = "SELECT * from dvds WHERE (title LIKE :searchText) or (category LIKE :searchText)"; - - $statement = $connection->prepare($sql); - $statement->bindParam(':searchText', $searchText, \PDO::PARAM_STR); - $statement->setFetchMode(\PDO::FETCH_CLASS, $this->getClassNameForDbRecords()); - $statement->execute(); - - $dvds = $statement->fetchAll(); - return $dvds; - } - -} \ No newline at end of file