Skip to content

Instantly share code, notes, and snippets.

@MirkoBonadei
Last active December 15, 2015 10:19
Show Gist options
  • Save MirkoBonadei/5245188 to your computer and use it in GitHub Desktop.
Save MirkoBonadei/5245188 to your computer and use it in GitHub Desktop.
Device-class-before
<?php
class Device
{
private $userAgent;
private $kind;
private $os;
private $devicesDatabase;
public function __construct($userAgent, $devicesDatabase)
{
$this->userAgent = $userAgent;
$this->devicesDatabase = $devicesDatabase;
}
public function os()
{
// some code to retrieve OS from $this->devicesDatabase
}
public function kind()
{
// some code to retrieve the kind of the Device from $this->devicesDatabase
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment