Skip to content

Commit

Permalink
Day of week data
Browse files Browse the repository at this point in the history
  • Loading branch information
jarofgreen committed Apr 2, 2011
1 parent 1b36cc9 commit 1921607
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/CreepyCoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
print(count($dataManager->getData()));

require dirname(__FILE__).DIRECTORY_SEPARATOR.'WriteHourOfDayData.php';

$dataManager->writeData(new WriteHourOfDayData(array()));

require dirname(__FILE__).DIRECTORY_SEPARATOR.'WriteDayOfWeekData.php';
$dataManager->writeData(new WriteDayOfWeekData(array()));

35 changes: 35 additions & 0 deletions src/WriteDayOfWeekData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Copyright (C) 2011 James (james at jarofgreen dot co dot uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/


class WriteDayOfWeekData extends BaseWriteClass {

public function write() {

$data = array();
$data['Sun'] = $data['Mon'] = $data['Tue'] = $data['Wed'] = $data['Thu'] = $data['Fri'] = $data['Sat'] = 0;

foreach($this->dataManager->getData() as $item) {
$data[$item->getDateTimeAs('D')]++;
}

print_r($data);
}

}

0 comments on commit 1921607

Please sign in to comment.