| @@ 70-86 (lines=17) @@ | ||
| 67 | * the ID of the user to retrieve |
|
| 68 | * @return \DataSift\Stone\ObjectLib\BaseObject |
|
| 69 | */ |
|
| 70 | public function getUser($userId) |
|
| 71 | { |
|
| 72 | // what are we doing? |
|
| 73 | $log = Log::usingLog()->startAction("get user ID '{$userId}'"); |
|
| 74 | ||
| 75 | // do we have this user? |
|
| 76 | $users = $this->st->getTestUsers(); |
|
| 77 | if (!isset($users->$userId)) { |
|
| 78 | $msg = "user ID '{$userId}' not found"; |
|
| 79 | $log->endAction($msg); |
|
| 80 | throw Exceptions::newActionFailedException($msg); |
|
| 81 | } |
|
| 82 | ||
| 83 | // all done |
|
| 84 | $log->endAction($users->$userId); |
|
| 85 | return $users->$userId; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * generates a random password of the requested length |
|
| @@ 120-140 (lines=21) @@ | ||
| 117 | * the name of the group that we want |
|
| 118 | * @return BaseObject |
|
| 119 | */ |
|
| 120 | public function getGroupFromTable($group) |
|
| 121 | { |
|
| 122 | // get our table name from the constructor |
|
| 123 | $tableName = $this->args[0]; |
|
| 124 | ||
| 125 | // what are we doing? |
|
| 126 | $log = Log::usingLog()->startAction("get '{$tableName}->{$group}' table group from runtime config"); |
|
| 127 | ||
| 128 | // get the table |
|
| 129 | $table = $this->getTable(); |
|
| 130 | ||
| 131 | // make sure we have a group |
|
| 132 | if (!isset($table->$group)) { |
|
| 133 | $log->writeToLog("'{$group}' does not exist; creating"); |
|
| 134 | $table->$group = new BaseObject; |
|
| 135 | } |
|
| 136 | ||
| 137 | // all done |
|
| 138 | $log->endAction(); |
|
| 139 | return $table->$group; |
|
| 140 | } |
|
| 141 | ||
| 142 | /** |
|
| 143 | * Get the value of a specific key |
|