1.2.499. Getter And Setter

A getter is a method whose purpose is to read the internal value of a class; a setter is a method whose purpose is to write a value inside a class.

Exakat marks simple setters and getters : their content only writes (resp. reads) on property at a time. More refined getters/setters might appear in the future, when formatting and filter is detected and omitted.

<?php

class x {
    private $p = 1;

    // getter
    function getP() {
        return $this->p;
    }

    // setter
    function setP($a) {
        $this->p = $a;
    }
}

?>

See also PHP: Getters and Setters.

1.2.499.1. Specs

Short name

Patterns/GetterSetter

Rulesets

All, Changed Behavior

Exakat since

2.3.3

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

getter, setter

Available in

Entreprise Edition, Exakat Cloud