Skip to content

Instantly share code, notes, and snippets.

@lesstif
Created August 10, 2020 04:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesstif/f813793d312d9de83646ac0cd386f54a to your computer and use it in GitHub Desktop.
Save lesstif/f813793d312d9de83646ac0cd386f54a to your computer and use it in GitHub Desktop.
PHP mockery logic class.
<?php
namespace App;
class Temperature
{
private $service;
public function __construct($service)
{
$this->service = $service;
}
public function average()
{
$total = 0;
$count = $this->service->count();
for ($i = 0; $i < $count; $i++) {
$total += $this->service->readTemp();
}
return ($total / $count);
}
}
@lesstif
Copy link
Author

lesstif commented Aug 10, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment