Various updates to Shape.php

Added functions for obtaining information about class objects, also a
bug fix that caused an endless loop in the array_flatten function.