You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Karsten Beyer <ma...@kbeyer.net> on 2008/06/06 18:33:21 UTC

Question about GadgetFeatureRegistryEntry (PHP)

Hi,


i have a question about the constructor for the GadgetFeatureRegistryEntry:


class GadgetFeatureRegistryEntry {

public $name;

public $deps = array();

public $feature;


 public function __construct($name, $deps, $feature, $registry)

{

$this->name = $name;

if ($deps != null) {

foreach ($deps as $dep) {

$entry = $registry->getEntry($dep);

$this->deps[$entry->name] = $entry->name;

}

}

$this->feature = $feature;

}


...



As far as i can see, we create an object to get the name by which we found
the object in the first place. So are there any valid reasons to not change
it to:


public function __construct($name, $deps, $feature, $registry)

{

$this->name = $name;

$this->deps = $deps == null ? array() : $deps;

$this->feature = $feature;

}


(aside from checking if the dependency is in the registry, which however now
anyway will result in a PHP error...)


Best Regards


Karsten Beyer

Re: Question about GadgetFeatureRegistryEntry (PHP)

Posted by Chris Chabot <ch...@xs4all.nl>.
Hmm i think the proper fix for this would be to actually do something  
useful with that php error (like displaying a error message that  
there's a dependency missing), and not remove the internal sanity  
checks :)



On Jun 6, 2008, at 6:33 PM, Karsten Beyer wrote:

>
> (aside from checking if the dependency is in the registry, which  
> however now
> anyway will result in a PHP error...)