Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Car.php
CarInterface.php
Driver.php
ProxyCar.php
readme.md

readme.md

#Proxy

Proxy is used to give access to origin object however before that some logic may be applied. In my case before giving access to drive method of car object I check if a driver is sober and actually can drive a car. For client using proxy is the same as origin object because they implement the same interface.

#When to use

  • When you want to hide information about origin object
  • When you want to provide more logic before accessing the object
  • When you want to do some optimisation before givng access to object
You can’t perform that action at this time.