protected static function pieceToForsyth(Piece $piece) { static $reverseClasses = array('Pawn' => 'p', 'Rook' => 'r', 'Knight' => 'n', 'Bishop' => 'b', 'Queen' => 'q', 'King' => 'k'); $notation = $reverseClasses[$piece->getClass()]; if ('white' === $piece->getColor()) { $notation = strtoupper($notation); } return $notation; }