Okay, I’m going to list anything and everything that came in my mind while reading your code.


Start documenting your code for better maintainability
Validate every and any user input
Use proper camelCase notation for property and method names
Separate your code into more methods (especially in __construct)
Keep everything protected unless you have a good reason to keep it private or expose it with public
Use single or double quotes throughout your code, but don’t mix it (consistency)
Enclose your variables in {} if you embed them in strings
Use single quotes for your HTML if you use double quotes for creating the string (prevent escaping mistakes)
Use namespace’s (even if you don’t need them now)


An example class:

&lt;?php

/*!
 * My license
 */
namespace \Fleshgrinder;

/**
 * Example class for Code Review at Stack Exchange.
 *
 * @author Fleshgrinder &lt;email@example.com&gt;
 */
class ExampleClass {

    /**
     * The example class's example property.
     *
     * @var mixed
     */
    protected $camelCasePropertyName;

    /**
     * Instantiate new example class.
     *
     * @var string $param1
     *   Example parameter 1.
     * @var string $param2 [optional]
     *   Optional example parameter 2.
     * @throws \RuntimeException
     */
    public function __construct($param1, $param2 = "foo") {
        if ($param2 == "foo") {
            $this-&gt;camelCasePropertyName = $this-&gt;camelCaseMethodName();
        }
        elseif ($param2 == "bar") {
            throw new \RuntimeException("No bar!");
        }
        else {
            $this-&gt;camelCasePropertyName = $param1;
        }
    }

    /**
     * Get &lt;var&gt;$str&lt;/var&gt; wrapped in &lt;code&gt;span&lt;/code&gt; HTML element.
     *
     * @param string $str
     *   The string to wrap.
     * @return string
     *   The wrapped string.
     */
    protected function camelCaseMethodName($str) {
        return "&lt;span class='foo'&gt;{$str}&lt;/span&gt;";
    }

}




Example regarding creation of methods that help to understand the code better (see comments):

&lt;?php

// No comments to keep it short, but always write comments!
class Database extends FictivePHPDBClass {

    public function __construct($user, $password, $host, $port, $database) {
        $this-&gt;setUser($user);
        $this-&gt;setPassword($password);
        $this-&gt;setHostname($host);
        $this-&gt;setPort($port);
        $this-&gt;connect();
        $this-&gt;selectDatabase($database);
    }

    protected function setUser($user) {
        if (empty($user) || !is_string($user)) {
            throw new \IllegalArgumentException("Username cannot be empty.");
        }
        $this-&gt;user = $user;
    }

    protected function setPassword($password) {}

    protected function setHostname($hostname) {}

    protected function setPort($port) {}

    protected function connect() {
        $phpDB = parent::connect($this-&gt;user, $this-&gt;password, $this-&gt;hostname, $this-&gt;port);
        if ($phpDB-&gt;errorCount &gt; 0) {
            throw new \Fleshgrinder\Exception\DatabaseException("Couldn't connect to {$this-&gt;hostname} database.");
        }
        $this-&gt;connection = $phpDB;
    }

    protected function selectDatabase($database) {
        if (empty($database) || !is_string($database)) {
            throw new \IllegalArgumentException("Bla bla ...");
        }
        if (!($this-&gt;connection instanceof \FictivePHPDBClass)) {
            throw new \LogicException("Bla bla ...");
        }
        $this-&gt;connection-&gt;selectDatabase($database);
        if ($this-&gt;connection-&gt;errorCount &gt; 0) {
            throw new \Fleshgrinder\Exception\DatabaseException("Bla bla ...");
        }
    }

}


That's stuff you often see in OO PHP code, wrapping some other classes and trying to make some real OO code out of them. But what I really want to show you is the fact that the methods are short, easy to understand because of that and that you already know what each method does only by reading their name.

Critique Requested on PHP Pagination Class
As the subject states, I was wondering if the Mage Wars Core Set comes with enough Fire type cards to allow the Warlock Mage to build a spellbook with absolutely no Demon cards. Without seeing the cards, I will assume that most, if not all of the other Dark magic cards are OK, but I would ultimately prefer a pure Fire Magic spellbook.

So as to preemptively answer the almost inevitable 'Why?', I will simply say that, as an orthodox Christian, my conscience doesn't allow me to play a game with such cards. I would prefer not to debate/explain this further, as I believe such a discussion is well beyond the scope of this site.
