# Class AlphaMetrics

Utility class for calcualting some software metics related to a project

Package: alpha::util::metrics
Copyright: Copyright (c) 2012, John Collins (founder of Alpha Framework). All rights reserved.

    Redistribution and use in source and binary forms, with or
    without modification, are permitted provided that the
    following conditions are met:

    * Redistributions of source code must retain the above
      copyright notice, this list of conditions and the
      following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the
      following disclaimer in the documentation and/or other
      materials provided with the distribution.
    * Neither the name of the Alpha Framework nor the names
      of its contributors may be used to endorse or promote
      products derived from this software without specific
      prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License: The BSD License
Author: John Collins <dev@alphaframework.org>
Version: $Id: AlphaMetrics.inc 1496 2012-02-12 20:32:21Z alphadev $
Since: 1.0
Located at util/metrics/AlphaMetrics.inc

Methods summary
`public` | # `__construct( string $rootDir = '.' )` Constructor, default $rootDir is . Constructor, default $rootDir is . #### Parameters $rootDir `string` $rootDir #### Since 1.0
`public` | # `calculateLOC( )` Calculates the Lines of Code (LOC) Calculates the Lines of Code (LOC) #### Since 1.0
`public string` | # `resultsToHTML( )` Generates a HTML table containing the metrics results Generates a HTML table containing the metrics results #### Returns `string` #### Since 1.0
`private integer` | # `disregardCommentsLOC( string $sourceFile )` Filters comments from LOC metric Filters comments from LOC metric #### Parameters $sourceFile `string` $sourceFile #### Returns `integer` #### Since 1.0

Properties summary
`private string` | $rootDir | `` | # The directory to begin the calculations from The directory to begin the calculations from #### Since 1.0
`private array` | $includeFileTypes | `array('.php', '.ini', '.html', '.phtml', '.inc', '.js', '.css', '.xml')` | # The file extensions of the file types to include in the calculations The file extensions of the file types to include in the calculations #### Since 1.0
`private array` | $excludeSubDirectories | `array('cache','lib','docs','attachments','dist')` | # Any sub-directories which you might want to exclude from the calculations Any sub-directories which you might want to exclude from the calculations #### Since 1.0
`private integer` | $TLOC | `0` | # The Total Lines of Code (TLOC) for the project The Total Lines of Code (TLOC) for the project #### Since 1.0
`private integer` | $TLOCLessComments | `0` | # The Total Lines of Code (TLOC) for the project, less comments defined in $comments The Total Lines of Code (TLOC) for the project, less comments defined in $comments #### Since 1.0
`private integer` | $fileCount | `0` | # The count of the source code files in the project The count of the source code files in the project #### Since 1.0
`private array` | $filesLOCResult | `array()` | # An array of fileName => lines of code to be populated by this class An array of fileName => lines of code to be populated by this class #### Since 1.0
`private array` | $filesLOCNoCommentsResult | `array()` | # An array of fileName => lines of code to be populated by this class, excluding comment lines defined in the $comments array An array of fileName => lines of code to be populated by this class, excluding comment lines defined in the $comments array #### Since 1.0
`private array` | $files | `array()` | # An array of the source code file names in the project An array of the source code file names in the project #### Since 1.0
`private array` | $directories | `array()` | # An array of the directories in the project An array of the directories in the project #### Since 1.0
`private array` | $comments | `array('/','*','#')` | # An array of the first characters of a comment line in source code An array of the first characters of a comment line in source code #### Since 1.0