public static function getLinkator() { $items = func_get_args(); if (count($items) == 1 && is_array($items[0])) { //входящие параметры переданы массивом $items = $items[0]; } $relations = array(); foreach ($items as $key => $item) { $itemName = self::getItemName($item); $items[$key] = $itemName; self::initStructure(self::getClassName($itemName)); $relations[] = array_keys(Lms_Item_Relations::getAll($itemName)); } //Находим место пересечения связей $intersection = call_user_func_array('array_intersect', $relations); if (count($intersection) == 0) { throw new Lms_Item_Exception("Relation between " . implode(', ', $items) . " not found"); } if (count($intersection) > 1) { throw new Lms_Item_Exception("Ambiguity relations between " . implode(', ', $items)); } //Получаем имя линкатора $linkatorName = reset($intersection); return $linkatorName; }