for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Copyright (c) 2014, Tobia De Koninck hey--at--ledfan.be
* This file is licensed under the AGPL version 3 or later.
* See the COPYING file.
*/
namespace OCA\Chat\OCH\Data;
use \OCA\Chat\OCH\ChatAPI;
use \OCA\Chat\App\Chat;
use \OCA\Chat\OCH\Db\UserMapper;
class GetUsers extends ChatAPI {
* @var $userMapper \OCA\Chat\OCH\Db\UserMapper
private $userMapper;
public function __construct(
Chat $app,
UserMapper $userMapper
){
$this->app = $app;
app
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->userMapper = $userMapper;
}
/*
* @param $requestData['user'] String user id of the client
* @param $requestData['convid'] String session_id of the client
public function setRequestData(array $requestData){
$this->requestData = $requestData;
public function execute(){
$contacts = $this->app->getContacts();
$contacts = $contacts['contactsObj'];
$users = $this->userMapper->findUsersInConv($this->requestData['conv_id']);
$return = array();
foreach($users as $user){
$return[] = $contacts[$user];
// Note: users are full contacts
return array("users" => $return);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: