title: Best way to get Properties when they are not public / PHP
body: <p>I have a class that when I instantiate it fill the property via construct.
  The goal of this class is describe a shop, so his properties will protected because they belongs only to that class. </p>
  
  <p>But the problem is that sometimes I need to get some informations about that class from the properties.</p>
  
  <p><strong>example:</strong></p>
  
  <pre><code>class Shop {
  
    protected $name;
  
    protected $typology;
  
    protected $owners;
  
    protected $closed;
  
    public function __construct($name,$typology,$owners,$closed)
    {
         $this-&gt;name = $name;
         $this-&gt;typology = $typology;
         $this-&gt;owners = $owners;
         $this-&gt;close = $closed;
    }
  
  }
  
  $shop = new Shop("Name Shop","vegetarian",2,1);
  
  $superMarket = SupermarketFactory::getInstance($shop);
  </code></pre>
  
  <p>On the class <code>Supermaket</code> that (instantiated via Factory), need to get shop properties to work with. </p>
  
  <p>There are a bunch of ways to make this work, but all solutions are a bit messy on my view point. I experimented this ways:</p>
  
  <ul>
  <li><p>Setting getters and setters - To exclude this way, having 20 properties I need 40 methods. Scripts are not efficient.</p></li>
  <li><p>Using <code>__get()</code> magic method, my IDE complain about getting those property via magic method. That's even true because at this point I could set it public.</p></li>
  <li><p>Using Reflection, It seem to be the best of the above ways, but still need too much implementation for get only properties ( I guess)</p></li>
  </ul>
  
  <p>So I would like achieve the best design to get this work, have a class that has protected property but at the same time callable in a elegant way. </p>
  
  <p>There is any of design pattern that helps this goal?</p>
  
  <p>I may have ask already something similar on stackOverflow but I reviewed the question and proposed in a better way.   </p>