예제 #1
0
 /**
  * Builds the fields to insert for the given call and project
  * 
  * @param PC_Obj_Call $call the call
  * @param PC_Project $project the project
  * @return array an associative array with the fields
  */
 private function build_fields($call, $project)
 {
     $args = serialize($call->get_arguments());
     if (strlen($args) > self::MAX_ARGS_LEN) {
         $arglist = array();
         foreach ($call->get_arguments() as $arg) {
             $arg->clear_values();
             $arglist[] = $arg;
         }
         $args = serialize($arglist);
     }
     return array('project_id' => $project !== null ? $project->get_id() : 0, 'file' => $call->get_file(), 'line' => $call->get_line(), 'function' => $call->get_function(), 'class' => $call->get_class() === null ? null : $call->get_class(), 'static' => $call->is_static() ? 1 : 0, 'objcreation' => $call->is_object_creation() ? 1 : 0, 'arguments' => $args);
 }
예제 #2
0
 /**
  * Builds an instance of PC_Project from the given row
  *
  * @param array $row the row from db
  * @param boolean $full whether to fetch data from other tables
  * @return PC_Project the project
  */
 private function build_project($row, $full)
 {
     if (!$row) {
         return null;
     }
     $db = FWS_Props::get()->db();
     $proj = new PC_Project($row['id'], $row['name'], $row['created'], $row['type_folders'], $row['type_exclude'], $row['stmt_folders'], $row['stmt_exclude'], $row['report_argret_strictly']);
     if ($full) {
         $stmt = $db->get_prepared_statement('SELECT * FROM ' . PC_TB_PROJECT_DEPS . ' WHERE project_id = :id');
         $stmt->bind(':id', $row['id']);
         $deps = $db->get_rows($stmt->get_statement());
         foreach ($deps as $d) {
             $proj->add_project_dep($d['dep_id']);
         }
         $stmt = $db->get_prepared_statement('SELECT * FROM ' . PC_TB_REQUIREMENTS . ' WHERE project_id = :id');
         $stmt->bind(':id', $row['id']);
         $req = $db->get_rows($stmt->get_statement());
         foreach ($req as $v) {
             $proj->add_req($v['id'], $v['type'], $v['name'], $v['version']);
         }
     }
     return $proj;
 }