User:Jeroen De Dauw/Single Responsibility Principle/01

From semantic-mediawiki.org
Jump to: navigation, search
Jeroen De DauwJeroen De Dauw/Single Responsibility PrincipleUser:Jeroen De Dauw/Single Responsibility Principle/01

The single responsibility principle

class MapsLocation {
 
    protected $latitude;
    protected $longitude;
    // ...
 
    protected $address;
    protected $isValid;
 
    protected $icon;
    protected $group;
    // ...
 
    protected $format;
    protected $directional;
    // ...
 
    public function setCoordinates( $coordinates ) {
        // parse
    }
 
    public function setAddress( $address, $asActualLocation = true ) {
        // geocode
    }
 
    public function __construct( $coordsOrAddress = null, $format = Maps_COORDS_FLOAT, $directional = false, $separator = ',' ) {
        // ...
    }
 
    // ...
 
}