protected static function all_fields_str() { $all_keys = \array_filter(\array_keys(\get_class_vars(\get_called_class())), function ($k) { return !\bmtmgr\utils\startswith($k, '_'); }); $tname = static::table_name(); return \implode(', ', \array_map(function ($k) use($tname) { return "{$tname}.{$k} AS {$k}"; }, $all_keys)); }
function detect_props(&$lib) { $url = $lib['url']; if (\bmtmgr\utils\startswith($url, 'git:')) { $lib['type'] = 'git'; $lib['detected_name'] = \bmtmgr\utils\url_basename($url); } elseif (\bmtmgr\utils\endswith($url, '.git')) { $lib['type'] = 'git'; $lib['detected_name'] = \bmtmgr\utils\strip_ext(\bmtmgr\utils\url_basename($url)); } elseif (\bmtmgr\utils\endswith($url, '.zip')) { $lib['type'] = 'zip'; $lib['detected_name'] = \bmtmgr\utils\strip_ext(\bmtmgr\utils\url_basename($url)); } else { $lib['type'] = 'file'; $lib['detected_name'] = \bmtmgr\utils\url_basename($url); } if (!array_key_exists('name', $lib)) { $lib['name'] = $lib['detected_name']; } $lib['fn'] = LIB_ROOT . $lib['name']; }