I don`t have time to investigate right now, but I certainly will in the morning (unless you feel like doing a bit more poking around)
phpSoCo, for counting php lines of code
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
Statistic Value
--------------------------------------------------
- Total Files 1
- Total Lines 1
- Total Characters 5030
- Average Lines 1
- Average Characters 5030
- Total Classes 0
- Total Functions 0
Applied Filters
--------------------------------------------------
- A_Utility_Loc_Filter_RemoveNonPHP
- A_Utility_Loc_Filter_RemoveBlank
- A_Utility_Loc_Filter_RemoveComment
- A_Utility_Loc_Filter_RemoveOpenBrace
Loaded Files
--------------------------------------------------
No filesCode: Select all
$linecount = new A_Utility_Loc();
#$linecount->addSource(new A_Utility_Loc_Iterator_Directory('C:\apache2\apache2\htdocs\smp\class'));
$linecount->addSource(new A_Utility_Loc_Iterator_File('C:\apache2\apache2\htdocs\smp\class\hash_base.php'));
$linecount->addFilter(new A_Utility_Loc_Filter_RemoveNonPHP);
$linecount->addFilter(new A_Utility_Loc_Filter_RemoveBlank);
$linecount->addFilter(new A_Utility_Loc_Filter_RemoveComment);
$linecount->addFilter(new A_Utility_Loc_Filter_RemoveOpenBrace);
$linecount->addCounter(new A_Utility_Loc_Counter_TotalFiles, 'Total Files');
$linecount->addCounter(new A_Utility_Loc_Counter_TotalLines, 'Total Lines');
$linecount->addCounter(new A_Utility_Loc_Counter_TotalCharacters, 'Total Characters');
$linecount->addCounter(new A_Utility_Loc_Counter_AverageLines, 'Average Lines');
$linecount->addCounter(new A_Utility_Loc_Counter_AverageCharacters, 'Average Characters');
$linecount->addCounter(new A_Utility_Loc_Counter_TotalClasses, 'Total Classes');
$linecount->addCounter(new A_Utility_Loc_Counter_TotalFunctions, 'Total Functions');
echo '<pre>' . $linecount->report(new A_Utility_Loc_Reporter_CLI) . '</pre>';Code: Select all
C:\Users\scott>php -r "var_dump($a = is_file('c:\apache2\apache2\htdocs\smp\clas
s\hash_base.php'));"
bool(true)
C:\Users\scott>Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Good catch!
I've patched this method in A/Utility/Loc/Iterator.php
I've patched this method in A/Utility/Loc/Iterator.php
Code: Select all
protected function getFileContents($filepath)
{
return str_replace(array("\r\n", "\r"), PHP_EOL, file_get_contents($filepath));
}I don't think that's going to workJcart wrote:Good catch!
I've patched this method in A/Utility/Loc/Iterator.php
Code: Select all
protected function getFileContents($filepath) { return str_replace(array("\r\n", "\r"), PHP_EOL, file_get_contents($filepath)); }
You could either
Code: Select all
return str_replace(array("\r\n", "\r", "\n"), PHP_EOL, file_get_contents($filepath));Code: Select all
return str_replace(array_diff(array("\r\n", "\r", "\n"), array(PHP_EOL)), PHP_EOL, file_get_contents($filepath));Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
look at that
scottayy's coding critique became JCart's coding critique
Sorry about that.. just thought I'd share an inconvenience I had in my library.
There's an oodle of parts of your code I don't understand. And to be quite honest, I'm tired of learning the way I have been learning. Trial & error, going into it blindly. I think I'd like a hardcover PHP OOP book, so I could sit back and soak in the ideas before blindly coding a mess that I think is nice.
There's an oodle of parts of your code I don't understand. And to be quite honest, I'm tired of learning the way I have been learning. Trial & error, going into it blindly. I think I'd like a hardcover PHP OOP book, so I could sit back and soak in the ideas before blindly coding a mess that I think is nice.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Again, appologies for the thread derailment, I had a feeling this would happen .. hense my appology earlierscottayy wrote:look at thatscottayy's coding critique became JCart's coding critique
Sorry about that.. just thought I'd share an inconvenience I had in my library.
There's an oodle of parts of your code I don't understand. And to be quite honest, I'm tired of learning the way I have been learning. Trial & error, going into it blindly. I think I'd like a hardcover PHP OOP book, so I could sit back and soak in the ideas before blindly coding a mess that I think is nice.
Feel free to ask any questions about the code, or the theory behind it. I would be happy to chat on a messenger as well if you think that will help.
But yes, you should certainly should find a book. They help oh so much.
Recommendations for PHP OOP? I'd like reading -- with examples of usage -- but I'm not so much into the thing where you copy and paste code examples on your computer. I'd like a book for just reading with usage examples.Jcart wrote:Again, appologies for the thread derailment, I had a feeling this would happen .. hense my appology earlierscottayy wrote:look at thatscottayy's coding critique became JCart's coding critique
Sorry about that.. just thought I'd share an inconvenience I had in my library.
There's an oodle of parts of your code I don't understand. And to be quite honest, I'm tired of learning the way I have been learning. Trial & error, going into it blindly. I think I'd like a hardcover PHP OOP book, so I could sit back and soak in the ideas before blindly coding a mess that I think is nice.
Feel free to ask any questions about the code, or the theory behind it. I would be happy to chat on a messenger as well if you think that will help.
But yes, you should certainly should find a book. They help oh so much.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
A good place to start is this freely available book online
PHP5 Power Programming
Then..
PHP5 Power Programming
Then..
sweatje wrote:Here was a list of Book References I put into my book:
• GoF - Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1995.
• PoEAA - Martin Fowler Patterns of Enterprise Application Architecture Addison-Wesley, 2003.
• Harry Fuecks, PHP Anthology: Object Oriented PHP Solutions, SitePoint Pty. Lt., 2003
• Allen Holub, Holub on Patterns: Learning Design Patterns by Looking at Code, Apress, 2004.
• Robert Martin, Agile Software Development, Prentice Hall, 2003.
• Clifton Nock, Data Access Patterns, Addison-Wesley, 2004.
• George Schlossnagle, Advanced PHP Programming, SAMS, 2004
• Alan Shalloway and James R. Trott, Design Patterns Explained, Addison-Wesley, 2005
• Rebecca Wirfs-Brock and Alan McKean, Roles, Responsibilities and Collaborations, Addison-Wesley, 2003.
• Matt Zandstra, PHP 5 Objects, Patterns, Practice, Apress, 2004.
Clearly not all of these are PHP only, but they are all great books for improving your overall programming knowledge.