Jump to content

A Question about Object Property Visibility


ethanbeyer
 Share

Recommended Posts

Why don't Processwire Objects have all their properties visible?

 

 

Here's what I mean. Take this super stripped-down class for example:

class MyClass
{
    public $public = 'Public';
    protected $protected = 'Protected';
    private $private = 'Private';
}

$obj = new MyClass();
dump($obj);
die;

Output:

MyClass {#244 
  +public: "Public"
  #protected: "Protected"
  -private: "Private"
}

This is straight from PHP's manual on Property Visibility.

 

Now, if I do this with two different Processwire Modules, this is what happens.

$soc = new Socicons();
$other = new InputfieldSimpleMDE();

dump($soc, $other);
die;

Output:

Socicons {#248}

InputfieldSimpleMDE {#113 
  +data: array:20 [▼
    "label" => ""
    "description" => ""
    "icon" => ""
    "notes" => ""
    "head" => ""
    "required" => 0
    "requiredIf" => ""
    "collapsed" => 0
    "showIf" => ""
    "columnWidth" => ""
    "skipLabel" => false
    "wrapClass" => ""
    "headerClass" => ""
    "contentClass" => ""
    "textFormat" => 4
    "renderValueFlags" => 0
    "requiredAttr" => 0
    "initValue" => ""
    "stripTags" => false
    "showCount" => 0
  ]
}

Now, Socicons is a module I am currently writing, and it has about a dozen public properties. In the first example, the dump of the $obj class included all of that class' properties - so why don't I see all of the properties encased within Socicons? Secondly, why are all the properties of the InputfieldSimpleMDE within a data array?

I'm sure this is part of the way that Processwire is written or configured, but I am often scratching my head over this. So again, I am hoping that someone can answer this for me.

Why don't Processwire Objects have all their properties visible?

Thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...