-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved harvesting and added card class
- Loading branch information
Showing
6 changed files
with
224 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
class card | ||
{ | ||
//An associative array representing a single card | ||
// The keys are card properties such as flavor_text | ||
private $c; | ||
|
||
//Initialise to db object (or just pass in null) | ||
function __construct($fetchedArray) { | ||
$this->c = null; | ||
if (isset($fetchedArray)){ | ||
foreach ($fetchedArray as $key => $value){ | ||
if ($value){ | ||
$this->set($key, $value); | ||
} | ||
} | ||
} | ||
$this->clear_error(); | ||
} | ||
|
||
function set($property, $value){ | ||
$this->c[$property] = $value; | ||
} | ||
function get($property){ | ||
return $this->c[$property]; | ||
} | ||
function has($property){ | ||
return isset($this->c[$property]); | ||
} | ||
function json(){ | ||
return json_encode($this->c); | ||
} | ||
|
||
function set_error($e){ | ||
if ($this->no_error()){ | ||
$this->c['error'] = $e; | ||
} | ||
} | ||
function clear_error(){ | ||
unset($this->c['error']); | ||
} | ||
function no_error(){ | ||
return empty($this->c['error']); | ||
} | ||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
alter table mtg_cards | ||
modify column name varchar(141) not null | ||
|
||
alter table mtg_cards | ||
modify column name varchar(500) not null |
Oops, something went wrong.