PHP Classes

Detail about design your code

Recommend this page to a friend!

      uClassDir  >  All threads  >  Detail about design your code  >  (Un) Subscribe thread alerts  
Subject:Detail about design your code
Summary:I would like to discuss with you some points this class
Messages:6
Author:Bogdan
Date:2009-08-01 08:48:35
Update:2009-08-01 13:32:30
 

  1. Detail about design your code   Reply   Report abuse  
Picture of Bogdan Bogdan - 2009-08-01 08:48:36
I have some questions (if you don't mind):

As I understand from the code, your class use a globals variable?
Or it's imitation? Nothing specific, just name.

  2. Re: Detail about design your code   Reply   Report abuse  
Picture of Bogdan Bogdan - 2009-08-01 09:18:29 - In reply to message 1 from Bogdan
I have error when processing your script (without change the source code)
/**
* Wrong directory adress when conferment
*@see core/uclassdir.class#recreate
*/
$this->docroot = $_SERVER['DOCUMENT_ROOT'].'/';

It's my $_SERVER['DOCUMENT_ROOT'] = /home/bogdan/workspace/testing/; if you can see this parameter already contains the symbol slash in the end.

So I get the wrong the line of address
$this->docroot = /home/bogdan/workspace/testing//

And I get

UnexpectedValueException: RecursiveDirectoryIterator::__construct(/home/bogdan/workspace/testing//core) [recursivedirectoryiterator.--construct]: failed to open dir: No such file or directory in /home/bogdan/workspace/testing/classesload/core/uclassdir.class on line 46

Perhaps you are right in that approach, but it seems failed to take into account, what main script can be located not in the root catalog.

  3. Re: Detail about design your code   Reply   Report abuse  
Picture of Bogdan Bogdan - 2009-08-01 09:33:17 - In reply to message 2 from Bogdan
Next bug :D : you forgot add file with class "RecursiveDirectoryIterator" to the "core" dir.

  4. Re: Detail about design your code   Reply   Report abuse  
Picture of Epsilon Alexey Epsilon Alexey - 2009-08-01 13:22:38 - In reply to message 1 from Bogdan
Thank you for you comments.

Yes, it using $GLOBALS[] as one of possible methods to transfer data from one (included) file to another. Of course, it may be static class with config data in the property and then using it like (for example) uConfig::$conf['core']['somedata']. It will work too.

  5. Re: Detail about design your code   Reply   Report abuse  
Picture of Epsilon Alexey Epsilon Alexey - 2009-08-01 13:26:52 - In reply to message 2 from Bogdan
Thank you for reporting this bug.

Actually, $_SERVER['DOCUMENT_ROOT'] is the copy of server's (Apache) config value of DocumentRoot property. So you can set it to "C:/www" or "C:/www/" - both is right. But, you right, uClassDir MUST have tolerance to it.

I will update class file very soon.

  6. Re: Detail about design your code   Reply   Report abuse  
Picture of Epsilon Alexey Epsilon Alexey - 2009-08-01 13:32:30 - In reply to message 3 from Bogdan
No, it is not a bug. RecursiveDirectoryIterator is the integrated part of Standard PHP Library and has included in PHP core since PHP5.0. See PHP documentation, please.