<commit_before><?php
namespace wcf\data\article;
use wcf\data\article\category\ArticleCategory;
use wcf\system\WCF;

/**
 * Represents a list of articles in a specific category.
 *
 * @author	<NAME>
 * @copyright	2001-2018 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\Data\Article
 * @since	3.0
 */
class CategoryArticleList extends AccessibleArticleList {
	/** @noinspection PhpMissingParentConstructorInspection */
	/**
	 * Creates a new CategoryArticleList object.
	 *
	 * @param	integer         $categoryID
	 * @param       boolean         $includeChildCategories
	 * @throws      \InvalidArgumentException
	 */
	public function __construct($categoryID, $includeChildCategories = false) {
		ViewableArticleList::__construct();
		
		$categoryIDs = [$categoryID];
		if ($includeChildCategories) {
			$category = ArticleCategory::getCategory($categoryID);
			if ($category === null) {
				throw new \InvalidArgumentException("invalid category id '".$categoryID."' given");
			}
			foreach ($category->getAllChildCategories() as $category) {
				if ($category->isAccessible()) {
					$categoryIDs[] = $category->categoryID;
				}
			}
		}
		
		$this->getConditionBuilder()->add('article.categoryID IN (?)', [$categoryIDs]);
		$this->getConditionBuilder()->add('article.publicationStatus = ?', [Article::PUBLISHED]);
		
		if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) {
			$this->getConditionBuilder()->add('article.isDeleted = ?', [0]);
		}
	}
}<commit_msg>Allow multiple categories in CategoryArticleList as first parameter See #2642<commit_after><?php
namespace wcf\data\article;
use wcf\data\article\category\ArticleCategory;
use wcf\system\WCF;

/**
 * Represents a list of articles in a specific category.
 *
 * @author	<NAME>
 * @copyright	2001-2018 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\Data\Article
 * @since	3.0
 */
class CategoryArticleList extends AccessibleArticleList {
	/** @noinspection PhpMissingParentConstructorInspection */
	/**
	 * Creates a new CategoryArticleList object.
	 *
	 * @param	integer[]       $categoryID
	 * @param       boolean         $includeChildCategories
	 * @throws      \InvalidArgumentException
	 */
	public function __construct($categoryID, $includeChildCategories = false) {
		ViewableArticleList::__construct();
		
		if (!is_array($categoryID)) {
			$categoryIDs = $fetchChildCategories = [$categoryID];
		}
		else {
			$categoryIDs = $fetchChildCategories = $categoryID;
		}
		
		if ($includeChildCategories) {
			foreach ($fetchChildCategories as $categoryID) {
				$category = ArticleCategory::getCategory($categoryID);
				if ($category === null) {
					throw new \InvalidArgumentException("invalid category id '".$categoryID."' given");
				}
				foreach ($category->getAllChildCategories() as $category) {
					if ($category->isAccessible()) {
						$categoryIDs[] = $category->categoryID;
					}
				}
			}
		}
		
		$this->getConditionBuilder()->add('article.categoryID IN (?)', [$categoryIDs]);
		$this->getConditionBuilder()->add('article.publicationStatus = ?', [Article::PUBLISHED]);
		
		if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) {
			$this->getConditionBuilder()->add('article.isDeleted = ?', [0]);
		}
	}
}
{'fraction_non_alphanumeric': 0.14298194525334887, 'fraction_numerical': 0.007571345369831101, 'mean_word_length': 4.350467289719626, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7060559', 'n_tokens_mistral': 1156, 'n_tokens_neox': 973, 'n_words': 202}