You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

composer.phar 2.9MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896121897121898121899121900121901121902121903121904121905121906121907121908121909121910121911121912121913121914121915121916121917121918121919121920121921121922121923121924121925121926121927121928121929121930121931121932121933121934121935121936121937121938121939121940121941121942121943121944121945121946121947121948121949121950121951121952121953121954121955121956121957121958121959121960121961121962121963121964121965121966121967121968121969121970121971121972121973121974121975121976121977121978121979121980121981121982121983121984121985121986121987121988121989121990121991121992121993121994121995121996121997121998121999122000122001122002122003122004122005122006122007122008122009122010122011122012122013122014122015122016122017122018122019122020122021122022122023122024122025122026122027122028122029122030122031122032122033122034122035122036122037122038122039122040122041122042122043122044122045122046122047122048122049122050122051122052122053122054122055122056122057122058122059122060122061122062122063122064122065122066122067122068122069122070122071122072122073122074122075122076122077122078122079122080122081122082122083122084122085122086122087122088122089122090122091122092122093122094122095122096122097122098122099122100122101122102122103122104122105122106122107122108122109122110122111122112122113122114122115122116122117122118122119122120122121122122122123122124122125122126122127122128122129122130122131122132122133122134122135122136122137122138122139122140122141122142122143122144122145122146122147122148122149122150122151122152122153122154122155122156122157122158122159122160122161122162122163122164122165122166122167122168122169122170122171122172122173122174122175122176122177122178122179122180122181122182122183122184122185122186122187122188122189122190122191122192122193122194122195122196122197122198122199122200122201122202122203122204122205122206122207122208122209122210122211122212122213122214122215122216122217122218122219122220122221122222122223122224122225122226122227122228122229122230122231122232122233122234122235122236122237122238122239122240122241122242122243122244122245122246122247122248122249122250122251122252122253122254122255122256122257122258122259122260122261122262122263122264122265122266122267122268122269122270122271122272122273122274122275122276122277122278122279122280122281122282122283122284122285122286122287122288122289122290122291122292122293122294122295122296122297122298122299122300122301122302122303122304122305122306122307122308122309122310122311122312122313122314122315122316122317122318122319122320122321122322122323122324122325122326122327122328122329122330122331122332122333122334122335122336122337122338122339122340122341122342122343122344122345122346122347122348122349122350122351122352122353122354122355122356122357122358122359122360122361122362122363122364122365122366122367122368122369122370122371122372122373122374122375122376122377122378122379122380122381122382122383122384122385122386122387122388122389122390122391122392122393122394122395122396122397122398122399122400122401122402122403122404122405122406122407122408122409122410122411122412122413122414122415122416122417122418122419122420122421122422122423122424122425122426122427122428122429122430122431122432122433122434122435122436122437122438122439122440122441122442122443122444122445122446122447122448122449122450122451122452122453122454122455122456122457122458122459122460122461122462122463122464122465122466122467122468122469122470122471122472122473122474122475122476122477122478122479122480122481122482122483122484122485122486122487122488122489122490122491122492122493122494122495122496122497122498122499122500122501122502122503122504122505122506122507122508122509122510122511122512122513122514122515122516122517122518122519122520122521122522122523122524122525122526122527122528122529122530122531122532122533122534122535122536122537122538122539122540122541122542122543122544122545122546122547122548122549122550122551122552122553122554122555122556122557122558122559122560122561122562122563122564122565122566122567122568122569122570122571122572122573122574122575122576122577122578122579122580122581122582122583122584122585122586122587122588122589122590122591122592122593122594122595122596122597122598122599122600122601122602122603122604122605122606122607122608122609122610122611122612122613122614122615122616122617122618122619122620122621122622122623122624122625122626122627122628122629122630122631122632122633122634122635122636122637122638122639122640122641122642122643122644122645122646122647122648122649122650122651122652122653122654122655122656122657122658122659122660122661122662122663122664122665122666122667122668122669122670122671122672122673122674122675122676122677122678122679122680122681122682122683122684122685122686122687122688122689122690122691122692122693122694122695122696122697122698122699122700122701122702122703122704122705122706122707122708122709122710122711122712122713122714122715122716122717122718122719122720122721122722122723122724122725122726122727122728122729122730122731122732122733122734122735122736122737122738122739122740122741122742122743122744122745122746122747122748122749122750122751122752122753122754122755122756122757122758122759122760122761122762122763122764122765122766122767122768122769122770122771122772122773122774122775122776122777122778122779122780122781122782122783122784122785122786122787122788122789122790122791122792122793122794122795122796122797122798122799122800122801122802122803122804122805122806122807122808122809122810122811122812122813122814122815122816122817122818122819122820122821122822122823122824122825122826122827122828122829122830122831122832122833122834122835122836122837122838122839122840122841122842122843122844122845122846122847122848122849122850122851122852122853122854122855122856122857122858122859122860122861122862122863122864122865122866122867122868122869122870122871122872122873122874122875122876122877122878122879122880122881122882122883122884122885122886122887122888122889122890122891122892122893122894122895122896122897122898122899122900122901122902122903122904122905122906122907122908122909122910122911122912122913122914122915122916122917122918122919122920122921122922122923122924122925122926122927122928122929122930122931122932122933122934122935122936122937122938122939122940122941122942122943122944122945122946122947122948122949122950122951122952122953122954122955122956122957122958122959122960122961122962122963122964122965122966122967122968122969122970122971122972122973122974122975122976122977122978122979122980122981122982122983122984122985122986122987122988122989122990122991122992122993122994122995122996122997122998122999123000123001123002123003123004123005123006123007123008123009123010123011123012123013123014123015123016123017123018123019123020123021123022123023123024123025123026123027123028123029123030123031123032123033123034123035123036123037123038123039123040123041123042123043123044123045123046123047123048123049123050123051123052123053123054123055123056123057123058123059123060123061123062123063123064123065123066123067123068123069123070123071123072123073123074123075123076123077123078123079123080123081123082123083123084123085123086123087123088123089123090123091123092123093123094123095123096123097123098123099123100123101123102123103123104123105123106123107123108123109123110123111123112123113123114123115123116123117123118123119123120123121123122123123123124123125123126123127123128123129123130123131123132123133123134123135123136123137123138123139123140123141123142123143123144123145123146123147123148123149123150123151123152123153123154123155123156123157123158123159123160123161123162123163123164123165123166123167123168123169123170123171123172123173123174123175123176123177123178123179123180123181123182123183123184123185123186123187123188123189123190123191123192123193123194123195123196123197123198123199123200123201123202123203123204123205123206123207123208123209123210123211123212123213123214123215123216123217123218123219123220123221123222123223123224123225123226123227123228123229123230123231123232123233123234123235123236123237123238123239123240123241123242123243123244123245123246123247123248123249123250123251123252123253123254123255123256123257123258123259123260123261123262123263123264123265123266123267123268123269123270123271123272123273123274123275123276123277123278123279123280123281123282123283123284123285123286123287123288123289123290123291123292123293123294123295123296123297123298123299123300123301123302123303123304123305123306123307123308123309123310123311123312123313123314123315123316123317123318123319123320123321123322123323123324123325123326123327123328123329123330123331123332123333123334123335123336123337123338123339123340123341123342123343123344123345123346123347123348123349123350123351123352123353123354123355123356123357123358123359123360123361123362123363123364123365123366123367123368123369123370123371123372123373123374123375123376123377123378123379123380123381123382123383123384123385123386123387123388123389123390123391123392123393123394123395123396123397123398123399123400123401123402123403123404123405123406123407123408123409123410123411123412123413123414123415123416123417123418123419123420123421123422123423123424123425123426123427123428123429123430123431123432123433123434123435123436123437123438123439123440123441123442123443123444123445123446123447123448123449123450123451123452123453123454123455123456123457123458123459123460123461123462123463123464123465123466123467123468123469123470123471123472123473123474123475123476123477123478123479123480123481123482123483123484123485123486123487123488123489123490123491123492123493123494123495123496123497123498123499123500123501123502123503123504123505123506123507123508123509123510123511123512123513123514123515123516123517123518123519123520123521123522123523123524123525123526123527123528123529123530123531123532123533123534123535123536123537123538123539123540123541123542123543123544123545123546123547123548123549123550123551123552123553123554123555123556123557123558123559123560123561123562123563123564123565123566123567123568123569123570123571123572123573123574123575123576123577123578123579123580123581123582123583123584123585123586123587123588123589123590123591123592123593123594123595123596123597123598123599123600123601123602123603123604123605123606123607123608123609123610123611123612123613123614123615123616123617123618123619123620123621123622123623123624123625123626123627123628123629123630123631123632123633123634123635123636123637123638123639123640123641123642123643123644123645123646123647123648123649123650123651123652123653123654123655123656123657123658123659123660123661123662123663123664123665123666123667123668123669123670123671123672123673123674123675123676123677123678123679123680123681123682123683123684123685123686123687123688123689123690123691123692123693123694123695123696123697123698123699123700123701123702123703123704123705123706123707123708123709123710123711123712123713123714123715123716123717123718123719123720123721123722123723123724123725123726123727123728123729123730123731123732123733123734123735123736123737123738123739123740123741123742123743123744123745123746123747123748123749123750123751123752123753123754123755123756123757123758123759123760123761123762123763123764123765123766123767123768123769123770123771123772123773123774123775123776123777123778123779123780123781123782123783123784123785123786123787123788123789123790123791123792123793123794123795123796123797123798123799123800123801123802123803123804123805123806123807123808123809123810123811123812123813123814123815123816123817123818123819123820123821123822123823123824123825123826123827123828123829123830123831123832123833123834123835123836123837123838123839123840123841123842123843123844123845123846123847123848123849123850123851123852123853123854123855123856123857123858123859123860123861123862123863123864123865123866123867123868123869123870123871123872123873123874123875123876123877123878123879123880123881123882123883123884123885123886123887123888123889123890123891123892123893123894123895123896123897123898123899123900123901123902123903123904123905123906123907123908123909123910123911123912123913123914123915123916123917123918123919123920123921123922123923123924123925123926123927123928123929123930123931123932123933123934123935123936123937123938123939123940123941123942123943123944123945123946123947123948123949123950123951123952123953123954123955123956123957123958123959123960123961123962123963123964123965123966123967123968123969123970123971123972123973123974123975123976123977123978123979123980123981123982123983123984123985123986123987123988123989123990123991123992123993123994123995123996123997123998123999124000124001124002124003124004124005124006124007124008124009124010124011124012124013124014124015124016124017124018124019124020124021124022124023124024124025124026124027124028124029124030124031124032124033124034124035124036124037124038124039124040124041124042124043124044124045124046124047124048124049124050124051124052124053124054124055124056124057124058124059124060124061124062124063124064124065124066124067124068124069124070124071124072124073124074124075124076124077124078124079124080124081124082124083124084124085124086124087124088124089124090124091124092124093124094124095124096124097124098124099124100124101124102124103124104124105124106124107124108124109124110124111124112124113124114124115124116124117124118124119124120124121124122124123124124124125124126124127124128124129124130124131124132124133124134124135124136124137124138124139124140124141124142124143124144124145124146124147124148124149124150124151124152124153124154124155124156124157124158124159124160124161124162124163124164124165124166124167124168124169124170124171124172124173124174124175124176124177124178124179124180124181124182124183124184124185124186124187124188124189124190124191124192124193124194124195124196124197124198124199124200124201124202124203124204124205124206124207124208124209124210124211124212124213124214124215124216124217124218124219124220124221124222124223124224124225124226124227124228124229124230124231124232124233124234124235124236124237124238124239124240124241124242124243124244124245124246124247124248124249124250124251124252124253124254124255124256124257124258124259124260124261124262124263124264124265124266124267124268124269124270124271124272124273124274124275124276124277124278124279124280124281124282124283124284124285124286124287124288124289124290124291124292124293124294124295124296124297124298124299124300124301124302124303124304124305124306124307124308124309124310124311124312124313124314124315124316124317124318124319124320124321124322124323124324124325124326124327124328124329124330124331124332124333124334124335124336124337124338124339124340124341124342124343124344124345124346124347124348124349124350124351124352124353124354124355124356124357124358124359124360124361124362124363124364124365124366124367124368124369124370124371124372124373124374124375124376124377124378124379124380124381124382124383124384124385124386124387124388124389124390124391124392124393124394124395124396124397124398124399124400124401124402124403124404124405124406124407124408124409124410124411124412124413124414124415124416124417124418124419124420124421124422124423124424124425124426124427124428124429124430124431124432124433124434124435124436124437124438124439124440124441124442124443124444124445124446124447124448124449124450124451124452124453124454124455124456124457124458124459124460124461124462124463124464124465124466124467124468124469124470124471124472124473124474124475124476124477124478124479124480124481124482124483124484124485124486124487124488124489124490124491124492124493124494124495124496124497124498124499124500124501124502124503124504124505124506124507124508124509124510124511124512124513124514124515124516124517124518124519124520124521124522124523124524124525124526124527124528124529124530124531124532124533124534124535124536124537124538124539124540124541124542124543124544124545124546124547124548124549124550124551124552124553124554124555124556124557124558124559124560124561124562124563124564124565124566124567124568124569124570124571124572124573124574124575124576124577124578124579124580124581124582124583124584124585124586124587124588124589124590124591124592124593124594124595124596124597124598124599124600124601124602124603124604124605124606124607124608124609124610124611124612124613124614124615124616124617124618124619124620124621124622124623124624124625124626124627124628124629124630124631124632124633124634124635124636124637124638124639124640124641124642124643124644124645124646124647124648124649124650124651124652124653124654124655124656124657124658124659124660124661124662124663124664124665124666124667124668124669124670124671124672124673124674124675124676124677124678124679124680124681124682124683124684124685124686124687124688124689124690124691124692124693124694124695124696124697124698124699124700124701124702124703124704124705124706124707124708124709124710124711124712124713124714124715124716124717124718124719124720124721124722124723124724124725124726124727124728124729124730124731124732124733124734124735124736124737124738124739124740124741124742124743124744124745124746124747124748124749124750124751124752124753124754124755124756124757124758124759124760124761124762124763124764124765124766124767124768124769124770124771124772124773124774124775124776124777124778124779124780124781124782124783124784124785124786124787124788124789124790124791124792124793124794124795124796124797124798124799124800124801124802124803124804124805124806124807124808124809124810124811124812124813124814124815124816124817124818124819124820124821124822124823124824124825124826124827124828124829124830124831124832124833124834124835124836124837124838124839124840124841124842124843124844124845124846124847124848124849124850124851124852124853124854124855124856124857124858124859124860124861124862124863124864124865124866124867124868124869124870124871124872124873124874124875124876124877124878124879124880124881124882124883124884124885124886124887124888124889124890124891124892124893124894124895124896124897124898124899124900124901124902124903124904124905124906124907124908124909124910124911124912124913124914124915124916124917124918124919124920124921124922124923124924124925124926124927124928124929124930124931124932124933124934124935124936124937124938124939124940124941124942124943124944124945124946124947124948124949124950124951124952124953124954124955124956124957124958124959124960124961124962124963124964124965124966124967124968124969124970124971124972124973124974124975124976124977124978124979124980124981124982124983124984124985124986124987124988124989124990124991124992124993124994124995124996124997124998124999125000125001125002125003125004125005125006125007125008125009125010125011125012125013125014125015125016125017125018125019125020125021125022125023125024125025125026125027125028125029125030125031125032125033125034125035125036125037125038125039125040125041125042125043125044125045125046125047125048125049125050125051125052125053125054125055125056125057125058125059125060125061125062125063125064125065125066125067125068125069125070125071125072125073125074125075125076125077125078125079125080125081125082125083125084125085125086125087125088125089125090125091125092125093125094125095125096125097125098125099125100125101125102125103125104125105125106125107125108125109125110125111125112125113125114125115125116125117125118125119125120125121125122125123125124125125125126125127125128125129125130125131125132125133125134125135125136125137125138125139125140125141125142125143125144125145125146125147125148125149125150125151125152125153125154125155125156125157125158125159125160125161125162125163125164125165125166125167125168125169125170125171125172125173125174125175125176125177125178125179125180125181125182125183125184125185125186125187125188125189125190125191125192125193125194125195125196125197125198125199125200125201125202125203125204125205125206125207125208125209125210125211125212125213125214125215125216125217125218125219125220125221125222125223125224125225125226125227125228125229125230125231125232125233125234125235125236125237125238125239125240125241125242125243125244125245125246125247125248125249125250125251125252125253125254125255125256125257125258125259125260125261125262125263125264125265125266125267125268125269125270125271125272125273125274125275125276125277125278125279125280125281125282125283125284125285125286125287125288125289125290125291125292125293125294125295125296125297125298125299125300125301125302125303125304125305125306125307125308125309125310125311125312125313125314125315125316125317125318125319125320125321125322125323125324125325125326125327125328125329125330125331125332125333125334125335125336125337125338125339125340125341125342125343125344125345125346125347125348125349125350125351125352125353125354125355125356125357125358125359125360125361125362125363125364125365125366125367125368125369125370125371125372125373125374125375125376125377125378125379125380125381125382125383125384125385125386125387125388125389125390125391125392125393125394125395125396125397125398125399125400125401125402125403125404125405125406125407125408125409125410125411125412125413125414125415125416125417125418125419125420125421125422125423125424125425125426125427125428125429125430125431125432125433125434125435125436125437125438125439125440125441125442125443125444125445125446125447125448125449125450125451125452125453125454125455125456125457125458125459125460125461125462125463125464125465125466125467125468125469125470125471125472125473125474125475125476125477125478125479125480125481125482125483125484125485125486125487125488125489125490125491125492125493125494125495125496125497125498125499125500125501125502125503125504125505125506125507125508125509125510125511125512125513125514125515125516125517125518125519125520125521125522125523125524125525125526125527125528125529125530125531125532125533125534125535125536125537125538125539125540125541125542125543125544125545125546125547125548125549125550125551125552125553125554125555125556125557125558125559125560125561125562125563125564125565125566125567125568125569125570125571125572125573125574125575125576125577125578125579125580125581125582125583125584125585125586125587125588125589125590125591125592125593125594125595125596125597125598125599125600125601125602125603125604125605125606125607125608125609125610125611125612125613125614125615125616125617125618125619125620125621125622125623125624125625125626125627125628125629125630125631125632125633125634125635125636125637125638125639125640125641125642125643125644125645125646125647125648125649125650125651125652125653125654125655125656125657125658125659125660125661125662125663125664125665125666125667125668125669125670125671125672125673125674125675125676125677125678125679125680125681125682125683125684125685125686125687125688125689125690125691125692125693125694125695125696125697125698125699125700125701125702125703125704125705125706125707125708125709125710125711125712125713125714125715125716125717125718125719125720125721125722125723125724125725125726125727125728125729125730125731125732125733125734125735125736125737125738125739125740125741125742125743125744125745125746125747125748125749125750125751125752125753125754125755125756125757125758125759125760125761125762125763125764125765125766125767125768125769125770125771125772125773125774125775125776125777125778125779125780125781125782125783125784125785125786125787125788125789125790125791125792125793125794125795125796125797125798125799125800125801125802125803125804125805125806125807125808125809125810125811125812125813125814125815125816125817125818125819125820125821125822125823125824125825125826125827125828125829125830125831125832125833125834125835125836125837125838125839125840125841125842125843125844125845125846125847125848125849125850125851125852125853125854125855125856125857125858125859125860125861125862125863125864125865125866125867125868125869125870125871125872125873125874125875125876125877125878125879125880125881125882125883125884125885125886125887125888125889125890125891125892125893125894125895125896125897125898125899125900125901125902125903125904125905125906125907125908125909125910125911125912125913125914125915125916125917125918125919125920125921125922125923125924125925125926125927125928125929125930125931125932125933125934125935125936125937125938125939125940125941125942125943125944125945125946125947125948125949125950125951125952125953125954125955125956125957125958125959125960125961125962125963125964125965125966125967125968125969125970125971125972125973125974125975125976125977125978125979125980125981125982125983125984125985125986125987125988125989125990125991125992125993125994125995125996125997125998125999126000126001126002126003126004126005126006126007126008126009126010126011126012126013126014126015126016126017126018126019126020126021126022126023126024126025126026126027126028126029126030126031126032126033126034126035126036126037126038126039126040126041126042126043126044126045126046126047126048126049126050126051126052126053126054126055126056126057126058126059126060126061126062126063126064126065126066126067126068126069126070126071126072126073126074126075126076126077126078126079126080126081126082126083126084126085126086126087126088126089126090126091126092126093126094126095126096126097126098126099126100126101126102126103126104126105126106126107126108126109126110126111126112126113126114126115126116126117126118126119126120126121126122126123126124126125126126126127126128126129126130126131126132126133126134126135126136126137126138126139126140126141126142126143126144126145126146126147126148126149126150126151126152126153126154126155126156126157126158126159126160126161126162126163126164126165126166126167126168126169126170126171126172126173126174126175126176126177126178126179126180126181126182126183126184126185126186126187126188126189126190126191126192126193126194126195126196126197126198126199126200126201126202126203126204126205126206126207126208126209126210126211126212126213126214126215126216126217126218126219126220126221126222126223126224126225126226126227126228126229126230126231126232126233126234126235126236126237126238126239126240126241126242126243126244126245126246126247126248126249126250126251126252126253126254126255126256126257126258126259126260126261126262126263126264126265126266126267126268126269126270126271126272126273126274126275126276126277126278126279126280126281126282126283126284126285126286126287126288126289126290126291126292126293126294126295126296126297126298126299126300126301126302126303126304126305126306126307126308126309126310126311126312126313126314126315126316126317126318126319126320126321126322126323126324126325126326126327126328126329126330126331126332126333126334126335126336126337126338126339126340126341126342126343126344126345126346126347126348126349126350126351126352126353126354126355126356126357126358126359126360126361126362126363126364126365126366126367126368126369126370126371126372126373126374126375126376126377126378126379126380126381126382126383126384126385126386126387126388126389126390126391126392126393126394126395126396126397126398126399126400126401126402126403126404126405126406126407126408126409126410126411126412126413126414126415126416126417126418126419126420126421126422126423126424126425126426126427126428126429126430126431126432126433126434126435126436126437126438126439126440126441126442126443126444126445126446126447126448126449126450126451126452126453126454126455126456126457126458126459126460126461126462126463126464126465126466126467126468126469126470126471126472126473126474126475126476126477126478126479126480126481126482126483126484126485126486126487126488126489126490126491126492126493126494126495126496126497126498126499126500126501126502126503126504126505126506126507126508126509126510126511126512126513126514126515126516126517126518126519126520126521126522126523126524126525126526126527126528126529126530126531126532126533126534126535126536126537126538126539126540126541126542126543126544126545126546126547126548126549126550126551126552126553126554126555126556126557126558126559126560126561126562126563126564126565126566126567126568126569126570126571126572126573126574126575126576126577126578126579126580126581126582126583126584126585126586126587126588126589126590126591126592126593126594126595126596126597126598126599126600126601126602126603126604126605126606126607126608126609126610126611126612126613126614126615126616126617126618126619126620126621126622126623126624126625126626126627126628126629126630126631126632126633126634126635126636126637126638126639126640126641126642126643126644126645126646126647126648126649126650126651126652126653126654126655126656126657126658126659126660126661126662126663126664126665126666126667126668126669126670126671126672126673126674126675126676126677126678126679126680126681126682126683126684126685126686126687126688126689126690126691126692126693126694126695126696126697126698126699126700126701126702126703126704126705126706126707126708126709126710126711126712126713126714126715126716126717126718126719126720126721126722126723126724126725126726126727126728126729126730126731126732126733126734126735126736126737126738126739126740126741126742126743126744126745126746126747126748126749126750126751126752126753126754126755126756126757126758126759126760126761126762126763126764126765126766126767126768126769126770126771126772126773126774126775126776126777126778126779126780126781126782126783126784126785126786126787126788126789126790126791126792126793126794126795126796126797126798126799126800126801126802126803126804126805126806126807126808126809126810126811126812126813126814126815126816126817126818126819126820126821126822126823126824126825126826126827126828126829126830126831126832126833126834126835126836126837126838126839126840126841126842126843126844126845126846126847126848126849126850126851126852126853126854126855126856126857126858126859126860126861126862126863126864126865126866126867126868126869126870126871126872126873126874126875126876126877126878126879126880126881126882126883126884126885126886126887126888126889126890126891126892126893126894126895126896126897126898126899126900126901126902126903126904126905126906126907126908126909126910126911126912126913126914126915126916126917126918126919126920126921126922126923126924126925126926126927126928126929126930126931126932126933126934126935126936126937126938126939126940126941126942126943126944126945126946126947126948126949126950126951126952126953126954126955126956126957126958126959126960126961126962126963126964126965126966126967126968126969126970126971126972126973126974126975126976126977126978126979126980126981126982126983126984126985126986126987126988126989126990126991126992126993126994126995126996126997126998126999127000127001127002127003127004127005127006127007127008127009127010127011127012127013127014127015127016127017127018127019127020127021127022127023127024127025127026127027127028127029127030127031127032127033127034127035127036127037127038127039127040127041127042127043127044127045127046127047127048127049127050127051127052127053127054127055127056127057127058127059127060127061127062127063127064127065127066127067127068127069127070127071127072127073127074127075127076127077127078127079127080127081127082127083127084127085127086127087127088127089127090127091127092127093127094127095127096127097127098127099127100127101127102127103127104127105127106127107127108127109127110127111127112127113127114127115127116127117127118127119127120127121127122127123127124127125127126127127127128127129127130127131127132127133127134127135127136127137127138127139127140127141127142127143127144127145127146127147127148127149127150127151127152127153127154127155127156127157127158127159127160127161127162127163127164127165127166127167127168127169127170127171127172127173127174127175127176127177127178127179127180127181127182127183127184127185127186127187127188127189127190127191127192127193127194127195127196127197127198127199127200127201127202127203127204127205127206127207127208127209127210127211127212127213127214127215127216127217127218127219127220127221127222127223127224127225127226127227127228127229127230127231127232127233127234127235127236127237127238127239127240127241127242127243127244127245127246127247127248127249127250127251127252127253127254127255127256127257127258127259127260127261127262127263127264127265127266127267127268127269127270127271127272127273127274127275127276127277127278127279127280127281127282127283127284127285127286127287127288127289127290127291127292127293127294127295127296127297127298127299127300127301127302127303127304127305127306127307127308127309127310127311127312127313127314127315127316127317127318127319127320127321127322127323127324127325127326127327127328127329127330127331127332127333127334127335127336127337127338127339127340127341127342127343127344127345127346127347127348127349127350127351127352127353127354127355127356127357127358127359127360127361127362127363127364127365127366127367127368127369127370127371127372127373127374127375127376127377127378127379127380127381127382127383127384127385127386127387127388127389127390127391127392127393127394127395127396127397127398127399127400127401127402127403127404127405127406127407127408127409127410127411127412127413127414127415127416127417127418127419127420127421127422127423127424127425127426127427127428127429127430127431127432127433127434127435127436127437127438127439127440127441127442127443127444127445127446127447127448127449127450127451127452127453127454127455127456127457127458127459127460127461127462127463127464127465127466127467127468127469127470127471127472127473127474127475127476127477127478127479127480127481127482127483127484127485127486127487127488127489127490127491127492127493127494127495127496127497127498127499127500127501127502127503127504127505127506127507127508127509127510127511127512127513127514127515127516127517127518127519127520127521127522127523127524127525127526127527127528127529127530127531127532127533127534127535127536127537127538127539127540127541127542127543127544127545127546127547127548127549127550127551127552127553127554127555127556127557127558127559127560127561127562127563127564127565127566127567127568127569127570127571127572127573127574127575127576127577127578127579127580127581127582127583127584127585127586127587127588127589127590127591127592127593127594127595127596127597127598127599127600127601127602127603127604127605127606127607127608127609127610127611127612127613127614127615127616127617127618127619127620127621127622127623127624127625127626127627127628127629127630127631127632127633127634127635127636127637127638127639127640127641127642127643127644127645127646127647127648127649127650127651127652127653127654127655127656127657127658127659127660127661127662127663127664127665127666127667127668127669127670127671127672127673127674127675127676127677127678127679127680127681127682127683127684127685127686127687127688127689127690127691127692127693127694127695127696127697127698127699127700127701127702127703127704127705127706127707127708127709127710127711127712127713127714127715127716127717127718127719127720127721127722127723127724127725127726127727127728127729127730127731127732127733127734127735127736127737127738127739127740127741127742127743127744127745127746127747127748127749127750127751127752127753127754127755127756127757127758127759127760127761127762127763127764127765127766127767127768127769127770127771127772127773127774127775127776127777127778127779127780127781127782127783127784127785127786127787127788127789127790127791127792127793127794127795127796127797127798127799127800127801127802127803127804127805127806127807127808127809127810127811127812127813127814127815127816127817127818127819127820127821127822127823127824127825127826127827127828127829127830127831127832127833127834127835127836127837127838127839127840127841127842127843127844127845127846127847127848127849127850127851127852127853127854127855127856127857127858127859127860127861127862127863127864127865127866127867127868127869127870127871127872127873127874127875127876127877127878127879127880127881127882127883127884127885127886127887127888127889127890127891127892127893127894127895127896127897127898127899127900127901127902127903127904127905127906127907127908127909127910127911127912127913127914127915127916127917127918127919127920127921127922127923127924127925127926127927127928127929127930127931127932127933127934127935127936127937127938127939127940127941127942127943127944127945127946127947127948127949127950127951127952127953127954127955127956127957127958127959127960127961127962127963127964127965127966127967127968127969127970127971127972127973127974127975127976127977127978127979127980127981127982127983127984127985127986127987127988127989127990127991127992127993127994127995127996127997127998127999128000128001128002128003128004128005128006128007128008128009128010128011128012128013128014128015128016128017128018128019128020128021128022128023128024128025128026128027128028128029128030128031128032128033128034128035128036128037128038128039128040128041128042128043128044128045128046128047128048128049128050128051128052128053128054128055128056128057128058128059128060128061128062128063128064128065128066128067128068128069128070128071128072128073128074128075128076128077128078128079128080128081128082128083128084128085128086128087128088128089128090128091128092128093128094128095128096128097128098128099128100128101128102128103128104128105128106128107128108128109128110128111128112128113128114128115128116128117128118128119128120128121128122128123128124128125128126128127128128128129128130128131128132128133128134128135128136128137128138128139128140128141128142128143128144128145128146128147128148128149128150128151128152128153128154128155128156128157128158128159128160128161128162128163128164128165128166128167128168128169128170128171128172128173128174128175128176128177128178128179128180128181128182128183128184128185128186128187128188128189128190128191128192128193128194128195128196128197128198128199128200128201128202128203128204128205128206128207128208128209128210128211128212128213128214128215128216128217128218128219128220128221128222128223128224128225128226128227128228128229128230128231128232128233128234128235128236128237128238128239128240128241128242128243128244128245128246128247128248128249128250128251128252128253128254128255128256128257128258128259128260128261128262128263128264128265128266128267128268128269128270128271128272128273128274128275128276128277128278128279128280128281128282128283128284128285128286128287128288128289128290128291128292128293128294128295128296128297128298128299128300128301128302128303128304128305128306128307128308128309128310128311128312128313128314128315128316128317128318128319128320128321128322128323128324128325128326128327128328128329128330128331128332128333128334128335128336128337128338128339128340128341128342128343128344128345128346128347128348128349128350128351128352128353128354128355128356128357128358128359128360128361128362128363128364128365128366128367128368128369128370128371128372128373128374128375128376128377128378128379128380128381128382128383128384128385128386128387128388128389128390128391128392128393128394128395128396128397128398128399128400128401128402128403128404128405128406128407128408128409128410128411128412128413128414128415128416128417128418128419128420128421128422128423128424128425128426128427128428128429128430128431128432128433128434128435128436128437128438128439128440128441128442128443128444128445128446128447128448128449128450128451128452128453128454128455128456128457128458128459128460128461128462128463128464128465128466128467128468128469128470128471128472128473128474128475128476128477128478128479128480128481128482128483128484128485128486128487128488128489128490128491128492128493128494128495128496128497128498128499128500128501128502128503128504128505128506128507128508128509128510128511128512128513128514128515128516128517128518128519128520128521128522128523128524128525128526128527128528128529128530128531128532128533128534128535128536128537128538128539128540128541128542128543128544128545128546128547128548128549128550128551128552128553128554128555128556128557128558128559128560128561128562128563128564128565128566128567128568128569128570128571128572128573128574128575128576128577128578128579128580128581128582128583128584128585128586128587128588128589128590128591128592128593128594128595128596128597128598128599128600128601128602128603128604128605128606128607128608128609128610128611128612128613128614128615128616128617128618128619128620128621128622128623128624128625128626128627128628128629128630128631128632128633128634128635128636128637128638128639128640128641128642128643128644128645128646128647128648128649128650128651128652128653128654128655128656128657128658128659128660128661128662128663128664128665128666128667128668128669128670128671128672128673128674128675128676128677128678128679128680128681128682128683128684128685128686128687128688128689128690128691128692128693128694128695128696128697128698128699128700128701128702128703128704128705128706128707128708128709128710128711128712128713128714128715128716128717128718128719128720128721128722128723128724128725128726128727128728128729128730128731128732128733128734128735128736128737128738128739128740128741128742128743128744128745128746128747128748128749128750128751128752128753128754128755128756128757128758128759128760128761128762128763128764128765128766128767128768128769128770128771128772128773128774128775128776128777128778128779128780128781128782128783128784128785128786128787128788128789128790128791128792128793128794128795128796128797128798128799128800128801128802128803128804128805128806128807128808128809128810128811128812128813128814128815128816128817128818128819128820128821128822128823128824128825128826128827128828128829128830128831128832128833128834128835128836128837128838128839128840128841128842128843128844128845128846128847128848128849128850128851128852128853128854128855128856128857128858128859128860128861128862128863128864128865128866128867128868128869128870128871128872128873128874128875128876128877128878128879128880128881128882128883128884128885128886128887128888128889128890128891128892128893128894128895128896128897128898128899128900128901128902128903128904128905128906128907128908128909128910128911128912128913128914128915128916128917128918128919128920128921128922128923128924128925128926128927128928128929128930128931128932128933128934128935128936128937128938128939128940128941128942128943128944128945128946128947128948128949128950128951128952128953128954128955128956128957128958128959128960128961128962128963128964128965128966128967128968128969128970128971128972128973128974128975128976128977128978128979128980128981128982128983128984128985128986128987128988128989128990128991128992128993128994128995128996128997128998128999129000129001129002129003129004129005129006129007129008129009129010129011129012129013129014129015129016129017129018129019129020129021129022129023129024129025129026129027129028129029129030129031129032129033129034129035129036129037129038129039129040129041129042129043129044129045129046129047129048129049129050129051129052129053129054129055129056129057129058129059129060129061129062129063129064129065129066129067129068129069129070129071129072129073129074129075129076129077129078129079129080129081129082129083129084129085129086129087129088129089129090129091129092129093129094129095129096129097129098129099129100129101129102129103129104129105129106129107129108129109129110129111129112129113129114129115129116129117129118129119129120129121129122129123129124129125129126129127129128129129129130129131129132129133129134129135129136129137129138129139129140129141129142129143129144129145129146129147129148129149129150129151129152129153129154129155129156129157129158129159129160129161129162129163129164129165129166129167129168129169129170129171129172129173129174129175129176129177129178129179129180129181129182129183129184129185129186129187129188129189129190129191129192129193129194129195129196129197129198129199129200129201129202129203129204129205129206129207129208129209129210129211129212129213129214129215129216129217129218129219129220129221129222129223129224129225129226129227129228129229129230129231129232129233129234129235129236129237129238129239129240129241129242129243129244129245129246129247129248129249129250129251129252129253129254129255129256129257129258129259129260129261129262129263129264129265129266129267129268129269129270129271129272129273129274129275129276129277129278129279129280129281129282129283129284129285129286129287129288129289129290129291129292129293129294129295129296129297129298129299129300129301129302129303129304129305129306129307129308129309129310129311129312129313129314129315129316129317129318129319129320129321129322129323129324129325129326129327129328129329129330129331129332129333129334129335129336129337129338129339129340129341129342129343129344129345129346129347129348129349129350129351129352129353129354129355129356129357129358129359129360129361129362129363129364129365129366129367129368129369129370129371129372129373129374129375129376129377129378129379129380129381129382129383129384129385129386129387129388129389129390129391129392129393129394129395129396129397129398129399129400129401129402129403129404129405129406129407129408129409129410129411129412129413129414129415129416129417129418129419129420129421129422129423129424129425129426129427129428129429129430129431129432129433129434129435129436129437129438129439129440129441129442129443129444129445129446129447129448129449129450129451129452129453129454129455129456129457129458129459129460129461129462129463129464129465129466129467129468129469129470129471129472129473129474129475129476129477129478129479129480129481129482129483129484129485129486129487129488129489129490129491129492129493129494129495129496129497129498129499129500129501129502129503129504129505129506129507129508129509129510129511129512129513129514129515129516129517129518129519129520129521129522129523129524129525129526129527129528129529129530129531129532129533129534129535129536129537129538129539129540129541129542129543129544129545129546129547129548129549129550129551129552129553129554129555129556129557129558129559129560129561129562129563129564129565129566129567129568129569129570129571129572129573129574129575129576129577129578129579129580129581129582129583129584129585129586129587129588129589129590129591129592129593129594129595129596129597129598129599129600129601129602129603129604129605129606129607129608129609129610129611129612129613129614129615129616129617129618129619129620129621129622129623129624129625129626129627129628129629129630129631129632129633129634129635129636129637129638129639129640129641129642129643129644129645129646129647129648129649129650129651129652129653129654129655129656129657129658129659129660129661129662129663129664129665129666129667129668129669129670129671129672129673129674129675129676129677129678129679129680129681129682129683129684129685129686129687129688129689129690129691129692129693129694129695129696129697129698129699129700129701129702129703129704129705129706129707129708129709129710129711129712129713129714129715129716129717129718129719129720129721129722129723129724129725129726129727129728129729129730129731129732129733129734129735129736129737129738129739129740129741129742129743129744129745129746129747129748129749129750129751129752129753129754129755129756129757129758129759129760129761129762129763129764129765129766129767129768129769129770129771129772129773129774129775129776129777129778129779129780129781129782129783129784129785129786129787129788129789129790129791129792129793129794129795129796129797129798129799129800129801129802129803129804129805129806129807129808129809129810129811129812129813129814129815129816129817129818129819129820129821129822129823129824129825129826129827129828129829129830129831129832129833129834129835129836129837129838129839129840129841129842129843129844129845129846129847129848129849129850129851129852129853129854129855129856129857129858129859129860129861129862129863129864129865129866129867129868129869129870129871129872129873129874129875129876129877129878129879129880129881129882129883129884129885129886129887129888129889129890129891129892129893129894129895129896129897129898129899129900129901129902129903129904129905129906129907129908129909129910129911129912129913129914129915129916129917129918129919129920129921129922129923129924129925129926129927129928129929129930129931129932129933129934129935129936129937129938129939129940129941129942129943129944129945129946129947129948129949129950129951129952129953129954129955129956129957129958129959129960129961129962129963129964129965129966129967129968129969129970129971129972129973129974129975129976129977129978129979129980129981129982129983129984129985129986129987129988129989129990129991129992129993129994129995129996129997129998129999130000130001130002130003130004130005130006130007130008130009130010130011130012130013130014130015130016130017130018130019130020130021130022130023130024130025130026130027130028130029130030130031130032130033130034130035130036130037130038130039130040130041130042130043130044130045130046130047130048130049130050130051130052130053130054130055130056130057130058130059130060130061130062130063130064130065130066130067130068130069130070130071130072130073130074130075130076130077130078130079130080130081130082130083130084130085130086130087130088130089130090130091130092130093130094130095130096130097130098130099130100130101130102130103130104130105130106130107130108130109130110130111130112130113130114130115130116130117130118130119130120130121130122130123130124130125130126130127130128130129130130130131130132130133130134130135130136130137130138130139130140130141130142130143130144130145130146130147130148130149130150130151130152130153130154130155130156130157130158130159130160130161130162130163130164130165130166130167130168130169130170130171130172130173130174130175130176130177130178130179130180130181130182130183130184130185130186130187130188130189130190130191130192130193130194130195130196130197130198130199130200130201130202130203130204130205130206130207130208130209130210130211130212130213130214130215130216130217130218130219130220130221130222130223130224130225130226130227130228130229130230130231130232130233130234130235130236130237130238130239130240130241130242130243130244130245130246130247130248130249130250130251130252130253130254130255130256130257130258130259130260130261130262130263130264130265130266130267130268130269130270130271130272130273130274130275130276130277130278130279130280130281130282130283130284130285130286130287130288130289130290130291130292130293130294130295130296130297130298130299130300130301130302130303130304130305130306130307130308130309130310130311130312130313130314130315130316130317130318130319130320130321130322130323130324130325130326130327130328130329130330130331130332130333130334130335130336130337130338130339130340130341130342130343130344130345130346130347130348130349130350130351130352130353130354130355130356130357130358130359130360130361130362130363130364130365130366130367130368130369130370130371130372130373130374130375130376130377130378130379130380130381130382130383130384130385130386130387130388130389130390130391130392130393130394130395130396130397130398130399130400130401130402130403130404130405130406130407130408130409130410130411130412130413130414130415130416130417130418130419130420130421130422130423130424130425130426130427130428130429130430130431130432130433130434130435130436130437130438130439130440130441130442130443130444130445130446130447130448130449130450130451130452130453130454130455130456130457130458130459130460130461130462130463130464130465130466130467130468130469130470130471130472130473130474130475130476130477130478130479130480130481130482130483130484130485130486130487130488130489130490130491130492130493130494130495130496130497130498130499130500130501130502130503130504130505130506130507130508130509130510130511130512130513130514130515130516130517130518130519130520130521130522130523130524130525130526130527130528130529130530130531130532130533130534130535130536130537130538130539130540130541130542130543130544130545130546130547130548130549130550130551130552130553130554130555130556130557130558130559130560130561130562130563130564130565130566130567130568130569130570130571130572130573130574130575130576130577130578130579130580130581130582130583130584130585130586130587130588130589130590130591130592130593130594130595130596130597130598130599130600130601130602130603130604130605130606130607130608130609130610130611130612130613130614130615130616130617130618130619130620130621130622130623130624130625130626130627130628130629130630130631130632130633130634130635130636130637130638130639130640130641130642130643130644130645130646130647130648130649130650130651130652130653130654130655130656130657130658130659130660130661130662130663130664130665130666130667130668130669130670130671130672130673130674130675130676130677130678130679130680130681130682130683130684130685130686130687130688130689130690130691130692130693130694130695130696130697130698130699130700130701130702130703130704130705130706130707130708130709130710130711130712130713130714130715130716130717130718130719130720130721130722130723130724130725130726130727130728130729130730130731130732130733130734130735130736130737130738130739130740130741130742130743130744130745130746130747130748130749130750130751130752130753130754130755130756130757130758130759130760130761130762130763130764130765130766130767130768130769130770130771130772130773130774130775130776130777130778130779130780130781130782130783130784130785130786130787130788130789130790130791130792130793130794130795130796130797130798130799130800130801130802130803130804130805130806130807130808130809130810130811130812130813130814130815130816130817130818130819130820130821130822130823130824130825130826130827130828130829130830130831130832130833130834130835130836130837130838130839130840130841130842130843130844130845130846130847130848130849130850130851130852130853130854130855130856130857130858130859130860130861130862130863130864130865130866130867130868130869130870130871130872130873130874130875130876130877130878130879130880130881130882130883130884130885130886130887130888130889130890130891130892130893130894130895130896130897130898130899130900130901130902130903130904130905130906130907130908130909130910130911130912130913130914130915130916130917130918130919130920130921130922130923130924130925130926130927130928130929130930130931130932130933130934130935130936130937130938130939130940130941130942130943130944130945130946130947130948130949130950130951130952130953130954130955130956130957130958130959130960130961130962130963130964130965130966130967130968130969130970130971130972130973130974130975130976130977130978130979130980130981130982130983130984130985130986130987130988130989130990130991130992130993130994130995130996130997130998130999131000131001131002131003131004131005131006131007131008131009131010131011131012131013131014131015131016131017131018131019131020131021131022131023131024131025131026131027131028131029131030131031131032131033131034131035131036131037131038131039131040131041131042131043131044131045131046131047131048131049131050131051131052131053131054131055131056131057131058131059131060131061131062131063131064131065131066131067131068131069131070131071131072131073131074131075131076131077131078131079131080131081131082131083131084131085131086131087131088131089131090131091131092131093131094131095131096131097131098131099131100131101131102131103131104131105131106131107131108131109131110131111131112131113131114131115131116131117131118131119131120131121131122131123131124131125131126131127131128131129131130131131131132131133131134131135131136131137131138131139131140131141131142131143131144131145131146131147131148131149131150131151131152131153131154131155131156131157131158131159131160131161131162131163131164131165131166131167131168131169131170131171131172131173131174131175131176131177131178131179131180131181131182131183131184131185131186131187131188131189131190131191131192131193131194131195131196131197131198131199131200131201131202131203131204131205131206131207131208131209131210131211131212131213131214131215131216131217131218131219131220131221131222131223131224131225131226131227131228131229131230131231131232131233131234131235131236131237131238131239131240131241131242131243131244131245131246131247131248131249131250131251131252131253131254131255131256131257131258131259131260131261131262131263131264131265131266131267131268131269131270131271131272131273131274131275131276131277131278131279131280131281131282131283131284131285131286131287131288131289131290131291131292131293131294131295131296131297131298131299131300131301131302131303131304131305131306131307131308131309131310131311131312131313131314131315131316131317131318131319131320131321131322131323131324131325131326131327131328131329131330131331131332131333131334131335131336131337131338131339131340131341131342131343131344131345131346131347131348131349131350131351131352131353131354131355131356131357131358131359131360131361131362131363131364131365131366131367131368131369131370131371131372131373131374131375131376131377131378131379131380131381131382131383131384131385131386131387131388131389131390131391131392131393131394131395131396131397131398131399131400131401131402131403131404131405131406131407131408131409131410131411131412131413131414131415131416131417131418131419131420131421131422131423131424131425131426131427131428131429131430131431131432131433131434131435131436131437131438131439131440131441131442131443131444131445131446131447131448131449131450131451131452131453131454131455131456131457131458131459131460131461131462131463131464131465131466131467131468131469131470131471131472131473131474131475131476131477131478131479131480131481131482131483131484131485131486131487131488131489131490131491131492131493131494131495131496131497131498131499131500131501131502131503131504131505131506131507131508131509131510131511131512131513131514131515131516131517131518131519131520131521131522131523131524131525131526131527131528131529131530131531131532131533131534131535131536131537131538131539131540131541131542131543131544131545131546131547131548131549131550131551131552131553131554131555131556131557131558131559131560131561131562131563131564131565131566131567131568131569131570131571131572131573131574131575131576131577131578131579131580131581131582131583131584131585131586131587131588131589131590131591131592131593131594131595131596131597131598131599131600131601131602131603131604131605131606131607131608131609131610131611131612131613131614131615131616131617131618131619131620131621131622131623131624131625131626131627131628131629131630131631131632131633131634131635131636131637131638131639131640131641131642131643131644131645131646131647131648131649131650131651131652131653131654131655131656131657131658131659131660131661131662131663131664131665131666131667131668131669131670131671131672131673131674131675131676131677131678131679131680131681131682131683131684131685131686131687131688131689131690131691131692131693131694131695131696131697131698131699131700131701131702131703131704131705131706131707131708131709131710131711131712131713131714131715131716131717131718131719131720131721131722131723131724131725131726131727131728131729131730131731131732131733131734131735131736131737131738131739131740131741131742131743131744131745131746131747131748131749131750131751131752131753131754131755131756131757131758131759131760131761131762131763131764131765131766131767131768131769131770131771131772131773131774131775131776131777131778131779131780131781131782131783131784131785131786131787131788131789131790131791131792131793131794131795131796131797131798131799131800131801131802131803131804131805131806131807131808131809131810131811131812131813131814131815131816131817131818131819131820131821131822131823131824131825131826131827131828131829131830131831131832131833131834131835131836131837131838131839131840131841131842131843131844131845131846131847131848131849131850131851131852131853131854131855131856131857131858131859131860131861131862131863131864131865131866131867131868131869131870131871131872131873131874131875131876131877131878131879131880131881131882131883131884131885131886131887131888131889131890131891131892131893131894131895131896131897131898131899131900131901131902131903131904131905131906131907131908131909131910131911131912131913131914131915131916131917131918131919131920131921131922131923131924131925131926131927131928131929131930131931131932131933131934131935131936131937131938131939131940131941131942131943131944131945131946131947131948131949131950131951131952131953131954131955131956131957131958131959131960131961131962131963131964131965131966131967131968131969131970131971131972131973131974131975131976131977131978131979131980131981131982131983131984131985131986131987131988131989131990131991131992131993131994131995131996131997131998131999132000132001132002132003132004132005132006132007132008132009132010132011132012132013132014132015132016132017132018132019132020132021132022132023132024132025132026132027132028132029132030132031132032132033132034132035132036132037132038132039132040132041132042132043132044132045132046132047132048132049132050132051132052132053132054132055132056132057132058132059132060132061132062132063132064132065132066132067132068132069132070132071132072132073132074132075132076132077132078132079132080132081132082132083132084132085132086132087132088132089132090132091132092132093132094132095132096132097132098132099132100132101132102132103132104132105132106132107132108132109132110132111132112132113132114132115132116132117132118132119132120132121132122132123132124132125132126132127132128132129132130132131132132132133132134132135132136132137132138132139132140132141132142132143132144132145132146132147132148132149132150132151132152132153132154132155132156132157132158132159132160132161132162132163132164132165132166132167132168132169132170132171132172132173132174132175132176132177132178132179132180132181132182132183132184132185132186132187132188132189132190132191132192132193132194132195132196132197132198132199132200132201132202132203132204132205132206132207132208132209132210132211132212132213132214132215132216132217132218132219132220132221132222132223132224132225132226132227132228132229132230132231132232132233132234132235132236132237132238132239132240132241132242132243132244132245132246132247132248132249132250132251132252132253132254132255132256132257132258132259132260132261132262132263132264132265132266132267132268132269132270132271132272132273132274132275132276132277132278132279132280132281132282132283132284132285132286132287132288132289132290132291132292132293132294132295132296132297132298132299132300132301132302132303132304132305132306132307132308132309132310132311132312132313132314132315132316132317132318132319132320132321132322132323132324132325132326132327132328132329132330132331132332132333132334132335132336132337132338132339132340132341132342132343132344132345132346132347132348132349132350132351132352132353132354132355132356132357132358132359132360132361132362132363132364132365132366132367132368132369132370132371132372132373132374132375132376132377132378132379132380132381132382132383132384132385132386132387132388132389132390132391132392132393132394132395132396132397132398132399132400132401132402132403132404132405132406132407132408132409132410132411132412132413132414132415132416132417132418132419132420132421132422132423132424132425132426132427132428132429132430132431132432132433132434132435132436132437132438132439132440132441132442132443132444132445132446132447132448132449132450132451132452132453132454132455132456132457132458132459132460132461132462132463132464132465132466132467132468132469132470132471132472132473132474132475132476132477132478132479132480132481132482132483132484132485132486132487132488132489132490132491132492132493132494132495132496132497132498132499132500132501132502132503132504132505132506132507132508132509132510132511132512132513132514132515132516132517132518132519132520132521132522132523132524132525132526132527132528132529132530132531132532132533132534132535132536132537132538132539132540132541132542132543132544132545132546132547132548132549132550132551132552132553132554132555132556132557132558132559132560132561132562132563132564132565132566132567132568132569132570132571132572132573132574132575132576132577132578132579132580132581132582132583132584132585132586132587132588132589132590132591132592132593132594132595132596132597132598132599132600132601132602132603132604132605132606132607132608132609132610132611132612132613132614132615132616132617132618132619132620132621132622132623132624132625132626132627132628132629132630132631132632132633132634132635132636132637132638132639132640132641132642132643132644132645132646132647132648132649132650132651132652132653132654132655132656132657132658132659132660132661132662132663132664132665132666132667132668132669132670132671132672132673132674132675132676132677132678132679132680132681132682132683132684132685132686132687132688132689132690132691132692132693132694132695132696132697132698132699132700132701132702132703132704132705132706132707132708132709132710132711132712132713132714132715132716132717132718132719132720132721132722132723132724132725132726132727132728132729132730132731132732132733132734132735132736132737132738132739132740132741132742132743132744132745132746132747132748132749132750132751132752132753132754132755132756132757132758132759132760132761132762132763132764132765132766132767132768132769132770132771132772132773132774132775132776132777132778132779132780132781132782132783132784132785132786132787132788132789132790132791132792132793132794132795132796132797132798132799132800132801132802132803132804132805132806132807132808132809132810132811132812132813132814132815132816132817132818132819132820132821132822132823132824132825132826132827132828132829132830132831132832132833132834132835132836132837132838132839132840132841132842132843132844132845132846132847132848132849132850132851132852132853132854132855132856132857132858132859132860132861132862132863132864132865132866132867132868132869132870132871132872132873132874132875132876132877132878132879132880132881132882132883132884132885132886132887132888132889132890132891132892132893132894132895132896132897132898132899132900132901132902132903132904132905132906132907132908132909132910132911132912132913132914132915132916132917132918132919132920132921132922132923132924132925132926132927132928132929132930132931132932132933132934132935132936132937132938132939132940132941132942132943132944132945132946132947132948132949132950132951132952132953132954132955132956132957132958132959132960132961132962132963132964132965132966132967132968132969132970132971132972132973132974132975132976132977132978132979132980132981132982132983132984132985132986132987132988132989132990132991132992132993132994132995132996132997132998132999133000133001133002133003133004133005133006133007133008133009133010133011133012133013133014133015133016133017133018133019133020133021133022133023133024133025133026133027133028133029133030133031133032133033133034133035133036133037133038133039133040133041133042133043133044133045133046133047133048133049133050133051133052133053133054133055133056133057133058133059133060133061133062133063133064133065133066133067133068133069133070133071133072133073133074133075133076133077133078133079133080133081133082133083133084133085133086133087133088133089133090133091133092133093133094133095133096133097133098133099133100133101133102133103133104133105133106133107133108133109133110133111133112133113133114133115133116133117133118133119133120133121133122133123133124133125133126133127133128133129133130133131133132133133133134133135133136133137133138133139133140133141133142133143133144133145133146133147133148133149133150133151133152133153133154133155133156133157133158133159133160133161133162133163133164133165133166133167133168133169133170133171133172133173133174133175133176133177133178133179133180133181133182133183133184133185133186133187133188133189133190133191133192133193133194133195133196133197133198133199133200133201133202133203133204133205133206133207133208133209133210133211133212133213133214133215133216133217133218133219133220133221133222133223133224133225133226133227133228133229133230133231133232133233133234133235133236133237133238133239133240133241133242133243133244133245133246133247133248133249133250133251133252133253133254133255133256133257133258133259133260133261133262133263133264133265133266133267133268133269133270133271133272133273133274133275133276133277133278133279133280133281133282133283133284133285133286133287133288133289133290133291133292133293133294133295133296133297133298133299133300133301133302133303133304133305133306133307133308133309133310133311133312133313133314133315133316133317133318133319133320133321133322133323133324133325133326133327133328133329133330133331133332133333133334133335133336133337133338133339133340133341133342133343133344133345133346133347133348133349133350133351133352133353133354133355133356133357133358133359133360133361133362133363133364133365133366133367133368133369133370133371133372133373133374133375133376133377133378133379133380133381133382133383133384133385133386133387133388133389133390133391133392133393133394133395133396133397133398133399133400133401133402133403133404133405133406133407133408133409133410133411133412133413133414133415133416133417133418133419133420133421133422133423133424133425133426133427133428133429133430133431133432133433133434133435133436133437133438133439133440133441133442133443133444133445133446133447133448133449133450133451133452133453133454133455133456133457133458133459133460133461133462133463133464133465133466133467133468133469133470133471133472133473133474133475133476133477133478133479133480133481133482133483133484133485133486133487133488133489133490133491133492133493133494133495133496133497133498133499133500133501133502133503133504133505133506133507133508133509133510133511133512133513133514133515133516133517133518133519133520133521133522133523133524133525133526133527133528133529133530133531133532133533133534133535133536133537133538133539133540133541133542133543133544133545133546133547133548133549133550133551133552133553133554133555133556133557133558133559133560133561133562133563133564133565133566133567133568133569133570133571133572133573133574133575133576133577133578133579133580133581133582133583133584133585133586133587133588133589133590133591133592133593133594133595133596133597133598133599133600133601133602133603133604133605133606133607133608133609133610133611133612133613133614133615133616133617133618133619133620133621133622133623133624133625133626133627133628133629133630133631133632133633133634133635133636133637133638133639133640133641133642133643133644133645133646133647133648133649133650133651133652133653133654133655133656133657133658133659133660133661133662133663133664133665133666133667133668133669133670133671133672133673133674133675133676133677133678133679133680133681133682133683133684133685133686133687133688133689133690133691133692133693133694133695133696133697133698133699133700133701133702133703133704133705133706133707133708133709133710133711133712133713133714133715133716133717133718133719133720133721133722133723133724133725133726133727133728133729133730133731133732133733133734133735133736133737133738133739133740133741133742133743133744133745133746133747133748133749133750133751133752133753133754133755133756133757133758133759133760133761133762133763133764133765133766133767133768133769133770133771133772133773133774133775133776133777133778133779133780133781133782133783133784133785133786133787133788133789133790133791133792133793133794133795133796133797133798133799133800133801133802133803133804133805133806133807133808133809133810133811133812133813133814133815133816133817133818133819133820133821133822133823133824133825133826133827133828133829133830133831133832133833133834133835133836133837133838133839133840133841133842133843133844133845133846133847133848133849133850133851133852133853133854133855133856133857133858133859133860133861133862133863133864133865133866133867133868133869133870133871133872133873133874133875133876133877133878133879133880133881133882133883133884133885133886133887133888133889133890133891133892133893133894133895133896133897133898133899133900133901133902133903133904133905133906133907133908133909133910133911133912133913133914133915133916133917133918133919133920133921133922133923133924133925133926133927133928133929133930133931133932133933133934133935133936133937133938133939133940133941133942133943133944133945133946133947133948133949133950133951133952133953133954133955133956133957133958133959133960133961133962133963133964133965133966133967133968133969133970133971133972133973133974133975133976133977133978133979133980133981133982133983133984133985133986133987133988133989133990133991133992133993133994133995133996133997133998133999134000134001134002134003134004134005134006134007134008134009134010134011134012134013134014134015134016134017134018134019134020134021134022134023134024134025134026134027134028134029134030134031134032134033134034134035134036134037134038134039134040134041134042134043134044134045134046134047134048134049134050134051134052134053134054134055134056134057134058134059134060134061134062134063134064134065134066134067134068134069134070134071134072134073134074134075134076134077134078134079134080134081134082134083134084134085134086134087134088134089134090134091134092134093134094134095134096134097134098134099134100134101134102134103134104134105134106134107134108134109134110134111134112134113134114134115134116134117134118134119134120134121134122134123134124134125134126134127134128134129134130134131134132134133134134134135134136134137134138134139134140134141134142134143134144134145134146134147134148134149134150134151134152134153134154134155134156134157134158134159134160134161134162134163134164134165134166134167134168134169134170134171134172134173134174134175134176134177134178134179134180134181134182134183134184134185134186134187134188134189134190134191134192134193134194134195134196134197134198134199134200134201134202134203134204134205134206134207134208134209134210134211134212134213134214134215134216134217134218134219134220134221134222134223134224134225134226134227134228134229134230134231134232134233134234134235134236134237134238134239134240134241134242134243134244134245134246134247134248134249134250134251134252134253134254134255134256134257134258134259134260134261134262134263134264134265134266134267134268134269134270134271134272134273134274134275134276134277134278134279134280134281134282134283134284134285134286134287134288134289134290134291134292134293134294134295134296134297134298134299134300134301134302134303134304134305134306134307134308134309134310134311134312134313134314134315134316134317134318134319134320134321134322134323134324134325134326134327134328134329134330134331134332134333134334134335134336134337134338134339134340134341134342134343134344134345134346134347134348134349134350134351134352134353134354134355134356134357134358134359134360134361134362134363134364134365134366134367134368134369134370134371134372134373134374134375134376134377134378134379134380134381134382134383134384134385134386134387134388134389134390134391134392134393134394134395134396134397134398134399134400134401134402134403134404134405134406134407134408134409134410134411134412134413134414134415134416134417134418134419134420134421134422134423134424134425134426134427134428134429134430134431134432134433134434134435134436134437134438134439134440134441134442134443134444134445134446134447134448134449134450134451134452134453134454134455134456134457134458134459134460134461134462134463134464134465134466134467134468134469134470134471134472134473134474134475134476134477134478134479134480134481134482134483134484134485134486134487134488134489134490134491134492134493134494134495134496134497134498134499134500134501134502134503134504134505134506134507134508134509134510134511134512134513134514134515134516134517134518134519134520134521134522134523134524134525134526134527134528134529134530134531134532134533134534134535134536134537134538134539134540134541134542134543134544134545134546134547134548134549134550134551134552134553134554134555134556134557134558134559134560134561134562134563134564134565134566134567134568134569134570134571134572134573134574134575134576134577134578134579134580134581134582134583134584134585134586134587134588134589134590134591134592134593134594134595134596134597134598134599134600134601134602134603134604134605134606134607134608134609134610134611134612134613134614134615134616134617134618134619134620134621134622134623134624134625134626134627134628134629134630134631134632134633134634134635134636134637134638134639134640134641134642134643134644134645134646134647134648134649134650134651134652134653134654134655134656134657134658134659134660134661134662134663134664134665134666134667134668134669134670134671134672134673134674134675134676134677134678134679134680134681134682134683134684134685134686134687134688134689134690134691134692134693134694134695134696134697134698134699134700134701134702134703134704134705134706134707134708134709134710134711134712134713134714134715134716134717134718134719134720134721134722134723134724134725134726134727134728134729134730134731134732134733134734134735134736134737134738134739134740134741134742134743134744134745134746134747134748134749134750134751134752134753134754134755134756134757134758134759134760134761134762134763134764134765134766134767134768134769134770134771134772134773134774134775134776134777134778134779134780134781134782134783134784134785134786134787134788134789134790134791134792134793134794134795134796134797134798134799134800134801134802134803134804134805134806134807134808134809134810134811134812134813134814134815134816134817134818134819134820134821134822134823134824134825134826134827134828134829134830134831134832134833134834134835134836134837134838134839134840134841134842134843134844134845134846134847134848134849134850134851134852134853134854134855134856134857134858134859134860134861134862134863134864134865134866134867134868134869134870134871134872134873134874134875134876134877134878134879134880134881134882134883134884134885134886134887134888134889134890134891134892134893134894134895134896134897134898134899134900134901134902134903134904134905134906134907134908134909134910134911134912134913134914134915134916134917134918134919134920134921134922134923134924134925134926134927134928134929134930134931134932134933134934134935134936134937134938134939134940134941134942134943134944134945134946134947134948134949134950134951134952134953134954134955134956134957134958134959134960134961134962134963134964134965134966134967134968134969134970134971134972134973134974134975134976134977134978134979134980134981134982134983134984134985134986134987134988134989134990134991134992134993134994134995134996134997134998134999135000135001135002135003135004135005135006135007135008135009135010135011135012135013135014135015135016135017135018135019135020135021135022135023135024135025135026135027135028135029135030135031135032135033135034135035135036135037135038135039135040135041135042135043135044135045135046135047135048135049135050135051135052135053135054135055135056135057135058135059135060135061135062135063135064135065135066135067135068135069135070135071135072135073135074135075135076135077135078135079135080135081135082135083135084135085135086135087135088135089135090135091135092135093135094135095135096135097135098135099135100135101135102135103135104135105135106135107135108135109135110135111135112135113135114135115135116135117135118135119135120135121135122135123135124135125135126135127135128135129135130135131135132135133135134135135135136135137135138135139135140135141135142135143135144135145135146135147135148135149135150135151135152135153135154135155135156135157135158135159135160135161135162135163135164135165135166135167135168135169135170135171135172135173135174135175135176135177135178135179135180135181135182135183135184135185135186135187135188135189135190135191135192135193135194135195135196135197135198135199135200135201135202135203135204135205135206135207135208135209135210135211135212135213135214135215135216135217135218135219135220135221135222135223135224135225135226135227135228135229135230135231135232135233135234135235135236135237135238135239135240135241135242135243135244135245135246135247135248135249135250135251135252135253135254135255135256135257135258135259135260135261135262135263135264135265135266135267135268135269135270135271135272135273135274135275135276135277135278135279135280135281135282135283135284135285135286135287135288135289135290135291135292135293135294135295135296135297135298135299135300135301135302135303135304135305135306135307135308135309135310135311135312135313135314135315135316135317135318135319135320135321135322135323135324135325135326135327135328135329135330135331135332135333135334135335135336135337135338135339135340135341135342135343135344135345135346135347135348135349135350135351135352135353135354135355135356135357135358135359135360135361135362135363135364135365135366135367135368135369135370135371135372135373135374135375135376135377135378135379135380135381135382135383135384135385135386135387135388135389135390135391135392135393135394135395135396135397135398135399135400135401135402135403135404135405135406135407135408135409135410135411135412135413135414135415135416135417135418135419135420135421135422135423135424135425135426135427135428135429135430135431135432135433135434135435135436135437135438135439135440135441135442135443135444135445135446135447135448135449135450135451135452135453135454135455135456135457135458135459135460135461135462135463135464135465135466135467135468135469135470135471135472135473135474135475135476135477135478135479135480135481135482135483135484135485135486135487135488135489135490135491135492135493135494135495135496135497135498135499135500135501135502135503135504135505135506135507135508135509135510135511135512135513135514135515135516135517135518135519135520135521135522135523135524135525135526135527135528135529135530135531135532135533135534135535135536135537135538135539135540135541135542135543135544135545135546135547135548135549135550135551135552135553135554135555135556135557135558135559135560135561135562135563135564135565135566135567135568135569135570135571135572135573135574135575135576135577135578135579135580135581135582135583135584135585135586135587135588135589135590135591135592135593135594135595135596135597135598135599135600135601135602135603135604135605135606135607135608135609135610135611135612135613135614135615135616135617135618135619135620135621135622135623135624135625135626135627135628135629135630135631135632135633135634135635135636135637135638135639135640135641135642135643135644135645135646135647135648135649135650135651135652135653135654135655135656135657135658135659135660135661135662135663135664135665135666135667135668135669135670135671135672135673135674135675135676135677135678135679135680135681135682135683135684135685135686135687135688135689135690135691135692135693135694135695135696135697135698135699135700135701135702135703135704135705135706135707135708135709135710135711135712135713135714135715135716135717135718135719135720135721135722135723135724135725135726135727135728135729135730135731135732135733135734135735135736135737135738135739135740135741135742135743135744135745135746135747135748135749135750135751135752135753135754135755135756135757135758135759135760135761135762135763135764135765135766135767135768135769135770135771135772135773135774135775135776135777135778135779135780135781135782135783135784135785135786135787135788135789135790135791135792135793135794135795135796135797135798135799135800135801135802135803135804135805135806135807135808135809135810135811135812135813135814135815135816135817135818135819135820135821135822135823135824135825135826135827135828135829135830135831135832135833135834135835135836135837135838135839135840135841135842135843135844135845135846135847135848135849135850135851135852135853135854135855135856135857135858135859135860135861135862135863135864135865135866135867135868135869135870135871135872135873135874135875135876135877135878135879135880135881135882135883135884135885135886135887135888135889135890135891135892135893135894135895135896135897135898135899135900135901135902135903135904135905135906135907135908135909135910135911135912135913135914135915135916135917135918135919135920135921135922135923135924135925135926135927135928135929135930135931135932135933135934135935135936135937135938135939135940135941135942135943135944135945135946135947135948135949135950135951135952135953135954135955135956135957135958135959135960135961135962135963135964135965135966135967135968135969135970135971135972135973135974135975135976135977135978135979135980135981135982135983135984135985135986135987135988135989135990135991135992135993135994135995135996135997135998135999136000136001136002136003136004136005136006136007136008136009136010136011136012136013136014136015136016136017136018136019136020136021136022136023136024136025136026136027136028136029136030136031136032136033136034136035136036136037136038136039136040136041136042136043136044136045136046136047136048136049136050136051136052136053136054136055136056136057136058136059136060136061136062136063136064136065136066136067136068136069136070136071136072136073136074136075136076136077136078136079136080136081136082136083136084136085136086136087136088136089136090136091136092136093136094136095136096136097136098136099136100136101136102136103136104136105136106136107136108136109136110136111136112136113136114136115136116136117136118136119136120136121136122136123136124136125136126136127136128136129136130136131136132136133136134136135136136136137136138136139136140136141136142136143136144136145136146136147136148136149136150136151136152136153136154136155136156136157136158136159136160136161136162136163136164136165136166136167136168136169136170136171136172136173136174136175136176136177136178136179136180136181136182136183136184136185136186136187136188136189136190136191136192136193136194136195136196136197136198136199136200136201136202136203136204136205136206136207136208136209136210136211136212136213136214136215136216136217136218136219136220136221136222136223136224136225136226136227136228136229136230136231136232136233136234136235136236136237136238136239136240136241136242136243136244136245136246136247136248136249136250136251136252136253136254136255136256136257136258136259136260136261136262136263136264136265136266136267136268136269136270136271136272136273136274136275136276136277136278136279136280136281136282136283136284136285136286136287136288136289136290136291136292136293136294136295136296136297136298136299136300136301136302136303136304136305136306136307136308136309136310136311136312136313136314136315136316136317136318136319136320136321136322136323136324136325136326136327136328136329136330136331136332136333136334136335136336136337136338136339136340136341136342136343136344136345136346136347136348136349136350136351136352136353136354136355136356136357136358136359136360136361136362136363136364136365136366136367136368136369136370136371136372136373136374136375136376136377136378136379136380136381136382136383136384136385136386136387136388136389136390136391136392136393136394136395136396136397136398136399136400136401136402136403136404136405136406136407136408136409136410136411136412136413136414136415136416136417136418136419136420136421136422136423136424136425136426136427136428136429136430136431136432136433136434136435136436136437136438136439136440136441136442136443136444136445136446136447136448136449136450136451136452136453136454136455136456136457136458136459136460136461136462136463136464136465136466136467136468136469136470136471136472136473136474136475136476136477136478136479136480136481136482136483136484136485136486136487136488136489136490136491136492136493136494136495136496136497136498136499136500136501136502136503136504136505136506136507136508136509136510136511136512136513136514136515136516136517136518136519136520136521136522136523136524136525136526136527136528136529136530136531136532136533136534136535136536136537136538136539136540136541136542136543136544136545136546136547136548136549136550136551136552136553136554136555136556136557136558136559136560136561136562136563136564136565136566136567136568136569136570136571136572136573136574136575136576136577136578136579136580136581136582136583136584136585136586136587136588136589136590136591136592136593136594136595136596136597136598136599136600136601136602136603136604136605136606136607136608136609136610136611136612136613136614136615136616136617136618136619136620136621136622136623136624136625136626136627136628136629136630136631136632136633136634136635136636136637136638136639136640136641136642136643136644136645136646136647136648136649136650136651136652136653136654136655136656136657136658136659136660136661136662136663136664136665136666136667136668136669136670136671136672136673136674136675136676136677136678136679136680136681136682136683136684136685136686136687136688136689136690136691136692136693136694136695136696136697136698136699136700136701136702136703136704136705136706136707136708136709136710136711136712136713136714136715136716136717136718136719136720136721136722136723136724136725136726136727136728136729136730136731136732136733136734136735136736136737136738136739136740136741136742136743136744136745136746136747136748136749136750136751136752136753136754136755136756136757136758136759136760136761136762136763136764136765136766136767136768136769136770136771136772136773136774136775136776136777136778136779136780136781136782136783136784136785136786136787136788136789136790136791136792136793136794136795136796136797136798136799136800136801136802136803136804136805136806136807136808136809136810136811136812136813136814136815136816136817136818136819136820136821136822136823136824136825136826136827136828136829136830136831136832136833136834136835136836136837136838136839136840136841136842136843136844136845136846136847136848136849136850136851136852136853136854136855136856136857136858136859136860136861136862136863136864136865136866136867136868136869136870136871136872136873136874136875136876136877136878136879136880136881136882136883136884136885136886136887136888136889136890136891136892136893136894136895136896136897136898136899136900136901136902136903136904136905136906136907136908136909136910136911136912136913136914136915136916136917136918136919136920136921136922136923136924136925136926136927136928136929136930136931136932136933136934136935136936136937136938136939136940136941136942136943136944136945136946136947136948136949136950136951136952136953136954136955136956136957136958136959136960136961136962136963136964136965136966136967136968136969136970136971136972136973136974136975136976136977136978136979136980136981136982136983136984136985136986136987136988136989136990136991136992136993136994136995136996136997136998136999137000137001137002137003137004137005137006137007137008137009137010137011137012137013137014137015137016137017137018137019137020137021137022137023137024137025137026137027137028137029137030137031137032137033137034137035137036137037137038137039137040137041137042137043137044137045137046137047137048137049137050137051137052137053137054137055137056137057137058137059137060137061137062137063137064137065137066137067137068137069137070137071137072137073137074137075137076137077137078137079137080137081137082137083137084137085137086137087137088137089137090137091137092137093137094137095137096137097137098137099137100137101137102137103137104137105137106137107137108137109137110137111137112137113137114137115137116137117137118137119137120137121137122137123137124137125137126137127137128137129137130137131137132137133137134137135137136137137137138137139137140137141137142137143137144137145137146137147137148137149137150137151137152137153137154137155137156137157137158137159137160137161137162137163137164137165137166137167137168137169137170137171137172137173137174137175137176137177137178137179137180137181137182137183137184137185137186137187137188137189137190137191137192137193137194137195137196137197137198137199137200137201137202137203137204137205137206137207137208137209137210137211137212137213137214137215137216137217137218137219137220137221137222137223137224137225137226137227137228137229137230137231137232137233137234137235137236137237137238137239137240137241137242137243137244137245137246137247137248137249137250137251137252137253137254137255137256137257137258137259137260137261137262137263137264137265137266137267137268137269137270137271137272137273137274137275137276137277137278137279137280137281137282137283137284137285137286137287137288137289137290137291137292137293137294137295137296137297137298137299137300137301137302137303137304137305137306137307137308137309137310137311137312137313137314137315137316137317137318137319137320137321137322137323137324137325137326137327137328137329137330137331137332137333137334137335137336137337137338137339137340137341137342137343137344137345137346137347137348137349137350137351137352137353137354137355137356137357137358137359137360137361137362137363137364137365137366137367137368137369137370137371137372137373137374137375137376137377137378137379137380137381137382137383137384137385137386137387137388137389137390137391137392137393137394137395137396137397137398137399137400137401137402137403137404137405137406137407137408137409137410137411137412137413137414137415137416137417137418137419137420137421137422137423137424137425137426137427137428137429137430137431137432137433137434137435137436137437137438137439137440137441137442137443137444137445137446137447137448137449137450137451137452137453137454137455137456137457137458137459137460137461137462137463137464137465137466137467137468137469137470137471137472137473137474137475137476137477137478137479137480137481137482137483137484137485137486137487137488137489137490137491137492137493137494137495137496137497137498137499137500137501137502137503137504137505137506137507137508137509137510137511137512137513137514137515137516137517137518137519137520137521137522137523137524137525137526137527137528137529137530137531137532137533137534137535137536137537137538137539137540137541137542137543137544137545137546137547137548137549137550137551137552137553137554137555137556137557137558137559137560137561137562137563137564137565137566137567137568137569137570137571137572137573137574137575137576137577137578137579137580137581137582137583137584137585137586137587137588137589137590137591137592137593137594137595137596137597137598137599137600137601137602137603137604137605137606137607137608137609137610137611137612137613137614137615137616137617137618137619137620137621137622137623137624137625137626137627137628137629137630137631137632137633137634137635137636137637137638137639137640137641137642137643137644137645137646137647137648137649137650137651137652137653137654137655137656137657137658137659137660137661137662137663137664137665137666137667137668137669137670137671137672137673137674137675137676137677137678137679137680137681137682137683137684137685137686137687137688137689137690137691137692137693137694137695137696137697137698137699137700137701137702137703137704137705137706137707137708137709137710137711137712137713137714137715137716137717137718137719137720137721137722137723137724137725137726137727137728137729137730137731137732137733137734137735137736137737137738137739137740137741137742137743137744137745137746137747137748137749137750137751137752137753137754137755137756137757137758137759137760137761137762137763137764137765137766137767137768137769137770137771137772137773137774137775137776137777137778137779137780137781137782137783137784137785137786137787137788137789137790137791137792137793137794137795137796137797137798137799137800137801137802137803137804137805137806137807137808137809137810137811137812137813137814137815137816137817137818137819137820137821137822137823137824137825137826137827137828137829137830137831137832137833137834137835137836137837137838137839137840137841137842137843137844137845137846137847137848137849137850137851137852137853137854137855137856137857137858137859137860137861137862137863137864137865137866137867137868137869137870137871137872137873137874137875137876137877137878137879137880137881137882137883137884137885137886137887137888137889137890137891137892137893137894137895137896137897137898137899137900137901137902137903137904137905137906137907137908137909137910137911137912137913137914137915137916137917137918137919137920137921137922137923137924137925137926137927137928137929137930137931137932137933137934137935137936
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. if (!class_exists('Phar')) {
  22. echo 'PHP\'s phar extension is missing. Composer requires it to run. Enable the extension or recompile php without --disable-phar then try again.' . PHP_EOL;
  23. exit(1);
  24. }
  25. Phar::mapPhar('composer.phar');
  26. require 'phar://composer.phar/bin/composer';
  27. __HALT_COMPILER(); ?>
  28. ‚Ä��’������ ���composer.phar����!���src/Composer/Advisory/Auditor.phpR&��ÐÝ9gR&��r�¤ý¤������1���src/Composer/Advisory/IgnoredSecurityAdvisory.phpT��ÐÝ9gT��"¼ï¤������1���src/Composer/Advisory/PartialSecurityAdvisory.php��ÐÝ9g��•ôã¤������*���src/Composer/Advisory/SecurityAdvisory.phpü��ÐÝ9gü��µ5t0¤������+���src/Composer/Autoload/AutoloadGenerator.phpŠ��ÐÝ9gŠ��Rˆyø¤������+���src/Composer/Autoload/ClassMapGenerator.php’��ÐÝ9g’���¨|S¤���������src/Composer/Cache.phpx��ÐÝ9gx��Ѐ%z¤������%���src/Composer/Command/AboutCommand.phpW��ÐÝ9gW��â:†!¤������'���src/Composer/Command/ArchiveCommand.phpG��ÐÝ9gG��3í2á¤������%���src/Composer/Command/AuditCommand.phpŽ ��ÐÝ9gŽ ��‡Ðܤ������$���src/Composer/Command/BaseCommand.phpé*��ÐÝ9gé*��¯3¤������.���src/Composer/Command/BaseDependencyCommand.php #��ÐÝ9g #��‚†h¤������$���src/Composer/Command/BumpCommand.php��ÐÝ9g��;̸¤������1���src/Composer/Command/CheckPlatformReqsCommand.php`��ÐÝ9g`��ù<t¤������*���src/Composer/Command/ClearCacheCommand.php| ��ÐÝ9g| �� æL ¤������(���src/Composer/Command/CompletionTrait.phpV��ÐÝ9gV��c7õ¤������&���src/Composer/Command/ConfigCommand.php“q��ÐÝ9g“q��DìîÚ¤������-���src/Composer/Command/CreateProjectCommand.php�J��ÐÝ9g�J��ß0®ö¤������'���src/Composer/Command/DependsCommand.phpE��ÐÝ9gE���z¤������(���src/Composer/Command/DiagnoseCommand.phpYg��ÐÝ9gYg��.V–¤������,���src/Composer/Command/DumpAutoloadCommand.phpù��ÐÝ9gù��Iªè‚¤������$���src/Composer/Command/ExecCommand.php ��ÐÝ9g ��Oì¡0¤������$���src/Composer/Command/FundCommand.phpÁ��ÐÝ9gÁ��5`ÈG¤������&���src/Composer/Command/GlobalCommand.phpÄ��ÐÝ9gÄ��Q#½y¤������$���src/Composer/Command/HomeCommand.phpG��ÐÝ9gG��¡gˆ¤������$���src/Composer/Command/InitCommand.phpD��ÐÝ9gD��ÉH q¤������'���src/Composer/Command/InstallCommand.phpa��ÐÝ9ga��ÛáÅ£¤������(���src/Composer/Command/LicensesCommand.php½��ÐÝ9g½��ƃi]¤������(���src/Composer/Command/OutdatedCommand.php’��ÐÝ9g’��@c�¤������.���src/Composer/Command/PackageDiscoveryTrait.php�6��ÐÝ9g�6��œðóº¤������)���src/Composer/Command/ProhibitsCommand.phpå��ÐÝ9gå��ÊDrø¤������)���src/Composer/Command/ReinstallCommand.php}��ÐÝ9g}��Ièפ������&���src/Composer/Command/RemoveCommand.phpS.��ÐÝ9gS.��<?K¤������'���src/Composer/Command/RequireCommand.phpþY��ÐÝ9gþY��»£¤������)���src/Composer/Command/RunScriptCommand.php��ÐÝ9g��f¿¤������+���src/Composer/Command/ScriptAliasCommand.phpò��ÐÝ9gò��sä*-¤������&���src/Composer/Command/SearchCommand.phpY��ÐÝ9gY��óì•ü¤������*���src/Composer/Command/SelfUpdateCommand.phpîK��ÐÝ9gîK��ààè3¤������$���src/Composer/Command/ShowCommand.phpÙ¼��ÐÝ9gÙ¼��Ô-ƒú¤������&���src/Composer/Command/StatusCommand.php·��ÐÝ9g·��éB˜¾¤������(���src/Composer/Command/SuggestsCommand.phpÉ ��ÐÝ9gÉ ��ùÏfk¤������&���src/Composer/Command/UpdateCommand.phpC��ÐÝ9gC��ìŒw ¤������(���src/Composer/Command/ValidateCommand.php8��ÐÝ9g8��8œG¤���������src/Composer/Composer.php���ÐÝ9g���áçÑÓ¤���������src/Composer/Config.php :��ÐÝ9g :��½ [¤������-���src/Composer/Config/ConfigSourceInterface.phpº��ÐÝ9gº��½Ó¤������(���src/Composer/Config/JsonConfigSource.phpÂ��ÐÝ9gÂ��Ž?z¤������$���src/Composer/Console/Application.phpW��ÐÝ9gW���–g¤������*���src/Composer/Console/GithubActionError.php��ÐÝ9g��`±‰æ¤������,���src/Composer/Console/HtmlOutputFormatter.php>��ÐÝ9g>��Ò ïR¤������,���src/Composer/Console/Input/InputArgument.php¶��ÐÝ9g¶��ª¼K¤������*���src/Composer/Console/Input/InputOption.phpg��ÐÝ9gg��ˆ7'4¤������-���src/Composer/DependencyResolver/Decisions.phpé��ÐÝ9gé��;$@ ¤������1���src/Composer/DependencyResolver/DefaultPolicy.php²��ÐÝ9g²��èMJ¤������/���src/Composer/DependencyResolver/GenericRule.php6��ÐÝ9g6��¥²l|¤������8���src/Composer/DependencyResolver/LocalRepoTransaction.php½��ÐÝ9g½��ßšHš¤������3���src/Composer/DependencyResolver/LockTransaction.phpA��ÐÝ9gA��f±+q¤������5���src/Composer/DependencyResolver/MultiConflictRule.phpË��ÐÝ9gË��´9 �¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpÿ��ÐÝ9gÿ��=ú§§¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php��ÐÝ9g���1NJ¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php��ÐÝ9g��tw ¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpø���ÐÝ9gø���÷Wý¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.phpH��ÐÝ9gH��§¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpç��ÐÝ9gç��|ÁR¤������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phpŸ��ÐÝ9gŸ��Ü7椤������3���src/Composer/DependencyResolver/PolicyInterface.phpž��ÐÝ9gž��øÎá¤������(���src/Composer/DependencyResolver/Pool.php ��ÐÝ9g ��xF!¤������/���src/Composer/DependencyResolver/PoolBuilder.php•J��ÐÝ9g•J��ôؤ������1���src/Composer/DependencyResolver/PoolOptimizer.phpõ)��ÐÝ9gõ)��KY•¤������+���src/Composer/DependencyResolver/Problem.phpÅ\��ÐÝ9gÅ\��_ÝûÔ¤������+���src/Composer/DependencyResolver/Request.php˜��ÐÝ9g˜��$£”¤������(���src/Composer/DependencyResolver/Rule.phpµ0��ÐÝ9gµ0��Ê{ Q¤������1���src/Composer/DependencyResolver/Rule2Literals.php��ÐÝ9g��3vþ¤������+���src/Composer/DependencyResolver/RuleSet.php¾ ��ÐÝ9g¾ ��¹u¨¤������4���src/Composer/DependencyResolver/RuleSetGenerator.phpC��ÐÝ9gC��/]Zž¤������3���src/Composer/DependencyResolver/RuleSetIterator.phpõ��ÐÝ9gõ��œ y¤������2���src/Composer/DependencyResolver/RuleWatchChain.php{��ÐÝ9g{��‚hóD¤������2���src/Composer/DependencyResolver/RuleWatchGraph.phpœ ��ÐÝ9gœ ��Zœ{|¤������1���src/Composer/DependencyResolver/RuleWatchNode.phpv��ÐÝ9gv��p™·¤������*���src/Composer/DependencyResolver/Solver.phpL8��ÐÝ9gL8��Ó�Z²¤������6���src/Composer/DependencyResolver/SolverBugException.php¹��ÐÝ9g¹��z­=¤������;���src/Composer/DependencyResolver/SolverProblemsException.phpË��ÐÝ9gË��£?¤������/���src/Composer/DependencyResolver/Transaction.phpC��ÐÝ9gC��¹]
  29. ¤������-���src/Composer/Downloader/ArchiveDownloader.phpï��ÐÝ9gï��?ÄþN¤������1���src/Composer/Downloader/ChangeReportInterface.phpõ���ÐÝ9gõ���­ÃÂB¤������+���src/Composer/Downloader/DownloadManager.phpª��ÐÝ9gª��²œ?g¤������/���src/Composer/Downloader/DownloaderInterface.phpÓ��ÐÝ9gÓ��bm[Ȥ������3���src/Composer/Downloader/DvcsDownloaderInterface.phpú���ÐÝ9gú���à%'¤������*���src/Composer/Downloader/FileDownloader.phph4��ÐÝ9gh4��$^°¤������/���src/Composer/Downloader/FilesystemException.php/��ÐÝ9g/��!‹å&¤������,���src/Composer/Downloader/FossilDownloader.phpP ��ÐÝ9gP ��„ð:à¤������)���src/Composer/Downloader/GitDownloader.php’C��ÐÝ9g’C��ùîƤ������*���src/Composer/Downloader/GzipDownloader.phpœ��ÐÝ9gœ��0•ÿ¤������(���src/Composer/Downloader/HgDownloader.php ��ÐÝ9g ��Ý‘›¤������8���src/Composer/Downloader/MaxFileSizeExceededException.phpŒ���ÐÝ9gŒ���ÚºÔ¤������*���src/Composer/Downloader/PathDownloader.phpA"��ÐÝ9gA"��Òཥ¤������.���src/Composer/Downloader/PerforceDownloader.php‹ ��ÐÝ9g‹ ���<­�¤������*���src/Composer/Downloader/PharDownloader.phpª��ÐÝ9gª��XÈȤ������)���src/Composer/Downloader/RarDownloader.phpd��ÐÝ9gd��G'°¤������)���src/Composer/Downloader/SvnDownloader.php~��ÐÝ9g~��ÈC¤������)���src/Composer/Downloader/TarDownloader.php¨��ÐÝ9g¨��×rß‚¤������.���src/Composer/Downloader/TransportException.php
  30. ��ÐÝ9g
  31. ��Þé:‡¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpý���ÐÝ9gý���ä6¤¤������)���src/Composer/Downloader/VcsDownloader.phpA��ÐÝ9gA��Æ3^´¤������(���src/Composer/Downloader/XzDownloader.phpˆ��ÐÝ9gˆ��E'§Á¤������)���src/Composer/Downloader/ZipDownloader.php_&��ÐÝ9g_&��RIFÿ¤������&���src/Composer/EventDispatcher/Event.phpØ��ÐÝ9gØ��…÷¡ð¤������0���src/Composer/EventDispatcher/EventDispatcher.phpDG��ÐÝ9gDG��b™'›¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.phpÂ���ÐÝ9gÂ���}=é¤������9���src/Composer/EventDispatcher/ScriptExecutionException.php‘���ÐÝ9g‘���XvèϤ������9���src/Composer/Exception/IrrecoverableDownloadException.php����ÐÝ9g����0Þ4 ¤������)���src/Composer/Exception/NoSslException.php����ÐÝ9g����ØU¦Ò¤���������src/Composer/Factory.phpMR��ÐÝ9gMR��ÿ—_¤������T���src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.php®��ÐÝ9g®��Zkª¤������U���src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php.��ÐÝ9g.��!;¤������X���src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.phpT��ÐÝ9gT��ÇàÙ¤������R���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.phpw��ÐÝ9gw��ÑT¿¤������T���src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.phpø���ÐÝ9gø���‰µÒg¤���������src/Composer/IO/BaseIO.phpÕ��ÐÝ9gÕ��§zPâ¤���������src/Composer/IO/BufferIO.php���ÐÝ9g���ÇÅ£¤���������src/Composer/IO/ConsoleIO.phpë��ÐÝ9gë��«ýâ¤���������src/Composer/IO/IOInterface.phpÐ��ÐÝ9gÐ��~ÿh­¤���������src/Composer/IO/NullIO.phpO��ÐÝ9gO��bˆ¨s¤���������src/Composer/Installer.phpÔ���ÐÝ9gÔ���Ì-ZÞ¤������*���src/Composer/Installer/BinaryInstaller.php*��ÐÝ9g*��°†Y¥¤������2���src/Composer/Installer/BinaryPresenceInterface.phpæ���ÐÝ9gæ���®3—Œ¤������.���src/Composer/Installer/InstallationManager.php6��ÐÝ9g6��Ñþ.©¤������)���src/Composer/Installer/InstallerEvent.php*��ÐÝ9g*��FZäÙ¤������*���src/Composer/Installer/InstallerEvents.php¥���ÐÝ9g¥���>•íǤ������-���src/Composer/Installer/InstallerInterface.php~��ÐÝ9g~���͔դ������+���src/Composer/Installer/LibraryInstaller.php��ÐÝ9g��ºc2¤������/���src/Composer/Installer/MetapackageInstaller.phpÖ��ÐÝ9gÖ��û
  32. õ"¤������(���src/Composer/Installer/NoopInstaller.phpa��ÐÝ9ga��êxQn¤������'���src/Composer/Installer/PackageEvent.phpô��ÐÝ9gô��b‘\A¤������(���src/Composer/Installer/PackageEvents.phpû��ÐÝ9gû��ò«K¤������*���src/Composer/Installer/PluginInstaller.php� ��ÐÝ9g� ��ò”=¤������+���src/Composer/Installer/ProjectInstaller.php9 ��ÐÝ9g9 ��Uц¤������4���src/Composer/Installer/SuggestedPackagesReporter.php¥��ÐÝ9g¥��ö”Oë¤���������src/Composer/Json/JsonFile.php��ÐÝ9g�� wE¤������#���src/Composer/Json/JsonFormatter.phpŒ��ÐÝ9gŒ��0Ûùd¤������%���src/Composer/Json/JsonManipulator.php°8��ÐÝ9g°8��:¢ù¤������-���src/Composer/Json/JsonValidationException.php—��ÐÝ9g—���^^´¤������2���src/Composer/PHPStan/ConfigReturnTypeExtension.php
  33. ��ÐÝ9g
  34. ��†CëP¤������:���src/Composer/PHPStan/RuleReasonDataReturnTypeExtension.php~��ÐÝ9g~��¦ç¬H¤������%���src/Composer/Package/AliasPackage.php¸��ÐÝ9g¸��ÝB1¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.phpS��ÐÝ9gS��'25f¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÕ��ÐÝ9gÕ��3äN¤������0���src/Composer/Package/Archiver/ArchiveManager.php~��ÐÝ9g~��¶&O»¤������3���src/Composer/Package/Archiver/ArchiverInterface.phpS��ÐÝ9gS��ÿì?î¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php��ÐÝ9g��xÆ6Ȥ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php?��ÐÝ9g?��?�`^¤������2���src/Composer/Package/Archiver/GitExcludeFilter.php$��ÐÝ9g$��t�8N¤������.���src/Composer/Package/Archiver/PharArchiver.phpÆ��ÐÝ9gÆ��-íÙª¤������-���src/Composer/Package/Archiver/ZipArchiver.phpŽ��ÐÝ9gŽ��aEФ������$���src/Composer/Package/BasePackage.php)��ÐÝ9g)��¢õ/¤������*���src/Composer/Package/Comparer/Comparer.phpÒ ��ÐÝ9gÒ ��ûÚ°ˆ¤������-���src/Composer/Package/CompleteAliasPackage.phpq
  35. ��ÐÝ9gq
  36. ��ú #·¤������(���src/Composer/Package/CompletePackage.php
  37. ��ÐÝ9g
  38. ��† J±¤������1���src/Composer/Package/CompletePackageInterface.php���ÐÝ9g���‰‘”¤������+���src/Composer/Package/Dumper/ArrayDumper.php¸ ��ÐÝ9g¸ ��–Ú•u¤���������src/Composer/Package/Link.phpö��ÐÝ9gö�� "j¥¤������+���src/Composer/Package/Loader/ArrayLoader.php(.��ÐÝ9g(.��Áƒwy¤������7���src/Composer/Package/Loader/InvalidPackageException.php„��ÐÝ9g„��èMü•¤������*���src/Composer/Package/Loader/JsonLoader.php“��ÐÝ9g“��褢4¤������/���src/Composer/Package/Loader/LoaderInterface.phpž��ÐÝ9gž��FB¤¤������1���src/Composer/Package/Loader/RootPackageLoader.phpY��ÐÝ9gY��ç¿òï¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.php•P��ÐÝ9g•P��p9 Œ¤���������src/Composer/Package/Locker.phpu4��ÐÝ9gu4��ÙœŒ�¤������ ���src/Composer/Package/Package.php%��ÐÝ9g%��mÒ(+¤������)���src/Composer/Package/PackageInterface.php� ��ÐÝ9g� ��·eZ¤������)���src/Composer/Package/RootAliasPackage.phpç ��ÐÝ9gç ��A:–D¤������$���src/Composer/Package/RootPackage.php©��ÐÝ9g©�� º¤������-���src/Composer/Package/RootPackageInterface.php=��ÐÝ9g=��¶Ù]Ĥ������0���src/Composer/Package/Version/StabilityFilter.php��ÐÝ9g��Ýhj¤������.���src/Composer/Package/Version/VersionBumper.phpÿ ��ÐÝ9gÿ ��ñSA¤������/���src/Composer/Package/Version/VersionGuesser.php(+��ÐÝ9g(+��Ò³8a¤������.���src/Composer/Package/Version/VersionParser.phpÔ��ÐÝ9gÔ��Øà’æ¤������0���src/Composer/Package/Version/VersionSelector.phpn��ÐÝ9gn��„NUŒ¤������ ���src/Composer/PartialComposer.phpþ��ÐÝ9gþ��¨ù š¤������&���src/Composer/Platform/HhvmDetector.php��ÐÝ9g���±óè¤������!���src/Composer/Platform/Runtime.phpò��ÐÝ9gò��'V 5¤������!���src/Composer/Platform/Version.phpª��ÐÝ9gª��Ë]¯ß¤������-���src/Composer/Plugin/Capability/Capability.phpp���ÐÝ9gp���š#c;¤������2���src/Composer/Plugin/Capability/CommandProvider.php°���ÐÝ9g°���FüÙ¤¤���������src/Composer/Plugin/Capable.php˜���ÐÝ9g˜���û°hª¤������$���src/Composer/Plugin/CommandEvent.php?��ÐÝ9g?��|U`¤������.���src/Composer/Plugin/PluginBlockedException.php§���ÐÝ9g§���öùr¤������$���src/Composer/Plugin/PluginEvents.php¨��ÐÝ9g¨��\K“Ö¤������'���src/Composer/Plugin/PluginInterface.php«��ÐÝ9g«��õ1i ¤������%���src/Composer/Plugin/PluginManager.phpYR��ÐÝ9gYR��D¬©Ò¤������-���src/Composer/Plugin/PostFileDownloadEvent.php¿��ÐÝ9g¿��à@>‰¤������*���src/Composer/Plugin/PreCommandRunEvent.php/��ÐÝ9g/��3 ±¤������,���src/Composer/Plugin/PreFileDownloadEvent.php ��ÐÝ9g ��´qŠl¤������*���src/Composer/Plugin/PrePoolCreateEvent.php±��ÐÝ9g±��ó¼Û¤������4���src/Composer/Question/StrictConfirmationQuestion.phpŽ��ÐÝ9gŽ��Ñr¤������5���src/Composer/Repository/AdvisoryProviderInterface.php©��ÐÝ9g©��•Ð°¤������+���src/Composer/Repository/ArrayRepository.php4��ÐÝ9g4��º�ÒÕ¤������.���src/Composer/Repository/ArtifactRepository.php| ��ÐÝ9g| ��¬ñ~3¤������2���src/Composer/Repository/CanonicalPackagesTrait.phpÄ��ÐÝ9gÄ��¦{ë¤������.���src/Composer/Repository/ComposerRepository.phpU·��ÐÝ9gU·��¼”È–¤������/���src/Composer/Repository/CompositeRepository.php… ��ÐÝ9g… ��û«ߤ������;���src/Composer/Repository/ConfigurableRepositoryInterface.php¡���ÐÝ9g¡���ce*2¤������0���src/Composer/Repository/FilesystemRepository.phpç'��ÐÝ9gç'��öÊ�8¤������,���src/Composer/Repository/FilterRepository.phpg��ÐÝ9gg��+¯F¾¤������4���src/Composer/Repository/InstalledArrayRepository.phpX��ÐÝ9gX��¼,[¤������9���src/Composer/Repository/InstalledFilesystemRepository.phpJ��ÐÝ9gJ��'kCè¤������/���src/Composer/Repository/InstalledRepository.phpm��ÐÝ9gm��ú:Ô¤������8���src/Composer/Repository/InstalledRepositoryInterface.phpà���ÐÝ9gà���¾²ÿg¤������6���src/Composer/Repository/InvalidRepositoryException.php‡���ÐÝ9g‡��� W<_¤������/���src/Composer/Repository/LockArrayRepository.phpâ���ÐÝ9gâ����^†ú¤������-���src/Composer/Repository/PackageRepository.php ��ÐÝ9g ��\/*þ¤������*���src/Composer/Repository/PathRepository.phpæ��ÐÝ9gæ��Ú™Mº¤������*���src/Composer/Repository/PearRepository.php��ÐÝ9g��QuÏj¤������.���src/Composer/Repository/PlatformRepository.php±Z��ÐÝ9g±Z��úR‚¤������-���src/Composer/Repository/RepositoryFactory.phpW��ÐÝ9gW��è(¤������/���src/Composer/Repository/RepositoryInterface.php¥��ÐÝ9g¥��1"ï�¤������-���src/Composer/Repository/RepositoryManager.php¢ ��ÐÝ9g¢ ��,}~¤������7���src/Composer/Repository/RepositorySecurityException.phpˆ���ÐÝ9gˆ���qœ×t¤������)���src/Composer/Repository/RepositorySet.php�#��ÐÝ9g�#��“ƒzå¤������+���src/Composer/Repository/RepositoryUtils.php™��ÐÝ9g™��)[�ݤ������1���src/Composer/Repository/RootPackageRepository.php\��ÐÝ9g\��¾`9ü¤������,���src/Composer/Repository/Vcs/FossilDriver.php��ÐÝ9g��,YÓU¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpÖ&��ÐÝ9gÖ&��ëy!†¤������)���src/Composer/Repository/Vcs/GitDriver.phpE��ÐÝ9gE��ú uȤ������,���src/Composer/Repository/Vcs/GitHubDriver.phpV9��ÐÝ9gV9��Ûø+¤������,���src/Composer/Repository/Vcs/GitLabDriver.phpŽ2��ÐÝ9gŽ2��µ&¿g¤������(���src/Composer/Repository/Vcs/HgDriver.php���ÐÝ9g���yè÷Ǥ������.���src/Composer/Repository/Vcs/PerforceDriver.php ��ÐÝ9g ��Î%ÿÚ¤������)���src/Composer/Repository/Vcs/SvnDriver.phpý��ÐÝ9gý��O]©¤������)���src/Composer/Repository/Vcs/VcsDriver.php ��ÐÝ9g ��Î&þ:¤������2���src/Composer/Repository/Vcs/VcsDriverInterface.php±��ÐÝ9g±��TŠ„ø¤������)���src/Composer/Repository/VcsRepository.phpÌ4��ÐÝ9gÌ4��®Ù”«¤������1���src/Composer/Repository/VersionCacheInterface.php¹���ÐÝ9g¹���‚h‡¤������3���src/Composer/Repository/WritableArrayRepository.phpÙ��ÐÝ9gÙ��l&´#¤������7���src/Composer/Repository/WritableRepositoryInterface.phpw��ÐÝ9gw��Õ~¼0¤���������src/Composer/Script/Event.phpå��ÐÝ9gå��Š¼ y¤������$���src/Composer/Script/ScriptEvents.phpI��ÐÝ9gI��¤£D4¤������ ���src/Composer/SelfUpdate/Keys.phpÙ��ÐÝ9gÙ��É ¨s¤������$���src/Composer/SelfUpdate/Versions.php] ��ÐÝ9g] ��ØŽ¤������ ���src/Composer/Util/AuthHelper.phpv#��ÐÝ9gv#��3̱¤���������src/Composer/Util/Bitbucket.phpN��ÐÝ9gN��j j¤������$���src/Composer/Util/ComposerMirror.php��ÐÝ9g��£4ˤ������%���src/Composer/Util/ConfigValidator.phps��ÐÝ9gs��ÕH¡ü¤������"���src/Composer/Util/ErrorHandler.php„��ÐÝ9g„��‡!&¿¤������ ���src/Composer/Util/Filesystem.phpáA��ÐÝ9gáA��òî!¶¤���������src/Composer/Util/Git.php_B��ÐÝ9g_B��*Ö§ ¤���������src/Composer/Util/GitHub.php?��ÐÝ9g?��¡Å²n¤���������src/Composer/Util/GitLab.phpö��ÐÝ9gö��»‘Š&¤���������src/Composer/Util/Hg.php… ��ÐÝ9g… ��¸’ø¤������)���src/Composer/Util/Http/CurlDownloader.phpO��ÐÝ9gO��uŸÂ¤������'���src/Composer/Util/Http/CurlResponse.php•��ÐÝ9g•��’;©¹¤������$���src/Composer/Util/Http/ProxyItem.phpE��ÐÝ9gE��yŸÝÕ¤������'���src/Composer/Util/Http/ProxyManager.phpT ��ÐÝ9gT ��•‘šø¤������'���src/Composer/Util/Http/RequestProxy.php†��ÐÝ9g†��YD?¤������#���src/Composer/Util/Http/Response.phpÞ��ÐÝ9gÞ��Ü… £¤������$���src/Composer/Util/HttpDownloader.phpï)��ÐÝ9gï)��ó'kö¤���������src/Composer/Util/IniHelper.phpŽ��ÐÝ9gŽ��™m®B¤���������src/Composer/Util/Loop.phpý��ÐÝ9gý��Ÿû£¤������&���src/Composer/Util/MetadataMinifier.phpC��ÐÝ9gC��d ˜¤������$���src/Composer/Util/NoProxyPattern.php(��ÐÝ9g(��Mû ¡¤������!���src/Composer/Util/PackageInfo.phpà��ÐÝ9gà���RX¤������#���src/Composer/Util/PackageSorter.phpÅ��ÐÝ9gÅ��öµ›ž¤���������src/Composer/Util/Perforce.phpN5��ÐÝ9gN5��ªÑ{4¤���������src/Composer/Util/Platform.php„��ÐÝ9g„��·âC¤������%���src/Composer/Util/ProcessExecutor.phpó)��ÐÝ9gó)��—þ�¤������&���src/Composer/Util/RemoteFilesystem.phpµA��ÐÝ9gµA��¶émš¤���������src/Composer/Util/Silencer.phpñ��ÐÝ9gñ��G�ÏE¤������*���src/Composer/Util/StreamContextFactory.php˜��ÐÝ9g˜��{®Tߤ���������src/Composer/Util/Svn.php›��ÐÝ9g›��ƒtT¢¤������ ���src/Composer/Util/SyncHelper.phpÿ��ÐÝ9gÿ��ÐzA¤���������src/Composer/Util/Tar.php…��ÐÝ9g…��÷Ìt?¤���������src/Composer/Util/TlsHelper.php§ ��ÐÝ9g§ ��%þx-¤���������src/Composer/Util/Url.phpË ��ÐÝ9gË ��4f¤���������src/Composer/Util/Zip.php��ÐÝ9g��£DÙ‘¤���������src/bootstrap.php
  39. ��ÐÝ9g
  40. ��ÑÄ-Ȥ������%���src/Composer/Autoload/ClassLoader.phpú?��ÐÝ9gú?��2@u¤������"���src/Composer/InstalledVersions.php?��ÐÝ9g?�� 2ªÅ¤���������res/composer-lock-schema.json¯ ��ÐÝ9g¯ ��·Ærf¤������#���res/composer-repository-schema.jsonø ��ÐÝ9gø ��×븂¤���������res/composer-schema.json¥Ö��ÐÝ9g¥Ö��Ã��¤���������vendor/autoload.phpo��ÐÝ9go�� Ù¤���������vendor/composer/ClassLoader.php/��ÐÝ9g/��˜Õâ’¤������%���vendor/composer/InstalledVersions.php��ÐÝ9g���xG¤������%���vendor/composer/autoload_classmap.phpò��ÐÝ9gò��êðÙפ������"���vendor/composer/autoload_files.php��ÐÝ9g��‹ebd¤������'���vendor/composer/autoload_namespaces.phpZ���ÐÝ9gZ���ë¦á–¤������!���vendor/composer/autoload_psr4.php®��ÐÝ9g®��úYI¤������!���vendor/composer/autoload_real.phpÆ��ÐÝ9gÆ��¢Ë:¤������#���vendor/composer/autoload_static.php0��ÐÝ9g0��Ü·ª§¤������!���vendor/composer/ca-bundle/LICENSE��ÐÝ9g��G _¤������(���vendor/composer/ca-bundle/res/cacert.pem_•�ÐÝ9g_•�%·Ø¤������*���vendor/composer/ca-bundle/src/CaBundle.php��ÐÝ9g��nª¿¤������+���vendor/composer/class-map-generator/LICENSE��ÐÝ9g��=ù¾õ¤������4���vendor/composer/class-map-generator/src/ClassMap.php± ��ÐÝ9g± ��6 B¤������=���vendor/composer/class-map-generator/src/ClassMapGenerator.php2��ÐÝ9g2��ZÔx¤������4���vendor/composer/class-map-generator/src/FileList.php$��ÐÝ9g$��hôSq¤������:���vendor/composer/class-map-generator/src/PhpFileCleaner.php ��ÐÝ9g ��/<;*¤������9���vendor/composer/class-map-generator/src/PhpFileParser.php® ��ÐÝ9g® ��Ú}ݼ¤���������vendor/composer/installed.jsonc$�ÐÝ9gc$�¡ý#û¤���������vendor/composer/installed.phpŠ ��ÐÝ9gŠ ��RÖê¤������)���vendor/composer/metadata-minifier/LICENSE��ÐÝ9g��½£ëǤ������:���vendor/composer/metadata-minifier/src/MetadataMinifier.phpÐ��ÐÝ9gÐ��Â0&À¤���������vendor/composer/pcre/LICENSE��ÐÝ9g��½£ëǤ������+���vendor/composer/pcre/src/MatchAllResult.php��ÐÝ9g�� \9ÿ¤������7���vendor/composer/pcre/src/MatchAllStrictGroupsResult.php)��ÐÝ9g)��hIŸ…¤������6���vendor/composer/pcre/src/MatchAllWithOffsetsResult.php*��ÐÝ9g*��øA à¤������(���vendor/composer/pcre/src/MatchResult.phpï���ÐÝ9gï���<äÀ¤������4���vendor/composer/pcre/src/MatchStrictGroupsResult.phpû���ÐÝ9gû���§Ë0Q¤������3���vendor/composer/pcre/src/MatchWithOffsetsResult.phpü���ÐÝ9gü���{*,o¤������<���vendor/composer/pcre/src/PHPStan/InvalidRegexPatternRule.phpâ ��ÐÝ9gâ ��üØîפ������3���vendor/composer/pcre/src/PHPStan/PregMatchFlags.phpp��ÐÝ9gp��YÊM¤������G���vendor/composer/pcre/src/PHPStan/PregMatchParameterOutTypeExtension.php1��ÐÝ9g1��Â}ÌÒ¤������E���vendor/composer/pcre/src/PHPStan/PregMatchTypeSpecifyingExtension.phpÙ ��ÐÝ9gÙ ��CºÇ¤������L���vendor/composer/pcre/src/PHPStan/PregReplaceCallbackClosureTypeExtension.phpˆ��ÐÝ9gˆ��Øø/¤������?���vendor/composer/pcre/src/PHPStan/UnsafeStrictGroupsCallRule.phpk
  41. ��ÐÝ9gk
  42. ��3E½¤������*���vendor/composer/pcre/src/PcreException.phpj��ÐÝ9gj��*»ª\¤������!���vendor/composer/pcre/src/Preg.php0"��ÐÝ9g0"��ѹ”{¤������"���vendor/composer/pcre/src/Regex.php ��ÐÝ9g ��£ù뇤������*���vendor/composer/pcre/src/ReplaceResult.php��ÐÝ9g��'±Èð¤������9���vendor/composer/pcre/src/UnexpectedNullMatchException.php��ÐÝ9g�� îÀò¤���������vendor/composer/semver/LICENSE��ÐÝ9g��ÇSRm¤������)���vendor/composer/semver/src/Comparator.php��ÐÝ9g��^_E“¤������/���vendor/composer/semver/src/CompilingMatcher.phpc��ÐÝ9gc��„€¦¤������/���vendor/composer/semver/src/Constraint/Bound.phpw��ÐÝ9gw��W4]W¤������4���vendor/composer/semver/src/Constraint/Constraint.phpø��ÐÝ9gø��’‹ˆ½¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.php¡��ÐÝ9g¡��Ž5´y¤������<���vendor/composer/semver/src/Constraint/MatchAllConstraint.php¯��ÐÝ9g¯��²Eú¤������=���vendor/composer/semver/src/Constraint/MatchNoneConstraint.phpÉ��ÐÝ9gÉ��֯خ¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.phpŠ��ÐÝ9gŠ��ÍÕĤ������'���vendor/composer/semver/src/Interval.phpæ��ÐÝ9gæ��=[i¤������(���vendor/composer/semver/src/Intervals.php¤+��ÐÝ9g¤+��@1º«¤������%���vendor/composer/semver/src/Semver.phpù��ÐÝ9gù��á-i¤������,���vendor/composer/semver/src/VersionParser.php×-��ÐÝ9g×-��*›p¤������%���vendor/composer/spdx-licenses/LICENSE��ÐÝ9g��ÇSRm¤������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json��ÐÝ9g��"mÓê¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonï��ÐÝ9gï��
  43. ‘x ¤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.php{��ÐÝ9g{��cE�¤������&���vendor/composer/xdebug-handler/LICENSE+��ÐÝ9g+��Öã@T¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php‰��ÐÝ9g‰��gÔ�v¤������.���vendor/composer/xdebug-handler/src/Process.phpò��ÐÝ9gò��fžZ.¤������-���vendor/composer/xdebug-handler/src/Status.phpÒ ��ÐÝ9gÒ ��±Ít¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.phpÓ,��ÐÝ9gÓ,��:@Óã¤������(���vendor/justinrainbow/json-schema/LICENSE"��ÐÝ9g"�� |»™¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php� ��ÐÝ9g� ��G?”¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php…
  44. ��ÐÝ9g…
  45. ��Ž^àó¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.phpà ��ÐÝ9gà ��F­6¦¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¸��ÐÝ9g¸��ºHëÓ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��ÐÝ9g]��äè€5¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpâ ��ÐÝ9gâ ��å³ Ü¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.phpt��ÐÝ9gt��; S¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php„ ��ÐÝ9g„ ��–¢<¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpµ��ÐÝ9gµ��»òæ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php' ��ÐÝ9g' ��¬Ò]p¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php{��ÐÝ9g{��Õ²çp¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��ÐÝ9ga�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��ÐÝ9g—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��ÐÝ9g‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php+��ÐÝ9g+��¾n´c¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpH"��ÐÝ9gH"��™ÿK'¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��ÐÝ9gè��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���ÐÝ9gI���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���ÐÝ9g•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���ÐÝ9gl���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���ÐÝ9gl���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���ÐÝ9gu���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���ÐÝ9gw���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpß��ÐÝ9gß��­¬Ò»¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���ÐÝ9go���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���ÐÝ9g…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���ÐÝ9g€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���ÐÝ9gj���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���ÐÝ9gf���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��ÐÝ9gþ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��ÐÝ9g ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php• ��ÐÝ9g• ��c{Â=¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��ÐÝ9g��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���ÐÝ9gá���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php£��ÐÝ9g£��Ç’ô¦¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php ��ÐÝ9g ��£Á¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��ÐÝ9g,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���ÐÝ9g®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��ÐÝ9g ��æP¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php@��ÐÝ9g@��5Î3¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���ÐÝ9gƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���ÐÝ9g…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phps��ÐÝ9gs��ßÁ‘#¤���������vendor/psr/container/LICENSE{��ÐÝ9g{��ÕÓ�e¤������8���vendor/psr/container/src/ContainerExceptionInterface.phpN���ÐÝ9gN���üLƒ¤������/���vendor/psr/container/src/ContainerInterface.php·���ÐÝ9g·���Šã¼¤������7���vendor/psr/container/src/NotFoundExceptionInterface.phpq���ÐÝ9gq���Rúõ¤���������vendor/psr/log/LICENSE?��ÐÝ9g?��„ù ¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��ÐÝ9g;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���ÐÝ9g`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû���ÐÝ9gû���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���ÐÝ9g|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���ÐÝ9g§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��ÐÝ9gÈ��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��ÐÝ9gk��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.phpŸ���ÐÝ9gŸ����Xóª¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp���ÐÝ9gp���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ��ÐÝ9g ��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��ÐÝ9g<��þ(åI¤���������vendor/react/promise/LICENSEi��ÐÝ9gi��3}‹¤������%���vendor/react/promise/src/Deferred.phpS��ÐÝ9gS��½ö׆¤������9���vendor/react/promise/src/Exception/CompositeException.phpŒ��ÐÝ9gŒ��!ŒÏâ¤������6���vendor/react/promise/src/Exception/LengthException.php^���ÐÝ9g^���?q¤������7���vendor/react/promise/src/Internal/CancellationQueue.phpr��ÐÝ9gr���x_±¤������6���vendor/react/promise/src/Internal/FulfilledPromise.phpw��ÐÝ9gw��ÿV÷¯¤������5���vendor/react/promise/src/Internal/RejectedPromise.phpõ��ÐÝ9gõ��Ÿ‡ú¤������$���vendor/react/promise/src/Promise.php���ÐÝ9g���²eªÒ¤������-���vendor/react/promise/src/PromiseInterface.phpi��ÐÝ9gi��&](¤������&���vendor/react/promise/src/functions.phpÇ��ÐÝ9gÇ��<îÂ`¤������.���vendor/react/promise/src/functions_include.php]���ÐÝ9g]���QÑ<¡¤���������vendor/seld/jsonlint/LICENSE$��ÐÝ9g$��4:‡~¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php|��ÐÝ9g|��šÊ ì¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.phpM9��ÐÝ9gM9��|Án¤������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php¥��ÐÝ9g¥��È»_¤¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php(��ÐÝ9g(��>Ûv}¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���ÐÝ9g>���ÿqŸŸ¤���������vendor/seld/phar-utils/LICENSE$��ÐÝ9g$��š,M§¤������%���vendor/seld/phar-utils/src/Linter.phpi��ÐÝ9gi�� �Þ¤������)���vendor/seld/phar-utils/src/Timestamps.php^ ��ÐÝ9g^ ���åÃD¤������"���vendor/seld/signal-handler/LICENSE$��ÐÝ9g$��š,M§¤������0���vendor/seld/signal-handler/src/SignalHandler.php°��ÐÝ9g°����
  46. ¤������&���vendor/symfony/console/Application.phpq��ÐÝ9gq��ým!„¤������.���vendor/symfony/console/Attribute/AsCommand.phpÔ��ÐÝ9gÔ��½3Üþ¤������2���vendor/symfony/console/CI/GithubActionReporter.phpõ��ÐÝ9gõ��¾Û"g¤������ ���vendor/symfony/console/Color.phph��ÐÝ9gh��Gbç—¤������*���vendor/symfony/console/Command/Command.phpJ'��ÐÝ9gJ'��� Úw¤������2���vendor/symfony/console/Command/CompleteCommand.php‹��ÐÝ9g‹��¾}¤������8���vendor/symfony/console/Command/DumpCompletionCommand.php���ÐÝ9g���9›9¤������.���vendor/symfony/console/Command/HelpCommand.php ��ÐÝ9g ��}—¥¤������.���vendor/symfony/console/Command/LazyCommand.php›��ÐÝ9g›��žmå¤������.���vendor/symfony/console/Command/ListCommand.php1 ��ÐÝ9g1 ��$D»|¤������0���vendor/symfony/console/Command/LockableTrait.php��ÐÝ9g��q5gj¤������=���vendor/symfony/console/Command/SignalableCommandInterface.phpÓ���ÐÝ9gÓ���»B`¾¤������?���vendor/symfony/console/CommandLoader/CommandLoaderInterface.phpQ��ÐÝ9gQ��›žH¤������?���vendor/symfony/console/CommandLoader/ContainerCommandLoader.phpU��ÐÝ9gU��Ë_ü¤������=���vendor/symfony/console/CommandLoader/FactoryCommandLoader.php¯��ÐÝ9g¯��d¼"z¤������5���vendor/symfony/console/Completion/CompletionInput.php��ÐÝ9g��”$„k¤������;���vendor/symfony/console/Completion/CompletionSuggestions.phpÂ��ÐÝ9gÂ��A¡¤������A���vendor/symfony/console/Completion/Output/BashCompletionOutput.phpg��ÐÝ9gg��‡ìùW¤������F���vendor/symfony/console/Completion/Output/CompletionOutputInterface.phpF��ÐÝ9gF��Ô2nM¤������0���vendor/symfony/console/Completion/Suggestion.php3��ÐÝ9g3��̆ ¤������(���vendor/symfony/console/ConsoleEvents.phpÕ��ÐÝ9gÕ���gw]¤������!���vendor/symfony/console/Cursor.php� ��ÐÝ9g� ��Æ«§Ž¤������D���vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.phpf��ÐÝ9gf��#Ô $¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÙ ��ÐÝ9gÙ ��çpC^¤������0���vendor/symfony/console/Descriptor/Descriptor.php}��ÐÝ9g}��±ê3^¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.php÷���ÐÝ9g÷���µå@à¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpë��ÐÝ9gë��1%è�¤������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.phpQ��ÐÝ9gQ��t ˆv¤������4���vendor/symfony/console/Descriptor/TextDescriptor.phpç"��ÐÝ9gç"��ȸÌˤ������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��ÐÝ9g��uI@š¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.phpÉ��ÐÝ9gÉ��°Öá¤������2���vendor/symfony/console/Event/ConsoleErrorEvent.phpý��ÐÝ9gý��é%˜¤������-���vendor/symfony/console/Event/ConsoleEvent.phpÆ��ÐÝ9gÆ��ÅoÛÙ¤������3���vendor/symfony/console/Event/ConsoleSignalEvent.phpG��ÐÝ9gG��Žû ¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.php~��ÐÝ9g~��hr½Ö¤������6���vendor/symfony/console/EventListener/ErrorListener.php'��ÐÝ9g'��𢡉¤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÛ��ÐÝ9gÛ��K}ž¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpy���ÐÝ9gy���Ù9[&¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���ÐÝ9g¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���ÐÝ9g¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’���ÐÝ9g’���ÍO\e¤������:���vendor/symfony/console/Exception/MissingInputException.phpœ���ÐÝ9gœ���æS
  47. þ¤������?���vendor/symfony/console/Exception/NamespaceNotFoundException.php‹���ÐÝ9g‹���‚ón©¤������5���vendor/symfony/console/Exception/RuntimeException.php–���ÐÝ9g–���Ùí,6¤������8���vendor/symfony/console/Formatter/NullOutputFormatter.php���ÐÝ9g���!& u¤������=���vendor/symfony/console/Formatter/NullOutputFormatterStyle.php ��ÐÝ9g ��Ê0‡Ø¤������4���vendor/symfony/console/Formatter/OutputFormatter.php��ÐÝ9g��Ü楤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.php£��ÐÝ9g£��Y §ß¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpz��ÐÝ9gz��ÿja­¤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.phpŸ��ÐÝ9gŸ��ø€Äw¤������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php…��ÐÝ9g…��LÙኤ������F���vendor/symfony/console/Formatter/WrappableOutputFormatterInterface.phpÖ���ÐÝ9gÖ���¡Z·¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.php¸��ÐÝ9g¸��¤ð6 ¤������2���vendor/symfony/console/Helper/DescriptorHelper.phpÀ��ÐÝ9gÀ��¦gÌ„¤������(���vendor/symfony/console/Helper/Dumper.php��ÐÝ9g��Ÿ<Ëߤ������1���vendor/symfony/console/Helper/FormatterHelper.phpi��ÐÝ9gi��¤¶€w¤������(���vendor/symfony/console/Helper/Helper.php� ��ÐÝ9g� ��Á”1T¤������1���vendor/symfony/console/Helper/HelperInterface.phpæ���ÐÝ9gæ���`RÂ\¤������+���vendor/symfony/console/Helper/HelperSet.phpI��ÐÝ9gI��=‡âD¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��ÐÝ9gc��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.php\ ��ÐÝ9g\ ��ÄzA¤������-���vendor/symfony/console/Helper/ProgressBar.phpX/��ÐÝ9gX/��2p’ä¤������3���vendor/symfony/console/Helper/ProgressIndicator.phpÀ��ÐÝ9gÀ��‡Ëeõ¤������0���vendor/symfony/console/Helper/QuestionHelper.phpR-��ÐÝ9gR-��æ§1i¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php ��ÐÝ9g ��à�dÿ¤������'���vendor/symfony/console/Helper/Table.php´J��ÐÝ9g´J��S×Á­¤������+���vendor/symfony/console/Helper/TableCell.phpA��ÐÝ9gA��èÓ ¤������0���vendor/symfony/console/Helper/TableCellStyle.phpî��ÐÝ9gî��Ñ�¹_¤������+���vendor/symfony/console/Helper/TableRows.php)��ÐÝ9g)��WŠ3z¤������0���vendor/symfony/console/Helper/TableSeparator.phpÅ���ÐÝ9gÅ���¼õËü¤������,���vendor/symfony/console/Helper/TableStyle.php���ÐÝ9g���Wº¤������*���vendor/symfony/console/Input/ArgvInput.php+��ÐÝ9g+��F±¶Ñ¤������+���vendor/symfony/console/Input/ArrayInput.php ��ÐÝ9g ��ñ¦Ÿ.¤������&���vendor/symfony/console/Input/Input.php¤ ��ÐÝ9g¤ ��ÚÜo±¤������.���vendor/symfony/console/Input/InputArgument.php��ÐÝ9g��ΠÀú¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜���ÐÝ9g˜���­O°¤������0���vendor/symfony/console/Input/InputDefinition.php#��ÐÝ9g#�� Œ!3¤������/���vendor/symfony/console/Input/InputInterface.phpü��ÐÝ9gü��G¶ô¨¤������,���vendor/symfony/console/Input/InputOption.php��ÐÝ9g��Iªž/¤������9���vendor/symfony/console/Input/StreamableInputInterface.phpÎ���ÐÝ9gÎ���ÖÕB›¤������,���vendor/symfony/console/Input/StringInput.php?��ÐÝ9g?��±’ˤ���������vendor/symfony/console/LICENSE.��ÐÝ9g.��÷ºk¤������/���vendor/symfony/console/Logger/ConsoleLogger.php ��ÐÝ9g ��Ç Q¤������0���vendor/symfony/console/Output/BufferedOutput.phpl��ÐÝ9gl��y:¸¤������/���vendor/symfony/console/Output/ConsoleOutput.php‘ ��ÐÝ9g‘ ��\Ýïb¤������8���vendor/symfony/console/Output/ConsoleOutputInterface.php��ÐÝ9g��‰ê÷´¤������6���vendor/symfony/console/Output/ConsoleSectionOutput.php” ��ÐÝ9g” ��Àgo@¤������,���vendor/symfony/console/Output/NullOutput.phpB��ÐÝ9gB��%#RƤ������(���vendor/symfony/console/Output/Output.phpÈ ��ÐÝ9gÈ ��ŸË8x¤������1���vendor/symfony/console/Output/OutputInterface.phpí��ÐÝ9gí��ðŽ¾¤������.���vendor/symfony/console/Output/StreamOutput.php¢��ÐÝ9g¢��,¾"ü¤������5���vendor/symfony/console/Output/TrimmedBufferOutput.phpÛ��ÐÝ9gÛ��lkƒ~¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpÝ
  48. ��ÐÝ9gÝ
  49. �� c䦤������8���vendor/symfony/console/Question/ConfirmationQuestion.php��ÐÝ9g��îyÅ„¤������,���vendor/symfony/console/Question/Question.php" ��ÐÝ9g" ��ÊÞ¹Û¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��ÐÝ9g�$��•�¥v¤������0���vendor/symfony/console/Resources/completion.bashÏ
  50. ��ÐÝ9gÏ
  51. ��›'r¤������8���vendor/symfony/console/SignalRegistry/SignalRegistry.php!��ÐÝ9g!��~.:¯¤������3���vendor/symfony/console/SingleCommandApplication.php7��ÐÝ9g7��Í1¾¤������,���vendor/symfony/console/Style/OutputStyle.phpt��ÐÝ9gt��O;Ƥ������/���vendor/symfony/console/Style/StyleInterface.php��ÐÝ9g��\ž¤������-���vendor/symfony/console/Style/SymfonyStyle.php5'��ÐÝ9g5'��yl÷ô¤������#���vendor/symfony/console/Terminal.phpm ��ÐÝ9gm ��‡¥Pv¤������3���vendor/symfony/console/Tester/ApplicationTester.phpŒ��ÐÝ9gŒ��Iû¤������9���vendor/symfony/console/Tester/CommandCompletionTester.phpÚ��ÐÝ9gÚ��Ê›;°¤������/���vendor/symfony/console/Tester/CommandTester.phpÙ��ÐÝ9gÙ��D¶¤������@���vendor/symfony/console/Tester/Constraint/CommandIsSuccessful.phpÖ��ÐÝ9gÖ��ƃ‚¤������-���vendor/symfony/console/Tester/TesterTrait.php¬ ��ÐÝ9g¬ ��2'L²¤������,���vendor/symfony/deprecation-contracts/LICENSE.��ÐÝ9g.��äôˆ¤������1���vendor/symfony/deprecation-contracts/function.php=��ÐÝ9g=��žÁ´ ¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.php|���ÐÝ9g|����éD¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.phpÑ��ÐÝ9gÑ��bæ}´¤������3���vendor/symfony/filesystem/Exception/IOException.php›��ÐÝ9g›��3_Ãê¤������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���ÐÝ9g¦���jÙwM¤������@���vendor/symfony/filesystem/Exception/InvalidArgumentException.php©���ÐÝ9g©����!Ǥ������8���vendor/symfony/filesystem/Exception/RuntimeException.php™���ÐÝ9g™���ÝUUH¤������(���vendor/symfony/filesystem/Filesystem.php$B��ÐÝ9g$B��’Àw;¤������!���vendor/symfony/filesystem/LICENSE.��ÐÝ9g.��÷ºk¤������"���vendor/symfony/filesystem/Path.phpb'��ÐÝ9gb'��ߣ¤������/���vendor/symfony/finder/Comparator/Comparator.php4��ÐÝ9g4��"ì¼Õ¤������3���vendor/symfony/finder/Comparator/DateComparator.php��ÐÝ9g��Ï%úe¤������5���vendor/symfony/finder/Comparator/NumberComparator.phpz��ÐÝ9gz��+¼�h¤������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���ÐÝ9g„���½¾sœ¤������>���vendor/symfony/finder/Exception/DirectoryNotFoundException.php‰���ÐÝ9g‰���a)ÿ¤������ ���vendor/symfony/finder/Finder.phpÖ'��ÐÝ9gÖ'��Ž?ä¤������#���vendor/symfony/finder/Gitignore.php³��ÐÝ9g³��s 4¤���������vendor/symfony/finder/Glob.phpÇ��ÐÝ9gÇ��Db‡³¤������7���vendor/symfony/finder/Iterator/CustomFilterIterator.phpc��ÐÝ9gc��7ð™¤������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.php���ÐÝ9g���Pšs¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php��ÐÝ9g��§Ž¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php0��ÐÝ9g0��.wv¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpˆ��ÐÝ9gˆ��^¶"û¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.phpW��ÐÝ9gW��ÂÅÙ¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.php”��ÐÝ9g”��=™Üô¤������/���vendor/symfony/finder/Iterator/LazyIterator.phpQ��ÐÝ9gQ��n]¿¼¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php���ÐÝ9g���¢€×¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpò��ÐÝ9gò��g"_¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.phpK ��ÐÝ9gK ��é†F ¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php|��ÐÝ9g|��3ÙŸ¤������3���vendor/symfony/finder/Iterator/SortableIterator.php(
  52. ��ÐÝ9g(
  53. ��Ó⮤������;���vendor/symfony/finder/Iterator/VcsIgnoredFilterIterator.phpw
  54. ��ÐÝ9gw
  55. ��ŵ3¤���������vendor/symfony/finder/LICENSE.��ÐÝ9g.��÷ºk¤������%���vendor/symfony/finder/SplFileInfo.php½��ÐÝ9g½��y¤������'���vendor/symfony/polyfill-ctype/Ctype.php‡
  56. ��ÐÝ9g‡
  57. ��~¶d¸¤������%���vendor/symfony/polyfill-ctype/LICENSE.��ÐÝ9g.��¦¸©X¤������+���vendor/symfony/polyfill-ctype/bootstrap.php2��ÐÝ9g2��Èa­8¤������-���vendor/symfony/polyfill-ctype/bootstrap80.phph��ÐÝ9gh��K¿y¸¤������2���vendor/symfony/polyfill-intl-grapheme/Grapheme.phpÚ��ÐÝ9gÚ��� ›¤������-���vendor/symfony/polyfill-intl-grapheme/LICENSE.��ÐÝ9g.��Ëk¤������3���vendor/symfony/polyfill-intl-grapheme/bootstrap.phpÏ��ÐÝ9gÏ��ý9À|¤������5���vendor/symfony/polyfill-intl-grapheme/bootstrap80.phpY ��ÐÝ9gY ��¨! ¤������/���vendor/symfony/polyfill-intl-normalizer/LICENSE.��ÐÝ9g.��Ëk¤������6���vendor/symfony/polyfill-intl-normalizer/Normalizer.phpö��ÐÝ9gö��êiÝe¤������F���vendor/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php.��ÐÝ9g.��Qs$—¤������R���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalComposition.php‰=��ÐÝ9g‰=��*ïo?¤������T���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/canonicalDecomposition.phpaˆ��ÐÝ9gaˆ��çR½}¤������L���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/combiningClass.phpt.��ÐÝ9gt.�� q�ܤ������X���vendor/symfony/polyfill-intl-normalizer/Resources/unidata/compatibilityDecomposition.php™è��ÐÝ9g™è��o”e)¤������5���vendor/symfony/polyfill-intl-normalizer/bootstrap.phpë��ÐÝ9gë��Pú£D¤������7���vendor/symfony/polyfill-intl-normalizer/bootstrap80.phpé��ÐÝ9gé��=år´¤������(���vendor/symfony/polyfill-mbstring/LICENSE.��ÐÝ9g.��Ëk¤������-���vendor/symfony/polyfill-mbstring/Mbstring.phpô^��ÐÝ9gô^��ÇXô«¤������B���vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php•��ÐÝ9g•��ô¶³ã¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.phpùT��ÐÝ9gùT��•±+¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��ÐÝ9gã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php8[��ÐÝ9g8[��+RØ*¤������.���vendor/symfony/polyfill-mbstring/bootstrap.phpm��ÐÝ9gm��Oé; ¤������0���vendor/symfony/polyfill-mbstring/bootstrap80.phpr%��ÐÝ9gr%��ï_Q¤������%���vendor/symfony/polyfill-php73/LICENSE.��ÐÝ9g.��¦¸©X¤������'���vendor/symfony/polyfill-php73/Php73.phpn��ÐÝ9gn��Cs¥l¤������?���vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php[���ÐÝ9g[���M²Ü¤������+���vendor/symfony/polyfill-php73/bootstrap.phpù��ÐÝ9gù��AY8Ƥ������%���vendor/symfony/polyfill-php80/LICENSE.��ÐÝ9g.��äôˆ¤������'���vendor/symfony/polyfill-php80/Php80.php¡ ��ÐÝ9g¡ ��[Âk ¤������*���vendor/symfony/polyfill-php80/PhpToken.php��ÐÝ9g��M£�I¤������;���vendor/symfony/polyfill-php80/Resources/stubs/Attribute.phpÇ��ÐÝ9gÇ��ÝÞíû¤������:���vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php����ÐÝ9g����Ú”ݤ������<���vendor/symfony/polyfill-php80/Resources/stubs/Stringable.phpk���ÐÝ9gk���Ðý+¤������E���vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php]���ÐÝ9g]���ºgä������<���vendor/symfony/polyfill-php80/Resources/stubs/ValueError.phpT���ÐÝ9gT���‘Öw—¤������+���vendor/symfony/polyfill-php80/bootstrap.phpú��ÐÝ9gú��×îå¤������%���vendor/symfony/polyfill-php81/LICENSE.��ÐÝ9g.��;c©§¤������'���vendor/symfony/polyfill-php81/Php81.php;��ÐÝ9g;��ù«d¤������@���vendor/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php‚��ÐÝ9g‚��áÁ?ì¤������F���vendor/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.phpŸ���ÐÝ9gŸ���ÎÀ¾ü¤������+���vendor/symfony/polyfill-php81/bootstrap.phpô��ÐÝ9gô��ˆÓÐ\¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpy���ÐÝ9gy���qVXJ¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���ÐÝ9g¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”���ÐÝ9g”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��ÐÝ9gx��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessSignaledException.php��ÐÝ9g��Yשâ¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php1��ÐÝ9g1��‚'Z¤������5���vendor/symfony/process/Exception/RuntimeException.php˜���ÐÝ9g˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.phpø��ÐÝ9gø��¿[ª¤������&���vendor/symfony/process/InputStream.php0��ÐÝ9g0��Œ„>‡¤���������vendor/symfony/process/LICENSE.��ÐÝ9g.��÷ºk¤������.���vendor/symfony/process/PhpExecutableFinder.phpÿ��ÐÝ9gÿ��ê®ÅŒ¤������%���vendor/symfony/process/PhpProcess.phpø��ÐÝ9gø��pÄX¤������.���vendor/symfony/process/Pipes/AbstractPipes.php ��ÐÝ9g ��kSQ¤������/���vendor/symfony/process/Pipes/PipesInterface.php™��ÐÝ9g™��fQÚ ¤������*���vendor/symfony/process/Pipes/UnixPipes.php€��ÐÝ9g€��¾”Vv¤������-���vendor/symfony/process/Pipes/WindowsPipes.php4 ��ÐÝ9g4 �� VÄà¤������"���vendor/symfony/process/Process.phpBh��ÐÝ9gBh��H"Τ������'���vendor/symfony/process/ProcessUtils.php��ÐÝ9g��ÓXì¤������7���vendor/symfony/service-contracts/Attribute/Required.php¨���ÐÝ9g¨���xj네������@���vendor/symfony/service-contracts/Attribute/SubscribedService.php
  58. ��ÐÝ9g
  59. ��1I®T¤������(���vendor/symfony/service-contracts/LICENSE.��ÐÝ9g.��¦¸©X¤������3���vendor/symfony/service-contracts/ResetInterface.phpy���ÐÝ9gy���°·jå¤������8���vendor/symfony/service-contracts/ServiceLocatorTrait.phpã ��ÐÝ9gã ��"�5é¤������=���vendor/symfony/service-contracts/ServiceProviderInterface.phpÞ���ÐÝ9gÞ���úRèk¤������?���vendor/symfony/service-contracts/ServiceSubscriberInterface.php³���ÐÝ9g³���—öd ¤������;���vendor/symfony/service-contracts/ServiceSubscriberTrait.php`
  60. ��ÐÝ9g`
  61. ��È3u¤������<���vendor/symfony/service-contracts/Test/ServiceLocatorTest.php²���ÐÝ9g²���mùªÔ¤������@���vendor/symfony/service-contracts/Test/ServiceLocatorTestCase.phpœ��ÐÝ9gœ��ÅšŒ½¤������(���vendor/symfony/string/AbstractString.php*4��ÐÝ9g*4��°J û¤������/���vendor/symfony/string/AbstractUnicodeString.php¸R��ÐÝ9g¸R��#·¤������$���vendor/symfony/string/ByteString.phpÿ+��ÐÝ9gÿ+��K«Ó^¤������)���vendor/symfony/string/CodePointString.phpõ��ÐÝ9gõ��BÂ�¤������6���vendor/symfony/string/Exception/ExceptionInterface.phps���ÐÝ9gs���qHV‘¤������<���vendor/symfony/string/Exception/InvalidArgumentException.php¢���ÐÝ9g¢���¥A¤������4���vendor/symfony/string/Exception/RuntimeException.php’���ÐÝ9g’���u‘g¤������4���vendor/symfony/string/Inflector/EnglishInflector.phpJ��ÐÝ9gJ��³Ø3¤������3���vendor/symfony/string/Inflector/FrenchInflector.phpˆ
  62. ��ÐÝ9gˆ
  63. ��·ŠH¤������6���vendor/symfony/string/Inflector/InflectorInterface.php×���ÐÝ9g×���hD£¤���������vendor/symfony/string/LICENSE.��ÐÝ9g.��š?ôw¤������$���vendor/symfony/string/LazyString.phpC ��ÐÝ9gC ��§á¬b¤������<���vendor/symfony/string/Resources/data/wcswidth_table_wide.php$��ÐÝ9g$��¥À–K¤������<���vendor/symfony/string/Resources/data/wcswidth_table_zero.phpÔ��ÐÝ9gÔ��Òþ$¤������-���vendor/symfony/string/Resources/functions.php��ÐÝ9g��cÚª"¤������.���vendor/symfony/string/Slugger/AsciiSlugger.phpì��ÐÝ9gì��}&ʤ������2���vendor/symfony/string/Slugger/SluggerInterface.php��ÐÝ9g���kñ¨¤������'���vendor/symfony/string/UnicodeString.phpí%��ÐÝ9gí%��ýÁ˜5¤������ ���bin/composer5 ��ÐÝ9g5 ��á?â¤���������LICENSE.��ÐÝ9g.�� Õ¤������<?php declare(strict_types=1);
  64. namespace Composer\Advisory;
  65. use Composer\IO\ConsoleIO;
  66. use Composer\IO\IOInterface;
  67. use Composer\Json\JsonFile;
  68. use Composer\Package\CompletePackageInterface;
  69. use Composer\Package\PackageInterface;
  70. use Composer\Repository\RepositorySet;
  71. use Composer\Util\PackageInfo;
  72. use InvalidArgumentException;
  73. use Symfony\Component\Console\Formatter\OutputFormatter;
  74. class Auditor
  75. {
  76. public const FORMAT_TABLE = 'table';
  77. public const FORMAT_PLAIN = 'plain';
  78. public const FORMAT_JSON = 'json';
  79. public const FORMAT_SUMMARY = 'summary';
  80. public const FORMATS = [
  81. self::FORMAT_TABLE,
  82. self::FORMAT_PLAIN,
  83. self::FORMAT_JSON,
  84. self::FORMAT_SUMMARY,
  85. ];
  86. public const ABANDONED_IGNORE = 'ignore';
  87. public const ABANDONED_REPORT = 'report';
  88. public const ABANDONED_FAIL = 'fail';
  89. public const ABANDONEDS = [
  90. self::ABANDONED_IGNORE,
  91. self::ABANDONED_REPORT,
  92. self::ABANDONED_FAIL,
  93. ];
  94. public function audit(IOInterface $io, RepositorySet $repoSet, array $packages, string $format, bool $warningOnly = true, array $ignoreList = [], string $abandoned = self::ABANDONED_FAIL, array $ignoredSeverities = []): int
  95. {
  96. $allAdvisories = $repoSet->getMatchingSecurityAdvisories($packages, $format === self::FORMAT_SUMMARY);
  97. if (count($allAdvisories) > 0 && $ignoreList !== [] && $format === self::FORMAT_SUMMARY) {
  98. $allAdvisories = $repoSet->getMatchingSecurityAdvisories($packages, false);
  99. }
  100. ['advisories' => $advisories, 'ignoredAdvisories' => $ignoredAdvisories] = $this->processAdvisories($allAdvisories, $ignoreList, $ignoredSeverities);
  101. $abandonedCount = 0;
  102. $affectedPackagesCount = 0;
  103. if ($abandoned === self::ABANDONED_IGNORE) {
  104. $abandonedPackages = [];
  105. } else {
  106. $abandonedPackages = $this->filterAbandonedPackages($packages);
  107. if ($abandoned === self::ABANDONED_FAIL) {
  108. $abandonedCount = count($abandonedPackages);
  109. }
  110. }
  111. if (self::FORMAT_JSON === $format) {
  112. $json = ['advisories' => $advisories];
  113. if ($ignoredAdvisories !== []) {
  114. $json['ignored-advisories'] = $ignoredAdvisories;
  115. }
  116. $json['abandoned'] = array_reduce($abandonedPackages, static function (array $carry, CompletePackageInterface $package): array {
  117. $carry[$package->getPrettyName()] = $package->getReplacementPackage();
  118. return $carry;
  119. }, []);
  120. $io->write(JsonFile::encode($json));
  121. return count($advisories) + $abandonedCount;
  122. }
  123. $errorOrWarn = $warningOnly ? 'warning' : 'error';
  124. if (count($advisories) > 0 || count($ignoredAdvisories) > 0) {
  125. $passes = [
  126. [$ignoredAdvisories, "<info>Found %d ignored security vulnerability advisor%s affecting %d package%s%s</info>"],
  127. [$advisories, "<$errorOrWarn>Found %d security vulnerability advisor%s affecting %d package%s%s</$errorOrWarn>"],
  128. ];
  129. foreach ($passes as [$advisoriesToOutput, $message]) {
  130. [$affectedPackagesCount, $totalAdvisoryCount] = $this->countAdvisories($advisoriesToOutput);
  131. if ($affectedPackagesCount > 0) {
  132. $plurality = $totalAdvisoryCount === 1 ? 'y' : 'ies';
  133. $pkgPlurality = $affectedPackagesCount === 1 ? '' : 's';
  134. $punctuation = $format === 'summary' ? '.' : ':';
  135. $io->writeError(sprintf($message, $totalAdvisoryCount, $plurality, $affectedPackagesCount, $pkgPlurality, $punctuation));
  136. $this->outputAdvisories($io, $advisoriesToOutput, $format);
  137. }
  138. }
  139. if ($format === self::FORMAT_SUMMARY) {
  140. $io->writeError('Run "composer audit" for a full list of advisories.');
  141. }
  142. } else {
  143. $io->writeError('<info>No security vulnerability advisories found.</info>');
  144. }
  145. if (count($abandonedPackages) > 0 && $format !== self::FORMAT_SUMMARY) {
  146. $this->outputAbandonedPackages($io, $abandonedPackages, $format);
  147. }
  148. return $affectedPackagesCount + $abandonedCount;
  149. }
  150. private function filterAbandonedPackages(array $packages): array
  151. {
  152. return array_filter($packages, static function (PackageInterface $pkg) {
  153. return $pkg instanceof CompletePackageInterface && $pkg->isAbandoned();
  154. });
  155. }
  156. private function processAdvisories(array $allAdvisories, array $ignoreList, array $ignoredSeverities): array
  157. {
  158. if ($ignoreList === [] && $ignoredSeverities === []) {
  159. return ['advisories' => $allAdvisories, 'ignoredAdvisories' => []];
  160. }
  161. if (\count($ignoreList) > 0 && !\array_is_list($ignoreList)) {
  162. $ignoredIds = array_keys($ignoreList);
  163. } else {
  164. $ignoredIds = $ignoreList;
  165. }
  166. $advisories = [];
  167. $ignored = [];
  168. $ignoreReason = null;
  169. foreach ($allAdvisories as $package => $pkgAdvisories) {
  170. foreach ($pkgAdvisories as $advisory) {
  171. $isActive = true;
  172. if (in_array($advisory->advisoryId, $ignoredIds, true)) {
  173. $isActive = false;
  174. $ignoreReason = $ignoreList[$advisory->advisoryId] ?? null;
  175. }
  176. if ($advisory instanceof SecurityAdvisory) {
  177. if (in_array($advisory->severity, $ignoredSeverities, true)) {
  178. $isActive = false;
  179. $ignoreReason = "Ignored via --ignore-severity={$advisory->severity}";
  180. }
  181. if (in_array($advisory->cve, $ignoredIds, true)) {
  182. $isActive = false;
  183. $ignoreReason = $ignoreList[$advisory->cve] ?? null;
  184. }
  185. foreach ($advisory->sources as $source) {
  186. if (in_array($source['remoteId'], $ignoredIds, true)) {
  187. $isActive = false;
  188. $ignoreReason = $ignoreList[$source['remoteId']] ?? null;
  189. break;
  190. }
  191. }
  192. }
  193. if ($isActive) {
  194. $advisories[$package][] = $advisory;
  195. continue;
  196. }
  197. if ($advisory instanceof SecurityAdvisory) {
  198. $advisory = $advisory->toIgnoredAdvisory($ignoreReason);
  199. }
  200. $ignored[$package][] = $advisory;
  201. }
  202. }
  203. return ['advisories' => $advisories, 'ignoredAdvisories' => $ignored];
  204. }
  205. private function countAdvisories(array $advisories): array
  206. {
  207. $count = 0;
  208. foreach ($advisories as $packageAdvisories) {
  209. $count += count($packageAdvisories);
  210. }
  211. return [count($advisories), $count];
  212. }
  213. private function outputAdvisories(IOInterface $io, array $advisories, string $format): void
  214. {
  215. switch ($format) {
  216. case self::FORMAT_TABLE:
  217. if (!($io instanceof ConsoleIO)) {
  218. throw new InvalidArgumentException('Cannot use table format with ' . get_class($io));
  219. }
  220. $this->outputAdvisoriesTable($io, $advisories);
  221. return;
  222. case self::FORMAT_PLAIN:
  223. $this->outputAdvisoriesPlain($io, $advisories);
  224. return;
  225. case self::FORMAT_SUMMARY:
  226. return;
  227. default:
  228. throw new InvalidArgumentException('Invalid format "'.$format.'".');
  229. }
  230. }
  231. private function outputAdvisoriesTable(ConsoleIO $io, array $advisories): void
  232. {
  233. foreach ($advisories as $packageAdvisories) {
  234. foreach ($packageAdvisories as $advisory) {
  235. $headers = [
  236. 'Package',
  237. 'Severity',
  238. 'CVE',
  239. 'Title',
  240. 'URL',
  241. 'Affected versions',
  242. 'Reported at',
  243. ];
  244. $row = [
  245. $advisory->packageName,
  246. $this->getSeverity($advisory),
  247. $this->getCVE($advisory),
  248. $advisory->title,
  249. $this->getURL($advisory),
  250. $advisory->affectedVersions->getPrettyString(),
  251. $advisory->reportedAt->format(DATE_ATOM),
  252. ];
  253. if ($advisory->cve === null) {
  254. $headers[] = 'Advisory ID';
  255. $row[] = $advisory->advisoryId;
  256. }
  257. if ($advisory instanceof IgnoredSecurityAdvisory) {
  258. $headers[] = 'Ignore reason';
  259. $row[] = $advisory->ignoreReason ?? 'None specified';
  260. }
  261. $io->getTable()
  262. ->setHorizontal()
  263. ->setHeaders($headers)
  264. ->addRow($row)
  265. ->setColumnWidth(1, 80)
  266. ->setColumnMaxWidth(1, 80)
  267. ->render();
  268. }
  269. }
  270. }
  271. private function outputAdvisoriesPlain(IOInterface $io, array $advisories): void
  272. {
  273. $error = [];
  274. $firstAdvisory = true;
  275. foreach ($advisories as $packageAdvisories) {
  276. foreach ($packageAdvisories as $advisory) {
  277. if (!$firstAdvisory) {
  278. $error[] = '--------';
  279. }
  280. $error[] = "Package: ".$advisory->packageName;
  281. $error[] = "Severity: ".$this->getSeverity($advisory);
  282. $error[] = "CVE: ".$this->getCVE($advisory);
  283. if ($advisory->cve === null) {
  284. $error[] = "Advisory ID: ".$advisory->advisoryId;
  285. }
  286. $error[] = "Title: ".OutputFormatter::escape($advisory->title);
  287. $error[] = "URL: ".$this->getURL($advisory);
  288. $error[] = "Affected versions: ".OutputFormatter::escape($advisory->affectedVersions->getPrettyString());
  289. $error[] = "Reported at: ".$advisory->reportedAt->format(DATE_ATOM);
  290. if ($advisory instanceof IgnoredSecurityAdvisory) {
  291. $error[] = "Ignore reason: ".($advisory->ignoreReason ?? 'None specified');
  292. }
  293. $firstAdvisory = false;
  294. }
  295. }
  296. $io->writeError($error);
  297. }
  298. private function outputAbandonedPackages(IOInterface $io, array $packages, string $format): void
  299. {
  300. $io->writeError(sprintf('<error>Found %d abandoned package%s:</error>', count($packages), count($packages) > 1 ? 's' : ''));
  301. if ($format === self::FORMAT_PLAIN) {
  302. foreach ($packages as $pkg) {
  303. $replacement = $pkg->getReplacementPackage() !== null
  304. ? 'Use '.$pkg->getReplacementPackage().' instead'
  305. : 'No replacement was suggested';
  306. $io->writeError(sprintf(
  307. '%s is abandoned. %s.',
  308. $this->getPackageNameWithLink($pkg),
  309. $replacement
  310. ));
  311. }
  312. return;
  313. }
  314. if (!($io instanceof ConsoleIO)) {
  315. throw new InvalidArgumentException('Cannot use table format with ' . get_class($io));
  316. }
  317. $table = $io->getTable()
  318. ->setHeaders(['Abandoned Package', 'Suggested Replacement'])
  319. ->setColumnWidth(1, 80)
  320. ->setColumnMaxWidth(1, 80);
  321. foreach ($packages as $pkg) {
  322. $replacement = $pkg->getReplacementPackage() !== null ? $pkg->getReplacementPackage() : 'none';
  323. $table->addRow([$this->getPackageNameWithLink($pkg), $replacement]);
  324. }
  325. $table->render();
  326. }
  327. private function getPackageNameWithLink(PackageInterface $package): string
  328. {
  329. $packageUrl = PackageInfo::getViewSourceOrHomepageUrl($package);
  330. return $packageUrl !== null ? '<href=' . OutputFormatter::escape($packageUrl) . '>' . $package->getPrettyName() . '</>' : $package->getPrettyName();
  331. }
  332. private function getSeverity(SecurityAdvisory $advisory): string
  333. {
  334. if ($advisory->severity === null) {
  335. return '';
  336. }
  337. return $advisory->severity;
  338. }
  339. private function getCVE(SecurityAdvisory $advisory): string
  340. {
  341. if ($advisory->cve === null) {
  342. return 'NO CVE';
  343. }
  344. return '<href=https://cve.mitre.org/cgi-bin/cvename.cgi?name='.$advisory->cve.'>'.$advisory->cve.'</>';
  345. }
  346. private function getURL(SecurityAdvisory $advisory): string
  347. {
  348. if ($advisory->link === null) {
  349. return '';
  350. }
  351. return '<href='.OutputFormatter::escape($advisory->link).'>'.OutputFormatter::escape($advisory->link).'</>';
  352. }
  353. }
  354. <?php declare(strict_types=1);
  355. namespace Composer\Advisory;
  356. use Composer\Semver\Constraint\ConstraintInterface;
  357. use DateTimeImmutable;
  358. class IgnoredSecurityAdvisory extends SecurityAdvisory
  359. {
  360. public $ignoreReason;
  361. public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions, string $title, array $sources, DateTimeImmutable $reportedAt, ?string $cve = null, ?string $link = null, ?string $ignoreReason = null, ?string $severity = null)
  362. {
  363. parent::__construct($packageName, $advisoryId, $affectedVersions, $title, $sources, $reportedAt, $cve, $link, $severity);
  364. $this->ignoreReason = $ignoreReason;
  365. }
  366. #[\ReturnTypeWillChange]
  367. public function jsonSerialize()
  368. {
  369. $data = parent::jsonSerialize();
  370. if ($this->ignoreReason === NULL) {
  371. unset($data['ignoreReason']);
  372. }
  373. return $data;
  374. }
  375. }
  376. <?php declare(strict_types=1);
  377. namespace Composer\Advisory;
  378. use Composer\Semver\Constraint\ConstraintInterface;
  379. use Composer\Semver\VersionParser;
  380. use JsonSerializable;
  381. class PartialSecurityAdvisory implements JsonSerializable
  382. {
  383. public $advisoryId;
  384. public $packageName;
  385. public $affectedVersions;
  386. public static function create(string $packageName, array $data, VersionParser $parser): self
  387. {
  388. $constraint = $parser->parseConstraints($data['affectedVersions']);
  389. if (isset($data['title'], $data['sources'], $data['reportedAt'])) {
  390. return new SecurityAdvisory($packageName, $data['advisoryId'], $constraint, $data['title'], $data['sources'], new \DateTimeImmutable($data['reportedAt'], new \DateTimeZone('UTC')), $data['cve'] ?? null, $data['link'] ?? null, $data['severity'] ?? null);
  391. }
  392. return new self($packageName, $data['advisoryId'], $constraint);
  393. }
  394. public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions)
  395. {
  396. $this->advisoryId = $advisoryId;
  397. $this->packageName = $packageName;
  398. $this->affectedVersions = $affectedVersions;
  399. }
  400. #[\ReturnTypeWillChange]
  401. public function jsonSerialize()
  402. {
  403. $data = (array) $this;
  404. $data['affectedVersions'] = $data['affectedVersions']->getPrettyString();
  405. return $data;
  406. }
  407. }
  408. <?php declare(strict_types=1);
  409. namespace Composer\Advisory;
  410. use Composer\Semver\Constraint\ConstraintInterface;
  411. use DateTimeImmutable;
  412. class SecurityAdvisory extends PartialSecurityAdvisory
  413. {
  414. public $title;
  415. public $cve;
  416. public $link;
  417. public $reportedAt;
  418. public $sources;
  419. public $severity;
  420. public function __construct(string $packageName, string $advisoryId, ConstraintInterface $affectedVersions, string $title, array $sources, DateTimeImmutable $reportedAt, ?string $cve = null, ?string $link = null, ?string $severity = null)
  421. {
  422. parent::__construct($packageName, $advisoryId, $affectedVersions);
  423. $this->title = $title;
  424. $this->sources = $sources;
  425. $this->reportedAt = $reportedAt;
  426. $this->cve = $cve;
  427. $this->link = $link;
  428. $this->severity = $severity;
  429. }
  430. public function toIgnoredAdvisory(?string $ignoreReason): IgnoredSecurityAdvisory
  431. {
  432. return new IgnoredSecurityAdvisory(
  433. $this->packageName,
  434. $this->advisoryId,
  435. $this->affectedVersions,
  436. $this->title,
  437. $this->sources,
  438. $this->reportedAt,
  439. $this->cve,
  440. $this->link,
  441. $ignoreReason,
  442. $this->severity
  443. );
  444. }
  445. #[\ReturnTypeWillChange]
  446. public function jsonSerialize()
  447. {
  448. $data = parent::jsonSerialize();
  449. $data['reportedAt'] = $data['reportedAt']->format(DATE_RFC3339);
  450. return $data;
  451. }
  452. }
  453. <?php declare(strict_types=1);
  454. namespace Composer\Autoload;
  455. use Composer\ClassMapGenerator\ClassMap;
  456. use Composer\ClassMapGenerator\ClassMapGenerator;
  457. use Composer\Config;
  458. use Composer\EventDispatcher\EventDispatcher;
  459. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  460. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  461. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  462. use Composer\Installer\InstallationManager;
  463. use Composer\IO\IOInterface;
  464. use Composer\IO\NullIO;
  465. use Composer\Package\AliasPackage;
  466. use Composer\Package\PackageInterface;
  467. use Composer\Package\RootPackageInterface;
  468. use Composer\Pcre\Preg;
  469. use Composer\Repository\InstalledRepositoryInterface;
  470. use Composer\Semver\Constraint\Bound;
  471. use Composer\Util\Filesystem;
  472. use Composer\Util\Platform;
  473. use Composer\Script\ScriptEvents;
  474. use Composer\Util\PackageSorter;
  475. use Composer\Json\JsonFile;
  476. use Composer\Package\Locker;
  477. use Symfony\Component\Console\Formatter\OutputFormatter;
  478. class AutoloadGenerator
  479. {
  480. private $eventDispatcher;
  481. private $io;
  482. private $devMode = null;
  483. private $classMapAuthoritative = false;
  484. private $apcu = false;
  485. private $apcuPrefix;
  486. private $dryRun = false;
  487. private $runScripts = false;
  488. private $platformRequirementFilter;
  489. public function __construct(EventDispatcher $eventDispatcher, ?IOInterface $io = null)
  490. {
  491. $this->eventDispatcher = $eventDispatcher;
  492. $this->io = $io ?? new NullIO();
  493. $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  494. }
  495. public function setDevMode(bool $devMode = true)
  496. {
  497. $this->devMode = $devMode;
  498. }
  499. public function setClassMapAuthoritative(bool $classMapAuthoritative)
  500. {
  501. $this->classMapAuthoritative = $classMapAuthoritative;
  502. }
  503. public function setApcu(bool $apcu, ?string $apcuPrefix = null)
  504. {
  505. $this->apcu = $apcu;
  506. $this->apcuPrefix = $apcuPrefix;
  507. }
  508. public function setRunScripts(bool $runScripts = true)
  509. {
  510. $this->runScripts = $runScripts;
  511. }
  512. public function setDryRun(bool $dryRun = true): void
  513. {
  514. $this->dryRun = $dryRun;
  515. }
  516. public function setIgnorePlatformRequirements($ignorePlatformReqs)
  517. {
  518. trigger_error('AutoloadGenerator::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
  519. $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
  520. }
  521. public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter)
  522. {
  523. $this->platformRequirementFilter = $platformRequirementFilter;
  524. }
  525. public function dump(Config $config, InstalledRepositoryInterface $localRepo, RootPackageInterface $rootPackage, InstallationManager $installationManager, string $targetDir, bool $scanPsrPackages = false, ?string $suffix = null, ?Locker $locker = null, bool $strictAmbiguous = false)
  526. {
  527. if ($this->classMapAuthoritative) {
  528. $scanPsrPackages = true;
  529. }
  530. if (null === $this->devMode) {
  531. $this->devMode = false;
  532. $installedJson = new JsonFile($config->get('vendor-dir').'/composer/installed.json');
  533. if ($installedJson->exists()) {
  534. $installedJson = $installedJson->read();
  535. if (isset($installedJson['dev'])) {
  536. $this->devMode = $installedJson['dev'];
  537. }
  538. }
  539. }
  540. if ($this->runScripts) {
  541. if (!isset($_SERVER['COMPOSER_DEV_MODE'])) {
  542. Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
  543. }
  544. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, [], [
  545. 'optimize' => $scanPsrPackages,
  546. ]);
  547. }
  548. $classMapGenerator = new ClassMapGenerator(['php', 'inc', 'hh']);
  549. $classMapGenerator->avoidDuplicateScans();
  550. $filesystem = new Filesystem();
  551. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  552. $basePath = $filesystem->normalizePath(realpath(realpath(Platform::getCwd())));
  553. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  554. $useGlobalIncludePath = $config->get('use-include-path');
  555. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  556. $targetDir = $vendorPath.'/'.$targetDir;
  557. $filesystem->ensureDirectoryExists($targetDir);
  558. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  559. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  560. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  561. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  562. $namespacesFile = <<<EOF
  563. <?php
  564. // autoload_namespaces.php @generated by Composer
  565. \$vendorDir = $vendorPathCode;
  566. \$baseDir = $appBaseDirCode;
  567. return array(
  568. EOF;
  569. $psr4File = <<<EOF
  570. <?php
  571. // autoload_psr4.php @generated by Composer
  572. \$vendorDir = $vendorPathCode;
  573. \$baseDir = $appBaseDirCode;
  574. return array(
  575. EOF;
  576. $devPackageNames = $localRepo->getDevPackageNames();
  577. $packageMap = $this->buildPackageMap($installationManager, $rootPackage, $localRepo->getCanonicalPackages());
  578. if ($this->devMode) {
  579. $filteredDevPackages = false;
  580. } else {
  581. $filteredDevPackages = $devPackageNames ?: true;
  582. }
  583. $autoloads = $this->parseAutoloads($packageMap, $rootPackage, $filteredDevPackages);
  584. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  585. $exportedPaths = [];
  586. foreach ($paths as $path) {
  587. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  588. }
  589. $exportedPrefix = var_export($namespace, true);
  590. $namespacesFile .= " $exportedPrefix => ";
  591. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  592. }
  593. $namespacesFile .= ");\n";
  594. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  595. $exportedPaths = [];
  596. foreach ($paths as $path) {
  597. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  598. }
  599. $exportedPrefix = var_export($namespace, true);
  600. $psr4File .= " $exportedPrefix => ";
  601. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  602. }
  603. $psr4File .= ");\n";
  604. $targetDirLoader = null;
  605. $mainAutoload = $rootPackage->getAutoload();
  606. if ($rootPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  607. $levels = substr_count($filesystem->normalizePath($rootPackage->getTargetDir()), '/') + 1;
  608. $prefixes = implode(', ', array_map(static function ($prefix): string {
  609. return var_export($prefix, true);
  610. }, array_keys($mainAutoload['psr-0'])));
  611. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  612. $targetDirLoader = <<<EOF
  613. public static function autoload(\$class)
  614. {
  615. \$dir = $baseDirFromTargetDirCode . '/';
  616. \$prefixes = array($prefixes);
  617. foreach (\$prefixes as \$prefix) {
  618. if (0 !== strpos(\$class, \$prefix)) {
  619. continue;
  620. }
  621. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  622. if (!\$path = stream_resolve_include_path(\$path)) {
  623. return false;
  624. }
  625. require \$path;
  626. return true;
  627. }
  628. }
  629. EOF;
  630. }
  631. $excluded = [];
  632. if (!empty($autoloads['exclude-from-classmap'])) {
  633. $excluded = $autoloads['exclude-from-classmap'];
  634. }
  635. foreach ($autoloads['classmap'] as $dir) {
  636. $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded));
  637. }
  638. if ($scanPsrPackages) {
  639. $namespacesToScan = [];
  640. foreach (['psr-4', 'psr-0'] as $psrType) {
  641. foreach ($autoloads[$psrType] as $namespace => $paths) {
  642. $namespacesToScan[$namespace][] = ['paths' => $paths, 'type' => $psrType];
  643. }
  644. }
  645. krsort($namespacesToScan);
  646. foreach ($namespacesToScan as $namespace => $groups) {
  647. foreach ($groups as $group) {
  648. foreach ($group['paths'] as $dir) {
  649. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  650. if (!is_dir($dir)) {
  651. continue;
  652. }
  653. if (str_contains($vendorPath, $dir.'/')) {
  654. $exclusionRegex = $this->buildExclusionRegex($dir, array_merge($excluded, [$vendorPath.'/']));
  655. } else {
  656. $exclusionRegex = $this->buildExclusionRegex($dir, $excluded);
  657. }
  658. $classMapGenerator->scanPaths($dir, $exclusionRegex, $group['type'], $namespace);
  659. }
  660. }
  661. }
  662. }
  663. $classMap = $classMapGenerator->getClassMap();
  664. if ($strictAmbiguous) {
  665. $ambiguousClasses = $classMap->getAmbiguousClasses(false);
  666. } else {
  667. $ambiguousClasses = $classMap->getAmbiguousClasses();
  668. }
  669. foreach ($ambiguousClasses as $className => $ambiguousPaths) {
  670. if (count($ambiguousPaths) > 1) {
  671. $this->io->writeError(
  672. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  673. ' was found '. (count($ambiguousPaths) + 1) .'x: in "'.$classMap->getClassPath($className).'" and "'. implode('", "', $ambiguousPaths) .'", the first will be used.</warning>'
  674. );
  675. } else {
  676. $this->io->writeError(
  677. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  678. ' was found in both "'.$classMap->getClassPath($className).'" and "'. implode('", "', $ambiguousPaths) .'", the first will be used.</warning>'
  679. );
  680. }
  681. }
  682. if (\count($ambiguousClasses) > 0) {
  683. $this->io->writeError('<info>To resolve ambiguity in classes not under your control you can ignore them by path using <href='.OutputFormatter::escape('https://getcomposer.org/doc/04-schema.md#exclude-files-from-classmaps').'>exclude-files-from-classmap</>');
  684. }
  685. $classMap->clearPsrViolationsByPath($vendorPath);
  686. foreach ($classMap->getPsrViolations() as $msg) {
  687. $this->io->writeError("<warning>$msg</warning>");
  688. }
  689. $classMap->addClass('Composer\InstalledVersions', $vendorPath . '/composer/InstalledVersions.php');
  690. $classMap->sort();
  691. $classmapFile = <<<EOF
  692. <?php
  693. // autoload_classmap.php @generated by Composer
  694. \$vendorDir = $vendorPathCode;
  695. \$baseDir = $appBaseDirCode;
  696. return array(
  697. EOF;
  698. foreach ($classMap->getMap() as $className => $path) {
  699. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  700. $classmapFile .= ' '.var_export($className, true).' => '.$pathCode;
  701. }
  702. $classmapFile .= ");\n";
  703. if ('' === $suffix) {
  704. $suffix = null;
  705. }
  706. if (null === $suffix) {
  707. $suffix = $config->get('autoloader-suffix');
  708. if (null === $suffix && Filesystem::isReadable($vendorPath.'/autoload.php')) {
  709. $content = (string) file_get_contents($vendorPath.'/autoload.php');
  710. if (Preg::isMatch('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  711. $suffix = $match[1];
  712. }
  713. }
  714. if (null === $suffix) {
  715. $suffix = $locker !== null && $locker->isLocked() ? $locker->getLockData()['content-hash'] : bin2hex(random_bytes(16));
  716. }
  717. }
  718. if ($this->dryRun) {
  719. return $classMap;
  720. }
  721. $filesystem->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
  722. $filesystem->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
  723. $filesystem->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
  724. $includePathFilePath = $targetDir.'/include_paths.php';
  725. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
  726. $filesystem->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
  727. } elseif (file_exists($includePathFilePath)) {
  728. unlink($includePathFilePath);
  729. }
  730. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  731. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
  732. $filesystem->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
  733. } elseif (file_exists($includeFilesFilePath)) {
  734. unlink($includeFilesFilePath);
  735. }
  736. $filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath));
  737. $checkPlatform = $config->get('platform-check') !== false && !($this->platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter);
  738. $platformCheckContent = null;
  739. if ($checkPlatform) {
  740. $platformCheckContent = $this->getPlatformCheck($packageMap, $config->get('platform-check'), $devPackageNames);
  741. if (null === $platformCheckContent) {
  742. $checkPlatform = false;
  743. }
  744. }
  745. if ($checkPlatform) {
  746. $filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $platformCheckContent);
  747. } elseif (file_exists($targetDir.'/platform_check.php')) {
  748. unlink($targetDir.'/platform_check.php');
  749. }
  750. $filesystem->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  751. $filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform));
  752. $filesystem->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  753. $filesystem->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  754. if ($this->runScripts) {
  755. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, [], [
  756. 'optimize' => $scanPsrPackages,
  757. ]);
  758. }
  759. return $classMap;
  760. }
  761. private function buildExclusionRegex(string $dir, array $excluded): ?string
  762. {
  763. if ([] === $excluded) {
  764. return null;
  765. }
  766. if (file_exists($dir)) {
  767. $dirMatch = preg_quote(strtr(realpath($dir), '\\', '/'));
  768. foreach ($excluded as $index => $pattern) {
  769. $pattern = Preg::replace('{^(([^.+*?\[^\]$(){}=!<>|:\\\\#-]+|\\\\[.+*?\[^\]$(){}=!<>|:#-])*).*}', '$1', $pattern);
  770. if (0 !== strpos($pattern, $dirMatch) && 0 !== strpos($dirMatch, $pattern)) {
  771. unset($excluded[$index]);
  772. }
  773. }
  774. }
  775. return \count($excluded) > 0 ? '{(' . implode('|', $excluded) . ')}' : null;
  776. }
  777. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $rootPackage, array $packages)
  778. {
  779. $packageMap = [[$rootPackage, '']];
  780. foreach ($packages as $package) {
  781. if ($package instanceof AliasPackage) {
  782. continue;
  783. }
  784. $this->validatePackage($package);
  785. $packageMap[] = [
  786. $package,
  787. $installationManager->getInstallPath($package),
  788. ];
  789. }
  790. return $packageMap;
  791. }
  792. protected function validatePackage(PackageInterface $package)
  793. {
  794. $autoload = $package->getAutoload();
  795. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  796. $name = $package->getName();
  797. $package->getTargetDir();
  798. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  799. }
  800. if (!empty($autoload['psr-4'])) {
  801. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  802. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  803. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  804. }
  805. }
  806. }
  807. }
  808. public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false)
  809. {
  810. $rootPackageMap = array_shift($packageMap);
  811. if (is_array($filteredDevPackages)) {
  812. $packageMap = array_filter($packageMap, static function ($item) use ($filteredDevPackages): bool {
  813. return !in_array($item[0]->getName(), $filteredDevPackages, true);
  814. });
  815. } elseif ($filteredDevPackages) {
  816. $packageMap = $this->filterPackageMap($packageMap, $rootPackage);
  817. }
  818. $sortedPackageMap = $this->sortPackageMap($packageMap);
  819. $sortedPackageMap[] = $rootPackageMap;
  820. array_unshift($packageMap, $rootPackageMap);
  821. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $rootPackage);
  822. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $rootPackage);
  823. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $rootPackage);
  824. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $rootPackage);
  825. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $rootPackage);
  826. krsort($psr0);
  827. krsort($psr4);
  828. return [
  829. 'psr-0' => $psr0,
  830. 'psr-4' => $psr4,
  831. 'classmap' => $classmap,
  832. 'files' => $files,
  833. 'exclude-from-classmap' => $exclude,
  834. ];
  835. }
  836. public function createLoader(array $autoloads, ?string $vendorDir = null)
  837. {
  838. $loader = new ClassLoader($vendorDir);
  839. if (isset($autoloads['psr-0'])) {
  840. foreach ($autoloads['psr-0'] as $namespace => $path) {
  841. $loader->add($namespace, $path);
  842. }
  843. }
  844. if (isset($autoloads['psr-4'])) {
  845. foreach ($autoloads['psr-4'] as $namespace => $path) {
  846. $loader->addPsr4($namespace, $path);
  847. }
  848. }
  849. if (isset($autoloads['classmap'])) {
  850. $excluded = [];
  851. if (!empty($autoloads['exclude-from-classmap'])) {
  852. $excluded = $autoloads['exclude-from-classmap'];
  853. }
  854. $classMapGenerator = new ClassMapGenerator(['php', 'inc', 'hh']);
  855. $classMapGenerator->avoidDuplicateScans();
  856. foreach ($autoloads['classmap'] as $dir) {
  857. try {
  858. $classMapGenerator->scanPaths($dir, $this->buildExclusionRegex($dir, $excluded));
  859. } catch (\RuntimeException $e) {
  860. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  861. }
  862. }
  863. $loader->addClassMap($classMapGenerator->getClassMap()->getMap());
  864. }
  865. return $loader;
  866. }
  867. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
  868. {
  869. $includePaths = [];
  870. foreach ($packageMap as $item) {
  871. [$package, $installPath] = $item;
  872. if (null === $installPath) {
  873. continue;
  874. }
  875. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  876. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  877. }
  878. foreach ($package->getIncludePaths() as $includePath) {
  879. $includePath = trim($includePath, '/');
  880. $includePaths[] = $installPath === '' ? $includePath : $installPath.'/'.$includePath;
  881. }
  882. }
  883. if (\count($includePaths) === 0) {
  884. return null;
  885. }
  886. $includePathsCode = '';
  887. foreach ($includePaths as $path) {
  888. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  889. }
  890. return <<<EOF
  891. <?php
  892. // include_paths.php @generated by Composer
  893. \$vendorDir = $vendorPathCode;
  894. \$baseDir = $appBaseDirCode;
  895. return array(
  896. $includePathsCode);
  897. EOF;
  898. }
  899. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, string $basePath, string $vendorPath, string $vendorPathCode, string $appBaseDirCode)
  900. {
  901. $files = array_map(
  902. function (string $functionFile) use ($filesystem, $basePath, $vendorPath): string {
  903. return $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile);
  904. },
  905. $files
  906. );
  907. $uniqueFiles = array_unique($files);
  908. if (count($uniqueFiles) < count($files)) {
  909. $this->io->writeError('<warning>The following "files" autoload rules are included multiple times, this may cause issues and should be resolved:</warning>');
  910. foreach (array_unique(array_diff_assoc($files, $uniqueFiles)) as $duplicateFile) {
  911. $this->io->writeError('<warning> - '.$duplicateFile.'</warning>');
  912. }
  913. }
  914. unset($uniqueFiles);
  915. $filesCode = '';
  916. foreach ($files as $fileIdentifier => $functionFile) {
  917. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => ' . $functionFile . ",\n";
  918. }
  919. if (!$filesCode) {
  920. return null;
  921. }
  922. return <<<EOF
  923. <?php
  924. // autoload_files.php @generated by Composer
  925. \$vendorDir = $vendorPathCode;
  926. \$baseDir = $appBaseDirCode;
  927. return array(
  928. $filesCode);
  929. EOF;
  930. }
  931. protected function getPathCode(Filesystem $filesystem, string $basePath, string $vendorPath, string $path)
  932. {
  933. if (!$filesystem->isAbsolutePath($path)) {
  934. $path = $basePath . '/' . $path;
  935. }
  936. $path = $filesystem->normalizePath($path);
  937. $baseDir = '';
  938. if (strpos($path.'/', $vendorPath.'/') === 0) {
  939. $path = (string) substr($path, strlen($vendorPath));
  940. $baseDir = '$vendorDir . ';
  941. } else {
  942. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  943. if (!$filesystem->isAbsolutePath($path)) {
  944. $baseDir = '$baseDir . ';
  945. $path = '/' . $path;
  946. }
  947. }
  948. if (strpos($path, '.phar') !== false) {
  949. $baseDir = "'phar://' . " . $baseDir;
  950. }
  951. return $baseDir . var_export($path, true);
  952. }
  953. protected function getPlatformCheck(array $packageMap, $checkPlatform, array $devPackageNames)
  954. {
  955. $lowestPhpVersion = Bound::zero();
  956. $requiredPhp64bit = false;
  957. $requiredExtensions = [];
  958. $extensionProviders = [];
  959. foreach ($packageMap as $item) {
  960. $package = $item[0];
  961. foreach (array_merge($package->getReplaces(), $package->getProvides()) as $link) {
  962. if (Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
  963. $extensionProviders[$match[1]][] = $link->getConstraint();
  964. }
  965. }
  966. }
  967. foreach ($packageMap as $item) {
  968. $package = $item[0];
  969. if (in_array($package->getName(), $devPackageNames, true)) {
  970. continue;
  971. }
  972. foreach ($package->getRequires() as $link) {
  973. if ($this->platformRequirementFilter->isIgnored($link->getTarget())) {
  974. continue;
  975. }
  976. if (in_array($link->getTarget(), ['php', 'php-64bit'], true)) {
  977. $constraint = $link->getConstraint();
  978. if ($constraint->getLowerBound()->compareTo($lowestPhpVersion, '>')) {
  979. $lowestPhpVersion = $constraint->getLowerBound();
  980. }
  981. }
  982. if ('php-64bit' === $link->getTarget()) {
  983. $requiredPhp64bit = true;
  984. }
  985. if ($checkPlatform === true && Preg::isMatch('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
  986. if (isset($extensionProviders[$match[1]])) {
  987. foreach ($extensionProviders[$match[1]] as $provided) {
  988. if ($provided->matches($link->getConstraint())) {
  989. continue 2;
  990. }
  991. }
  992. }
  993. if ($match[1] === 'zend-opcache') {
  994. $match[1] = 'zend opcache';
  995. }
  996. $extension = var_export($match[1], true);
  997. if ($match[1] === 'pcntl' || $match[1] === 'readline') {
  998. $requiredExtensions[$extension] = "PHP_SAPI !== 'cli' || extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
  999. } else {
  1000. $requiredExtensions[$extension] = "extension_loaded($extension) || \$missingExtensions[] = $extension;\n";
  1001. }
  1002. }
  1003. }
  1004. }
  1005. ksort($requiredExtensions);
  1006. $formatToPhpVersionId = static function (Bound $bound): int {
  1007. if ($bound->isZero()) {
  1008. return 0;
  1009. }
  1010. if ($bound->isPositiveInfinity()) {
  1011. return 99999;
  1012. }
  1013. $version = str_replace('-', '.', $bound->getVersion());
  1014. $chunks = array_map('intval', explode('.', $version));
  1015. return $chunks[0] * 10000 + $chunks[1] * 100 + $chunks[2];
  1016. };
  1017. $formatToHumanReadable = static function (Bound $bound) {
  1018. if ($bound->isZero()) {
  1019. return 0;
  1020. }
  1021. if ($bound->isPositiveInfinity()) {
  1022. return 99999;
  1023. }
  1024. $version = str_replace('-', '.', $bound->getVersion());
  1025. $chunks = explode('.', $version);
  1026. $chunks = array_slice($chunks, 0, 3);
  1027. return implode('.', $chunks);
  1028. };
  1029. $requiredPhp = '';
  1030. $requiredPhpError = '';
  1031. if (!$lowestPhpVersion->isZero()) {
  1032. $operator = $lowestPhpVersion->isInclusive() ? '>=' : '>';
  1033. $requiredPhp = 'PHP_VERSION_ID '.$operator.' '.$formatToPhpVersionId($lowestPhpVersion);
  1034. $requiredPhpError = '"'.$operator.' '.$formatToHumanReadable($lowestPhpVersion).'"';
  1035. }
  1036. if ($requiredPhp) {
  1037. $requiredPhp = <<<PHP_CHECK
  1038. if (!($requiredPhp)) {
  1039. \$issues[] = 'Your Composer dependencies require a PHP version $requiredPhpError. You are running ' . PHP_VERSION . '.';
  1040. }
  1041. PHP_CHECK;
  1042. }
  1043. if ($requiredPhp64bit) {
  1044. $requiredPhp .= <<<PHP_CHECK
  1045. if (PHP_INT_SIZE !== 8) {
  1046. \$issues[] = 'Your Composer dependencies require a 64-bit build of PHP.';
  1047. }
  1048. PHP_CHECK;
  1049. }
  1050. $requiredExtensions = implode('', $requiredExtensions);
  1051. if ('' !== $requiredExtensions) {
  1052. $requiredExtensions = <<<EXT_CHECKS
  1053. \$missingExtensions = array();
  1054. $requiredExtensions
  1055. if (\$missingExtensions) {
  1056. \$issues[] = 'Your Composer dependencies require the following PHP extensions to be installed: ' . implode(', ', \$missingExtensions) . '.';
  1057. }
  1058. EXT_CHECKS;
  1059. }
  1060. if (!$requiredPhp && !$requiredExtensions) {
  1061. return null;
  1062. }
  1063. return <<<PLATFORM_CHECK
  1064. <?php
  1065. // platform_check.php @generated by Composer
  1066. \$issues = array();
  1067. {$requiredPhp}{$requiredExtensions}
  1068. if (\$issues) {
  1069. if (!headers_sent()) {
  1070. header('HTTP/1.1 500 Internal Server Error');
  1071. }
  1072. if (!ini_get('display_errors')) {
  1073. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  1074. fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, \$issues) . PHP_EOL.PHP_EOL);
  1075. } elseif (!headers_sent()) {
  1076. echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, \$issues)) . PHP_EOL.PHP_EOL;
  1077. }
  1078. }
  1079. trigger_error(
  1080. 'Composer detected issues in your platform: ' . implode(' ', \$issues),
  1081. E_USER_ERROR
  1082. );
  1083. }
  1084. PLATFORM_CHECK;
  1085. }
  1086. protected function getAutoloadFile(string $vendorPathToTargetDirCode, string $suffix)
  1087. {
  1088. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  1089. if ("'" === $lastChar || '"' === $lastChar) {
  1090. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  1091. } else {
  1092. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  1093. }
  1094. return <<<AUTOLOAD
  1095. <?php
  1096. // autoload.php @generated by Composer
  1097. if (PHP_VERSION_ID < 50600) {
  1098. if (!headers_sent()) {
  1099. header('HTTP/1.1 500 Internal Server Error');
  1100. }
  1101. \$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  1102. if (!ini_get('display_errors')) {
  1103. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  1104. fwrite(STDERR, \$err);
  1105. } elseif (!headers_sent()) {
  1106. echo \$err;
  1107. }
  1108. }
  1109. trigger_error(
  1110. \$err,
  1111. E_USER_ERROR
  1112. );
  1113. }
  1114. require_once $vendorPathToTargetDirCode;
  1115. return ComposerAutoloaderInit$suffix::getLoader();
  1116. AUTOLOAD;
  1117. }
  1118. protected function getAutoloadRealFile(bool $useClassMap, bool $useIncludePath, ?string $targetDirLoader, bool $useIncludeFiles, string $vendorPathCode, string $appBaseDirCode, string $suffix, bool $useGlobalIncludePath, string $prependAutoloader, bool $checkPlatform)
  1119. {
  1120. $file = <<<HEADER
  1121. <?php
  1122. // autoload_real.php @generated by Composer
  1123. class ComposerAutoloaderInit$suffix
  1124. {
  1125. private static \$loader;
  1126. public static function loadClassLoader(\$class)
  1127. {
  1128. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  1129. require __DIR__ . '/ClassLoader.php';
  1130. }
  1131. }
  1132. /**
  1133. * @return \Composer\Autoload\ClassLoader
  1134. */
  1135. public static function getLoader()
  1136. {
  1137. if (null !== self::\$loader) {
  1138. return self::\$loader;
  1139. }
  1140. HEADER;
  1141. if ($checkPlatform) {
  1142. $file .= <<<'PLATFORM_CHECK'
  1143. require __DIR__ . '/platform_check.php';
  1144. PLATFORM_CHECK;
  1145. }
  1146. $file .= <<<CLASSLOADER_INIT
  1147. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  1148. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader(\\dirname(__DIR__));
  1149. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  1150. CLASSLOADER_INIT;
  1151. if ($useIncludePath) {
  1152. $file .= <<<'INCLUDE_PATH'
  1153. $includePaths = require __DIR__ . '/include_paths.php';
  1154. $includePaths[] = get_include_path();
  1155. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  1156. INCLUDE_PATH;
  1157. }
  1158. $file .= <<<STATIC_INIT
  1159. require __DIR__ . '/autoload_static.php';
  1160. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  1161. STATIC_INIT;
  1162. if ($this->classMapAuthoritative) {
  1163. $file .= <<<'CLASSMAPAUTHORITATIVE'
  1164. $loader->setClassMapAuthoritative(true);
  1165. CLASSMAPAUTHORITATIVE;
  1166. }
  1167. if ($this->apcu) {
  1168. $apcuPrefix = var_export(($this->apcuPrefix !== null ? $this->apcuPrefix : bin2hex(random_bytes(10))), true);
  1169. $file .= <<<APCU
  1170. \$loader->setApcuPrefix($apcuPrefix);
  1171. APCU;
  1172. }
  1173. if ($useGlobalIncludePath) {
  1174. $file .= <<<'INCLUDEPATH'
  1175. $loader->setUseIncludePath(true);
  1176. INCLUDEPATH;
  1177. }
  1178. if ($targetDirLoader) {
  1179. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  1180. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  1181. REGISTER_TARGET_DIR_AUTOLOAD;
  1182. }
  1183. $file .= <<<REGISTER_LOADER
  1184. \$loader->register($prependAutoloader);
  1185. REGISTER_LOADER;
  1186. if ($useIncludeFiles) {
  1187. $file .= <<<INCLUDE_FILES
  1188. \$filesToLoad = \Composer\Autoload\ComposerStaticInit$suffix::\$files;
  1189. \$requireFile = \Closure::bind(static function (\$fileIdentifier, \$file) {
  1190. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  1191. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  1192. require \$file;
  1193. }
  1194. }, null, null);
  1195. foreach (\$filesToLoad as \$fileIdentifier => \$file) {
  1196. \$requireFile(\$fileIdentifier, \$file);
  1197. }
  1198. INCLUDE_FILES;
  1199. }
  1200. $file .= <<<METHOD_FOOTER
  1201. return \$loader;
  1202. }
  1203. METHOD_FOOTER;
  1204. $file .= $targetDirLoader;
  1205. return $file . <<<FOOTER
  1206. }
  1207. FOOTER;
  1208. }
  1209. protected function getStaticFile(string $suffix, string $targetDir, string $vendorPath, string $basePath)
  1210. {
  1211. $file = <<<HEADER
  1212. <?php
  1213. // autoload_static.php @generated by Composer
  1214. namespace Composer\Autoload;
  1215. class ComposerStaticInit$suffix
  1216. {
  1217. HEADER;
  1218. $loader = new ClassLoader();
  1219. $map = require $targetDir . '/autoload_namespaces.php';
  1220. foreach ($map as $namespace => $path) {
  1221. $loader->set($namespace, $path);
  1222. }
  1223. $map = require $targetDir . '/autoload_psr4.php';
  1224. foreach ($map as $namespace => $path) {
  1225. $loader->setPsr4($namespace, $path);
  1226. }
  1227. $classMap = require $targetDir . '/autoload_classmap.php';
  1228. if ($classMap) {
  1229. $loader->addClassMap($classMap);
  1230. }
  1231. $filesystem = new Filesystem();
  1232. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  1233. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  1234. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  1235. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  1236. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  1237. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  1238. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  1239. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  1240. $initializer = '';
  1241. $prefix = "\0Composer\Autoload\ClassLoader\0";
  1242. $prefixLen = strlen($prefix);
  1243. if (file_exists($targetDir . '/autoload_files.php')) {
  1244. $maps = ['files' => require $targetDir . '/autoload_files.php'];
  1245. } else {
  1246. $maps = [];
  1247. }
  1248. foreach ((array) $loader as $prop => $value) {
  1249. if (!is_array($value) || \count($value) === 0 || !str_starts_with($prop, $prefix)) {
  1250. continue;
  1251. }
  1252. $maps[substr($prop, $prefixLen)] = $value;
  1253. }
  1254. foreach ($maps as $prop => $value) {
  1255. $value = strtr(
  1256. var_export($value, true),
  1257. [
  1258. $absoluteVendorPathCode => $vendorPathCode,
  1259. $absoluteVendorPharPathCode => $vendorPharPathCode,
  1260. $absoluteAppBaseDirCode => $appBaseDirCode,
  1261. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  1262. ]
  1263. );
  1264. $value = ltrim(Preg::replace('/^ */m', ' $0$0', $value));
  1265. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  1266. if ('files' !== $prop) {
  1267. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  1268. }
  1269. }
  1270. return $file . <<<INITIALIZER
  1271. public static function getInitializer(ClassLoader \$loader)
  1272. {
  1273. return \Closure::bind(function () use (\$loader) {
  1274. $initializer
  1275. }, null, ClassLoader::class);
  1276. }
  1277. }
  1278. INITIALIZER;
  1279. }
  1280. protected function parseAutoloadsType(array $packageMap, string $type, RootPackageInterface $rootPackage)
  1281. {
  1282. $autoloads = [];
  1283. foreach ($packageMap as $item) {
  1284. [$package, $installPath] = $item;
  1285. if (null === $installPath) {
  1286. continue;
  1287. }
  1288. $autoload = $package->getAutoload();
  1289. if ($this->devMode && $package === $rootPackage) {
  1290. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  1291. }
  1292. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  1293. continue;
  1294. }
  1295. if (null !== $package->getTargetDir() && $package !== $rootPackage) {
  1296. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  1297. }
  1298. foreach ($autoload[$type] as $namespace => $paths) {
  1299. if (in_array($type, ['psr-4', 'psr-0'], true)) {
  1300. $namespace = ltrim($namespace, '\\');
  1301. }
  1302. foreach ((array) $paths as $path) {
  1303. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !Filesystem::isReadable($installPath.'/'.$path)) {
  1304. if ($package === $rootPackage) {
  1305. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(['/', '\\'], '<dirsep>', $package->getTargetDir())));
  1306. $path = ltrim(Preg::replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  1307. } else {
  1308. $path = $package->getTargetDir() . '/' . $path;
  1309. }
  1310. }
  1311. if ($type === 'exclude-from-classmap') {
  1312. $path = Preg::replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  1313. $path = strtr($path, ['\\*\\*' => '.+?', '\\*' => '[^/]+?']);
  1314. $updir = null;
  1315. $path = Preg::replaceCallback(
  1316. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  1317. static function ($matches) use (&$updir): string {
  1318. $updir = str_replace('\\.', '.', $matches[1]);
  1319. return '';
  1320. },
  1321. $path
  1322. );
  1323. if (empty($installPath)) {
  1324. $installPath = strtr(Platform::getCwd(), '\\', '/');
  1325. }
  1326. $resolvedPath = realpath($installPath . '/' . $updir);
  1327. if (false === $resolvedPath) {
  1328. continue;
  1329. }
  1330. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
  1331. continue;
  1332. }
  1333. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  1334. if ($type === 'files') {
  1335. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  1336. continue;
  1337. }
  1338. if ($type === 'classmap') {
  1339. $autoloads[] = $relativePath;
  1340. continue;
  1341. }
  1342. $autoloads[$namespace][] = $relativePath;
  1343. }
  1344. }
  1345. }
  1346. return $autoloads;
  1347. }
  1348. protected function getFileIdentifier(PackageInterface $package, string $path)
  1349. {
  1350. return hash('md5', $package->getName() . ':' . $path);
  1351. }
  1352. protected function filterPackageMap(array $packageMap, RootPackageInterface $rootPackage)
  1353. {
  1354. $packages = [];
  1355. $include = [];
  1356. $replacedBy = [];
  1357. foreach ($packageMap as $item) {
  1358. $package = $item[0];
  1359. $name = $package->getName();
  1360. $packages[$name] = $package;
  1361. foreach ($package->getReplaces() as $replace) {
  1362. $replacedBy[$replace->getTarget()] = $name;
  1363. }
  1364. }
  1365. $add = static function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy): void {
  1366. foreach ($package->getRequires() as $link) {
  1367. $target = $link->getTarget();
  1368. if (isset($replacedBy[$target])) {
  1369. $target = $replacedBy[$target];
  1370. }
  1371. if (!isset($include[$target])) {
  1372. $include[$target] = true;
  1373. if (isset($packages[$target])) {
  1374. $add($packages[$target]);
  1375. }
  1376. }
  1377. }
  1378. };
  1379. $add($rootPackage);
  1380. return array_filter(
  1381. $packageMap,
  1382. static function ($item) use ($include): bool {
  1383. $package = $item[0];
  1384. foreach ($package->getNames() as $name) {
  1385. if (isset($include[$name])) {
  1386. return true;
  1387. }
  1388. }
  1389. return false;
  1390. }
  1391. );
  1392. }
  1393. protected function sortPackageMap(array $packageMap)
  1394. {
  1395. $packages = [];
  1396. $paths = [];
  1397. foreach ($packageMap as $item) {
  1398. [$package, $path] = $item;
  1399. $name = $package->getName();
  1400. $packages[$name] = $package;
  1401. $paths[$name] = $path;
  1402. }
  1403. $sortedPackages = PackageSorter::sortPackages($packages);
  1404. $sortedPackageMap = [];
  1405. foreach ($sortedPackages as $package) {
  1406. $name = $package->getName();
  1407. $sortedPackageMap[] = [$packages[$name], $paths[$name]];
  1408. }
  1409. return $sortedPackageMap;
  1410. }
  1411. }
  1412. function composerRequire(string $fileIdentifier, string $file): void
  1413. {
  1414. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  1415. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  1416. require $file;
  1417. }
  1418. }
  1419. <?php declare(strict_types=1);
  1420. namespace Composer\Autoload;
  1421. use Composer\ClassMapGenerator\FileList;
  1422. use Composer\IO\IOInterface;
  1423. class ClassMapGenerator
  1424. {
  1425. public static function dump(iterable $dirs, string $file): void
  1426. {
  1427. $maps = [];
  1428. foreach ($dirs as $dir) {
  1429. $maps = array_merge($maps, static::createMap($dir));
  1430. }
  1431. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  1432. }
  1433. public static function createMap($path, ?string $excluded = null, ?IOInterface $io = null, ?string $namespace = null, ?string $autoloadType = null, array &$scannedFiles = []): array
  1434. {
  1435. $generator = new \Composer\ClassMapGenerator\ClassMapGenerator(['php', 'inc', 'hh']);
  1436. $fileList = new FileList();
  1437. $fileList->files = $scannedFiles;
  1438. $generator->avoidDuplicateScans($fileList);
  1439. $generator->scanPaths($path, $excluded, $autoloadType ?? 'classmap', $namespace);
  1440. $classMap = $generator->getClassMap();
  1441. $scannedFiles = $fileList->files;
  1442. if ($io !== null) {
  1443. foreach ($classMap->getPsrViolations() as $msg) {
  1444. $io->writeError("<warning>$msg</warning>");
  1445. }
  1446. foreach ($classMap->getAmbiguousClasses() as $class => $paths) {
  1447. if (count($paths) > 1) {
  1448. $io->writeError(
  1449. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  1450. ' was found '. (count($paths) + 1) .'x: in "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.</warning>'
  1451. );
  1452. } else {
  1453. $io->writeError(
  1454. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  1455. ' was found in both "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.</warning>'
  1456. );
  1457. }
  1458. }
  1459. }
  1460. return $classMap->getMap();
  1461. }
  1462. }
  1463. <?php declare(strict_types=1);
  1464. namespace Composer;
  1465. use Composer\IO\IOInterface;
  1466. use Composer\Pcre\Preg;
  1467. use Composer\Util\Filesystem;
  1468. use Composer\Util\Platform;
  1469. use Composer\Util\Silencer;
  1470. use Symfony\Component\Finder\Finder;
  1471. class Cache
  1472. {
  1473. private static $cacheCollected = null;
  1474. private $io;
  1475. private $root;
  1476. private $enabled = null;
  1477. private $allowlist;
  1478. private $filesystem;
  1479. private $readOnly;
  1480. public function __construct(IOInterface $io, string $cacheDir, string $allowlist = 'a-z0-9._', ?Filesystem $filesystem = null, bool $readOnly = false)
  1481. {
  1482. $this->io = $io;
  1483. $this->root = rtrim($cacheDir, '/\\') . '/';
  1484. $this->allowlist = $allowlist;
  1485. $this->filesystem = $filesystem ?: new Filesystem();
  1486. $this->readOnly = $readOnly;
  1487. if (!self::isUsable($cacheDir)) {
  1488. $this->enabled = false;
  1489. }
  1490. }
  1491. public function setReadOnly(bool $readOnly)
  1492. {
  1493. $this->readOnly = $readOnly;
  1494. }
  1495. public function isReadOnly()
  1496. {
  1497. return $this->readOnly;
  1498. }
  1499. public static function isUsable(string $path)
  1500. {
  1501. return !Preg::isMatch('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  1502. }
  1503. public function isEnabled()
  1504. {
  1505. if ($this->enabled === null) {
  1506. $this->enabled = true;
  1507. if (
  1508. !$this->readOnly
  1509. && (
  1510. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1511. || !is_writable($this->root)
  1512. )
  1513. ) {
  1514. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache. See also cache-read-only config if your filesystem is read-only.</warning>');
  1515. $this->enabled = false;
  1516. }
  1517. }
  1518. return $this->enabled;
  1519. }
  1520. public function getRoot()
  1521. {
  1522. return $this->root;
  1523. }
  1524. public function read(string $file)
  1525. {
  1526. if ($this->isEnabled()) {
  1527. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1528. if (file_exists($this->root . $file)) {
  1529. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1530. return file_get_contents($this->root . $file);
  1531. }
  1532. }
  1533. return false;
  1534. }
  1535. public function write(string $file, string $contents)
  1536. {
  1537. $wasEnabled = $this->enabled === true;
  1538. if ($this->isEnabled() && !$this->readOnly) {
  1539. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1540. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1541. $tempFileName = $this->root . $file . bin2hex(random_bytes(5)) . '.tmp';
  1542. try {
  1543. return file_put_contents($tempFileName, $contents) !== false && rename($tempFileName, $this->root . $file);
  1544. } catch (\ErrorException $e) {
  1545. if ($wasEnabled) {
  1546. clearstatcache();
  1547. $this->enabled = null;
  1548. return $this->write($file, $contents);
  1549. }
  1550. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1551. if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1552. unlink($tempFileName);
  1553. $message = sprintf(
  1554. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$s bytes of free space available</warning>',
  1555. $tempFileName,
  1556. $m[1],
  1557. $m[2],
  1558. function_exists('disk_free_space') ? @disk_free_space(dirname($tempFileName)) : 'unknown'
  1559. );
  1560. $this->io->writeError($message);
  1561. return false;
  1562. }
  1563. throw $e;
  1564. }
  1565. }
  1566. return false;
  1567. }
  1568. public function copyFrom(string $file, string $source)
  1569. {
  1570. if ($this->isEnabled() && !$this->readOnly) {
  1571. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1572. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1573. if (!file_exists($source)) {
  1574. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1575. } elseif ($this->io->isDebug()) {
  1576. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1577. }
  1578. return $this->filesystem->copy($source, $this->root . $file);
  1579. }
  1580. return false;
  1581. }
  1582. public function copyTo(string $file, string $target)
  1583. {
  1584. if ($this->isEnabled()) {
  1585. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1586. if (file_exists($this->root . $file)) {
  1587. try {
  1588. touch($this->root . $file, (int) filemtime($this->root . $file), time());
  1589. } catch (\ErrorException $e) {
  1590. Silencer::call('touch', $this->root . $file);
  1591. }
  1592. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1593. return $this->filesystem->copy($this->root . $file, $target);
  1594. }
  1595. }
  1596. return false;
  1597. }
  1598. public function gcIsNecessary()
  1599. {
  1600. if (self::$cacheCollected) {
  1601. return false;
  1602. }
  1603. self::$cacheCollected = true;
  1604. if (Platform::getEnv('COMPOSER_TEST_SUITE')) {
  1605. return false;
  1606. }
  1607. if (Platform::isInputCompletionProcess()) {
  1608. return false;
  1609. }
  1610. return !random_int(0, 50);
  1611. }
  1612. public function remove(string $file)
  1613. {
  1614. if ($this->isEnabled() && !$this->readOnly) {
  1615. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1616. if (file_exists($this->root . $file)) {
  1617. return $this->filesystem->unlink($this->root . $file);
  1618. }
  1619. }
  1620. return false;
  1621. }
  1622. public function clear()
  1623. {
  1624. if ($this->isEnabled() && !$this->readOnly) {
  1625. $this->filesystem->emptyDirectory($this->root);
  1626. return true;
  1627. }
  1628. return false;
  1629. }
  1630. public function getAge(string $file)
  1631. {
  1632. if ($this->isEnabled()) {
  1633. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1634. if (file_exists($this->root . $file) && ($mtime = filemtime($this->root . $file)) !== false) {
  1635. return abs(time() - $mtime);
  1636. }
  1637. }
  1638. return false;
  1639. }
  1640. public function gc(int $ttl, int $maxSize)
  1641. {
  1642. if ($this->isEnabled() && !$this->readOnly) {
  1643. $expire = new \DateTime();
  1644. $expire->modify('-'.$ttl.' seconds');
  1645. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1646. foreach ($finder as $file) {
  1647. $this->filesystem->unlink($file->getPathname());
  1648. }
  1649. $totalSize = $this->filesystem->size($this->root);
  1650. if ($totalSize > $maxSize) {
  1651. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1652. while ($totalSize > $maxSize && $iterator->valid()) {
  1653. $filepath = $iterator->current()->getPathname();
  1654. $totalSize -= $this->filesystem->size($filepath);
  1655. $this->filesystem->unlink($filepath);
  1656. $iterator->next();
  1657. }
  1658. }
  1659. self::$cacheCollected = true;
  1660. return true;
  1661. }
  1662. return false;
  1663. }
  1664. public function gcVcsCache(int $ttl): bool
  1665. {
  1666. if ($this->isEnabled()) {
  1667. $expire = new \DateTime();
  1668. $expire->modify('-'.$ttl.' seconds');
  1669. $finder = Finder::create()->in($this->root)->directories()->depth(0)->date('until '.$expire->format('Y-m-d H:i:s'));
  1670. foreach ($finder as $file) {
  1671. $this->filesystem->removeDirectory($file->getPathname());
  1672. }
  1673. self::$cacheCollected = true;
  1674. return true;
  1675. }
  1676. return false;
  1677. }
  1678. public function sha1(string $file)
  1679. {
  1680. if ($this->isEnabled()) {
  1681. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1682. if (file_exists($this->root . $file)) {
  1683. return hash_file('sha1', $this->root . $file);
  1684. }
  1685. }
  1686. return false;
  1687. }
  1688. public function sha256(string $file)
  1689. {
  1690. if ($this->isEnabled()) {
  1691. $file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
  1692. if (file_exists($this->root . $file)) {
  1693. return hash_file('sha256', $this->root . $file);
  1694. }
  1695. }
  1696. return false;
  1697. }
  1698. protected function getFinder()
  1699. {
  1700. return Finder::create()->in($this->root)->files();
  1701. }
  1702. }
  1703. <?php declare(strict_types=1);
  1704. namespace Composer\Command;
  1705. use Composer\Composer;
  1706. use Symfony\Component\Console\Input\InputInterface;
  1707. use Symfony\Component\Console\Output\OutputInterface;
  1708. class AboutCommand extends BaseCommand
  1709. {
  1710. protected function configure(): void
  1711. {
  1712. $this
  1713. ->setName('about')
  1714. ->setDescription('Shows a short information about Composer')
  1715. ->setHelp(
  1716. <<<EOT
  1717. <info>php composer.phar about</info>
  1718. EOT
  1719. )
  1720. ;
  1721. }
  1722. protected function execute(InputInterface $input, OutputInterface $output): int
  1723. {
  1724. $composerVersion = Composer::getVersion();
  1725. $this->getIO()->write(
  1726. <<<EOT
  1727. <info>Composer - Dependency Manager for PHP - version $composerVersion</info>
  1728. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1729. See https://getcomposer.org/ for more information.</comment>
  1730. EOT
  1731. );
  1732. return 0;
  1733. }
  1734. }
  1735. <?php declare(strict_types=1);
  1736. namespace Composer\Command;
  1737. use Composer\Factory;
  1738. use Composer\IO\IOInterface;
  1739. use Composer\Config;
  1740. use Composer\Composer;
  1741. use Composer\Package\BasePackage;
  1742. use Composer\Package\CompletePackageInterface;
  1743. use Composer\Package\Version\VersionParser;
  1744. use Composer\Package\Version\VersionSelector;
  1745. use Composer\Pcre\Preg;
  1746. use Composer\Repository\CompositeRepository;
  1747. use Composer\Repository\RepositoryFactory;
  1748. use Composer\Repository\RepositorySet;
  1749. use Composer\Script\ScriptEvents;
  1750. use Composer\Plugin\CommandEvent;
  1751. use Composer\Plugin\PluginEvents;
  1752. use Composer\Util\Filesystem;
  1753. use Composer\Util\Loop;
  1754. use Composer\Util\Platform;
  1755. use Composer\Util\ProcessExecutor;
  1756. use Composer\Console\Input\InputArgument;
  1757. use Symfony\Component\Console\Input\InputInterface;
  1758. use Composer\Console\Input\InputOption;
  1759. use Symfony\Component\Console\Output\OutputInterface;
  1760. class ArchiveCommand extends BaseCommand
  1761. {
  1762. use CompletionTrait;
  1763. private const FORMATS = ['tar', 'tar.gz', 'tar.bz2', 'zip'];
  1764. protected function configure(): void
  1765. {
  1766. $this
  1767. ->setName('archive')
  1768. ->setDescription('Creates an archive of this composer package')
  1769. ->setDefinition([
  1770. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project', null, $this->suggestAvailablePackage()),
  1771. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1772. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar, tar.gz, tar.bz2 or zip (default tar)', null, self::FORMATS),
  1773. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1774. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1775. .' Note that the format will be appended.'),
  1776. new InputOption('ignore-filters', null, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1777. ])
  1778. ->setHelp(
  1779. <<<EOT
  1780. The <info>archive</info> command creates an archive of the specified format
  1781. containing the files and directories of the Composer project or the specified
  1782. package in the specified version and writes it to the specified directory.
  1783. <info>php composer.phar archive [--format=zip] [--dir=/foo] [--file=filename] [package [version]]</info>
  1784. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1785. EOT
  1786. )
  1787. ;
  1788. }
  1789. protected function execute(InputInterface $input, OutputInterface $output): int
  1790. {
  1791. $composer = $this->tryComposer();
  1792. $config = null;
  1793. if ($composer) {
  1794. $config = $composer->getConfig();
  1795. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1796. $eventDispatcher = $composer->getEventDispatcher();
  1797. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1798. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1799. }
  1800. if (!$config) {
  1801. $config = Factory::createConfig();
  1802. }
  1803. $format = $input->getOption('format') ?? $config->get('archive-format');
  1804. $dir = $input->getOption('dir') ?? $config->get('archive-dir');
  1805. $returnCode = $this->archive(
  1806. $this->getIO(),
  1807. $config,
  1808. $input->getArgument('package'),
  1809. $input->getArgument('version'),
  1810. $format,
  1811. $dir,
  1812. $input->getOption('file'),
  1813. $input->getOption('ignore-filters'),
  1814. $composer
  1815. );
  1816. if (0 === $returnCode && $composer) {
  1817. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1818. }
  1819. return $returnCode;
  1820. }
  1821. protected function archive(IOInterface $io, Config $config, ?string $packageName, ?string $version, string $format, string $dest, ?string $fileName, bool $ignoreFilters, ?Composer $composer): int
  1822. {
  1823. if ($composer) {
  1824. $archiveManager = $composer->getArchiveManager();
  1825. } else {
  1826. $factory = new Factory;
  1827. $process = new ProcessExecutor();
  1828. $httpDownloader = Factory::createHttpDownloader($io, $config);
  1829. $downloadManager = $factory->createDownloadManager($io, $config, $httpDownloader, $process);
  1830. $archiveManager = $factory->createArchiveManager($config, $downloadManager, new Loop($httpDownloader, $process));
  1831. }
  1832. if ($packageName) {
  1833. $package = $this->selectPackage($io, $packageName, $version);
  1834. if (!$package) {
  1835. return 1;
  1836. }
  1837. } else {
  1838. $package = $this->requireComposer()->getPackage();
  1839. }
  1840. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1841. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1842. $fs = new Filesystem;
  1843. $shortPath = $fs->findShortestPath(Platform::getCwd(), $packagePath, true);
  1844. $io->writeError('Created: ', false);
  1845. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1846. return 0;
  1847. }
  1848. protected function selectPackage(IOInterface $io, string $packageName, ?string $version = null)
  1849. {
  1850. $io->writeError('<info>Searching for the specified package.</info>');
  1851. if ($composer = $this->tryComposer()) {
  1852. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1853. $repo = new CompositeRepository(array_merge([$localRepo], $composer->getRepositoryManager()->getRepositories()));
  1854. $minStability = $composer->getPackage()->getMinimumStability();
  1855. } else {
  1856. $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
  1857. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1858. $repo = new CompositeRepository($defaultRepos);
  1859. $minStability = 'stable';
  1860. }
  1861. if ($version !== null && Preg::isMatchStrictGroups('{@(stable|RC|beta|alpha|dev)$}i', $version, $match)) {
  1862. $minStability = VersionParser::normalizeStability($match[1]);
  1863. $version = (string) substr($version, 0, -strlen($match[0]));
  1864. }
  1865. $repoSet = new RepositorySet($minStability);
  1866. $repoSet->addRepository($repo);
  1867. $parser = new VersionParser();
  1868. $constraint = $version !== null ? $parser->parseConstraints($version) : null;
  1869. $packages = $repoSet->findPackages(strtolower($packageName), $constraint);
  1870. if (count($packages) > 1) {
  1871. $versionSelector = new VersionSelector($repoSet);
  1872. $package = $versionSelector->findBestCandidate(strtolower($packageName), $version, $minStability);
  1873. if ($package === false) {
  1874. $package = reset($packages);
  1875. }
  1876. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1877. $io->writeError('Alternatives were '.implode(', ', array_map(static function ($p): string {
  1878. return $p->getPrettyString();
  1879. }, $packages)).'.');
  1880. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1881. } elseif (count($packages) === 1) {
  1882. $package = reset($packages);
  1883. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1884. } else {
  1885. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1886. return false;
  1887. }
  1888. if (!$package instanceof CompletePackageInterface) {
  1889. throw new \LogicException('Expected a CompletePackageInterface instance but found '.get_class($package));
  1890. }
  1891. if (!$package instanceof BasePackage) {
  1892. throw new \LogicException('Expected a BasePackage instance but found '.get_class($package));
  1893. }
  1894. return $package;
  1895. }
  1896. }
  1897. <?php declare(strict_types=1);
  1898. namespace Composer\Command;
  1899. use Composer\Composer;
  1900. use Composer\Repository\RepositorySet;
  1901. use Composer\Repository\RepositoryUtils;
  1902. use Symfony\Component\Console\Input\InputInterface;
  1903. use Symfony\Component\Console\Output\OutputInterface;
  1904. use Composer\Package\PackageInterface;
  1905. use Composer\Repository\InstalledRepository;
  1906. use Composer\Advisory\Auditor;
  1907. use Composer\Console\Input\InputOption;
  1908. class AuditCommand extends BaseCommand
  1909. {
  1910. protected function configure(): void
  1911. {
  1912. $this
  1913. ->setName('audit')
  1914. ->setDescription('Checks for security vulnerability advisories for installed packages')
  1915. ->setDefinition([
  1916. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables auditing of require-dev packages.'),
  1917. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_TABLE, Auditor::FORMATS),
  1918. new InputOption('locked', null, InputOption::VALUE_NONE, 'Audit based on the lock file instead of the installed packages.'),
  1919. new InputOption('abandoned', null, InputOption::VALUE_REQUIRED, 'Behavior on abandoned packages. Must be "ignore", "report", or "fail".', null, Auditor::ABANDONEDS),
  1920. new InputOption('ignore-severity', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Ignore advisories of a certain severity level.', [], ['low', 'medium', 'high', 'critical']),
  1921. ])
  1922. ->setHelp(
  1923. <<<EOT
  1924. The <info>audit</info> command checks for security vulnerability advisories for installed packages.
  1925. If you do not want to include dev dependencies in the audit you can omit them with --no-dev
  1926. Read more at https://getcomposer.org/doc/03-cli.md#audit
  1927. EOT
  1928. )
  1929. ;
  1930. }
  1931. protected function execute(InputInterface $input, OutputInterface $output): int
  1932. {
  1933. $composer = $this->requireComposer();
  1934. $packages = $this->getPackages($composer, $input);
  1935. if (count($packages) === 0) {
  1936. $this->getIO()->writeError('No packages - skipping audit.');
  1937. return 0;
  1938. }
  1939. $auditor = new Auditor();
  1940. $repoSet = new RepositorySet();
  1941. foreach ($composer->getRepositoryManager()->getRepositories() as $repo) {
  1942. $repoSet->addRepository($repo);
  1943. }
  1944. $auditConfig = $composer->getConfig()->get('audit');
  1945. $abandoned = $input->getOption('abandoned');
  1946. if ($abandoned !== null && !in_array($abandoned, Auditor::ABANDONEDS, true)) {
  1947. throw new \InvalidArgumentException('--audit must be one of '.implode(', ', Auditor::ABANDONEDS).'.');
  1948. }
  1949. $abandoned = $abandoned ?? $auditConfig['abandoned'] ?? Auditor::ABANDONED_FAIL;
  1950. $ignoreSeverities = $input->getOption('ignore-severity') ?? [];
  1951. return min(255, $auditor->audit(
  1952. $this->getIO(),
  1953. $repoSet,
  1954. $packages,
  1955. $this->getAuditFormat($input, 'format'),
  1956. false,
  1957. $auditConfig['ignore'] ?? [],
  1958. $abandoned,
  1959. $ignoreSeverities
  1960. ));
  1961. }
  1962. private function getPackages(Composer $composer, InputInterface $input): array
  1963. {
  1964. if ($input->getOption('locked')) {
  1965. if (!$composer->getLocker()->isLocked()) {
  1966. throw new \UnexpectedValueException('Valid composer.json and composer.lock files are required to run this command with --locked');
  1967. }
  1968. $locker = $composer->getLocker();
  1969. return $locker->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1970. }
  1971. $rootPkg = $composer->getPackage();
  1972. $installedRepo = new InstalledRepository([$composer->getRepositoryManager()->getLocalRepository()]);
  1973. if ($input->getOption('no-dev')) {
  1974. return RepositoryUtils::filterRequiredPackages($installedRepo->getPackages(), $rootPkg);
  1975. }
  1976. return $installedRepo->getPackages();
  1977. }
  1978. }
  1979. <?php declare(strict_types=1);
  1980. namespace Composer\Command;
  1981. use Composer\Composer;
  1982. use Composer\Config;
  1983. use Composer\Console\Application;
  1984. use Composer\Console\Input\InputArgument;
  1985. use Composer\Console\Input\InputOption;
  1986. use Composer\Factory;
  1987. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  1988. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  1989. use Composer\IO\IOInterface;
  1990. use Composer\IO\NullIO;
  1991. use Composer\Plugin\PreCommandRunEvent;
  1992. use Composer\Package\Version\VersionParser;
  1993. use Composer\Plugin\PluginEvents;
  1994. use Composer\Advisory\Auditor;
  1995. use Composer\Util\Platform;
  1996. use Symfony\Component\Console\Completion\CompletionInput;
  1997. use Symfony\Component\Console\Completion\CompletionSuggestions;
  1998. use Symfony\Component\Console\Helper\Table;
  1999. use Symfony\Component\Console\Helper\TableSeparator;
  2000. use Symfony\Component\Console\Input\InputInterface;
  2001. use Symfony\Component\Console\Output\OutputInterface;
  2002. use Symfony\Component\Console\Command\Command;
  2003. use Symfony\Component\Console\Terminal;
  2004. abstract class BaseCommand extends Command
  2005. {
  2006. private $composer;
  2007. private $io;
  2008. public function getApplication(): Application
  2009. {
  2010. $application = parent::getApplication();
  2011. if (!$application instanceof Application) {
  2012. throw new \RuntimeException('Composer commands can only work with an '.Application::class.' instance set');
  2013. }
  2014. return $application;
  2015. }
  2016. public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null)
  2017. {
  2018. if ($required) {
  2019. return $this->requireComposer($disablePlugins, $disableScripts);
  2020. }
  2021. return $this->tryComposer($disablePlugins, $disableScripts);
  2022. }
  2023. public function requireComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): Composer
  2024. {
  2025. if (null === $this->composer) {
  2026. $application = parent::getApplication();
  2027. if ($application instanceof Application) {
  2028. $this->composer = $application->getComposer(true, $disablePlugins, $disableScripts);
  2029. assert($this->composer instanceof Composer);
  2030. } else {
  2031. throw new \RuntimeException(
  2032. 'Could not create a Composer\Composer instance, you must inject '.
  2033. 'one if this command is not used with a Composer\Console\Application instance'
  2034. );
  2035. }
  2036. }
  2037. return $this->composer;
  2038. }
  2039. public function tryComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
  2040. {
  2041. if (null === $this->composer) {
  2042. $application = parent::getApplication();
  2043. if ($application instanceof Application) {
  2044. $this->composer = $application->getComposer(false, $disablePlugins, $disableScripts);
  2045. }
  2046. }
  2047. return $this->composer;
  2048. }
  2049. public function setComposer(Composer $composer)
  2050. {
  2051. $this->composer = $composer;
  2052. }
  2053. public function resetComposer()
  2054. {
  2055. $this->composer = null;
  2056. $this->getApplication()->resetComposer();
  2057. }
  2058. public function isProxyCommand()
  2059. {
  2060. return false;
  2061. }
  2062. public function getIO()
  2063. {
  2064. if (null === $this->io) {
  2065. $application = parent::getApplication();
  2066. if ($application instanceof Application) {
  2067. $this->io = $application->getIO();
  2068. } else {
  2069. $this->io = new NullIO();
  2070. }
  2071. }
  2072. return $this->io;
  2073. }
  2074. public function setIO(IOInterface $io)
  2075. {
  2076. $this->io = $io;
  2077. }
  2078. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  2079. {
  2080. $definition = $this->getDefinition();
  2081. $name = (string) $input->getCompletionName();
  2082. if (CompletionInput::TYPE_OPTION_VALUE === $input->getCompletionType()
  2083. && $definition->hasOption($name)
  2084. && ($option = $definition->getOption($name)) instanceof InputOption
  2085. ) {
  2086. $option->complete($input, $suggestions);
  2087. } elseif (CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
  2088. && $definition->hasArgument($name)
  2089. && ($argument = $definition->getArgument($name)) instanceof InputArgument
  2090. ) {
  2091. $argument->complete($input, $suggestions);
  2092. } else {
  2093. parent::complete($input, $suggestions);
  2094. }
  2095. }
  2096. protected function initialize(InputInterface $input, OutputInterface $output)
  2097. {
  2098. $disablePlugins = $input->hasParameterOption('--no-plugins');
  2099. $disableScripts = $input->hasParameterOption('--no-scripts');
  2100. $application = parent::getApplication();
  2101. if ($application instanceof Application && $application->getDisablePluginsByDefault()) {
  2102. $disablePlugins = true;
  2103. }
  2104. if ($application instanceof Application && $application->getDisableScriptsByDefault()) {
  2105. $disableScripts = true;
  2106. }
  2107. if ($this instanceof SelfUpdateCommand) {
  2108. $disablePlugins = true;
  2109. $disableScripts = true;
  2110. }
  2111. $composer = $this->tryComposer($disablePlugins, $disableScripts);
  2112. $io = $this->getIO();
  2113. if (null === $composer) {
  2114. $composer = Factory::createGlobal($this->getIO(), $disablePlugins, $disableScripts);
  2115. }
  2116. if ($composer) {
  2117. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  2118. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  2119. }
  2120. if (true === $input->hasParameterOption(['--no-ansi']) && $input->hasOption('no-progress')) {
  2121. $input->setOption('no-progress', true);
  2122. }
  2123. $envOptions = [
  2124. 'COMPOSER_NO_AUDIT' => ['no-audit'],
  2125. 'COMPOSER_NO_DEV' => ['no-dev', 'update-no-dev'],
  2126. 'COMPOSER_PREFER_STABLE' => ['prefer-stable'],
  2127. 'COMPOSER_PREFER_LOWEST' => ['prefer-lowest'],
  2128. 'COMPOSER_MINIMAL_CHANGES' => ['minimal-changes'],
  2129. ];
  2130. foreach ($envOptions as $envName => $optionNames) {
  2131. foreach ($optionNames as $optionName) {
  2132. if (true === $input->hasOption($optionName)) {
  2133. if (false === $input->getOption($optionName) && (bool) Platform::getEnv($envName)) {
  2134. $input->setOption($optionName, true);
  2135. }
  2136. }
  2137. }
  2138. }
  2139. if (true === $input->hasOption('ignore-platform-reqs')) {
  2140. if (!$input->getOption('ignore-platform-reqs') && (bool) Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQS')) {
  2141. $input->setOption('ignore-platform-reqs', true);
  2142. $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQS is set. You may experience unexpected errors.</warning>');
  2143. }
  2144. }
  2145. if (true === $input->hasOption('ignore-platform-req') && (!$input->hasOption('ignore-platform-reqs') || !$input->getOption('ignore-platform-reqs'))) {
  2146. $ignorePlatformReqEnv = Platform::getEnv('COMPOSER_IGNORE_PLATFORM_REQ');
  2147. if (0 === count($input->getOption('ignore-platform-req')) && is_string($ignorePlatformReqEnv) && '' !== $ignorePlatformReqEnv) {
  2148. $input->setOption('ignore-platform-req', explode(',', $ignorePlatformReqEnv));
  2149. $io->writeError('<warning>COMPOSER_IGNORE_PLATFORM_REQ is set to ignore '.$ignorePlatformReqEnv.'. You may experience unexpected errors.</warning>');
  2150. }
  2151. }
  2152. parent::initialize($input, $output);
  2153. }
  2154. protected function createComposerInstance(InputInterface $input, IOInterface $io, $config = null, ?bool $disablePlugins = null, ?bool $disableScripts = null): Composer
  2155. {
  2156. $disablePlugins = $disablePlugins === true || $input->hasParameterOption('--no-plugins');
  2157. $disableScripts = $disableScripts === true || $input->hasParameterOption('--no-scripts');
  2158. $application = parent::getApplication();
  2159. if ($application instanceof Application && $application->getDisablePluginsByDefault()) {
  2160. $disablePlugins = true;
  2161. }
  2162. if ($application instanceof Application && $application->getDisableScriptsByDefault()) {
  2163. $disableScripts = true;
  2164. }
  2165. return Factory::create($io, $config, $disablePlugins, $disableScripts);
  2166. }
  2167. protected function getPreferredInstallOptions(Config $config, InputInterface $input, bool $keepVcsRequiresPreferSource = false)
  2168. {
  2169. $preferSource = false;
  2170. $preferDist = false;
  2171. switch ($config->get('preferred-install')) {
  2172. case 'source':
  2173. $preferSource = true;
  2174. break;
  2175. case 'dist':
  2176. $preferDist = true;
  2177. break;
  2178. case 'auto':
  2179. default:
  2180. break;
  2181. }
  2182. if (!$input->hasOption('prefer-dist') || !$input->hasOption('prefer-source')) {
  2183. return [$preferSource, $preferDist];
  2184. }
  2185. if ($input->hasOption('prefer-install') && is_string($input->getOption('prefer-install'))) {
  2186. if ($input->getOption('prefer-source')) {
  2187. throw new \InvalidArgumentException('--prefer-source can not be used together with --prefer-install');
  2188. }
  2189. if ($input->getOption('prefer-dist')) {
  2190. throw new \InvalidArgumentException('--prefer-dist can not be used together with --prefer-install');
  2191. }
  2192. switch ($input->getOption('prefer-install')) {
  2193. case 'dist':
  2194. $input->setOption('prefer-dist', true);
  2195. break;
  2196. case 'source':
  2197. $input->setOption('prefer-source', true);
  2198. break;
  2199. case 'auto':
  2200. $preferDist = false;
  2201. $preferSource = false;
  2202. break;
  2203. default:
  2204. throw new \UnexpectedValueException('--prefer-install accepts one of "dist", "source" or "auto", got '.$input->getOption('prefer-install'));
  2205. }
  2206. }
  2207. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  2208. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  2209. $preferDist = $input->getOption('prefer-dist');
  2210. }
  2211. return [$preferSource, $preferDist];
  2212. }
  2213. protected function getPlatformRequirementFilter(InputInterface $input): PlatformRequirementFilterInterface
  2214. {
  2215. if (!$input->hasOption('ignore-platform-reqs') || !$input->hasOption('ignore-platform-req')) {
  2216. throw new \LogicException('Calling getPlatformRequirementFilter from a command which does not define the --ignore-platform-req[s] flags is not permitted.');
  2217. }
  2218. if (true === $input->getOption('ignore-platform-reqs')) {
  2219. return PlatformRequirementFilterFactory::ignoreAll();
  2220. }
  2221. $ignores = $input->getOption('ignore-platform-req');
  2222. if (count($ignores) > 0) {
  2223. return PlatformRequirementFilterFactory::fromBoolOrList($ignores);
  2224. }
  2225. return PlatformRequirementFilterFactory::ignoreNothing();
  2226. }
  2227. protected function formatRequirements(array $requirements)
  2228. {
  2229. $requires = [];
  2230. $requirements = $this->normalizeRequirements($requirements);
  2231. foreach ($requirements as $requirement) {
  2232. if (!isset($requirement['version'])) {
  2233. throw new \UnexpectedValueException('Option '.$requirement['name'] .' is missing a version constraint, use e.g. '.$requirement['name'].':^1.0');
  2234. }
  2235. $requires[$requirement['name']] = $requirement['version'];
  2236. }
  2237. return $requires;
  2238. }
  2239. protected function normalizeRequirements(array $requirements)
  2240. {
  2241. $parser = new VersionParser();
  2242. return $parser->parseNameVersionPairs($requirements);
  2243. }
  2244. protected function renderTable(array $table, OutputInterface $output)
  2245. {
  2246. $renderer = new Table($output);
  2247. $renderer->setStyle('compact');
  2248. $renderer->setRows($table)->render();
  2249. }
  2250. protected function getTerminalWidth()
  2251. {
  2252. $terminal = new Terminal();
  2253. $width = $terminal->getWidth();
  2254. if (Platform::isWindows()) {
  2255. $width--;
  2256. } else {
  2257. $width = max(80, $width);
  2258. }
  2259. return $width;
  2260. }
  2261. protected function getAuditFormat(InputInterface $input, string $optName = 'audit-format'): string
  2262. {
  2263. if (!$input->hasOption($optName)) {
  2264. throw new \LogicException('This should not be called on a Command which has no '.$optName.' option defined.');
  2265. }
  2266. $val = $input->getOption($optName);
  2267. if (!in_array($val, Auditor::FORMATS, true)) {
  2268. throw new \InvalidArgumentException('--'.$optName.' must be one of '.implode(', ', Auditor::FORMATS).'.');
  2269. }
  2270. return $val;
  2271. }
  2272. }
  2273. <?php declare(strict_types=1);
  2274. namespace Composer\Command;
  2275. use Composer\Package\Link;
  2276. use Composer\Package\Package;
  2277. use Composer\Package\PackageInterface;
  2278. use Composer\Package\CompletePackageInterface;
  2279. use Composer\Package\RootPackage;
  2280. use Composer\Repository\InstalledArrayRepository;
  2281. use Composer\Repository\CompositeRepository;
  2282. use Composer\Repository\RootPackageRepository;
  2283. use Composer\Repository\InstalledRepository;
  2284. use Composer\Repository\PlatformRepository;
  2285. use Composer\Repository\RepositoryFactory;
  2286. use Composer\Plugin\CommandEvent;
  2287. use Composer\Plugin\PluginEvents;
  2288. use Composer\Semver\Constraint\Bound;
  2289. use Composer\Util\Platform;
  2290. use Symfony\Component\Console\Formatter\OutputFormatter;
  2291. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  2292. use Composer\Package\Version\VersionParser;
  2293. use Symfony\Component\Console\Input\InputInterface;
  2294. use Symfony\Component\Console\Output\OutputInterface;
  2295. use Composer\Util\PackageInfo;
  2296. abstract class BaseDependencyCommand extends BaseCommand
  2297. {
  2298. protected const ARGUMENT_PACKAGE = 'package';
  2299. protected const ARGUMENT_CONSTRAINT = 'version';
  2300. protected const OPTION_RECURSIVE = 'recursive';
  2301. protected const OPTION_TREE = 'tree';
  2302. protected $colors;
  2303. protected function doExecute(InputInterface $input, OutputInterface $output, bool $inverted = false): int
  2304. {
  2305. $composer = $this->requireComposer();
  2306. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  2307. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2308. $repos = [];
  2309. $repos[] = new RootPackageRepository(clone $composer->getPackage());
  2310. if ($input->getOption('locked')) {
  2311. $locker = $composer->getLocker();
  2312. if (!$locker->isLocked()) {
  2313. throw new \UnexpectedValueException('A valid composer.lock file is required to run this command with --locked');
  2314. }
  2315. $repos[] = $locker->getLockedRepository(true);
  2316. $repos[] = new PlatformRepository([], $locker->getPlatformOverrides());
  2317. } else {
  2318. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  2319. $rootPkg = $composer->getPackage();
  2320. if (count($localRepo->getPackages()) === 0 && (count($rootPkg->getRequires()) > 0 || count($rootPkg->getDevRequires()) > 0)) {
  2321. $output->writeln('<warning>No dependencies installed. Try running composer install or update, or use --locked.</warning>');
  2322. return 1;
  2323. }
  2324. $repos[] = $localRepo;
  2325. $platformOverrides = $composer->getConfig()->get('platform') ?: [];
  2326. $repos[] = new PlatformRepository([], $platformOverrides);
  2327. }
  2328. $installedRepo = new InstalledRepository($repos);
  2329. $needle = $input->getArgument(self::ARGUMENT_PACKAGE);
  2330. $textConstraint = $input->hasArgument(self::ARGUMENT_CONSTRAINT) ? $input->getArgument(self::ARGUMENT_CONSTRAINT) : '*';
  2331. $packages = $installedRepo->findPackagesWithReplacersAndProviders($needle);
  2332. if (empty($packages)) {
  2333. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  2334. }
  2335. $matchedPackage = $installedRepo->findPackage($needle, $textConstraint);
  2336. if (!$matchedPackage) {
  2337. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO(), $composer->getConfig(), $composer->getRepositoryManager()));
  2338. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  2339. $installedRepo->addRepository(new InstalledArrayRepository([clone $match]));
  2340. } elseif (PlatformRepository::isPlatformPackage($needle)) {
  2341. $parser = new VersionParser();
  2342. $constraint = $parser->parseConstraints($textConstraint);
  2343. if ($constraint->getLowerBound() !== Bound::zero()) {
  2344. $tempPlatformPkg = new Package($needle, $constraint->getLowerBound()->getVersion(), $constraint->getLowerBound()->getVersion());
  2345. $installedRepo->addRepository(new InstalledArrayRepository([$tempPlatformPkg]));
  2346. }
  2347. } else {
  2348. $this->getIO()->writeError('<error>Package "'.$needle.'" could not be found with constraint "'.$textConstraint.'", results below will most likely be incomplete.</error>');
  2349. }
  2350. } elseif (PlatformRepository::isPlatformPackage($needle)) {
  2351. $extraNotice = '';
  2352. if (($matchedPackage->getExtra()['config.platform'] ?? false) === true) {
  2353. $extraNotice = ' (version provided by config.platform)';
  2354. }
  2355. $this->getIO()->writeError('<info>Package "'.$needle.' '.$textConstraint.'" found in version "'.$matchedPackage->getPrettyVersion().'"'.$extraNotice.'.</info>');
  2356. }
  2357. $needles = [$needle];
  2358. if ($inverted) {
  2359. foreach ($packages as $package) {
  2360. $needles = array_merge($needles, array_map(static function (Link $link): string {
  2361. return $link->getTarget();
  2362. }, $package->getReplaces()));
  2363. }
  2364. }
  2365. if ('*' !== $textConstraint) {
  2366. $versionParser = new VersionParser();
  2367. $constraint = $versionParser->parseConstraints($textConstraint);
  2368. } else {
  2369. $constraint = null;
  2370. }
  2371. $renderTree = $input->getOption(self::OPTION_TREE);
  2372. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  2373. $return = $inverted ? 1 : 0;
  2374. $results = $installedRepo->getDependents($needles, $constraint, $inverted, $recursive);
  2375. if (empty($results)) {
  2376. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  2377. $this->getIO()->writeError(sprintf(
  2378. '<info>There is no installed package depending on "%s"%s</info>',
  2379. $needle,
  2380. $extra
  2381. ));
  2382. $return = $inverted ? 0 : 1;
  2383. } elseif ($renderTree) {
  2384. $this->initStyles($output);
  2385. $root = $packages[0];
  2386. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root instanceof CompletePackageInterface ? $root->getDescription() : ''));
  2387. $this->printTree($results);
  2388. } else {
  2389. $this->printTable($output, $results);
  2390. }
  2391. if ($inverted && $input->hasArgument(self::ARGUMENT_CONSTRAINT) && !PlatformRepository::isPlatformPackage($needle)) {
  2392. $composerCommand = 'update';
  2393. foreach ($composer->getPackage()->getRequires() as $rootRequirement) {
  2394. if ($rootRequirement->getTarget() === $needle) {
  2395. $composerCommand = 'require';
  2396. break;
  2397. }
  2398. }
  2399. foreach ($composer->getPackage()->getDevRequires() as $rootRequirement) {
  2400. if ($rootRequirement->getTarget() === $needle) {
  2401. $composerCommand = 'require --dev';
  2402. break;
  2403. }
  2404. }
  2405. $this->getIO()->writeError('Not finding what you were looking for? Try calling `composer '.$composerCommand.' "'.$needle.':'.$textConstraint.'" --dry-run` to get another view on the problem.');
  2406. }
  2407. return $return;
  2408. }
  2409. protected function printTable(OutputInterface $output, array $results): void
  2410. {
  2411. $table = [];
  2412. $doubles = [];
  2413. do {
  2414. $queue = [];
  2415. $rows = [];
  2416. foreach ($results as $result) {
  2417. [$package, $link, $children] = $result;
  2418. $unique = (string) $link;
  2419. if (isset($doubles[$unique])) {
  2420. continue;
  2421. }
  2422. $doubles[$unique] = true;
  2423. $version = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '-' : $package->getPrettyVersion();
  2424. $packageUrl = PackageInfo::getViewSourceOrHomepageUrl($package);
  2425. $nameWithLink = $packageUrl !== null ? '<href=' . OutputFormatter::escape($packageUrl) . '>' . $package->getPrettyName() . '</>' : $package->getPrettyName();
  2426. $rows[] = [$nameWithLink, $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint())];
  2427. if (is_array($children)) {
  2428. $queue = array_merge($queue, $children);
  2429. }
  2430. }
  2431. $results = $queue;
  2432. $table = array_merge($rows, $table);
  2433. } while (\count($results) > 0);
  2434. $this->renderTable($table, $output);
  2435. }
  2436. protected function initStyles(OutputInterface $output): void
  2437. {
  2438. $this->colors = [
  2439. 'green',
  2440. 'yellow',
  2441. 'cyan',
  2442. 'magenta',
  2443. 'blue',
  2444. ];
  2445. foreach ($this->colors as $color) {
  2446. $style = new OutputFormatterStyle($color);
  2447. $output->getFormatter()->setStyle($color, $style);
  2448. }
  2449. }
  2450. protected function printTree(array $results, string $prefix = '', int $level = 1): void
  2451. {
  2452. $count = count($results);
  2453. $idx = 0;
  2454. foreach ($results as $result) {
  2455. [$package, $link, $children] = $result;
  2456. $color = $this->colors[$level % count($this->colors)];
  2457. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  2458. $isLast = (++$idx === $count);
  2459. $versionText = $package->getPrettyVersion() === RootPackage::DEFAULT_PRETTY_VERSION ? '' : $package->getPrettyVersion();
  2460. $packageUrl = PackageInfo::getViewSourceOrHomepageUrl($package);
  2461. $nameWithLink = $packageUrl !== null ? '<href=' . OutputFormatter::escape($packageUrl) . '>' . $package->getPrettyName() . '</>' : $package->getPrettyName();
  2462. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $nameWithLink, $versionText));
  2463. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  2464. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  2465. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  2466. if (is_array($children)) {
  2467. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  2468. }
  2469. }
  2470. }
  2471. private function writeTreeLine(string $line): void
  2472. {
  2473. $io = $this->getIO();
  2474. if (!$io->isDecorated()) {
  2475. $line = str_replace(['└', '├', '──', '│'], ['`-', '|-', '-', '|'], $line);
  2476. }
  2477. $io->write($line);
  2478. }
  2479. }
  2480. <?php declare(strict_types=1);
  2481. namespace Composer\Command;
  2482. use Composer\IO\IOInterface;
  2483. use Composer\Package\AliasPackage;
  2484. use Composer\Package\BasePackage;
  2485. use Composer\Package\Locker;
  2486. use Composer\Package\Version\VersionBumper;
  2487. use Composer\Pcre\Preg;
  2488. use Composer\Util\Filesystem;
  2489. use Symfony\Component\Console\Input\InputInterface;
  2490. use Composer\Console\Input\InputArgument;
  2491. use Composer\Console\Input\InputOption;
  2492. use Symfony\Component\Console\Output\OutputInterface;
  2493. use Composer\Factory;
  2494. use Composer\Json\JsonFile;
  2495. use Composer\Json\JsonManipulator;
  2496. use Composer\Repository\PlatformRepository;
  2497. use Composer\Util\Silencer;
  2498. final class BumpCommand extends BaseCommand
  2499. {
  2500. private const ERROR_GENERIC = 1;
  2501. private const ERROR_LOCK_OUTDATED = 2;
  2502. use CompletionTrait;
  2503. protected function configure(): void
  2504. {
  2505. $this
  2506. ->setName('bump')
  2507. ->setDescription('Increases the lower limit of your composer.json requirements to the currently installed versions')
  2508. ->setDefinition([
  2509. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name(s) to restrict which packages are bumped.', null, $this->suggestRootRequirement()),
  2510. new InputOption('dev-only', 'D', InputOption::VALUE_NONE, 'Only bump requirements in "require-dev".'),
  2511. new InputOption('no-dev-only', 'R', InputOption::VALUE_NONE, 'Only bump requirements in "require".'),
  2512. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the packages to bump, but will not execute anything.'),
  2513. ])
  2514. ->setHelp(
  2515. <<<EOT
  2516. The <info>bump</info> command increases the lower limit of your composer.json requirements
  2517. to the currently installed versions. This helps to ensure your dependencies do not
  2518. accidentally get downgraded due to some other conflict, and can slightly improve
  2519. dependency resolution performance as it limits the amount of package versions
  2520. Composer has to look at.
  2521. Running this blindly on libraries is **NOT** recommended as it will narrow down
  2522. your allowed dependencies, which may cause dependency hell for your users.
  2523. Running it with <info>--dev-only</info> on libraries may be fine however as dev requirements
  2524. are local to the library and do not affect consumers of the package.
  2525. EOT
  2526. )
  2527. ;
  2528. }
  2529. protected function execute(InputInterface $input, OutputInterface $output): int
  2530. {
  2531. return $this->doBump(
  2532. $this->getIO(),
  2533. $input->getOption('dev-only'),
  2534. $input->getOption('no-dev-only'),
  2535. $input->getOption('dry-run'),
  2536. $input->getArgument('packages')
  2537. );
  2538. }
  2539. public function doBump(
  2540. IOInterface $io,
  2541. bool $devOnly,
  2542. bool $noDevOnly,
  2543. bool $dryRun,
  2544. array $packagesFilter
  2545. ): int {
  2546. $composerJsonPath = Factory::getComposerFile();
  2547. if (!Filesystem::isReadable($composerJsonPath)) {
  2548. $io->writeError('<error>'.$composerJsonPath.' is not readable.</error>');
  2549. return self::ERROR_GENERIC;
  2550. }
  2551. $composerJson = new JsonFile($composerJsonPath);
  2552. $contents = file_get_contents($composerJson->getPath());
  2553. if (false === $contents) {
  2554. $io->writeError('<error>'.$composerJsonPath.' is not readable.</error>');
  2555. return self::ERROR_GENERIC;
  2556. }
  2557. if (!is_writable($composerJsonPath) && false === Silencer::call('file_put_contents', $composerJsonPath, $contents)) {
  2558. $io->writeError('<error>'.$composerJsonPath.' is not writable.</error>');
  2559. return self::ERROR_GENERIC;
  2560. }
  2561. unset($contents);
  2562. $composer = $this->requireComposer();
  2563. if ($composer->getLocker()->isLocked()) {
  2564. if (!$composer->getLocker()->isFresh()) {
  2565. $io->writeError('<error>The lock file is not up to date with the latest changes in composer.json. Run the appropriate `update` to fix that before you use the `bump` command.</error>');
  2566. return self::ERROR_LOCK_OUTDATED;
  2567. }
  2568. $repo = $composer->getLocker()->getLockedRepository(true);
  2569. } else {
  2570. $repo = $composer->getRepositoryManager()->getLocalRepository();
  2571. }
  2572. if ($composer->getPackage()->getType() !== 'project' && !$devOnly) {
  2573. $io->writeError('<warning>Warning: Bumping dependency constraints is not recommended for libraries as it will narrow down your dependencies and may cause problems for your users.</warning>');
  2574. $contents = $composerJson->read();
  2575. if (!isset($contents['type'])) {
  2576. $io->writeError('<warning>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</warning>');
  2577. $io->writeError('<warning>Alternatively you can use --dev-only to only bump dependencies within "require-dev".</warning>');
  2578. }
  2579. unset($contents);
  2580. }
  2581. $bumper = new VersionBumper();
  2582. $tasks = [];
  2583. if (!$devOnly) {
  2584. $tasks['require'] = $composer->getPackage()->getRequires();
  2585. }
  2586. if (!$noDevOnly) {
  2587. $tasks['require-dev'] = $composer->getPackage()->getDevRequires();
  2588. }
  2589. if (count($packagesFilter) > 0) {
  2590. $pattern = BasePackage::packageNamesToRegexp(array_unique(array_map('strtolower', $packagesFilter)));
  2591. foreach ($tasks as $key => $reqs) {
  2592. foreach ($reqs as $pkgName => $link) {
  2593. if (!Preg::isMatch($pattern, $pkgName)) {
  2594. unset($tasks[$key][$pkgName]);
  2595. }
  2596. }
  2597. }
  2598. }
  2599. $updates = [];
  2600. foreach ($tasks as $key => $reqs) {
  2601. foreach ($reqs as $pkgName => $link) {
  2602. if (PlatformRepository::isPlatformPackage($pkgName)) {
  2603. continue;
  2604. }
  2605. $currentConstraint = $link->getPrettyConstraint();
  2606. $package = $repo->findPackage($pkgName, '*');
  2607. if (null === $package) {
  2608. continue;
  2609. }
  2610. while ($package instanceof AliasPackage) {
  2611. $package = $package->getAliasOf();
  2612. }
  2613. $bumped = $bumper->bumpRequirement($link->getConstraint(), $package);
  2614. if ($bumped === $currentConstraint) {
  2615. continue;
  2616. }
  2617. $updates[$key][$pkgName] = $bumped;
  2618. }
  2619. }
  2620. if (!$dryRun && !$this->updateFileCleanly($composerJson, $updates)) {
  2621. $composerDefinition = $composerJson->read();
  2622. foreach ($updates as $key => $packages) {
  2623. foreach ($packages as $package => $version) {
  2624. $composerDefinition[$key][$package] = $version;
  2625. }
  2626. }
  2627. $composerJson->write($composerDefinition);
  2628. }
  2629. $changeCount = array_sum(array_map('count', $updates));
  2630. if ($changeCount > 0) {
  2631. if ($dryRun) {
  2632. $io->write('<info>' . $composerJsonPath . ' would be updated with:</info>');
  2633. foreach ($updates as $requireType => $packages) {
  2634. foreach ($packages as $package => $version) {
  2635. $io->write(sprintf('<info> - %s.%s: %s</info>', $requireType, $package, $version));
  2636. }
  2637. }
  2638. } else {
  2639. $io->write('<info>' . $composerJsonPath . ' has been updated (' . $changeCount . ' changes).</info>');
  2640. }
  2641. } else {
  2642. $io->write('<info>No requirements to update in '.$composerJsonPath.'.</info>');
  2643. }
  2644. if (!$dryRun && $composer->getLocker()->isLocked() && $composer->getConfig()->get('lock') && $changeCount > 0) {
  2645. $composer->getLocker()->updateHash($composerJson);
  2646. }
  2647. if ($dryRun && $changeCount > 0) {
  2648. return self::ERROR_GENERIC;
  2649. }
  2650. return 0;
  2651. }
  2652. private function updateFileCleanly(JsonFile $json, array $updates): bool
  2653. {
  2654. $contents = file_get_contents($json->getPath());
  2655. if (false === $contents) {
  2656. throw new \RuntimeException('Unable to read '.$json->getPath().' contents.');
  2657. }
  2658. $manipulator = new JsonManipulator($contents);
  2659. foreach ($updates as $key => $packages) {
  2660. foreach ($packages as $package => $version) {
  2661. if (!$manipulator->addLink($key, $package, $version)) {
  2662. return false;
  2663. }
  2664. }
  2665. }
  2666. if (false === file_put_contents($json->getPath(), $manipulator->getContents())) {
  2667. throw new \RuntimeException('Unable to write new '.$json->getPath().' contents.');
  2668. }
  2669. return true;
  2670. }
  2671. }
  2672. <?php declare(strict_types=1);
  2673. namespace Composer\Command;
  2674. use Composer\Package\Link;
  2675. use Composer\Semver\Constraint\Constraint;
  2676. use Symfony\Component\Console\Input\InputInterface;
  2677. use Composer\Console\Input\InputOption;
  2678. use Symfony\Component\Console\Output\OutputInterface;
  2679. use Composer\Repository\PlatformRepository;
  2680. use Composer\Repository\RootPackageRepository;
  2681. use Composer\Repository\InstalledRepository;
  2682. use Composer\Json\JsonFile;
  2683. class CheckPlatformReqsCommand extends BaseCommand
  2684. {
  2685. protected function configure(): void
  2686. {
  2687. $this->setName('check-platform-reqs')
  2688. ->setDescription('Check that platform requirements are satisfied')
  2689. ->setDefinition([
  2690. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  2691. new InputOption('lock', null, InputOption::VALUE_NONE, 'Checks requirements only from the lock file, not from installed packages.'),
  2692. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  2693. ])
  2694. ->setHelp(
  2695. <<<EOT
  2696. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  2697. Unlike update/install, this command will ignore config.platform settings and check the real platform packages so you can be certain you have the required platform dependencies.
  2698. <info>php composer.phar check-platform-reqs</info>
  2699. EOT
  2700. );
  2701. }
  2702. protected function execute(InputInterface $input, OutputInterface $output): int
  2703. {
  2704. $composer = $this->requireComposer();
  2705. $requires = [];
  2706. $removePackages = [];
  2707. if ($input->getOption('lock')) {
  2708. $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements using the lock file</info>');
  2709. $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
  2710. } else {
  2711. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  2712. if (!$installedRepo->getPackages()) {
  2713. $this->getIO()->writeError('<warning>No vendor dir present, checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements from the lock file</warning>');
  2714. $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
  2715. } else {
  2716. if ($input->getOption('no-dev')) {
  2717. $removePackages = $installedRepo->getDevPackageNames();
  2718. }
  2719. $this->getIO()->writeError('<info>Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements for packages in the vendor dir</info>');
  2720. }
  2721. }
  2722. if (!$input->getOption('no-dev')) {
  2723. foreach ($composer->getPackage()->getDevRequires() as $require => $link) {
  2724. $requires[$require] = [$link];
  2725. }
  2726. }
  2727. $installedRepo = new InstalledRepository([$installedRepo, new RootPackageRepository(clone $composer->getPackage())]);
  2728. foreach ($installedRepo->getPackages() as $package) {
  2729. if (in_array($package->getName(), $removePackages, true)) {
  2730. continue;
  2731. }
  2732. foreach ($package->getRequires() as $require => $link) {
  2733. $requires[$require][] = $link;
  2734. }
  2735. }
  2736. ksort($requires);
  2737. $installedRepo->addRepository(new PlatformRepository([], []));
  2738. $results = [];
  2739. $exitCode = 0;
  2740. foreach ($requires as $require => $links) {
  2741. if (PlatformRepository::isPlatformPackage($require)) {
  2742. $candidates = $installedRepo->findPackagesWithReplacersAndProviders($require);
  2743. if ($candidates) {
  2744. $reqResults = [];
  2745. foreach ($candidates as $candidate) {
  2746. $candidateConstraint = null;
  2747. if ($candidate->getName() === $require) {
  2748. $candidateConstraint = new Constraint('=', $candidate->getVersion());
  2749. $candidateConstraint->setPrettyString($candidate->getPrettyVersion());
  2750. } else {
  2751. foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
  2752. if ($link->getTarget() === $require) {
  2753. $candidateConstraint = $link->getConstraint();
  2754. break;
  2755. }
  2756. }
  2757. }
  2758. if (!$candidateConstraint) {
  2759. continue;
  2760. }
  2761. foreach ($links as $link) {
  2762. if (!$link->getConstraint()->matches($candidateConstraint)) {
  2763. $reqResults[] = [
  2764. $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
  2765. $candidateConstraint->getPrettyString(),
  2766. $link,
  2767. '<error>failed</error>',
  2768. $candidate->getName() === $require ? '' : '<comment>provided by '.$candidate->getPrettyName().'</comment>',
  2769. ];
  2770. continue 2;
  2771. }
  2772. }
  2773. $results[] = [
  2774. $candidate->getName() === $require ? $candidate->getPrettyName() : $require,
  2775. $candidateConstraint->getPrettyString(),
  2776. null,
  2777. '<info>success</info>',
  2778. $candidate->getName() === $require ? '' : '<comment>provided by '.$candidate->getPrettyName().'</comment>',
  2779. ];
  2780. continue 2;
  2781. }
  2782. $results = array_merge($results, $reqResults);
  2783. $exitCode = max($exitCode, 1);
  2784. continue;
  2785. }
  2786. $results[] = [
  2787. $require,
  2788. 'n/a',
  2789. $links[0],
  2790. '<error>missing</error>',
  2791. '',
  2792. ];
  2793. $exitCode = max($exitCode, 2);
  2794. }
  2795. }
  2796. $this->printTable($output, $results, $input->getOption('format'));
  2797. return $exitCode;
  2798. }
  2799. protected function printTable(OutputInterface $output, array $results, string $format): void
  2800. {
  2801. $rows = [];
  2802. foreach ($results as $result) {
  2803. [$platformPackage, $version, $link, $status, $provider] = $result;
  2804. if ('json' === $format) {
  2805. $rows[] = [
  2806. "name" => $platformPackage,
  2807. "version" => $version,
  2808. "status" => strip_tags($status),
  2809. "failed_requirement" => $link instanceof Link ? [
  2810. 'source' => $link->getSource(),
  2811. 'type' => $link->getDescription(),
  2812. 'target' => $link->getTarget(),
  2813. 'constraint' => $link->getPrettyConstraint(),
  2814. ] : null,
  2815. "provider" => $provider === '' ? null : strip_tags($provider),
  2816. ];
  2817. } else {
  2818. $rows[] = [
  2819. $platformPackage,
  2820. $version,
  2821. $link,
  2822. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  2823. rtrim($status.' '.$provider),
  2824. ];
  2825. }
  2826. }
  2827. if ('json' === $format) {
  2828. $this->getIO()->write(JsonFile::encode($rows));
  2829. } else {
  2830. $this->renderTable($rows, $output);
  2831. }
  2832. }
  2833. }
  2834. <?php declare(strict_types=1);
  2835. namespace Composer\Command;
  2836. use Composer\Cache;
  2837. use Composer\Factory;
  2838. use Symfony\Component\Console\Input\InputInterface;
  2839. use Symfony\Component\Console\Input\InputOption;
  2840. use Symfony\Component\Console\Output\OutputInterface;
  2841. class ClearCacheCommand extends BaseCommand
  2842. {
  2843. protected function configure(): void
  2844. {
  2845. $this
  2846. ->setName('clear-cache')
  2847. ->setAliases(['clearcache', 'cc'])
  2848. ->setDescription('Clears composer\'s internal package cache')
  2849. ->setDefinition([
  2850. new InputOption('gc', null, InputOption::VALUE_NONE, 'Only run garbage collection, not a full cache clear'),
  2851. ])
  2852. ->setHelp(
  2853. <<<EOT
  2854. The <info>clear-cache</info> deletes all cached packages from composer's
  2855. cache directory.
  2856. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
  2857. EOT
  2858. )
  2859. ;
  2860. }
  2861. protected function execute(InputInterface $input, OutputInterface $output): int
  2862. {
  2863. $composer = $this->tryComposer();
  2864. if ($composer !== null) {
  2865. $config = $composer->getConfig();
  2866. } else {
  2867. $config = Factory::createConfig();
  2868. }
  2869. $io = $this->getIO();
  2870. $cachePaths = [
  2871. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  2872. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  2873. 'cache-files-dir' => $config->get('cache-files-dir'),
  2874. 'cache-dir' => $config->get('cache-dir'),
  2875. ];
  2876. foreach ($cachePaths as $key => $cachePath) {
  2877. if ($key === 'cache-dir' && $input->getOption('gc')) {
  2878. continue;
  2879. }
  2880. $cachePath = realpath($cachePath);
  2881. if (!$cachePath) {
  2882. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  2883. continue;
  2884. }
  2885. $cache = new Cache($io, $cachePath);
  2886. $cache->setReadOnly($config->get('cache-read-only'));
  2887. if (!$cache->isEnabled()) {
  2888. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  2889. continue;
  2890. }
  2891. if ($input->getOption('gc')) {
  2892. $io->writeError("<info>Garbage-collecting cache ($key): $cachePath</info>");
  2893. if ($key === 'cache-files-dir') {
  2894. $cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  2895. } elseif ($key === 'cache-repo-dir') {
  2896. $cache->gc($config->get('cache-ttl'), 1024 * 1024 * 1024 );
  2897. } elseif ($key === 'cache-vcs-dir') {
  2898. $cache->gcVcsCache($config->get('cache-ttl'));
  2899. }
  2900. } else {
  2901. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  2902. $cache->clear();
  2903. }
  2904. }
  2905. if ($input->getOption('gc')) {
  2906. $io->writeError('<info>All caches garbage-collected.</info>');
  2907. } else {
  2908. $io->writeError('<info>All caches cleared.</info>');
  2909. }
  2910. return 0;
  2911. }
  2912. }
  2913. <?php declare(strict_types=1);
  2914. namespace Composer\Command;
  2915. use Composer\Composer;
  2916. use Composer\Package\BasePackage;
  2917. use Composer\Package\PackageInterface;
  2918. use Composer\Pcre\Preg;
  2919. use Composer\Repository\CompositeRepository;
  2920. use Composer\Repository\InstalledRepository;
  2921. use Composer\Repository\PlatformRepository;
  2922. use Composer\Repository\RepositoryInterface;
  2923. use Composer\Repository\RootPackageRepository;
  2924. use Symfony\Component\Console\Completion\CompletionInput;
  2925. trait CompletionTrait
  2926. {
  2927. abstract public function requireComposer(?bool $disablePlugins = null, ?bool $disableScripts = null): Composer;
  2928. private function suggestPreferInstall(): array
  2929. {
  2930. return ['dist', 'source', 'auto'];
  2931. }
  2932. private function suggestRootRequirement(): \Closure
  2933. {
  2934. return function (CompletionInput $input): array {
  2935. $composer = $this->requireComposer();
  2936. return array_merge(array_keys($composer->getPackage()->getRequires()), array_keys($composer->getPackage()->getDevRequires()));
  2937. };
  2938. }
  2939. private function suggestInstalledPackage(bool $includeRootPackage = true, bool $includePlatformPackages = false): \Closure
  2940. {
  2941. return function (CompletionInput $input) use ($includeRootPackage, $includePlatformPackages): array {
  2942. $composer = $this->requireComposer();
  2943. $installedRepos = [];
  2944. if ($includeRootPackage) {
  2945. $installedRepos[] = new RootPackageRepository(clone $composer->getPackage());
  2946. }
  2947. $locker = $composer->getLocker();
  2948. if ($locker->isLocked()) {
  2949. $installedRepos[] = $locker->getLockedRepository(true);
  2950. } else {
  2951. $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
  2952. }
  2953. $platformHint = [];
  2954. if ($includePlatformPackages) {
  2955. if ($locker->isLocked()) {
  2956. $platformRepo = new PlatformRepository([], $locker->getPlatformOverrides());
  2957. } else {
  2958. $platformRepo = new PlatformRepository([], $composer->getConfig()->get('platform'));
  2959. }
  2960. if ($input->getCompletionValue() === '') {
  2961. $hintsToFind = ['ext-' => 0, 'lib-' => 0, 'php' => 99, 'composer' => 99];
  2962. foreach ($platformRepo->getPackages() as $pkg) {
  2963. foreach ($hintsToFind as $hintPrefix => $hintCount) {
  2964. if (str_starts_with($pkg->getName(), $hintPrefix)) {
  2965. if ($hintCount === 0 || $hintCount >= 99) {
  2966. $platformHint[] = $pkg->getName();
  2967. $hintsToFind[$hintPrefix]++;
  2968. } elseif ($hintCount === 1) {
  2969. unset($hintsToFind[$hintPrefix]);
  2970. $platformHint[] = substr($pkg->getName(), 0, max(strlen($pkg->getName()) - 3, strlen($hintPrefix) + 1)).'...';
  2971. }
  2972. continue 2;
  2973. }
  2974. }
  2975. }
  2976. } else {
  2977. $installedRepos[] = $platformRepo;
  2978. }
  2979. }
  2980. $installedRepo = new InstalledRepository($installedRepos);
  2981. return array_merge(
  2982. array_map(static function (PackageInterface $package) {
  2983. return $package->getName();
  2984. }, $installedRepo->getPackages()),
  2985. $platformHint
  2986. );
  2987. };
  2988. }
  2989. private function suggestInstalledPackageTypes(bool $includeRootPackage = true): \Closure
  2990. {
  2991. return function (CompletionInput $input) use ($includeRootPackage): array {
  2992. $composer = $this->requireComposer();
  2993. $installedRepos = [];
  2994. if ($includeRootPackage) {
  2995. $installedRepos[] = new RootPackageRepository(clone $composer->getPackage());
  2996. }
  2997. $locker = $composer->getLocker();
  2998. if ($locker->isLocked()) {
  2999. $installedRepos[] = $locker->getLockedRepository(true);
  3000. } else {
  3001. $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
  3002. }
  3003. $installedRepo = new InstalledRepository($installedRepos);
  3004. return array_values(array_unique(
  3005. array_map(static function (PackageInterface $package) {
  3006. return $package->getType();
  3007. }, $installedRepo->getPackages())
  3008. ));
  3009. };
  3010. }
  3011. private function suggestAvailablePackage(int $max = 99): \Closure
  3012. {
  3013. return function (CompletionInput $input) use ($max): array {
  3014. if ($max < 1) {
  3015. return [];
  3016. }
  3017. $composer = $this->requireComposer();
  3018. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  3019. $results = [];
  3020. $showVendors = false;
  3021. if (!str_contains($input->getCompletionValue(), '/')) {
  3022. $results = $repos->search('^' . preg_quote($input->getCompletionValue()), RepositoryInterface::SEARCH_VENDOR);
  3023. $showVendors = true;
  3024. }
  3025. if (\count($results) <= 1) {
  3026. $results = $repos->search('^'.preg_quote($input->getCompletionValue()), RepositoryInterface::SEARCH_NAME);
  3027. $showVendors = false;
  3028. }
  3029. $results = array_column($results, 'name');
  3030. if ($showVendors) {
  3031. $results = array_map(static function (string $name): string {
  3032. return $name.'/';
  3033. }, $results);
  3034. usort($results, static function (string $a, string $b) {
  3035. $lenA = \strlen($a);
  3036. $lenB = \strlen($b);
  3037. if ($lenA === $lenB) {
  3038. return $a <=> $b;
  3039. }
  3040. return $lenA - $lenB;
  3041. });
  3042. $pinned = [];
  3043. $completionInput = $input->getCompletionValue().'/';
  3044. if (false !== ($exactIndex = array_search($completionInput, $results, true))) {
  3045. $pinned[] = $completionInput;
  3046. array_splice($results, $exactIndex, 1);
  3047. }
  3048. return array_merge($pinned, array_slice($results, 0, $max - \count($pinned)));
  3049. }
  3050. return array_slice($results, 0, $max);
  3051. };
  3052. }
  3053. private function suggestAvailablePackageInclPlatform(): \Closure
  3054. {
  3055. return function (CompletionInput $input): array {
  3056. if (Preg::isMatch('{^(ext|lib|php)(-|$)|^com}', $input->getCompletionValue())) {
  3057. $matches = $this->suggestPlatformPackage()($input);
  3058. } else {
  3059. $matches = [];
  3060. }
  3061. return array_merge($matches, $this->suggestAvailablePackage(99 - \count($matches))($input));
  3062. };
  3063. }
  3064. private function suggestPlatformPackage(): \Closure
  3065. {
  3066. return function (CompletionInput $input): array {
  3067. $repos = new PlatformRepository([], $this->requireComposer()->getConfig()->get('platform'));
  3068. $pattern = BasePackage::packageNameToRegexp($input->getCompletionValue().'*');
  3069. return array_filter(array_map(static function (PackageInterface $package) {
  3070. return $package->getName();
  3071. }, $repos->getPackages()), static function (string $name) use ($pattern): bool {
  3072. return Preg::isMatch($pattern, $name);
  3073. });
  3074. };
  3075. }
  3076. }
  3077. <?php declare(strict_types=1);
  3078. namespace Composer\Command;
  3079. use Composer\Advisory\Auditor;
  3080. use Composer\Pcre\Preg;
  3081. use Composer\Util\Filesystem;
  3082. use Composer\Util\Platform;
  3083. use Composer\Util\Silencer;
  3084. use Symfony\Component\Console\Input\InputInterface;
  3085. use Composer\Console\Input\InputArgument;
  3086. use Symfony\Component\Console\Completion\CompletionInput;
  3087. use Symfony\Component\Console\Input\InputOption;
  3088. use Symfony\Component\Console\Output\OutputInterface;
  3089. use Composer\Config;
  3090. use Composer\Config\JsonConfigSource;
  3091. use Composer\Factory;
  3092. use Composer\IO\IOInterface;
  3093. use Composer\Json\JsonFile;
  3094. use Composer\Semver\VersionParser;
  3095. use Composer\Package\BasePackage;
  3096. class ConfigCommand extends BaseCommand
  3097. {
  3098. protected const CONFIGURABLE_PACKAGE_PROPERTIES = [
  3099. 'name',
  3100. 'type',
  3101. 'description',
  3102. 'homepage',
  3103. 'version',
  3104. 'minimum-stability',
  3105. 'prefer-stable',
  3106. 'keywords',
  3107. 'license',
  3108. 'repositories',
  3109. 'suggest',
  3110. 'extra',
  3111. ];
  3112. protected $config;
  3113. protected $configFile;
  3114. protected $configSource;
  3115. protected $authConfigFile;
  3116. protected $authConfigSource;
  3117. protected function configure(): void
  3118. {
  3119. $this
  3120. ->setName('config')
  3121. ->setDescription('Sets config options')
  3122. ->setDefinition([
  3123. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  3124. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  3125. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  3126. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  3127. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  3128. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  3129. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  3130. new InputOption('json', 'j', InputOption::VALUE_NONE, 'JSON decode the setting value, to be used with extra.* keys'),
  3131. new InputOption('merge', 'm', InputOption::VALUE_NONE, 'Merge the setting value with the current value, to be used with extra.* keys in combination with --json'),
  3132. new InputOption('append', null, InputOption::VALUE_NONE, 'When adding a repository, append it (lowest priority) to the existing ones instead of prepending it (highest priority)'),
  3133. new InputOption('source', null, InputOption::VALUE_NONE, 'Display where the config value is loaded from'),
  3134. new InputArgument('setting-key', null, 'Setting key', null, $this->suggestSettingKeys()),
  3135. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  3136. ])
  3137. ->setHelp(
  3138. <<<EOT
  3139. This command allows you to edit composer config settings and repositories
  3140. in either the local composer.json file or the global config.json file.
  3141. Additionally it lets you edit most properties in the local composer.json.
  3142. To set a config setting:
  3143. <comment>%command.full_name% bin-dir bin/</comment>
  3144. To read a config setting:
  3145. <comment>%command.full_name% bin-dir</comment>
  3146. Outputs: <info>bin</info>
  3147. To edit the global config.json file:
  3148. <comment>%command.full_name% --global</comment>
  3149. To add a repository:
  3150. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  3151. To remove a repository (repo is a short alias for repositories):
  3152. <comment>%command.full_name% --unset repo.foo</comment>
  3153. To disable packagist:
  3154. <comment>%command.full_name% repo.packagist false</comment>
  3155. You can alter repositories in the global config.json file by passing in the
  3156. <info>--global</info> option.
  3157. To add or edit suggested packages you can use:
  3158. <comment>%command.full_name% suggest.package reason for the suggestion</comment>
  3159. To add or edit extra properties you can use:
  3160. <comment>%command.full_name% extra.property value</comment>
  3161. Or to add a complex value you can use json with:
  3162. <comment>%command.full_name% extra.property --json '{"foo":true, "bar": []}'</comment>
  3163. To edit the file in an external editor:
  3164. <comment>%command.full_name% --editor</comment>
  3165. To choose your editor you can set the "EDITOR" env variable.
  3166. To get a list of configuration values in the file:
  3167. <comment>%command.full_name% --list</comment>
  3168. You can always pass more than one option. As an example, if you want to edit the
  3169. global config.json file.
  3170. <comment>%command.full_name% --editor --global</comment>
  3171. Read more at https://getcomposer.org/doc/03-cli.md#config
  3172. EOT
  3173. )
  3174. ;
  3175. }
  3176. protected function initialize(InputInterface $input, OutputInterface $output): void
  3177. {
  3178. parent::initialize($input, $output);
  3179. if ($input->getOption('global') && null !== $input->getOption('file')) {
  3180. throw new \RuntimeException('--file and --global can not be combined');
  3181. }
  3182. $io = $this->getIO();
  3183. $this->config = Factory::createConfig($io);
  3184. $configFile = $this->getComposerConfigFile($input, $this->config);
  3185. if (
  3186. ($configFile === 'composer.json' || $configFile === './composer.json')
  3187. && !file_exists($configFile)
  3188. && realpath(Platform::getCwd()) === realpath($this->config->get('home'))
  3189. ) {
  3190. file_put_contents($configFile, "{\n}\n");
  3191. }
  3192. $this->configFile = new JsonFile($configFile, null, $io);
  3193. $this->configSource = new JsonConfigSource($this->configFile);
  3194. $authConfigFile = $this->getAuthConfigFile($input, $this->config);
  3195. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  3196. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  3197. if ($input->getOption('global') && !$this->configFile->exists()) {
  3198. touch($this->configFile->getPath());
  3199. $this->configFile->write(['config' => new \ArrayObject]);
  3200. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  3201. }
  3202. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  3203. touch($this->authConfigFile->getPath());
  3204. $this->authConfigFile->write(['bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject, 'bearer' => new \ArrayObject]);
  3205. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  3206. }
  3207. if (!$this->configFile->exists()) {
  3208. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  3209. }
  3210. }
  3211. protected function execute(InputInterface $input, OutputInterface $output): int
  3212. {
  3213. if (true === $input->getOption('editor')) {
  3214. $editor = Platform::getEnv('EDITOR');
  3215. if (false === $editor || '' === $editor) {
  3216. if (Platform::isWindows()) {
  3217. $editor = 'notepad';
  3218. } else {
  3219. foreach (['editor', 'vim', 'vi', 'nano', 'pico', 'ed'] as $candidate) {
  3220. if (exec('which '.$candidate)) {
  3221. $editor = $candidate;
  3222. break;
  3223. }
  3224. }
  3225. }
  3226. } else {
  3227. $editor = escapeshellcmd($editor);
  3228. }
  3229. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  3230. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  3231. return 0;
  3232. }
  3233. if (false === $input->getOption('global')) {
  3234. $this->config->merge($this->configFile->read(), $this->configFile->getPath());
  3235. $this->config->merge(['config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : []], $this->authConfigFile->getPath());
  3236. }
  3237. $this->getIO()->loadConfiguration($this->config);
  3238. if (true === $input->getOption('list')) {
  3239. $this->listConfiguration($this->config->all(), $this->config->raw(), $output, null, $input->getOption('source'));
  3240. return 0;
  3241. }
  3242. $settingKey = $input->getArgument('setting-key');
  3243. if (!is_string($settingKey)) {
  3244. return 0;
  3245. }
  3246. if ([] !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  3247. throw new \RuntimeException('You can not combine a setting value with --unset');
  3248. }
  3249. if ([] === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  3250. $properties = self::CONFIGURABLE_PACKAGE_PROPERTIES;
  3251. $propertiesDefaults = [
  3252. 'type' => 'library',
  3253. 'description' => '',
  3254. 'homepage' => '',
  3255. 'minimum-stability' => 'stable',
  3256. 'prefer-stable' => false,
  3257. 'keywords' => [],
  3258. 'license' => [],
  3259. 'suggest' => [],
  3260. 'extra' => [],
  3261. ];
  3262. $rawData = $this->configFile->read();
  3263. $data = $this->config->all();
  3264. $source = $this->config->getSourceOfValue($settingKey);
  3265. if (Preg::isMatch('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  3266. if (!isset($matches[1])) {
  3267. $value = $data['repositories'] ?? [];
  3268. } else {
  3269. if (!isset($data['repositories'][$matches[1]])) {
  3270. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  3271. }
  3272. $value = $data['repositories'][$matches[1]];
  3273. }
  3274. } elseif (strpos($settingKey, '.')) {
  3275. $bits = explode('.', $settingKey);
  3276. if ($bits[0] === 'extra' || $bits[0] === 'suggest') {
  3277. $data = $rawData;
  3278. } else {
  3279. $data = $data['config'];
  3280. }
  3281. $match = false;
  3282. foreach ($bits as $bit) {
  3283. $key = isset($key) ? $key.'.'.$bit : $bit;
  3284. $match = false;
  3285. if (isset($data[$key])) {
  3286. $match = true;
  3287. $data = $data[$key];
  3288. unset($key);
  3289. }
  3290. }
  3291. if (!$match) {
  3292. throw new \RuntimeException($settingKey.' is not defined.');
  3293. }
  3294. $value = $data;
  3295. } elseif (isset($data['config'][$settingKey])) {
  3296. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  3297. if ($value === []) {
  3298. $schema = JsonFile::parseJson((string) file_get_contents(JsonFile::COMPOSER_SCHEMA_PATH));
  3299. if (
  3300. isset($schema['properties']['config']['properties'][$settingKey]['type'])
  3301. && in_array('object', (array) $schema['properties']['config']['properties'][$settingKey]['type'], true)
  3302. ) {
  3303. $value = new \stdClass;
  3304. }
  3305. }
  3306. } elseif (isset($rawData[$settingKey]) && in_array($settingKey, $properties, true)) {
  3307. $value = $rawData[$settingKey];
  3308. $source = $this->configFile->getPath();
  3309. } elseif (isset($propertiesDefaults[$settingKey])) {
  3310. $value = $propertiesDefaults[$settingKey];
  3311. $source = 'defaults';
  3312. } else {
  3313. throw new \RuntimeException($settingKey.' is not defined');
  3314. }
  3315. if (is_array($value) || is_object($value) || is_bool($value)) {
  3316. $value = JsonFile::encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  3317. }
  3318. $sourceOfConfigValue = '';
  3319. if ($input->getOption('source')) {
  3320. $sourceOfConfigValue = ' (' . $source . ')';
  3321. }
  3322. $this->getIO()->write($value . $sourceOfConfigValue, true, IOInterface::QUIET);
  3323. return 0;
  3324. }
  3325. $values = $input->getArgument('setting-value');
  3326. $booleanValidator = static function ($val): bool {
  3327. return in_array($val, ['true', 'false', '1', '0'], true);
  3328. };
  3329. $booleanNormalizer = static function ($val): bool {
  3330. return $val !== 'false' && (bool) $val;
  3331. };
  3332. $uniqueConfigValues = [
  3333. 'process-timeout' => ['is_numeric', 'intval'],
  3334. 'use-include-path' => [$booleanValidator, $booleanNormalizer],
  3335. 'use-github-api' => [$booleanValidator, $booleanNormalizer],
  3336. 'preferred-install' => [
  3337. static function ($val): bool {
  3338. return in_array($val, ['auto', 'source', 'dist'], true);
  3339. },
  3340. static function ($val) {
  3341. return $val;
  3342. },
  3343. ],
  3344. 'gitlab-protocol' => [
  3345. static function ($val): bool {
  3346. return in_array($val, ['git', 'http', 'https'], true);
  3347. },
  3348. static function ($val) {
  3349. return $val;
  3350. },
  3351. ],
  3352. 'store-auths' => [
  3353. static function ($val): bool {
  3354. return in_array($val, ['true', 'false', 'prompt'], true);
  3355. },
  3356. static function ($val) {
  3357. if ('prompt' === $val) {
  3358. return 'prompt';
  3359. }
  3360. return $val !== 'false' && (bool) $val;
  3361. },
  3362. ],
  3363. 'notify-on-install' => [$booleanValidator, $booleanNormalizer],
  3364. 'vendor-dir' => ['is_string', static function ($val) {
  3365. return $val;
  3366. }],
  3367. 'bin-dir' => ['is_string', static function ($val) {
  3368. return $val;
  3369. }],
  3370. 'archive-dir' => ['is_string', static function ($val) {
  3371. return $val;
  3372. }],
  3373. 'archive-format' => ['is_string', static function ($val) {
  3374. return $val;
  3375. }],
  3376. 'data-dir' => ['is_string', static function ($val) {
  3377. return $val;
  3378. }],
  3379. 'cache-dir' => ['is_string', static function ($val) {
  3380. return $val;
  3381. }],
  3382. 'cache-files-dir' => ['is_string', static function ($val) {
  3383. return $val;
  3384. }],
  3385. 'cache-repo-dir' => ['is_string', static function ($val) {
  3386. return $val;
  3387. }],
  3388. 'cache-vcs-dir' => ['is_string', static function ($val) {
  3389. return $val;
  3390. }],
  3391. 'cache-ttl' => ['is_numeric', 'intval'],
  3392. 'cache-files-ttl' => ['is_numeric', 'intval'],
  3393. 'cache-files-maxsize' => [
  3394. static function ($val): bool {
  3395. return Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val);
  3396. },
  3397. static function ($val) {
  3398. return $val;
  3399. },
  3400. ],
  3401. 'bin-compat' => [
  3402. static function ($val): bool {
  3403. return in_array($val, ['auto', 'full', 'proxy', 'symlink']);
  3404. },
  3405. static function ($val) {
  3406. return $val;
  3407. },
  3408. ],
  3409. 'discard-changes' => [
  3410. static function ($val): bool {
  3411. return in_array($val, ['stash', 'true', 'false', '1', '0'], true);
  3412. },
  3413. static function ($val) {
  3414. if ('stash' === $val) {
  3415. return 'stash';
  3416. }
  3417. return $val !== 'false' && (bool) $val;
  3418. },
  3419. ],
  3420. 'autoloader-suffix' => ['is_string', static function ($val) {
  3421. return $val === 'null' ? null : $val;
  3422. }],
  3423. 'sort-packages' => [$booleanValidator, $booleanNormalizer],
  3424. 'optimize-autoloader' => [$booleanValidator, $booleanNormalizer],
  3425. 'classmap-authoritative' => [$booleanValidator, $booleanNormalizer],
  3426. 'apcu-autoloader' => [$booleanValidator, $booleanNormalizer],
  3427. 'prepend-autoloader' => [$booleanValidator, $booleanNormalizer],
  3428. 'disable-tls' => [$booleanValidator, $booleanNormalizer],
  3429. 'secure-http' => [$booleanValidator, $booleanNormalizer],
  3430. 'bump-after-update' => [
  3431. static function ($val): bool {
  3432. return in_array($val, ['dev', 'no-dev', 'true', 'false', '1', '0'], true);
  3433. },
  3434. static function ($val) {
  3435. if ('dev' === $val || 'no-dev' === $val) {
  3436. return $val;
  3437. }
  3438. return $val !== 'false' && (bool) $val;
  3439. },
  3440. ],
  3441. 'cafile' => [
  3442. static function ($val): bool {
  3443. return file_exists($val) && Filesystem::isReadable($val);
  3444. },
  3445. static function ($val) {
  3446. return $val === 'null' ? null : $val;
  3447. },
  3448. ],
  3449. 'capath' => [
  3450. static function ($val): bool {
  3451. return is_dir($val) && Filesystem::isReadable($val);
  3452. },
  3453. static function ($val) {
  3454. return $val === 'null' ? null : $val;
  3455. },
  3456. ],
  3457. 'github-expose-hostname' => [$booleanValidator, $booleanNormalizer],
  3458. 'htaccess-protect' => [$booleanValidator, $booleanNormalizer],
  3459. 'lock' => [$booleanValidator, $booleanNormalizer],
  3460. 'allow-plugins' => [$booleanValidator, $booleanNormalizer],
  3461. 'platform-check' => [
  3462. static function ($val): bool {
  3463. return in_array($val, ['php-only', 'true', 'false', '1', '0'], true);
  3464. },
  3465. static function ($val) {
  3466. if ('php-only' === $val) {
  3467. return 'php-only';
  3468. }
  3469. return $val !== 'false' && (bool) $val;
  3470. },
  3471. ],
  3472. 'use-parent-dir' => [
  3473. static function ($val): bool {
  3474. return in_array($val, ['true', 'false', 'prompt'], true);
  3475. },
  3476. static function ($val) {
  3477. if ('prompt' === $val) {
  3478. return 'prompt';
  3479. }
  3480. return $val !== 'false' && (bool) $val;
  3481. },
  3482. ],
  3483. 'audit.abandoned' => [
  3484. static function ($val): bool {
  3485. return in_array($val, [Auditor::ABANDONED_IGNORE, Auditor::ABANDONED_REPORT, Auditor::ABANDONED_FAIL], true);
  3486. },
  3487. static function ($val) {
  3488. return $val;
  3489. },
  3490. ],
  3491. ];
  3492. $multiConfigValues = [
  3493. 'github-protocols' => [
  3494. static function ($vals) {
  3495. if (!is_array($vals)) {
  3496. return 'array expected';
  3497. }
  3498. foreach ($vals as $val) {
  3499. if (!in_array($val, ['git', 'https', 'ssh'])) {
  3500. return 'valid protocols include: git, https, ssh';
  3501. }
  3502. }
  3503. return true;
  3504. },
  3505. static function ($vals) {
  3506. return $vals;
  3507. },
  3508. ],
  3509. 'github-domains' => [
  3510. static function ($vals) {
  3511. if (!is_array($vals)) {
  3512. return 'array expected';
  3513. }
  3514. return true;
  3515. },
  3516. static function ($vals) {
  3517. return $vals;
  3518. },
  3519. ],
  3520. 'gitlab-domains' => [
  3521. static function ($vals) {
  3522. if (!is_array($vals)) {
  3523. return 'array expected';
  3524. }
  3525. return true;
  3526. },
  3527. static function ($vals) {
  3528. return $vals;
  3529. },
  3530. ],
  3531. 'audit.ignore' => [
  3532. static function ($vals) {
  3533. if (!is_array($vals)) {
  3534. return 'array expected';
  3535. }
  3536. return true;
  3537. },
  3538. static function ($vals) {
  3539. return $vals;
  3540. },
  3541. ],
  3542. ];
  3543. if ($input->getOption('unset') && $settingKey === 'audit') {
  3544. $this->configSource->removeConfigSetting($settingKey);
  3545. return 0;
  3546. }
  3547. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  3548. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  3549. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  3550. }
  3551. $this->configSource->removeConfigSetting($settingKey);
  3552. return 0;
  3553. }
  3554. if (isset($uniqueConfigValues[$settingKey])) {
  3555. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  3556. return 0;
  3557. }
  3558. if (isset($multiConfigValues[$settingKey])) {
  3559. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  3560. return 0;
  3561. }
  3562. if (Preg::isMatch('/^preferred-install\.(.+)/', $settingKey, $matches)) {
  3563. if ($input->getOption('unset')) {
  3564. $this->configSource->removeConfigSetting($settingKey);
  3565. return 0;
  3566. }
  3567. [$validator] = $uniqueConfigValues['preferred-install'];
  3568. if (!$validator($values[0])) {
  3569. throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
  3570. }
  3571. $this->configSource->addConfigSetting($settingKey, $values[0]);
  3572. return 0;
  3573. }
  3574. if (Preg::isMatch('{^allow-plugins\.([a-zA-Z0-9/*-]+)}', $settingKey, $matches)) {
  3575. if ($input->getOption('unset')) {
  3576. $this->configSource->removeConfigSetting($settingKey);
  3577. return 0;
  3578. }
  3579. if (true !== $booleanValidator($values[0])) {
  3580. throw new \RuntimeException(sprintf(
  3581. '"%s" is an invalid value',
  3582. $values[0]
  3583. ));
  3584. }
  3585. $normalizedValue = $booleanNormalizer($values[0]);
  3586. $this->configSource->addConfigSetting($settingKey, $normalizedValue);
  3587. return 0;
  3588. }
  3589. $uniqueProps = [
  3590. 'name' => ['is_string', static function ($val) {
  3591. return $val;
  3592. }],
  3593. 'type' => ['is_string', static function ($val) {
  3594. return $val;
  3595. }],
  3596. 'description' => ['is_string', static function ($val) {
  3597. return $val;
  3598. }],
  3599. 'homepage' => ['is_string', static function ($val) {
  3600. return $val;
  3601. }],
  3602. 'version' => ['is_string', static function ($val) {
  3603. return $val;
  3604. }],
  3605. 'minimum-stability' => [
  3606. static function ($val): bool {
  3607. return isset(BasePackage::STABILITIES[VersionParser::normalizeStability($val)]);
  3608. },
  3609. static function ($val): string {
  3610. return VersionParser::normalizeStability($val);
  3611. },
  3612. ],
  3613. 'prefer-stable' => [$booleanValidator, $booleanNormalizer],
  3614. ];
  3615. $multiProps = [
  3616. 'keywords' => [
  3617. static function ($vals) {
  3618. if (!is_array($vals)) {
  3619. return 'array expected';
  3620. }
  3621. return true;
  3622. },
  3623. static function ($vals) {
  3624. return $vals;
  3625. },
  3626. ],
  3627. 'license' => [
  3628. static function ($vals) {
  3629. if (!is_array($vals)) {
  3630. return 'array expected';
  3631. }
  3632. return true;
  3633. },
  3634. static function ($vals) {
  3635. return $vals;
  3636. },
  3637. ],
  3638. ];
  3639. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) {
  3640. throw new \InvalidArgumentException('The ' . $settingKey . ' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  3641. }
  3642. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  3643. $this->configSource->removeProperty($settingKey);
  3644. return 0;
  3645. }
  3646. if (isset($uniqueProps[$settingKey])) {
  3647. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  3648. return 0;
  3649. }
  3650. if (isset($multiProps[$settingKey])) {
  3651. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  3652. return 0;
  3653. }
  3654. if (Preg::isMatchStrictGroups('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  3655. if ($input->getOption('unset')) {
  3656. $this->configSource->removeRepository($matches[1]);
  3657. return 0;
  3658. }
  3659. if (2 === count($values)) {
  3660. $this->configSource->addRepository($matches[1], [
  3661. 'type' => $values[0],
  3662. 'url' => $values[1],
  3663. ], $input->getOption('append'));
  3664. return 0;
  3665. }
  3666. if (1 === count($values)) {
  3667. $value = strtolower($values[0]);
  3668. if (true === $booleanValidator($value)) {
  3669. if (false === $booleanNormalizer($value)) {
  3670. $this->configSource->addRepository($matches[1], false, $input->getOption('append'));
  3671. return 0;
  3672. }
  3673. } else {
  3674. $value = JsonFile::parseJson($values[0]);
  3675. $this->configSource->addRepository($matches[1], $value, $input->getOption('append'));
  3676. return 0;
  3677. }
  3678. }
  3679. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  3680. }
  3681. if (Preg::isMatch('/^extra\.(.+)/', $settingKey, $matches)) {
  3682. if ($input->getOption('unset')) {
  3683. $this->configSource->removeProperty($settingKey);
  3684. return 0;
  3685. }
  3686. $value = $values[0];
  3687. if ($input->getOption('json')) {
  3688. $value = JsonFile::parseJson($value);
  3689. if ($input->getOption('merge')) {
  3690. $currentValue = $this->configFile->read();
  3691. $bits = explode('.', $settingKey);
  3692. foreach ($bits as $bit) {
  3693. $currentValue = $currentValue[$bit] ?? null;
  3694. }
  3695. if (is_array($currentValue) && is_array($value)) {
  3696. if (array_is_list($currentValue) && array_is_list($value)) {
  3697. $value = array_merge($currentValue, $value);
  3698. } else {
  3699. $value = $value + $currentValue;
  3700. }
  3701. }
  3702. }
  3703. }
  3704. $this->configSource->addProperty($settingKey, $value);
  3705. return 0;
  3706. }
  3707. if (Preg::isMatch('/^suggest\.(.+)/', $settingKey, $matches)) {
  3708. if ($input->getOption('unset')) {
  3709. $this->configSource->removeProperty($settingKey);
  3710. return 0;
  3711. }
  3712. $this->configSource->addProperty($settingKey, implode(' ', $values));
  3713. return 0;
  3714. }
  3715. if (in_array($settingKey, ['suggest', 'extra'], true) && $input->getOption('unset')) {
  3716. $this->configSource->removeProperty($settingKey);
  3717. return 0;
  3718. }
  3719. if (Preg::isMatch('/^platform\.(.+)/', $settingKey, $matches)) {
  3720. if ($input->getOption('unset')) {
  3721. $this->configSource->removeConfigSetting($settingKey);
  3722. return 0;
  3723. }
  3724. $this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]);
  3725. return 0;
  3726. }
  3727. if ($settingKey === 'platform' && $input->getOption('unset')) {
  3728. $this->configSource->removeConfigSetting($settingKey);
  3729. return 0;
  3730. }
  3731. if (Preg::isMatch('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
  3732. if ($input->getOption('unset')) {
  3733. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3734. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3735. return 0;
  3736. }
  3737. if ($matches[1] === 'bitbucket-oauth') {
  3738. if (2 !== count($values)) {
  3739. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  3740. }
  3741. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3742. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['consumer-key' => $values[0], 'consumer-secret' => $values[1]]);
  3743. } elseif ($matches[1] === 'gitlab-token' && 2 === count($values)) {
  3744. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3745. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['username' => $values[0], 'token' => $values[1]]);
  3746. } elseif (in_array($matches[1], ['github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'], true)) {
  3747. if (1 !== count($values)) {
  3748. throw new \RuntimeException('Too many arguments, expected only one token');
  3749. }
  3750. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3751. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  3752. } elseif ($matches[1] === 'http-basic') {
  3753. if (2 !== count($values)) {
  3754. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  3755. }
  3756. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  3757. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], ['username' => $values[0], 'password' => $values[1]]);
  3758. }
  3759. return 0;
  3760. }
  3761. if (Preg::isMatch('/^scripts\.(.+)/', $settingKey, $matches)) {
  3762. if ($input->getOption('unset')) {
  3763. $this->configSource->removeProperty($settingKey);
  3764. return 0;
  3765. }
  3766. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  3767. return 0;
  3768. }
  3769. if ($input->getOption('unset')) {
  3770. $this->configSource->removeProperty($settingKey);
  3771. return 0;
  3772. }
  3773. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  3774. }
  3775. protected function handleSingleValue(string $key, array $callbacks, array $values, string $method): void
  3776. {
  3777. [$validator, $normalizer] = $callbacks;
  3778. if (1 !== count($values)) {
  3779. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  3780. }
  3781. if (true !== $validation = $validator($values[0])) {
  3782. throw new \RuntimeException(sprintf(
  3783. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  3784. $values[0]
  3785. ));
  3786. }
  3787. $normalizedValue = $normalizer($values[0]);
  3788. if ($key === 'disable-tls') {
  3789. if (!$normalizedValue && $this->config->get('disable-tls')) {
  3790. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  3791. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  3792. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  3793. }
  3794. }
  3795. call_user_func([$this->configSource, $method], $key, $normalizedValue);
  3796. }
  3797. protected function handleMultiValue(string $key, array $callbacks, array $values, string $method): void
  3798. {
  3799. [$validator, $normalizer] = $callbacks;
  3800. if (true !== $validation = $validator($values)) {
  3801. throw new \RuntimeException(sprintf(
  3802. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  3803. json_encode($values)
  3804. ));
  3805. }
  3806. call_user_func([$this->configSource, $method], $key, $normalizer($values));
  3807. }
  3808. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, ?string $k = null, bool $showSource = false): void
  3809. {
  3810. $origK = $k;
  3811. $io = $this->getIO();
  3812. foreach ($contents as $key => $value) {
  3813. if ($k === null && !in_array($key, ['config', 'repositories'])) {
  3814. continue;
  3815. }
  3816. $rawVal = $rawContents[$key] ?? null;
  3817. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  3818. $k .= Preg::replace('{^config\.}', '', $key . '.');
  3819. $this->listConfiguration($value, $rawVal, $output, $k, $showSource);
  3820. $k = $origK;
  3821. continue;
  3822. }
  3823. if (is_array($value)) {
  3824. $value = array_map(static function ($val) {
  3825. return is_array($val) ? json_encode($val) : $val;
  3826. }, $value);
  3827. $value = '['.implode(', ', $value).']';
  3828. }
  3829. if (is_bool($value)) {
  3830. $value = var_export($value, true);
  3831. }
  3832. $source = '';
  3833. if ($showSource) {
  3834. $source = ' (' . $this->config->getSourceOfValue($k . $key) . ')';
  3835. }
  3836. if (null !== $k && 0 === strpos($k, 'repositories')) {
  3837. $link = 'https://getcomposer.org/doc/05-repositories.md';
  3838. } else {
  3839. $id = Preg::replace('{\..*$}', '', $k === '' || $k === null ? (string) $key : $k);
  3840. $id = Preg::replace('{[^a-z0-9]}i', '-', strtolower(trim($id)));
  3841. $id = Preg::replace('{-+}', '-', $id);
  3842. $link = 'https://getcomposer.org/doc/06-config.md#' . $id;
  3843. }
  3844. if (is_string($rawVal) && $rawVal !== $value) {
  3845. $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $rawVal . ' (' . $value . ')</info>' . $source, true, IOInterface::QUIET);
  3846. } else {
  3847. $io->write('[<fg=yellow;href=' . $link .'>' . $k . $key . '</>] <info>' . $value . '</info>' . $source, true, IOInterface::QUIET);
  3848. }
  3849. }
  3850. }
  3851. private function getComposerConfigFile(InputInterface $input, Config $config): string
  3852. {
  3853. return $input->getOption('global')
  3854. ? ($config->get('home') . '/config.json')
  3855. : ($input->getOption('file') ?: Factory::getComposerFile())
  3856. ;
  3857. }
  3858. private function getAuthConfigFile(InputInterface $input, Config $config): string
  3859. {
  3860. return $input->getOption('global')
  3861. ? ($config->get('home') . '/auth.json')
  3862. : dirname($this->getComposerConfigFile($input, $config)) . '/auth.json'
  3863. ;
  3864. }
  3865. private function suggestSettingKeys(): \Closure
  3866. {
  3867. return function (CompletionInput $input): array {
  3868. if ($input->getOption('list') || $input->getOption('editor') || $input->getOption('auth')) {
  3869. return [];
  3870. }
  3871. $config = Factory::createConfig();
  3872. $configFile = new JsonFile($this->getComposerConfigFile($input, $config));
  3873. if ($configFile->exists()) {
  3874. $config->merge($configFile->read(), $configFile->getPath());
  3875. }
  3876. $authConfigFile = new JsonFile($this->getAuthConfigFile($input, $config));
  3877. if ($authConfigFile->exists()) {
  3878. $config->merge(['config' => $authConfigFile->read()], $authConfigFile->getPath());
  3879. }
  3880. $rawConfig = $config->raw();
  3881. $keys = array_merge(
  3882. $this->flattenSettingKeys($rawConfig['config']),
  3883. $this->flattenSettingKeys($rawConfig['repositories'], 'repositories.')
  3884. );
  3885. if ($input->getOption('unset')) {
  3886. $sources = [$configFile->getPath(), $authConfigFile->getPath()];
  3887. $keys = array_filter(
  3888. $keys,
  3889. static function (string $key) use ($config, $sources): bool {
  3890. return in_array($config->getSourceOfValue($key), $sources, true);
  3891. }
  3892. );
  3893. } else {
  3894. $keys = array_merge($keys, self::CONFIGURABLE_PACKAGE_PROPERTIES);
  3895. }
  3896. if ($configFile->exists()) {
  3897. $properties = array_filter(
  3898. $configFile->read(),
  3899. static function (string $key): bool {
  3900. return in_array($key, self::CONFIGURABLE_PACKAGE_PROPERTIES, true);
  3901. },
  3902. ARRAY_FILTER_USE_KEY
  3903. );
  3904. $keys = array_merge(
  3905. $keys,
  3906. $this->flattenSettingKeys($properties)
  3907. );
  3908. }
  3909. $completionValue = $input->getCompletionValue();
  3910. if ($completionValue !== '') {
  3911. $keys = array_filter(
  3912. $keys,
  3913. static function (string $key) use ($completionValue): bool {
  3914. return str_starts_with($key, $completionValue);
  3915. }
  3916. );
  3917. }
  3918. sort($keys);
  3919. return array_unique($keys);
  3920. };
  3921. }
  3922. private function flattenSettingKeys(array $config, string $prefix = ''): array
  3923. {
  3924. $keys = [];
  3925. foreach ($config as $key => $value) {
  3926. $keys[] = [$prefix . $key];
  3927. if (is_array($value) && !array_is_list($value) && $prefix !== 'repositories.') {
  3928. $keys[] = $this->flattenSettingKeys($value, $prefix . $key . '.');
  3929. }
  3930. }
  3931. return array_merge(...$keys);
  3932. }
  3933. }
  3934. <?php declare(strict_types=1);
  3935. namespace Composer\Command;
  3936. use Composer\Config;
  3937. use Composer\Factory;
  3938. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  3939. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  3940. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  3941. use Composer\Installer;
  3942. use Composer\Installer\ProjectInstaller;
  3943. use Composer\Installer\SuggestedPackagesReporter;
  3944. use Composer\IO\IOInterface;
  3945. use Composer\Package\BasePackage;
  3946. use Composer\DependencyResolver\Operation\InstallOperation;
  3947. use Composer\Package\Version\VersionSelector;
  3948. use Composer\Package\AliasPackage;
  3949. use Composer\Pcre\Preg;
  3950. use Composer\Plugin\PluginBlockedException;
  3951. use Composer\Repository\RepositoryFactory;
  3952. use Composer\Repository\CompositeRepository;
  3953. use Composer\Repository\PlatformRepository;
  3954. use Composer\Repository\InstalledArrayRepository;
  3955. use Composer\Repository\RepositorySet;
  3956. use Composer\Script\ScriptEvents;
  3957. use Composer\Util\Silencer;
  3958. use Composer\Console\Input\InputArgument;
  3959. use Seld\Signal\SignalHandler;
  3960. use Symfony\Component\Console\Input\InputInterface;
  3961. use Composer\Console\Input\InputOption;
  3962. use Symfony\Component\Console\Output\OutputInterface;
  3963. use Symfony\Component\Finder\Finder;
  3964. use Composer\Json\JsonFile;
  3965. use Composer\Config\JsonConfigSource;
  3966. use Composer\Util\Filesystem;
  3967. use Composer\Util\Platform;
  3968. use Composer\Util\ProcessExecutor;
  3969. use Composer\Package\Version\VersionParser;
  3970. use Composer\Advisory\Auditor;
  3971. class CreateProjectCommand extends BaseCommand
  3972. {
  3973. use CompletionTrait;
  3974. protected $suggestedPackagesReporter;
  3975. protected function configure(): void
  3976. {
  3977. $this
  3978. ->setName('create-project')
  3979. ->setDescription('Creates new project from a package into given directory')
  3980. ->setDefinition([
  3981. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed', null, $this->suggestAvailablePackage()),
  3982. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  3983. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  3984. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  3985. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3986. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  3987. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  3988. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories to look the package up, either by URL or using JSON arrays'),
  3989. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  3990. new InputOption('add-repository', null, InputOption::VALUE_NONE, 'Add the custom repository in the composer.json. If a lock file is present it will be deleted and an update will be run instead of install.'),
  3991. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3992. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3993. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3994. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  3995. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3996. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  3997. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  3998. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  3999. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  4000. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Whether to skip auditing of the installed package dependencies (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  4001. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json" or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  4002. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  4003. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  4004. new InputOption('ask', null, InputOption::VALUE_NONE, 'Whether to ask for project directory.'),
  4005. ])
  4006. ->setHelp(
  4007. <<<EOT
  4008. The <info>create-project</info> command creates a new project from a given
  4009. package into a new directory. If executed without params and in a directory
  4010. with a composer.json file it installs the packages for the current project.
  4011. You can use this command to bootstrap new projects or setup a clean
  4012. version-controlled installation for developers of your project.
  4013. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  4014. You can also specify the version with the package name using = or : as separator.
  4015. <info>php composer.phar create-project vendor/project:version target-directory</info>
  4016. To install unstable packages, either specify the version you want, or use the
  4017. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  4018. To setup a developer workable version you should create the project using the source
  4019. controlled code by appending the <info>'--prefer-source'</info> flag.
  4020. To install a package from another repository than the default one you
  4021. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  4022. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  4023. EOT
  4024. )
  4025. ;
  4026. }
  4027. protected function execute(InputInterface $input, OutputInterface $output): int
  4028. {
  4029. $config = Factory::createConfig();
  4030. $io = $this->getIO();
  4031. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input, true);
  4032. if ($input->getOption('dev')) {
  4033. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4034. }
  4035. if ($input->getOption('no-custom-installers')) {
  4036. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4037. $input->setOption('no-plugins', true);
  4038. }
  4039. if ($input->isInteractive() && $input->getOption('ask')) {
  4040. $package = $input->getArgument('package');
  4041. if (null === $package) {
  4042. throw new \RuntimeException('Not enough arguments (missing: "package").');
  4043. }
  4044. $parts = explode("/", strtolower($package), 2);
  4045. $input->setArgument('directory', $io->ask('New project directory [<comment>'.array_pop($parts).'</comment>]: '));
  4046. }
  4047. return $this->installProject(
  4048. $io,
  4049. $config,
  4050. $input,
  4051. $input->getArgument('package'),
  4052. $input->getArgument('directory'),
  4053. $input->getArgument('version'),
  4054. $input->getOption('stability'),
  4055. $preferSource,
  4056. $preferDist,
  4057. !$input->getOption('no-dev'),
  4058. \count($input->getOption('repository')) > 0 ? $input->getOption('repository') : $input->getOption('repository-url'),
  4059. $input->getOption('no-plugins'),
  4060. $input->getOption('no-scripts'),
  4061. $input->getOption('no-progress'),
  4062. $input->getOption('no-install'),
  4063. $this->getPlatformRequirementFilter($input),
  4064. !$input->getOption('no-secure-http'),
  4065. $input->getOption('add-repository')
  4066. );
  4067. }
  4068. public function installProject(IOInterface $io, Config $config, InputInterface $input, ?string $packageName = null, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $noInstall = false, ?PlatformRequirementFilterInterface $platformRequirementFilter = null, bool $secureHttp = true, bool $addRepository = false): int
  4069. {
  4070. $oldCwd = Platform::getCwd();
  4071. if ($repositories !== null && !is_array($repositories)) {
  4072. $repositories = (array) $repositories;
  4073. }
  4074. $platformRequirementFilter = $platformRequirementFilter ?? PlatformRequirementFilterFactory::ignoreNothing();
  4075. $io->loadConfiguration($config);
  4076. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  4077. if ($packageName !== null) {
  4078. $installedFromVcs = $this->installRootPackage($input, $io, $config, $packageName, $platformRequirementFilter, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repositories, $disablePlugins, $disableScripts, $noProgress, $secureHttp);
  4079. } else {
  4080. $installedFromVcs = false;
  4081. }
  4082. if ($repositories !== null && $addRepository && is_file('composer.lock')) {
  4083. unlink('composer.lock');
  4084. }
  4085. $composer = $this->createComposerInstance($input, $io, null, $disablePlugins, $disableScripts);
  4086. if ($repositories !== null && $addRepository) {
  4087. foreach ($repositories as $index => $repo) {
  4088. $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repo, true);
  4089. $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
  4090. $name = RepositoryFactory::generateRepositoryName($index, $repoConfig, $composerJsonRepositoriesConfig);
  4091. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  4092. if (
  4093. (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
  4094. || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
  4095. ) {
  4096. $configSource->addRepository('packagist.org', false);
  4097. } else {
  4098. $configSource->addRepository($name, $repoConfig, false);
  4099. }
  4100. $composer = $this->createComposerInstance($input, $io, null, $disablePlugins);
  4101. }
  4102. }
  4103. $process = $composer->getLoop()->getProcessExecutor();
  4104. $fs = new Filesystem($process);
  4105. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  4106. $config = $composer->getConfig();
  4107. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  4108. if ($noInstall === false) {
  4109. $composer->getInstallationManager()->setOutputProgress(!$noProgress);
  4110. $installer = Installer::create($io, $composer);
  4111. $installer->setPreferSource($preferSource)
  4112. ->setPreferDist($preferDist)
  4113. ->setDevMode($installDevPackages)
  4114. ->setPlatformRequirementFilter($platformRequirementFilter)
  4115. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  4116. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  4117. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  4118. ->setApcuAutoloader($config->get('apcu-autoloader'))
  4119. ->setAudit(!$input->getOption('no-audit'))
  4120. ->setAuditFormat($this->getAuditFormat($input));
  4121. if (!$composer->getLocker()->isLocked()) {
  4122. $installer->setUpdate(true);
  4123. }
  4124. if ($disablePlugins) {
  4125. $installer->disablePlugins();
  4126. }
  4127. try {
  4128. $status = $installer->run();
  4129. if (0 !== $status) {
  4130. return $status;
  4131. }
  4132. } catch (PluginBlockedException $e) {
  4133. $io->writeError('<error>Hint: To allow running the config command recommended below before dependencies are installed, run create-project with --no-install.</error>');
  4134. $io->writeError('<error>You can then cd into '.getcwd().', configure allow-plugins, and finally run a composer install to complete the process.</error>');
  4135. throw $e;
  4136. }
  4137. }
  4138. $hasVcs = $installedFromVcs;
  4139. if (
  4140. !$input->getOption('keep-vcs')
  4141. && $installedFromVcs
  4142. && (
  4143. $input->getOption('remove-vcs')
  4144. || !$io->isInteractive()
  4145. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ')
  4146. )
  4147. ) {
  4148. $finder = new Finder();
  4149. $finder->depth(0)->directories()->in(Platform::getCwd())->ignoreVCS(false)->ignoreDotFiles(false);
  4150. foreach (['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_'] as $vcsName) {
  4151. $finder->name($vcsName);
  4152. }
  4153. try {
  4154. $dirs = iterator_to_array($finder);
  4155. unset($finder);
  4156. foreach ($dirs as $dir) {
  4157. if (!$fs->removeDirectory((string) $dir)) {
  4158. throw new \RuntimeException('Could not remove '.$dir);
  4159. }
  4160. }
  4161. } catch (\Exception $e) {
  4162. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  4163. }
  4164. $hasVcs = false;
  4165. }
  4166. if (!$hasVcs) {
  4167. $package = $composer->getPackage();
  4168. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  4169. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  4170. foreach ($package->{'get'.$meta['method']}() as $link) {
  4171. if ($link->getPrettyConstraint() === 'self.version') {
  4172. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  4173. }
  4174. }
  4175. }
  4176. }
  4177. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  4178. chdir($oldCwd);
  4179. return 0;
  4180. }
  4181. protected function installRootPackage(InputInterface $input, IOInterface $io, Config $config, string $packageName, PlatformRequirementFilterInterface $platformRequirementFilter, ?string $directory = null, ?string $packageVersion = null, ?string $stability = 'stable', bool $preferSource = false, bool $preferDist = false, bool $installDevPackages = false, ?array $repositories = null, bool $disablePlugins = false, bool $disableScripts = false, bool $noProgress = false, bool $secureHttp = true): bool
  4182. {
  4183. $parser = new VersionParser();
  4184. $requirements = $parser->parseNameVersionPairs([$packageName]);
  4185. $name = strtolower($requirements[0]['name']);
  4186. if (!$packageVersion && isset($requirements[0]['version'])) {
  4187. $packageVersion = $requirements[0]['version'];
  4188. }
  4189. if (null === $directory) {
  4190. $parts = explode("/", $name, 2);
  4191. $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  4192. }
  4193. $directory = rtrim($directory, '/\\');
  4194. $process = new ProcessExecutor($io);
  4195. $fs = new Filesystem($process);
  4196. if (!$fs->isAbsolutePath($directory)) {
  4197. $directory = Platform::getCwd() . DIRECTORY_SEPARATOR . $directory;
  4198. }
  4199. if ('' === $directory) {
  4200. throw new \UnexpectedValueException('Got an empty target directory, something went wrong');
  4201. }
  4202. $config->setBaseDir($directory);
  4203. if (!$secureHttp) {
  4204. $config->merge(['config' => ['secure-http' => false]], Config::SOURCE_COMMAND);
  4205. }
  4206. $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(Platform::getCwd(), $directory, true) . '"</info>');
  4207. if (file_exists($directory)) {
  4208. if (!is_dir($directory)) {
  4209. throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
  4210. }
  4211. if (!$fs->isDirEmpty($directory)) {
  4212. throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
  4213. }
  4214. }
  4215. if (null === $stability) {
  4216. if (null === $packageVersion) {
  4217. $stability = 'stable';
  4218. } elseif (Preg::isMatchStrictGroups('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::STABILITIES)).')$}i', $packageVersion, $match)) {
  4219. $stability = $match[1];
  4220. } else {
  4221. $stability = VersionParser::parseStability($packageVersion);
  4222. }
  4223. }
  4224. $stability = VersionParser::normalizeStability($stability);
  4225. if (!isset(BasePackage::STABILITIES[$stability])) {
  4226. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::STABILITIES)));
  4227. }
  4228. $composer = $this->createComposerInstance($input, $io, $config->all(), $disablePlugins, $disableScripts);
  4229. $config = $composer->getConfig();
  4230. $config->setBaseDir($directory);
  4231. $rm = $composer->getRepositoryManager();
  4232. $repositorySet = new RepositorySet($stability);
  4233. if (null === $repositories) {
  4234. $repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm)));
  4235. } else {
  4236. foreach ($repositories as $repo) {
  4237. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
  4238. if (
  4239. (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
  4240. || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
  4241. ) {
  4242. continue;
  4243. }
  4244. $repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig, $rm));
  4245. }
  4246. }
  4247. $platformOverrides = $config->get('platform');
  4248. $platformRepo = new PlatformRepository([], $platformOverrides);
  4249. $versionSelector = new VersionSelector($repositorySet, $platformRepo);
  4250. $package = $versionSelector->findBestCandidate($name, $packageVersion, $stability, $platformRequirementFilter, 0, $io);
  4251. if (!$package) {
  4252. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  4253. if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && $versionSelector->findBestCandidate($name, $packageVersion, $stability, PlatformRequirementFilterFactory::ignoreAll())) {
  4254. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version, PHP extensions and Composer version.');
  4255. }
  4256. throw new \InvalidArgumentException($errorMessage .'.');
  4257. }
  4258. @mkdir($directory, 0777, true);
  4259. if (false !== ($realDir = realpath($directory))) {
  4260. $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) use ($realDir) {
  4261. $this->getIO()->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
  4262. $fs = new Filesystem();
  4263. $fs->removeDirectory($realDir);
  4264. $handler->exitWithLastSignal();
  4265. });
  4266. }
  4267. if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  4268. $package = $package->getAliasOf();
  4269. }
  4270. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  4271. if ($disablePlugins) {
  4272. $io->writeError('<info>Plugins have been disabled.</info>');
  4273. }
  4274. if ($package instanceof AliasPackage) {
  4275. $package = $package->getAliasOf();
  4276. }
  4277. $dm = $composer->getDownloadManager();
  4278. $dm->setPreferSource($preferSource)
  4279. ->setPreferDist($preferDist);
  4280. $projectInstaller = new ProjectInstaller($directory, $dm, $fs);
  4281. $im = $composer->getInstallationManager();
  4282. $im->setOutputProgress(!$noProgress);
  4283. $im->addInstaller($projectInstaller);
  4284. $im->execute(new InstalledArrayRepository(), [new InstallOperation($package)]);
  4285. $im->notifyInstalls($io);
  4286. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  4287. $installedFromVcs = 'source' === $package->getInstallationSource();
  4288. $io->writeError('<info>Created project in ' . $directory . '</info>');
  4289. chdir($directory);
  4290. if (file_exists($directory.'/composer.json') && Platform::getEnv('COMPOSER') !== false) {
  4291. Platform::clearEnv('COMPOSER');
  4292. }
  4293. Platform::putEnv('COMPOSER_ROOT_VERSION', $package->getPrettyVersion());
  4294. if (isset($signalHandler)) {
  4295. $signalHandler->unregister();
  4296. }
  4297. return $installedFromVcs;
  4298. }
  4299. }
  4300. <?php declare(strict_types=1);
  4301. namespace Composer\Command;
  4302. use Symfony\Component\Console\Input\InputInterface;
  4303. use Symfony\Component\Console\Output\OutputInterface;
  4304. use Composer\Console\Input\InputArgument;
  4305. use Composer\Console\Input\InputOption;
  4306. class DependsCommand extends BaseDependencyCommand
  4307. {
  4308. use CompletionTrait;
  4309. protected function configure(): void
  4310. {
  4311. $this
  4312. ->setName('depends')
  4313. ->setAliases(['why'])
  4314. ->setDescription('Shows which packages cause the given package to be installed')
  4315. ->setDefinition([
  4316. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect', null, $this->suggestInstalledPackage(true, true)),
  4317. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  4318. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  4319. new InputOption('locked', null, InputOption::VALUE_NONE, 'Read dependency information from composer.lock'),
  4320. ])
  4321. ->setHelp(
  4322. <<<EOT
  4323. Displays detailed information about where a package is referenced.
  4324. <info>php composer.phar depends composer/composer</info>
  4325. Read more at https://getcomposer.org/doc/03-cli.md#depends-why
  4326. EOT
  4327. )
  4328. ;
  4329. }
  4330. protected function execute(InputInterface $input, OutputInterface $output): int
  4331. {
  4332. return parent::doExecute($input, $output);
  4333. }
  4334. }
  4335. <?php declare(strict_types=1);
  4336. namespace Composer\Command;
  4337. use Composer\Advisory\Auditor;
  4338. use Composer\Composer;
  4339. use Composer\Factory;
  4340. use Composer\Config;
  4341. use Composer\Downloader\TransportException;
  4342. use Composer\IO\BufferIO;
  4343. use Composer\Json\JsonFile;
  4344. use Composer\Json\JsonValidationException;
  4345. use Composer\Package\Locker;
  4346. use Composer\Package\RootPackage;
  4347. use Composer\Package\Version\VersionParser;
  4348. use Composer\Pcre\Preg;
  4349. use Composer\Repository\ComposerRepository;
  4350. use Composer\Repository\FilesystemRepository;
  4351. use Composer\Repository\PlatformRepository;
  4352. use Composer\Plugin\CommandEvent;
  4353. use Composer\Plugin\PluginEvents;
  4354. use Composer\Repository\RepositorySet;
  4355. use Composer\Repository\RootPackageRepository;
  4356. use Composer\Util\ConfigValidator;
  4357. use Composer\Util\Git;
  4358. use Composer\Util\IniHelper;
  4359. use Composer\Util\ProcessExecutor;
  4360. use Composer\Util\HttpDownloader;
  4361. use Composer\Util\StreamContextFactory;
  4362. use Composer\Util\Platform;
  4363. use Composer\SelfUpdate\Keys;
  4364. use Composer\SelfUpdate\Versions;
  4365. use Composer\IO\NullIO;
  4366. use Composer\Package\CompletePackageInterface;
  4367. use Composer\XdebugHandler\XdebugHandler;
  4368. use Symfony\Component\Console\Input\InputInterface;
  4369. use Symfony\Component\Console\Output\OutputInterface;
  4370. use Symfony\Component\Process\ExecutableFinder;
  4371. use Composer\Util\Http\ProxyManager;
  4372. use Composer\Util\Http\RequestProxy;
  4373. class DiagnoseCommand extends BaseCommand
  4374. {
  4375. protected $httpDownloader;
  4376. protected $process;
  4377. protected $exitCode = 0;
  4378. protected function configure(): void
  4379. {
  4380. $this
  4381. ->setName('diagnose')
  4382. ->setDescription('Diagnoses the system to identify common errors')
  4383. ->setHelp(
  4384. <<<EOT
  4385. The <info>diagnose</info> command checks common errors to help debugging problems.
  4386. The process exit code will be 1 in case of warnings and 2 for errors.
  4387. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  4388. EOT
  4389. )
  4390. ;
  4391. }
  4392. protected function execute(InputInterface $input, OutputInterface $output): int
  4393. {
  4394. $composer = $this->tryComposer();
  4395. $io = $this->getIO();
  4396. if ($composer) {
  4397. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  4398. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4399. $io->write('Checking composer.json: ', false);
  4400. $this->outputResult($this->checkComposerSchema());
  4401. if ($composer->getLocker()->isLocked()) {
  4402. $io->write('Checking composer.lock: ', false);
  4403. $this->outputResult($this->checkComposerLockSchema($composer->getLocker()));
  4404. }
  4405. $this->process = $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io);
  4406. } else {
  4407. $this->process = new ProcessExecutor($io);
  4408. }
  4409. if ($composer) {
  4410. $config = $composer->getConfig();
  4411. } else {
  4412. $config = Factory::createConfig();
  4413. }
  4414. $config->merge(['config' => ['secure-http' => false]], Config::SOURCE_COMMAND);
  4415. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  4416. $this->httpDownloader = Factory::createHttpDownloader($io, $config);
  4417. $io->write('Checking platform settings: ', false);
  4418. $this->outputResult($this->checkPlatform());
  4419. $io->write('Checking git settings: ', false);
  4420. $this->outputResult($this->checkGit());
  4421. $io->write('Checking http connectivity to packagist: ', false);
  4422. $this->outputResult($this->checkHttp('http', $config));
  4423. $io->write('Checking https connectivity to packagist: ', false);
  4424. $this->outputResult($this->checkHttp('https', $config));
  4425. foreach ($config->getRepositories() as $repo) {
  4426. if (($repo['type'] ?? null) === 'composer' && isset($repo['url'])) {
  4427. $composerRepo = new ComposerRepository($repo, $this->getIO(), $config, $this->httpDownloader);
  4428. $reflMethod = new \ReflectionMethod($composerRepo, 'getPackagesJsonUrl');
  4429. if (PHP_VERSION_ID < 80100) {
  4430. $reflMethod->setAccessible(true);
  4431. }
  4432. $url = $reflMethod->invoke($composerRepo);
  4433. if (!str_starts_with($url, 'http')) {
  4434. continue;
  4435. }
  4436. if (str_starts_with($url, 'https://repo.packagist.org')) {
  4437. continue;
  4438. }
  4439. $io->write('Checking connectivity to ' . $repo['url'].': ', false);
  4440. $this->outputResult($this->checkComposerRepo($url, $config));
  4441. }
  4442. }
  4443. $proxyManager = ProxyManager::getInstance();
  4444. $protos = $config->get('disable-tls') === true ? ['http'] : ['http', 'https'];
  4445. try {
  4446. foreach ($protos as $proto) {
  4447. $proxy = $proxyManager->getProxyForRequest($proto.'://repo.packagist.org');
  4448. if ($proxy->getStatus() !== '') {
  4449. $type = $proxy->isSecure() ? 'HTTPS' : 'HTTP';
  4450. $io->write('Checking '.$type.' proxy with '.$proto.': ', false);
  4451. $this->outputResult($this->checkHttpProxy($proxy, $proto));
  4452. }
  4453. }
  4454. } catch (TransportException $e) {
  4455. $io->write('Checking HTTP proxy: ', false);
  4456. $status = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4457. $this->outputResult(is_string($status) ? $status : $e);
  4458. }
  4459. if (count($oauth = $config->get('github-oauth')) > 0) {
  4460. foreach ($oauth as $domain => $token) {
  4461. $io->write('Checking '.$domain.' oauth access: ', false);
  4462. $this->outputResult($this->checkGithubOauth($domain, $token));
  4463. }
  4464. } else {
  4465. $io->write('Checking github.com rate limit: ', false);
  4466. try {
  4467. $rate = $this->getGithubRateLimit('github.com');
  4468. if (!is_array($rate)) {
  4469. $this->outputResult($rate);
  4470. } elseif (10 > $rate['remaining']) {
  4471. $io->write('<warning>WARNING</warning>');
  4472. $io->write(sprintf(
  4473. '<comment>GitHub has a rate limit on their API. '
  4474. . 'You currently have <options=bold>%u</options=bold> '
  4475. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  4476. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  4477. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  4478. $rate['remaining'],
  4479. $rate['limit']
  4480. ));
  4481. } else {
  4482. $this->outputResult(true);
  4483. }
  4484. } catch (\Exception $e) {
  4485. if ($e instanceof TransportException && $e->getCode() === 401) {
  4486. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  4487. } else {
  4488. $this->outputResult($e);
  4489. }
  4490. }
  4491. }
  4492. $io->write('Checking disk free space: ', false);
  4493. $this->outputResult($this->checkDiskSpace($config));
  4494. if (strpos(__FILE__, 'phar:') === 0) {
  4495. $io->write('Checking pubkeys: ', false);
  4496. $this->outputResult($this->checkPubKeys($config));
  4497. $io->write('Checking Composer version: ', false);
  4498. $this->outputResult($this->checkVersion($config));
  4499. }
  4500. $io->write('Checking Composer and its dependencies for vulnerabilities: ', false);
  4501. $this->outputResult($this->checkComposerAudit($config));
  4502. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::getVersion()));
  4503. $platformOverrides = $config->get('platform') ?: [];
  4504. $platformRepo = new PlatformRepository([], $platformOverrides);
  4505. $phpPkg = $platformRepo->findPackage('php', '*');
  4506. $phpVersion = $phpPkg->getPrettyVersion();
  4507. if ($phpPkg instanceof CompletePackageInterface && str_contains((string) $phpPkg->getDescription(), 'overridden')) {
  4508. $phpVersion .= ' - ' . $phpPkg->getDescription();
  4509. }
  4510. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  4511. if (defined('PHP_BINARY')) {
  4512. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  4513. }
  4514. $io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? '<comment>'.OPENSSL_VERSION_TEXT.'</comment>' : '<error>missing</error>'));
  4515. $io->write('curl version: ' . $this->getCurlVersion());
  4516. $finder = new ExecutableFinder;
  4517. $hasSystemUnzip = (bool) $finder->find('unzip');
  4518. $bin7zip = '';
  4519. if ($hasSystem7zip = (bool) $finder->find('7z', null, ['C:\Program Files\7-Zip'])) {
  4520. $bin7zip = '7z';
  4521. }
  4522. if (!Platform::isWindows() && !$hasSystem7zip && $hasSystem7zip = (bool) $finder->find('7zz')) {
  4523. $bin7zip = '7zz';
  4524. }
  4525. $io->write(
  4526. 'zip: ' . (extension_loaded('zip') ? '<comment>extension present</comment>' : '<comment>extension not loaded</comment>')
  4527. . ', ' . ($hasSystemUnzip ? '<comment>unzip present</comment>' : '<comment>unzip not available</comment>')
  4528. . ', ' . ($hasSystem7zip ? '<comment>7-Zip present ('.$bin7zip.')</comment>' : '<comment>7-Zip not available</comment>')
  4529. . (($hasSystem7zip || $hasSystemUnzip) && !function_exists('proc_open') ? ', <warning>proc_open is disabled or not present, unzip/7-z will not be usable</warning>' : '')
  4530. );
  4531. return $this->exitCode;
  4532. }
  4533. private function checkComposerSchema()
  4534. {
  4535. $validator = new ConfigValidator($this->getIO());
  4536. [$errors, , $warnings] = $validator->validate(Factory::getComposerFile());
  4537. if ($errors || $warnings) {
  4538. $messages = [
  4539. 'error' => $errors,
  4540. 'warning' => $warnings,
  4541. ];
  4542. $output = '';
  4543. foreach ($messages as $style => $msgs) {
  4544. foreach ($msgs as $msg) {
  4545. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  4546. }
  4547. }
  4548. return rtrim($output);
  4549. }
  4550. return true;
  4551. }
  4552. private function checkComposerLockSchema(Locker $locker)
  4553. {
  4554. $json = $locker->getJsonFile();
  4555. try {
  4556. $json->validateSchema(JsonFile::LOCK_SCHEMA);
  4557. } catch (JsonValidationException $e) {
  4558. $output = '';
  4559. foreach ($e->getErrors() as $error) {
  4560. $output .= '<error>'.$error.'</error>'.PHP_EOL;
  4561. }
  4562. return trim($output);
  4563. }
  4564. return true;
  4565. }
  4566. private function checkGit(): string
  4567. {
  4568. if (!function_exists('proc_open')) {
  4569. return '<comment>proc_open is not available, git cannot be used</comment>';
  4570. }
  4571. $this->process->execute(['git', 'config', 'color.ui'], $output);
  4572. if (strtolower(trim($output)) === 'always') {
  4573. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  4574. }
  4575. $gitVersion = Git::getVersion($this->process);
  4576. if (null === $gitVersion) {
  4577. return '<comment>No git process found</>';
  4578. }
  4579. if (version_compare('2.24.0', $gitVersion, '>')) {
  4580. return '<warning>Your git version ('.$gitVersion.') is too old and possibly will cause issues. Please upgrade to git 2.24 or above</>';
  4581. }
  4582. return '<info>OK</> <comment>git version '.$gitVersion.'</>';
  4583. }
  4584. private function checkHttp(string $proto, Config $config)
  4585. {
  4586. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4587. if ($result !== true) {
  4588. return $result;
  4589. }
  4590. $result = [];
  4591. if ($proto === 'https' && $config->get('disable-tls') === true) {
  4592. $tlsWarning = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  4593. }
  4594. try {
  4595. $this->httpDownloader->get($proto . '://repo.packagist.org/packages.json');
  4596. } catch (TransportException $e) {
  4597. $hints = HttpDownloader::getExceptionHints($e);
  4598. if (null !== $hints && count($hints) > 0) {
  4599. foreach ($hints as $hint) {
  4600. $result[] = $hint;
  4601. }
  4602. }
  4603. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  4604. }
  4605. if (isset($tlsWarning)) {
  4606. $result[] = $tlsWarning;
  4607. }
  4608. if (count($result) > 0) {
  4609. return $result;
  4610. }
  4611. return true;
  4612. }
  4613. private function checkComposerRepo(string $url, Config $config)
  4614. {
  4615. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4616. if ($result !== true) {
  4617. return $result;
  4618. }
  4619. $result = [];
  4620. if (str_starts_with($url, 'https://') && $config->get('disable-tls') === true) {
  4621. $tlsWarning = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  4622. }
  4623. try {
  4624. $this->httpDownloader->get($url);
  4625. } catch (TransportException $e) {
  4626. $hints = HttpDownloader::getExceptionHints($e);
  4627. if (null !== $hints && count($hints) > 0) {
  4628. foreach ($hints as $hint) {
  4629. $result[] = $hint;
  4630. }
  4631. }
  4632. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  4633. }
  4634. if (isset($tlsWarning)) {
  4635. $result[] = $tlsWarning;
  4636. }
  4637. if (count($result) > 0) {
  4638. return $result;
  4639. }
  4640. return true;
  4641. }
  4642. private function checkHttpProxy(RequestProxy $proxy, string $protocol)
  4643. {
  4644. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4645. if ($result !== true) {
  4646. return $result;
  4647. }
  4648. try {
  4649. $proxyStatus = $proxy->getStatus();
  4650. if ($proxy->isExcludedByNoProxy()) {
  4651. return '<info>SKIP</> <comment>Because repo.packagist.org is '.$proxyStatus.'</>';
  4652. }
  4653. $json = $this->httpDownloader->get($protocol.'://repo.packagist.org/packages.json')->decodeJson();
  4654. if (isset($json['provider-includes'])) {
  4655. $hash = reset($json['provider-includes']);
  4656. $hash = $hash['sha256'];
  4657. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  4658. $provider = $this->httpDownloader->get($protocol.'://repo.packagist.org/'.$path)->getBody();
  4659. if (hash('sha256', $provider) !== $hash) {
  4660. return '<warning>It seems that your proxy ('.$proxyStatus.') is modifying '.$protocol.' traffic on the fly</>';
  4661. }
  4662. }
  4663. return '<info>OK</> <comment>'.$proxyStatus.'</>';
  4664. } catch (\Exception $e) {
  4665. return $e;
  4666. }
  4667. }
  4668. private function checkGithubOauth(string $domain, string $token)
  4669. {
  4670. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4671. if ($result !== true) {
  4672. return $result;
  4673. }
  4674. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  4675. try {
  4676. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  4677. $response = $this->httpDownloader->get($url, [
  4678. 'retry-auth-failure' => false,
  4679. ]);
  4680. $expiration = $response->getHeader('github-authentication-token-expiration');
  4681. if ($expiration === null) {
  4682. return '<info>OK</> <comment>does not expire</>';
  4683. }
  4684. return '<info>OK</> <comment>expires on '. $expiration .'</>';
  4685. } catch (\Exception $e) {
  4686. if ($e instanceof TransportException && $e->getCode() === 401) {
  4687. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  4688. }
  4689. return $e;
  4690. }
  4691. }
  4692. private function getGithubRateLimit(string $domain, ?string $token = null)
  4693. {
  4694. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4695. if ($result !== true) {
  4696. return $result;
  4697. }
  4698. if ($token) {
  4699. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  4700. }
  4701. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  4702. $data = $this->httpDownloader->get($url, ['retry-auth-failure' => false])->decodeJson();
  4703. return $data['resources']['core'];
  4704. }
  4705. private function checkDiskSpace(Config $config)
  4706. {
  4707. if (!function_exists('disk_free_space')) {
  4708. return true;
  4709. }
  4710. $minSpaceFree = 1024 * 1024;
  4711. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  4712. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  4713. ) {
  4714. return '<error>The disk hosting '.$dir.' is full</error>';
  4715. }
  4716. return true;
  4717. }
  4718. private function checkPubKeys(Config $config)
  4719. {
  4720. $home = $config->get('home');
  4721. $errors = [];
  4722. $io = $this->getIO();
  4723. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  4724. $io->write('');
  4725. }
  4726. if (file_exists($home.'/keys.tags.pub')) {
  4727. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  4728. } else {
  4729. $errors[] = '<error>Missing pubkey for tags verification</error>';
  4730. }
  4731. if (file_exists($home.'/keys.dev.pub')) {
  4732. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  4733. } else {
  4734. $errors[] = '<error>Missing pubkey for dev verification</error>';
  4735. }
  4736. if ($errors) {
  4737. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  4738. }
  4739. return $errors ?: true;
  4740. }
  4741. private function checkVersion(Config $config)
  4742. {
  4743. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4744. if ($result !== true) {
  4745. return $result;
  4746. }
  4747. $versionsUtil = new Versions($config, $this->httpDownloader);
  4748. try {
  4749. $latest = $versionsUtil->getLatest();
  4750. } catch (\Exception $e) {
  4751. return $e;
  4752. }
  4753. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  4754. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  4755. }
  4756. return true;
  4757. }
  4758. private function checkComposerAudit(Config $config)
  4759. {
  4760. $result = $this->checkConnectivityAndComposerNetworkHttpEnablement();
  4761. if ($result !== true) {
  4762. return $result;
  4763. }
  4764. $auditor = new Auditor();
  4765. $repoSet = new RepositorySet();
  4766. $installedJson = new JsonFile(__DIR__ . '/../../../vendor/composer/installed.json');
  4767. if (!$installedJson->exists()) {
  4768. return '<warning>Could not find Composer\'s installed.json, this must be a non-standard Composer installation.</>';
  4769. }
  4770. $localRepo = new FilesystemRepository($installedJson);
  4771. $version = Composer::getVersion();
  4772. $packages = $localRepo->getCanonicalPackages();
  4773. if ($version !== '@package_version@') {
  4774. $versionParser = new VersionParser();
  4775. $normalizedVersion = $versionParser->normalize($version);
  4776. $rootPkg = new RootPackage('composer/composer', $normalizedVersion, $version);
  4777. $packages[] = $rootPkg;
  4778. }
  4779. $repoSet->addRepository(new ComposerRepository(['type' => 'composer', 'url' => 'https://packagist.org'], new NullIO(), $config, $this->httpDownloader));
  4780. try {
  4781. $io = new BufferIO();
  4782. $result = $auditor->audit($io, $repoSet, $packages, Auditor::FORMAT_TABLE, true, [], Auditor::ABANDONED_IGNORE);
  4783. } catch (\Throwable $e) {
  4784. return '<warning>Failed performing audit: '.$e->getMessage().'</>';
  4785. }
  4786. if ($result > 0) {
  4787. return '<error>Audit found some issues:</>' . PHP_EOL . $io->getOutput();
  4788. }
  4789. return true;
  4790. }
  4791. private function getCurlVersion(): string
  4792. {
  4793. if (extension_loaded('curl')) {
  4794. if (!HttpDownloader::isCurlEnabled()) {
  4795. return '<error>disabled via disable_functions, using php streams fallback, which reduces performance</error>';
  4796. }
  4797. $version = curl_version();
  4798. return '<comment>'.$version['version'].'</comment> '.
  4799. 'libz <comment>'.(!empty($version['libz_version']) ? $version['libz_version'] : 'missing').'</comment> '.
  4800. 'ssl <comment>'.($version['ssl_version'] ?? 'missing').'</comment>';
  4801. }
  4802. return '<error>missing, using php streams fallback, which reduces performance</error>';
  4803. }
  4804. private function outputResult($result): void
  4805. {
  4806. $io = $this->getIO();
  4807. if (true === $result) {
  4808. $io->write('<info>OK</info>');
  4809. return;
  4810. }
  4811. $hadError = false;
  4812. $hadWarning = false;
  4813. if ($result instanceof \Exception) {
  4814. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  4815. }
  4816. if (!$result) {
  4817. $hadError = true;
  4818. } else {
  4819. if (!is_array($result)) {
  4820. $result = [$result];
  4821. }
  4822. foreach ($result as $message) {
  4823. if (false !== strpos($message, '<error>')) {
  4824. $hadError = true;
  4825. } elseif (false !== strpos($message, '<warning>')) {
  4826. $hadWarning = true;
  4827. }
  4828. }
  4829. }
  4830. if ($hadError) {
  4831. $io->write('<error>FAIL</error>');
  4832. $this->exitCode = max($this->exitCode, 2);
  4833. } elseif ($hadWarning) {
  4834. $io->write('<warning>WARNING</warning>');
  4835. $this->exitCode = max($this->exitCode, 1);
  4836. }
  4837. if ($result) {
  4838. foreach ($result as $message) {
  4839. $io->write(trim($message));
  4840. }
  4841. }
  4842. }
  4843. private function checkPlatform()
  4844. {
  4845. $output = '';
  4846. $out = static function ($msg, $style) use (&$output): void {
  4847. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  4848. };
  4849. $errors = [];
  4850. $warnings = [];
  4851. $displayIniMessage = false;
  4852. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  4853. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  4854. if (!function_exists('json_decode')) {
  4855. $errors['json'] = true;
  4856. }
  4857. if (!extension_loaded('Phar')) {
  4858. $errors['phar'] = true;
  4859. }
  4860. if (!extension_loaded('filter')) {
  4861. $errors['filter'] = true;
  4862. }
  4863. if (!extension_loaded('hash')) {
  4864. $errors['hash'] = true;
  4865. }
  4866. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  4867. $errors['iconv_mbstring'] = true;
  4868. }
  4869. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  4870. $errors['allow_url_fopen'] = true;
  4871. }
  4872. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  4873. $errors['ioncube'] = ioncube_loader_version();
  4874. }
  4875. if (\PHP_VERSION_ID < 70205) {
  4876. $errors['php'] = PHP_VERSION;
  4877. }
  4878. if (!extension_loaded('openssl')) {
  4879. $errors['openssl'] = true;
  4880. }
  4881. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  4882. $warnings['openssl_version'] = true;
  4883. }
  4884. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  4885. $warnings['apc_cli'] = true;
  4886. }
  4887. if (!extension_loaded('zlib')) {
  4888. $warnings['zlib'] = true;
  4889. }
  4890. ob_start();
  4891. phpinfo(INFO_GENERAL);
  4892. $phpinfo = ob_get_clean();
  4893. if (is_string($phpinfo) && Preg::isMatchStrictGroups('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  4894. $configure = $match[1];
  4895. if (str_contains($configure, '--enable-sigchild')) {
  4896. $warnings['sigchild'] = true;
  4897. }
  4898. if (str_contains($configure, '--with-curlwrappers')) {
  4899. $warnings['curlwrappers'] = true;
  4900. }
  4901. }
  4902. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  4903. $warnings['xdebug_profile'] = true;
  4904. } elseif (XdebugHandler::isXdebugActive()) {
  4905. $warnings['xdebug_loaded'] = true;
  4906. }
  4907. if (defined('PHP_WINDOWS_VERSION_BUILD')
  4908. && (version_compare(PHP_VERSION, '7.2.23', '<')
  4909. || (version_compare(PHP_VERSION, '7.3.0', '>=')
  4910. && version_compare(PHP_VERSION, '7.3.10', '<')))) {
  4911. $warnings['onedrive'] = PHP_VERSION;
  4912. }
  4913. if (extension_loaded('uopz')
  4914. && !(filter_var(ini_get('uopz.disable'), FILTER_VALIDATE_BOOLEAN)
  4915. || filter_var(ini_get('uopz.exit'), FILTER_VALIDATE_BOOLEAN))) {
  4916. $warnings['uopz'] = true;
  4917. }
  4918. if (!empty($errors)) {
  4919. foreach ($errors as $error => $current) {
  4920. switch ($error) {
  4921. case 'json':
  4922. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  4923. $text .= "Install it or recompile php without --disable-json";
  4924. break;
  4925. case 'phar':
  4926. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  4927. $text .= "Install it or recompile php without --disable-phar";
  4928. break;
  4929. case 'filter':
  4930. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  4931. $text .= "Install it or recompile php without --disable-filter";
  4932. break;
  4933. case 'hash':
  4934. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  4935. $text .= "Install it or recompile php without --disable-hash";
  4936. break;
  4937. case 'iconv_mbstring':
  4938. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  4939. $text .= "Install either of them or recompile php without --disable-iconv";
  4940. break;
  4941. case 'php':
  4942. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 7.2.5 or higher.";
  4943. break;
  4944. case 'allow_url_fopen':
  4945. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  4946. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  4947. $text .= " allow_url_fopen = On";
  4948. $displayIniMessage = true;
  4949. break;
  4950. case 'ioncube':
  4951. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  4952. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  4953. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  4954. $displayIniMessage = true;
  4955. break;
  4956. case 'openssl':
  4957. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  4958. $text .= "If possible you should enable it or recompile php with --with-openssl";
  4959. break;
  4960. default:
  4961. throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown error type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $error));
  4962. }
  4963. $out($text, 'error');
  4964. }
  4965. $output .= PHP_EOL;
  4966. }
  4967. if (!empty($warnings)) {
  4968. foreach ($warnings as $warning => $current) {
  4969. switch ($warning) {
  4970. case 'apc_cli':
  4971. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  4972. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  4973. $text .= " apc.enable_cli = Off";
  4974. $displayIniMessage = true;
  4975. break;
  4976. case 'zlib':
  4977. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  4978. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  4979. $displayIniMessage = true;
  4980. break;
  4981. case 'sigchild':
  4982. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  4983. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  4984. $text .= " https://bugs.php.net/bug.php?id=22999";
  4985. break;
  4986. case 'curlwrappers':
  4987. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  4988. $text .= " Recompile it without this flag if possible";
  4989. break;
  4990. case 'openssl_version':
  4991. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  4992. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  4993. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  4994. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  4995. break;
  4996. case 'xdebug_loaded':
  4997. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  4998. $text .= " Disabling it when using Composer is recommended.";
  4999. break;
  5000. case 'xdebug_profile':
  5001. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  5002. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  5003. $text .= " xdebug.profiler_enabled = 0";
  5004. $displayIniMessage = true;
  5005. break;
  5006. case 'onedrive':
  5007. $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
  5008. $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
  5009. break;
  5010. case 'uopz':
  5011. $text = "The uopz extension ignores exit calls and may not work with all Composer commands.".PHP_EOL;
  5012. $text .= "Disabling it when using Composer is recommended.";
  5013. break;
  5014. default:
  5015. throw new \InvalidArgumentException(sprintf("DiagnoseCommand: Unknown warning type \"%s\". Please report at https://github.com/composer/composer/issues/new.", $warning));
  5016. }
  5017. $out($text, 'comment');
  5018. }
  5019. }
  5020. if ($displayIniMessage) {
  5021. $out($iniMessage, 'comment');
  5022. }
  5023. if (in_array(Platform::getEnv('COMPOSER_IPRESOLVE'), ['4', '6'], true)) {
  5024. $warnings['ipresolve'] = true;
  5025. $out('The COMPOSER_IPRESOLVE env var is set to ' . Platform::getEnv('COMPOSER_IPRESOLVE') .' which may result in network failures below.', 'comment');
  5026. }
  5027. return count($warnings) === 0 && count($errors) === 0 ? true : $output;
  5028. }
  5029. private function checkConnectivity()
  5030. {
  5031. if (!ini_get('allow_url_fopen')) {
  5032. return '<info>SKIP</> <comment>Because allow_url_fopen is missing.</>';
  5033. }
  5034. return true;
  5035. }
  5036. private function checkConnectivityAndComposerNetworkHttpEnablement()
  5037. {
  5038. $result = $this->checkConnectivity();
  5039. if ($result !== true) {
  5040. return $result;
  5041. }
  5042. $result = $this->checkComposerNetworkHttpEnablement();
  5043. if ($result !== true) {
  5044. return $result;
  5045. }
  5046. return true;
  5047. }
  5048. private function checkComposerNetworkHttpEnablement()
  5049. {
  5050. if ((bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  5051. return '<info>SKIP</> <comment>Network is disabled by COMPOSER_DISABLE_NETWORK.</>';
  5052. }
  5053. return true;
  5054. }
  5055. }
  5056. <?php declare(strict_types=1);
  5057. namespace Composer\Command;
  5058. use Composer\Package\AliasPackage;
  5059. use Composer\Plugin\CommandEvent;
  5060. use Composer\Plugin\PluginEvents;
  5061. use Symfony\Component\Console\Input\InputInterface;
  5062. use Symfony\Component\Console\Input\InputOption;
  5063. use Symfony\Component\Console\Output\OutputInterface;
  5064. class DumpAutoloadCommand extends BaseCommand
  5065. {
  5066. protected function configure()
  5067. {
  5068. $this
  5069. ->setName('dump-autoload')
  5070. ->setAliases(['dumpautoload'])
  5071. ->setDescription('Dumps the autoloader')
  5072. ->setDefinition([
  5073. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  5074. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  5075. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5076. new InputOption('apcu-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu'),
  5077. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything.'),
  5078. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables autoload-dev rules. Composer will by default infer this automatically according to the last install or update --no-dev state.'),
  5079. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules. Composer will by default infer this automatically according to the last install or update --no-dev state.'),
  5080. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  5081. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  5082. new InputOption('strict-psr', null, InputOption::VALUE_NONE, 'Return a failed status code (1) if PSR-4 or PSR-0 mapping errors are present. Requires --optimize to work.'),
  5083. new InputOption('strict-ambiguous', null, InputOption::VALUE_NONE, 'Return a failed status code (2) if the same class is found in multiple files. Requires --optimize to work.'),
  5084. ])
  5085. ->setHelp(
  5086. <<<EOT
  5087. <info>php composer.phar dump-autoload</info>
  5088. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload
  5089. EOT
  5090. )
  5091. ;
  5092. }
  5093. protected function execute(InputInterface $input, OutputInterface $output): int
  5094. {
  5095. $composer = $this->requireComposer();
  5096. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  5097. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5098. $installationManager = $composer->getInstallationManager();
  5099. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5100. $package = $composer->getPackage();
  5101. $config = $composer->getConfig();
  5102. $missingDependencies = false;
  5103. foreach ($localRepo->getCanonicalPackages() as $localPkg) {
  5104. $installPath = $installationManager->getInstallPath($localPkg);
  5105. if ($installPath !== null && file_exists($installPath) === false) {
  5106. $missingDependencies = true;
  5107. $this->getIO()->write('<warning>Not all dependencies are installed. Make sure to run a "composer install" to install missing dependencies</warning>');
  5108. break;
  5109. }
  5110. }
  5111. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  5112. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5113. $apcuPrefix = $input->getOption('apcu-prefix');
  5114. $apcu = $apcuPrefix !== null || $input->getOption('apcu') || $config->get('apcu-autoloader');
  5115. if ($input->getOption('strict-psr') && !$optimize && !$authoritative) {
  5116. throw new \InvalidArgumentException('--strict-psr mode only works with optimized autoloader, use --optimize or --classmap-authoritative if you want a strict return value.');
  5117. }
  5118. if ($input->getOption('strict-ambiguous') && !$optimize && !$authoritative) {
  5119. throw new \InvalidArgumentException('--strict-ambiguous mode only works with optimized autoloader, use --optimize or --classmap-authoritative if you want a strict return value.');
  5120. }
  5121. if ($authoritative) {
  5122. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  5123. } elseif ($optimize) {
  5124. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  5125. } else {
  5126. $this->getIO()->write('<info>Generating autoload files</info>');
  5127. }
  5128. $generator = $composer->getAutoloadGenerator();
  5129. if ($input->getOption('dry-run')) {
  5130. $generator->setDryRun(true);
  5131. }
  5132. if ($input->getOption('no-dev')) {
  5133. $generator->setDevMode(false);
  5134. }
  5135. if ($input->getOption('dev')) {
  5136. if ($input->getOption('no-dev')) {
  5137. throw new \InvalidArgumentException('You can not use both --no-dev and --dev as they conflict with each other.');
  5138. }
  5139. $generator->setDevMode(true);
  5140. }
  5141. $generator->setClassMapAuthoritative($authoritative);
  5142. $generator->setRunScripts(true);
  5143. $generator->setApcu($apcu, $apcuPrefix);
  5144. $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
  5145. $classMap = $generator->dump(
  5146. $config,
  5147. $localRepo,
  5148. $package,
  5149. $installationManager,
  5150. 'composer',
  5151. $optimize,
  5152. null,
  5153. $composer->getLocker(),
  5154. $input->getOption('strict-ambiguous')
  5155. );
  5156. $numberOfClasses = count($classMap);
  5157. if ($authoritative) {
  5158. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  5159. } elseif ($optimize) {
  5160. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  5161. } else {
  5162. $this->getIO()->write('<info>Generated autoload files</info>');
  5163. }
  5164. if ($missingDependencies || ($input->getOption('strict-psr') && count($classMap->getPsrViolations()) > 0)) {
  5165. return 1;
  5166. }
  5167. if ($input->getOption('strict-ambiguous') && count($classMap->getAmbiguousClasses(false)) > 0) {
  5168. return 2;
  5169. }
  5170. return 0;
  5171. }
  5172. }
  5173. <?php declare(strict_types=1);
  5174. namespace Composer\Command;
  5175. use Symfony\Component\Console\Input\InputInterface;
  5176. use Composer\Console\Input\InputOption;
  5177. use Symfony\Component\Console\Output\OutputInterface;
  5178. use Composer\Console\Input\InputArgument;
  5179. class ExecCommand extends BaseCommand
  5180. {
  5181. protected function configure()
  5182. {
  5183. $this
  5184. ->setName('exec')
  5185. ->setDescription('Executes a vendored binary/script')
  5186. ->setDefinition([
  5187. new InputOption('list', 'l', InputOption::VALUE_NONE),
  5188. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit', null, function () {
  5189. return $this->getBinaries(false);
  5190. }),
  5191. new InputArgument(
  5192. 'args',
  5193. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  5194. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  5195. ),
  5196. ])
  5197. ->setHelp(
  5198. <<<EOT
  5199. Executes a vendored binary/script.
  5200. Read more at https://getcomposer.org/doc/03-cli.md#exec
  5201. EOT
  5202. )
  5203. ;
  5204. }
  5205. protected function interact(InputInterface $input, OutputInterface $output): void
  5206. {
  5207. $binaries = $this->getBinaries(false);
  5208. if (count($binaries) === 0) {
  5209. return;
  5210. }
  5211. if ($input->getArgument('binary') !== null || $input->getOption('list')) {
  5212. return;
  5213. }
  5214. $io = $this->getIO();
  5215. $binary = $io->select(
  5216. 'Binary to run: ',
  5217. $binaries,
  5218. '',
  5219. 1,
  5220. 'Invalid binary name "%s"'
  5221. );
  5222. $input->setArgument('binary', $binaries[$binary]);
  5223. }
  5224. protected function execute(InputInterface $input, OutputInterface $output): int
  5225. {
  5226. $composer = $this->requireComposer();
  5227. if ($input->getOption('list') || null === $input->getArgument('binary')) {
  5228. $bins = $this->getBinaries(true);
  5229. if ([] === $bins) {
  5230. $binDir = $composer->getConfig()->get('bin-dir');
  5231. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  5232. }
  5233. $this->getIO()->write(
  5234. <<<EOT
  5235. <comment>Available binaries:</comment>
  5236. EOT
  5237. );
  5238. foreach ($bins as $bin) {
  5239. $this->getIO()->write(
  5240. <<<EOT
  5241. <info>- $bin</info>
  5242. EOT
  5243. );
  5244. }
  5245. return 0;
  5246. }
  5247. $binary = $input->getArgument('binary');
  5248. $dispatcher = $composer->getEventDispatcher();
  5249. $dispatcher->addListener('__exec_command', $binary);
  5250. if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory() && $this->getApplication()->getInitialWorkingDirectory() !== false) {
  5251. try {
  5252. chdir($this->getApplication()->getInitialWorkingDirectory());
  5253. } catch (\Exception $e) {
  5254. throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
  5255. }
  5256. }
  5257. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  5258. }
  5259. private function getBinaries(bool $forDisplay): array
  5260. {
  5261. $composer = $this->requireComposer();
  5262. $binDir = $composer->getConfig()->get('bin-dir');
  5263. $bins = glob($binDir . '/*');
  5264. $localBins = $composer->getPackage()->getBinaries();
  5265. if ($forDisplay) {
  5266. $localBins = array_map(static function ($e) {
  5267. return "$e (local)";
  5268. }, $localBins);
  5269. }
  5270. $binaries = [];
  5271. foreach (array_merge($bins, $localBins) as $bin) {
  5272. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  5273. continue;
  5274. }
  5275. $previousBin = $bin;
  5276. $binaries[] = basename($bin);
  5277. }
  5278. return $binaries;
  5279. }
  5280. }
  5281. <?php declare(strict_types=1);
  5282. namespace Composer\Command;
  5283. use Composer\Json\JsonFile;
  5284. use Composer\Package\AliasPackage;
  5285. use Composer\Package\BasePackage;
  5286. use Composer\Package\CompletePackageInterface;
  5287. use Composer\Pcre\Preg;
  5288. use Composer\Repository\CompositeRepository;
  5289. use Composer\Semver\Constraint\MatchAllConstraint;
  5290. use Symfony\Component\Console\Formatter\OutputFormatter;
  5291. use Symfony\Component\Console\Input\InputInterface;
  5292. use Composer\Console\Input\InputOption;
  5293. use Symfony\Component\Console\Output\OutputInterface;
  5294. class FundCommand extends BaseCommand
  5295. {
  5296. protected function configure(): void
  5297. {
  5298. $this->setName('fund')
  5299. ->setDescription('Discover how to help fund the maintenance of your dependencies')
  5300. ->setDefinition([
  5301. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['text', 'json']),
  5302. ])
  5303. ;
  5304. }
  5305. protected function execute(InputInterface $input, OutputInterface $output): int
  5306. {
  5307. $composer = $this->requireComposer();
  5308. $repo = $composer->getRepositoryManager()->getLocalRepository();
  5309. $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5310. $fundings = [];
  5311. $packagesToLoad = [];
  5312. foreach ($repo->getPackages() as $package) {
  5313. if ($package instanceof AliasPackage) {
  5314. continue;
  5315. }
  5316. $packagesToLoad[$package->getName()] = new MatchAllConstraint();
  5317. }
  5318. $result = $remoteRepos->loadPackages($packagesToLoad, ['dev' => BasePackage::STABILITY_DEV], []);
  5319. foreach ($result['packages'] as $package) {
  5320. if (
  5321. !$package instanceof AliasPackage
  5322. && $package instanceof CompletePackageInterface
  5323. && $package->isDefaultBranch()
  5324. && $package->getFunding()
  5325. && isset($packagesToLoad[$package->getName()])
  5326. ) {
  5327. $fundings = $this->insertFundingData($fundings, $package);
  5328. unset($packagesToLoad[$package->getName()]);
  5329. }
  5330. }
  5331. foreach ($repo->getPackages() as $package) {
  5332. if ($package instanceof AliasPackage || !isset($packagesToLoad[$package->getName()])) {
  5333. continue;
  5334. }
  5335. if ($package instanceof CompletePackageInterface && $package->getFunding()) {
  5336. $fundings = $this->insertFundingData($fundings, $package);
  5337. }
  5338. }
  5339. ksort($fundings);
  5340. $io = $this->getIO();
  5341. $format = $input->getOption('format');
  5342. if (!in_array($format, ['text', 'json'])) {
  5343. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5344. return 1;
  5345. }
  5346. if ($fundings && $format === 'text') {
  5347. $prev = null;
  5348. $io->write('The following packages were found in your dependencies which publish funding information:');
  5349. foreach ($fundings as $vendor => $links) {
  5350. $io->write('');
  5351. $io->write(sprintf("<comment>%s</comment>", $vendor));
  5352. foreach ($links as $url => $packages) {
  5353. $line = sprintf(' <info>%s</info>', implode(', ', $packages));
  5354. if ($prev !== $line) {
  5355. $io->write($line);
  5356. $prev = $line;
  5357. }
  5358. $io->write(sprintf(' <href=%s>%s</>', OutputFormatter::escape($url), $url));
  5359. }
  5360. }
  5361. $io->write("");
  5362. $io->write("Please consider following these links and sponsoring the work of package authors!");
  5363. $io->write("Thank you!");
  5364. } elseif ($format === 'json') {
  5365. $io->write(JsonFile::encode($fundings));
  5366. } else {
  5367. $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
  5368. }
  5369. return 0;
  5370. }
  5371. private function insertFundingData(array $fundings, CompletePackageInterface $package): array
  5372. {
  5373. foreach ($package->getFunding() as $fundingOption) {
  5374. [$vendor, $packageName] = explode('/', $package->getPrettyName());
  5375. if (empty($fundingOption['url'])) {
  5376. continue;
  5377. }
  5378. $url = $fundingOption['url'];
  5379. if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && Preg::isMatch('{^https://github.com/([^/]+)$}', $url, $match)) {
  5380. $url = 'https://github.com/sponsors/'.$match[1];
  5381. }
  5382. $fundings[$vendor][$url][] = $packageName;
  5383. }
  5384. return $fundings;
  5385. }
  5386. }
  5387. <?php declare(strict_types=1);
  5388. namespace Composer\Command;
  5389. use Composer\Factory;
  5390. use Composer\Pcre\Preg;
  5391. use Composer\Util\Filesystem;
  5392. use Composer\Util\Platform;
  5393. use Symfony\Component\Console\Command\Command;
  5394. use Symfony\Component\Console\Completion\CompletionInput;
  5395. use Symfony\Component\Console\Completion\CompletionSuggestions;
  5396. use Symfony\Component\Console\Input\InputInterface;
  5397. use Composer\Console\Input\InputArgument;
  5398. use Symfony\Component\Console\Input\StringInput;
  5399. use Symfony\Component\Console\Output\OutputInterface;
  5400. class GlobalCommand extends BaseCommand
  5401. {
  5402. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  5403. {
  5404. $application = $this->getApplication();
  5405. if ($input->mustSuggestArgumentValuesFor('command-name')) {
  5406. $suggestions->suggestValues(array_values(array_filter(
  5407. array_map(static function (Command $command) {
  5408. return $command->isHidden() ? null : $command->getName();
  5409. }, $application->all()), function (?string $cmd) {
  5410. return $cmd !== null;
  5411. }
  5412. )));
  5413. return;
  5414. }
  5415. if ($application->has($commandName = $input->getArgument('command-name'))) {
  5416. $input = $this->prepareSubcommandInput($input, true);
  5417. $input = CompletionInput::fromString($input->__toString(), 2);
  5418. $command = $application->find($commandName);
  5419. $command->mergeApplicationDefinition();
  5420. $input->bind($command->getDefinition());
  5421. $command->complete($input, $suggestions);
  5422. }
  5423. }
  5424. protected function configure(): void
  5425. {
  5426. $this
  5427. ->setName('global')
  5428. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME)')
  5429. ->setDefinition([
  5430. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  5431. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5432. ])
  5433. ->setHelp(
  5434. <<<EOT
  5435. Use this command as a wrapper to run other Composer commands
  5436. within the global context of COMPOSER_HOME.
  5437. You can use this to install CLI utilities globally, all you need
  5438. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  5439. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  5440. and /home/<user>/.composer on unix systems.
  5441. If your system uses freedesktop.org standards, then it will first check
  5442. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  5443. Note: This path may vary depending on customizations to bin-dir in
  5444. composer.json or the environmental variable COMPOSER_BIN_DIR.
  5445. Read more at https://getcomposer.org/doc/03-cli.md#global
  5446. EOT
  5447. )
  5448. ;
  5449. }
  5450. public function run(InputInterface $input, OutputInterface $output): int
  5451. {
  5452. if (!method_exists($input, '__toString')) {
  5453. throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
  5454. }
  5455. $tokens = Preg::split('{\s+}', $input->__toString());
  5456. $args = [];
  5457. foreach ($tokens as $token) {
  5458. if ($token && $token[0] !== '-') {
  5459. $args[] = $token;
  5460. if (count($args) >= 2) {
  5461. break;
  5462. }
  5463. }
  5464. }
  5465. if (count($args) < 2) {
  5466. return parent::run($input, $output);
  5467. }
  5468. $input = $this->prepareSubcommandInput($input);
  5469. return $this->getApplication()->run($input, $output);
  5470. }
  5471. private function prepareSubcommandInput(InputInterface $input, bool $quiet = false): StringInput
  5472. {
  5473. if (!method_exists($input, '__toString')) {
  5474. throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
  5475. }
  5476. if (Platform::getEnv('COMPOSER')) {
  5477. Platform::clearEnv('COMPOSER');
  5478. }
  5479. $config = Factory::createConfig();
  5480. $home = $config->get('home');
  5481. if (!is_dir($home)) {
  5482. $fs = new Filesystem();
  5483. $fs->ensureDirectoryExists($home);
  5484. if (!is_dir($home)) {
  5485. throw new \RuntimeException('Could not create home directory');
  5486. }
  5487. }
  5488. try {
  5489. chdir($home);
  5490. } catch (\Exception $e) {
  5491. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  5492. }
  5493. if (!$quiet) {
  5494. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  5495. }
  5496. $input = new StringInput(Preg::replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  5497. $this->getApplication()->resetComposer();
  5498. return $input;
  5499. }
  5500. public function isProxyCommand(): bool
  5501. {
  5502. return true;
  5503. }
  5504. }
  5505. <?php declare(strict_types=1);
  5506. namespace Composer\Command;
  5507. use Composer\Package\CompletePackageInterface;
  5508. use Composer\Repository\RepositoryInterface;
  5509. use Composer\Repository\RootPackageRepository;
  5510. use Composer\Repository\RepositoryFactory;
  5511. use Composer\Util\Platform;
  5512. use Composer\Util\ProcessExecutor;
  5513. use Composer\Console\Input\InputArgument;
  5514. use Composer\Console\Input\InputOption;
  5515. use Symfony\Component\Console\Input\InputInterface;
  5516. use Symfony\Component\Console\Output\OutputInterface;
  5517. class HomeCommand extends BaseCommand
  5518. {
  5519. use CompletionTrait;
  5520. protected function configure(): void
  5521. {
  5522. $this
  5523. ->setName('browse')
  5524. ->setAliases(['home'])
  5525. ->setDescription('Opens the package\'s repository URL or homepage in your browser')
  5526. ->setDefinition([
  5527. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.', null, $this->suggestInstalledPackage()),
  5528. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  5529. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  5530. ])
  5531. ->setHelp(
  5532. <<<EOT
  5533. The home command opens or shows a package's repository URL or
  5534. homepage in your default browser.
  5535. To open the homepage by default, use -H or --homepage.
  5536. To show instead of open the repository or homepage URL, use -s or --show.
  5537. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  5538. EOT
  5539. );
  5540. }
  5541. protected function execute(InputInterface $input, OutputInterface $output): int
  5542. {
  5543. $repos = $this->initializeRepos();
  5544. $io = $this->getIO();
  5545. $return = 0;
  5546. $packages = $input->getArgument('packages');
  5547. if (count($packages) === 0) {
  5548. $io->writeError('No package specified, opening homepage for the root package');
  5549. $packages = [$this->requireComposer()->getPackage()->getName()];
  5550. }
  5551. foreach ($packages as $packageName) {
  5552. $handled = false;
  5553. $packageExists = false;
  5554. foreach ($repos as $repo) {
  5555. foreach ($repo->findPackages($packageName) as $package) {
  5556. $packageExists = true;
  5557. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  5558. $handled = true;
  5559. break 2;
  5560. }
  5561. }
  5562. }
  5563. if (!$packageExists) {
  5564. $return = 1;
  5565. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  5566. }
  5567. if (!$handled) {
  5568. $return = 1;
  5569. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  5570. }
  5571. }
  5572. return $return;
  5573. }
  5574. private function handlePackage(CompletePackageInterface $package, bool $showHomepage, bool $showOnly): bool
  5575. {
  5576. $support = $package->getSupport();
  5577. $url = $support['source'] ?? $package->getSourceUrl();
  5578. if (!$url || $showHomepage) {
  5579. $url = $package->getHomepage();
  5580. }
  5581. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  5582. return false;
  5583. }
  5584. if ($showOnly) {
  5585. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  5586. } else {
  5587. $this->openBrowser($url);
  5588. }
  5589. return true;
  5590. }
  5591. private function openBrowser(string $url): void
  5592. {
  5593. $process = new ProcessExecutor($this->getIO());
  5594. if (Platform::isWindows()) {
  5595. $process->execute(['start', '"web"', 'explorer', $url], $output);
  5596. return;
  5597. }
  5598. $linux = $process->execute(['which', 'xdg-open'], $output);
  5599. $osx = $process->execute(['which', 'open'], $output);
  5600. if (0 === $linux) {
  5601. $process->execute(['xdg-open', $url], $output);
  5602. } elseif (0 === $osx) {
  5603. $process->execute(['open', $url], $output);
  5604. } else {
  5605. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  5606. }
  5607. }
  5608. private function initializeRepos(): array
  5609. {
  5610. $composer = $this->tryComposer();
  5611. if ($composer) {
  5612. return array_merge(
  5613. [new RootPackageRepository(clone $composer->getPackage())],
  5614. [$composer->getRepositoryManager()->getLocalRepository()],
  5615. $composer->getRepositoryManager()->getRepositories()
  5616. );
  5617. }
  5618. return RepositoryFactory::defaultReposWithDefaultManager($this->getIO());
  5619. }
  5620. }
  5621. <?php declare(strict_types=1);
  5622. namespace Composer\Command;
  5623. use Composer\Factory;
  5624. use Composer\Json\JsonFile;
  5625. use Composer\Json\JsonValidationException;
  5626. use Composer\Package\BasePackage;
  5627. use Composer\Package\Package;
  5628. use Composer\Pcre\Preg;
  5629. use Composer\Repository\CompositeRepository;
  5630. use Composer\Repository\PlatformRepository;
  5631. use Composer\Repository\RepositoryFactory;
  5632. use Composer\Spdx\SpdxLicenses;
  5633. use Composer\Util\Filesystem;
  5634. use Composer\Util\Silencer;
  5635. use Symfony\Component\Console\Input\ArrayInput;
  5636. use Symfony\Component\Console\Input\InputInterface;
  5637. use Composer\Console\Input\InputOption;
  5638. use Composer\Util\ProcessExecutor;
  5639. use Symfony\Component\Console\Output\OutputInterface;
  5640. use Symfony\Component\Process\ExecutableFinder;
  5641. use Symfony\Component\Process\Process;
  5642. use Symfony\Component\Console\Helper\FormatterHelper;
  5643. class InitCommand extends BaseCommand
  5644. {
  5645. use CompletionTrait;
  5646. use PackageDiscoveryTrait;
  5647. private $gitConfig;
  5648. protected function configure()
  5649. {
  5650. $this
  5651. ->setName('init')
  5652. ->setDescription('Creates a basic composer.json file in current directory')
  5653. ->setDefinition([
  5654. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  5655. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  5656. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  5657. new InputOption('type', null, InputOption::VALUE_REQUIRED, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  5658. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  5659. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"', null, $this->suggestAvailablePackageInclPlatform()),
  5660. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"', null, $this->suggestAvailablePackageInclPlatform()),
  5661. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::STABILITIES)).')'),
  5662. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  5663. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  5664. new InputOption('autoload', 'a', InputOption::VALUE_REQUIRED, 'Add PSR-4 autoload mapping. Maps your package\'s namespace to the provided directory. (Expects a relative path, e.g. src/)'),
  5665. ])
  5666. ->setHelp(
  5667. <<<EOT
  5668. The <info>init</info> command creates a basic composer.json file
  5669. in the current directory.
  5670. <info>php composer.phar init</info>
  5671. Read more at https://getcomposer.org/doc/03-cli.md#init
  5672. EOT
  5673. )
  5674. ;
  5675. }
  5676. protected function execute(InputInterface $input, OutputInterface $output): int
  5677. {
  5678. $io = $this->getIO();
  5679. $allowlist = ['name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license', 'autoload'];
  5680. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowlist)), function ($val) { return $val !== null && $val !== []; });
  5681. if (isset($options['name']) && !Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $options['name'])) {
  5682. throw new \InvalidArgumentException(
  5683. 'The package name '.$options['name'].' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  5684. );
  5685. }
  5686. if (isset($options['author'])) {
  5687. $options['authors'] = $this->formatAuthors($options['author']);
  5688. unset($options['author']);
  5689. }
  5690. $repositories = $input->getOption('repository');
  5691. if (count($repositories) > 0) {
  5692. $config = Factory::createConfig($io);
  5693. foreach ($repositories as $repo) {
  5694. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo, true);
  5695. }
  5696. }
  5697. if (isset($options['stability'])) {
  5698. $options['minimum-stability'] = $options['stability'];
  5699. unset($options['stability']);
  5700. }
  5701. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  5702. if ([] === $options['require']) {
  5703. $options['require'] = new \stdClass;
  5704. }
  5705. if (isset($options['require-dev'])) {
  5706. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  5707. if ([] === $options['require-dev']) {
  5708. $options['require-dev'] = new \stdClass;
  5709. }
  5710. }
  5711. $autoloadPath = null;
  5712. if (isset($options['autoload'])) {
  5713. $autoloadPath = $options['autoload'];
  5714. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  5715. $options['autoload'] = (object) [
  5716. 'psr-4' => [
  5717. $namespace . '\\' => $autoloadPath,
  5718. ],
  5719. ];
  5720. }
  5721. $file = new JsonFile(Factory::getComposerFile());
  5722. $json = JsonFile::encode($options);
  5723. if ($input->isInteractive()) {
  5724. $io->writeError(['', $json, '']);
  5725. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ')) {
  5726. $io->writeError('<error>Command aborted</error>');
  5727. return 1;
  5728. }
  5729. } else {
  5730. if (json_encode($options) === '{"require":{}}') {
  5731. throw new \RuntimeException('You have to run this command in interactive mode, or specify at least some data using --name, --require, etc.');
  5732. }
  5733. $io->writeError('Writing '.$file->getPath());
  5734. }
  5735. $file->write($options);
  5736. try {
  5737. $file->validateSchema(JsonFile::LAX_SCHEMA);
  5738. } catch (JsonValidationException $e) {
  5739. $io->writeError('<error>Schema validation error, aborting</error>');
  5740. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  5741. $io->writeError($e->getMessage() . ':' . PHP_EOL . $errors);
  5742. Silencer::call('unlink', $file->getPath());
  5743. return 1;
  5744. }
  5745. if ($autoloadPath) {
  5746. $filesystem = new Filesystem();
  5747. $filesystem->ensureDirectoryExists($autoloadPath);
  5748. if (!$this->hasDependencies($options)) {
  5749. $this->runDumpAutoloadCommand($output);
  5750. }
  5751. }
  5752. if ($input->isInteractive() && is_dir('.git')) {
  5753. $ignoreFile = realpath('.gitignore');
  5754. if (false === $ignoreFile) {
  5755. $ignoreFile = realpath('.') . '/.gitignore';
  5756. }
  5757. if (!$this->hasVendorIgnore($ignoreFile)) {
  5758. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  5759. if ($io->askConfirmation($question)) {
  5760. $this->addVendorIgnore($ignoreFile);
  5761. }
  5762. }
  5763. }
  5764. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  5765. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question)) {
  5766. $this->updateDependencies($output);
  5767. }
  5768. if ($autoloadPath) {
  5769. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  5770. $io->writeError('PSR-4 autoloading configured. Use "<comment>namespace '.$namespace.';</comment>" in '.$autoloadPath);
  5771. $io->writeError('Include the Composer autoloader with: <comment>require \'vendor/autoload.php\';</comment>');
  5772. }
  5773. return 0;
  5774. }
  5775. protected function interact(InputInterface $input, OutputInterface $output)
  5776. {
  5777. $git = $this->getGitConfig();
  5778. $io = $this->getIO();
  5779. $formatter = $this->getHelperSet()->get('formatter');
  5780. $repositories = $input->getOption('repository');
  5781. if (count($repositories) > 0) {
  5782. $config = Factory::createConfig($io);
  5783. $io->loadConfiguration($config);
  5784. $repoManager = RepositoryFactory::manager($io, $config);
  5785. $repos = [new PlatformRepository];
  5786. $createDefaultPackagistRepo = true;
  5787. foreach ($repositories as $repo) {
  5788. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
  5789. if (
  5790. (isset($repoConfig['packagist']) && $repoConfig === ['packagist' => false])
  5791. || (isset($repoConfig['packagist.org']) && $repoConfig === ['packagist.org' => false])
  5792. ) {
  5793. $createDefaultPackagistRepo = false;
  5794. continue;
  5795. }
  5796. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig, $repoManager);
  5797. }
  5798. if ($createDefaultPackagistRepo) {
  5799. $repos[] = RepositoryFactory::createRepo($io, $config, [
  5800. 'type' => 'composer',
  5801. 'url' => 'https://repo.packagist.org',
  5802. ], $repoManager);
  5803. }
  5804. $this->repos = new CompositeRepository($repos);
  5805. unset($repos, $config, $repositories);
  5806. }
  5807. $io->writeError([
  5808. '',
  5809. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  5810. '',
  5811. ]);
  5812. $io->writeError([
  5813. '',
  5814. 'This command will guide you through creating your composer.json config.',
  5815. '',
  5816. ]);
  5817. $cwd = realpath(".");
  5818. $name = $input->getOption('name');
  5819. if (null === $name) {
  5820. $name = basename($cwd);
  5821. $name = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  5822. $name = strtolower($name);
  5823. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  5824. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  5825. } elseif (isset($git['github.user'])) {
  5826. $name = $git['github.user'] . '/' . $name;
  5827. } elseif (!empty($_SERVER['USERNAME'])) {
  5828. $name = $_SERVER['USERNAME'] . '/' . $name;
  5829. } elseif (!empty($_SERVER['USER'])) {
  5830. $name = $_SERVER['USER'] . '/' . $name;
  5831. } elseif (get_current_user()) {
  5832. $name = get_current_user() . '/' . $name;
  5833. } else {
  5834. $name .= '/' . $name;
  5835. }
  5836. $name = strtolower($name);
  5837. }
  5838. $name = $io->askAndValidate(
  5839. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  5840. static function ($value) use ($name) {
  5841. if (null === $value) {
  5842. return $name;
  5843. }
  5844. if (!Preg::isMatch('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  5845. throw new \InvalidArgumentException(
  5846. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  5847. );
  5848. }
  5849. return $value;
  5850. },
  5851. null,
  5852. $name
  5853. );
  5854. $input->setOption('name', $name);
  5855. $description = $input->getOption('description') ?: null;
  5856. $description = $io->ask(
  5857. 'Description [<comment>'.$description.'</comment>]: ',
  5858. $description
  5859. );
  5860. $input->setOption('description', $description);
  5861. if (null === $author = $input->getOption('author')) {
  5862. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  5863. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  5864. } elseif (isset($git['user.name'])) {
  5865. $author_name = $git['user.name'];
  5866. }
  5867. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  5868. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  5869. } elseif (isset($git['user.email'])) {
  5870. $author_email = $git['user.email'];
  5871. }
  5872. if (isset($author_name, $author_email)) {
  5873. $author = sprintf('%s <%s>', $author_name, $author_email);
  5874. }
  5875. }
  5876. $author = $io->askAndValidate(
  5877. 'Author ['.(is_string($author) ? '<comment>'.$author.'</comment>, ' : '') . 'n to skip]: ',
  5878. function ($value) use ($author) {
  5879. if ($value === 'n' || $value === 'no') {
  5880. return;
  5881. }
  5882. $value = $value ?: $author;
  5883. $author = $this->parseAuthorString($value ?? '');
  5884. if ($author['email'] === null) {
  5885. return $author['name'];
  5886. }
  5887. return sprintf('%s <%s>', $author['name'], $author['email']);
  5888. },
  5889. null,
  5890. $author
  5891. );
  5892. $input->setOption('author', $author);
  5893. $minimumStability = $input->getOption('stability') ?: null;
  5894. $minimumStability = $io->askAndValidate(
  5895. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  5896. static function ($value) use ($minimumStability) {
  5897. if (null === $value) {
  5898. return $minimumStability;
  5899. }
  5900. if (!isset(BasePackage::STABILITIES[$value])) {
  5901. throw new \InvalidArgumentException(
  5902. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  5903. implode(', ', array_keys(BasePackage::STABILITIES))
  5904. );
  5905. }
  5906. return $value;
  5907. },
  5908. null,
  5909. $minimumStability
  5910. );
  5911. $input->setOption('stability', $minimumStability);
  5912. $type = $input->getOption('type');
  5913. $type = $io->ask(
  5914. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  5915. $type
  5916. );
  5917. if ($type === '' || $type === false) {
  5918. $type = null;
  5919. }
  5920. $input->setOption('type', $type);
  5921. if (null === $license = $input->getOption('license')) {
  5922. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  5923. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  5924. }
  5925. }
  5926. $license = $io->ask(
  5927. 'License [<comment>'.$license.'</comment>]: ',
  5928. $license
  5929. );
  5930. $spdx = new SpdxLicenses();
  5931. if (null !== $license && !$spdx->validate($license) && $license !== 'proprietary') {
  5932. throw new \InvalidArgumentException('Invalid license provided: '.$license.'. Only SPDX license identifiers (https://spdx.org/licenses/) or "proprietary" are accepted.');
  5933. }
  5934. $input->setOption('license', $license);
  5935. $io->writeError(['', 'Define your dependencies.', '']);
  5936. $repos = $this->getRepos();
  5937. $preferredStability = $minimumStability ?: 'stable';
  5938. $platformRepo = null;
  5939. if ($repos instanceof CompositeRepository) {
  5940. foreach ($repos->getRepositories() as $candidateRepo) {
  5941. if ($candidateRepo instanceof PlatformRepository) {
  5942. $platformRepo = $candidateRepo;
  5943. break;
  5944. }
  5945. }
  5946. }
  5947. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  5948. $require = $input->getOption('require');
  5949. $requirements = [];
  5950. if (count($require) > 0 || $io->askConfirmation($question)) {
  5951. $requirements = $this->determineRequirements($input, $output, $require, $platformRepo, $preferredStability);
  5952. }
  5953. $input->setOption('require', $requirements);
  5954. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  5955. $requireDev = $input->getOption('require-dev');
  5956. $devRequirements = [];
  5957. if (count($requireDev) > 0 || $io->askConfirmation($question)) {
  5958. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $platformRepo, $preferredStability);
  5959. }
  5960. $input->setOption('require-dev', $devRequirements);
  5961. $autoload = $input->getOption('autoload') ?: 'src/';
  5962. $namespace = $this->namespaceFromPackageName((string) $input->getOption('name'));
  5963. $autoload = $io->askAndValidate(
  5964. 'Add PSR-4 autoload mapping? Maps namespace "'.$namespace.'" to the entered relative path. [<comment>'.$autoload.'</comment>, n to skip]: ',
  5965. static function ($value) use ($autoload) {
  5966. if (null === $value) {
  5967. return $autoload;
  5968. }
  5969. if ($value === 'n' || $value === 'no') {
  5970. return;
  5971. }
  5972. $value = $value ?: $autoload;
  5973. if (!Preg::isMatch('{^[^/][A-Za-z0-9\-_/]+/$}', $value)) {
  5974. throw new \InvalidArgumentException(sprintf(
  5975. 'The src folder name "%s" is invalid. Please add a relative path with tailing forward slash. [A-Za-z0-9_-/]+/',
  5976. $value
  5977. ));
  5978. }
  5979. return $value;
  5980. },
  5981. null,
  5982. $autoload
  5983. );
  5984. $input->setOption('autoload', $autoload);
  5985. }
  5986. private function parseAuthorString(string $author): array
  5987. {
  5988. if (Preg::isMatch('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+)(?:\s+<(?P<email>.+?)>)?$/u', $author, $match)) {
  5989. if (null !== $match['email'] && !$this->isValidEmail($match['email'])) {
  5990. throw new \InvalidArgumentException('Invalid email "'.$match['email'].'"');
  5991. }
  5992. return [
  5993. 'name' => trim($match['name']),
  5994. 'email' => $match['email'],
  5995. ];
  5996. }
  5997. throw new \InvalidArgumentException(
  5998. 'Invalid author string. Must be in the formats: '.
  5999. 'Jane Doe or John Smith <john@example.com>'
  6000. );
  6001. }
  6002. protected function formatAuthors(string $author): array
  6003. {
  6004. $author = $this->parseAuthorString($author);
  6005. if (null === $author['email']) {
  6006. unset($author['email']);
  6007. }
  6008. return [$author];
  6009. }
  6010. public function namespaceFromPackageName(string $packageName): ?string
  6011. {
  6012. if (!$packageName || strpos($packageName, '/') === false) {
  6013. return null;
  6014. }
  6015. $namespace = array_map(
  6016. static function ($part): string {
  6017. $part = Preg::replace('/[^a-z0-9]/i', ' ', $part);
  6018. $part = ucwords($part);
  6019. return str_replace(' ', '', $part);
  6020. },
  6021. explode('/', $packageName)
  6022. );
  6023. return implode('\\', $namespace);
  6024. }
  6025. protected function getGitConfig(): array
  6026. {
  6027. if (null !== $this->gitConfig) {
  6028. return $this->gitConfig;
  6029. }
  6030. $process = new ProcessExecutor($this->getIO());
  6031. if (0 === $process->execute(['git', 'config', '-l'], $output)) {
  6032. $this->gitConfig = [];
  6033. Preg::matchAllStrictGroups('{^([^=]+)=(.*)$}m', $output, $matches);
  6034. foreach ($matches[1] as $key => $match) {
  6035. $this->gitConfig[$match] = $matches[2][$key];
  6036. }
  6037. return $this->gitConfig;
  6038. }
  6039. return $this->gitConfig = [];
  6040. }
  6041. protected function hasVendorIgnore(string $ignoreFile, string $vendor = 'vendor'): bool
  6042. {
  6043. if (!file_exists($ignoreFile)) {
  6044. return false;
  6045. }
  6046. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  6047. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  6048. foreach ($lines as $line) {
  6049. if (Preg::isMatch($pattern, $line)) {
  6050. return true;
  6051. }
  6052. }
  6053. return false;
  6054. }
  6055. protected function addVendorIgnore(string $ignoreFile, string $vendor = '/vendor/'): void
  6056. {
  6057. $contents = "";
  6058. if (file_exists($ignoreFile)) {
  6059. $contents = file_get_contents($ignoreFile);
  6060. if (strpos($contents, "\n") !== 0) {
  6061. $contents .= "\n";
  6062. }
  6063. }
  6064. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  6065. }
  6066. protected function isValidEmail(string $email): bool
  6067. {
  6068. if (!function_exists('filter_var')) {
  6069. return true;
  6070. }
  6071. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  6072. }
  6073. private function updateDependencies(OutputInterface $output): void
  6074. {
  6075. try {
  6076. $updateCommand = $this->getApplication()->find('update');
  6077. $this->getApplication()->resetComposer();
  6078. $updateCommand->run(new ArrayInput([]), $output);
  6079. } catch (\Exception $e) {
  6080. $this->getIO()->writeError('Could not update dependencies. Run `composer update` to see more information.');
  6081. }
  6082. }
  6083. private function runDumpAutoloadCommand(OutputInterface $output): void
  6084. {
  6085. try {
  6086. $command = $this->getApplication()->find('dump-autoload');
  6087. $this->getApplication()->resetComposer();
  6088. $command->run(new ArrayInput([]), $output);
  6089. } catch (\Exception $e) {
  6090. $this->getIO()->writeError('Could not run dump-autoload.');
  6091. }
  6092. }
  6093. private function hasDependencies(array $options): bool
  6094. {
  6095. $requires = (array) $options['require'];
  6096. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : [];
  6097. return !empty($requires) || !empty($devRequires);
  6098. }
  6099. }
  6100. <?php declare(strict_types=1);
  6101. namespace Composer\Command;
  6102. use Composer\Installer;
  6103. use Composer\Plugin\CommandEvent;
  6104. use Composer\Plugin\PluginEvents;
  6105. use Composer\Advisory\Auditor;
  6106. use Composer\Util\HttpDownloader;
  6107. use Symfony\Component\Console\Input\InputInterface;
  6108. use Composer\Console\Input\InputOption;
  6109. use Composer\Console\Input\InputArgument;
  6110. use Symfony\Component\Console\Output\OutputInterface;
  6111. class InstallCommand extends BaseCommand
  6112. {
  6113. use CompletionTrait;
  6114. protected function configure()
  6115. {
  6116. $this
  6117. ->setName('install')
  6118. ->setAliases(['i'])
  6119. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json')
  6120. ->setDefinition([
  6121. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6122. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  6123. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  6124. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6125. new InputOption('download-only', null, InputOption::VALUE_NONE, 'Download only, do not install packages.'),
  6126. new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6127. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  6128. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6129. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6130. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6131. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Do not use, only defined here to catch misuse of the install command.'),
  6132. new InputOption('audit', null, InputOption::VALUE_NONE, 'Run an audit after installation is complete.'),
  6133. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  6134. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6135. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  6136. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6137. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6138. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  6139. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  6140. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  6141. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  6142. ])
  6143. ->setHelp(
  6144. <<<EOT
  6145. The <info>install</info> command reads the composer.lock file from
  6146. the current directory, processes it, and downloads and installs all the
  6147. libraries and dependencies outlined in that file. If the file does not
  6148. exist it will look for composer.json and do the same.
  6149. <info>php composer.phar install</info>
  6150. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  6151. EOT
  6152. )
  6153. ;
  6154. }
  6155. protected function execute(InputInterface $input, OutputInterface $output): int
  6156. {
  6157. $io = $this->getIO();
  6158. if ($input->getOption('dev')) {
  6159. $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
  6160. }
  6161. if ($input->getOption('no-suggest')) {
  6162. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  6163. }
  6164. $args = $input->getArgument('packages');
  6165. if (count($args) > 0) {
  6166. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  6167. return 1;
  6168. }
  6169. if ($input->getOption('no-install')) {
  6170. $io->writeError('<error>Invalid option "--no-install". Use "composer update --no-install" instead if you are trying to update the composer.lock file.</error>');
  6171. return 1;
  6172. }
  6173. $composer = $this->requireComposer();
  6174. if (!$composer->getLocker()->isLocked() && !HttpDownloader::isCurlEnabled()) {
  6175. $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
  6176. }
  6177. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  6178. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6179. $install = Installer::create($io, $composer);
  6180. $config = $composer->getConfig();
  6181. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  6182. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6183. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6184. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  6185. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6186. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  6187. $install
  6188. ->setDryRun($input->getOption('dry-run'))
  6189. ->setDownloadOnly($input->getOption('download-only'))
  6190. ->setVerbose($input->getOption('verbose'))
  6191. ->setPreferSource($preferSource)
  6192. ->setPreferDist($preferDist)
  6193. ->setDevMode(!$input->getOption('no-dev'))
  6194. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6195. ->setOptimizeAutoloader($optimize)
  6196. ->setClassMapAuthoritative($authoritative)
  6197. ->setApcuAutoloader($apcu, $apcuPrefix)
  6198. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  6199. ->setAudit($input->getOption('audit'))
  6200. ->setErrorOnAudit($input->getOption('audit'))
  6201. ->setAuditFormat($this->getAuditFormat($input))
  6202. ;
  6203. if ($input->getOption('no-plugins')) {
  6204. $install->disablePlugins();
  6205. }
  6206. return $install->run();
  6207. }
  6208. }
  6209. <?php declare(strict_types=1);
  6210. namespace Composer\Command;
  6211. use Composer\Console\Input\InputOption;
  6212. use Composer\Json\JsonFile;
  6213. use Composer\Package\CompletePackageInterface;
  6214. use Composer\Plugin\CommandEvent;
  6215. use Composer\Plugin\PluginEvents;
  6216. use Composer\Repository\RepositoryUtils;
  6217. use Composer\Util\PackageInfo;
  6218. use Composer\Util\PackageSorter;
  6219. use Symfony\Component\Console\Formatter\OutputFormatter;
  6220. use Symfony\Component\Console\Helper\Table;
  6221. use Symfony\Component\Console\Input\InputInterface;
  6222. use Symfony\Component\Console\Output\OutputInterface;
  6223. use Symfony\Component\Console\Style\SymfonyStyle;
  6224. class LicensesCommand extends BaseCommand
  6225. {
  6226. protected function configure(): void
  6227. {
  6228. $this
  6229. ->setName('licenses')
  6230. ->setDescription('Shows information about licenses of dependencies')
  6231. ->setDefinition([
  6232. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text, json or summary', 'text', ['text', 'json', 'summary']),
  6233. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  6234. ])
  6235. ->setHelp(
  6236. <<<EOT
  6237. The license command displays detailed information about the licenses of
  6238. the installed dependencies.
  6239. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  6240. EOT
  6241. )
  6242. ;
  6243. }
  6244. protected function execute(InputInterface $input, OutputInterface $output): int
  6245. {
  6246. $composer = $this->requireComposer();
  6247. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  6248. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6249. $root = $composer->getPackage();
  6250. $repo = $composer->getRepositoryManager()->getLocalRepository();
  6251. if ($input->getOption('no-dev')) {
  6252. $packages = RepositoryUtils::filterRequiredPackages($repo->getPackages(), $root);
  6253. } else {
  6254. $packages = $repo->getPackages();
  6255. }
  6256. $packages = PackageSorter::sortPackagesAlphabetically($packages);
  6257. $io = $this->getIO();
  6258. switch ($format = $input->getOption('format')) {
  6259. case 'text':
  6260. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  6261. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  6262. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  6263. $io->write('Dependencies:');
  6264. $io->write('');
  6265. $table = new Table($output);
  6266. $table->setStyle('compact');
  6267. $table->setHeaders(['Name', 'Version', 'Licenses']);
  6268. foreach ($packages as $package) {
  6269. $link = PackageInfo::getViewSourceOrHomepageUrl($package);
  6270. if ($link !== null) {
  6271. $name = '<href='.OutputFormatter::escape($link).'>'.$package->getPrettyName().'</>';
  6272. } else {
  6273. $name = $package->getPrettyName();
  6274. }
  6275. $table->addRow([
  6276. $name,
  6277. $package->getFullPrettyVersion(),
  6278. implode(', ', $package instanceof CompletePackageInterface ? $package->getLicense() : []) ?: 'none',
  6279. ]);
  6280. }
  6281. $table->render();
  6282. break;
  6283. case 'json':
  6284. $dependencies = [];
  6285. foreach ($packages as $package) {
  6286. $dependencies[$package->getPrettyName()] = [
  6287. 'version' => $package->getFullPrettyVersion(),
  6288. 'license' => $package instanceof CompletePackageInterface ? $package->getLicense() : [],
  6289. ];
  6290. }
  6291. $io->write(JsonFile::encode([
  6292. 'name' => $root->getPrettyName(),
  6293. 'version' => $root->getFullPrettyVersion(),
  6294. 'license' => $root->getLicense(),
  6295. 'dependencies' => $dependencies,
  6296. ]));
  6297. break;
  6298. case 'summary':
  6299. $usedLicenses = [];
  6300. foreach ($packages as $package) {
  6301. $licenses = $package instanceof CompletePackageInterface ? $package->getLicense() : [];
  6302. if (count($licenses) === 0) {
  6303. $licenses[] = 'none';
  6304. }
  6305. foreach ($licenses as $licenseName) {
  6306. if (!isset($usedLicenses[$licenseName])) {
  6307. $usedLicenses[$licenseName] = 0;
  6308. }
  6309. $usedLicenses[$licenseName]++;
  6310. }
  6311. }
  6312. arsort($usedLicenses, SORT_NUMERIC);
  6313. $rows = [];
  6314. foreach ($usedLicenses as $usedLicense => $numberOfDependencies) {
  6315. $rows[] = [$usedLicense, $numberOfDependencies];
  6316. }
  6317. $symfonyIo = new SymfonyStyle($input, $output);
  6318. $symfonyIo->table(
  6319. ['License', 'Number of dependencies'],
  6320. $rows
  6321. );
  6322. break;
  6323. default:
  6324. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  6325. }
  6326. return 0;
  6327. }
  6328. }
  6329. <?php declare(strict_types=1);
  6330. namespace Composer\Command;
  6331. use Symfony\Component\Console\Input\InputInterface;
  6332. use Composer\Console\Input\InputArgument;
  6333. use Symfony\Component\Console\Input\ArrayInput;
  6334. use Composer\Console\Input\InputOption;
  6335. use Symfony\Component\Console\Output\OutputInterface;
  6336. class OutdatedCommand extends BaseCommand
  6337. {
  6338. use CompletionTrait;
  6339. protected function configure(): void
  6340. {
  6341. $this
  6342. ->setName('outdated')
  6343. ->setDescription('Shows a list of installed packages that have updates available, including their latest version')
  6344. ->setDefinition([
  6345. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.', null, $this->suggestInstalledPackage(false)),
  6346. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  6347. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  6348. new InputOption('locked', null, InputOption::VALUE_NONE, 'Shows updates for packages from the lock file, regardless of what is currently in vendor dir'),
  6349. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  6350. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  6351. new InputOption('major-only', 'M', InputOption::VALUE_NONE, 'Show only packages that have major SemVer-compatible updates.'),
  6352. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates.'),
  6353. new InputOption('patch-only', 'p', InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates.'),
  6354. new InputOption('sort-by-age', 'A', InputOption::VALUE_NONE, 'Displays the installed version\'s age, and sorts packages oldest first.'),
  6355. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  6356. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Can contain wildcards (*). Use it if you don\'t want to be informed about new versions of some packages.', null, $this->suggestInstalledPackage(false)),
  6357. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  6358. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages). Use with the --outdated option'),
  6359. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
  6360. ])
  6361. ->setHelp(
  6362. <<<EOT
  6363. The outdated command is just a proxy for `composer show -l`
  6364. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  6365. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  6366. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  6367. compatibility breaks according to semver, so upgrade when you can but it
  6368. may involve work.
  6369. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  6370. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  6371. EOT
  6372. )
  6373. ;
  6374. }
  6375. protected function execute(InputInterface $input, OutputInterface $output): int
  6376. {
  6377. $args = [
  6378. 'command' => 'show',
  6379. '--latest' => true,
  6380. ];
  6381. if ($input->getOption('no-interaction')) {
  6382. $args['--no-interaction'] = true;
  6383. }
  6384. if ($input->getOption('no-plugins')) {
  6385. $args['--no-plugins'] = true;
  6386. }
  6387. if ($input->getOption('no-scripts')) {
  6388. $args['--no-scripts'] = true;
  6389. }
  6390. if ($input->getOption('no-cache')) {
  6391. $args['--no-cache'] = true;
  6392. }
  6393. if (!$input->getOption('all')) {
  6394. $args['--outdated'] = true;
  6395. }
  6396. if ($input->getOption('direct')) {
  6397. $args['--direct'] = true;
  6398. }
  6399. if (null !== $input->getArgument('package')) {
  6400. $args['package'] = $input->getArgument('package');
  6401. }
  6402. if ($input->getOption('strict')) {
  6403. $args['--strict'] = true;
  6404. }
  6405. if ($input->getOption('major-only')) {
  6406. $args['--major-only'] = true;
  6407. }
  6408. if ($input->getOption('minor-only')) {
  6409. $args['--minor-only'] = true;
  6410. }
  6411. if ($input->getOption('patch-only')) {
  6412. $args['--patch-only'] = true;
  6413. }
  6414. if ($input->getOption('locked')) {
  6415. $args['--locked'] = true;
  6416. }
  6417. if ($input->getOption('no-dev')) {
  6418. $args['--no-dev'] = true;
  6419. }
  6420. if ($input->getOption('sort-by-age')) {
  6421. $args['--sort-by-age'] = true;
  6422. }
  6423. $args['--ignore-platform-req'] = $input->getOption('ignore-platform-req');
  6424. if ($input->getOption('ignore-platform-reqs')) {
  6425. $args['--ignore-platform-reqs'] = true;
  6426. }
  6427. $args['--format'] = $input->getOption('format');
  6428. $args['--ignore'] = $input->getOption('ignore');
  6429. $input = new ArrayInput($args);
  6430. return $this->getApplication()->run($input, $output);
  6431. }
  6432. public function isProxyCommand(): bool
  6433. {
  6434. return true;
  6435. }
  6436. }
  6437. <?php declare(strict_types=1);
  6438. namespace Composer\Command;
  6439. use Composer\Factory;
  6440. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  6441. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  6442. use Composer\IO\IOInterface;
  6443. use Composer\Package\BasePackage;
  6444. use Composer\Package\CompletePackageInterface;
  6445. use Composer\Package\PackageInterface;
  6446. use Composer\Package\Version\VersionParser;
  6447. use Composer\Package\Version\VersionSelector;
  6448. use Composer\Pcre\Preg;
  6449. use Composer\Repository\CompositeRepository;
  6450. use Composer\Repository\PlatformRepository;
  6451. use Composer\Repository\RepositoryFactory;
  6452. use Composer\Repository\RepositorySet;
  6453. use Composer\Semver\Constraint\Constraint;
  6454. use Composer\Util\Filesystem;
  6455. use Symfony\Component\Console\Input\InputInterface;
  6456. use Symfony\Component\Console\Output\OutputInterface;
  6457. trait PackageDiscoveryTrait
  6458. {
  6459. private $repos;
  6460. private $repositorySets;
  6461. protected function getRepos(): CompositeRepository
  6462. {
  6463. if (null === $this->repos) {
  6464. $this->repos = new CompositeRepository(array_merge(
  6465. [new PlatformRepository],
  6466. RepositoryFactory::defaultReposWithDefaultManager($this->getIO())
  6467. ));
  6468. }
  6469. return $this->repos;
  6470. }
  6471. private function getRepositorySet(InputInterface $input, ?string $minimumStability = null): RepositorySet
  6472. {
  6473. $key = $minimumStability ?? 'default';
  6474. if (!isset($this->repositorySets[$key])) {
  6475. $this->repositorySets[$key] = $repositorySet = new RepositorySet($minimumStability ?? $this->getMinimumStability($input));
  6476. $repositorySet->addRepository($this->getRepos());
  6477. }
  6478. return $this->repositorySets[$key];
  6479. }
  6480. private function getMinimumStability(InputInterface $input): string
  6481. {
  6482. if ($input->hasOption('stability')) {
  6483. return VersionParser::normalizeStability($input->getOption('stability') ?? 'stable');
  6484. }
  6485. $file = Factory::getComposerFile();
  6486. if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode((string) file_get_contents($file), true))) {
  6487. if (isset($composer['minimum-stability'])) {
  6488. return VersionParser::normalizeStability($composer['minimum-stability']);
  6489. }
  6490. }
  6491. return 'stable';
  6492. }
  6493. final protected function determineRequirements(InputInterface $input, OutputInterface $output, array $requires = [], ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', bool $useBestVersionConstraint = true, bool $fixed = false): array
  6494. {
  6495. if (count($requires) > 0) {
  6496. $requires = $this->normalizeRequirements($requires);
  6497. $result = [];
  6498. $io = $this->getIO();
  6499. foreach ($requires as $requirement) {
  6500. if (isset($requirement['version']) && Preg::isMatch('{^\d+(\.\d+)?$}', $requirement['version'])) {
  6501. $io->writeError('<warning>The "'.$requirement['version'].'" constraint for "'.$requirement['name'].'" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints</warning>');
  6502. }
  6503. if (!isset($requirement['version'])) {
  6504. [$name, $version] = $this->findBestVersionAndNameForPackage($this->getIO(), $input, $requirement['name'], $platformRepo, $preferredStability, $fixed);
  6505. $requirement['name'] = $name;
  6506. if ($useBestVersionConstraint) {
  6507. $requirement['version'] = $version;
  6508. $io->writeError(sprintf(
  6509. 'Using version <info>%s</info> for <info>%s</info>',
  6510. $requirement['version'],
  6511. $requirement['name']
  6512. ));
  6513. } else {
  6514. $requirement['version'] = 'guess';
  6515. }
  6516. }
  6517. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  6518. }
  6519. return $result;
  6520. }
  6521. $versionParser = new VersionParser();
  6522. $composer = $this->tryComposer();
  6523. $installedRepo = null;
  6524. if (null !== $composer) {
  6525. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6526. }
  6527. $existingPackages = [];
  6528. if (null !== $installedRepo) {
  6529. foreach ($installedRepo->getPackages() as $package) {
  6530. $existingPackages[] = $package->getName();
  6531. }
  6532. }
  6533. unset($composer, $installedRepo);
  6534. $io = $this->getIO();
  6535. while (null !== $package = $io->ask('Search for a package: ')) {
  6536. $matches = $this->getRepos()->search($package);
  6537. if (count($matches) > 0) {
  6538. foreach ($matches as $position => $foundPackage) {
  6539. if (in_array($foundPackage['name'], $existingPackages, true)) {
  6540. unset($matches[$position]);
  6541. }
  6542. }
  6543. $matches = array_values($matches);
  6544. $exactMatch = false;
  6545. foreach ($matches as $match) {
  6546. if ($match['name'] === $package) {
  6547. $exactMatch = true;
  6548. break;
  6549. }
  6550. }
  6551. if (!$exactMatch) {
  6552. $providers = $this->getRepos()->getProviders($package);
  6553. if (count($providers) > 0) {
  6554. array_unshift($matches, ['name' => $package, 'description' => '']);
  6555. }
  6556. $choices = [];
  6557. foreach ($matches as $position => $foundPackage) {
  6558. $abandoned = '';
  6559. if (isset($foundPackage['abandoned'])) {
  6560. if (is_string($foundPackage['abandoned'])) {
  6561. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  6562. } else {
  6563. $replacement = 'No replacement was suggested';
  6564. }
  6565. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  6566. }
  6567. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  6568. }
  6569. $io->writeError([
  6570. '',
  6571. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  6572. '',
  6573. ]);
  6574. $io->writeError($choices);
  6575. $io->writeError('');
  6576. $validator = static function (string $selection) use ($matches, $versionParser) {
  6577. if ('' === $selection) {
  6578. return false;
  6579. }
  6580. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  6581. $package = $matches[(int) $selection];
  6582. return $package['name'];
  6583. }
  6584. if (Preg::isMatch('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  6585. if (isset($packageMatches['version'])) {
  6586. $versionParser->parseConstraints($packageMatches['version']);
  6587. return $packageMatches['name'].' '.$packageMatches['version'];
  6588. }
  6589. return $packageMatches['name'];
  6590. }
  6591. throw new \Exception('Not a valid selection');
  6592. };
  6593. $package = $io->askAndValidate(
  6594. 'Enter package # to add, or the complete package name if it is not listed: ',
  6595. $validator,
  6596. 3,
  6597. ''
  6598. );
  6599. }
  6600. if (false !== $package && false === strpos($package, ' ')) {
  6601. $validator = static function (string $input) {
  6602. $input = trim($input);
  6603. return strlen($input) > 0 ? $input : false;
  6604. };
  6605. $constraint = $io->askAndValidate(
  6606. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  6607. $validator,
  6608. 3,
  6609. ''
  6610. );
  6611. if (false === $constraint) {
  6612. [, $constraint] = $this->findBestVersionAndNameForPackage($this->getIO(), $input, $package, $platformRepo, $preferredStability);
  6613. $io->writeError(sprintf(
  6614. 'Using version <info>%s</info> for <info>%s</info>',
  6615. $constraint,
  6616. $package
  6617. ));
  6618. }
  6619. $package .= ' '.$constraint;
  6620. }
  6621. if (false !== $package) {
  6622. $requires[] = $package;
  6623. $existingPackages[] = explode(' ', $package)[0];
  6624. }
  6625. }
  6626. }
  6627. return $requires;
  6628. }
  6629. private function findBestVersionAndNameForPackage(IOInterface $io, InputInterface $input, string $name, ?PlatformRepository $platformRepo = null, string $preferredStability = 'stable', bool $fixed = false): array
  6630. {
  6631. if ($input->hasOption('ignore-platform-reqs') && $input->hasOption('ignore-platform-req')) {
  6632. $platformRequirementFilter = $this->getPlatformRequirementFilter($input);
  6633. } else {
  6634. $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  6635. }
  6636. $repoSet = $this->getRepositorySet($input);
  6637. $versionSelector = new VersionSelector($repoSet, $platformRepo);
  6638. $effectiveMinimumStability = $this->getMinimumStability($input);
  6639. $package = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, 0, $this->getIO());
  6640. if (false === $package) {
  6641. if ($platformRequirementFilter->isIgnored($name)) {
  6642. return [$name, '*'];
  6643. }
  6644. $providers = $repoSet->getProviders($name);
  6645. if (count($providers) > 0) {
  6646. $constraint = '*';
  6647. if ($input->isInteractive()) {
  6648. $constraint = $this->getIO()->askAndValidate('Package "<info>'.$name.'</info>" does not exist but is provided by '.count($providers).' packages. Which version constraint would you like to use? [<info>*</info>] ', static function ($value) {
  6649. $parser = new VersionParser();
  6650. $parser->parseConstraints($value);
  6651. return $value;
  6652. }, 3, '*');
  6653. }
  6654. return [$name, $constraint];
  6655. }
  6656. if (!($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter) && false !== ($candidate = $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll()))) {
  6657. throw new \InvalidArgumentException(sprintf(
  6658. 'Package %s has requirements incompatible with your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo),
  6659. $name
  6660. ));
  6661. }
  6662. if (false !== ($package = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
  6663. if (false !== ($allReposPackage = $versionSelector->findBestCandidate($name, null, $preferredStability, $platformRequirementFilter, RepositorySet::ALLOW_SHADOWED_REPOSITORIES))) {
  6664. throw new \InvalidArgumentException(
  6665. 'Package '.$name.' exists in '.$allReposPackage->getRepository()->getRepoName().' and '.$package->getRepository()->getRepoName().' which has a higher repository priority. The packages from the higher priority repository do not match your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.'
  6666. );
  6667. }
  6668. throw new \InvalidArgumentException(sprintf(
  6669. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  6670. $name,
  6671. $effectiveMinimumStability
  6672. ));
  6673. }
  6674. if (!$platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter && false !== ($candidate = $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll(), RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES))) {
  6675. $additional = '';
  6676. if (false === $versionSelector->findBestCandidate($name, null, $preferredStability, PlatformRequirementFilterFactory::ignoreAll())) {
  6677. $additional = PHP_EOL.PHP_EOL.'Additionally, the package was only found with a stability of "'.$candidate->getStability().'" while your minimum stability is "'.$effectiveMinimumStability.'".';
  6678. }
  6679. throw new \InvalidArgumentException(sprintf(
  6680. 'Could not find package %s in any version matching your PHP version, PHP extensions and Composer version' . $this->getPlatformExceptionDetails($candidate, $platformRepo) . '%s',
  6681. $name,
  6682. $additional
  6683. ));
  6684. }
  6685. $similar = $this->findSimilar($name);
  6686. if (count($similar) > 0) {
  6687. if (in_array($name, $similar, true)) {
  6688. throw new \InvalidArgumentException(sprintf(
  6689. "Could not find package %s. It was however found via repository search, which indicates a consistency issue with the repository.",
  6690. $name
  6691. ));
  6692. }
  6693. if ($input->isInteractive()) {
  6694. $result = $io->select("<error>Could not find package $name.</error>\nPick one of these or leave empty to abort:", $similar, false, 1);
  6695. if ($result !== false) {
  6696. return $this->findBestVersionAndNameForPackage($io, $input, $similar[$result], $platformRepo, $preferredStability, $fixed);
  6697. }
  6698. }
  6699. throw new \InvalidArgumentException(sprintf(
  6700. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  6701. $name,
  6702. implode("\n ", $similar)
  6703. ));
  6704. }
  6705. throw new \InvalidArgumentException(sprintf(
  6706. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  6707. $name,
  6708. $effectiveMinimumStability
  6709. ));
  6710. }
  6711. return [
  6712. $package->getPrettyName(),
  6713. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  6714. ];
  6715. }
  6716. private function findSimilar(string $package): array
  6717. {
  6718. try {
  6719. if (null === $this->repos) {
  6720. throw new \LogicException('findSimilar was called before $this->repos was initialized');
  6721. }
  6722. $results = $this->repos->search($package);
  6723. } catch (\Throwable $e) {
  6724. if ($e instanceof \LogicException) {
  6725. throw $e;
  6726. }
  6727. return [];
  6728. }
  6729. $similarPackages = [];
  6730. $installedRepo = $this->requireComposer()->getRepositoryManager()->getLocalRepository();
  6731. foreach ($results as $result) {
  6732. if (null !== $installedRepo->findPackage($result['name'], '*')) {
  6733. continue;
  6734. }
  6735. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  6736. }
  6737. asort($similarPackages);
  6738. return array_keys(array_slice($similarPackages, 0, 5));
  6739. }
  6740. private function getPlatformExceptionDetails(PackageInterface $candidate, ?PlatformRepository $platformRepo = null): string
  6741. {
  6742. $details = [];
  6743. if (null === $platformRepo) {
  6744. return '';
  6745. }
  6746. foreach ($candidate->getRequires() as $link) {
  6747. if (!PlatformRepository::isPlatformPackage($link->getTarget())) {
  6748. continue;
  6749. }
  6750. $platformPkg = $platformRepo->findPackage($link->getTarget(), '*');
  6751. if (null === $platformPkg) {
  6752. if ($platformRepo->isPlatformPackageDisabled($link->getTarget())) {
  6753. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' but it is disabled by your platform config. Enable it again with "composer config platform.'.$link->getTarget().' --unset".';
  6754. } else {
  6755. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' but it is not present.';
  6756. }
  6757. continue;
  6758. }
  6759. if (!$link->getConstraint()->matches(new Constraint('==', $platformPkg->getVersion()))) {
  6760. $platformPkgVersion = $platformPkg->getPrettyVersion();
  6761. $platformExtra = $platformPkg->getExtra();
  6762. if (isset($platformExtra['config.platform']) && $platformPkg instanceof CompletePackageInterface) {
  6763. $platformPkgVersion .= ' ('.$platformPkg->getDescription().')';
  6764. }
  6765. $details[] = $candidate->getPrettyName().' '.$candidate->getPrettyVersion().' requires '.$link->getTarget().' '.$link->getPrettyConstraint().' which does not match your installed version '.$platformPkgVersion.'.';
  6766. }
  6767. }
  6768. if (count($details) === 0) {
  6769. return '';
  6770. }
  6771. return ':'.PHP_EOL.' - ' . implode(PHP_EOL.' - ', $details);
  6772. }
  6773. }
  6774. <?php declare(strict_types=1);
  6775. namespace Composer\Command;
  6776. use Symfony\Component\Console\Input\InputInterface;
  6777. use Symfony\Component\Console\Output\OutputInterface;
  6778. use Composer\Console\Input\InputArgument;
  6779. use Composer\Console\Input\InputOption;
  6780. class ProhibitsCommand extends BaseDependencyCommand
  6781. {
  6782. use CompletionTrait;
  6783. protected function configure(): void
  6784. {
  6785. $this
  6786. ->setName('prohibits')
  6787. ->setAliases(['why-not'])
  6788. ->setDescription('Shows which packages prevent the given package from being installed')
  6789. ->setDefinition([
  6790. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect', null, $this->suggestAvailablePackage()),
  6791. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::REQUIRED, 'Version constraint, which version you expected to be installed'),
  6792. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  6793. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  6794. new InputOption('locked', null, InputOption::VALUE_NONE, 'Read dependency information from composer.lock'),
  6795. ])
  6796. ->setHelp(
  6797. <<<EOT
  6798. Displays detailed information about why a package cannot be installed.
  6799. <info>php composer.phar prohibits composer/composer</info>
  6800. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not
  6801. EOT
  6802. )
  6803. ;
  6804. }
  6805. protected function execute(InputInterface $input, OutputInterface $output): int
  6806. {
  6807. return parent::doExecute($input, $output, true);
  6808. }
  6809. }
  6810. <?php declare(strict_types=1);
  6811. namespace Composer\Command;
  6812. use Composer\DependencyResolver\Operation\InstallOperation;
  6813. use Composer\DependencyResolver\Operation\UninstallOperation;
  6814. use Composer\DependencyResolver\Transaction;
  6815. use Composer\Package\AliasPackage;
  6816. use Composer\Package\BasePackage;
  6817. use Composer\Pcre\Preg;
  6818. use Composer\Plugin\CommandEvent;
  6819. use Composer\Plugin\PluginEvents;
  6820. use Composer\Script\ScriptEvents;
  6821. use Composer\Util\Platform;
  6822. use Symfony\Component\Console\Input\InputInterface;
  6823. use Composer\Console\Input\InputOption;
  6824. use Composer\Console\Input\InputArgument;
  6825. use Symfony\Component\Console\Output\OutputInterface;
  6826. class ReinstallCommand extends BaseCommand
  6827. {
  6828. use CompletionTrait;
  6829. protected function configure(): void
  6830. {
  6831. $this
  6832. ->setName('reinstall')
  6833. ->setDescription('Uninstalls and reinstalls the given package names')
  6834. ->setDefinition([
  6835. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6836. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  6837. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  6838. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6839. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6840. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  6841. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6842. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6843. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  6844. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  6845. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  6846. new InputOption('type', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Filter packages to reinstall by type(s)', null, $this->suggestInstalledPackageTypes(false)),
  6847. new InputArgument('packages', InputArgument::IS_ARRAY, 'List of package names to reinstall, can include a wildcard (*) to match any substring.', null, $this->suggestInstalledPackage(false)),
  6848. ])
  6849. ->setHelp(
  6850. <<<EOT
  6851. The <info>reinstall</info> command looks up installed packages by name,
  6852. uninstalls them and reinstalls them. This lets you do a clean install
  6853. of a package if you messed with its files, or if you wish to change
  6854. the installation type using --prefer-install.
  6855. <info>php composer.phar reinstall acme/foo "acme/bar-*"</info>
  6856. Read more at https://getcomposer.org/doc/03-cli.md#reinstall
  6857. EOT
  6858. )
  6859. ;
  6860. }
  6861. protected function execute(InputInterface $input, OutputInterface $output): int
  6862. {
  6863. $io = $this->getIO();
  6864. $composer = $this->requireComposer();
  6865. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6866. $packagesToReinstall = [];
  6867. $packageNamesToReinstall = [];
  6868. if (\count($input->getOption('type')) > 0) {
  6869. if (\count($input->getArgument('packages')) > 0) {
  6870. throw new \InvalidArgumentException('You cannot specify package names and filter by type at the same time.');
  6871. }
  6872. foreach ($localRepo->getCanonicalPackages() as $package) {
  6873. if (in_array($package->getType(), $input->getOption('type'), true)) {
  6874. $packagesToReinstall[] = $package;
  6875. $packageNamesToReinstall[] = $package->getName();
  6876. }
  6877. }
  6878. } else {
  6879. if (\count($input->getArgument('packages')) === 0) {
  6880. throw new \InvalidArgumentException('You must pass one or more package names to be reinstalled.');
  6881. }
  6882. foreach ($input->getArgument('packages') as $pattern) {
  6883. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  6884. $matched = false;
  6885. foreach ($localRepo->getCanonicalPackages() as $package) {
  6886. if (Preg::isMatch($patternRegexp, $package->getName())) {
  6887. $matched = true;
  6888. $packagesToReinstall[] = $package;
  6889. $packageNamesToReinstall[] = $package->getName();
  6890. }
  6891. }
  6892. if (!$matched) {
  6893. $io->writeError('<warning>Pattern "' . $pattern . '" does not match any currently installed packages.</warning>');
  6894. }
  6895. }
  6896. }
  6897. if (0 === \count($packagesToReinstall)) {
  6898. $io->writeError('<warning>Found no packages to reinstall, aborting.</warning>');
  6899. return 1;
  6900. }
  6901. $uninstallOperations = [];
  6902. foreach ($packagesToReinstall as $package) {
  6903. $uninstallOperations[] = new UninstallOperation($package);
  6904. }
  6905. $presentPackages = $localRepo->getPackages();
  6906. $resultPackages = $presentPackages;
  6907. foreach ($presentPackages as $index => $package) {
  6908. if (in_array($package->getName(), $packageNamesToReinstall, true)) {
  6909. unset($presentPackages[$index]);
  6910. }
  6911. }
  6912. $transaction = new Transaction($presentPackages, $resultPackages);
  6913. $installOperations = $transaction->getOperations();
  6914. $installOrder = [];
  6915. foreach ($installOperations as $index => $op) {
  6916. if ($op instanceof InstallOperation && !$op->getPackage() instanceof AliasPackage) {
  6917. $installOrder[$op->getPackage()->getName()] = $index;
  6918. }
  6919. }
  6920. usort($uninstallOperations, static function ($a, $b) use ($installOrder): int {
  6921. return $installOrder[$b->getPackage()->getName()] - $installOrder[$a->getPackage()->getName()];
  6922. });
  6923. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'reinstall', $input, $output);
  6924. $eventDispatcher = $composer->getEventDispatcher();
  6925. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  6926. $config = $composer->getConfig();
  6927. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  6928. $installationManager = $composer->getInstallationManager();
  6929. $downloadManager = $composer->getDownloadManager();
  6930. $package = $composer->getPackage();
  6931. $installationManager->setOutputProgress(!$input->getOption('no-progress'));
  6932. if ($input->getOption('no-plugins')) {
  6933. $installationManager->disablePlugins();
  6934. }
  6935. $downloadManager->setPreferSource($preferSource);
  6936. $downloadManager->setPreferDist($preferDist);
  6937. $devMode = $localRepo->getDevMode() !== null ? $localRepo->getDevMode() : true;
  6938. Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
  6939. $eventDispatcher->dispatchScript(ScriptEvents::PRE_INSTALL_CMD, $devMode);
  6940. $installationManager->execute($localRepo, $uninstallOperations, $devMode);
  6941. $installationManager->execute($localRepo, $installOperations, $devMode);
  6942. if (!$input->getOption('no-autoloader')) {
  6943. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6944. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6945. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  6946. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6947. $generator = $composer->getAutoloadGenerator();
  6948. $generator->setClassMapAuthoritative($authoritative);
  6949. $generator->setApcu($apcu, $apcuPrefix);
  6950. $generator->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input));
  6951. $generator->dump(
  6952. $config,
  6953. $localRepo,
  6954. $package,
  6955. $installationManager,
  6956. 'composer',
  6957. $optimize,
  6958. null,
  6959. $composer->getLocker()
  6960. );
  6961. }
  6962. $eventDispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, $devMode);
  6963. return 0;
  6964. }
  6965. }
  6966. <?php declare(strict_types=1);
  6967. namespace Composer\Command;
  6968. use Composer\Config\JsonConfigSource;
  6969. use Composer\DependencyResolver\Request;
  6970. use Composer\Installer;
  6971. use Composer\Pcre\Preg;
  6972. use Composer\Plugin\CommandEvent;
  6973. use Composer\Plugin\PluginEvents;
  6974. use Composer\Json\JsonFile;
  6975. use Composer\Factory;
  6976. use Symfony\Component\Console\Exception\InvalidArgumentException;
  6977. use Symfony\Component\Console\Input\InputInterface;
  6978. use Composer\Console\Input\InputOption;
  6979. use Composer\Console\Input\InputArgument;
  6980. use Symfony\Component\Console\Output\OutputInterface;
  6981. use Composer\Package\BasePackage;
  6982. use Composer\Advisory\Auditor;
  6983. class RemoveCommand extends BaseCommand
  6984. {
  6985. use CompletionTrait;
  6986. protected function configure()
  6987. {
  6988. $this
  6989. ->setName('remove')
  6990. ->setAliases(['rm', 'uninstall'])
  6991. ->setDescription('Removes a package from the require or require-dev')
  6992. ->setDefinition([
  6993. new InputArgument('packages', InputArgument::IS_ARRAY, 'Packages that should be removed.', null, $this->suggestRootRequirement()),
  6994. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  6995. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6996. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6997. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
  6998. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  6999. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  7000. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  7001. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  7002. new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecated, is now default behavior)'),
  7003. new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  7004. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
  7005. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  7006. new InputOption('minimal-changes', 'm', InputOption::VALUE_NONE, 'During an update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).'),
  7007. new InputOption('unused', null, InputOption::VALUE_NONE, 'Remove all packages which are locked but not required by any other package.'),
  7008. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  7009. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  7010. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  7011. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  7012. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  7013. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  7014. ])
  7015. ->setHelp(
  7016. <<<EOT
  7017. The <info>remove</info> command removes a package from the current
  7018. list of installed packages
  7019. <info>php composer.phar remove</info>
  7020. Read more at https://getcomposer.org/doc/03-cli.md#remove-rm
  7021. EOT
  7022. )
  7023. ;
  7024. }
  7025. protected function execute(InputInterface $input, OutputInterface $output): int
  7026. {
  7027. if ($input->getArgument('packages') === [] && !$input->getOption('unused')) {
  7028. throw new InvalidArgumentException('Not enough arguments (missing: "packages").');
  7029. }
  7030. $packages = $input->getArgument('packages');
  7031. $packages = array_map('strtolower', $packages);
  7032. if ($input->getOption('unused')) {
  7033. $composer = $this->requireComposer();
  7034. $locker = $composer->getLocker();
  7035. if (!$locker->isLocked()) {
  7036. throw new \UnexpectedValueException('A valid composer.lock file is required to run this command with --unused');
  7037. }
  7038. $lockedPackages = $locker->getLockedRepository()->getPackages();
  7039. $required = [];
  7040. foreach (array_merge($composer->getPackage()->getRequires(), $composer->getPackage()->getDevRequires()) as $link) {
  7041. $required[$link->getTarget()] = true;
  7042. }
  7043. do {
  7044. $found = false;
  7045. foreach ($lockedPackages as $index => $package) {
  7046. foreach ($package->getNames() as $name) {
  7047. if (isset($required[$name])) {
  7048. foreach ($package->getRequires() as $link) {
  7049. $required[$link->getTarget()] = true;
  7050. }
  7051. $found = true;
  7052. unset($lockedPackages[$index]);
  7053. break;
  7054. }
  7055. }
  7056. }
  7057. } while ($found);
  7058. $unused = [];
  7059. foreach ($lockedPackages as $package) {
  7060. $unused[] = $package->getName();
  7061. }
  7062. $packages = array_merge($packages, $unused);
  7063. if (count($packages) === 0) {
  7064. $this->getIO()->writeError('<info>No unused packages to remove</info>');
  7065. return 0;
  7066. }
  7067. }
  7068. $file = Factory::getComposerFile();
  7069. $jsonFile = new JsonFile($file);
  7070. $composer = $jsonFile->read();
  7071. $composerBackup = file_get_contents($jsonFile->getPath());
  7072. $json = new JsonConfigSource($jsonFile);
  7073. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  7074. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  7075. $io = $this->getIO();
  7076. if ($input->getOption('update-with-dependencies')) {
  7077. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  7078. }
  7079. foreach (['require', 'require-dev'] as $linkType) {
  7080. if (isset($composer[$linkType])) {
  7081. foreach ($composer[$linkType] as $name => $version) {
  7082. $composer[$linkType][strtolower($name)] = $name;
  7083. }
  7084. }
  7085. }
  7086. $dryRun = $input->getOption('dry-run');
  7087. $toRemove = [];
  7088. foreach ($packages as $package) {
  7089. if (isset($composer[$type][$package])) {
  7090. if ($dryRun) {
  7091. $toRemove[$type][] = $composer[$type][$package];
  7092. } else {
  7093. $json->removeLink($type, $composer[$type][$package]);
  7094. }
  7095. } elseif (isset($composer[$altType][$package])) {
  7096. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  7097. if ($io->isInteractive()) {
  7098. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
  7099. if ($dryRun) {
  7100. $toRemove[$altType][] = $composer[$altType][$package];
  7101. } else {
  7102. $json->removeLink($altType, $composer[$altType][$package]);
  7103. }
  7104. }
  7105. }
  7106. } elseif (isset($composer[$type]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) > 0) {
  7107. foreach ($matches as $matchedPackage) {
  7108. if ($dryRun) {
  7109. $toRemove[$type][] = $matchedPackage;
  7110. } else {
  7111. $json->removeLink($type, $matchedPackage);
  7112. }
  7113. }
  7114. } elseif (isset($composer[$altType]) && count($matches = Preg::grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) > 0) {
  7115. foreach ($matches as $matchedPackage) {
  7116. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  7117. if ($io->isInteractive()) {
  7118. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
  7119. if ($dryRun) {
  7120. $toRemove[$altType][] = $matchedPackage;
  7121. } else {
  7122. $json->removeLink($altType, $matchedPackage);
  7123. }
  7124. }
  7125. }
  7126. }
  7127. } else {
  7128. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  7129. }
  7130. }
  7131. $io->writeError('<info>'.$file.' has been updated</info>');
  7132. if ($input->getOption('no-update')) {
  7133. return 0;
  7134. }
  7135. if ($composer = $this->tryComposer()) {
  7136. $composer->getPluginManager()->deactivateInstalledPlugins();
  7137. }
  7138. $this->resetComposer();
  7139. $composer = $this->requireComposer();
  7140. if ($dryRun) {
  7141. $rootPackage = $composer->getPackage();
  7142. $links = [
  7143. 'require' => $rootPackage->getRequires(),
  7144. 'require-dev' => $rootPackage->getDevRequires(),
  7145. ];
  7146. foreach ($toRemove as $type => $names) {
  7147. foreach ($names as $name) {
  7148. unset($links[$type][$name]);
  7149. }
  7150. }
  7151. $rootPackage->setRequires($links['require']);
  7152. $rootPackage->setDevRequires($links['require-dev']);
  7153. }
  7154. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  7155. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7156. $allowPlugins = $composer->getConfig()->get('allow-plugins');
  7157. $removedPlugins = is_array($allowPlugins) ? array_intersect(array_keys($allowPlugins), $packages) : [];
  7158. if (!$dryRun && is_array($allowPlugins) && count($removedPlugins) > 0) {
  7159. if (count($allowPlugins) === count($removedPlugins)) {
  7160. $json->removeConfigSetting('allow-plugins');
  7161. } else {
  7162. foreach ($removedPlugins as $plugin) {
  7163. $json->removeConfigSetting('allow-plugins.'.$plugin);
  7164. }
  7165. }
  7166. }
  7167. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  7168. $install = Installer::create($io, $composer);
  7169. $updateDevMode = !$input->getOption('update-no-dev');
  7170. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  7171. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  7172. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  7173. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  7174. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  7175. $flags = '';
  7176. if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
  7177. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  7178. $flags .= ' --with-all-dependencies';
  7179. } elseif ($input->getOption('no-update-with-dependencies')) {
  7180. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  7181. $flags .= ' --with-dependencies';
  7182. }
  7183. $io->writeError('<info>Running composer update '.implode(' ', $packages).$flags.'</info>');
  7184. $install
  7185. ->setVerbose($input->getOption('verbose'))
  7186. ->setDevMode($updateDevMode)
  7187. ->setOptimizeAutoloader($optimize)
  7188. ->setClassMapAuthoritative($authoritative)
  7189. ->setApcuAutoloader($apcu, $apcuPrefix)
  7190. ->setUpdate(true)
  7191. ->setInstall(!$input->getOption('no-install'))
  7192. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  7193. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  7194. ->setDryRun($dryRun)
  7195. ->setAudit(!$input->getOption('no-audit'))
  7196. ->setAuditFormat($this->getAuditFormat($input))
  7197. ->setMinimalUpdate($input->getOption('minimal-changes'))
  7198. ;
  7199. if ($composer->getLocker()->isLocked()) {
  7200. $install->setUpdateAllowList($packages);
  7201. }
  7202. $status = $install->run();
  7203. if ($status !== 0) {
  7204. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  7205. file_put_contents($jsonFile->getPath(), $composerBackup);
  7206. }
  7207. if (!$dryRun) {
  7208. foreach ($packages as $package) {
  7209. if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) {
  7210. $io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>');
  7211. return 2;
  7212. }
  7213. }
  7214. }
  7215. return $status;
  7216. }
  7217. }
  7218. <?php declare(strict_types=1);
  7219. namespace Composer\Command;
  7220. use Composer\DependencyResolver\Request;
  7221. use Composer\Package\AliasPackage;
  7222. use Composer\Package\CompletePackageInterface;
  7223. use Composer\Package\Loader\RootPackageLoader;
  7224. use Composer\Package\Locker;
  7225. use Composer\Package\PackageInterface;
  7226. use Composer\Package\Version\VersionBumper;
  7227. use Composer\Package\Version\VersionSelector;
  7228. use Composer\Pcre\Preg;
  7229. use Composer\Repository\RepositorySet;
  7230. use Composer\Util\Filesystem;
  7231. use Composer\Util\PackageSorter;
  7232. use Seld\Signal\SignalHandler;
  7233. use Symfony\Component\Console\Input\InputInterface;
  7234. use Composer\Console\Input\InputArgument;
  7235. use Composer\Console\Input\InputOption;
  7236. use Symfony\Component\Console\Output\OutputInterface;
  7237. use Composer\Factory;
  7238. use Composer\Installer;
  7239. use Composer\Installer\InstallerEvents;
  7240. use Composer\Json\JsonFile;
  7241. use Composer\Json\JsonManipulator;
  7242. use Composer\Package\Version\VersionParser;
  7243. use Composer\Package\Loader\ArrayLoader;
  7244. use Composer\Package\BasePackage;
  7245. use Composer\Plugin\CommandEvent;
  7246. use Composer\Plugin\PluginEvents;
  7247. use Composer\Repository\CompositeRepository;
  7248. use Composer\Repository\PlatformRepository;
  7249. use Composer\IO\IOInterface;
  7250. use Composer\Advisory\Auditor;
  7251. use Composer\Util\Silencer;
  7252. class RequireCommand extends BaseCommand
  7253. {
  7254. use CompletionTrait;
  7255. use PackageDiscoveryTrait;
  7256. private $newlyCreated;
  7257. private $firstRequire;
  7258. private $json;
  7259. private $file;
  7260. private $composerBackup;
  7261. private $lock;
  7262. private $lockBackup;
  7263. private $dependencyResolutionCompleted = false;
  7264. protected function configure()
  7265. {
  7266. $this
  7267. ->setName('require')
  7268. ->setAliases(['r'])
  7269. ->setDescription('Adds required packages to your composer.json and installs them')
  7270. ->setDefinition([
  7271. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"', null, $this->suggestAvailablePackageInclPlatform()),
  7272. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  7273. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  7274. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  7275. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  7276. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  7277. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  7278. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  7279. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  7280. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies (implies --no-install).'),
  7281. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  7282. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  7283. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  7284. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  7285. new InputOption('update-with-dependencies', 'w', InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  7286. new InputOption('update-with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  7287. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-dependencies'),
  7288. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Alias for --update-with-all-dependencies'),
  7289. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  7290. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  7291. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies (can also be set via the COMPOSER_PREFER_STABLE=1 env var).'),
  7292. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies (can also be set via the COMPOSER_PREFER_LOWEST=1 env var).'),
  7293. new InputOption('minimal-changes', 'm', InputOption::VALUE_NONE, 'During an update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).'),
  7294. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  7295. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  7296. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  7297. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  7298. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  7299. ])
  7300. ->setHelp(
  7301. <<<EOT
  7302. The require command adds required packages to your composer.json and installs them.
  7303. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  7304. matches to require.
  7305. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  7306. If you do not want to install the new dependencies immediately you can call it with --no-update
  7307. Read more at https://getcomposer.org/doc/03-cli.md#require-r
  7308. EOT
  7309. )
  7310. ;
  7311. }
  7312. protected function execute(InputInterface $input, OutputInterface $output): int
  7313. {
  7314. $this->file = Factory::getComposerFile();
  7315. $io = $this->getIO();
  7316. if ($input->getOption('no-suggest')) {
  7317. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  7318. }
  7319. $this->newlyCreated = !file_exists($this->file);
  7320. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  7321. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  7322. return 1;
  7323. }
  7324. if (!Filesystem::isReadable($this->file)) {
  7325. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  7326. return 1;
  7327. }
  7328. if (filesize($this->file) === 0) {
  7329. file_put_contents($this->file, "{\n}\n");
  7330. }
  7331. $this->json = new JsonFile($this->file);
  7332. $this->lock = Factory::getLockFile($this->file);
  7333. $this->composerBackup = file_get_contents($this->json->getPath());
  7334. $this->lockBackup = file_exists($this->lock) ? file_get_contents($this->lock) : null;
  7335. $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) {
  7336. $this->getIO()->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
  7337. $this->revertComposerFile();
  7338. $handler->exitWithLastSignal();
  7339. });
  7340. if (!is_writable($this->file) && false === Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  7341. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  7342. return 1;
  7343. }
  7344. if ($input->getOption('fixed') === true) {
  7345. $config = $this->json->read();
  7346. $packageType = empty($config['type']) ? 'library' : $config['type'];
  7347. if ($packageType !== 'project' && !$input->getOption('dev')) {
  7348. $io->writeError('<error>The "--fixed" option is only allowed for packages with a "project" type or for dev dependencies to prevent possible misuses.</error>');
  7349. if (!isset($config['type'])) {
  7350. $io->writeError('<error>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</error>');
  7351. }
  7352. return 1;
  7353. }
  7354. }
  7355. $composer = $this->requireComposer();
  7356. $repos = $composer->getRepositoryManager()->getRepositories();
  7357. $platformOverrides = $composer->getConfig()->get('platform');
  7358. $this->repos = new CompositeRepository(array_merge(
  7359. [$platformRepo = new PlatformRepository([], $platformOverrides)],
  7360. $repos
  7361. ));
  7362. if ($composer->getPackage()->getPreferStable()) {
  7363. $preferredStability = 'stable';
  7364. } else {
  7365. $preferredStability = $composer->getPackage()->getMinimumStability();
  7366. }
  7367. try {
  7368. $requirements = $this->determineRequirements(
  7369. $input,
  7370. $output,
  7371. $input->getArgument('packages'),
  7372. $platformRepo,
  7373. $preferredStability,
  7374. $input->getOption('no-update'),
  7375. $input->getOption('fixed')
  7376. );
  7377. } catch (\Exception $e) {
  7378. if ($this->newlyCreated) {
  7379. $this->revertComposerFile();
  7380. throw new \RuntimeException('No composer.json present in the current directory ('.$this->file.'), this may be the cause of the following exception.', 0, $e);
  7381. }
  7382. throw $e;
  7383. }
  7384. $requirements = $this->formatRequirements($requirements);
  7385. if (!$input->getOption('dev') && $io->isInteractive()) {
  7386. $devPackages = [];
  7387. $devTags = ['dev', 'testing', 'static analysis'];
  7388. $currentRequiresByKey = $this->getPackagesByRequireKey();
  7389. foreach ($requirements as $name => $version) {
  7390. if (isset($currentRequiresByKey[$name])) {
  7391. continue;
  7392. }
  7393. $pkg = PackageSorter::getMostCurrentVersion($this->getRepos()->findPackages($name));
  7394. if ($pkg instanceof CompletePackageInterface) {
  7395. $pkgDevTags = array_intersect($devTags, array_map('strtolower', $pkg->getKeywords()));
  7396. if (count($pkgDevTags) > 0) {
  7397. $devPackages[] = $pkgDevTags;
  7398. }
  7399. }
  7400. }
  7401. if (count($devPackages) === count($requirements)) {
  7402. $plural = count($requirements) > 1 ? 's' : '';
  7403. $plural2 = count($requirements) > 1 ? 'are' : 'is';
  7404. $plural3 = count($requirements) > 1 ? 'they are' : 'it is';
  7405. $pkgDevTags = array_unique(array_merge(...$devPackages));
  7406. $io->warning('The package'.$plural.' you required '.$plural2.' recommended to be placed in require-dev (because '.$plural3.' tagged as "'.implode('", "', $pkgDevTags).'") but you did not use --dev.');
  7407. if ($io->askConfirmation('<info>Do you want to re-run the command with --dev?</> [<comment>yes</>]? ')) {
  7408. $input->setOption('dev', true);
  7409. }
  7410. }
  7411. unset($devPackages, $pkgDevTags);
  7412. }
  7413. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  7414. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  7415. $requirementsToGuess = [];
  7416. foreach ($requirements as $package => $constraint) {
  7417. if ($constraint === 'guess') {
  7418. $requirements[$package] = '*';
  7419. $requirementsToGuess[] = $package;
  7420. }
  7421. }
  7422. $versionParser = new VersionParser();
  7423. foreach ($requirements as $package => $constraint) {
  7424. if (strtolower($package) === $composer->getPackage()->getName()) {
  7425. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  7426. return 1;
  7427. }
  7428. if ($constraint === 'self.version') {
  7429. continue;
  7430. }
  7431. $versionParser->parseConstraints($constraint);
  7432. }
  7433. $inconsistentRequireKeys = $this->getInconsistentRequireKeys($requirements, $requireKey);
  7434. if (count($inconsistentRequireKeys) > 0) {
  7435. foreach ($inconsistentRequireKeys as $package) {
  7436. $io->warning(sprintf(
  7437. '%s is currently present in the %s key and you ran the command %s the --dev flag, which will move it to the %s key.',
  7438. $package,
  7439. $removeKey,
  7440. $input->getOption('dev') ? 'with' : 'without',
  7441. $requireKey
  7442. ));
  7443. }
  7444. if ($io->isInteractive()) {
  7445. if (!$io->askConfirmation(sprintf('<info>Do you want to move %s?</info> [<comment>no</comment>]? ', count($inconsistentRequireKeys) > 1 ? 'these requirements' : 'this requirement'), false)) {
  7446. if (!$io->askConfirmation(sprintf('<info>Do you want to re-run the command %s --dev?</info> [<comment>yes</comment>]? ', $input->getOption('dev') ? 'without' : 'with'), true)) {
  7447. return 0;
  7448. }
  7449. $input->setOption('dev', true);
  7450. [$requireKey, $removeKey] = [$removeKey, $requireKey];
  7451. }
  7452. }
  7453. }
  7454. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  7455. $this->firstRequire = $this->newlyCreated;
  7456. if (!$this->firstRequire) {
  7457. $composerDefinition = $this->json->read();
  7458. if (count($composerDefinition['require'] ?? []) === 0 && count($composerDefinition['require-dev'] ?? []) === 0) {
  7459. $this->firstRequire = true;
  7460. }
  7461. }
  7462. if (!$input->getOption('dry-run')) {
  7463. $this->updateFile($this->json, $requirements, $requireKey, $removeKey, $sortPackages);
  7464. }
  7465. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  7466. if ($input->getOption('no-update')) {
  7467. return 0;
  7468. }
  7469. $composer->getPluginManager()->deactivateInstalledPlugins();
  7470. try {
  7471. $result = $this->doUpdate($input, $output, $io, $requirements, $requireKey, $removeKey);
  7472. if ($result === 0 && count($requirementsToGuess) > 0) {
  7473. $result = $this->updateRequirementsAfterResolution($requirementsToGuess, $requireKey, $removeKey, $sortPackages, $input->getOption('dry-run'), $input->getOption('fixed'));
  7474. }
  7475. return $result;
  7476. } catch (\Exception $e) {
  7477. if (!$this->dependencyResolutionCompleted) {
  7478. $this->revertComposerFile();
  7479. }
  7480. throw $e;
  7481. } finally {
  7482. if ($input->getOption('dry-run') && $this->newlyCreated) {
  7483. @unlink($this->json->getPath());
  7484. }
  7485. $signalHandler->unregister();
  7486. }
  7487. }
  7488. private function getInconsistentRequireKeys(array $newRequirements, string $requireKey): array
  7489. {
  7490. $requireKeys = $this->getPackagesByRequireKey();
  7491. $inconsistentRequirements = [];
  7492. foreach ($requireKeys as $package => $packageRequireKey) {
  7493. if (!isset($newRequirements[$package])) {
  7494. continue;
  7495. }
  7496. if ($requireKey !== $packageRequireKey) {
  7497. $inconsistentRequirements[] = $package;
  7498. }
  7499. }
  7500. return $inconsistentRequirements;
  7501. }
  7502. private function getPackagesByRequireKey(): array
  7503. {
  7504. $composerDefinition = $this->json->read();
  7505. $require = [];
  7506. $requireDev = [];
  7507. if (isset($composerDefinition['require'])) {
  7508. $require = $composerDefinition['require'];
  7509. }
  7510. if (isset($composerDefinition['require-dev'])) {
  7511. $requireDev = $composerDefinition['require-dev'];
  7512. }
  7513. return array_merge(
  7514. array_fill_keys(array_keys($require), 'require'),
  7515. array_fill_keys(array_keys($requireDev), 'require-dev')
  7516. );
  7517. }
  7518. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, string $requireKey, string $removeKey): int
  7519. {
  7520. $this->resetComposer();
  7521. $composer = $this->requireComposer();
  7522. $this->dependencyResolutionCompleted = false;
  7523. $composer->getEventDispatcher()->addListener(InstallerEvents::PRE_OPERATIONS_EXEC, function (): void {
  7524. $this->dependencyResolutionCompleted = true;
  7525. }, 10000);
  7526. if ($input->getOption('dry-run')) {
  7527. $rootPackage = $composer->getPackage();
  7528. $links = [
  7529. 'require' => $rootPackage->getRequires(),
  7530. 'require-dev' => $rootPackage->getDevRequires(),
  7531. ];
  7532. $loader = new ArrayLoader();
  7533. $newLinks = $loader->parseLinks($rootPackage->getName(), $rootPackage->getPrettyVersion(), BasePackage::$supportedLinkTypes[$requireKey]['method'], $requirements);
  7534. $links[$requireKey] = array_merge($links[$requireKey], $newLinks);
  7535. foreach ($requirements as $package => $constraint) {
  7536. unset($links[$removeKey][$package]);
  7537. }
  7538. $rootPackage->setRequires($links['require']);
  7539. $rootPackage->setDevRequires($links['require-dev']);
  7540. $references = $rootPackage->getReferences();
  7541. $references = RootPackageLoader::extractReferences($requirements, $references);
  7542. $rootPackage->setReferences($references);
  7543. $stabilityFlags = $rootPackage->getStabilityFlags();
  7544. $stabilityFlags = RootPackageLoader::extractStabilityFlags($requirements, $rootPackage->getMinimumStability(), $stabilityFlags);
  7545. $rootPackage->setStabilityFlags($stabilityFlags);
  7546. unset($stabilityFlags, $references);
  7547. }
  7548. $updateDevMode = !$input->getOption('update-no-dev');
  7549. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  7550. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  7551. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  7552. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  7553. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  7554. $flags = '';
  7555. if ($input->getOption('update-with-all-dependencies') || $input->getOption('with-all-dependencies')) {
  7556. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  7557. $flags .= ' --with-all-dependencies';
  7558. } elseif ($input->getOption('update-with-dependencies') || $input->getOption('with-dependencies')) {
  7559. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  7560. $flags .= ' --with-dependencies';
  7561. }
  7562. $io->writeError('<info>Running composer update '.implode(' ', array_keys($requirements)).$flags.'</info>');
  7563. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  7564. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7565. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  7566. $install = Installer::create($io, $composer);
  7567. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($composer->getConfig(), $input);
  7568. $install
  7569. ->setDryRun($input->getOption('dry-run'))
  7570. ->setVerbose($input->getOption('verbose'))
  7571. ->setPreferSource($preferSource)
  7572. ->setPreferDist($preferDist)
  7573. ->setDevMode($updateDevMode)
  7574. ->setOptimizeAutoloader($optimize)
  7575. ->setClassMapAuthoritative($authoritative)
  7576. ->setApcuAutoloader($apcu, $apcuPrefix)
  7577. ->setUpdate(true)
  7578. ->setInstall(!$input->getOption('no-install'))
  7579. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  7580. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  7581. ->setPreferStable($input->getOption('prefer-stable'))
  7582. ->setPreferLowest($input->getOption('prefer-lowest'))
  7583. ->setAudit(!$input->getOption('no-audit'))
  7584. ->setAuditFormat($this->getAuditFormat($input))
  7585. ->setMinimalUpdate($input->getOption('minimal-changes'))
  7586. ;
  7587. if (!$this->firstRequire && $composer->getLocker()->isLocked()) {
  7588. $install->setUpdateAllowList(array_keys($requirements));
  7589. }
  7590. $status = $install->run();
  7591. if ($status !== 0 && $status !== Installer::ERROR_AUDIT_FAILED) {
  7592. if ($status === Installer::ERROR_DEPENDENCY_RESOLUTION_FAILED) {
  7593. foreach ($this->normalizeRequirements($input->getArgument('packages')) as $req) {
  7594. if (!isset($req['version'])) {
  7595. $io->writeError('You can also try re-running composer require with an explicit version constraint, e.g. "composer require '.$req['name'].':*" to figure out if any version is installable, or "composer require '.$req['name'].':^2.1" if you know which you need.');
  7596. break;
  7597. }
  7598. }
  7599. }
  7600. $this->revertComposerFile();
  7601. }
  7602. return $status;
  7603. }
  7604. private function updateRequirementsAfterResolution(array $requirementsToUpdate, string $requireKey, string $removeKey, bool $sortPackages, bool $dryRun, bool $fixed): int
  7605. {
  7606. $composer = $this->requireComposer();
  7607. $locker = $composer->getLocker();
  7608. $requirements = [];
  7609. $versionSelector = new VersionSelector(new RepositorySet());
  7610. $repo = $locker->isLocked() ? $composer->getLocker()->getLockedRepository(true) : $composer->getRepositoryManager()->getLocalRepository();
  7611. foreach ($requirementsToUpdate as $packageName) {
  7612. $package = $repo->findPackage($packageName, '*');
  7613. while ($package instanceof AliasPackage) {
  7614. $package = $package->getAliasOf();
  7615. }
  7616. if (!$package instanceof PackageInterface) {
  7617. continue;
  7618. }
  7619. if ($fixed) {
  7620. $requirements[$packageName] = $package->getPrettyVersion();
  7621. } else {
  7622. $requirements[$packageName] = $versionSelector->findRecommendedRequireVersion($package);
  7623. }
  7624. $this->getIO()->writeError(sprintf(
  7625. 'Using version <info>%s</info> for <info>%s</info>',
  7626. $requirements[$packageName],
  7627. $packageName
  7628. ));
  7629. if (Preg::isMatch('{^dev-(?!main$|master$|trunk$|latest$)}', $requirements[$packageName])) {
  7630. $this->getIO()->warning('Version '.$requirements[$packageName].' looks like it may be a feature branch which is unlikely to keep working in the long run and may be in an unstable state');
  7631. if ($this->getIO()->isInteractive() && !$this->getIO()->askConfirmation('Are you sure you want to use this constraint (<comment>Y</comment>) or would you rather abort (<comment>n</comment>) the whole operation [<comment>Y,n</comment>]? ')) {
  7632. $this->revertComposerFile();
  7633. return 1;
  7634. }
  7635. }
  7636. }
  7637. if (!$dryRun) {
  7638. $this->updateFile($this->json, $requirements, $requireKey, $removeKey, $sortPackages);
  7639. if ($locker->isLocked() && $composer->getConfig()->get('lock')) {
  7640. $stabilityFlags = RootPackageLoader::extractStabilityFlags($requirements, $composer->getPackage()->getMinimumStability(), []);
  7641. $locker->updateHash($this->json, function (array $lockData) use ($stabilityFlags) {
  7642. foreach ($stabilityFlags as $packageName => $flag) {
  7643. $lockData['stability-flags'][$packageName] = $flag;
  7644. }
  7645. return $lockData;
  7646. });
  7647. }
  7648. }
  7649. return 0;
  7650. }
  7651. private function updateFile(JsonFile $json, array $new, string $requireKey, string $removeKey, bool $sortPackages): void
  7652. {
  7653. if ($this->updateFileCleanly($json, $new, $requireKey, $removeKey, $sortPackages)) {
  7654. return;
  7655. }
  7656. $composerDefinition = $this->json->read();
  7657. foreach ($new as $package => $version) {
  7658. $composerDefinition[$requireKey][$package] = $version;
  7659. unset($composerDefinition[$removeKey][$package]);
  7660. if (isset($composerDefinition[$removeKey]) && count($composerDefinition[$removeKey]) === 0) {
  7661. unset($composerDefinition[$removeKey]);
  7662. }
  7663. }
  7664. $this->json->write($composerDefinition);
  7665. }
  7666. private function updateFileCleanly(JsonFile $json, array $new, string $requireKey, string $removeKey, bool $sortPackages): bool
  7667. {
  7668. $contents = file_get_contents($json->getPath());
  7669. $manipulator = new JsonManipulator($contents);
  7670. foreach ($new as $package => $constraint) {
  7671. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  7672. return false;
  7673. }
  7674. if (!$manipulator->removeSubNode($removeKey, $package)) {
  7675. return false;
  7676. }
  7677. }
  7678. $manipulator->removeMainKeyIfEmpty($removeKey);
  7679. file_put_contents($json->getPath(), $manipulator->getContents());
  7680. return true;
  7681. }
  7682. protected function interact(InputInterface $input, OutputInterface $output): void
  7683. {
  7684. }
  7685. private function revertComposerFile(): void
  7686. {
  7687. $io = $this->getIO();
  7688. if ($this->newlyCreated) {
  7689. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  7690. unlink($this->json->getPath());
  7691. if (file_exists($this->lock)) {
  7692. unlink($this->lock);
  7693. }
  7694. } else {
  7695. $msg = ' to its ';
  7696. if ($this->lockBackup) {
  7697. $msg = ' and '.$this->lock.' to their ';
  7698. }
  7699. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.$msg.'original content.</error>');
  7700. file_put_contents($this->json->getPath(), $this->composerBackup);
  7701. if ($this->lockBackup) {
  7702. file_put_contents($this->lock, $this->lockBackup);
  7703. }
  7704. }
  7705. }
  7706. }
  7707. <?php declare(strict_types=1);
  7708. namespace Composer\Command;
  7709. use Composer\Script\Event as ScriptEvent;
  7710. use Composer\Script\ScriptEvents;
  7711. use Composer\Util\ProcessExecutor;
  7712. use Composer\Util\Platform;
  7713. use Symfony\Component\Console\Input\InputInterface;
  7714. use Composer\Console\Input\InputOption;
  7715. use Composer\Console\Input\InputArgument;
  7716. use Symfony\Component\Console\Output\OutputInterface;
  7717. class RunScriptCommand extends BaseCommand
  7718. {
  7719. protected $scriptEvents = [
  7720. ScriptEvents::PRE_INSTALL_CMD,
  7721. ScriptEvents::POST_INSTALL_CMD,
  7722. ScriptEvents::PRE_UPDATE_CMD,
  7723. ScriptEvents::POST_UPDATE_CMD,
  7724. ScriptEvents::PRE_STATUS_CMD,
  7725. ScriptEvents::POST_STATUS_CMD,
  7726. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  7727. ScriptEvents::POST_CREATE_PROJECT_CMD,
  7728. ScriptEvents::PRE_ARCHIVE_CMD,
  7729. ScriptEvents::POST_ARCHIVE_CMD,
  7730. ScriptEvents::PRE_AUTOLOAD_DUMP,
  7731. ScriptEvents::POST_AUTOLOAD_DUMP,
  7732. ];
  7733. protected function configure(): void
  7734. {
  7735. $this
  7736. ->setName('run-script')
  7737. ->setAliases(['run'])
  7738. ->setDescription('Runs the scripts defined in composer.json')
  7739. ->setDefinition([
  7740. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.', null, function () {
  7741. return array_map(static function ($script) { return $script['name']; }, $this->getScripts());
  7742. }),
  7743. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  7744. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  7745. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  7746. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  7747. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  7748. ])
  7749. ->setHelp(
  7750. <<<EOT
  7751. The <info>run-script</info> command runs scripts defined in composer.json:
  7752. <info>php composer.phar run-script post-update-cmd</info>
  7753. Read more at https://getcomposer.org/doc/03-cli.md#run-script-run
  7754. EOT
  7755. )
  7756. ;
  7757. }
  7758. protected function interact(InputInterface $input, OutputInterface $output): void
  7759. {
  7760. $scripts = $this->getScripts();
  7761. if (count($scripts) === 0) {
  7762. return;
  7763. }
  7764. if ($input->getArgument('script') !== null || $input->getOption('list')) {
  7765. return;
  7766. }
  7767. $options = [];
  7768. foreach ($scripts as $script) {
  7769. $options[$script['name']] = $script['description'];
  7770. }
  7771. $io = $this->getIO();
  7772. $script = $io->select(
  7773. 'Script to run: ',
  7774. $options,
  7775. '',
  7776. 1,
  7777. 'Invalid script name "%s"'
  7778. );
  7779. $input->setArgument('script', $script);
  7780. }
  7781. protected function execute(InputInterface $input, OutputInterface $output): int
  7782. {
  7783. if ($input->getOption('list')) {
  7784. return $this->listScripts($output);
  7785. }
  7786. $script = $input->getArgument('script');
  7787. if ($script === null) {
  7788. throw new \RuntimeException('Missing required argument "script"');
  7789. }
  7790. if (!in_array($script, $this->scriptEvents)) {
  7791. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7792. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  7793. }
  7794. }
  7795. $composer = $this->requireComposer();
  7796. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  7797. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  7798. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  7799. if (!$hasListeners) {
  7800. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  7801. }
  7802. $args = $input->getArgument('args');
  7803. if (null !== $timeout = $input->getOption('timeout')) {
  7804. if (!ctype_digit($timeout)) {
  7805. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  7806. }
  7807. ProcessExecutor::setTimeout((int) $timeout);
  7808. }
  7809. Platform::putEnv('COMPOSER_DEV_MODE', $devMode ? '1' : '0');
  7810. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  7811. }
  7812. protected function listScripts(OutputInterface $output): int
  7813. {
  7814. $scripts = $this->getScripts();
  7815. if (count($scripts) === 0) {
  7816. return 0;
  7817. }
  7818. $io = $this->getIO();
  7819. $io->writeError('<info>scripts:</info>');
  7820. $table = [];
  7821. foreach ($scripts as $script) {
  7822. $table[] = [' '.$script['name'], $script['description']];
  7823. }
  7824. $this->renderTable($table, $output);
  7825. return 0;
  7826. }
  7827. private function getScripts(): array
  7828. {
  7829. $scripts = $this->requireComposer()->getPackage()->getScripts();
  7830. if (count($scripts) === 0) {
  7831. return [];
  7832. }
  7833. $result = [];
  7834. foreach ($scripts as $name => $script) {
  7835. $description = '';
  7836. try {
  7837. $cmd = $this->getApplication()->find($name);
  7838. if ($cmd instanceof ScriptAliasCommand) {
  7839. $description = $cmd->getDescription();
  7840. }
  7841. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  7842. }
  7843. $result[] = ['name' => $name, 'description' => $description];
  7844. }
  7845. return $result;
  7846. }
  7847. }
  7848. <?php declare(strict_types=1);
  7849. namespace Composer\Command;
  7850. use Composer\Pcre\Preg;
  7851. use Symfony\Component\Console\Input\InputInterface;
  7852. use Composer\Console\Input\InputOption;
  7853. use Composer\Console\Input\InputArgument;
  7854. use Symfony\Component\Console\Output\OutputInterface;
  7855. class ScriptAliasCommand extends BaseCommand
  7856. {
  7857. private $script;
  7858. private $description;
  7859. private $aliases;
  7860. public function __construct(string $script, ?string $description, array $aliases = [])
  7861. {
  7862. $this->script = $script;
  7863. $this->description = $description ?? 'Runs the '.$script.' script as defined in composer.json';
  7864. $this->aliases = $aliases;
  7865. foreach ($this->aliases as $alias) {
  7866. if (!is_string($alias)) {
  7867. throw new \InvalidArgumentException('"scripts-aliases" element array values should contain only strings');
  7868. }
  7869. }
  7870. $this->ignoreValidationErrors();
  7871. parent::__construct();
  7872. }
  7873. protected function configure(): void
  7874. {
  7875. $this
  7876. ->setName($this->script)
  7877. ->setDescription($this->description)
  7878. ->setAliases($this->aliases)
  7879. ->setDefinition([
  7880. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  7881. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  7882. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  7883. ])
  7884. ->setHelp(
  7885. <<<EOT
  7886. The <info>run-script</info> command runs scripts defined in composer.json:
  7887. <info>php composer.phar run-script post-update-cmd</info>
  7888. Read more at https://getcomposer.org/doc/03-cli.md#run-script-run
  7889. EOT
  7890. )
  7891. ;
  7892. }
  7893. protected function execute(InputInterface $input, OutputInterface $output): int
  7894. {
  7895. $composer = $this->requireComposer();
  7896. $args = $input->getArguments();
  7897. if (!method_exists($input, '__toString')) {
  7898. throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
  7899. }
  7900. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args'], ['script-alias-input' => Preg::replace('{^\S+ ?}', '', $input->__toString(), 1)]);
  7901. }
  7902. }
  7903. <?php declare(strict_types=1);
  7904. namespace Composer\Command;
  7905. use Composer\Factory;
  7906. use Composer\Json\JsonFile;
  7907. use Symfony\Component\Console\Formatter\OutputFormatter;
  7908. use Symfony\Component\Console\Input\InputInterface;
  7909. use Composer\Console\Input\InputArgument;
  7910. use Composer\Console\Input\InputOption;
  7911. use Symfony\Component\Console\Output\OutputInterface;
  7912. use Composer\Repository\CompositeRepository;
  7913. use Composer\Repository\PlatformRepository;
  7914. use Composer\Repository\RepositoryInterface;
  7915. use Composer\Plugin\CommandEvent;
  7916. use Composer\Plugin\PluginEvents;
  7917. class SearchCommand extends BaseCommand
  7918. {
  7919. protected function configure(): void
  7920. {
  7921. $this
  7922. ->setName('search')
  7923. ->setDescription('Searches for packages')
  7924. ->setDefinition([
  7925. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in package names'),
  7926. new InputOption('only-vendor', 'O', InputOption::VALUE_NONE, 'Search only for vendor / organization names, returns only "vendor" as result'),
  7927. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  7928. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  7929. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  7930. ])
  7931. ->setHelp(
  7932. <<<EOT
  7933. The search command searches for packages by its name
  7934. <info>php composer.phar search symfony composer</info>
  7935. Read more at https://getcomposer.org/doc/03-cli.md#search
  7936. EOT
  7937. )
  7938. ;
  7939. }
  7940. protected function execute(InputInterface $input, OutputInterface $output): int
  7941. {
  7942. $platformRepo = new PlatformRepository;
  7943. $io = $this->getIO();
  7944. $format = $input->getOption('format');
  7945. if (!in_array($format, ['text', 'json'])) {
  7946. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  7947. return 1;
  7948. }
  7949. if (!($composer = $this->tryComposer())) {
  7950. $composer = $this->createComposerInstance($input, $this->getIO(), []);
  7951. }
  7952. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  7953. $installedRepo = new CompositeRepository([$localRepo, $platformRepo]);
  7954. $repos = new CompositeRepository(array_merge([$installedRepo], $composer->getRepositoryManager()->getRepositories()));
  7955. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  7956. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7957. $mode = RepositoryInterface::SEARCH_FULLTEXT;
  7958. if ($input->getOption('only-name') === true) {
  7959. if ($input->getOption('only-vendor') === true) {
  7960. throw new \InvalidArgumentException('--only-name and --only-vendor cannot be used together');
  7961. }
  7962. $mode = RepositoryInterface::SEARCH_NAME;
  7963. } elseif ($input->getOption('only-vendor') === true) {
  7964. $mode = RepositoryInterface::SEARCH_VENDOR;
  7965. }
  7966. $type = $input->getOption('type');
  7967. $query = implode(' ', $input->getArgument('tokens'));
  7968. if ($mode !== RepositoryInterface::SEARCH_FULLTEXT) {
  7969. $query = preg_quote($query);
  7970. }
  7971. $results = $repos->search($query, $mode, $type);
  7972. if (\count($results) > 0 && $format === 'text') {
  7973. $width = $this->getTerminalWidth();
  7974. $nameLength = 0;
  7975. foreach ($results as $result) {
  7976. $nameLength = max(strlen($result['name']), $nameLength);
  7977. }
  7978. $nameLength += 1;
  7979. foreach ($results as $result) {
  7980. $description = $result['description'] ?? '';
  7981. $warning = !empty($result['abandoned']) ? '<warning>! Abandoned !</warning> ' : '';
  7982. $remaining = $width - $nameLength - strlen($warning) - 2;
  7983. if (strlen($description) > $remaining) {
  7984. $description = substr($description, 0, $remaining - 3) . '...';
  7985. }
  7986. $link = $result['url'] ?? null;
  7987. if ($link !== null) {
  7988. $io->write('<href='.OutputFormatter::escape($link).'>'.$result['name'].'</>'. str_repeat(' ', $nameLength - strlen($result['name'])) . $warning . $description);
  7989. } else {
  7990. $io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description);
  7991. }
  7992. }
  7993. } elseif ($format === 'json') {
  7994. $io->write(JsonFile::encode($results));
  7995. }
  7996. return 0;
  7997. }
  7998. }
  7999. <?php declare(strict_types=1);
  8000. namespace Composer\Command;
  8001. use Composer\Composer;
  8002. use Composer\Factory;
  8003. use Composer\Config;
  8004. use Composer\Pcre\Preg;
  8005. use Composer\Util\Filesystem;
  8006. use Composer\Util\Platform;
  8007. use Composer\SelfUpdate\Keys;
  8008. use Composer\SelfUpdate\Versions;
  8009. use Composer\IO\IOInterface;
  8010. use Composer\Downloader\FilesystemException;
  8011. use Composer\Downloader\TransportException;
  8012. use Symfony\Component\Console\Input\InputInterface;
  8013. use Composer\Console\Input\InputOption;
  8014. use Composer\Console\Input\InputArgument;
  8015. use Symfony\Component\Console\Output\OutputInterface;
  8016. use Symfony\Component\Finder\Finder;
  8017. class SelfUpdateCommand extends BaseCommand
  8018. {
  8019. private const HOMEPAGE = 'getcomposer.org';
  8020. private const OLD_INSTALL_EXT = '-old.phar';
  8021. protected function configure(): void
  8022. {
  8023. $this
  8024. ->setName('self-update')
  8025. ->setAliases(['selfupdate'])
  8026. ->setDescription('Updates composer.phar to the latest version')
  8027. ->setDefinition([
  8028. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  8029. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  8030. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  8031. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  8032. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  8033. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  8034. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  8035. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  8036. new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
  8037. new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
  8038. new InputOption('2.2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.2.x LTS versions'),
  8039. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  8040. ])
  8041. ->setHelp(
  8042. <<<EOT
  8043. The <info>self-update</info> command checks getcomposer.org for newer
  8044. versions of composer and if found, installs the latest.
  8045. <info>php composer.phar self-update</info>
  8046. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate
  8047. EOT
  8048. )
  8049. ;
  8050. }
  8051. protected function execute(InputInterface $input, OutputInterface $output): int
  8052. {
  8053. if ($_SERVER['argv'][0] === 'Standard input code') {
  8054. return 1;
  8055. }
  8056. class_exists('Composer\Util\Platform');
  8057. class_exists('Composer\Downloader\FilesystemException');
  8058. $config = Factory::createConfig();
  8059. if ($config->get('disable-tls') === true) {
  8060. $baseUrl = 'http://' . self::HOMEPAGE;
  8061. } else {
  8062. $baseUrl = 'https://' . self::HOMEPAGE;
  8063. }
  8064. $io = $this->getIO();
  8065. $httpDownloader = Factory::createHttpDownloader($io, $config);
  8066. $versionsUtil = new Versions($config, $httpDownloader);
  8067. $requestedChannel = null;
  8068. foreach (Versions::CHANNELS as $channel) {
  8069. if ($input->getOption($channel)) {
  8070. $requestedChannel = $channel;
  8071. $versionsUtil->setChannel($channel, $io);
  8072. break;
  8073. }
  8074. }
  8075. if ($input->getOption('set-channel-only')) {
  8076. return 0;
  8077. }
  8078. $cacheDir = $config->get('cache-dir');
  8079. $rollbackDir = $config->get('data-dir');
  8080. $home = $config->get('home');
  8081. $localFilename = realpath($_SERVER['argv'][0]);
  8082. if (false === $localFilename) {
  8083. $localFilename = $_SERVER['argv'][0];
  8084. }
  8085. if ($input->getOption('update-keys')) {
  8086. $this->fetchKeys($io, $config);
  8087. return 0;
  8088. }
  8089. if (!file_exists($localFilename)) {
  8090. throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
  8091. }
  8092. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  8093. if (!is_writable($tmpDir)) {
  8094. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  8095. }
  8096. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  8097. $composerUser = posix_getpwuid(posix_geteuid());
  8098. $homeDirOwnerId = fileowner($home);
  8099. if (is_array($composerUser) && $homeDirOwnerId !== false) {
  8100. $homeOwner = posix_getpwuid($homeDirOwnerId);
  8101. if (is_array($homeOwner) && $composerUser['name'] !== $homeOwner['name']) {
  8102. $io->writeError('<warning>You are running Composer as "'.$composerUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  8103. }
  8104. }
  8105. }
  8106. if ($input->getOption('rollback')) {
  8107. return $this->rollback($output, $rollbackDir, $localFilename);
  8108. }
  8109. if ($input->getArgument('command') === 'self' && $input->getArgument('version') === 'update') {
  8110. $input->setArgument('version', null);
  8111. }
  8112. $latest = $versionsUtil->getLatest();
  8113. $latestStable = $versionsUtil->getLatest('stable');
  8114. try {
  8115. $latestPreview = $versionsUtil->getLatest('preview');
  8116. } catch (\UnexpectedValueException $e) {
  8117. $latestPreview = $latestStable;
  8118. }
  8119. $latestVersion = $latest['version'];
  8120. $updateVersion = $input->getArgument('version') ?? $latestVersion;
  8121. $currentMajorVersion = Preg::replace('{^(\d+).*}', '$1', Composer::getVersion());
  8122. $updateMajorVersion = Preg::replace('{^(\d+).*}', '$1', $updateVersion);
  8123. $previewMajorVersion = Preg::replace('{^(\d+).*}', '$1', $latestPreview['version']);
  8124. if ($versionsUtil->getChannel() === 'stable' && null === $input->getArgument('version')) {
  8125. if ($currentMajorVersion < $updateMajorVersion) {
  8126. $skippedVersion = $updateVersion;
  8127. $versionsUtil->setChannel($currentMajorVersion);
  8128. $latest = $versionsUtil->getLatest();
  8129. $latestStable = $versionsUtil->getLatest('stable');
  8130. $latestVersion = $latest['version'];
  8131. $updateVersion = $latestVersion;
  8132. $io->writeError('<warning>A new stable major version of Composer is available ('.$skippedVersion.'), run "composer self-update --'.$updateMajorVersion.'" to update to it. See also https://getcomposer.org/'.$updateMajorVersion.'</warning>');
  8133. } elseif ($currentMajorVersion < $previewMajorVersion) {
  8134. $io->writeError('<warning>A preview release of the next major version of Composer is available ('.$latestPreview['version'].'), run "composer self-update --preview" to give it a try. See also https://github.com/composer/composer/releases for changelogs.</warning>');
  8135. }
  8136. }
  8137. $effectiveChannel = $requestedChannel === null ? $versionsUtil->getChannel() : $requestedChannel;
  8138. if (is_numeric($effectiveChannel) && strpos($latestStable['version'], $effectiveChannel) !== 0) {
  8139. $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$effectiveChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  8140. }
  8141. if (isset($latest['eol'])) {
  8142. $io->writeError('<warning>Warning: Version '.$latestVersion.' is EOL / End of Life. '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  8143. }
  8144. if (Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  8145. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  8146. return 1;
  8147. }
  8148. $channelString = $versionsUtil->getChannel();
  8149. if (is_numeric($channelString)) {
  8150. $channelString .= '.x';
  8151. }
  8152. if (Composer::VERSION === $updateVersion) {
  8153. $io->writeError(
  8154. sprintf(
  8155. '<info>You are already using the latest available Composer version %s (%s channel).</info>',
  8156. $updateVersion,
  8157. $channelString
  8158. )
  8159. );
  8160. if ($input->getOption('clean-backups')) {
  8161. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  8162. }
  8163. return 0;
  8164. }
  8165. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp'.random_int(0, 10000000).'.phar';
  8166. $backupFile = sprintf(
  8167. '%s/%s-%s%s',
  8168. $rollbackDir,
  8169. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  8170. Preg::replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  8171. self::OLD_INSTALL_EXT
  8172. );
  8173. $updatingToTag = !Preg::isMatch('{^[0-9a-f]{40}$}', $updateVersion);
  8174. $io->write(sprintf("Upgrading to version <info>%s</info> (%s channel).", $updateVersion, $channelString));
  8175. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  8176. try {
  8177. $signature = $httpDownloader->get($remoteFilename.'.sig')->getBody();
  8178. } catch (TransportException $e) {
  8179. if ($e->getStatusCode() === 404) {
  8180. throw new \InvalidArgumentException('Version "'.$updateVersion.'" could not be found.', 0, $e);
  8181. }
  8182. throw $e;
  8183. }
  8184. $io->writeError(' ', false);
  8185. $httpDownloader->copy($remoteFilename, $tempFilename);
  8186. $io->writeError('');
  8187. if (!file_exists($tempFilename) || null === $signature || '' === $signature) {
  8188. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  8189. return 1;
  8190. }
  8191. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  8192. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  8193. } else {
  8194. if (!extension_loaded('openssl')) {
  8195. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  8196. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  8197. }
  8198. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  8199. if (!file_exists($sigFile)) {
  8200. file_put_contents(
  8201. $home.'/keys.dev.pub',
  8202. <<<DEVPUBKEY
  8203. -----BEGIN PUBLIC KEY-----
  8204. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  8205. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  8206. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  8207. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  8208. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  8209. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  8210. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  8211. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  8212. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  8213. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  8214. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  8215. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  8216. -----END PUBLIC KEY-----
  8217. DEVPUBKEY
  8218. );
  8219. file_put_contents(
  8220. $home.'/keys.tags.pub',
  8221. <<<TAGSPUBKEY
  8222. -----BEGIN PUBLIC KEY-----
  8223. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  8224. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  8225. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  8226. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  8227. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  8228. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  8229. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  8230. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  8231. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  8232. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  8233. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  8234. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  8235. -----END PUBLIC KEY-----
  8236. TAGSPUBKEY
  8237. );
  8238. }
  8239. $pubkeyid = openssl_pkey_get_public($sigFile);
  8240. if (false === $pubkeyid) {
  8241. throw new \RuntimeException('Failed loading the public key from '.$sigFile);
  8242. }
  8243. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  8244. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()), true)) {
  8245. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  8246. }
  8247. $signatureData = json_decode($signature, true);
  8248. $signatureSha384 = base64_decode($signatureData['sha384'], true);
  8249. if (false === $signatureSha384) {
  8250. throw new \RuntimeException('Failed loading the phar signature from '.$remoteFilename.'.sig, got '.$signature);
  8251. }
  8252. $verified = 1 === openssl_verify((string) file_get_contents($tempFilename), $signatureSha384, $pubkeyid, $algo);
  8253. if (\PHP_VERSION_ID < 80000) {
  8254. openssl_free_key($pubkeyid);
  8255. }
  8256. if (!$verified) {
  8257. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  8258. }
  8259. }
  8260. if ($input->getOption('clean-backups')) {
  8261. $this->cleanBackups($rollbackDir);
  8262. }
  8263. if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  8264. @unlink($tempFilename);
  8265. return 1;
  8266. }
  8267. if (file_exists($backupFile)) {
  8268. $io->writeError(sprintf(
  8269. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  8270. Composer::VERSION
  8271. ));
  8272. } else {
  8273. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  8274. }
  8275. return 0;
  8276. }
  8277. protected function fetchKeys(IOInterface $io, Config $config): void
  8278. {
  8279. if (!$io->isInteractive()) {
  8280. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  8281. }
  8282. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  8283. $validator = static function ($value): string {
  8284. $value = (string) $value;
  8285. if (!Preg::isMatch('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  8286. throw new \UnexpectedValueException('Invalid input');
  8287. }
  8288. return trim($value)."\n";
  8289. };
  8290. $devKey = '';
  8291. while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  8292. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  8293. while ($line = $io->ask('', '')) {
  8294. $devKey .= trim($line)."\n";
  8295. if (trim($line) === '-----END PUBLIC KEY-----') {
  8296. break;
  8297. }
  8298. }
  8299. }
  8300. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  8301. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  8302. $tagsKey = '';
  8303. while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  8304. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  8305. while ($line = $io->ask('', '')) {
  8306. $tagsKey .= trim($line)."\n";
  8307. if (trim($line) === '-----END PUBLIC KEY-----') {
  8308. break;
  8309. }
  8310. }
  8311. }
  8312. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  8313. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  8314. $io->write('Public keys stored in '.$config->get('home'));
  8315. }
  8316. protected function rollback(OutputInterface $output, string $rollbackDir, string $localFilename): int
  8317. {
  8318. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  8319. if (null === $rollbackVersion) {
  8320. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  8321. }
  8322. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  8323. if (!is_file($oldFile)) {
  8324. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  8325. }
  8326. if (!Filesystem::isReadable($oldFile)) {
  8327. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  8328. }
  8329. $io = $this->getIO();
  8330. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  8331. if (!$this->setLocalPhar($localFilename, $oldFile)) {
  8332. return 1;
  8333. }
  8334. return 0;
  8335. }
  8336. protected function setLocalPhar(string $localFilename, string $newFilename, ?string $backupTarget = null): bool
  8337. {
  8338. $io = $this->getIO();
  8339. $perms = @fileperms($localFilename);
  8340. if ($perms !== false) {
  8341. @chmod($newFilename, $perms);
  8342. }
  8343. if (!$this->validatePhar($newFilename, $error)) {
  8344. $io->writeError('<error>The '.($backupTarget !== null ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
  8345. if ($backupTarget !== null) {
  8346. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  8347. }
  8348. return false;
  8349. }
  8350. if ($backupTarget !== null) {
  8351. @copy($localFilename, $backupTarget);
  8352. }
  8353. try {
  8354. if (Platform::isWindows()) {
  8355. copy($newFilename, $localFilename);
  8356. @unlink($newFilename);
  8357. } else {
  8358. rename($newFilename, $localFilename);
  8359. }
  8360. return true;
  8361. } catch (\Exception $e) {
  8362. if (!is_writable(dirname($localFilename))
  8363. && $io->isInteractive()
  8364. && $this->isWindowsNonAdminUser()) {
  8365. return $this->tryAsWindowsAdmin($localFilename, $newFilename);
  8366. }
  8367. @unlink($newFilename);
  8368. $action = 'Composer '.($backupTarget !== null ? 'update' : 'rollback');
  8369. throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
  8370. }
  8371. }
  8372. protected function cleanBackups(string $rollbackDir, ?string $except = null): void
  8373. {
  8374. $finder = $this->getOldInstallationFinder($rollbackDir);
  8375. $io = $this->getIO();
  8376. $fs = new Filesystem;
  8377. foreach ($finder as $file) {
  8378. if ($file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  8379. continue;
  8380. }
  8381. $file = (string) $file;
  8382. $io->writeError('<info>Removing: '.$file.'</info>');
  8383. $fs->remove($file);
  8384. }
  8385. }
  8386. protected function getLastBackupVersion(string $rollbackDir): ?string
  8387. {
  8388. $finder = $this->getOldInstallationFinder($rollbackDir);
  8389. $finder->sortByName();
  8390. $files = iterator_to_array($finder);
  8391. if (count($files) > 0) {
  8392. return end($files)->getBasename(self::OLD_INSTALL_EXT);
  8393. }
  8394. return null;
  8395. }
  8396. protected function getOldInstallationFinder(string $rollbackDir): Finder
  8397. {
  8398. return Finder::create()
  8399. ->depth(0)
  8400. ->files()
  8401. ->name('*' . self::OLD_INSTALL_EXT)
  8402. ->in($rollbackDir);
  8403. }
  8404. protected function validatePhar(string $pharFile, ?string &$error): bool
  8405. {
  8406. if ((bool) ini_get('phar.readonly')) {
  8407. return true;
  8408. }
  8409. try {
  8410. $phar = new \Phar($pharFile);
  8411. unset($phar);
  8412. $result = true;
  8413. } catch (\Exception $e) {
  8414. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  8415. throw $e;
  8416. }
  8417. $error = $e->getMessage();
  8418. $result = false;
  8419. }
  8420. return $result;
  8421. }
  8422. protected function isWindowsNonAdminUser(): bool
  8423. {
  8424. if (!Platform::isWindows()) {
  8425. return false;
  8426. }
  8427. exec('fltmc.exe filters', $output, $exitCode);
  8428. return $exitCode !== 0;
  8429. }
  8430. protected function tryAsWindowsAdmin(string $localFilename, string $newFilename): bool
  8431. {
  8432. $io = $this->getIO();
  8433. $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
  8434. $helpMessage = 'Please run the self-update command as an Administrator.';
  8435. $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
  8436. if (!$io->askConfirmation($question, true)) {
  8437. $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
  8438. return false;
  8439. }
  8440. $tmpFile = tempnam(sys_get_temp_dir(), '');
  8441. if (false === $tmpFile) {
  8442. $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
  8443. return false;
  8444. }
  8445. $script = $tmpFile.'.vbs';
  8446. rename($tmpFile, $script);
  8447. $checksum = hash_file('sha256', $newFilename);
  8448. $source = str_replace('/', '\\', $newFilename);
  8449. $destination = str_replace('/', '\\', $localFilename);
  8450. $vbs = <<<EOT
  8451. Set UAC = CreateObject("Shell.Application")
  8452. UAC.ShellExecute "cmd.exe", "/c copy /b /y ""$source"" ""$destination""", "", "runas", 0
  8453. Wscript.Sleep(300)
  8454. EOT;
  8455. file_put_contents($script, $vbs);
  8456. exec('"'.$script.'"');
  8457. @unlink($script);
  8458. if ($result = Filesystem::isReadable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {
  8459. $io->writeError('<info>Operation succeeded.</info>');
  8460. @unlink($newFilename);
  8461. } else {
  8462. $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');
  8463. }
  8464. return $result;
  8465. }
  8466. }
  8467. <?php declare(strict_types=1);
  8468. namespace Composer\Command;
  8469. use Composer\Composer;
  8470. use Composer\DependencyResolver\DefaultPolicy;
  8471. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  8472. use Composer\IO\IOInterface;
  8473. use Composer\Json\JsonFile;
  8474. use Composer\Package\BasePackage;
  8475. use Composer\Package\CompletePackageInterface;
  8476. use Composer\Package\Link;
  8477. use Composer\Package\AliasPackage;
  8478. use Composer\Package\PackageInterface;
  8479. use Composer\Package\Version\VersionParser;
  8480. use Composer\Package\Version\VersionSelector;
  8481. use Composer\Pcre\Preg;
  8482. use Composer\Plugin\CommandEvent;
  8483. use Composer\Plugin\PluginEvents;
  8484. use Composer\Repository\ArrayRepository;
  8485. use Composer\Repository\InstalledArrayRepository;
  8486. use Composer\Repository\ComposerRepository;
  8487. use Composer\Repository\CompositeRepository;
  8488. use Composer\Repository\FilterRepository;
  8489. use Composer\Repository\PlatformRepository;
  8490. use Composer\Repository\RepositoryFactory;
  8491. use Composer\Repository\InstalledRepository;
  8492. use Composer\Repository\RepositoryInterface;
  8493. use Composer\Repository\RepositorySet;
  8494. use Composer\Repository\RepositoryUtils;
  8495. use Composer\Repository\RootPackageRepository;
  8496. use Composer\Semver\Constraint\ConstraintInterface;
  8497. use Composer\Semver\Semver;
  8498. use Composer\Spdx\SpdxLicenses;
  8499. use Composer\Util\PackageInfo;
  8500. use DateTimeInterface;
  8501. use Symfony\Component\Console\Completion\CompletionInput;
  8502. use Symfony\Component\Console\Formatter\OutputFormatter;
  8503. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  8504. use Composer\Console\Input\InputArgument;
  8505. use Symfony\Component\Console\Input\InputInterface;
  8506. use Composer\Console\Input\InputOption;
  8507. use Symfony\Component\Console\Output\OutputInterface;
  8508. class ShowCommand extends BaseCommand
  8509. {
  8510. use CompletionTrait;
  8511. protected $versionParser;
  8512. protected $colors;
  8513. private $repositorySet;
  8514. protected function configure()
  8515. {
  8516. $this
  8517. ->setName('show')
  8518. ->setAliases(['info'])
  8519. ->setDescription('Shows information about packages')
  8520. ->setDefinition([
  8521. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.', null, $this->suggestPackageBasedOnMode()),
  8522. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  8523. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  8524. new InputOption('locked', null, InputOption::VALUE_NONE, 'List all locked packages'),
  8525. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  8526. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  8527. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  8528. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  8529. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  8530. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  8531. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  8532. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  8533. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  8534. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Can contain wildcards (*). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.', null, $this->suggestInstalledPackage(false)),
  8535. new InputOption('major-only', 'M', InputOption::VALUE_NONE, 'Show only packages that have major SemVer-compatible updates. Use with the --latest or --outdated option.'),
  8536. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --latest or --outdated option.'),
  8537. new InputOption('patch-only', null, InputOption::VALUE_NONE, 'Show only packages that have patch SemVer-compatible updates. Use with the --latest or --outdated option.'),
  8538. new InputOption('sort-by-age', 'A', InputOption::VALUE_NONE, 'Displays the installed version\'s age, and sorts packages oldest first. Use with the --latest or --outdated option.'),
  8539. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  8540. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  8541. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text', ['json', 'text']),
  8542. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  8543. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages). Use with the --outdated option'),
  8544. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages). Use with the --outdated option'),
  8545. ])
  8546. ->setHelp(
  8547. <<<EOT
  8548. The show command displays detailed information about a package, or
  8549. lists all packages available.
  8550. Read more at https://getcomposer.org/doc/03-cli.md#show-info
  8551. EOT
  8552. )
  8553. ;
  8554. }
  8555. protected function suggestPackageBasedOnMode(): \Closure
  8556. {
  8557. return function (CompletionInput $input) {
  8558. if ($input->getOption('available') || $input->getOption('all')) {
  8559. return $this->suggestAvailablePackageInclPlatform()($input);
  8560. }
  8561. if ($input->getOption('platform')) {
  8562. return $this->suggestPlatformPackage()($input);
  8563. }
  8564. return $this->suggestInstalledPackage(false)($input);
  8565. };
  8566. }
  8567. protected function execute(InputInterface $input, OutputInterface $output): int
  8568. {
  8569. $this->versionParser = new VersionParser;
  8570. if ($input->getOption('tree')) {
  8571. $this->initStyles($output);
  8572. }
  8573. $composer = $this->tryComposer();
  8574. $io = $this->getIO();
  8575. if ($input->getOption('installed') && !$input->getOption('self')) {
  8576. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  8577. }
  8578. if ($input->getOption('outdated')) {
  8579. $input->setOption('latest', true);
  8580. } elseif (count($input->getOption('ignore')) > 0) {
  8581. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  8582. }
  8583. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  8584. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  8585. return 1;
  8586. }
  8587. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  8588. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  8589. return 1;
  8590. }
  8591. if (count(array_filter([$input->getOption('patch-only'), $input->getOption('minor-only'), $input->getOption('major-only')])) > 1) {
  8592. $io->writeError('Only one of --major-only, --minor-only or --patch-only can be used at once');
  8593. return 1;
  8594. }
  8595. if ($input->getOption('tree') && $input->getOption('latest')) {
  8596. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  8597. return 1;
  8598. }
  8599. if ($input->getOption('tree') && $input->getOption('path')) {
  8600. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  8601. return 1;
  8602. }
  8603. $format = $input->getOption('format');
  8604. if (!in_array($format, ['text', 'json'])) {
  8605. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  8606. return 1;
  8607. }
  8608. $platformReqFilter = $this->getPlatformRequirementFilter($input);
  8609. $platformOverrides = [];
  8610. if ($composer) {
  8611. $platformOverrides = $composer->getConfig()->get('platform');
  8612. }
  8613. $platformRepo = new PlatformRepository([], $platformOverrides);
  8614. $lockedRepo = null;
  8615. if ($input->getOption('self') && !$input->getOption('installed') && !$input->getOption('locked')) {
  8616. $package = clone $this->requireComposer()->getPackage();
  8617. if ($input->getOption('name-only')) {
  8618. $io->write($package->getName());
  8619. return 0;
  8620. }
  8621. if ($input->getArgument('package')) {
  8622. throw new \InvalidArgumentException('You cannot use --self together with a package name');
  8623. }
  8624. $repos = $installedRepo = new InstalledRepository([new RootPackageRepository($package)]);
  8625. } elseif ($input->getOption('platform')) {
  8626. $repos = $installedRepo = new InstalledRepository([$platformRepo]);
  8627. } elseif ($input->getOption('available')) {
  8628. $installedRepo = new InstalledRepository([$platformRepo]);
  8629. if ($composer) {
  8630. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  8631. $installedRepo->addRepository($composer->getRepositoryManager()->getLocalRepository());
  8632. } else {
  8633. $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
  8634. $repos = new CompositeRepository($defaultRepos);
  8635. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  8636. }
  8637. } elseif ($input->getOption('all') && $composer) {
  8638. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  8639. $locker = $composer->getLocker();
  8640. if ($locker->isLocked()) {
  8641. $lockedRepo = $locker->getLockedRepository(true);
  8642. $installedRepo = new InstalledRepository([$lockedRepo, $localRepo, $platformRepo]);
  8643. } else {
  8644. $installedRepo = new InstalledRepository([$localRepo, $platformRepo]);
  8645. }
  8646. $repos = new CompositeRepository(array_merge([new FilterRepository($installedRepo, ['canonical' => false])], $composer->getRepositoryManager()->getRepositories()));
  8647. } elseif ($input->getOption('all')) {
  8648. $defaultRepos = RepositoryFactory::defaultReposWithDefaultManager($io);
  8649. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  8650. $installedRepo = new InstalledRepository([$platformRepo]);
  8651. $repos = new CompositeRepository(array_merge([$installedRepo], $defaultRepos));
  8652. } elseif ($input->getOption('locked')) {
  8653. if (!$composer || !$composer->getLocker()->isLocked()) {
  8654. throw new \UnexpectedValueException('A valid composer.json and composer.lock files is required to run this command with --locked');
  8655. }
  8656. $locker = $composer->getLocker();
  8657. $lockedRepo = $locker->getLockedRepository(!$input->getOption('no-dev'));
  8658. if ($input->getOption('self')) {
  8659. $lockedRepo->addPackage(clone $composer->getPackage());
  8660. }
  8661. $repos = $installedRepo = new InstalledRepository([$lockedRepo]);
  8662. } else {
  8663. if (!$composer) {
  8664. $composer = $this->requireComposer();
  8665. }
  8666. $rootPkg = $composer->getPackage();
  8667. $rootRepo = new InstalledArrayRepository();
  8668. if ($input->getOption('self')) {
  8669. $rootRepo = new RootPackageRepository(clone $rootPkg);
  8670. }
  8671. if ($input->getOption('no-dev')) {
  8672. $packages = RepositoryUtils::filterRequiredPackages($composer->getRepositoryManager()->getLocalRepository()->getPackages(), $rootPkg);
  8673. $repos = $installedRepo = new InstalledRepository([$rootRepo, new InstalledArrayRepository(array_map(static function ($pkg): PackageInterface {
  8674. return clone $pkg;
  8675. }, $packages))]);
  8676. } else {
  8677. $repos = $installedRepo = new InstalledRepository([$rootRepo, $composer->getRepositoryManager()->getLocalRepository()]);
  8678. }
  8679. if (!$installedRepo->getPackages()) {
  8680. $hasNonPlatformReqs = static function (array $reqs): bool {
  8681. return (bool) array_filter(array_keys($reqs), function (string $name) {
  8682. return !PlatformRepository::isPlatformPackage($name);
  8683. });
  8684. };
  8685. if ($hasNonPlatformReqs($rootPkg->getRequires()) || $hasNonPlatformReqs($rootPkg->getDevRequires())) {
  8686. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  8687. }
  8688. }
  8689. }
  8690. if ($composer) {
  8691. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  8692. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  8693. }
  8694. if ($input->getOption('latest') && null === $composer) {
  8695. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  8696. $input->setOption('latest', false);
  8697. }
  8698. $packageFilter = $input->getArgument('package');
  8699. if (isset($package)) {
  8700. $versions = [$package->getPrettyVersion() => $package->getVersion()];
  8701. } elseif (null !== $packageFilter && !str_contains($packageFilter, '*')) {
  8702. [$package, $versions] = $this->getPackage($installedRepo, $repos, $packageFilter, $input->getArgument('version'));
  8703. if (isset($package) && $input->getOption('direct')) {
  8704. if (!in_array($package->getName(), $this->getRootRequires(), true)) {
  8705. throw new \InvalidArgumentException('Package "' . $package->getName() . '" is installed but not a direct dependent of the root package.');
  8706. }
  8707. }
  8708. if (!isset($package)) {
  8709. $options = $input->getOptions();
  8710. $hint = '';
  8711. if ($input->getOption('locked')) {
  8712. $hint .= ' in lock file';
  8713. }
  8714. if (isset($options['working-dir'])) {
  8715. $hint .= ' in ' . $options['working-dir'] . '/composer.json';
  8716. }
  8717. if (PlatformRepository::isPlatformPackage($packageFilter) && !$input->getOption('platform')) {
  8718. $hint .= ', try using --platform (-p) to show platform packages';
  8719. }
  8720. if (!$input->getOption('all') && !$input->getOption('available')) {
  8721. $hint .= ', try using --available (-a) to show all available packages';
  8722. }
  8723. throw new \InvalidArgumentException('Package "' . $packageFilter . '" not found'.$hint.'.');
  8724. }
  8725. }
  8726. if (isset($package)) {
  8727. assert(isset($versions));
  8728. $exitCode = 0;
  8729. if ($input->getOption('tree')) {
  8730. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  8731. if ('json' === $format) {
  8732. $io->write(JsonFile::encode(['installed' => [$arrayTree]]));
  8733. } else {
  8734. $this->displayPackageTree([$arrayTree]);
  8735. }
  8736. return $exitCode;
  8737. }
  8738. $latestPackage = null;
  8739. if ($input->getOption('latest')) {
  8740. $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $input->getOption('major-only'), $input->getOption('minor-only'), $input->getOption('patch-only'), $platformReqFilter);
  8741. }
  8742. if (
  8743. $input->getOption('outdated')
  8744. && $input->getOption('strict')
  8745. && null !== $latestPackage
  8746. && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion()
  8747. && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned())
  8748. ) {
  8749. $exitCode = 1;
  8750. }
  8751. if ($input->getOption('path')) {
  8752. $io->write($package->getName(), false);
  8753. $path = $composer->getInstallationManager()->getInstallPath($package);
  8754. if (is_string($path)) {
  8755. $io->write(' ' . strtok(realpath($path), "\r\n"));
  8756. } else {
  8757. $io->write(' null');
  8758. }
  8759. return $exitCode;
  8760. }
  8761. if ('json' === $format) {
  8762. $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
  8763. } else {
  8764. $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
  8765. }
  8766. return $exitCode;
  8767. }
  8768. if ($input->getOption('tree')) {
  8769. $rootRequires = $this->getRootRequires();
  8770. $packages = $installedRepo->getPackages();
  8771. usort($packages, static function (BasePackage $a, BasePackage $b): int {
  8772. return strcmp((string) $a, (string) $b);
  8773. });
  8774. $arrayTree = [];
  8775. foreach ($packages as $package) {
  8776. if (in_array($package->getName(), $rootRequires, true)) {
  8777. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  8778. }
  8779. }
  8780. if ('json' === $format) {
  8781. $io->write(JsonFile::encode(['installed' => $arrayTree]));
  8782. } else {
  8783. $this->displayPackageTree($arrayTree);
  8784. }
  8785. return 0;
  8786. }
  8787. $packages = [];
  8788. $packageFilterRegex = null;
  8789. if (null !== $packageFilter) {
  8790. $packageFilterRegex = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  8791. }
  8792. $packageListFilter = null;
  8793. if ($input->getOption('direct')) {
  8794. $packageListFilter = $this->getRootRequires();
  8795. }
  8796. if ($input->getOption('path') && null === $composer) {
  8797. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  8798. $input->setOption('path', false);
  8799. }
  8800. foreach (RepositoryUtils::flattenRepositories($repos) as $repo) {
  8801. if ($repo === $platformRepo) {
  8802. $type = 'platform';
  8803. } elseif ($lockedRepo !== null && $repo === $lockedRepo) {
  8804. $type = 'locked';
  8805. } elseif ($repo === $installedRepo || in_array($repo, $installedRepo->getRepositories(), true)) {
  8806. $type = 'installed';
  8807. } else {
  8808. $type = 'available';
  8809. }
  8810. if ($repo instanceof ComposerRepository) {
  8811. foreach ($repo->getPackageNames($packageFilter) as $name) {
  8812. $packages[$type][$name] = $name;
  8813. }
  8814. } else {
  8815. foreach ($repo->getPackages() as $package) {
  8816. if (!isset($packages[$type][$package->getName()])
  8817. || !is_object($packages[$type][$package->getName()])
  8818. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  8819. ) {
  8820. while ($package instanceof AliasPackage) {
  8821. $package = $package->getAliasOf();
  8822. }
  8823. if (!$packageFilterRegex || Preg::isMatch($packageFilterRegex, $package->getName())) {
  8824. if (null === $packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  8825. $packages[$type][$package->getName()] = $package;
  8826. }
  8827. }
  8828. }
  8829. }
  8830. if ($repo === $platformRepo) {
  8831. foreach ($platformRepo->getDisabledPackages() as $name => $package) {
  8832. $packages[$type][$name] = $package;
  8833. }
  8834. }
  8835. }
  8836. }
  8837. $showAllTypes = $input->getOption('all');
  8838. $showLatest = $input->getOption('latest');
  8839. $showMajorOnly = $input->getOption('major-only');
  8840. $showMinorOnly = $input->getOption('minor-only');
  8841. $showPatchOnly = $input->getOption('patch-only');
  8842. $ignoredPackagesRegex = BasePackage::packageNamesToRegexp(array_map('strtolower', $input->getOption('ignore')));
  8843. $indent = $showAllTypes ? ' ' : '';
  8844. $latestPackages = [];
  8845. $exitCode = 0;
  8846. $viewData = [];
  8847. $viewMetaData = [];
  8848. $writeVersion = false;
  8849. $writeDescription = false;
  8850. foreach (['platform' => true, 'locked' => true, 'available' => false, 'installed' => true] as $type => $showVersion) {
  8851. if (isset($packages[$type])) {
  8852. ksort($packages[$type]);
  8853. $nameLength = $versionLength = $latestLength = $releaseDateLength = 0;
  8854. if ($showLatest && $showVersion) {
  8855. foreach ($packages[$type] as $package) {
  8856. if (is_object($package) && !Preg::isMatch($ignoredPackagesRegex, $package->getPrettyName())) {
  8857. $latestPackage = $this->findLatestPackage($package, $composer, $platformRepo, $showMajorOnly, $showMinorOnly, $showPatchOnly, $platformReqFilter);
  8858. if ($latestPackage === null) {
  8859. continue;
  8860. }
  8861. $latestPackages[$package->getPrettyName()] = $latestPackage;
  8862. }
  8863. }
  8864. }
  8865. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  8866. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  8867. $writeLatest = $writeVersion && $showLatest;
  8868. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  8869. $writeReleaseDate = $writeLatest && ($input->getOption('sort-by-age') || $format === 'json');
  8870. $hasOutdatedPackages = false;
  8871. if ($input->getOption('sort-by-age')) {
  8872. usort($packages[$type], function ($a, $b) {
  8873. if (is_object($a) && is_object($b)) {
  8874. return $a->getReleaseDate() <=> $b->getReleaseDate();
  8875. }
  8876. return 0;
  8877. });
  8878. }
  8879. $viewData[$type] = [];
  8880. foreach ($packages[$type] as $package) {
  8881. $packageViewData = [];
  8882. if (is_object($package)) {
  8883. $latestPackage = null;
  8884. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  8885. $latestPackage = $latestPackages[$package->getPrettyName()];
  8886. }
  8887. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && (!$latestPackage instanceof CompletePackageInterface || !$latestPackage->isAbandoned());
  8888. $packageIsUpToDate = $packageIsUpToDate || ($latestPackage === null && $showMajorOnly);
  8889. $packageIsIgnored = Preg::isMatch($ignoredPackagesRegex, $package->getPrettyName());
  8890. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  8891. continue;
  8892. }
  8893. if ($input->getOption('outdated') || $input->getOption('strict')) {
  8894. $hasOutdatedPackages = true;
  8895. }
  8896. $packageViewData['name'] = $package->getPrettyName();
  8897. $packageViewData['direct-dependency'] = in_array($package->getName(), $this->getRootRequires(), true);
  8898. if ($format !== 'json' || true !== $input->getOption('name-only')) {
  8899. $packageViewData['homepage'] = $package instanceof CompletePackageInterface ? $package->getHomepage() : null;
  8900. $packageViewData['source'] = PackageInfo::getViewSourceUrl($package);
  8901. }
  8902. $nameLength = max($nameLength, strlen($packageViewData['name']));
  8903. if ($writeVersion) {
  8904. $packageViewData['version'] = $package->getFullPrettyVersion();
  8905. if ($format === 'text') {
  8906. $packageViewData['version'] = ltrim($packageViewData['version'], 'v');
  8907. }
  8908. $versionLength = max($versionLength, strlen($packageViewData['version']));
  8909. }
  8910. if ($writeReleaseDate) {
  8911. if ($package->getReleaseDate() !== null) {
  8912. $packageViewData['release-age'] = str_replace(' ago', ' old', $this->getRelativeTime($package->getReleaseDate()));
  8913. if (!str_contains($packageViewData['release-age'], ' old')) {
  8914. $packageViewData['release-age'] = 'from '.$packageViewData['release-age'];
  8915. }
  8916. $releaseDateLength = max($releaseDateLength, strlen($packageViewData['release-age']));
  8917. $packageViewData['release-date'] = $package->getReleaseDate()->format(DateTimeInterface::ATOM);
  8918. } else {
  8919. $packageViewData['release-age'] = '';
  8920. $packageViewData['release-date'] = '';
  8921. }
  8922. }
  8923. if ($writeLatest && $latestPackage) {
  8924. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  8925. if ($format === 'text') {
  8926. $packageViewData['latest'] = ltrim($packageViewData['latest'], 'v');
  8927. }
  8928. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  8929. $latestLength = max($latestLength, strlen($packageViewData['latest']));
  8930. if ($latestPackage->getReleaseDate() !== null) {
  8931. $packageViewData['latest-release-date'] = $latestPackage->getReleaseDate()->format(DateTimeInterface::ATOM);
  8932. } else {
  8933. $packageViewData['latest-release-date'] = '';
  8934. }
  8935. } elseif ($writeLatest) {
  8936. $packageViewData['latest'] = '[none matched]';
  8937. $packageViewData['latest-status'] = 'up-to-date';
  8938. $latestLength = max($latestLength, strlen($packageViewData['latest']));
  8939. }
  8940. if ($writeDescription && $package instanceof CompletePackageInterface) {
  8941. $packageViewData['description'] = $package->getDescription();
  8942. }
  8943. if ($writePath) {
  8944. $path = $composer->getInstallationManager()->getInstallPath($package);
  8945. if (is_string($path)) {
  8946. $packageViewData['path'] = strtok(realpath($path), "\r\n");
  8947. } else {
  8948. $packageViewData['path'] = null;
  8949. }
  8950. }
  8951. $packageIsAbandoned = false;
  8952. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  8953. $replacementPackageName = $latestPackage->getReplacementPackage();
  8954. $replacement = $replacementPackageName !== null
  8955. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  8956. : 'No replacement was suggested';
  8957. $packageWarning = sprintf(
  8958. 'Package %s is abandoned, you should avoid using it. %s.',
  8959. $package->getPrettyName(),
  8960. $replacement
  8961. );
  8962. $packageViewData['warning'] = $packageWarning;
  8963. $packageIsAbandoned = $replacementPackageName ?? true;
  8964. }
  8965. $packageViewData['abandoned'] = $packageIsAbandoned;
  8966. } else {
  8967. $packageViewData['name'] = $package;
  8968. $nameLength = max($nameLength, strlen($package));
  8969. }
  8970. $viewData[$type][] = $packageViewData;
  8971. }
  8972. $viewMetaData[$type] = [
  8973. 'nameLength' => $nameLength,
  8974. 'versionLength' => $versionLength,
  8975. 'latestLength' => $latestLength,
  8976. 'releaseDateLength' => $releaseDateLength,
  8977. 'writeLatest' => $writeLatest,
  8978. 'writeReleaseDate' => $writeReleaseDate,
  8979. ];
  8980. if ($input->getOption('strict') && $hasOutdatedPackages) {
  8981. $exitCode = 1;
  8982. break;
  8983. }
  8984. }
  8985. }
  8986. if ('json' === $format) {
  8987. $io->write(JsonFile::encode($viewData));
  8988. } else {
  8989. if ($input->getOption('latest') && array_filter($viewData)) {
  8990. if (!$io->isDecorated()) {
  8991. $io->writeError('Legend:');
  8992. $io->writeError('! patch or minor release available - update recommended');
  8993. $io->writeError('~ major release available - update possible');
  8994. if (!$input->getOption('outdated')) {
  8995. $io->writeError('= up to date version');
  8996. }
  8997. } else {
  8998. $io->writeError('<info>Color legend:</info>');
  8999. $io->writeError('- <highlight>patch or minor</highlight> release available - update recommended');
  9000. $io->writeError('- <comment>major</comment> release available - update possible');
  9001. if (!$input->getOption('outdated')) {
  9002. $io->writeError('- <info>up to date</info> version');
  9003. }
  9004. }
  9005. }
  9006. $width = $this->getTerminalWidth();
  9007. foreach ($viewData as $type => $packages) {
  9008. $nameLength = $viewMetaData[$type]['nameLength'];
  9009. $versionLength = $viewMetaData[$type]['versionLength'];
  9010. $latestLength = $viewMetaData[$type]['latestLength'];
  9011. $releaseDateLength = $viewMetaData[$type]['releaseDateLength'];
  9012. $writeLatest = $viewMetaData[$type]['writeLatest'];
  9013. $writeReleaseDate = $viewMetaData[$type]['writeReleaseDate'];
  9014. $versionFits = $nameLength + $versionLength + 3 <= $width;
  9015. $latestFits = $nameLength + $versionLength + $latestLength + 3 <= $width;
  9016. $releaseDateFits = $nameLength + $versionLength + $latestLength + $releaseDateLength + 3 <= $width;
  9017. $descriptionFits = $nameLength + $versionLength + $latestLength + $releaseDateLength + 24 <= $width;
  9018. if ($latestFits && !$io->isDecorated()) {
  9019. $latestLength += 2;
  9020. }
  9021. if ($showAllTypes) {
  9022. if ('available' === $type) {
  9023. $io->write('<comment>' . $type . '</comment>:');
  9024. } else {
  9025. $io->write('<info>' . $type . '</info>:');
  9026. }
  9027. }
  9028. if ($writeLatest && !$input->getOption('direct')) {
  9029. $directDeps = [];
  9030. $transitiveDeps = [];
  9031. foreach ($packages as $pkg) {
  9032. if ($pkg['direct-dependency'] ?? false) {
  9033. $directDeps[] = $pkg;
  9034. } else {
  9035. $transitiveDeps[] = $pkg;
  9036. }
  9037. }
  9038. $io->writeError('');
  9039. $io->writeError('<info>Direct dependencies required in composer.json:</>');
  9040. if (\count($directDeps) > 0) {
  9041. $this->printPackages($io, $directDeps, $indent, $writeVersion && $versionFits, $latestFits, $writeDescription && $descriptionFits, $width, $versionLength, $nameLength, $latestLength, $writeReleaseDate && $releaseDateFits, $releaseDateLength);
  9042. } else {
  9043. $io->writeError('Everything up to date');
  9044. }
  9045. $io->writeError('');
  9046. $io->writeError('<info>Transitive dependencies not required in composer.json:</>');
  9047. if (\count($transitiveDeps) > 0) {
  9048. $this->printPackages($io, $transitiveDeps, $indent, $writeVersion && $versionFits, $latestFits, $writeDescription && $descriptionFits, $width, $versionLength, $nameLength, $latestLength, $writeReleaseDate && $releaseDateFits, $releaseDateLength);
  9049. } else {
  9050. $io->writeError('Everything up to date');
  9051. }
  9052. } else {
  9053. if ($writeLatest && \count($packages) === 0) {
  9054. $io->writeError('All your direct dependencies are up to date');
  9055. } else {
  9056. $this->printPackages($io, $packages, $indent, $writeVersion && $versionFits, $writeLatest && $latestFits, $writeDescription && $descriptionFits, $width, $versionLength, $nameLength, $latestLength, $writeReleaseDate && $releaseDateFits, $releaseDateLength);
  9057. }
  9058. }
  9059. if ($showAllTypes) {
  9060. $io->write('');
  9061. }
  9062. }
  9063. }
  9064. return $exitCode;
  9065. }
  9066. private function printPackages(IOInterface $io, array $packages, string $indent, bool $writeVersion, bool $writeLatest, bool $writeDescription, int $width, int $versionLength, int $nameLength, int $latestLength, bool $writeReleaseDate, int $releaseDateLength): void
  9067. {
  9068. $padName = $writeVersion || $writeLatest || $writeReleaseDate || $writeDescription;
  9069. $padVersion = $writeLatest || $writeReleaseDate || $writeDescription;
  9070. $padLatest = $writeDescription || $writeReleaseDate;
  9071. $padReleaseDate = $writeDescription;
  9072. foreach ($packages as $package) {
  9073. $link = $package['source'] ?? $package['homepage'] ?? '';
  9074. if ($link !== '') {
  9075. $io->write($indent . '<href='.OutputFormatter::escape($link).'>'.$package['name'].'</>'. str_repeat(' ', ($padName ? $nameLength - strlen($package['name']) : 0)), false);
  9076. } else {
  9077. $io->write($indent . str_pad($package['name'], ($padName ? $nameLength : 0), ' '), false);
  9078. }
  9079. if (isset($package['version']) && $writeVersion) {
  9080. $io->write(' ' . str_pad($package['version'], ($padVersion ? $versionLength : 0), ' '), false);
  9081. }
  9082. if (isset($package['latest']) && isset($package['latest-status']) && $writeLatest) {
  9083. $latestVersion = $package['latest'];
  9084. $updateStatus = $package['latest-status'];
  9085. $style = $this->updateStatusToVersionStyle($updateStatus);
  9086. if (!$io->isDecorated()) {
  9087. $latestVersion = str_replace(['up-to-date', 'semver-safe-update', 'update-possible'], ['=', '!', '~'], $updateStatus) . ' ' . $latestVersion;
  9088. }
  9089. $io->write(' <' . $style . '>' . str_pad($latestVersion, ($padLatest ? $latestLength : 0), ' ') . '</' . $style . '>', false);
  9090. if ($writeReleaseDate && isset($package['release-age'])) {
  9091. $io->write(' '.str_pad($package['release-age'], ($padReleaseDate ? $releaseDateLength : 0), ' '), false);
  9092. }
  9093. }
  9094. if (isset($package['description']) && $writeDescription) {
  9095. $description = strtok($package['description'], "\r\n");
  9096. $remaining = $width - $nameLength - $versionLength - $releaseDateLength - 4;
  9097. if ($writeLatest) {
  9098. $remaining -= $latestLength;
  9099. }
  9100. if (strlen($description) > $remaining) {
  9101. $description = substr($description, 0, $remaining - 3) . '...';
  9102. }
  9103. $io->write(' ' . $description, false);
  9104. }
  9105. if (array_key_exists('path', $package)) {
  9106. $io->write(' '.(is_string($package['path']) ? $package['path'] : 'null'), false);
  9107. }
  9108. $io->write('');
  9109. if (isset($package['warning'])) {
  9110. $io->write('<warning>' . $package['warning'] . '</warning>');
  9111. }
  9112. }
  9113. }
  9114. protected function getRootRequires(): array
  9115. {
  9116. $composer = $this->tryComposer();
  9117. if ($composer === null) {
  9118. return [];
  9119. }
  9120. $rootPackage = $composer->getPackage();
  9121. return array_map(
  9122. 'strtolower',
  9123. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  9124. );
  9125. }
  9126. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  9127. {
  9128. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  9129. }
  9130. protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, string $name, $version = null): array
  9131. {
  9132. $name = strtolower($name);
  9133. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  9134. $policy = new DefaultPolicy();
  9135. $repositorySet = new RepositorySet('dev');
  9136. $repositorySet->allowInstalledRepositories();
  9137. $repositorySet->addRepository($repos);
  9138. $matchedPackage = null;
  9139. $versions = [];
  9140. if (PlatformRepository::isPlatformPackage($name)) {
  9141. $pool = $repositorySet->createPoolWithAllPackages();
  9142. } else {
  9143. $pool = $repositorySet->createPoolForPackage($name);
  9144. }
  9145. $matches = $pool->whatProvides($name, $constraint);
  9146. $literals = [];
  9147. foreach ($matches as $package) {
  9148. if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  9149. $package = $package->getAliasOf();
  9150. }
  9151. if (null === $version && $installedRepo->hasPackage($package)) {
  9152. $matchedPackage = $package;
  9153. }
  9154. $versions[$package->getPrettyVersion()] = $package->getVersion();
  9155. $literals[] = $package->getId();
  9156. }
  9157. if (null === $matchedPackage && \count($literals) > 0) {
  9158. $preferred = $policy->selectPreferredPackages($pool, $literals);
  9159. $matchedPackage = $pool->literalToPackage($preferred[0]);
  9160. }
  9161. if ($matchedPackage !== null && !$matchedPackage instanceof CompletePackageInterface) {
  9162. throw new \LogicException('ShowCommand::getPackage can only work with CompletePackageInterface, but got '.get_class($matchedPackage));
  9163. }
  9164. return [$matchedPackage, $versions];
  9165. }
  9166. protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
  9167. {
  9168. $io = $this->getIO();
  9169. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  9170. $this->printLinks($package, Link::TYPE_REQUIRE);
  9171. $this->printLinks($package, Link::TYPE_DEV_REQUIRE, 'requires (dev)');
  9172. if ($package->getSuggests()) {
  9173. $io->write("\n<info>suggests</info>");
  9174. foreach ($package->getSuggests() as $suggested => $reason) {
  9175. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  9176. }
  9177. }
  9178. $this->printLinks($package, Link::TYPE_PROVIDE);
  9179. $this->printLinks($package, Link::TYPE_CONFLICT);
  9180. $this->printLinks($package, Link::TYPE_REPLACE);
  9181. }
  9182. protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
  9183. {
  9184. $isInstalledPackage = !PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package);
  9185. $io = $this->getIO();
  9186. $io->write('<info>name</info> : ' . $package->getPrettyName());
  9187. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  9188. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: []));
  9189. $this->printVersions($package, $versions, $installedRepo);
  9190. if ($isInstalledPackage && $package->getReleaseDate() !== null) {
  9191. $io->write('<info>released</info> : ' . $package->getReleaseDate()->format('Y-m-d') . ', ' . $this->getRelativeTime($package->getReleaseDate()));
  9192. }
  9193. if ($latestPackage) {
  9194. $style = $this->getVersionStyle($latestPackage, $package);
  9195. $releasedTime = $latestPackage->getReleaseDate() === null ? '' : ' released ' . $latestPackage->getReleaseDate()->format('Y-m-d') . ', ' . $this->getRelativeTime($latestPackage->getReleaseDate());
  9196. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>' . $releasedTime);
  9197. } else {
  9198. $latestPackage = $package;
  9199. }
  9200. $io->write('<info>type</info> : ' . $package->getType());
  9201. $this->printLicenses($package);
  9202. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  9203. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  9204. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  9205. if ($isInstalledPackage) {
  9206. $path = $this->requireComposer()->getInstallationManager()->getInstallPath($package);
  9207. if (is_string($path)) {
  9208. $io->write('<info>path</info> : ' . realpath($path));
  9209. } else {
  9210. $io->write('<info>path</info> : null');
  9211. }
  9212. }
  9213. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  9214. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  9215. $replacement = ($latestPackage->getReplacementPackage() !== null)
  9216. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  9217. : null;
  9218. $io->writeError(
  9219. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  9220. );
  9221. }
  9222. if ($package->getSupport()) {
  9223. $io->write("\n<info>support</info>");
  9224. foreach ($package->getSupport() as $type => $value) {
  9225. $io->write('<comment>' . $type . '</comment> : '.$value);
  9226. }
  9227. }
  9228. if (\count($package->getAutoload()) > 0) {
  9229. $io->write("\n<info>autoload</info>");
  9230. $autoloadConfig = $package->getAutoload();
  9231. foreach ($autoloadConfig as $type => $autoloads) {
  9232. $io->write('<comment>' . $type . '</comment>');
  9233. if ($type === 'psr-0' || $type === 'psr-4') {
  9234. foreach ($autoloads as $name => $path) {
  9235. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  9236. }
  9237. } elseif ($type === 'classmap') {
  9238. $io->write(implode(', ', $autoloadConfig[$type]));
  9239. }
  9240. }
  9241. if ($package->getIncludePaths()) {
  9242. $io->write('<comment>include-path</comment>');
  9243. $io->write(implode(', ', $package->getIncludePaths()));
  9244. }
  9245. }
  9246. }
  9247. protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo): void
  9248. {
  9249. $versions = array_keys($versions);
  9250. $versions = Semver::rsort($versions);
  9251. if ($installedPackages = $installedRepo->findPackages($package->getName())) {
  9252. foreach ($installedPackages as $installedPackage) {
  9253. $installedVersion = $installedPackage->getPrettyVersion();
  9254. $key = array_search($installedVersion, $versions);
  9255. if (false !== $key) {
  9256. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  9257. }
  9258. }
  9259. }
  9260. $versions = implode(', ', $versions);
  9261. $this->getIO()->write('<info>versions</info> : ' . $versions);
  9262. }
  9263. protected function printLinks(CompletePackageInterface $package, string $linkType, ?string $title = null): void
  9264. {
  9265. $title = $title ?: $linkType;
  9266. $io = $this->getIO();
  9267. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  9268. $io->write("\n<info>" . $title . "</info>");
  9269. foreach ($links as $link) {
  9270. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  9271. }
  9272. }
  9273. }
  9274. protected function printLicenses(CompletePackageInterface $package): void
  9275. {
  9276. $spdxLicenses = new SpdxLicenses();
  9277. $licenses = $package->getLicense();
  9278. $io = $this->getIO();
  9279. foreach ($licenses as $licenseId) {
  9280. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  9281. if (!$license) {
  9282. $out = $licenseId;
  9283. } else {
  9284. if ($license[1] === true) {
  9285. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  9286. } else {
  9287. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  9288. }
  9289. }
  9290. $io->write('<info>license</info> : ' . $out);
  9291. }
  9292. }
  9293. protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, ?PackageInterface $latestPackage = null): void
  9294. {
  9295. $json = [
  9296. 'name' => $package->getPrettyName(),
  9297. 'description' => $package->getDescription(),
  9298. 'keywords' => $package->getKeywords() ?: [],
  9299. 'type' => $package->getType(),
  9300. 'homepage' => $package->getHomepage(),
  9301. 'names' => $package->getNames(),
  9302. ];
  9303. $json = $this->appendVersions($json, $versions);
  9304. $json = $this->appendLicenses($json, $package);
  9305. if ($latestPackage) {
  9306. $json['latest'] = $latestPackage->getPrettyVersion();
  9307. } else {
  9308. $latestPackage = $package;
  9309. }
  9310. if (null !== $package->getSourceType()) {
  9311. $json['source'] = [
  9312. 'type' => $package->getSourceType(),
  9313. 'url' => $package->getSourceUrl(),
  9314. 'reference' => $package->getSourceReference(),
  9315. ];
  9316. }
  9317. if (null !== $package->getDistType()) {
  9318. $json['dist'] = [
  9319. 'type' => $package->getDistType(),
  9320. 'url' => $package->getDistUrl(),
  9321. 'reference' => $package->getDistReference(),
  9322. ];
  9323. }
  9324. if (!PlatformRepository::isPlatformPackage($package->getName()) && $installedRepo->hasPackage($package)) {
  9325. $path = $this->requireComposer()->getInstallationManager()->getInstallPath($package);
  9326. if (is_string($path)) {
  9327. $path = realpath($path);
  9328. if ($path !== false) {
  9329. $json['path'] = $path;
  9330. }
  9331. } else {
  9332. $json['path'] = null;
  9333. }
  9334. if ($package->getReleaseDate() !== null) {
  9335. $json['released'] = $package->getReleaseDate()->format(DATE_ATOM);
  9336. }
  9337. }
  9338. if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {
  9339. $json['replacement'] = $latestPackage->getReplacementPackage();
  9340. }
  9341. if ($package->getSuggests()) {
  9342. $json['suggests'] = $package->getSuggests();
  9343. }
  9344. if ($package->getSupport()) {
  9345. $json['support'] = $package->getSupport();
  9346. }
  9347. $json = $this->appendAutoload($json, $package);
  9348. if ($package->getIncludePaths()) {
  9349. $json['include_path'] = $package->getIncludePaths();
  9350. }
  9351. $json = $this->appendLinks($json, $package);
  9352. $this->getIO()->write(JsonFile::encode($json));
  9353. }
  9354. private function appendVersions(array $json, array $versions): array
  9355. {
  9356. uasort($versions, 'version_compare');
  9357. $versions = array_keys(array_reverse($versions));
  9358. $json['versions'] = $versions;
  9359. return $json;
  9360. }
  9361. private function appendLicenses(array $json, CompletePackageInterface $package): array
  9362. {
  9363. if ($licenses = $package->getLicense()) {
  9364. $spdxLicenses = new SpdxLicenses();
  9365. $json['licenses'] = array_map(static function ($licenseId) use ($spdxLicenses) {
  9366. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  9367. if (!$license) {
  9368. return $licenseId;
  9369. }
  9370. return [
  9371. 'name' => $license[0],
  9372. 'osi' => $licenseId,
  9373. 'url' => $license[2],
  9374. ];
  9375. }, $licenses);
  9376. }
  9377. return $json;
  9378. }
  9379. private function appendAutoload(array $json, CompletePackageInterface $package): array
  9380. {
  9381. if (\count($package->getAutoload()) > 0) {
  9382. $autoload = [];
  9383. foreach ($package->getAutoload() as $type => $autoloads) {
  9384. if ($type === 'psr-0' || $type === 'psr-4') {
  9385. $psr = [];
  9386. foreach ($autoloads as $name => $path) {
  9387. if (!$path) {
  9388. $path = '.';
  9389. }
  9390. $psr[$name ?: '*'] = $path;
  9391. }
  9392. $autoload[$type] = $psr;
  9393. } elseif ($type === 'classmap') {
  9394. $autoload['classmap'] = $autoloads;
  9395. }
  9396. }
  9397. $json['autoload'] = $autoload;
  9398. }
  9399. return $json;
  9400. }
  9401. private function appendLinks(array $json, CompletePackageInterface $package): array
  9402. {
  9403. foreach (Link::$TYPES as $linkType) {
  9404. $json = $this->appendLink($json, $package, $linkType);
  9405. }
  9406. return $json;
  9407. }
  9408. private function appendLink(array $json, CompletePackageInterface $package, string $linkType): array
  9409. {
  9410. $links = $package->{'get' . ucfirst($linkType)}();
  9411. if ($links) {
  9412. $json[$linkType] = [];
  9413. foreach ($links as $link) {
  9414. $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
  9415. }
  9416. }
  9417. return $json;
  9418. }
  9419. protected function initStyles(OutputInterface $output): void
  9420. {
  9421. $this->colors = [
  9422. 'green',
  9423. 'yellow',
  9424. 'cyan',
  9425. 'magenta',
  9426. 'blue',
  9427. ];
  9428. foreach ($this->colors as $color) {
  9429. $style = new OutputFormatterStyle($color);
  9430. $output->getFormatter()->setStyle($color, $style);
  9431. }
  9432. }
  9433. protected function displayPackageTree(array $arrayTree): void
  9434. {
  9435. $io = $this->getIO();
  9436. foreach ($arrayTree as $package) {
  9437. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  9438. $io->write(' ' . $package['version'], false);
  9439. if (isset($package['description'])) {
  9440. $io->write(' ' . strtok($package['description'], "\r\n"));
  9441. } else {
  9442. $io->write('');
  9443. }
  9444. if (isset($package['requires'])) {
  9445. $requires = $package['requires'];
  9446. $treeBar = '├';
  9447. $j = 0;
  9448. $total = count($requires);
  9449. foreach ($requires as $require) {
  9450. $requireName = $require['name'];
  9451. $j++;
  9452. if ($j === $total) {
  9453. $treeBar = 'â””';
  9454. }
  9455. $level = 1;
  9456. $color = $this->colors[$level];
  9457. $info = sprintf(
  9458. '%s──<%s>%s</%s> %s',
  9459. $treeBar,
  9460. $color,
  9461. $requireName,
  9462. $color,
  9463. $require['version']
  9464. );
  9465. $this->writeTreeLine($info);
  9466. $treeBar = str_replace('â””', ' ', $treeBar);
  9467. $packagesInTree = [$package['name'], $requireName];
  9468. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  9469. }
  9470. }
  9471. }
  9472. }
  9473. protected function generatePackageTree(
  9474. PackageInterface $package,
  9475. InstalledRepository $installedRepo,
  9476. RepositoryInterface $remoteRepos
  9477. ): array {
  9478. $requires = $package->getRequires();
  9479. ksort($requires);
  9480. $children = [];
  9481. foreach ($requires as $requireName => $require) {
  9482. $packagesInTree = [$package->getName(), $requireName];
  9483. $treeChildDesc = [
  9484. 'name' => $requireName,
  9485. 'version' => $require->getPrettyConstraint(),
  9486. ];
  9487. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $packagesInTree);
  9488. if ($deepChildren) {
  9489. $treeChildDesc['requires'] = $deepChildren;
  9490. }
  9491. $children[] = $treeChildDesc;
  9492. }
  9493. $tree = [
  9494. 'name' => $package->getPrettyName(),
  9495. 'version' => $package->getPrettyVersion(),
  9496. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : '',
  9497. ];
  9498. if ($children) {
  9499. $tree['requires'] = $children;
  9500. }
  9501. return $tree;
  9502. }
  9503. protected function displayTree(
  9504. $package,
  9505. array $packagesInTree,
  9506. string $previousTreeBar = '├',
  9507. int $level = 1
  9508. ): void {
  9509. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  9510. if (is_array($package) && isset($package['requires'])) {
  9511. $requires = $package['requires'];
  9512. $treeBar = $previousTreeBar . ' ├';
  9513. $i = 0;
  9514. $total = count($requires);
  9515. foreach ($requires as $require) {
  9516. $currentTree = $packagesInTree;
  9517. $i++;
  9518. if ($i === $total) {
  9519. $treeBar = $previousTreeBar . ' â””';
  9520. }
  9521. $colorIdent = $level % count($this->colors);
  9522. $color = $this->colors[$colorIdent];
  9523. assert(is_string($require['name']));
  9524. assert(is_string($require['version']));
  9525. $circularWarn = in_array(
  9526. $require['name'],
  9527. $currentTree,
  9528. true
  9529. ) ? '(circular dependency aborted here)' : '';
  9530. $info = rtrim(sprintf(
  9531. '%s──<%s>%s</%s> %s %s',
  9532. $treeBar,
  9533. $color,
  9534. $require['name'],
  9535. $color,
  9536. $require['version'],
  9537. $circularWarn
  9538. ));
  9539. $this->writeTreeLine($info);
  9540. $treeBar = str_replace('â””', ' ', $treeBar);
  9541. $currentTree[] = $require['name'];
  9542. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  9543. }
  9544. }
  9545. }
  9546. protected function addTree(
  9547. string $name,
  9548. Link $link,
  9549. InstalledRepository $installedRepo,
  9550. RepositoryInterface $remoteRepos,
  9551. array $packagesInTree
  9552. ): array {
  9553. $children = [];
  9554. [$package] = $this->getPackage(
  9555. $installedRepo,
  9556. $remoteRepos,
  9557. $name,
  9558. $link->getPrettyConstraint() === 'self.version' ? $link->getConstraint() : $link->getPrettyConstraint()
  9559. );
  9560. if (is_object($package)) {
  9561. $requires = $package->getRequires();
  9562. ksort($requires);
  9563. foreach ($requires as $requireName => $require) {
  9564. $currentTree = $packagesInTree;
  9565. $treeChildDesc = [
  9566. 'name' => $requireName,
  9567. 'version' => $require->getPrettyConstraint(),
  9568. ];
  9569. if (!in_array($requireName, $currentTree, true)) {
  9570. $currentTree[] = $requireName;
  9571. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $remoteRepos, $currentTree);
  9572. if ($deepChildren) {
  9573. $treeChildDesc['requires'] = $deepChildren;
  9574. }
  9575. }
  9576. $children[] = $treeChildDesc;
  9577. }
  9578. }
  9579. return $children;
  9580. }
  9581. private function updateStatusToVersionStyle(string $updateStatus): string
  9582. {
  9583. return str_replace(['up-to-date', 'semver-safe-update', 'update-possible'], ['info', 'highlight', 'comment'], $updateStatus);
  9584. }
  9585. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package): string
  9586. {
  9587. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  9588. return 'up-to-date';
  9589. }
  9590. $constraint = $package->getVersion();
  9591. if (0 !== strpos($constraint, 'dev-')) {
  9592. $constraint = '^'.$constraint;
  9593. }
  9594. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  9595. return 'semver-safe-update';
  9596. }
  9597. return 'update-possible';
  9598. }
  9599. private function writeTreeLine(string $line): void
  9600. {
  9601. $io = $this->getIO();
  9602. if (!$io->isDecorated()) {
  9603. $line = str_replace(['└', '├', '──', '│'], ['`-', '|-', '-', '|'], $line);
  9604. }
  9605. $io->write($line);
  9606. }
  9607. private function findLatestPackage(PackageInterface $package, Composer $composer, PlatformRepository $platformRepo, bool $majorOnly, bool $minorOnly, bool $patchOnly, PlatformRequirementFilterInterface $platformReqFilter): ?PackageInterface
  9608. {
  9609. $name = $package->getName();
  9610. $versionSelector = new VersionSelector($this->getRepositorySet($composer), $platformRepo);
  9611. $stability = $composer->getPackage()->getMinimumStability();
  9612. $flags = $composer->getPackage()->getStabilityFlags();
  9613. if (isset($flags[$name])) {
  9614. $stability = array_search($flags[$name], BasePackage::STABILITIES, true);
  9615. }
  9616. $bestStability = $stability;
  9617. if ($composer->getPackage()->getPreferStable()) {
  9618. $bestStability = $package->getStability();
  9619. }
  9620. $targetVersion = null;
  9621. if (0 === strpos($package->getVersion(), 'dev-')) {
  9622. $targetVersion = $package->getVersion();
  9623. if ($majorOnly) {
  9624. return null;
  9625. }
  9626. }
  9627. if ($targetVersion === null) {
  9628. if ($majorOnly && Preg::isMatch('{^(?P<zero_major>(?:0\.)+)?(?P<first_meaningful>\d+)\.}', $package->getVersion(), $match)) {
  9629. $targetVersion = '>='.$match['zero_major'].(((int) $match['first_meaningful']) + 1).',<9999999-dev';
  9630. }
  9631. if ($minorOnly) {
  9632. $targetVersion = '^'.$package->getVersion();
  9633. }
  9634. if ($patchOnly) {
  9635. $trimmedVersion = Preg::replace('{(\.0)+$}D', '', $package->getVersion());
  9636. $partsNeeded = substr($trimmedVersion, 0, 1) === '0' ? 4 : 3;
  9637. while (substr_count($trimmedVersion, '.') + 1 < $partsNeeded) {
  9638. $trimmedVersion .= '.0';
  9639. }
  9640. $targetVersion = '~'.$trimmedVersion;
  9641. }
  9642. }
  9643. if ($this->getIO()->isVerbose()) {
  9644. $showWarnings = true;
  9645. } else {
  9646. $showWarnings = static function (PackageInterface $candidate) use ($package): bool {
  9647. if (str_starts_with($candidate->getVersion(), 'dev-') || str_starts_with($package->getVersion(), 'dev-')) {
  9648. return false;
  9649. }
  9650. return version_compare($candidate->getVersion(), $package->getVersion(), '<=');
  9651. };
  9652. }
  9653. $candidate = $versionSelector->findBestCandidate($name, $targetVersion, $bestStability, $platformReqFilter, 0, $this->getIO(), $showWarnings);
  9654. while ($candidate instanceof AliasPackage) {
  9655. $candidate = $candidate->getAliasOf();
  9656. }
  9657. return $candidate !== false ? $candidate : null;
  9658. }
  9659. private function getRepositorySet(Composer $composer): RepositorySet
  9660. {
  9661. if (!$this->repositorySet) {
  9662. $this->repositorySet = new RepositorySet($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  9663. $this->repositorySet->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  9664. }
  9665. return $this->repositorySet;
  9666. }
  9667. private function getRelativeTime(\DateTimeInterface $releaseDate): string
  9668. {
  9669. if ($releaseDate->format('Ymd') === date('Ymd')) {
  9670. return 'today';
  9671. }
  9672. $diff = $releaseDate->diff(new \DateTimeImmutable());
  9673. if ($diff->days < 7) {
  9674. return 'this week';
  9675. }
  9676. if ($diff->days < 14) {
  9677. return 'last week';
  9678. }
  9679. if ($diff->m < 1 && $diff->days < 31) {
  9680. return floor($diff->days / 7) . ' weeks ago';
  9681. }
  9682. if ($diff->y < 1) {
  9683. return $diff->m . ' month' . ($diff->m > 1 ? 's' : '') . ' ago';
  9684. }
  9685. return $diff->y . ' year' . ($diff->y > 1 ? 's' : '') . ' ago';
  9686. }
  9687. }
  9688. <?php declare(strict_types=1);
  9689. namespace Composer\Command;
  9690. use Symfony\Component\Console\Input\InputInterface;
  9691. use Composer\Console\Input\InputOption;
  9692. use Symfony\Component\Console\Output\OutputInterface;
  9693. use Composer\Downloader\ChangeReportInterface;
  9694. use Composer\Downloader\DvcsDownloaderInterface;
  9695. use Composer\Downloader\VcsCapableDownloaderInterface;
  9696. use Composer\Package\Dumper\ArrayDumper;
  9697. use Composer\Package\Version\VersionGuesser;
  9698. use Composer\Package\Version\VersionParser;
  9699. use Composer\Plugin\CommandEvent;
  9700. use Composer\Plugin\PluginEvents;
  9701. use Composer\Script\ScriptEvents;
  9702. use Composer\Util\ProcessExecutor;
  9703. class StatusCommand extends BaseCommand
  9704. {
  9705. private const EXIT_CODE_ERRORS = 1;
  9706. private const EXIT_CODE_UNPUSHED_CHANGES = 2;
  9707. private const EXIT_CODE_VERSION_CHANGES = 4;
  9708. protected function configure(): void
  9709. {
  9710. $this
  9711. ->setName('status')
  9712. ->setDescription('Shows a list of locally modified packages')
  9713. ->setDefinition([
  9714. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  9715. ])
  9716. ->setHelp(
  9717. <<<EOT
  9718. The status command displays a list of dependencies that have
  9719. been modified locally.
  9720. Read more at https://getcomposer.org/doc/03-cli.md#status
  9721. EOT
  9722. )
  9723. ;
  9724. }
  9725. protected function execute(InputInterface $input, OutputInterface $output): int
  9726. {
  9727. $composer = $this->requireComposer();
  9728. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  9729. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  9730. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  9731. $exitCode = $this->doExecute($input);
  9732. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  9733. return $exitCode;
  9734. }
  9735. private function doExecute(InputInterface $input): int
  9736. {
  9737. $composer = $this->requireComposer();
  9738. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  9739. $dm = $composer->getDownloadManager();
  9740. $im = $composer->getInstallationManager();
  9741. $errors = [];
  9742. $io = $this->getIO();
  9743. $unpushedChanges = [];
  9744. $vcsVersionChanges = [];
  9745. $parser = new VersionParser;
  9746. $guesser = new VersionGuesser($composer->getConfig(), $composer->getLoop()->getProcessExecutor() ?? new ProcessExecutor($io), $parser, $io);
  9747. $dumper = new ArrayDumper;
  9748. foreach ($installedRepo->getCanonicalPackages() as $package) {
  9749. $downloader = $dm->getDownloaderForPackage($package);
  9750. $targetDir = $im->getInstallPath($package);
  9751. if ($targetDir === null) {
  9752. continue;
  9753. }
  9754. if ($downloader instanceof ChangeReportInterface) {
  9755. if (is_link($targetDir)) {
  9756. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  9757. }
  9758. if (null !== ($changes = $downloader->getLocalChanges($package, $targetDir))) {
  9759. $errors[$targetDir] = $changes;
  9760. }
  9761. }
  9762. if ($downloader instanceof VcsCapableDownloaderInterface) {
  9763. if ($downloader->getVcsReference($package, $targetDir)) {
  9764. switch ($package->getInstallationSource()) {
  9765. case 'source':
  9766. $previousRef = $package->getSourceReference();
  9767. break;
  9768. case 'dist':
  9769. $previousRef = $package->getDistReference();
  9770. break;
  9771. default:
  9772. $previousRef = null;
  9773. }
  9774. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  9775. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef && $currentVersion['pretty_version'] !== $previousRef) {
  9776. $vcsVersionChanges[$targetDir] = [
  9777. 'previous' => [
  9778. 'version' => $package->getPrettyVersion(),
  9779. 'ref' => $previousRef,
  9780. ],
  9781. 'current' => [
  9782. 'version' => $currentVersion['pretty_version'],
  9783. 'ref' => $currentVersion['commit'],
  9784. ],
  9785. ];
  9786. }
  9787. }
  9788. }
  9789. if ($downloader instanceof DvcsDownloaderInterface) {
  9790. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  9791. $unpushedChanges[$targetDir] = $unpushed;
  9792. }
  9793. }
  9794. }
  9795. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  9796. $io->writeError('<info>No local changes</info>');
  9797. return 0;
  9798. }
  9799. if ($errors) {
  9800. $io->writeError('<error>You have changes in the following dependencies:</error>');
  9801. foreach ($errors as $path => $changes) {
  9802. if ($input->getOption('verbose')) {
  9803. $indentedChanges = implode("\n", array_map(static function ($line): string {
  9804. return ' ' . ltrim($line);
  9805. }, explode("\n", $changes)));
  9806. $io->write('<info>'.$path.'</info>:');
  9807. $io->write($indentedChanges);
  9808. } else {
  9809. $io->write($path);
  9810. }
  9811. }
  9812. }
  9813. if ($unpushedChanges) {
  9814. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  9815. foreach ($unpushedChanges as $path => $changes) {
  9816. if ($input->getOption('verbose')) {
  9817. $indentedChanges = implode("\n", array_map(static function ($line): string {
  9818. return ' ' . ltrim($line);
  9819. }, explode("\n", $changes)));
  9820. $io->write('<info>'.$path.'</info>:');
  9821. $io->write($indentedChanges);
  9822. } else {
  9823. $io->write($path);
  9824. }
  9825. }
  9826. }
  9827. if ($vcsVersionChanges) {
  9828. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  9829. foreach ($vcsVersionChanges as $path => $changes) {
  9830. if ($input->getOption('verbose')) {
  9831. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  9832. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  9833. if ($io->isVeryVerbose()) {
  9834. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  9835. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  9836. }
  9837. $io->write('<info>'.$path.'</info>:');
  9838. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  9839. } else {
  9840. $io->write($path);
  9841. }
  9842. }
  9843. }
  9844. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  9845. $io->writeError('Use --verbose (-v) to see a list of files');
  9846. }
  9847. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  9848. }
  9849. }
  9850. <?php declare(strict_types=1);
  9851. namespace Composer\Command;
  9852. use Composer\Repository\PlatformRepository;
  9853. use Composer\Repository\RootPackageRepository;
  9854. use Composer\Repository\InstalledRepository;
  9855. use Composer\Installer\SuggestedPackagesReporter;
  9856. use Composer\Console\Input\InputArgument;
  9857. use Symfony\Component\Console\Input\InputInterface;
  9858. use Composer\Console\Input\InputOption;
  9859. use Symfony\Component\Console\Output\OutputInterface;
  9860. class SuggestsCommand extends BaseCommand
  9861. {
  9862. use CompletionTrait;
  9863. protected function configure(): void
  9864. {
  9865. $this
  9866. ->setName('suggests')
  9867. ->setDescription('Shows package suggestions')
  9868. ->setDefinition([
  9869. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package (default)'),
  9870. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  9871. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show suggestions from all dependencies, including transitive ones'),
  9872. new InputOption('list', null, InputOption::VALUE_NONE, 'Show only list of suggested package names'),
  9873. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  9874. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.', null, $this->suggestInstalledPackage()),
  9875. ])
  9876. ->setHelp(
  9877. <<<EOT
  9878. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  9879. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  9880. EOT
  9881. )
  9882. ;
  9883. }
  9884. protected function execute(InputInterface $input, OutputInterface $output): int
  9885. {
  9886. $composer = $this->requireComposer();
  9887. $installedRepos = [
  9888. new RootPackageRepository(clone $composer->getPackage()),
  9889. ];
  9890. $locker = $composer->getLocker();
  9891. if ($locker->isLocked()) {
  9892. $installedRepos[] = new PlatformRepository([], $locker->getPlatformOverrides());
  9893. $installedRepos[] = $locker->getLockedRepository(!$input->getOption('no-dev'));
  9894. } else {
  9895. $installedRepos[] = new PlatformRepository([], $composer->getConfig()->get('platform'));
  9896. $installedRepos[] = $composer->getRepositoryManager()->getLocalRepository();
  9897. }
  9898. $installedRepo = new InstalledRepository($installedRepos);
  9899. $reporter = new SuggestedPackagesReporter($this->getIO());
  9900. $filter = $input->getArgument('packages');
  9901. $packages = $installedRepo->getPackages();
  9902. $packages[] = $composer->getPackage();
  9903. foreach ($packages as $package) {
  9904. if (!empty($filter) && !in_array($package->getName(), $filter)) {
  9905. continue;
  9906. }
  9907. $reporter->addSuggestionsFromPackage($package);
  9908. }
  9909. $mode = SuggestedPackagesReporter::MODE_BY_PACKAGE;
  9910. if ($input->getOption('by-suggestion')) {
  9911. $mode = SuggestedPackagesReporter::MODE_BY_SUGGESTION;
  9912. }
  9913. if ($input->getOption('by-package')) {
  9914. $mode |= SuggestedPackagesReporter::MODE_BY_PACKAGE;
  9915. }
  9916. if ($input->getOption('list')) {
  9917. $mode = SuggestedPackagesReporter::MODE_LIST;
  9918. }
  9919. $reporter->output($mode, $installedRepo, empty($filter) && !$input->getOption('all') ? $composer->getPackage() : null);
  9920. return 0;
  9921. }
  9922. }
  9923. <?php declare(strict_types=1);
  9924. namespace Composer\Command;
  9925. use Composer\Composer;
  9926. use Composer\DependencyResolver\Request;
  9927. use Composer\Installer;
  9928. use Composer\IO\IOInterface;
  9929. use Composer\Package\BasePackage;
  9930. use Composer\Package\Loader\RootPackageLoader;
  9931. use Composer\Package\PackageInterface;
  9932. use Composer\Package\Version\VersionSelector;
  9933. use Composer\Pcre\Preg;
  9934. use Composer\Plugin\CommandEvent;
  9935. use Composer\Plugin\PluginEvents;
  9936. use Composer\Package\Version\VersionParser;
  9937. use Composer\Repository\CompositeRepository;
  9938. use Composer\Repository\PlatformRepository;
  9939. use Composer\Repository\RepositoryInterface;
  9940. use Composer\Repository\RepositorySet;
  9941. use Composer\Semver\Constraint\MultiConstraint;
  9942. use Composer\Semver\Intervals;
  9943. use Composer\Util\HttpDownloader;
  9944. use Composer\Advisory\Auditor;
  9945. use Composer\Util\Platform;
  9946. use Symfony\Component\Console\Helper\Table;
  9947. use Symfony\Component\Console\Input\InputInterface;
  9948. use Composer\Console\Input\InputOption;
  9949. use Composer\Console\Input\InputArgument;
  9950. use Symfony\Component\Console\Output\OutputInterface;
  9951. class UpdateCommand extends BaseCommand
  9952. {
  9953. use CompletionTrait;
  9954. protected function configure()
  9955. {
  9956. $this
  9957. ->setName('update')
  9958. ->setAliases(['u', 'upgrade'])
  9959. ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file')
  9960. ->setDefinition([
  9961. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.', null, $this->suggestInstalledPackage(false)),
  9962. new InputOption('with', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Temporary version constraint to add, e.g. foo/bar:1.0.0 or foo/bar=1.0.0'),
  9963. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  9964. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist (default behavior).'),
  9965. new InputOption('prefer-install', null, InputOption::VALUE_REQUIRED, 'Forces installation from package dist|source|auto (auto chooses source for dev versions, dist for the rest).', null, $this->suggestPreferInstall()),
  9966. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  9967. new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'),
  9968. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  9969. new InputOption('lock', null, InputOption::VALUE_NONE, 'Overwrites the lock file hash to suppress warning about the lock file being out of date without updating package versions. Package metadata like mirrors and URLs are updated if they changed.'),
  9970. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Skip the install step after updating the composer.lock file.'),
  9971. new InputOption('no-audit', null, InputOption::VALUE_NONE, 'Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).'),
  9972. new InputOption('audit-format', null, InputOption::VALUE_REQUIRED, 'Audit output format. Must be "table", "plain", "json", or "summary".', Auditor::FORMAT_SUMMARY, Auditor::FORMATS),
  9973. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  9974. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'),
  9975. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  9976. new InputOption('with-dependencies', 'w', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, except those which are root requirements.'),
  9977. new InputOption('with-all-dependencies', 'W', InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, including those which are root requirements.'),
  9978. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  9979. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  9980. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  9981. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  9982. new InputOption('apcu-autoloader-prefix', null, InputOption::VALUE_REQUIRED, 'Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader'),
  9983. new InputOption('ignore-platform-req', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore a specific platform requirement (php & ext- packages).'),
  9984. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore all platform requirements (php & ext- packages).'),
  9985. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies (can also be set via the COMPOSER_PREFER_STABLE=1 env var).'),
  9986. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies (can also be set via the COMPOSER_PREFER_LOWEST=1 env var).'),
  9987. new InputOption('minimal-changes', 'm', InputOption::VALUE_NONE, 'During a partial update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).'),
  9988. new InputOption('patch-only', null, InputOption::VALUE_NONE, 'Only allow patch version updates for currently installed dependencies.'),
  9989. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  9990. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  9991. new InputOption('bump-after-update', null, InputOption::VALUE_OPTIONAL, 'Runs bump after performing the update.', false, ['dev', 'no-dev', 'all']),
  9992. ])
  9993. ->setHelp(
  9994. <<<EOT
  9995. The <info>update</info> command reads the composer.json file from the
  9996. current directory, processes it, and updates, removes or installs all the
  9997. dependencies.
  9998. <info>php composer.phar update</info>
  9999. To limit the update operation to a few packages, you can list the package(s)
  10000. you want to update as such:
  10001. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  10002. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  10003. from a specific vendor:
  10004. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  10005. To run an update with more restrictive constraints you can use:
  10006. <info>php composer.phar update --with vendor/package:1.0.*</info>
  10007. To run a partial update with more restrictive constraints you can use the shorthand:
  10008. <info>php composer.phar update vendor/package:1.0.*</info>
  10009. To select packages names interactively with auto-completion use <info>-i</info>.
  10010. Read more at https://getcomposer.org/doc/03-cli.md#update-u-upgrade
  10011. EOT
  10012. )
  10013. ;
  10014. }
  10015. protected function execute(InputInterface $input, OutputInterface $output): int
  10016. {
  10017. $io = $this->getIO();
  10018. if ($input->getOption('dev')) {
  10019. $io->writeError('<warning>You are using the deprecated option "--dev". It has no effect and will break in Composer 3.</warning>');
  10020. }
  10021. if ($input->getOption('no-suggest')) {
  10022. $io->writeError('<warning>You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.</warning>');
  10023. }
  10024. $composer = $this->requireComposer();
  10025. if (!HttpDownloader::isCurlEnabled()) {
  10026. $io->writeError('<warning>Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.</warning>');
  10027. }
  10028. $packages = $input->getArgument('packages');
  10029. $reqs = $this->formatRequirements($input->getOption('with'));
  10030. if (count($packages) > 0) {
  10031. $allowlistPackagesWithRequirements = array_filter($packages, static function ($pkg): bool {
  10032. return Preg::isMatch('{\S+[ =:]\S+}', $pkg);
  10033. });
  10034. foreach ($this->formatRequirements($allowlistPackagesWithRequirements) as $package => $constraint) {
  10035. $reqs[$package] = $constraint;
  10036. }
  10037. foreach ($allowlistPackagesWithRequirements as $package) {
  10038. $packageName = Preg::replace('{^([^ =:]+)[ =:].*$}', '$1', $package);
  10039. $index = array_search($package, $packages);
  10040. $packages[$index] = $packageName;
  10041. }
  10042. }
  10043. $rootPackage = $composer->getPackage();
  10044. $rootPackage->setReferences(RootPackageLoader::extractReferences($reqs, $rootPackage->getReferences()));
  10045. $rootPackage->setStabilityFlags(RootPackageLoader::extractStabilityFlags($reqs, $rootPackage->getMinimumStability(), $rootPackage->getStabilityFlags()));
  10046. $parser = new VersionParser;
  10047. $temporaryConstraints = [];
  10048. $rootRequirements = array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires());
  10049. foreach ($reqs as $package => $constraint) {
  10050. $package = strtolower($package);
  10051. $parsedConstraint = $parser->parseConstraints($constraint);
  10052. $temporaryConstraints[$package] = $parsedConstraint;
  10053. if (isset($rootRequirements[$package]) && !Intervals::haveIntersections($parsedConstraint, $rootRequirements[$package]->getConstraint())) {
  10054. $io->writeError('<error>The temporary constraint "'.$constraint.'" for "'.$package.'" must be a subset of the constraint in your composer.json ('.$rootRequirements[$package]->getPrettyConstraint().')</error>');
  10055. $io->write('<info>Run `composer require '.$package.'` or `composer require '.$package.':'.$constraint.'` instead to replace the constraint</info>');
  10056. return self::FAILURE;
  10057. }
  10058. }
  10059. if ($input->getOption('patch-only')) {
  10060. if (!$composer->getLocker()->isLocked()) {
  10061. throw new \InvalidArgumentException('patch-only can only be used with a lock file present');
  10062. }
  10063. foreach ($composer->getLocker()->getLockedRepository(true)->getCanonicalPackages() as $package) {
  10064. if ($package->isDev()) {
  10065. continue;
  10066. }
  10067. if (!Preg::isMatch('{^(\d+\.\d+\.\d+)}', $package->getVersion(), $match)) {
  10068. continue;
  10069. }
  10070. $constraint = $parser->parseConstraints('~'.$match[1]);
  10071. if (isset($temporaryConstraints[$package->getName()])) {
  10072. $temporaryConstraints[$package->getName()] = MultiConstraint::create([$temporaryConstraints[$package->getName()], $constraint], true);
  10073. } else {
  10074. $temporaryConstraints[$package->getName()] = $constraint;
  10075. }
  10076. }
  10077. }
  10078. if ($input->getOption('interactive')) {
  10079. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  10080. }
  10081. if ($input->getOption('root-reqs')) {
  10082. $requires = array_keys($rootPackage->getRequires());
  10083. if (!$input->getOption('no-dev')) {
  10084. $requires = array_merge($requires, array_keys($rootPackage->getDevRequires()));
  10085. }
  10086. if (!empty($packages)) {
  10087. $packages = array_intersect($packages, $requires);
  10088. } else {
  10089. $packages = $requires;
  10090. }
  10091. }
  10092. $filteredPackages = array_filter($packages, static function ($package): bool {
  10093. return !in_array($package, ['lock', 'nothing', 'mirrors'], true);
  10094. });
  10095. $updateMirrors = $input->getOption('lock') || count($filteredPackages) !== count($packages);
  10096. $packages = $filteredPackages;
  10097. if ($updateMirrors && !empty($packages)) {
  10098. $io->writeError('<error>You cannot simultaneously update only a selection of packages and regenerate the lock file metadata.</error>');
  10099. return -1;
  10100. }
  10101. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  10102. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  10103. $composer->getInstallationManager()->setOutputProgress(!$input->getOption('no-progress'));
  10104. $install = Installer::create($io, $composer);
  10105. $config = $composer->getConfig();
  10106. [$preferSource, $preferDist] = $this->getPreferredInstallOptions($config, $input);
  10107. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  10108. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  10109. $apcuPrefix = $input->getOption('apcu-autoloader-prefix');
  10110. $apcu = $apcuPrefix !== null || $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  10111. $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  10112. if ($input->getOption('with-all-dependencies')) {
  10113. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  10114. } elseif ($input->getOption('with-dependencies')) {
  10115. $updateAllowTransitiveDependencies = Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE;
  10116. }
  10117. $install
  10118. ->setDryRun($input->getOption('dry-run'))
  10119. ->setVerbose($input->getOption('verbose'))
  10120. ->setPreferSource($preferSource)
  10121. ->setPreferDist($preferDist)
  10122. ->setDevMode(!$input->getOption('no-dev'))
  10123. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  10124. ->setOptimizeAutoloader($optimize)
  10125. ->setClassMapAuthoritative($authoritative)
  10126. ->setApcuAutoloader($apcu, $apcuPrefix)
  10127. ->setUpdate(true)
  10128. ->setInstall(!$input->getOption('no-install'))
  10129. ->setUpdateMirrors($updateMirrors)
  10130. ->setUpdateAllowList($packages)
  10131. ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
  10132. ->setPlatformRequirementFilter($this->getPlatformRequirementFilter($input))
  10133. ->setPreferStable($input->getOption('prefer-stable'))
  10134. ->setPreferLowest($input->getOption('prefer-lowest'))
  10135. ->setTemporaryConstraints($temporaryConstraints)
  10136. ->setAudit(!$input->getOption('no-audit'))
  10137. ->setAuditFormat($this->getAuditFormat($input))
  10138. ->setMinimalUpdate($input->getOption('minimal-changes'))
  10139. ;
  10140. if ($input->getOption('no-plugins')) {
  10141. $install->disablePlugins();
  10142. }
  10143. $result = $install->run();
  10144. if ($result === 0) {
  10145. $bumpAfterUpdate = $input->getOption('bump-after-update');
  10146. if (false === $bumpAfterUpdate) {
  10147. $bumpAfterUpdate = $composer->getConfig()->get('bump-after-update');
  10148. }
  10149. if (false !== $bumpAfterUpdate) {
  10150. $io->writeError('<info>Bumping dependencies</info>');
  10151. $bumpCommand = new BumpCommand();
  10152. $bumpCommand->setComposer($composer);
  10153. $result = $bumpCommand->doBump(
  10154. $io,
  10155. $bumpAfterUpdate === 'dev',
  10156. $bumpAfterUpdate === 'no-dev',
  10157. $input->getOption('dry-run'),
  10158. $input->getArgument('packages')
  10159. );
  10160. }
  10161. }
  10162. return $result;
  10163. }
  10164. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages): array
  10165. {
  10166. if (!$input->isInteractive()) {
  10167. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  10168. }
  10169. $platformReqFilter = $this->getPlatformRequirementFilter($input);
  10170. $stabilityFlags = $composer->getPackage()->getStabilityFlags();
  10171. $requires = array_merge(
  10172. $composer->getPackage()->getRequires(),
  10173. $composer->getPackage()->getDevRequires()
  10174. );
  10175. $filter = \count($packages) > 0 ? BasePackage::packageNamesToRegexp($packages) : null;
  10176. $io->writeError('<info>Loading packages that can be updated...</info>');
  10177. $autocompleterValues = [];
  10178. $installedPackages = $composer->getLocker()->isLocked() ? $composer->getLocker()->getLockedRepository(true)->getPackages() : $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  10179. $versionSelector = $this->createVersionSelector($composer);
  10180. foreach ($installedPackages as $package) {
  10181. if ($filter !== null && !Preg::isMatch($filter, $package->getName())) {
  10182. continue;
  10183. }
  10184. $currentVersion = $package->getPrettyVersion();
  10185. $constraint = isset($requires[$package->getName()]) ? $requires[$package->getName()]->getPrettyConstraint() : null;
  10186. $stability = isset($stabilityFlags[$package->getName()]) ? (string) array_search($stabilityFlags[$package->getName()], BasePackage::STABILITIES, true) : $composer->getPackage()->getMinimumStability();
  10187. $latestVersion = $versionSelector->findBestCandidate($package->getName(), $constraint, $stability, $platformReqFilter);
  10188. if ($latestVersion !== false && ($package->getVersion() !== $latestVersion->getVersion() || $latestVersion->isDev())) {
  10189. $autocompleterValues[$package->getName()] = '<comment>' . $currentVersion . '</comment> => <comment>' . $latestVersion->getPrettyVersion() . '</comment>';
  10190. }
  10191. }
  10192. if (0 === \count($installedPackages)) {
  10193. foreach ($requires as $req => $constraint) {
  10194. if (PlatformRepository::isPlatformPackage($req)) {
  10195. continue;
  10196. }
  10197. $autocompleterValues[$req] = '';
  10198. }
  10199. }
  10200. if (0 === \count($autocompleterValues)) {
  10201. throw new \RuntimeException('Could not find any package with new versions available');
  10202. }
  10203. $packages = $io->select(
  10204. 'Select packages: (Select more than one value separated by comma) ',
  10205. $autocompleterValues,
  10206. false,
  10207. 1,
  10208. 'No package named "%s" is installed.',
  10209. true
  10210. );
  10211. $table = new Table($output);
  10212. $table->setHeaders(['Selected packages']);
  10213. foreach ($packages as $package) {
  10214. $table->addRow([$package]);
  10215. }
  10216. $table->render();
  10217. if ($io->askConfirmation(sprintf(
  10218. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  10219. 1 === count($packages) ? '' : 's'
  10220. ))) {
  10221. return $packages;
  10222. }
  10223. throw new \RuntimeException('Installation aborted.');
  10224. }
  10225. private function createVersionSelector(Composer $composer): VersionSelector
  10226. {
  10227. $repositorySet = new RepositorySet();
  10228. $repositorySet->addRepository(new CompositeRepository(array_filter($composer->getRepositoryManager()->getRepositories(), function (RepositoryInterface $repository) {
  10229. return !$repository instanceof PlatformRepository;
  10230. })));
  10231. return new VersionSelector($repositorySet);
  10232. }
  10233. }
  10234. <?php declare(strict_types=1);
  10235. namespace Composer\Command;
  10236. use Composer\Factory;
  10237. use Composer\IO\IOInterface;
  10238. use Composer\Package\Loader\ValidatingArrayLoader;
  10239. use Composer\Plugin\CommandEvent;
  10240. use Composer\Plugin\PluginEvents;
  10241. use Composer\Repository\InstalledRepository;
  10242. use Composer\Repository\PlatformRepository;
  10243. use Composer\Util\ConfigValidator;
  10244. use Composer\Util\Filesystem;
  10245. use Symfony\Component\Console\Input\InputArgument;
  10246. use Symfony\Component\Console\Input\InputInterface;
  10247. use Symfony\Component\Console\Input\InputOption;
  10248. use Symfony\Component\Console\Output\OutputInterface;
  10249. class ValidateCommand extends BaseCommand
  10250. {
  10251. protected function configure(): void
  10252. {
  10253. $this
  10254. ->setName('validate')
  10255. ->setDescription('Validates a composer.json and composer.lock')
  10256. ->setDefinition([
  10257. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  10258. new InputOption('check-lock', null, InputOption::VALUE_NONE, 'Check if lock file is up to date (even when config.lock is false)'),
  10259. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  10260. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  10261. new InputOption('no-check-version', null, InputOption::VALUE_NONE, 'Do not report a warning if the version field is present'),
  10262. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  10263. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  10264. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  10265. ])
  10266. ->setHelp(
  10267. <<<EOT
  10268. The validate command validates a given composer.json and composer.lock
  10269. Exit codes in case of errors are:
  10270. 1 validation warning(s), only when --strict is given
  10271. 2 validation error(s)
  10272. 3 file unreadable or missing
  10273. Read more at https://getcomposer.org/doc/03-cli.md#validate
  10274. EOT
  10275. );
  10276. }
  10277. protected function execute(InputInterface $input, OutputInterface $output): int
  10278. {
  10279. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  10280. $io = $this->getIO();
  10281. if (!file_exists($file)) {
  10282. $io->writeError('<error>' . $file . ' not found.</error>');
  10283. return 3;
  10284. }
  10285. if (!Filesystem::isReadable($file)) {
  10286. $io->writeError('<error>' . $file . ' is not readable.</error>');
  10287. return 3;
  10288. }
  10289. $validator = new ConfigValidator($io);
  10290. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  10291. $checkPublish = !$input->getOption('no-check-publish');
  10292. $checkLock = !$input->getOption('no-check-lock');
  10293. $checkVersion = $input->getOption('no-check-version') ? 0 : ConfigValidator::CHECK_VERSION;
  10294. $isStrict = $input->getOption('strict');
  10295. [$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion);
  10296. $lockErrors = [];
  10297. $composer = $this->createComposerInstance($input, $io, $file);
  10298. $checkLock = ($checkLock && $composer->getConfig()->get('lock')) || $input->getOption('check-lock');
  10299. $locker = $composer->getLocker();
  10300. if ($locker->isLocked() && !$locker->isFresh()) {
  10301. $lockErrors[] = '- The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update <package name>`.';
  10302. }
  10303. if ($locker->isLocked()) {
  10304. $lockErrors = array_merge($lockErrors, $locker->getMissingRequirementInfo($composer->getPackage(), true));
  10305. }
  10306. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  10307. $exitCode = count($errors) > 0 ? 2 : (($isStrict && count($warnings) > 0) ? 1 : 0);
  10308. if ($input->getOption('with-dependencies')) {
  10309. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  10310. foreach ($localRepo->getPackages() as $package) {
  10311. $path = $composer->getInstallationManager()->getInstallPath($package);
  10312. if (null === $path) {
  10313. continue;
  10314. }
  10315. $file = $path . '/composer.json';
  10316. if (is_dir($path) && file_exists($file)) {
  10317. [$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion);
  10318. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  10319. $depCode = count($errors) > 0 ? 2 : (($isStrict && count($warnings) > 0) ? 1 : 0);
  10320. $exitCode = max($depCode, $exitCode);
  10321. }
  10322. }
  10323. }
  10324. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  10325. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  10326. return max($eventCode, $exitCode);
  10327. }
  10328. private function outputResult(IOInterface $io, string $name, array &$errors, array &$warnings, bool $checkPublish = false, array $publishErrors = [], bool $checkLock = false, array $lockErrors = [], bool $printSchemaUrl = false): void
  10329. {
  10330. $doPrintSchemaUrl = false;
  10331. if ($errors) {
  10332. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  10333. } elseif ($publishErrors) {
  10334. $io->writeError('<info>' . $name . ' is valid for simple usage with Composer but has</info>');
  10335. $io->writeError('<info>strict errors that make it unable to be published as a package</info>');
  10336. $doPrintSchemaUrl = $printSchemaUrl;
  10337. } elseif ($warnings) {
  10338. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  10339. $doPrintSchemaUrl = $printSchemaUrl;
  10340. } elseif ($lockErrors) {
  10341. $io->write('<info>' . $name . ' is valid but your composer.lock has some '.($checkLock ? 'errors' : 'warnings').'</info>');
  10342. } else {
  10343. $io->write('<info>' . $name . ' is valid</info>');
  10344. }
  10345. if ($doPrintSchemaUrl) {
  10346. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  10347. }
  10348. if ($errors) {
  10349. $errors = array_map(static function ($err): string {
  10350. return '- ' . $err;
  10351. }, $errors);
  10352. array_unshift($errors, '# General errors');
  10353. }
  10354. if ($warnings) {
  10355. $warnings = array_map(static function ($err): string {
  10356. return '- ' . $err;
  10357. }, $warnings);
  10358. array_unshift($warnings, '# General warnings');
  10359. }
  10360. $extraWarnings = [];
  10361. if ($publishErrors) {
  10362. $publishErrors = array_map(static function ($err): string {
  10363. return '- ' . $err;
  10364. }, $publishErrors);
  10365. if ($checkPublish) {
  10366. array_unshift($publishErrors, '# Publish errors');
  10367. $errors = array_merge($errors, $publishErrors);
  10368. } else {
  10369. array_unshift($publishErrors, '# Publish warnings');
  10370. $extraWarnings = array_merge($extraWarnings, $publishErrors);
  10371. }
  10372. }
  10373. if ($lockErrors) {
  10374. if ($checkLock) {
  10375. array_unshift($lockErrors, '# Lock file errors');
  10376. $errors = array_merge($errors, $lockErrors);
  10377. } else {
  10378. array_unshift($lockErrors, '# Lock file warnings');
  10379. $extraWarnings = array_merge($extraWarnings, $lockErrors);
  10380. }
  10381. }
  10382. $messages = [
  10383. 'error' => $errors,
  10384. 'warning' => array_merge($warnings, $extraWarnings),
  10385. ];
  10386. foreach ($messages as $style => $msgs) {
  10387. foreach ($msgs as $msg) {
  10388. if (strpos($msg, '#') === 0) {
  10389. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  10390. } else {
  10391. $io->writeError($msg);
  10392. }
  10393. }
  10394. }
  10395. }
  10396. }
  10397. <?php declare(strict_types=1);
  10398. namespace Composer;
  10399. use Composer\Package\Locker;
  10400. use Composer\Pcre\Preg;
  10401. use Composer\Plugin\PluginManager;
  10402. use Composer\Downloader\DownloadManager;
  10403. use Composer\Autoload\AutoloadGenerator;
  10404. use Composer\Package\Archiver\ArchiveManager;
  10405. class Composer extends PartialComposer
  10406. {
  10407. public const VERSION = '2.8.3';
  10408. public const BRANCH_ALIAS_VERSION = '';
  10409. public const RELEASE_DATE = '2024-11-17 13:13:04';
  10410. public const SOURCE_VERSION = '';
  10411. public const RUNTIME_API_VERSION = '2.2.2';
  10412. public static function getVersion(): string
  10413. {
  10414. if (self::VERSION === '@package_version'.'@') {
  10415. return self::SOURCE_VERSION;
  10416. }
  10417. if (self::BRANCH_ALIAS_VERSION !== '' && Preg::isMatch('{^[a-f0-9]{40}$}', self::VERSION)) {
  10418. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  10419. }
  10420. return self::VERSION;
  10421. }
  10422. private $locker;
  10423. private $downloadManager;
  10424. private $pluginManager;
  10425. private $autoloadGenerator;
  10426. private $archiveManager;
  10427. public function setLocker(Locker $locker): void
  10428. {
  10429. $this->locker = $locker;
  10430. }
  10431. public function getLocker(): Locker
  10432. {
  10433. return $this->locker;
  10434. }
  10435. public function setDownloadManager(DownloadManager $manager): void
  10436. {
  10437. $this->downloadManager = $manager;
  10438. }
  10439. public function getDownloadManager(): DownloadManager
  10440. {
  10441. return $this->downloadManager;
  10442. }
  10443. public function setArchiveManager(ArchiveManager $manager): void
  10444. {
  10445. $this->archiveManager = $manager;
  10446. }
  10447. public function getArchiveManager(): ArchiveManager
  10448. {
  10449. return $this->archiveManager;
  10450. }
  10451. public function setPluginManager(PluginManager $manager): void
  10452. {
  10453. $this->pluginManager = $manager;
  10454. }
  10455. public function getPluginManager(): PluginManager
  10456. {
  10457. return $this->pluginManager;
  10458. }
  10459. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator): void
  10460. {
  10461. $this->autoloadGenerator = $autoloadGenerator;
  10462. }
  10463. public function getAutoloadGenerator(): AutoloadGenerator
  10464. {
  10465. return $this->autoloadGenerator;
  10466. }
  10467. }
  10468. <?php declare(strict_types=1);
  10469. namespace Composer;
  10470. use Composer\Advisory\Auditor;
  10471. use Composer\Config\ConfigSourceInterface;
  10472. use Composer\Downloader\TransportException;
  10473. use Composer\IO\IOInterface;
  10474. use Composer\Pcre\Preg;
  10475. use Composer\Util\Platform;
  10476. use Composer\Util\ProcessExecutor;
  10477. class Config
  10478. {
  10479. public const SOURCE_DEFAULT = 'default';
  10480. public const SOURCE_COMMAND = 'command';
  10481. public const SOURCE_UNKNOWN = 'unknown';
  10482. public const RELATIVE_PATHS = 1;
  10483. public static $defaultConfig = [
  10484. 'process-timeout' => 300,
  10485. 'use-include-path' => false,
  10486. 'allow-plugins' => [],
  10487. 'use-parent-dir' => 'prompt',
  10488. 'preferred-install' => 'dist',
  10489. 'audit' => ['ignore' => [], 'abandoned' => Auditor::ABANDONED_FAIL],
  10490. 'notify-on-install' => true,
  10491. 'github-protocols' => ['https', 'ssh', 'git'],
  10492. 'gitlab-protocol' => null,
  10493. 'vendor-dir' => 'vendor',
  10494. 'bin-dir' => '{$vendor-dir}/bin',
  10495. 'cache-dir' => '{$home}/cache',
  10496. 'data-dir' => '{$home}',
  10497. 'cache-files-dir' => '{$cache-dir}/files',
  10498. 'cache-repo-dir' => '{$cache-dir}/repo',
  10499. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  10500. 'cache-ttl' => 15552000,
  10501. 'cache-files-ttl' => null,
  10502. 'cache-files-maxsize' => '300MiB',
  10503. 'cache-read-only' => false,
  10504. 'bin-compat' => 'auto',
  10505. 'discard-changes' => false,
  10506. 'autoloader-suffix' => null,
  10507. 'sort-packages' => false,
  10508. 'optimize-autoloader' => false,
  10509. 'classmap-authoritative' => false,
  10510. 'apcu-autoloader' => false,
  10511. 'prepend-autoloader' => true,
  10512. 'github-domains' => ['github.com'],
  10513. 'bitbucket-expose-hostname' => true,
  10514. 'disable-tls' => false,
  10515. 'secure-http' => true,
  10516. 'secure-svn-domains' => [],
  10517. 'cafile' => null,
  10518. 'capath' => null,
  10519. 'github-expose-hostname' => true,
  10520. 'gitlab-domains' => ['gitlab.com'],
  10521. 'store-auths' => 'prompt',
  10522. 'platform' => [],
  10523. 'archive-format' => 'tar',
  10524. 'archive-dir' => '.',
  10525. 'htaccess-protect' => true,
  10526. 'use-github-api' => true,
  10527. 'lock' => true,
  10528. 'platform-check' => 'php-only',
  10529. 'bitbucket-oauth' => [],
  10530. 'github-oauth' => [],
  10531. 'gitlab-oauth' => [],
  10532. 'gitlab-token' => [],
  10533. 'http-basic' => [],
  10534. 'bearer' => [],
  10535. 'bump-after-update' => false,
  10536. 'allow-missing-requirements' => false,
  10537. ];
  10538. public static $defaultRepositories = [
  10539. 'packagist.org' => [
  10540. 'type' => 'composer',
  10541. 'url' => 'https://repo.packagist.org',
  10542. ],
  10543. ];
  10544. private $config;
  10545. private $baseDir;
  10546. private $repositories;
  10547. private $configSource;
  10548. private $authConfigSource;
  10549. private $localAuthConfigSource = null;
  10550. private $useEnvironment;
  10551. private $warnedHosts = [];
  10552. private $sslVerifyWarnedHosts = [];
  10553. private $sourceOfConfigValue = [];
  10554. public function __construct(bool $useEnvironment = true, ?string $baseDir = null)
  10555. {
  10556. $this->config = static::$defaultConfig;
  10557. $this->repositories = static::$defaultRepositories;
  10558. $this->useEnvironment = $useEnvironment;
  10559. $this->baseDir = is_string($baseDir) && '' !== $baseDir ? $baseDir : null;
  10560. foreach ($this->config as $configKey => $configValue) {
  10561. $this->setSourceOfConfigValue($configValue, $configKey, self::SOURCE_DEFAULT);
  10562. }
  10563. foreach ($this->repositories as $configKey => $configValue) {
  10564. $this->setSourceOfConfigValue($configValue, 'repositories.' . $configKey, self::SOURCE_DEFAULT);
  10565. }
  10566. }
  10567. public function setBaseDir(?string $baseDir): void
  10568. {
  10569. $this->baseDir = $baseDir;
  10570. }
  10571. public function setConfigSource(ConfigSourceInterface $source): void
  10572. {
  10573. $this->configSource = $source;
  10574. }
  10575. public function getConfigSource(): ConfigSourceInterface
  10576. {
  10577. return $this->configSource;
  10578. }
  10579. public function setAuthConfigSource(ConfigSourceInterface $source): void
  10580. {
  10581. $this->authConfigSource = $source;
  10582. }
  10583. public function getAuthConfigSource(): ConfigSourceInterface
  10584. {
  10585. return $this->authConfigSource;
  10586. }
  10587. public function setLocalAuthConfigSource(ConfigSourceInterface $source): void
  10588. {
  10589. $this->localAuthConfigSource = $source;
  10590. }
  10591. public function getLocalAuthConfigSource(): ?ConfigSourceInterface
  10592. {
  10593. return $this->localAuthConfigSource;
  10594. }
  10595. public function merge(array $config, string $source = self::SOURCE_UNKNOWN): void
  10596. {
  10597. if (!empty($config['config']) && is_array($config['config'])) {
  10598. foreach ($config['config'] as $key => $val) {
  10599. if (in_array($key, ['bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer'], true) && isset($this->config[$key])) {
  10600. $this->config[$key] = array_merge($this->config[$key], $val);
  10601. $this->setSourceOfConfigValue($val, $key, $source);
  10602. } elseif (in_array($key, ['allow-plugins'], true) && isset($this->config[$key]) && is_array($this->config[$key]) && is_array($val)) {
  10603. $this->config[$key] = array_merge($val, $this->config[$key], $val);
  10604. $this->setSourceOfConfigValue($val, $key, $source);
  10605. } elseif (in_array($key, ['gitlab-domains', 'github-domains'], true) && isset($this->config[$key])) {
  10606. $this->config[$key] = array_unique(array_merge($this->config[$key], $val));
  10607. $this->setSourceOfConfigValue($val, $key, $source);
  10608. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  10609. if (is_array($val) || is_array($this->config[$key])) {
  10610. if (is_string($val)) {
  10611. $val = ['*' => $val];
  10612. }
  10613. if (is_string($this->config[$key])) {
  10614. $this->config[$key] = ['*' => $this->config[$key]];
  10615. $this->sourceOfConfigValue[$key . '*'] = $source;
  10616. }
  10617. $this->config[$key] = array_merge($this->config[$key], $val);
  10618. $this->setSourceOfConfigValue($val, $key, $source);
  10619. if (isset($this->config[$key]['*'])) {
  10620. $wildcard = $this->config[$key]['*'];
  10621. unset($this->config[$key]['*']);
  10622. $this->config[$key]['*'] = $wildcard;
  10623. }
  10624. } else {
  10625. $this->config[$key] = $val;
  10626. $this->setSourceOfConfigValue($val, $key, $source);
  10627. }
  10628. } elseif ('audit' === $key) {
  10629. $currentIgnores = $this->config['audit']['ignore'];
  10630. $this->config[$key] = array_merge($this->config['audit'], $val);
  10631. $this->setSourceOfConfigValue($val, $key, $source);
  10632. $this->config['audit']['ignore'] = array_merge($currentIgnores, $val['ignore'] ?? []);
  10633. } else {
  10634. $this->config[$key] = $val;
  10635. $this->setSourceOfConfigValue($val, $key, $source);
  10636. }
  10637. }
  10638. }
  10639. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  10640. $this->repositories = array_reverse($this->repositories, true);
  10641. $newRepos = array_reverse($config['repositories'], true);
  10642. foreach ($newRepos as $name => $repository) {
  10643. if (false === $repository) {
  10644. $this->disableRepoByName((string) $name);
  10645. continue;
  10646. }
  10647. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  10648. $this->disableRepoByName((string) key($repository));
  10649. continue;
  10650. }
  10651. if (isset($repository['type'], $repository['url']) && $repository['type'] === 'composer' && Preg::isMatch('{^https?://(?:[a-z0-9-.]+\.)?packagist.org(/|$)}', $repository['url'])) {
  10652. $this->disableRepoByName('packagist.org');
  10653. }
  10654. if (is_int($name)) {
  10655. $this->repositories[] = $repository;
  10656. $this->setSourceOfConfigValue($repository, 'repositories.' . array_search($repository, $this->repositories, true), $source);
  10657. } else {
  10658. if ($name === 'packagist') {
  10659. $this->repositories[$name . '.org'] = $repository;
  10660. $this->setSourceOfConfigValue($repository, 'repositories.' . $name . '.org', $source);
  10661. } else {
  10662. $this->repositories[$name] = $repository;
  10663. $this->setSourceOfConfigValue($repository, 'repositories.' . $name, $source);
  10664. }
  10665. }
  10666. }
  10667. $this->repositories = array_reverse($this->repositories, true);
  10668. }
  10669. }
  10670. public function getRepositories(): array
  10671. {
  10672. return $this->repositories;
  10673. }
  10674. public function get(string $key, int $flags = 0)
  10675. {
  10676. switch ($key) {
  10677. case 'vendor-dir':
  10678. case 'bin-dir':
  10679. case 'process-timeout':
  10680. case 'data-dir':
  10681. case 'cache-dir':
  10682. case 'cache-files-dir':
  10683. case 'cache-repo-dir':
  10684. case 'cache-vcs-dir':
  10685. case 'cafile':
  10686. case 'capath':
  10687. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  10688. $val = $this->getComposerEnv($env);
  10689. if ($val !== false) {
  10690. $this->setSourceOfConfigValue($val, $key, $env);
  10691. }
  10692. if ($key === 'process-timeout') {
  10693. return max(0, false !== $val ? (int) $val : $this->config[$key]);
  10694. }
  10695. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  10696. $val = Platform::expandPath($val);
  10697. if (substr($key, -4) !== '-dir') {
  10698. return $val;
  10699. }
  10700. return (($flags & self::RELATIVE_PATHS) === self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  10701. case 'cache-read-only':
  10702. case 'htaccess-protect':
  10703. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  10704. $val = $this->getComposerEnv($env);
  10705. if (false === $val) {
  10706. $val = $this->config[$key];
  10707. } else {
  10708. $this->setSourceOfConfigValue($val, $key, $env);
  10709. }
  10710. return $val !== 'false' && (bool) $val;
  10711. case 'disable-tls':
  10712. case 'secure-http':
  10713. case 'use-github-api':
  10714. case 'lock':
  10715. if ($key === 'secure-http' && $this->get('disable-tls') === true) {
  10716. return false;
  10717. }
  10718. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  10719. case 'cache-ttl':
  10720. return max(0, (int) $this->config[$key]);
  10721. case 'cache-files-maxsize':
  10722. if (!Preg::isMatch('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', (string) $this->config[$key], $matches)) {
  10723. throw new \RuntimeException(
  10724. "Could not parse the value of '$key': {$this->config[$key]}"
  10725. );
  10726. }
  10727. $size = (float) $matches[1];
  10728. if (isset($matches[2])) {
  10729. switch (strtolower($matches[2])) {
  10730. case 'g':
  10731. $size *= 1024;
  10732. case 'm':
  10733. $size *= 1024;
  10734. case 'k':
  10735. $size *= 1024;
  10736. break;
  10737. }
  10738. }
  10739. return max(0, (int) $size);
  10740. case 'cache-files-ttl':
  10741. if (isset($this->config[$key])) {
  10742. return max(0, (int) $this->config[$key]);
  10743. }
  10744. return $this->get('cache-ttl');
  10745. case 'home':
  10746. return rtrim($this->process(Platform::expandPath($this->config[$key]), $flags), '/\\');
  10747. case 'bin-compat':
  10748. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  10749. if (!in_array($value, ['auto', 'full', 'proxy', 'symlink'])) {
  10750. throw new \RuntimeException(
  10751. "Invalid value for 'bin-compat': {$value}. Expected auto, full or proxy"
  10752. );
  10753. }
  10754. if ($value === 'symlink') {
  10755. trigger_error('config.bin-compat "symlink" is deprecated since Composer 2.2, use auto, full (for Windows compatibility) or proxy instead.', E_USER_DEPRECATED);
  10756. }
  10757. return $value;
  10758. case 'discard-changes':
  10759. $env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES');
  10760. if ($env !== false) {
  10761. if (!in_array($env, ['stash', 'true', 'false', '1', '0'], true)) {
  10762. throw new \RuntimeException(
  10763. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  10764. );
  10765. }
  10766. if ('stash' === $env) {
  10767. return 'stash';
  10768. }
  10769. return $env !== 'false' && (bool) $env;
  10770. }
  10771. if (!in_array($this->config[$key], [true, false, 'stash'], true)) {
  10772. throw new \RuntimeException(
  10773. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  10774. );
  10775. }
  10776. return $this->config[$key];
  10777. case 'github-protocols':
  10778. $protos = $this->config['github-protocols'];
  10779. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  10780. unset($protos[$index]);
  10781. }
  10782. if (reset($protos) === 'http') {
  10783. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  10784. }
  10785. return $protos;
  10786. case 'autoloader-suffix':
  10787. if ($this->config[$key] === '') {
  10788. return null;
  10789. }
  10790. return $this->process($this->config[$key], $flags);
  10791. case 'audit':
  10792. $result = $this->config[$key];
  10793. $abandonedEnv = $this->getComposerEnv('COMPOSER_AUDIT_ABANDONED');
  10794. if (false !== $abandonedEnv) {
  10795. if (!in_array($abandonedEnv, $validChoices = Auditor::ABANDONEDS, true)) {
  10796. throw new \RuntimeException(
  10797. "Invalid value for COMPOSER_AUDIT_ABANDONED: {$abandonedEnv}. Expected one of ".implode(', ', Auditor::ABANDONEDS)."."
  10798. );
  10799. }
  10800. $result['abandoned'] = $abandonedEnv;
  10801. }
  10802. return $result;
  10803. default:
  10804. if (!isset($this->config[$key])) {
  10805. return null;
  10806. }
  10807. return $this->process($this->config[$key], $flags);
  10808. }
  10809. }
  10810. public function all(int $flags = 0): array
  10811. {
  10812. $all = [
  10813. 'repositories' => $this->getRepositories(),
  10814. ];
  10815. foreach (array_keys($this->config) as $key) {
  10816. $all['config'][$key] = $this->get($key, $flags);
  10817. }
  10818. return $all;
  10819. }
  10820. public function getSourceOfValue(string $key): string
  10821. {
  10822. $this->get($key);
  10823. return $this->sourceOfConfigValue[$key] ?? self::SOURCE_UNKNOWN;
  10824. }
  10825. private function setSourceOfConfigValue($configValue, string $path, string $source): void
  10826. {
  10827. $this->sourceOfConfigValue[$path] = $source;
  10828. if (is_array($configValue)) {
  10829. foreach ($configValue as $key => $value) {
  10830. $this->setSourceOfConfigValue($value, $path . '.' . $key, $source);
  10831. }
  10832. }
  10833. }
  10834. public function raw(): array
  10835. {
  10836. return [
  10837. 'repositories' => $this->getRepositories(),
  10838. 'config' => $this->config,
  10839. ];
  10840. }
  10841. public function has(string $key): bool
  10842. {
  10843. return array_key_exists($key, $this->config);
  10844. }
  10845. private function process($value, int $flags)
  10846. {
  10847. if (!is_string($value)) {
  10848. return $value;
  10849. }
  10850. return Preg::replaceCallback('#\{\$(.+)\}#', function ($match) use ($flags) {
  10851. return $this->get($match[1], $flags);
  10852. }, $value);
  10853. }
  10854. private function realpath(string $path): string
  10855. {
  10856. if (Preg::isMatch('{^(?:/|[a-z]:|[a-z0-9.]+://|\\\\\\\\)}i', $path)) {
  10857. return $path;
  10858. }
  10859. return $this->baseDir !== null ? $this->baseDir . '/' . $path : $path;
  10860. }
  10861. private function getComposerEnv(string $var)
  10862. {
  10863. if ($this->useEnvironment) {
  10864. return Platform::getEnv($var);
  10865. }
  10866. return false;
  10867. }
  10868. private function disableRepoByName(string $name): void
  10869. {
  10870. if (isset($this->repositories[$name])) {
  10871. unset($this->repositories[$name]);
  10872. } elseif ($name === 'packagist') {
  10873. unset($this->repositories['packagist.org']);
  10874. }
  10875. }
  10876. public function prohibitUrlByConfig(string $url, ?IOInterface $io = null, array $repoOptions = []): void
  10877. {
  10878. if (false === filter_var($url, FILTER_VALIDATE_URL) && !Preg::isMatch('{^https?://}', $url)) {
  10879. return;
  10880. }
  10881. $scheme = parse_url($url, PHP_URL_SCHEME);
  10882. $hostname = parse_url($url, PHP_URL_HOST);
  10883. if (in_array($scheme, ['http', 'git', 'ftp', 'svn'])) {
  10884. if ($this->get('secure-http')) {
  10885. if ($scheme === 'svn') {
  10886. if (in_array($hostname, $this->get('secure-svn-domains'), true)) {
  10887. return;
  10888. }
  10889. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-svn-domains for details.");
  10890. }
  10891. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  10892. }
  10893. if ($io !== null) {
  10894. if (is_string($hostname)) {
  10895. if (!isset($this->warnedHosts[$hostname])) {
  10896. $io->writeError("<warning>Warning: Accessing $hostname over $scheme which is an insecure protocol.</warning>");
  10897. }
  10898. $this->warnedHosts[$hostname] = true;
  10899. }
  10900. }
  10901. }
  10902. if ($io !== null && is_string($hostname) && !isset($this->sslVerifyWarnedHosts[$hostname])) {
  10903. $warning = null;
  10904. if (isset($repoOptions['ssl']['verify_peer']) && !(bool) $repoOptions['ssl']['verify_peer']) {
  10905. $warning = 'verify_peer';
  10906. }
  10907. if (isset($repoOptions['ssl']['verify_peer_name']) && !(bool) $repoOptions['ssl']['verify_peer_name']) {
  10908. $warning = $warning === null ? 'verify_peer_name' : $warning . ' and verify_peer_name';
  10909. }
  10910. if ($warning !== null) {
  10911. $io->writeError("<warning>Warning: Accessing $hostname with $warning disabled.</warning>");
  10912. $this->sslVerifyWarnedHosts[$hostname] = true;
  10913. }
  10914. }
  10915. }
  10916. public static function disableProcessTimeout(): void
  10917. {
  10918. ProcessExecutor::setTimeout(0);
  10919. }
  10920. }
  10921. <?php declare(strict_types=1);
  10922. namespace Composer\Config;
  10923. interface ConfigSourceInterface
  10924. {
  10925. public function addRepository(string $name, $config, bool $append = true): void;
  10926. public function removeRepository(string $name): void;
  10927. public function addConfigSetting(string $name, $value): void;
  10928. public function removeConfigSetting(string $name): void;
  10929. public function addProperty(string $name, $value): void;
  10930. public function removeProperty(string $name): void;
  10931. public function addLink(string $type, string $name, string $value): void;
  10932. public function removeLink(string $type, string $name): void;
  10933. public function getName(): string;
  10934. }
  10935. <?php declare(strict_types=1);
  10936. namespace Composer\Config;
  10937. use Composer\Json\JsonFile;
  10938. use Composer\Json\JsonManipulator;
  10939. use Composer\Json\JsonValidationException;
  10940. use Composer\Pcre\Preg;
  10941. use Composer\Util\Filesystem;
  10942. use Composer\Util\Silencer;
  10943. class JsonConfigSource implements ConfigSourceInterface
  10944. {
  10945. private $file;
  10946. private $authConfig;
  10947. public function __construct(JsonFile $file, bool $authConfig = false)
  10948. {
  10949. $this->file = $file;
  10950. $this->authConfig = $authConfig;
  10951. }
  10952. public function getName(): string
  10953. {
  10954. return $this->file->getPath();
  10955. }
  10956. public function addRepository(string $name, $config, bool $append = true): void
  10957. {
  10958. $this->manipulateJson('addRepository', static function (&$config, $repo, $repoConfig) use ($append): void {
  10959. if (isset($config['repositories'])) {
  10960. foreach ($config['repositories'] as $index => $val) {
  10961. if ($index === $repo) {
  10962. continue;
  10963. }
  10964. if (is_numeric($index) && ($val === ['packagist' => false] || $val === ['packagist.org' => false])) {
  10965. unset($config['repositories'][$index]);
  10966. $config['repositories']['packagist.org'] = false;
  10967. break;
  10968. }
  10969. }
  10970. }
  10971. if ($append) {
  10972. $config['repositories'][$repo] = $repoConfig;
  10973. } else {
  10974. $config['repositories'] = [$repo => $repoConfig] + $config['repositories'];
  10975. }
  10976. }, $name, $config, $append);
  10977. }
  10978. public function removeRepository(string $name): void
  10979. {
  10980. $this->manipulateJson('removeRepository', static function (&$config, $repo): void {
  10981. unset($config['repositories'][$repo]);
  10982. }, $name);
  10983. }
  10984. public function addConfigSetting(string $name, $value): void
  10985. {
  10986. $authConfig = $this->authConfig;
  10987. $this->manipulateJson('addConfigSetting', static function (&$config, $key, $val) use ($authConfig): void {
  10988. if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  10989. [$key, $host] = explode('.', $key, 2);
  10990. if ($authConfig) {
  10991. $config[$key][$host] = $val;
  10992. } else {
  10993. $config['config'][$key][$host] = $val;
  10994. }
  10995. } else {
  10996. $config['config'][$key] = $val;
  10997. }
  10998. }, $name, $value);
  10999. }
  11000. public function removeConfigSetting(string $name): void
  11001. {
  11002. $authConfig = $this->authConfig;
  11003. $this->manipulateJson('removeConfigSetting', static function (&$config, $key) use ($authConfig): void {
  11004. if (Preg::isMatch('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  11005. [$key, $host] = explode('.', $key, 2);
  11006. if ($authConfig) {
  11007. unset($config[$key][$host]);
  11008. } else {
  11009. unset($config['config'][$key][$host]);
  11010. }
  11011. } else {
  11012. unset($config['config'][$key]);
  11013. }
  11014. }, $name);
  11015. }
  11016. public function addProperty(string $name, $value): void
  11017. {
  11018. $this->manipulateJson('addProperty', static function (&$config, $key, $val): void {
  11019. if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0) {
  11020. $bits = explode('.', $key);
  11021. $last = array_pop($bits);
  11022. $arr = &$config[reset($bits)];
  11023. foreach ($bits as $bit) {
  11024. if (!isset($arr[$bit])) {
  11025. $arr[$bit] = [];
  11026. }
  11027. $arr = &$arr[$bit];
  11028. }
  11029. $arr[$last] = $val;
  11030. } else {
  11031. $config[$key] = $val;
  11032. }
  11033. }, $name, $value);
  11034. }
  11035. public function removeProperty(string $name): void
  11036. {
  11037. $this->manipulateJson('removeProperty', static function (&$config, $key): void {
  11038. if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0 || stripos($key, 'autoload.') === 0 || stripos($key, 'autoload-dev.') === 0) {
  11039. $bits = explode('.', $key);
  11040. $last = array_pop($bits);
  11041. $arr = &$config[reset($bits)];
  11042. foreach ($bits as $bit) {
  11043. if (!isset($arr[$bit])) {
  11044. return;
  11045. }
  11046. $arr = &$arr[$bit];
  11047. }
  11048. unset($arr[$last]);
  11049. } else {
  11050. unset($config[$key]);
  11051. }
  11052. }, $name);
  11053. }
  11054. public function addLink(string $type, string $name, string $value): void
  11055. {
  11056. $this->manipulateJson('addLink', static function (&$config, $type, $name, $value): void {
  11057. $config[$type][$name] = $value;
  11058. }, $type, $name, $value);
  11059. }
  11060. public function removeLink(string $type, string $name): void
  11061. {
  11062. $this->manipulateJson('removeSubNode', static function (&$config, $type, $name): void {
  11063. unset($config[$type][$name]);
  11064. }, $type, $name);
  11065. $this->manipulateJson('removeMainKeyIfEmpty', static function (&$config, $type): void {
  11066. if (0 === count($config[$type])) {
  11067. unset($config[$type]);
  11068. }
  11069. }, $type);
  11070. }
  11071. private function manipulateJson(string $method, callable $fallback, ...$args): void
  11072. {
  11073. if ($this->file->exists()) {
  11074. if (!is_writable($this->file->getPath())) {
  11075. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  11076. }
  11077. if (!Filesystem::isReadable($this->file->getPath())) {
  11078. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  11079. }
  11080. $contents = file_get_contents($this->file->getPath());
  11081. } elseif ($this->authConfig) {
  11082. $contents = "{\n}\n";
  11083. } else {
  11084. $contents = "{\n \"config\": {\n }\n}\n";
  11085. }
  11086. $manipulator = new JsonManipulator($contents);
  11087. $newFile = !$this->file->exists();
  11088. if ($this->authConfig && $method === 'addConfigSetting') {
  11089. $method = 'addSubNode';
  11090. [$mainNode, $name] = explode('.', $args[0], 2);
  11091. $args = [$mainNode, $name, $args[1]];
  11092. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  11093. $method = 'removeSubNode';
  11094. [$mainNode, $name] = explode('.', $args[0], 2);
  11095. $args = [$mainNode, $name];
  11096. }
  11097. if (call_user_func_array([$manipulator, $method], $args)) {
  11098. file_put_contents($this->file->getPath(), $manipulator->getContents());
  11099. } else {
  11100. $config = $this->file->read();
  11101. $this->arrayUnshiftRef($args, $config);
  11102. $fallback(...$args);
  11103. foreach (['require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev', 'scripts', 'scripts-descriptions', 'scripts-aliases', 'support'] as $prop) {
  11104. if (isset($config[$prop]) && $config[$prop] === []) {
  11105. $config[$prop] = new \stdClass;
  11106. }
  11107. }
  11108. foreach (['psr-0', 'psr-4'] as $prop) {
  11109. if (isset($config['autoload'][$prop]) && $config['autoload'][$prop] === []) {
  11110. $config['autoload'][$prop] = new \stdClass;
  11111. }
  11112. if (isset($config['autoload-dev'][$prop]) && $config['autoload-dev'][$prop] === []) {
  11113. $config['autoload-dev'][$prop] = new \stdClass;
  11114. }
  11115. }
  11116. foreach (['platform', 'http-basic', 'bearer', 'gitlab-token', 'gitlab-oauth', 'github-oauth', 'preferred-install'] as $prop) {
  11117. if (isset($config['config'][$prop]) && $config['config'][$prop] === []) {
  11118. $config['config'][$prop] = new \stdClass;
  11119. }
  11120. }
  11121. $this->file->write($config);
  11122. }
  11123. try {
  11124. $this->file->validateSchema(JsonFile::LAX_SCHEMA);
  11125. } catch (JsonValidationException $e) {
  11126. file_put_contents($this->file->getPath(), $contents);
  11127. throw new \RuntimeException('Failed to update composer.json with a valid format, reverting to the original content. Please report an issue to us with details (command you run and a copy of your composer.json). '.PHP_EOL.implode(PHP_EOL, $e->getErrors()), 0, $e);
  11128. }
  11129. if ($newFile) {
  11130. Silencer::call('chmod', $this->file->getPath(), 0600);
  11131. }
  11132. }
  11133. private function arrayUnshiftRef(array &$array, &$value): int
  11134. {
  11135. $return = array_unshift($array, '');
  11136. $array[0] = &$value;
  11137. return $return;
  11138. }
  11139. }
  11140. <?php declare(strict_types=1);
  11141. namespace Composer\Console;
  11142. use Composer\Installer;
  11143. use Composer\IO\NullIO;
  11144. use Composer\Util\Filesystem;
  11145. use Composer\Util\Platform;
  11146. use Composer\Util\Silencer;
  11147. use LogicException;
  11148. use RuntimeException;
  11149. use Symfony\Component\Console\Application as BaseApplication;
  11150. use Symfony\Component\Console\Exception\CommandNotFoundException;
  11151. use Symfony\Component\Console\Helper\HelperSet;
  11152. use Symfony\Component\Console\Helper\QuestionHelper;
  11153. use Symfony\Component\Console\Input\InputDefinition;
  11154. use Symfony\Component\Console\Input\InputInterface;
  11155. use Symfony\Component\Console\Input\InputOption;
  11156. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  11157. use Symfony\Component\Console\Output\OutputInterface;
  11158. use Seld\JsonLint\ParsingException;
  11159. use Composer\Command;
  11160. use Composer\Composer;
  11161. use Composer\Factory;
  11162. use Composer\Downloader\TransportException;
  11163. use Composer\IO\IOInterface;
  11164. use Composer\IO\ConsoleIO;
  11165. use Composer\Json\JsonValidationException;
  11166. use Composer\Util\ErrorHandler;
  11167. use Composer\Util\HttpDownloader;
  11168. use Composer\EventDispatcher\ScriptExecutionException;
  11169. use Composer\Exception\NoSslException;
  11170. use Composer\XdebugHandler\XdebugHandler;
  11171. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  11172. class Application extends BaseApplication
  11173. {
  11174. protected $composer;
  11175. protected $io;
  11176. private static $logo = ' ______
  11177. / ____/___ ____ ___ ____ ____ ________ _____
  11178. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  11179. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  11180. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  11181. /_/
  11182. ';
  11183. private $hasPluginCommands = false;
  11184. private $disablePluginsByDefault = false;
  11185. private $disableScriptsByDefault = false;
  11186. private $initialWorkingDirectory;
  11187. public function __construct(string $name = 'Composer', string $version = '')
  11188. {
  11189. if (method_exists($this, 'setCatchErrors')) {
  11190. $this->setCatchErrors(true);
  11191. }
  11192. static $shutdownRegistered = false;
  11193. if ($version === '') {
  11194. $version = Composer::getVersion();
  11195. }
  11196. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  11197. ini_set('xdebug.show_exception_trace', '0');
  11198. ini_set('xdebug.scream', '0');
  11199. }
  11200. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  11201. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  11202. }
  11203. $this->io = new NullIO();
  11204. if (!$shutdownRegistered) {
  11205. $shutdownRegistered = true;
  11206. register_shutdown_function(static function (): void {
  11207. $lastError = error_get_last();
  11208. if ($lastError && $lastError['message'] &&
  11209. (strpos($lastError['message'], 'Allowed memory') !== false ||
  11210. strpos($lastError['message'], 'exceeded memory') !== false )) {
  11211. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  11212. }
  11213. });
  11214. }
  11215. $this->initialWorkingDirectory = getcwd();
  11216. parent::__construct($name, $version);
  11217. }
  11218. public function __destruct()
  11219. {
  11220. }
  11221. public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
  11222. {
  11223. if (null === $output) {
  11224. $output = Factory::createOutput();
  11225. }
  11226. return parent::run($input, $output);
  11227. }
  11228. public function doRun(InputInterface $input, OutputInterface $output): int
  11229. {
  11230. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  11231. $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts');
  11232. static $stdin = null;
  11233. if (null === $stdin) {
  11234. $stdin = defined('STDIN') ? STDIN : fopen('php://stdin', 'r');
  11235. }
  11236. if (Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') !== '1' && (Platform::getEnv('COMPOSER_NO_INTERACTION') || $stdin === false || !Platform::isTty($stdin))) {
  11237. $input->setInteractive(false);
  11238. }
  11239. $io = $this->io = new ConsoleIO($input, $output, new HelperSet([
  11240. new QuestionHelper(),
  11241. ]));
  11242. ErrorHandler::register($io);
  11243. if ($input->hasParameterOption('--no-cache')) {
  11244. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  11245. Platform::putEnv('COMPOSER_CACHE_DIR', Platform::isWindows() ? 'nul' : '/dev/null');
  11246. }
  11247. $newWorkDir = $this->getNewWorkingDir($input);
  11248. if (null !== $newWorkDir) {
  11249. $oldWorkingDir = Platform::getCwd(true);
  11250. chdir($newWorkDir);
  11251. $this->initialWorkingDirectory = $newWorkDir;
  11252. $cwd = Platform::getCwd(true);
  11253. $io->writeError('Changed CWD to ' . ($cwd !== '' ? $cwd : $newWorkDir), true, IOInterface::DEBUG);
  11254. }
  11255. $commandName = '';
  11256. if ($name = $this->getCommandName($input)) {
  11257. try {
  11258. $commandName = $this->find($name)->getName();
  11259. } catch (CommandNotFoundException $e) {
  11260. $commandName = false;
  11261. } catch (\InvalidArgumentException $e) {
  11262. }
  11263. }
  11264. if (
  11265. null === $newWorkDir
  11266. && !in_array($commandName, ['', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'], true)
  11267. && !file_exists(Factory::getComposerFile())
  11268. && ($useParentDirIfNoJsonAvailable = $this->getUseParentDirConfigValue()) !== false
  11269. && ($commandName !== 'config' || ($input->hasParameterOption('--file', true) === false && $input->hasParameterOption('-f', true) === false))
  11270. && $input->hasParameterOption('--help', true) === false
  11271. && $input->hasParameterOption('-h', true) === false
  11272. ) {
  11273. $dir = dirname(Platform::getCwd(true));
  11274. $home = realpath(Platform::getEnv('HOME') ?: Platform::getEnv('USERPROFILE') ?: '/');
  11275. while (dirname($dir) !== $dir && $dir !== $home) {
  11276. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  11277. if ($useParentDirIfNoJsonAvailable !== true && !$io->isInteractive()) {
  11278. $io->writeError('<info>No composer.json in current directory, to use the one at '.$dir.' run interactively or set config.use-parent-dir to true</info>');
  11279. break;
  11280. }
  11281. if ($useParentDirIfNoJsonAvailable === true || $io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ')) {
  11282. if ($useParentDirIfNoJsonAvailable === true) {
  11283. $io->writeError('<info>No composer.json in current directory, changing working directory to '.$dir.'</info>');
  11284. } else {
  11285. $io->writeError('<info>Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default.</info>');
  11286. }
  11287. $oldWorkingDir = Platform::getCwd(true);
  11288. chdir($dir);
  11289. }
  11290. break;
  11291. }
  11292. $dir = dirname($dir);
  11293. }
  11294. unset($dir, $home);
  11295. }
  11296. $needsSudoCheck = !Platform::isWindows()
  11297. && function_exists('exec')
  11298. && !Platform::getEnv('COMPOSER_ALLOW_SUPERUSER')
  11299. && !Platform::isDocker();
  11300. $isNonAllowedRoot = false;
  11301. if ($needsSudoCheck) {
  11302. $isNonAllowedRoot = $this->isRunningAsRoot();
  11303. if ($isNonAllowedRoot) {
  11304. if ($uid = (int) Platform::getEnv('SUDO_UID')) {
  11305. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  11306. }
  11307. }
  11308. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  11309. }
  11310. $mayNeedPluginCommand = false === $input->hasParameterOption(['--version', '-V'])
  11311. && (
  11312. false === $commandName
  11313. || in_array($commandName, ['', 'list', 'help'], true)
  11314. || ($commandName === '_complete' && !$isNonAllowedRoot)
  11315. );
  11316. if ($mayNeedPluginCommand && !$this->disablePluginsByDefault && !$this->hasPluginCommands) {
  11317. if ($isNonAllowedRoot) {
  11318. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  11319. if ($io->isInteractive() && $io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ')) {
  11320. $isNonAllowedRoot = false;
  11321. } else {
  11322. $io->writeError('<warning>Aborting as no plugin should be loaded if running as super user is not explicitly allowed</warning>');
  11323. return 1;
  11324. }
  11325. }
  11326. try {
  11327. foreach ($this->getPluginCommands() as $command) {
  11328. if ($this->has($command->getName())) {
  11329. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  11330. } else {
  11331. $this->add($command);
  11332. }
  11333. }
  11334. } catch (NoSslException $e) {
  11335. } catch (ParsingException $e) {
  11336. $details = $e->getDetails();
  11337. $file = realpath(Factory::getComposerFile());
  11338. $line = null;
  11339. if ($details && isset($details['line'])) {
  11340. $line = $details['line'];
  11341. }
  11342. $ghe = new GithubActionError($this->io);
  11343. $ghe->emit($e->getMessage(), $file, $line);
  11344. throw $e;
  11345. }
  11346. $this->hasPluginCommands = true;
  11347. }
  11348. if (!$this->disablePluginsByDefault && $isNonAllowedRoot && !$io->isInteractive()) {
  11349. $io->writeError('<error>Composer plugins have been disabled for safety in this non-interactive session.</error>');
  11350. $io->writeError('<error>Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.</error>');
  11351. $this->disablePluginsByDefault = true;
  11352. }
  11353. $isProxyCommand = false;
  11354. if ($name = $this->getCommandName($input)) {
  11355. try {
  11356. $command = $this->find($name);
  11357. $commandName = $command->getName();
  11358. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  11359. } catch (\InvalidArgumentException $e) {
  11360. }
  11361. }
  11362. if (!$isProxyCommand) {
  11363. $io->writeError(sprintf(
  11364. 'Running %s (%s) with %s on %s',
  11365. Composer::getVersion(),
  11366. Composer::RELEASE_DATE,
  11367. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  11368. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  11369. ), true, IOInterface::DEBUG);
  11370. if (\PHP_VERSION_ID < 70205) {
  11371. $io->writeError('<warning>Composer supports PHP 7.2.5 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.'. Upgrading is strongly recommended but you can use Composer 2.2.x LTS as a fallback.</warning>');
  11372. }
  11373. if (XdebugHandler::isXdebugActive() && !Platform::getEnv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  11374. $io->writeError('<warning>Composer is operating slower than normal because you have Xdebug enabled. See https://getcomposer.org/xdebug</warning>');
  11375. }
  11376. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  11377. $io->writeError(sprintf('<warning>Warning: This development build of Composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  11378. }
  11379. if ($isNonAllowedRoot) {
  11380. if ($commandName !== 'self-update' && $commandName !== 'selfupdate' && $commandName !== '_complete') {
  11381. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  11382. if ($io->isInteractive()) {
  11383. if (!$io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ')) {
  11384. return 1;
  11385. }
  11386. }
  11387. }
  11388. }
  11389. Silencer::call(static function () use ($io): void {
  11390. $pid = function_exists('getmypid') ? getmypid() . '-' : '';
  11391. $tempfile = sys_get_temp_dir() . '/temp-' . $pid . bin2hex(random_bytes(5));
  11392. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) === __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  11393. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  11394. }
  11395. });
  11396. $file = Factory::getComposerFile();
  11397. if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  11398. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  11399. foreach ($composer['scripts'] as $script => $dummy) {
  11400. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  11401. if ($this->has($script)) {
  11402. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  11403. } else {
  11404. $description = null;
  11405. if (isset($composer['scripts-descriptions'][$script])) {
  11406. $description = $composer['scripts-descriptions'][$script];
  11407. }
  11408. $aliases = $composer['scripts-aliases'][$script] ?? [];
  11409. $this->add(new Command\ScriptAliasCommand($script, $description, $aliases));
  11410. }
  11411. }
  11412. }
  11413. }
  11414. }
  11415. }
  11416. try {
  11417. if ($input->hasParameterOption('--profile')) {
  11418. $startTime = microtime(true);
  11419. $this->io->enableDebugging($startTime);
  11420. }
  11421. $result = parent::doRun($input, $output);
  11422. if (true === $input->hasParameterOption(['--version', '-V'], true)) {
  11423. $io->writeError(sprintf('<info>PHP</info> version <comment>%s</comment> (%s)', \PHP_VERSION, \PHP_BINARY));
  11424. $io->writeError('Run the "diagnose" command to get more detailed diagnostics output.');
  11425. }
  11426. if (isset($oldWorkingDir) && '' !== $oldWorkingDir) {
  11427. Silencer::call('chdir', $oldWorkingDir);
  11428. }
  11429. if (isset($startTime)) {
  11430. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s</info>');
  11431. }
  11432. return $result;
  11433. } catch (ScriptExecutionException $e) {
  11434. if ($this->getDisablePluginsByDefault() && $this->isRunningAsRoot() && !$this->io->isInteractive()) {
  11435. $io->writeError('<error>Plugins have been disabled automatically as you are running as root, this may be the cause of the script failure.</error>', true, IOInterface::QUIET);
  11436. $io->writeError('<error>See also https://getcomposer.org/root</error>', true, IOInterface::QUIET);
  11437. }
  11438. return $e->getCode();
  11439. } catch (\Throwable $e) {
  11440. $ghe = new GithubActionError($this->io);
  11441. $ghe->emit($e->getMessage());
  11442. $this->hintCommonErrors($e, $output);
  11443. if (!method_exists($this, 'setCatchErrors') && !$e instanceof \Exception) {
  11444. if ($output instanceof ConsoleOutputInterface) {
  11445. $this->renderThrowable($e, $output->getErrorOutput());
  11446. } else {
  11447. $this->renderThrowable($e, $output);
  11448. }
  11449. return max(1, $e->getCode());
  11450. }
  11451. if ($e instanceof TransportException) {
  11452. $reflProp = new \ReflectionProperty($e, 'code');
  11453. $reflProp->setAccessible(true);
  11454. $reflProp->setValue($e, Installer::ERROR_TRANSPORT_EXCEPTION);
  11455. }
  11456. throw $e;
  11457. } finally {
  11458. restore_error_handler();
  11459. }
  11460. }
  11461. private function getNewWorkingDir(InputInterface $input): ?string
  11462. {
  11463. $workingDir = $input->getParameterOption(['--working-dir', '-d'], null, true);
  11464. if (null !== $workingDir && !is_dir($workingDir)) {
  11465. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  11466. }
  11467. return $workingDir;
  11468. }
  11469. private function hintCommonErrors(\Throwable $exception, OutputInterface $output): void
  11470. {
  11471. $io = $this->getIO();
  11472. if ((get_class($exception) === LogicException::class || $exception instanceof \Error) && $output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) {
  11473. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  11474. }
  11475. Silencer::suppress();
  11476. try {
  11477. $composer = $this->getComposer(false, true);
  11478. if (null !== $composer && function_exists('disk_free_space')) {
  11479. $config = $composer->getConfig();
  11480. $minSpaceFree = 100 * 1024 * 1024;
  11481. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  11482. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  11483. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  11484. ) {
  11485. $io->writeError('<error>The disk hosting '.$dir.' has less than 100MiB of free space, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  11486. }
  11487. }
  11488. } catch (\Exception $e) {
  11489. }
  11490. Silencer::restore();
  11491. if ($exception instanceof TransportException && str_contains($exception->getMessage(), 'Unable to use a proxy')) {
  11492. $io->writeError('<error>The following exception indicates your proxy is misconfigured</error>', true, IOInterface::QUIET);
  11493. $io->writeError('<error>Check https://getcomposer.org/doc/faqs/how-to-use-composer-behind-a-proxy.md for details</error>', true, IOInterface::QUIET);
  11494. }
  11495. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  11496. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  11497. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  11498. }
  11499. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  11500. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  11501. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  11502. }
  11503. if ($exception instanceof ProcessTimedOutException) {
  11504. $io->writeError('<error>The following exception is caused by a process timeout</error>', true, IOInterface::QUIET);
  11505. $io->writeError('<error>Check https://getcomposer.org/doc/06-config.md#process-timeout for details</error>', true, IOInterface::QUIET);
  11506. }
  11507. if ($this->getDisablePluginsByDefault() && $this->isRunningAsRoot() && !$this->io->isInteractive()) {
  11508. $io->writeError('<error>Plugins have been disabled automatically as you are running as root, this may be the cause of the following exception. See also https://getcomposer.org/root</error>', true, IOInterface::QUIET);
  11509. } elseif ($exception instanceof CommandNotFoundException && $this->getDisablePluginsByDefault()) {
  11510. $io->writeError('<error>Plugins have been disabled, which may be why some commands are missing, unless you made a typo</error>', true, IOInterface::QUIET);
  11511. }
  11512. $hints = HttpDownloader::getExceptionHints($exception);
  11513. if (null !== $hints && count($hints) > 0) {
  11514. foreach ($hints as $hint) {
  11515. $io->writeError($hint, true, IOInterface::QUIET);
  11516. }
  11517. }
  11518. }
  11519. public function getComposer(bool $required = true, ?bool $disablePlugins = null, ?bool $disableScripts = null): ?Composer
  11520. {
  11521. if (null === $disablePlugins) {
  11522. $disablePlugins = $this->disablePluginsByDefault;
  11523. }
  11524. if (null === $disableScripts) {
  11525. $disableScripts = $this->disableScriptsByDefault;
  11526. }
  11527. if (null === $this->composer) {
  11528. try {
  11529. $this->composer = Factory::create(Platform::isInputCompletionProcess() ? new NullIO() : $this->io, null, $disablePlugins, $disableScripts);
  11530. } catch (\InvalidArgumentException $e) {
  11531. if ($required) {
  11532. $this->io->writeError($e->getMessage());
  11533. if ($this->areExceptionsCaught()) {
  11534. exit(1);
  11535. }
  11536. throw $e;
  11537. }
  11538. } catch (JsonValidationException $e) {
  11539. if ($required) {
  11540. throw $e;
  11541. }
  11542. } catch (RuntimeException $e) {
  11543. if ($required) {
  11544. throw $e;
  11545. }
  11546. }
  11547. }
  11548. return $this->composer;
  11549. }
  11550. public function resetComposer(): void
  11551. {
  11552. $this->composer = null;
  11553. if (method_exists($this->getIO(), 'resetAuthentications')) {
  11554. $this->getIO()->resetAuthentications();
  11555. }
  11556. }
  11557. public function getIO(): IOInterface
  11558. {
  11559. return $this->io;
  11560. }
  11561. public function getHelp(): string
  11562. {
  11563. return self::$logo . parent::getHelp();
  11564. }
  11565. protected function getDefaultCommands(): array
  11566. {
  11567. $commands = array_merge(parent::getDefaultCommands(), [
  11568. new Command\AboutCommand(),
  11569. new Command\ConfigCommand(),
  11570. new Command\DependsCommand(),
  11571. new Command\ProhibitsCommand(),
  11572. new Command\InitCommand(),
  11573. new Command\InstallCommand(),
  11574. new Command\CreateProjectCommand(),
  11575. new Command\UpdateCommand(),
  11576. new Command\SearchCommand(),
  11577. new Command\ValidateCommand(),
  11578. new Command\AuditCommand(),
  11579. new Command\ShowCommand(),
  11580. new Command\SuggestsCommand(),
  11581. new Command\RequireCommand(),
  11582. new Command\DumpAutoloadCommand(),
  11583. new Command\StatusCommand(),
  11584. new Command\ArchiveCommand(),
  11585. new Command\DiagnoseCommand(),
  11586. new Command\RunScriptCommand(),
  11587. new Command\LicensesCommand(),
  11588. new Command\GlobalCommand(),
  11589. new Command\ClearCacheCommand(),
  11590. new Command\RemoveCommand(),
  11591. new Command\HomeCommand(),
  11592. new Command\ExecCommand(),
  11593. new Command\OutdatedCommand(),
  11594. new Command\CheckPlatformReqsCommand(),
  11595. new Command\FundCommand(),
  11596. new Command\ReinstallCommand(),
  11597. new Command\BumpCommand(),
  11598. ]);
  11599. if (strpos(__FILE__, 'phar:') === 0 || '1' === Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
  11600. $commands[] = new Command\SelfUpdateCommand();
  11601. }
  11602. return $commands;
  11603. }
  11604. public function getLongVersion(): string
  11605. {
  11606. $branchAliasString = '';
  11607. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  11608. $branchAliasString = sprintf(' (%s)', Composer::BRANCH_ALIAS_VERSION);
  11609. }
  11610. return sprintf(
  11611. '<info>%s</info> version <comment>%s%s</comment> %s',
  11612. $this->getName(),
  11613. $this->getVersion(),
  11614. $branchAliasString,
  11615. Composer::RELEASE_DATE
  11616. );
  11617. }
  11618. protected function getDefaultInputDefinition(): InputDefinition
  11619. {
  11620. $definition = parent::getDefaultInputDefinition();
  11621. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  11622. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  11623. $definition->addOption(new InputOption('--no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'));
  11624. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  11625. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  11626. return $definition;
  11627. }
  11628. private function getPluginCommands(): array
  11629. {
  11630. $commands = [];
  11631. $composer = $this->getComposer(false, false);
  11632. if (null === $composer) {
  11633. $composer = Factory::createGlobal($this->io, $this->disablePluginsByDefault, $this->disableScriptsByDefault);
  11634. }
  11635. if (null !== $composer) {
  11636. $pm = $composer->getPluginManager();
  11637. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', ['composer' => $composer, 'io' => $this->io]) as $capability) {
  11638. $newCommands = $capability->getCommands();
  11639. if (!is_array($newCommands)) {
  11640. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  11641. }
  11642. foreach ($newCommands as $command) {
  11643. if (!$command instanceof Command\BaseCommand) {
  11644. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  11645. }
  11646. }
  11647. $commands = array_merge($commands, $newCommands);
  11648. }
  11649. }
  11650. return $commands;
  11651. }
  11652. public function getInitialWorkingDirectory()
  11653. {
  11654. return $this->initialWorkingDirectory;
  11655. }
  11656. public function getDisablePluginsByDefault(): bool
  11657. {
  11658. return $this->disablePluginsByDefault;
  11659. }
  11660. public function getDisableScriptsByDefault(): bool
  11661. {
  11662. return $this->disableScriptsByDefault;
  11663. }
  11664. private function getUseParentDirConfigValue()
  11665. {
  11666. $config = Factory::createConfig($this->io);
  11667. return $config->get('use-parent-dir');
  11668. }
  11669. private function isRunningAsRoot(): bool
  11670. {
  11671. return function_exists('posix_getuid') && posix_getuid() === 0;
  11672. }
  11673. }
  11674. <?php declare(strict_types=1);
  11675. namespace Composer\Console;
  11676. use Composer\IO\IOInterface;
  11677. use Composer\Util\Platform;
  11678. final class GithubActionError
  11679. {
  11680. protected $io;
  11681. public function __construct(IOInterface $io)
  11682. {
  11683. $this->io = $io;
  11684. }
  11685. public function emit(string $message, ?string $file = null, ?int $line = null): void
  11686. {
  11687. if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
  11688. $message = $this->escapeData($message);
  11689. if ($file && $line) {
  11690. $file = $this->escapeProperty($file);
  11691. $this->io->write("::error file=". $file .",line=". $line ."::". $message);
  11692. } elseif ($file) {
  11693. $file = $this->escapeProperty($file);
  11694. $this->io->write("::error file=". $file ."::". $message);
  11695. } else {
  11696. $this->io->write("::error ::". $message);
  11697. }
  11698. }
  11699. }
  11700. private function escapeData(string $data): string
  11701. {
  11702. $data = str_replace("%", '%25', $data);
  11703. $data = str_replace("\r", '%0D', $data);
  11704. $data = str_replace("\n", '%0A', $data);
  11705. return $data;
  11706. }
  11707. private function escapeProperty(string $property): string
  11708. {
  11709. $property = str_replace("%", '%25', $property);
  11710. $property = str_replace("\r", '%0D', $property);
  11711. $property = str_replace("\n", '%0A', $property);
  11712. $property = str_replace(":", '%3A', $property);
  11713. $property = str_replace(",", '%2C', $property);
  11714. return $property;
  11715. }
  11716. }
  11717. <?php declare(strict_types=1);
  11718. namespace Composer\Console;
  11719. use Closure;
  11720. use Composer\Pcre\Preg;
  11721. use Symfony\Component\Console\Formatter\OutputFormatter;
  11722. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  11723. class HtmlOutputFormatter extends OutputFormatter
  11724. {
  11725. private static $availableForegroundColors = [
  11726. 30 => 'black',
  11727. 31 => 'red',
  11728. 32 => 'green',
  11729. 33 => 'yellow',
  11730. 34 => 'blue',
  11731. 35 => 'magenta',
  11732. 36 => 'cyan',
  11733. 37 => 'white',
  11734. ];
  11735. private static $availableBackgroundColors = [
  11736. 40 => 'black',
  11737. 41 => 'red',
  11738. 42 => 'green',
  11739. 43 => 'yellow',
  11740. 44 => 'blue',
  11741. 45 => 'magenta',
  11742. 46 => 'cyan',
  11743. 47 => 'white',
  11744. ];
  11745. private static $availableOptions = [
  11746. 1 => 'bold',
  11747. 4 => 'underscore',
  11748. ];
  11749. public function __construct(array $styles = [])
  11750. {
  11751. parent::__construct(true, $styles);
  11752. }
  11753. public function format(?string $message): ?string
  11754. {
  11755. $formatted = parent::format($message);
  11756. if ($formatted === null) {
  11757. return null;
  11758. }
  11759. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  11760. return Preg::replaceCallback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", Closure::fromCallable([$this, 'formatHtml']), $formatted);
  11761. }
  11762. private function formatHtml(array $matches): string
  11763. {
  11764. assert(is_string($matches[1]));
  11765. $out = '<span style="';
  11766. foreach (explode(';', $matches[1]) as $code) {
  11767. if (isset(self::$availableForegroundColors[(int) $code])) {
  11768. $out .= 'color:'.self::$availableForegroundColors[(int) $code].';';
  11769. } elseif (isset(self::$availableBackgroundColors[(int) $code])) {
  11770. $out .= 'background-color:'.self::$availableBackgroundColors[(int) $code].';';
  11771. } elseif (isset(self::$availableOptions[(int) $code])) {
  11772. switch (self::$availableOptions[(int) $code]) {
  11773. case 'bold':
  11774. $out .= 'font-weight:bold;';
  11775. break;
  11776. case 'underscore':
  11777. $out .= 'text-decoration:underline;';
  11778. break;
  11779. }
  11780. }
  11781. }
  11782. return $out.'">'.$matches[2].'</span>';
  11783. }
  11784. }
  11785. <?php declare(strict_types=1);
  11786. namespace Composer\Console\Input;
  11787. use Symfony\Component\Console\Completion\CompletionInput;
  11788. use Symfony\Component\Console\Completion\CompletionSuggestions;
  11789. use Symfony\Component\Console\Completion\Suggestion;
  11790. use Symfony\Component\Console\Exception\InvalidArgumentException;
  11791. use Symfony\Component\Console\Exception\LogicException;
  11792. use Symfony\Component\Console\Input\InputArgument as BaseInputArgument;
  11793. class InputArgument extends BaseInputArgument
  11794. {
  11795. private $suggestedValues;
  11796. public function __construct(string $name, ?int $mode = null, string $description = '', $default = null, $suggestedValues = [])
  11797. {
  11798. parent::__construct($name, $mode, $description, $default);
  11799. $this->suggestedValues = $suggestedValues;
  11800. }
  11801. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  11802. {
  11803. $values = $this->suggestedValues;
  11804. if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) {
  11805. throw new LogicException(sprintf('Closure for option "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
  11806. }
  11807. if ([] !== $values) {
  11808. $suggestions->suggestValues($values);
  11809. }
  11810. }
  11811. }
  11812. <?php declare(strict_types=1);
  11813. namespace Composer\Console\Input;
  11814. use Symfony\Component\Console\Completion\CompletionInput;
  11815. use Symfony\Component\Console\Completion\CompletionSuggestions;
  11816. use Symfony\Component\Console\Completion\Suggestion;
  11817. use Symfony\Component\Console\Exception\InvalidArgumentException;
  11818. use Symfony\Component\Console\Exception\LogicException;
  11819. use Symfony\Component\Console\Input\InputOption as BaseInputOption;
  11820. class InputOption extends BaseInputOption
  11821. {
  11822. private $suggestedValues;
  11823. public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null, $suggestedValues = [])
  11824. {
  11825. parent::__construct($name, $shortcut, $mode, $description, $default);
  11826. $this->suggestedValues = $suggestedValues;
  11827. if ([] !== $suggestedValues && !$this->acceptValue()) {
  11828. throw new LogicException('Cannot set suggested values if the option does not accept a value.');
  11829. }
  11830. }
  11831. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  11832. {
  11833. $values = $this->suggestedValues;
  11834. if ($values instanceof \Closure && !\is_array($values = $values($input, $suggestions))) {
  11835. throw new LogicException(sprintf('Closure for argument "%s" must return an array. Got "%s".', $this->getName(), get_debug_type($values)));
  11836. }
  11837. if ([] !== $values) {
  11838. $suggestions->suggestValues($values);
  11839. }
  11840. }
  11841. }
  11842. <?php declare(strict_types=1);
  11843. namespace Composer\DependencyResolver;
  11844. class Decisions implements \Iterator, \Countable
  11845. {
  11846. public const DECISION_LITERAL = 0;
  11847. public const DECISION_REASON = 1;
  11848. protected $pool;
  11849. protected $decisionMap;
  11850. protected $decisionQueue = [];
  11851. public function __construct(Pool $pool)
  11852. {
  11853. $this->pool = $pool;
  11854. $this->decisionMap = [];
  11855. }
  11856. public function decide(int $literal, int $level, Rule $why): void
  11857. {
  11858. $this->addDecision($literal, $level);
  11859. $this->decisionQueue[] = [
  11860. self::DECISION_LITERAL => $literal,
  11861. self::DECISION_REASON => $why,
  11862. ];
  11863. }
  11864. public function satisfy(int $literal): bool
  11865. {
  11866. $packageId = abs($literal);
  11867. return (
  11868. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  11869. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  11870. );
  11871. }
  11872. public function conflict(int $literal): bool
  11873. {
  11874. $packageId = abs($literal);
  11875. return (
  11876. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  11877. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  11878. );
  11879. }
  11880. public function decided(int $literalOrPackageId): bool
  11881. {
  11882. return ($this->decisionMap[abs($literalOrPackageId)] ?? 0) !== 0;
  11883. }
  11884. public function undecided(int $literalOrPackageId): bool
  11885. {
  11886. return ($this->decisionMap[abs($literalOrPackageId)] ?? 0) === 0;
  11887. }
  11888. public function decidedInstall(int $literalOrPackageId): bool
  11889. {
  11890. $packageId = abs($literalOrPackageId);
  11891. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  11892. }
  11893. public function decisionLevel(int $literalOrPackageId): int
  11894. {
  11895. $packageId = abs($literalOrPackageId);
  11896. if (isset($this->decisionMap[$packageId])) {
  11897. return abs($this->decisionMap[$packageId]);
  11898. }
  11899. return 0;
  11900. }
  11901. public function decisionRule(int $literalOrPackageId): Rule
  11902. {
  11903. $packageId = abs($literalOrPackageId);
  11904. foreach ($this->decisionQueue as $decision) {
  11905. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  11906. return $decision[self::DECISION_REASON];
  11907. }
  11908. }
  11909. throw new \LogicException('Did not find a decision rule using '.$literalOrPackageId);
  11910. }
  11911. public function atOffset(int $queueOffset): array
  11912. {
  11913. return $this->decisionQueue[$queueOffset];
  11914. }
  11915. public function validOffset(int $queueOffset): bool
  11916. {
  11917. return $queueOffset >= 0 && $queueOffset < \count($this->decisionQueue);
  11918. }
  11919. public function lastReason(): Rule
  11920. {
  11921. return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_REASON];
  11922. }
  11923. public function lastLiteral(): int
  11924. {
  11925. return $this->decisionQueue[\count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  11926. }
  11927. public function reset(): void
  11928. {
  11929. while ($decision = array_pop($this->decisionQueue)) {
  11930. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  11931. }
  11932. }
  11933. public function resetToOffset(int $offset): void
  11934. {
  11935. while (\count($this->decisionQueue) > $offset + 1) {
  11936. $decision = array_pop($this->decisionQueue);
  11937. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  11938. }
  11939. }
  11940. public function revertLast(): void
  11941. {
  11942. $this->decisionMap[abs($this->lastLiteral())] = 0;
  11943. array_pop($this->decisionQueue);
  11944. }
  11945. public function count(): int
  11946. {
  11947. return \count($this->decisionQueue);
  11948. }
  11949. public function rewind(): void
  11950. {
  11951. end($this->decisionQueue);
  11952. }
  11953. #[\ReturnTypeWillChange]
  11954. public function current()
  11955. {
  11956. return current($this->decisionQueue);
  11957. }
  11958. public function key(): ?int
  11959. {
  11960. return key($this->decisionQueue);
  11961. }
  11962. public function next(): void
  11963. {
  11964. prev($this->decisionQueue);
  11965. }
  11966. public function valid(): bool
  11967. {
  11968. return false !== current($this->decisionQueue);
  11969. }
  11970. public function isEmpty(): bool
  11971. {
  11972. return \count($this->decisionQueue) === 0;
  11973. }
  11974. protected function addDecision(int $literal, int $level): void
  11975. {
  11976. $packageId = abs($literal);
  11977. $previousDecision = $this->decisionMap[$packageId] ?? 0;
  11978. if ($previousDecision !== 0) {
  11979. $literalString = $this->pool->literalToPrettyString($literal, []);
  11980. $package = $this->pool->literalToPackage($literal);
  11981. throw new SolverBugException(
  11982. "Trying to decide $literalString on level $level, even though $package was previously decided as ".$previousDecision."."
  11983. );
  11984. }
  11985. if ($literal > 0) {
  11986. $this->decisionMap[$packageId] = $level;
  11987. } else {
  11988. $this->decisionMap[$packageId] = -$level;
  11989. }
  11990. }
  11991. public function toString(?Pool $pool = null): string
  11992. {
  11993. $decisionMap = $this->decisionMap;
  11994. ksort($decisionMap);
  11995. $str = '[';
  11996. foreach ($decisionMap as $packageId => $level) {
  11997. $str .= ($pool !== null ? $pool->literalToPackage($packageId) : $packageId).':'.$level.',';
  11998. }
  11999. $str .= ']';
  12000. return $str;
  12001. }
  12002. public function __toString(): string
  12003. {
  12004. return $this->toString();
  12005. }
  12006. }
  12007. <?php declare(strict_types=1);
  12008. namespace Composer\DependencyResolver;
  12009. use Composer\Package\AliasPackage;
  12010. use Composer\Package\BasePackage;
  12011. use Composer\Package\PackageInterface;
  12012. use Composer\Semver\CompilingMatcher;
  12013. use Composer\Semver\Constraint\Constraint;
  12014. class DefaultPolicy implements PolicyInterface
  12015. {
  12016. private $preferStable;
  12017. private $preferLowest;
  12018. private $preferredVersions;
  12019. private $preferredPackageResultCachePerPool;
  12020. private $sortingCachePerPool;
  12021. public function __construct(bool $preferStable = false, bool $preferLowest = false, ?array $preferredVersions = null)
  12022. {
  12023. $this->preferStable = $preferStable;
  12024. $this->preferLowest = $preferLowest;
  12025. $this->preferredVersions = $preferredVersions;
  12026. }
  12027. public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool
  12028. {
  12029. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  12030. return BasePackage::STABILITIES[$stabA] < BasePackage::STABILITIES[$stabB];
  12031. }
  12032. if (($a->isDev() && str_starts_with($a->getVersion(), 'dev-')) || ($b->isDev() && str_starts_with($b->getVersion(), 'dev-'))) {
  12033. $constraint = new Constraint($operator, $b->getVersion());
  12034. $version = new Constraint('==', $a->getVersion());
  12035. return $constraint->matchSpecific($version, true);
  12036. }
  12037. return CompilingMatcher::match(new Constraint($operator, $b->getVersion()), Constraint::OP_EQ, $a->getVersion());
  12038. }
  12039. public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array
  12040. {
  12041. sort($literals);
  12042. $resultCacheKey = implode(',', $literals).$requiredPackage;
  12043. $poolId = spl_object_id($pool);
  12044. if (isset($this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey])) {
  12045. return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey];
  12046. }
  12047. $packages = $this->groupLiteralsByName($pool, $literals);
  12048. foreach ($packages as &$nameLiterals) {
  12049. usort($nameLiterals, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
  12050. $cacheKey = 'i'.$a.'.'.$b.$requiredPackage;
  12051. if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
  12052. return $this->sortingCachePerPool[$poolId][$cacheKey];
  12053. }
  12054. return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  12055. });
  12056. }
  12057. foreach ($packages as &$sortedLiterals) {
  12058. $sortedLiterals = $this->pruneToBestVersion($pool, $sortedLiterals);
  12059. $sortedLiterals = $this->pruneRemoteAliases($pool, $sortedLiterals);
  12060. }
  12061. $selected = array_merge(...array_values($packages));
  12062. usort($selected, function ($a, $b) use ($pool, $requiredPackage, $poolId): int {
  12063. $cacheKey = $a.'.'.$b.$requiredPackage;
  12064. if (isset($this->sortingCachePerPool[$poolId][$cacheKey])) {
  12065. return $this->sortingCachePerPool[$poolId][$cacheKey];
  12066. }
  12067. return $this->sortingCachePerPool[$poolId][$cacheKey] = $this->compareByPriority($pool, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  12068. });
  12069. return $this->preferredPackageResultCachePerPool[$poolId][$resultCacheKey] = $selected;
  12070. }
  12071. protected function groupLiteralsByName(Pool $pool, array $literals): array
  12072. {
  12073. $packages = [];
  12074. foreach ($literals as $literal) {
  12075. $packageName = $pool->literalToPackage($literal)->getName();
  12076. if (!isset($packages[$packageName])) {
  12077. $packages[$packageName] = [];
  12078. }
  12079. $packages[$packageName][] = $literal;
  12080. }
  12081. return $packages;
  12082. }
  12083. public function compareByPriority(Pool $pool, BasePackage $a, BasePackage $b, ?string $requiredPackage = null, bool $ignoreReplace = false): int
  12084. {
  12085. if ($a->getName() === $b->getName()) {
  12086. $aAliased = $a instanceof AliasPackage;
  12087. $bAliased = $b instanceof AliasPackage;
  12088. if ($aAliased && !$bAliased) {
  12089. return -1;
  12090. }
  12091. if (!$aAliased && $bAliased) {
  12092. return 1;
  12093. }
  12094. }
  12095. if (!$ignoreReplace) {
  12096. if ($this->replaces($a, $b)) {
  12097. return 1;
  12098. }
  12099. if ($this->replaces($b, $a)) {
  12100. return -1;
  12101. }
  12102. if ($requiredPackage !== null && false !== ($pos = strpos($requiredPackage, '/'))) {
  12103. $requiredVendor = substr($requiredPackage, 0, $pos);
  12104. $aIsSameVendor = strpos($a->getName(), $requiredVendor) === 0;
  12105. $bIsSameVendor = strpos($b->getName(), $requiredVendor) === 0;
  12106. if ($bIsSameVendor !== $aIsSameVendor) {
  12107. return $aIsSameVendor ? -1 : 1;
  12108. }
  12109. }
  12110. }
  12111. if ($a->id === $b->id) {
  12112. return 0;
  12113. }
  12114. return ($a->id < $b->id) ? -1 : 1;
  12115. }
  12116. protected function replaces(BasePackage $source, BasePackage $target): bool
  12117. {
  12118. foreach ($source->getReplaces() as $link) {
  12119. if ($link->getTarget() === $target->getName()
  12120. ) {
  12121. return true;
  12122. }
  12123. }
  12124. return false;
  12125. }
  12126. protected function pruneToBestVersion(Pool $pool, array $literals): array
  12127. {
  12128. if ($this->preferredVersions !== null) {
  12129. $name = $pool->literalToPackage($literals[0])->getName();
  12130. if (isset($this->preferredVersions[$name])) {
  12131. $preferredVersion = $this->preferredVersions[$name];
  12132. $bestLiterals = [];
  12133. foreach ($literals as $literal) {
  12134. if ($pool->literalToPackage($literal)->getVersion() === $preferredVersion) {
  12135. $bestLiterals[] = $literal;
  12136. }
  12137. }
  12138. if (\count($bestLiterals) > 0) {
  12139. return $bestLiterals;
  12140. }
  12141. }
  12142. }
  12143. $operator = $this->preferLowest ? '<' : '>';
  12144. $bestLiterals = [$literals[0]];
  12145. $bestPackage = $pool->literalToPackage($literals[0]);
  12146. foreach ($literals as $i => $literal) {
  12147. if (0 === $i) {
  12148. continue;
  12149. }
  12150. $package = $pool->literalToPackage($literal);
  12151. if ($this->versionCompare($package, $bestPackage, $operator)) {
  12152. $bestPackage = $package;
  12153. $bestLiterals = [$literal];
  12154. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  12155. $bestLiterals[] = $literal;
  12156. }
  12157. }
  12158. return $bestLiterals;
  12159. }
  12160. protected function pruneRemoteAliases(Pool $pool, array $literals): array
  12161. {
  12162. $hasLocalAlias = false;
  12163. foreach ($literals as $literal) {
  12164. $package = $pool->literalToPackage($literal);
  12165. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  12166. $hasLocalAlias = true;
  12167. break;
  12168. }
  12169. }
  12170. if (!$hasLocalAlias) {
  12171. return $literals;
  12172. }
  12173. $selected = [];
  12174. foreach ($literals as $literal) {
  12175. $package = $pool->literalToPackage($literal);
  12176. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  12177. $selected[] = $literal;
  12178. }
  12179. }
  12180. return $selected;
  12181. }
  12182. }
  12183. <?php declare(strict_types=1);
  12184. namespace Composer\DependencyResolver;
  12185. class GenericRule extends Rule
  12186. {
  12187. protected $literals;
  12188. public function __construct(array $literals, $reason, $reasonData)
  12189. {
  12190. parent::__construct($reason, $reasonData);
  12191. sort($literals);
  12192. $this->literals = $literals;
  12193. }
  12194. public function getLiterals(): array
  12195. {
  12196. return $this->literals;
  12197. }
  12198. public function getHash()
  12199. {
  12200. $data = unpack('ihash', (string) hash(\PHP_VERSION_ID > 80100 ? 'xxh3' : 'sha1', implode(',', $this->literals), true));
  12201. if (false === $data) {
  12202. throw new \RuntimeException('Failed unpacking: '.implode(', ', $this->literals));
  12203. }
  12204. return $data['hash'];
  12205. }
  12206. public function equals(Rule $rule): bool
  12207. {
  12208. return $this->literals === $rule->getLiterals();
  12209. }
  12210. public function isAssertion(): bool
  12211. {
  12212. return 1 === \count($this->literals);
  12213. }
  12214. public function __toString(): string
  12215. {
  12216. $result = $this->isDisabled() ? 'disabled(' : '(';
  12217. foreach ($this->literals as $i => $literal) {
  12218. if ($i !== 0) {
  12219. $result .= '|';
  12220. }
  12221. $result .= $literal;
  12222. }
  12223. $result .= ')';
  12224. return $result;
  12225. }
  12226. }
  12227. <?php declare(strict_types=1);
  12228. namespace Composer\DependencyResolver;
  12229. use Composer\Repository\InstalledRepositoryInterface;
  12230. use Composer\Repository\RepositoryInterface;
  12231. class LocalRepoTransaction extends Transaction
  12232. {
  12233. public function __construct(RepositoryInterface $lockedRepository, InstalledRepositoryInterface $localRepository)
  12234. {
  12235. parent::__construct(
  12236. $localRepository->getPackages(),
  12237. $lockedRepository->getPackages()
  12238. );
  12239. }
  12240. }
  12241. <?php declare(strict_types=1);
  12242. namespace Composer\DependencyResolver;
  12243. use Composer\Package\AliasPackage;
  12244. use Composer\Package\BasePackage;
  12245. use Composer\Package\Package;
  12246. use Composer\Pcre\Preg;
  12247. class LockTransaction extends Transaction
  12248. {
  12249. protected $presentMap;
  12250. protected $unlockableMap;
  12251. protected $resultPackages;
  12252. public function __construct(Pool $pool, array $presentMap, array $unlockableMap, Decisions $decisions)
  12253. {
  12254. $this->presentMap = $presentMap;
  12255. $this->unlockableMap = $unlockableMap;
  12256. $this->setResultPackages($pool, $decisions);
  12257. parent::__construct($this->presentMap, $this->resultPackages['all']);
  12258. }
  12259. public function setResultPackages(Pool $pool, Decisions $decisions): void
  12260. {
  12261. $this->resultPackages = ['all' => [], 'non-dev' => [], 'dev' => []];
  12262. foreach ($decisions as $i => $decision) {
  12263. $literal = $decision[Decisions::DECISION_LITERAL];
  12264. if ($literal > 0) {
  12265. $package = $pool->literalToPackage($literal);
  12266. $this->resultPackages['all'][] = $package;
  12267. if (!isset($this->unlockableMap[$package->id])) {
  12268. $this->resultPackages['non-dev'][] = $package;
  12269. }
  12270. }
  12271. }
  12272. }
  12273. public function setNonDevPackages(LockTransaction $extractionResult): void
  12274. {
  12275. $packages = $extractionResult->getNewLockPackages(false);
  12276. $this->resultPackages['dev'] = $this->resultPackages['non-dev'];
  12277. $this->resultPackages['non-dev'] = [];
  12278. foreach ($packages as $package) {
  12279. foreach ($this->resultPackages['dev'] as $i => $resultPackage) {
  12280. if ($package->getName() === $resultPackage->getName()) {
  12281. $this->resultPackages['non-dev'][] = $resultPackage;
  12282. unset($this->resultPackages['dev'][$i]);
  12283. }
  12284. }
  12285. }
  12286. }
  12287. public function getNewLockPackages(bool $devMode, bool $updateMirrors = false): array
  12288. {
  12289. $packages = [];
  12290. foreach ($this->resultPackages[$devMode ? 'dev' : 'non-dev'] as $package) {
  12291. if ($package instanceof AliasPackage) {
  12292. continue;
  12293. }
  12294. if ($updateMirrors === true && !array_key_exists(spl_object_hash($package), $this->presentMap)) {
  12295. $package = $this->updateMirrorAndUrls($package);
  12296. }
  12297. $packages[] = $package;
  12298. }
  12299. return $packages;
  12300. }
  12301. private function updateMirrorAndUrls(BasePackage $package): BasePackage
  12302. {
  12303. foreach ($this->presentMap as $presentPackage) {
  12304. if ($package->getName() !== $presentPackage->getName()) {
  12305. continue;
  12306. }
  12307. if ($package->getVersion() !== $presentPackage->getVersion()) {
  12308. continue;
  12309. }
  12310. if ($presentPackage->getSourceReference() === null) {
  12311. continue;
  12312. }
  12313. if ($presentPackage->getSourceType() !== $package->getSourceType()) {
  12314. continue;
  12315. }
  12316. if ($presentPackage instanceof Package) {
  12317. $presentPackage->setSourceUrl($package->getSourceUrl());
  12318. $presentPackage->setSourceMirrors($package->getSourceMirrors());
  12319. }
  12320. if ($presentPackage->getDistType() !== $package->getDistType()) {
  12321. return $presentPackage;
  12322. }
  12323. if (
  12324. $package->getDistUrl() !== null
  12325. && $presentPackage->getDistReference() !== null
  12326. && Preg::isMatch('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())
  12327. ) {
  12328. $presentPackage->setDistUrl(Preg::replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $presentPackage->getDistReference(), $package->getDistUrl()));
  12329. }
  12330. $presentPackage->setDistMirrors($package->getDistMirrors());
  12331. return $presentPackage;
  12332. }
  12333. return $package;
  12334. }
  12335. public function getAliases(array $aliases): array
  12336. {
  12337. $usedAliases = [];
  12338. foreach ($this->resultPackages['all'] as $package) {
  12339. if ($package instanceof AliasPackage) {
  12340. foreach ($aliases as $index => $alias) {
  12341. if ($alias['package'] === $package->getName()) {
  12342. $usedAliases[] = $alias;
  12343. unset($aliases[$index]);
  12344. }
  12345. }
  12346. }
  12347. }
  12348. usort($usedAliases, static function ($a, $b): int {
  12349. return strcmp($a['package'], $b['package']);
  12350. });
  12351. return $usedAliases;
  12352. }
  12353. }
  12354. <?php declare(strict_types=1);
  12355. namespace Composer\DependencyResolver;
  12356. class MultiConflictRule extends Rule
  12357. {
  12358. protected $literals;
  12359. public function __construct(array $literals, $reason, $reasonData)
  12360. {
  12361. parent::__construct($reason, $reasonData);
  12362. if (\count($literals) < 3) {
  12363. throw new \RuntimeException("multi conflict rule requires at least 3 literals");
  12364. }
  12365. sort($literals);
  12366. $this->literals = $literals;
  12367. }
  12368. public function getLiterals(): array
  12369. {
  12370. return $this->literals;
  12371. }
  12372. public function getHash()
  12373. {
  12374. $data = unpack('ihash', (string) hash(\PHP_VERSION_ID > 80100 ? 'xxh3' : 'sha1', 'c:'.implode(',', $this->literals), true));
  12375. if (false === $data) {
  12376. throw new \RuntimeException('Failed unpacking: '.implode(', ', $this->literals));
  12377. }
  12378. return $data['hash'];
  12379. }
  12380. public function equals(Rule $rule): bool
  12381. {
  12382. if ($rule instanceof MultiConflictRule) {
  12383. return $this->literals === $rule->getLiterals();
  12384. }
  12385. return false;
  12386. }
  12387. public function isAssertion(): bool
  12388. {
  12389. return false;
  12390. }
  12391. public function disable(): void
  12392. {
  12393. throw new \RuntimeException("Disabling multi conflict rules is not possible. Please contact composer at https://github.com/composer/composer to let us debug what lead to this situation.");
  12394. }
  12395. public function __toString(): string
  12396. {
  12397. $result = $this->isDisabled() ? 'disabled(multi(' : '(multi(';
  12398. foreach ($this->literals as $i => $literal) {
  12399. if ($i !== 0) {
  12400. $result .= '|';
  12401. }
  12402. $result .= $literal;
  12403. }
  12404. $result .= '))';
  12405. return $result;
  12406. }
  12407. }
  12408. <?php declare(strict_types=1);
  12409. namespace Composer\DependencyResolver\Operation;
  12410. use Composer\Package\PackageInterface;
  12411. class InstallOperation extends SolverOperation implements OperationInterface
  12412. {
  12413. protected const TYPE = 'install';
  12414. protected $package;
  12415. public function __construct(PackageInterface $package)
  12416. {
  12417. $this->package = $package;
  12418. }
  12419. public function getPackage(): PackageInterface
  12420. {
  12421. return $this->package;
  12422. }
  12423. public function show($lock): string
  12424. {
  12425. return self::format($this->package, $lock);
  12426. }
  12427. public static function format(PackageInterface $package, bool $lock = false): string
  12428. {
  12429. return ($lock ? 'Locking ' : 'Installing ').'<info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
  12430. }
  12431. }
  12432. <?php declare(strict_types=1);
  12433. namespace Composer\DependencyResolver\Operation;
  12434. use Composer\Package\AliasPackage;
  12435. class MarkAliasInstalledOperation extends SolverOperation implements OperationInterface
  12436. {
  12437. protected const TYPE = 'markAliasInstalled';
  12438. protected $package;
  12439. public function __construct(AliasPackage $package)
  12440. {
  12441. $this->package = $package;
  12442. }
  12443. public function getPackage(): AliasPackage
  12444. {
  12445. return $this->package;
  12446. }
  12447. public function show($lock): string
  12448. {
  12449. return 'Marking <info>'.$this->package->getPrettyName().'</info> (<comment>'.$this->package->getFullPrettyVersion().'</comment>) as installed, alias of <info>'.$this->package->getAliasOf()->getPrettyName().'</info> (<comment>'.$this->package->getAliasOf()->getFullPrettyVersion().'</comment>)';
  12450. }
  12451. }
  12452. <?php declare(strict_types=1);
  12453. namespace Composer\DependencyResolver\Operation;
  12454. use Composer\Package\AliasPackage;
  12455. class MarkAliasUninstalledOperation extends SolverOperation implements OperationInterface
  12456. {
  12457. protected const TYPE = 'markAliasUninstalled';
  12458. protected $package;
  12459. public function __construct(AliasPackage $package)
  12460. {
  12461. $this->package = $package;
  12462. }
  12463. public function getPackage(): AliasPackage
  12464. {
  12465. return $this->package;
  12466. }
  12467. public function show($lock): string
  12468. {
  12469. return 'Marking <info>'.$this->package->getPrettyName().'</info> (<comment>'.$this->package->getFullPrettyVersion().'</comment>) as uninstalled, alias of <info>'.$this->package->getAliasOf()->getPrettyName().'</info> (<comment>'.$this->package->getAliasOf()->getFullPrettyVersion().'</comment>)';
  12470. }
  12471. }
  12472. <?php declare(strict_types=1);
  12473. namespace Composer\DependencyResolver\Operation;
  12474. interface OperationInterface
  12475. {
  12476. public function getOperationType();
  12477. public function show(bool $lock);
  12478. public function __toString();
  12479. }
  12480. <?php declare(strict_types=1);
  12481. namespace Composer\DependencyResolver\Operation;
  12482. abstract class SolverOperation implements OperationInterface
  12483. {
  12484. protected const TYPE = '';
  12485. public function getOperationType(): string
  12486. {
  12487. return static::TYPE;
  12488. }
  12489. public function __toString()
  12490. {
  12491. return $this->show(false);
  12492. }
  12493. }
  12494. <?php declare(strict_types=1);
  12495. namespace Composer\DependencyResolver\Operation;
  12496. use Composer\Package\PackageInterface;
  12497. class UninstallOperation extends SolverOperation implements OperationInterface
  12498. {
  12499. protected const TYPE = 'uninstall';
  12500. protected $package;
  12501. public function __construct(PackageInterface $package)
  12502. {
  12503. $this->package = $package;
  12504. }
  12505. public function getPackage(): PackageInterface
  12506. {
  12507. return $this->package;
  12508. }
  12509. public function show($lock): string
  12510. {
  12511. return self::format($this->package, $lock);
  12512. }
  12513. public static function format(PackageInterface $package, bool $lock = false): string
  12514. {
  12515. return 'Removing <info>'.$package->getPrettyName().'</info> (<comment>'.$package->getFullPrettyVersion().'</comment>)';
  12516. }
  12517. }
  12518. <?php declare(strict_types=1);
  12519. namespace Composer\DependencyResolver\Operation;
  12520. use Composer\Package\PackageInterface;
  12521. use Composer\Package\Version\VersionParser;
  12522. class UpdateOperation extends SolverOperation implements OperationInterface
  12523. {
  12524. protected const TYPE = 'update';
  12525. protected $initialPackage;
  12526. protected $targetPackage;
  12527. public function __construct(PackageInterface $initial, PackageInterface $target)
  12528. {
  12529. $this->initialPackage = $initial;
  12530. $this->targetPackage = $target;
  12531. }
  12532. public function getInitialPackage(): PackageInterface
  12533. {
  12534. return $this->initialPackage;
  12535. }
  12536. public function getTargetPackage(): PackageInterface
  12537. {
  12538. return $this->targetPackage;
  12539. }
  12540. public function show($lock): string
  12541. {
  12542. return self::format($this->initialPackage, $this->targetPackage, $lock);
  12543. }
  12544. public static function format(PackageInterface $initialPackage, PackageInterface $targetPackage, bool $lock = false): string
  12545. {
  12546. $fromVersion = $initialPackage->getFullPrettyVersion();
  12547. $toVersion = $targetPackage->getFullPrettyVersion();
  12548. if ($fromVersion === $toVersion && $initialPackage->getSourceReference() !== $targetPackage->getSourceReference()) {
  12549. $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
  12550. $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_SOURCE_REF);
  12551. } elseif ($fromVersion === $toVersion && $initialPackage->getDistReference() !== $targetPackage->getDistReference()) {
  12552. $fromVersion = $initialPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
  12553. $toVersion = $targetPackage->getFullPrettyVersion(true, PackageInterface::DISPLAY_DIST_REF);
  12554. }
  12555. $actionName = VersionParser::isUpgrade($initialPackage->getVersion(), $targetPackage->getVersion()) ? 'Upgrading' : 'Downgrading';
  12556. return $actionName.' <info>'.$initialPackage->getPrettyName().'</info> (<comment>'.$fromVersion.'</comment> => <comment>'.$toVersion.'</comment>)';
  12557. }
  12558. }
  12559. <?php declare(strict_types=1);
  12560. namespace Composer\DependencyResolver;
  12561. use Composer\Package\PackageInterface;
  12562. use Composer\Semver\Constraint\Constraint;
  12563. interface PolicyInterface
  12564. {
  12565. public function versionCompare(PackageInterface $a, PackageInterface $b, string $operator): bool;
  12566. public function selectPreferredPackages(Pool $pool, array $literals, ?string $requiredPackage = null): array;
  12567. }
  12568. <?php declare(strict_types=1);
  12569. namespace Composer\DependencyResolver;
  12570. use Composer\Package\BasePackage;
  12571. use Composer\Package\Version\VersionParser;
  12572. use Composer\Semver\CompilingMatcher;
  12573. use Composer\Semver\Constraint\ConstraintInterface;
  12574. use Composer\Semver\Constraint\Constraint;
  12575. class Pool implements \Countable
  12576. {
  12577. protected $packages = [];
  12578. protected $packageByName = [];
  12579. protected $versionParser;
  12580. protected $providerCache = [];
  12581. protected $unacceptableFixedOrLockedPackages;
  12582. protected $removedVersions = [];
  12583. protected $removedVersionsByPackage = [];
  12584. public function __construct(array $packages = [], array $unacceptableFixedOrLockedPackages = [], array $removedVersions = [], array $removedVersionsByPackage = [])
  12585. {
  12586. $this->versionParser = new VersionParser;
  12587. $this->setPackages($packages);
  12588. $this->unacceptableFixedOrLockedPackages = $unacceptableFixedOrLockedPackages;
  12589. $this->removedVersions = $removedVersions;
  12590. $this->removedVersionsByPackage = $removedVersionsByPackage;
  12591. }
  12592. public function getRemovedVersions(string $name, ConstraintInterface $constraint): array
  12593. {
  12594. if (!isset($this->removedVersions[$name])) {
  12595. return [];
  12596. }
  12597. $result = [];
  12598. foreach ($this->removedVersions[$name] as $version => $prettyVersion) {
  12599. if ($constraint->matches(new Constraint('==', $version))) {
  12600. $result[$version] = $prettyVersion;
  12601. }
  12602. }
  12603. return $result;
  12604. }
  12605. public function getRemovedVersionsByPackage(string $objectHash): array
  12606. {
  12607. if (!isset($this->removedVersionsByPackage[$objectHash])) {
  12608. return [];
  12609. }
  12610. return $this->removedVersionsByPackage[$objectHash];
  12611. }
  12612. private function setPackages(array $packages): void
  12613. {
  12614. $id = 1;
  12615. foreach ($packages as $package) {
  12616. $this->packages[] = $package;
  12617. $package->id = $id++;
  12618. foreach ($package->getNames() as $provided) {
  12619. $this->packageByName[$provided][] = $package;
  12620. }
  12621. }
  12622. }
  12623. public function getPackages(): array
  12624. {
  12625. return $this->packages;
  12626. }
  12627. public function packageById(int $id): BasePackage
  12628. {
  12629. return $this->packages[$id - 1];
  12630. }
  12631. public function count(): int
  12632. {
  12633. return \count($this->packages);
  12634. }
  12635. public function whatProvides(string $name, ?ConstraintInterface $constraint = null): array
  12636. {
  12637. $key = (string) $constraint;
  12638. if (isset($this->providerCache[$name][$key])) {
  12639. return $this->providerCache[$name][$key];
  12640. }
  12641. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint);
  12642. }
  12643. private function computeWhatProvides(string $name, ?ConstraintInterface $constraint = null): array
  12644. {
  12645. if (!isset($this->packageByName[$name])) {
  12646. return [];
  12647. }
  12648. $matches = [];
  12649. foreach ($this->packageByName[$name] as $candidate) {
  12650. if ($this->match($candidate, $name, $constraint)) {
  12651. $matches[] = $candidate;
  12652. }
  12653. }
  12654. return $matches;
  12655. }
  12656. public function literalToPackage(int $literal): BasePackage
  12657. {
  12658. $packageId = abs($literal);
  12659. return $this->packageById($packageId);
  12660. }
  12661. public function literalToPrettyString(int $literal, array $installedMap): string
  12662. {
  12663. $package = $this->literalToPackage($literal);
  12664. if (isset($installedMap[$package->id])) {
  12665. $prefix = ($literal > 0 ? 'keep' : 'remove');
  12666. } else {
  12667. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  12668. }
  12669. return $prefix.' '.$package->getPrettyString();
  12670. }
  12671. public function match(BasePackage $candidate, string $name, ?ConstraintInterface $constraint = null): bool
  12672. {
  12673. $candidateName = $candidate->getName();
  12674. $candidateVersion = $candidate->getVersion();
  12675. if ($candidateName === $name) {
  12676. return $constraint === null || CompilingMatcher::match($constraint, Constraint::OP_EQ, $candidateVersion);
  12677. }
  12678. $provides = $candidate->getProvides();
  12679. $replaces = $candidate->getReplaces();
  12680. if (isset($replaces[0]) || isset($provides[0])) {
  12681. foreach ($provides as $link) {
  12682. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  12683. return true;
  12684. }
  12685. }
  12686. foreach ($replaces as $link) {
  12687. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  12688. return true;
  12689. }
  12690. }
  12691. return false;
  12692. }
  12693. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  12694. return true;
  12695. }
  12696. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  12697. return true;
  12698. }
  12699. return false;
  12700. }
  12701. public function isUnacceptableFixedOrLockedPackage(BasePackage $package): bool
  12702. {
  12703. return \in_array($package, $this->unacceptableFixedOrLockedPackages, true);
  12704. }
  12705. public function getUnacceptableFixedOrLockedPackages(): array
  12706. {
  12707. return $this->unacceptableFixedOrLockedPackages;
  12708. }
  12709. public function __toString(): string
  12710. {
  12711. $str = "Pool:\n";
  12712. foreach ($this->packages as $package) {
  12713. $str .= '- '.str_pad((string) $package->id, 6, ' ', STR_PAD_LEFT).': '.$package->getName()."\n";
  12714. }
  12715. return $str;
  12716. }
  12717. }
  12718. <?php declare(strict_types=1);
  12719. namespace Composer\DependencyResolver;
  12720. use Composer\EventDispatcher\EventDispatcher;
  12721. use Composer\IO\IOInterface;
  12722. use Composer\Package\AliasPackage;
  12723. use Composer\Package\BasePackage;
  12724. use Composer\Package\CompleteAliasPackage;
  12725. use Composer\Package\CompletePackage;
  12726. use Composer\Package\PackageInterface;
  12727. use Composer\Package\Version\StabilityFilter;
  12728. use Composer\Pcre\Preg;
  12729. use Composer\Plugin\PluginEvents;
  12730. use Composer\Plugin\PrePoolCreateEvent;
  12731. use Composer\Repository\PlatformRepository;
  12732. use Composer\Repository\RepositoryInterface;
  12733. use Composer\Repository\RootPackageRepository;
  12734. use Composer\Semver\CompilingMatcher;
  12735. use Composer\Semver\Constraint\Constraint;
  12736. use Composer\Semver\Constraint\ConstraintInterface;
  12737. use Composer\Semver\Constraint\MatchAllConstraint;
  12738. use Composer\Semver\Constraint\MultiConstraint;
  12739. use Composer\Semver\Intervals;
  12740. class PoolBuilder
  12741. {
  12742. private $acceptableStabilities;
  12743. private $stabilityFlags;
  12744. private $rootAliases;
  12745. private $rootReferences;
  12746. private $temporaryConstraints;
  12747. private $eventDispatcher;
  12748. private $poolOptimizer;
  12749. private $io;
  12750. private $aliasMap = [];
  12751. private $packagesToLoad = [];
  12752. private $loadedPackages = [];
  12753. private $loadedPerRepo = [];
  12754. private $packages = [];
  12755. private $unacceptableFixedOrLockedPackages = [];
  12756. private $updateAllowList = [];
  12757. private $skippedLoad = [];
  12758. private $ignoredTypes = [];
  12759. private $allowedTypes = null;
  12760. private $restrictedPackagesList = null;
  12761. private $pathRepoUnlocked = [];
  12762. private $maxExtendedReqs = [];
  12763. private $updateAllowWarned = [];
  12764. private $indexCounter = 0;
  12765. public function __construct(array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, IOInterface $io, ?EventDispatcher $eventDispatcher = null, ?PoolOptimizer $poolOptimizer = null, array $temporaryConstraints = [])
  12766. {
  12767. $this->acceptableStabilities = $acceptableStabilities;
  12768. $this->stabilityFlags = $stabilityFlags;
  12769. $this->rootAliases = $rootAliases;
  12770. $this->rootReferences = $rootReferences;
  12771. $this->eventDispatcher = $eventDispatcher;
  12772. $this->poolOptimizer = $poolOptimizer;
  12773. $this->io = $io;
  12774. $this->temporaryConstraints = $temporaryConstraints;
  12775. }
  12776. public function setIgnoredTypes(array $types): void
  12777. {
  12778. $this->ignoredTypes = $types;
  12779. }
  12780. public function setAllowedTypes(?array $types): void
  12781. {
  12782. $this->allowedTypes = $types;
  12783. }
  12784. public function buildPool(array $repositories, Request $request): Pool
  12785. {
  12786. $this->restrictedPackagesList = $request->getRestrictedPackages() !== null ? array_flip($request->getRestrictedPackages()) : null;
  12787. if (\count($request->getUpdateAllowList()) > 0) {
  12788. $this->updateAllowList = $request->getUpdateAllowList();
  12789. $this->warnAboutNonMatchingUpdateAllowList($request);
  12790. if (null === $request->getLockedRepository()) {
  12791. throw new \LogicException('No lock repo present and yet a partial update was requested.');
  12792. }
  12793. foreach ($request->getLockedRepository()->getPackages() as $lockedPackage) {
  12794. if (!$this->isUpdateAllowed($lockedPackage)) {
  12795. $this->skippedLoad[$lockedPackage->getName()][] = $lockedPackage;
  12796. foreach ($lockedPackage->getReplaces() as $link) {
  12797. $this->skippedLoad[$link->getTarget()][] = $lockedPackage;
  12798. }
  12799. if ($lockedPackage->getDistType() === 'path') {
  12800. $transportOptions = $lockedPackage->getTransportOptions();
  12801. if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
  12802. $this->pathRepoUnlocked[$lockedPackage->getName()] = true;
  12803. continue;
  12804. }
  12805. }
  12806. $request->lockPackage($lockedPackage);
  12807. }
  12808. }
  12809. }
  12810. foreach ($request->getFixedOrLockedPackages() as $package) {
  12811. $this->loadedPackages[$package->getName()] = new MatchAllConstraint();
  12812. foreach ($package->getReplaces() as $link) {
  12813. $this->loadedPackages[$link->getTarget()] = new MatchAllConstraint();
  12814. }
  12815. if (
  12816. $package->getRepository() instanceof RootPackageRepository
  12817. || $package->getRepository() instanceof PlatformRepository
  12818. || StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $package->getNames(), $package->getStability())
  12819. ) {
  12820. $this->loadPackage($request, $repositories, $package, false);
  12821. } else {
  12822. $this->unacceptableFixedOrLockedPackages[] = $package;
  12823. }
  12824. }
  12825. foreach ($request->getRequires() as $packageName => $constraint) {
  12826. if (isset($this->loadedPackages[$packageName])) {
  12827. continue;
  12828. }
  12829. $this->packagesToLoad[$packageName] = $constraint;
  12830. $this->maxExtendedReqs[$packageName] = true;
  12831. }
  12832. foreach ($this->packagesToLoad as $name => $constraint) {
  12833. if (isset($this->loadedPackages[$name])) {
  12834. unset($this->packagesToLoad[$name]);
  12835. }
  12836. }
  12837. while (\count($this->packagesToLoad) > 0) {
  12838. $this->loadPackagesMarkedForLoading($request, $repositories);
  12839. }
  12840. if (\count($this->temporaryConstraints) > 0) {
  12841. foreach ($this->packages as $i => $package) {
  12842. if (!isset($this->temporaryConstraints[$package->getName()]) || $package instanceof AliasPackage) {
  12843. continue;
  12844. }
  12845. $constraint = $this->temporaryConstraints[$package->getName()];
  12846. $packageAndAliases = [$i => $package];
  12847. if (isset($this->aliasMap[spl_object_hash($package)])) {
  12848. $packageAndAliases += $this->aliasMap[spl_object_hash($package)];
  12849. }
  12850. $found = false;
  12851. foreach ($packageAndAliases as $packageOrAlias) {
  12852. if (CompilingMatcher::match($constraint, Constraint::OP_EQ, $packageOrAlias->getVersion())) {
  12853. $found = true;
  12854. }
  12855. }
  12856. if (!$found) {
  12857. foreach ($packageAndAliases as $index => $packageOrAlias) {
  12858. unset($this->packages[$index]);
  12859. }
  12860. }
  12861. }
  12862. }
  12863. if ($this->eventDispatcher !== null) {
  12864. $prePoolCreateEvent = new PrePoolCreateEvent(
  12865. PluginEvents::PRE_POOL_CREATE,
  12866. $repositories,
  12867. $request,
  12868. $this->acceptableStabilities,
  12869. $this->stabilityFlags,
  12870. $this->rootAliases,
  12871. $this->rootReferences,
  12872. $this->packages,
  12873. $this->unacceptableFixedOrLockedPackages
  12874. );
  12875. $this->eventDispatcher->dispatch($prePoolCreateEvent->getName(), $prePoolCreateEvent);
  12876. $this->packages = $prePoolCreateEvent->getPackages();
  12877. $this->unacceptableFixedOrLockedPackages = $prePoolCreateEvent->getUnacceptableFixedPackages();
  12878. }
  12879. $pool = new Pool($this->packages, $this->unacceptableFixedOrLockedPackages);
  12880. $this->aliasMap = [];
  12881. $this->packagesToLoad = [];
  12882. $this->loadedPackages = [];
  12883. $this->loadedPerRepo = [];
  12884. $this->packages = [];
  12885. $this->unacceptableFixedOrLockedPackages = [];
  12886. $this->maxExtendedReqs = [];
  12887. $this->skippedLoad = [];
  12888. $this->indexCounter = 0;
  12889. $this->io->debug('Built pool.');
  12890. $pool = $this->runOptimizer($request, $pool);
  12891. Intervals::clear();
  12892. return $pool;
  12893. }
  12894. private function markPackageNameForLoading(Request $request, string $name, ConstraintInterface $constraint): void
  12895. {
  12896. if (PlatformRepository::isPlatformPackage($name)) {
  12897. return;
  12898. }
  12899. if (isset($this->maxExtendedReqs[$name])) {
  12900. return;
  12901. }
  12902. $rootRequires = $request->getRequires();
  12903. if (isset($rootRequires[$name]) && !Intervals::isSubsetOf($constraint, $rootRequires[$name])) {
  12904. $constraint = $rootRequires[$name];
  12905. }
  12906. if (!isset($this->loadedPackages[$name])) {
  12907. if (isset($this->packagesToLoad[$name])) {
  12908. if (Intervals::isSubsetOf($constraint, $this->packagesToLoad[$name])) {
  12909. return;
  12910. }
  12911. $constraint = Intervals::compactConstraint(MultiConstraint::create([$this->packagesToLoad[$name], $constraint], false));
  12912. }
  12913. $this->packagesToLoad[$name] = $constraint;
  12914. return;
  12915. }
  12916. if (Intervals::isSubsetOf($constraint, $this->loadedPackages[$name])) {
  12917. return;
  12918. }
  12919. $this->packagesToLoad[$name] = Intervals::compactConstraint(MultiConstraint::create([$this->loadedPackages[$name], $constraint], false));
  12920. unset($this->loadedPackages[$name]);
  12921. }
  12922. private function loadPackagesMarkedForLoading(Request $request, array $repositories): void
  12923. {
  12924. foreach ($this->packagesToLoad as $name => $constraint) {
  12925. if ($this->restrictedPackagesList !== null && !isset($this->restrictedPackagesList[$name])) {
  12926. unset($this->packagesToLoad[$name]);
  12927. continue;
  12928. }
  12929. $this->loadedPackages[$name] = $constraint;
  12930. }
  12931. $packageBatch = $this->packagesToLoad;
  12932. $this->packagesToLoad = [];
  12933. foreach ($repositories as $repoIndex => $repository) {
  12934. if (0 === \count($packageBatch)) {
  12935. break;
  12936. }
  12937. if ($repository instanceof PlatformRepository || $repository === $request->getLockedRepository()) {
  12938. continue;
  12939. }
  12940. $result = $repository->loadPackages($packageBatch, $this->acceptableStabilities, $this->stabilityFlags, $this->loadedPerRepo[$repoIndex] ?? []);
  12941. foreach ($result['namesFound'] as $name) {
  12942. unset($packageBatch[$name]);
  12943. }
  12944. foreach ($result['packages'] as $package) {
  12945. $this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()] = $package;
  12946. if (in_array($package->getType(), $this->ignoredTypes, true) || ($this->allowedTypes !== null && !in_array($package->getType(), $this->allowedTypes, true))) {
  12947. continue;
  12948. }
  12949. $this->loadPackage($request, $repositories, $package, !isset($this->pathRepoUnlocked[$package->getName()]));
  12950. }
  12951. }
  12952. }
  12953. private function loadPackage(Request $request, array $repositories, BasePackage $package, bool $propagateUpdate): void
  12954. {
  12955. $index = $this->indexCounter++;
  12956. $this->packages[$index] = $package;
  12957. if ($package instanceof AliasPackage) {
  12958. $this->aliasMap[spl_object_hash($package->getAliasOf())][$index] = $package;
  12959. }
  12960. $name = $package->getName();
  12961. if (isset($this->rootReferences[$name])) {
  12962. if (!$request->isLockedPackage($package) && !$request->isFixedPackage($package)) {
  12963. $package->setSourceDistReferences($this->rootReferences[$name]);
  12964. }
  12965. }
  12966. if (($propagateUpdate || isset($this->pathRepoUnlocked[$package->getName()])) && isset($this->rootAliases[$name][$package->getVersion()])) {
  12967. $alias = $this->rootAliases[$name][$package->getVersion()];
  12968. if ($package instanceof AliasPackage) {
  12969. $basePackage = $package->getAliasOf();
  12970. } else {
  12971. $basePackage = $package;
  12972. }
  12973. if ($basePackage instanceof CompletePackage) {
  12974. $aliasPackage = new CompleteAliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
  12975. } else {
  12976. $aliasPackage = new AliasPackage($basePackage, $alias['alias_normalized'], $alias['alias']);
  12977. }
  12978. $aliasPackage->setRootPackageAlias(true);
  12979. $newIndex = $this->indexCounter++;
  12980. $this->packages[$newIndex] = $aliasPackage;
  12981. $this->aliasMap[spl_object_hash($aliasPackage->getAliasOf())][$newIndex] = $aliasPackage;
  12982. }
  12983. foreach ($package->getRequires() as $link) {
  12984. $require = $link->getTarget();
  12985. $linkConstraint = $link->getConstraint();
  12986. if (isset($this->skippedLoad[$require])) {
  12987. if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
  12988. $skippedRootRequires = $this->getSkippedRootRequires($request, $require);
  12989. if ($request->getUpdateAllowTransitiveRootDependencies() || 0 === \count($skippedRootRequires)) {
  12990. $this->unlockPackage($request, $repositories, $require);
  12991. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  12992. } else {
  12993. foreach ($skippedRootRequires as $rootRequire) {
  12994. if (!isset($this->updateAllowWarned[$rootRequire])) {
  12995. $this->updateAllowWarned[$rootRequire] = true;
  12996. $this->io->writeError('<warning>Dependency '.$rootRequire.' is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.</warning>');
  12997. }
  12998. }
  12999. }
  13000. } elseif (isset($this->pathRepoUnlocked[$require]) && !isset($this->loadedPackages[$require])) {
  13001. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  13002. }
  13003. } else {
  13004. $this->markPackageNameForLoading($request, $require, $linkConstraint);
  13005. }
  13006. }
  13007. if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
  13008. foreach ($package->getReplaces() as $link) {
  13009. $replace = $link->getTarget();
  13010. if (isset($this->loadedPackages[$replace], $this->skippedLoad[$replace])) {
  13011. $skippedRootRequires = $this->getSkippedRootRequires($request, $replace);
  13012. if ($request->getUpdateAllowTransitiveRootDependencies() || 0 === \count($skippedRootRequires)) {
  13013. $this->unlockPackage($request, $repositories, $replace);
  13014. $this->markPackageNameForLoadingIfRequired($request, $replace);
  13015. } else {
  13016. foreach ($skippedRootRequires as $rootRequire) {
  13017. if (!isset($this->updateAllowWarned[$rootRequire])) {
  13018. $this->updateAllowWarned[$rootRequire] = true;
  13019. $this->io->writeError('<warning>Dependency '.$rootRequire.' is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.</warning>');
  13020. }
  13021. }
  13022. }
  13023. }
  13024. }
  13025. }
  13026. }
  13027. private function isRootRequire(Request $request, string $name): bool
  13028. {
  13029. $rootRequires = $request->getRequires();
  13030. return isset($rootRequires[$name]);
  13031. }
  13032. private function getSkippedRootRequires(Request $request, string $name): array
  13033. {
  13034. if (!isset($this->skippedLoad[$name])) {
  13035. return [];
  13036. }
  13037. $rootRequires = $request->getRequires();
  13038. $matches = [];
  13039. if (isset($rootRequires[$name])) {
  13040. return array_map(static function (PackageInterface $package) use ($name): string {
  13041. if ($name !== $package->getName()) {
  13042. return $package->getName() .' (via replace of '.$name.')';
  13043. }
  13044. return $package->getName();
  13045. }, $this->skippedLoad[$name]);
  13046. }
  13047. foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
  13048. if (isset($rootRequires[$packageOrReplacer->getName()])) {
  13049. $matches[] = $packageOrReplacer->getName();
  13050. }
  13051. foreach ($packageOrReplacer->getReplaces() as $link) {
  13052. if (isset($rootRequires[$link->getTarget()])) {
  13053. if ($name !== $packageOrReplacer->getName()) {
  13054. $matches[] = $packageOrReplacer->getName() .' (via replace of '.$name.')';
  13055. } else {
  13056. $matches[] = $packageOrReplacer->getName();
  13057. }
  13058. break;
  13059. }
  13060. }
  13061. }
  13062. return $matches;
  13063. }
  13064. private function isUpdateAllowed(BasePackage $package): bool
  13065. {
  13066. foreach ($this->updateAllowList as $pattern) {
  13067. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  13068. if (Preg::isMatch($patternRegexp, $package->getName())) {
  13069. return true;
  13070. }
  13071. }
  13072. return false;
  13073. }
  13074. private function warnAboutNonMatchingUpdateAllowList(Request $request): void
  13075. {
  13076. if (null === $request->getLockedRepository()) {
  13077. throw new \LogicException('No lock repo present and yet a partial update was requested.');
  13078. }
  13079. foreach ($this->updateAllowList as $pattern) {
  13080. $matchedPlatformPackage = false;
  13081. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  13082. foreach ($request->getLockedRepository()->getPackages() as $package) {
  13083. if (Preg::isMatch($patternRegexp, $package->getName())) {
  13084. continue 2;
  13085. }
  13086. }
  13087. foreach ($request->getRequires() as $packageName => $constraint) {
  13088. if (Preg::isMatch($patternRegexp, $packageName)) {
  13089. if (PlatformRepository::isPlatformPackage($packageName)) {
  13090. $matchedPlatformPackage = true;
  13091. continue;
  13092. }
  13093. continue 2;
  13094. }
  13095. }
  13096. if ($matchedPlatformPackage) {
  13097. $this->io->writeError('<warning>Pattern "' . $pattern . '" listed for update matches platform packages, but these cannot be updated by Composer.</warning>');
  13098. } elseif (strpos($pattern, '*') !== false) {
  13099. $this->io->writeError('<warning>Pattern "' . $pattern . '" listed for update does not match any locked packages.</warning>');
  13100. } else {
  13101. $this->io->writeError('<warning>Package "' . $pattern . '" listed for update is not locked.</warning>');
  13102. }
  13103. }
  13104. }
  13105. private function unlockPackage(Request $request, array $repositories, string $name): void
  13106. {
  13107. foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
  13108. if ($packageOrReplacer->getName() !== $name && isset($this->skippedLoad[$packageOrReplacer->getName()])) {
  13109. $replacerName = $packageOrReplacer->getName();
  13110. if ($request->getUpdateAllowTransitiveRootDependencies() || (!$this->isRootRequire($request, $name) && !$this->isRootRequire($request, $replacerName))) {
  13111. $this->unlockPackage($request, $repositories, $replacerName);
  13112. if ($this->isRootRequire($request, $replacerName)) {
  13113. $this->markPackageNameForLoading($request, $replacerName, new MatchAllConstraint);
  13114. } else {
  13115. foreach ($this->packages as $loadedPackage) {
  13116. $requires = $loadedPackage->getRequires();
  13117. if (isset($requires[$replacerName])) {
  13118. $this->markPackageNameForLoading($request, $replacerName, $requires[$replacerName]->getConstraint());
  13119. }
  13120. }
  13121. }
  13122. }
  13123. }
  13124. }
  13125. if (isset($this->pathRepoUnlocked[$name])) {
  13126. foreach ($this->packages as $index => $package) {
  13127. if ($package->getName() === $name) {
  13128. $this->removeLoadedPackage($request, $repositories, $package, $index);
  13129. }
  13130. }
  13131. }
  13132. unset($this->skippedLoad[$name], $this->loadedPackages[$name], $this->maxExtendedReqs[$name], $this->pathRepoUnlocked[$name]);
  13133. foreach ($request->getLockedPackages() as $lockedPackage) {
  13134. if (!($lockedPackage instanceof AliasPackage) && $lockedPackage->getName() === $name) {
  13135. if (false !== $index = array_search($lockedPackage, $this->packages, true)) {
  13136. $request->unlockPackage($lockedPackage);
  13137. $this->removeLoadedPackage($request, $repositories, $lockedPackage, $index);
  13138. foreach ($request->getFixedOrLockedPackages() as $fixedOrLockedPackage) {
  13139. if ($fixedOrLockedPackage === $lockedPackage) {
  13140. continue;
  13141. }
  13142. if (isset($this->skippedLoad[$fixedOrLockedPackage->getName()])) {
  13143. $requires = $fixedOrLockedPackage->getRequires();
  13144. if (isset($requires[$lockedPackage->getName()])) {
  13145. $this->markPackageNameForLoading($request, $lockedPackage->getName(), $requires[$lockedPackage->getName()]->getConstraint());
  13146. }
  13147. foreach ($lockedPackage->getReplaces() as $replace) {
  13148. if (isset($requires[$replace->getTarget()], $this->skippedLoad[$replace->getTarget()])) {
  13149. $this->unlockPackage($request, $repositories, $replace->getTarget());
  13150. $this->markPackageNameForLoading($request, $replace->getTarget(), $replace->getConstraint());
  13151. }
  13152. }
  13153. }
  13154. }
  13155. }
  13156. }
  13157. }
  13158. }
  13159. private function markPackageNameForLoadingIfRequired(Request $request, string $name): void
  13160. {
  13161. if ($this->isRootRequire($request, $name)) {
  13162. $this->markPackageNameForLoading($request, $name, $request->getRequires()[$name]);
  13163. }
  13164. foreach ($this->packages as $package) {
  13165. foreach ($package->getRequires() as $link) {
  13166. if ($name === $link->getTarget()) {
  13167. $this->markPackageNameForLoading($request, $link->getTarget(), $link->getConstraint());
  13168. }
  13169. }
  13170. }
  13171. }
  13172. private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, int $index): void
  13173. {
  13174. $repoIndex = array_search($package->getRepository(), $repositories, true);
  13175. unset($this->loadedPerRepo[$repoIndex][$package->getName()][$package->getVersion()]);
  13176. unset($this->packages[$index]);
  13177. if (isset($this->aliasMap[spl_object_hash($package)])) {
  13178. foreach ($this->aliasMap[spl_object_hash($package)] as $aliasIndex => $aliasPackage) {
  13179. unset($this->loadedPerRepo[$repoIndex][$aliasPackage->getName()][$aliasPackage->getVersion()]);
  13180. unset($this->packages[$aliasIndex]);
  13181. }
  13182. unset($this->aliasMap[spl_object_hash($package)]);
  13183. }
  13184. }
  13185. private function runOptimizer(Request $request, Pool $pool): Pool
  13186. {
  13187. if (null === $this->poolOptimizer) {
  13188. return $pool;
  13189. }
  13190. $this->io->debug('Running pool optimizer.');
  13191. $before = microtime(true);
  13192. $total = \count($pool->getPackages());
  13193. $pool = $this->poolOptimizer->optimize($request, $pool);
  13194. $filtered = $total - \count($pool->getPackages());
  13195. if (0 === $filtered) {
  13196. return $pool;
  13197. }
  13198. $this->io->write(sprintf('Pool optimizer completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERY_VERBOSE);
  13199. $this->io->write(sprintf(
  13200. '<info>Found %s package versions referenced in your dependency graph. %s (%d%%) were optimized away.</info>',
  13201. number_format($total),
  13202. number_format($filtered),
  13203. round(100 / $total * $filtered)
  13204. ), true, IOInterface::VERY_VERBOSE);
  13205. return $pool;
  13206. }
  13207. }
  13208. <?php declare(strict_types=1);
  13209. namespace Composer\DependencyResolver;
  13210. use Composer\Package\AliasPackage;
  13211. use Composer\Package\BasePackage;
  13212. use Composer\Package\Version\VersionParser;
  13213. use Composer\Semver\CompilingMatcher;
  13214. use Composer\Semver\Constraint\ConstraintInterface;
  13215. use Composer\Semver\Constraint\Constraint;
  13216. use Composer\Semver\Constraint\MultiConstraint;
  13217. use Composer\Semver\Intervals;
  13218. class PoolOptimizer
  13219. {
  13220. private $policy;
  13221. private $irremovablePackages = [];
  13222. private $requireConstraintsPerPackage = [];
  13223. private $conflictConstraintsPerPackage = [];
  13224. private $packagesToRemove = [];
  13225. private $aliasesPerPackage = [];
  13226. private $removedVersionsByPackage = [];
  13227. public function __construct(PolicyInterface $policy)
  13228. {
  13229. $this->policy = $policy;
  13230. }
  13231. public function optimize(Request $request, Pool $pool): Pool
  13232. {
  13233. $this->prepare($request, $pool);
  13234. $this->optimizeByIdenticalDependencies($request, $pool);
  13235. $this->optimizeImpossiblePackagesAway($request, $pool);
  13236. $optimizedPool = $this->applyRemovalsToPool($pool);
  13237. $this->irremovablePackages = [];
  13238. $this->requireConstraintsPerPackage = [];
  13239. $this->conflictConstraintsPerPackage = [];
  13240. $this->packagesToRemove = [];
  13241. $this->aliasesPerPackage = [];
  13242. $this->removedVersionsByPackage = [];
  13243. return $optimizedPool;
  13244. }
  13245. private function prepare(Request $request, Pool $pool): void
  13246. {
  13247. $irremovablePackageConstraintGroups = [];
  13248. foreach ($request->getFixedOrLockedPackages() as $package) {
  13249. $irremovablePackageConstraintGroups[$package->getName()][] = new Constraint('==', $package->getVersion());
  13250. }
  13251. foreach ($request->getRequires() as $require => $constraint) {
  13252. $this->extractRequireConstraintsPerPackage($require, $constraint);
  13253. }
  13254. foreach ($pool->getPackages() as $package) {
  13255. foreach ($package->getRequires() as $link) {
  13256. $this->extractRequireConstraintsPerPackage($link->getTarget(), $link->getConstraint());
  13257. }
  13258. foreach ($package->getConflicts() as $link) {
  13259. $this->extractConflictConstraintsPerPackage($link->getTarget(), $link->getConstraint());
  13260. }
  13261. if ($package instanceof AliasPackage) {
  13262. $this->aliasesPerPackage[$package->getAliasOf()->id][] = $package;
  13263. }
  13264. }
  13265. $irremovablePackageConstraints = [];
  13266. foreach ($irremovablePackageConstraintGroups as $packageName => $constraints) {
  13267. $irremovablePackageConstraints[$packageName] = 1 === \count($constraints) ? $constraints[0] : new MultiConstraint($constraints, false);
  13268. }
  13269. unset($irremovablePackageConstraintGroups);
  13270. foreach ($pool->getPackages() as $package) {
  13271. if (!isset($irremovablePackageConstraints[$package->getName()])) {
  13272. continue;
  13273. }
  13274. if (CompilingMatcher::match($irremovablePackageConstraints[$package->getName()], Constraint::OP_EQ, $package->getVersion())) {
  13275. $this->markPackageIrremovable($package);
  13276. }
  13277. }
  13278. }
  13279. private function markPackageIrremovable(BasePackage $package): void
  13280. {
  13281. $this->irremovablePackages[$package->id] = true;
  13282. if ($package instanceof AliasPackage) {
  13283. $this->markPackageIrremovable($package->getAliasOf());
  13284. }
  13285. if (isset($this->aliasesPerPackage[$package->id])) {
  13286. foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
  13287. $this->irremovablePackages[$aliasPackage->id] = true;
  13288. }
  13289. }
  13290. }
  13291. private function applyRemovalsToPool(Pool $pool): Pool
  13292. {
  13293. $packages = [];
  13294. $removedVersions = [];
  13295. foreach ($pool->getPackages() as $package) {
  13296. if (!isset($this->packagesToRemove[$package->id])) {
  13297. $packages[] = $package;
  13298. } else {
  13299. $removedVersions[$package->getName()][$package->getVersion()] = $package->getPrettyVersion();
  13300. }
  13301. }
  13302. $optimizedPool = new Pool($packages, $pool->getUnacceptableFixedOrLockedPackages(), $removedVersions, $this->removedVersionsByPackage);
  13303. return $optimizedPool;
  13304. }
  13305. private function optimizeByIdenticalDependencies(Request $request, Pool $pool): void
  13306. {
  13307. $identicalDefinitionsPerPackage = [];
  13308. $packageIdenticalDefinitionLookup = [];
  13309. foreach ($pool->getPackages() as $package) {
  13310. if (isset($this->irremovablePackages[$package->id])) {
  13311. continue;
  13312. }
  13313. $this->markPackageForRemoval($package->id);
  13314. $dependencyHash = $this->calculateDependencyHash($package);
  13315. foreach ($package->getNames(false) as $packageName) {
  13316. if (!isset($this->requireConstraintsPerPackage[$packageName])) {
  13317. continue;
  13318. }
  13319. foreach ($this->requireConstraintsPerPackage[$packageName] as $requireConstraint) {
  13320. $groupHashParts = [];
  13321. if (CompilingMatcher::match($requireConstraint, Constraint::OP_EQ, $package->getVersion())) {
  13322. $groupHashParts[] = 'require:' . (string) $requireConstraint;
  13323. }
  13324. if (\count($package->getReplaces()) > 0) {
  13325. foreach ($package->getReplaces() as $link) {
  13326. if (CompilingMatcher::match($link->getConstraint(), Constraint::OP_EQ, $package->getVersion())) {
  13327. $groupHashParts[] = 'require:' . (string) $link->getConstraint();
  13328. }
  13329. }
  13330. }
  13331. if (isset($this->conflictConstraintsPerPackage[$packageName])) {
  13332. foreach ($this->conflictConstraintsPerPackage[$packageName] as $conflictConstraint) {
  13333. if (CompilingMatcher::match($conflictConstraint, Constraint::OP_EQ, $package->getVersion())) {
  13334. $groupHashParts[] = 'conflict:' . (string) $conflictConstraint;
  13335. }
  13336. }
  13337. }
  13338. if (0 === \count($groupHashParts)) {
  13339. continue;
  13340. }
  13341. $groupHash = implode('', $groupHashParts);
  13342. $identicalDefinitionsPerPackage[$packageName][$groupHash][$dependencyHash][] = $package;
  13343. $packageIdenticalDefinitionLookup[$package->id][$packageName] = ['groupHash' => $groupHash, 'dependencyHash' => $dependencyHash];
  13344. }
  13345. }
  13346. }
  13347. foreach ($identicalDefinitionsPerPackage as $constraintGroups) {
  13348. foreach ($constraintGroups as $constraintGroup) {
  13349. foreach ($constraintGroup as $packages) {
  13350. if (1 === \count($packages)) {
  13351. $this->keepPackage($packages[0], $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  13352. continue;
  13353. }
  13354. $literals = [];
  13355. foreach ($packages as $package) {
  13356. $literals[] = $package->id;
  13357. }
  13358. foreach ($this->policy->selectPreferredPackages($pool, $literals) as $preferredLiteral) {
  13359. $this->keepPackage($pool->literalToPackage($preferredLiteral), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  13360. }
  13361. }
  13362. }
  13363. }
  13364. }
  13365. private function calculateDependencyHash(BasePackage $package): string
  13366. {
  13367. $hash = '';
  13368. $hashRelevantLinks = [
  13369. 'requires' => $package->getRequires(),
  13370. 'conflicts' => $package->getConflicts(),
  13371. 'replaces' => $package->getReplaces(),
  13372. 'provides' => $package->getProvides(),
  13373. ];
  13374. foreach ($hashRelevantLinks as $key => $links) {
  13375. if (0 === \count($links)) {
  13376. continue;
  13377. }
  13378. $hash .= $key . ':';
  13379. $subhash = [];
  13380. foreach ($links as $link) {
  13381. $subhash[$link->getTarget()] = (string) $link->getConstraint();
  13382. }
  13383. ksort($subhash);
  13384. foreach ($subhash as $target => $constraint) {
  13385. $hash .= $target . '@' . $constraint;
  13386. }
  13387. }
  13388. return $hash;
  13389. }
  13390. private function markPackageForRemoval(int $id): void
  13391. {
  13392. if (isset($this->irremovablePackages[$id])) {
  13393. throw new \LogicException('Attempted removing a package which was previously marked irremovable');
  13394. }
  13395. $this->packagesToRemove[$id] = true;
  13396. }
  13397. private function keepPackage(BasePackage $package, array $identicalDefinitionsPerPackage, array $packageIdenticalDefinitionLookup): void
  13398. {
  13399. if (!isset($this->packagesToRemove[$package->id])) {
  13400. return;
  13401. }
  13402. unset($this->packagesToRemove[$package->id]);
  13403. if ($package instanceof AliasPackage) {
  13404. $this->keepPackage($package->getAliasOf(), $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup);
  13405. }
  13406. foreach ($package->getNames(false) as $name) {
  13407. if (isset($packageIdenticalDefinitionLookup[$package->id][$name])) {
  13408. $packageGroupPointers = $packageIdenticalDefinitionLookup[$package->id][$name];
  13409. $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
  13410. foreach ($packageGroup as $pkg) {
  13411. if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  13412. $pkg = $pkg->getAliasOf();
  13413. }
  13414. $this->removedVersionsByPackage[spl_object_hash($package)][$pkg->getVersion()] = $pkg->getPrettyVersion();
  13415. }
  13416. }
  13417. }
  13418. if (isset($this->aliasesPerPackage[$package->id])) {
  13419. foreach ($this->aliasesPerPackage[$package->id] as $aliasPackage) {
  13420. unset($this->packagesToRemove[$aliasPackage->id]);
  13421. foreach ($aliasPackage->getNames(false) as $name) {
  13422. if (isset($packageIdenticalDefinitionLookup[$aliasPackage->id][$name])) {
  13423. $packageGroupPointers = $packageIdenticalDefinitionLookup[$aliasPackage->id][$name];
  13424. $packageGroup = $identicalDefinitionsPerPackage[$name][$packageGroupPointers['groupHash']][$packageGroupPointers['dependencyHash']];
  13425. foreach ($packageGroup as $pkg) {
  13426. if ($pkg instanceof AliasPackage && $pkg->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  13427. $pkg = $pkg->getAliasOf();
  13428. }
  13429. $this->removedVersionsByPackage[spl_object_hash($aliasPackage)][$pkg->getVersion()] = $pkg->getPrettyVersion();
  13430. }
  13431. }
  13432. }
  13433. }
  13434. }
  13435. }
  13436. private function optimizeImpossiblePackagesAway(Request $request, Pool $pool): void
  13437. {
  13438. if (\count($request->getLockedPackages()) === 0) {
  13439. return;
  13440. }
  13441. $packageIndex = [];
  13442. foreach ($pool->getPackages() as $package) {
  13443. $id = $package->id;
  13444. if (isset($this->irremovablePackages[$id])) {
  13445. continue;
  13446. }
  13447. if (isset($this->aliasesPerPackage[$id]) || $package instanceof AliasPackage) {
  13448. continue;
  13449. }
  13450. if ($request->isFixedPackage($package) || $request->isLockedPackage($package)) {
  13451. continue;
  13452. }
  13453. $packageIndex[$package->getName()][$package->id] = $package;
  13454. }
  13455. foreach ($request->getLockedPackages() as $package) {
  13456. $isUnusedPackage = true;
  13457. foreach ($package->getNames(false) as $packageName) {
  13458. if (isset($this->requireConstraintsPerPackage[$packageName])) {
  13459. $isUnusedPackage = false;
  13460. break;
  13461. }
  13462. }
  13463. if ($isUnusedPackage) {
  13464. continue;
  13465. }
  13466. foreach ($package->getRequires() as $link) {
  13467. $require = $link->getTarget();
  13468. if (!isset($packageIndex[$require])) {
  13469. continue;
  13470. }
  13471. $linkConstraint = $link->getConstraint();
  13472. foreach ($packageIndex[$require] as $id => $requiredPkg) {
  13473. if (false === CompilingMatcher::match($linkConstraint, Constraint::OP_EQ, $requiredPkg->getVersion())) {
  13474. $this->markPackageForRemoval($id);
  13475. unset($packageIndex[$require][$id]);
  13476. }
  13477. }
  13478. }
  13479. }
  13480. }
  13481. private function extractRequireConstraintsPerPackage(string $package, ConstraintInterface $constraint)
  13482. {
  13483. foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
  13484. $this->requireConstraintsPerPackage[$package][(string) $expanded] = $expanded;
  13485. }
  13486. }
  13487. private function extractConflictConstraintsPerPackage(string $package, ConstraintInterface $constraint)
  13488. {
  13489. foreach ($this->expandDisjunctiveMultiConstraints($constraint) as $expanded) {
  13490. $this->conflictConstraintsPerPackage[$package][(string) $expanded] = $expanded;
  13491. }
  13492. }
  13493. private function expandDisjunctiveMultiConstraints(ConstraintInterface $constraint)
  13494. {
  13495. $constraint = Intervals::compactConstraint($constraint);
  13496. if ($constraint instanceof MultiConstraint && $constraint->isDisjunctive()) {
  13497. return $constraint->getConstraints();
  13498. }
  13499. return [$constraint];
  13500. }
  13501. }
  13502. <?php declare(strict_types=1);
  13503. namespace Composer\DependencyResolver;
  13504. use Composer\Package\CompletePackageInterface;
  13505. use Composer\Package\AliasPackage;
  13506. use Composer\Package\BasePackage;
  13507. use Composer\Package\Link;
  13508. use Composer\Package\PackageInterface;
  13509. use Composer\Package\RootPackageInterface;
  13510. use Composer\Pcre\Preg;
  13511. use Composer\Repository\RepositorySet;
  13512. use Composer\Repository\LockArrayRepository;
  13513. use Composer\Semver\Constraint\Constraint;
  13514. use Composer\Semver\Constraint\ConstraintInterface;
  13515. use Composer\Package\Version\VersionParser;
  13516. use Composer\Repository\PlatformRepository;
  13517. use Composer\Semver\Constraint\MultiConstraint;
  13518. class Problem
  13519. {
  13520. protected $reasonSeen;
  13521. protected $reasons = [];
  13522. protected $section = 0;
  13523. public function addRule(Rule $rule): void
  13524. {
  13525. $this->addReason(spl_object_hash($rule), $rule);
  13526. }
  13527. public function getReasons(): array
  13528. {
  13529. return $this->reasons;
  13530. }
  13531. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
  13532. {
  13533. $reasons = array_merge(...array_reverse($this->reasons));
  13534. if (\count($reasons) === 1) {
  13535. reset($reasons);
  13536. $rule = current($reasons);
  13537. if ($rule->getReason() !== Rule::RULE_ROOT_REQUIRE) {
  13538. throw new \LogicException("Single reason problems must contain a root require rule.");
  13539. }
  13540. $reasonData = $rule->getReasonData();
  13541. $packageName = $reasonData['packageName'];
  13542. $constraint = $reasonData['constraint'];
  13543. $packages = $pool->whatProvides($packageName, $constraint);
  13544. if (\count($packages) === 0) {
  13545. return "\n ".implode(self::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $packageName, $constraint));
  13546. }
  13547. }
  13548. usort($reasons, function (Rule $rule1, Rule $rule2) use ($pool) {
  13549. $rule1Prio = $this->getRulePriority($rule1);
  13550. $rule2Prio = $this->getRulePriority($rule2);
  13551. if ($rule1Prio !== $rule2Prio) {
  13552. return $rule2Prio - $rule1Prio;
  13553. }
  13554. return $this->getSortableString($pool, $rule1) <=> $this->getSortableString($pool, $rule2);
  13555. });
  13556. return self::formatDeduplicatedRules($reasons, ' ', $repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
  13557. }
  13558. private function getSortableString(Pool $pool, Rule $rule): string
  13559. {
  13560. switch ($rule->getReason()) {
  13561. case Rule::RULE_ROOT_REQUIRE:
  13562. return $rule->getReasonData()['packageName'];
  13563. case Rule::RULE_FIXED:
  13564. return (string) $rule->getReasonData()['package'];
  13565. case Rule::RULE_PACKAGE_CONFLICT:
  13566. case Rule::RULE_PACKAGE_REQUIRES:
  13567. return $rule->getSourcePackage($pool) . '//' . $rule->getReasonData()->getPrettyString($rule->getSourcePackage($pool));
  13568. case Rule::RULE_PACKAGE_SAME_NAME:
  13569. case Rule::RULE_PACKAGE_ALIAS:
  13570. case Rule::RULE_PACKAGE_INVERSE_ALIAS:
  13571. return (string) $rule->getReasonData();
  13572. case Rule::RULE_LEARNED:
  13573. return implode('-', $rule->getLiterals());
  13574. }
  13575. throw new \LogicException('Unknown rule type: '.$rule->getReason());
  13576. }
  13577. private function getRulePriority(Rule $rule): int
  13578. {
  13579. switch ($rule->getReason()) {
  13580. case Rule::RULE_FIXED:
  13581. return 3;
  13582. case Rule::RULE_ROOT_REQUIRE:
  13583. return 2;
  13584. case Rule::RULE_PACKAGE_CONFLICT:
  13585. case Rule::RULE_PACKAGE_REQUIRES:
  13586. return 1;
  13587. case Rule::RULE_PACKAGE_SAME_NAME:
  13588. case Rule::RULE_LEARNED:
  13589. case Rule::RULE_PACKAGE_ALIAS:
  13590. case Rule::RULE_PACKAGE_INVERSE_ALIAS:
  13591. return 0;
  13592. }
  13593. throw new \LogicException('Unknown rule type: '.$rule->getReason());
  13594. }
  13595. public static function formatDeduplicatedRules(array $rules, string $indent, RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
  13596. {
  13597. $messages = [];
  13598. $templates = [];
  13599. $parser = new VersionParser;
  13600. $deduplicatableRuleTypes = [Rule::RULE_PACKAGE_REQUIRES, Rule::RULE_PACKAGE_CONFLICT];
  13601. foreach ($rules as $rule) {
  13602. $message = $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
  13603. if (in_array($rule->getReason(), $deduplicatableRuleTypes, true) && Preg::isMatchStrictGroups('{^(?P<package>\S+) (?P<version>\S+) (?P<type>requires|conflicts)}', $message, $m)) {
  13604. $message = str_replace('%', '%%', $message);
  13605. $template = Preg::replace('{^\S+ \S+ }', '%s%s ', $message);
  13606. $messages[] = $template;
  13607. $templates[$template][$m[1]][$parser->normalize($m[2])] = $m[2];
  13608. $sourcePackage = $rule->getSourcePackage($pool);
  13609. foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($sourcePackage)) as $version => $prettyVersion) {
  13610. $templates[$template][$m[1]][$version] = $prettyVersion;
  13611. }
  13612. } elseif ($message !== '') {
  13613. $messages[] = $message;
  13614. }
  13615. }
  13616. $result = [];
  13617. foreach (array_unique($messages) as $message) {
  13618. if (isset($templates[$message])) {
  13619. foreach ($templates[$message] as $package => $versions) {
  13620. uksort($versions, 'version_compare');
  13621. if (!$isVerbose) {
  13622. $versions = self::condenseVersionList($versions, 1);
  13623. }
  13624. if (\count($versions) > 1) {
  13625. $message = Preg::replace('{^(%s%s (?:require|conflict))s}', '$1', $message);
  13626. $result[] = sprintf($message, $package, '['.implode(', ', $versions).']');
  13627. } else {
  13628. $result[] = sprintf($message, $package, ' '.reset($versions));
  13629. }
  13630. }
  13631. } else {
  13632. $result[] = $message;
  13633. }
  13634. }
  13635. return "\n$indent- ".implode("\n$indent- ", $result);
  13636. }
  13637. public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
  13638. {
  13639. foreach ($this->reasons as $sectionRules) {
  13640. foreach ($sectionRules as $rule) {
  13641. if ($rule->isCausedByLock($repositorySet, $request, $pool)) {
  13642. return true;
  13643. }
  13644. }
  13645. }
  13646. return false;
  13647. }
  13648. protected function addReason(string $id, Rule $reason): void
  13649. {
  13650. if (!isset($this->reasonSeen[$id])) {
  13651. $this->reasonSeen[$id] = true;
  13652. $this->reasons[$this->section][] = $reason;
  13653. }
  13654. }
  13655. public function nextSection(): void
  13656. {
  13657. $this->section++;
  13658. }
  13659. public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, string $packageName, ?ConstraintInterface $constraint = null): array
  13660. {
  13661. if (PlatformRepository::isPlatformPackage($packageName)) {
  13662. if (0 === stripos($packageName, 'php') || $packageName === 'hhvm') {
  13663. $version = self::getPlatformPackageVersion($pool, $packageName, phpversion());
  13664. $msg = "- Root composer.json requires ".$packageName.self::constraintToText($constraint).' but ';
  13665. if (defined('HHVM_VERSION') || ($packageName === 'hhvm' && count($pool->whatProvides($packageName)) > 0)) {
  13666. return [$msg, 'your HHVM version does not satisfy that requirement.'];
  13667. }
  13668. if ($packageName === 'hhvm') {
  13669. return [$msg, 'HHVM was not detected on this machine, make sure it is in your PATH.'];
  13670. }
  13671. if (null === $version) {
  13672. return [$msg, 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".'];
  13673. }
  13674. return [$msg, 'your '.$packageName.' version ('. $version .') does not satisfy that requirement.'];
  13675. }
  13676. if (0 === stripos($packageName, 'ext-')) {
  13677. if (false !== strpos($packageName, ' ')) {
  13678. return ['- ', "PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.'];
  13679. }
  13680. $ext = substr($packageName, 4);
  13681. $msg = "- Root composer.json requires PHP extension ".$packageName.self::constraintToText($constraint).' but ';
  13682. $version = self::getPlatformPackageVersion($pool, $packageName, phpversion($ext) === false ? '0' : phpversion($ext));
  13683. if (null === $version) {
  13684. $providersStr = self::getProvidersList($repositorySet, $packageName, 5);
  13685. if ($providersStr !== null) {
  13686. $providersStr = "\n\n Alternatively you can require one of these packages that provide the extension (or parts of it):\n$providersStr";
  13687. }
  13688. if (extension_loaded($ext)) {
  13689. return [
  13690. $msg,
  13691. 'the '.$packageName.' package is disabled by your platform config. Enable it again with "composer config platform.'.$packageName.' --unset".' . $providersStr,
  13692. ];
  13693. }
  13694. return [$msg, 'it is missing from your system. Install or enable PHP\'s '.$ext.' extension.' . $providersStr];
  13695. }
  13696. return [$msg, 'it has the wrong version installed ('.$version.').'];
  13697. }
  13698. if (0 === stripos($packageName, 'lib-')) {
  13699. if (strtolower($packageName) === 'lib-icu') {
  13700. $error = extension_loaded('intl') ? 'it has the wrong version installed, try upgrading the intl extension.' : 'it is missing from your system, make sure the intl extension is loaded.';
  13701. return ["- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', $error];
  13702. }
  13703. $providersStr = self::getProvidersList($repositorySet, $packageName, 5);
  13704. if ($providersStr !== null) {
  13705. $providersStr = "\n\n Alternatively you can require one of these packages that provide the library (or parts of it):\n$providersStr";
  13706. }
  13707. return ["- Root composer.json requires linked library ".$packageName.self::constraintToText($constraint).' but ', 'it has the wrong version installed or is missing from your system, make sure to load the extension providing it.'.$providersStr];
  13708. }
  13709. }
  13710. $lockedPackage = null;
  13711. foreach ($request->getLockedPackages() as $package) {
  13712. if ($package->getName() === $packageName) {
  13713. $lockedPackage = $package;
  13714. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  13715. return ["- ", $package->getPrettyName().' is fixed to '.$package->getPrettyVersion().' (lock file version) by a partial update but that version is rejected by your minimum-stability. Make sure you list it as an argument for the update command.'];
  13716. }
  13717. break;
  13718. }
  13719. }
  13720. if ($constraint instanceof Constraint && $constraint->getOperator() === Constraint::STR_OP_EQ && Preg::isMatch('{^dev-.*#.*}', $constraint->getPrettyString())) {
  13721. $newConstraint = Preg::replace('{ +as +([^,\s|]+)$}', '', $constraint->getPrettyString());
  13722. $packages = $repositorySet->findPackages($packageName, new MultiConstraint([
  13723. new Constraint(Constraint::STR_OP_EQ, $newConstraint),
  13724. new Constraint(Constraint::STR_OP_EQ, str_replace('#', '+', $newConstraint))
  13725. ], false));
  13726. if (\count($packages) > 0) {
  13727. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).'. The # character in branch names is replaced by a + character. Make sure to require it as "'.str_replace('#', '+', $constraint->getPrettyString()).'".'];
  13728. }
  13729. }
  13730. $packages = $repositorySet->findPackages($packageName, $constraint);
  13731. if (\count($packages) > 0) {
  13732. $rootReqs = $repositorySet->getRootRequires();
  13733. if (isset($rootReqs[$packageName])) {
  13734. $filtered = array_filter($packages, static function ($p) use ($rootReqs, $packageName): bool {
  13735. return $rootReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
  13736. });
  13737. if (0 === count($filtered)) {
  13738. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with your root composer.json require ('.$rootReqs[$packageName]->getPrettyString().').'];
  13739. }
  13740. }
  13741. $tempReqs = $repositorySet->getTemporaryConstraints();
  13742. if (isset($tempReqs[$packageName])) {
  13743. $filtered = array_filter($packages, static function ($p) use ($tempReqs, $packageName): bool {
  13744. return $tempReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
  13745. });
  13746. if (0 === count($filtered)) {
  13747. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with your temporary update constraint ('.$packageName.':'.$tempReqs[$packageName]->getPrettyString().').'];
  13748. }
  13749. }
  13750. if ($lockedPackage !== null) {
  13751. $fixedConstraint = new Constraint('==', $lockedPackage->getVersion());
  13752. $filtered = array_filter($packages, static function ($p) use ($fixedConstraint): bool {
  13753. return $fixedConstraint->matches(new Constraint('==', $p->getVersion()));
  13754. });
  13755. if (0 === count($filtered)) {
  13756. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but the package is fixed to '.$lockedPackage->getPrettyVersion().' (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.'];
  13757. }
  13758. }
  13759. $nonLockedPackages = array_filter($packages, static function ($p): bool {
  13760. return !$p->getRepository() instanceof LockArrayRepository;
  13761. });
  13762. if (0 === \count($nonLockedPackages)) {
  13763. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.'];
  13764. }
  13765. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but these were not loaded, likely because '.(self::hasMultipleNames($packages) ? 'they conflict' : 'it conflicts').' with another require.'];
  13766. }
  13767. $packages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES);
  13768. if (\count($packages) > 0) {
  13769. $allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES);
  13770. if (\count($allReposPackages) > 0) {
  13771. return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'minimum-stability', $constraint);
  13772. }
  13773. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match your minimum-stability.'];
  13774. }
  13775. $packages = $repositorySet->findPackages($packageName, null, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES);
  13776. if (\count($packages) > 0) {
  13777. $allReposPackages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_SHADOWED_REPOSITORIES);
  13778. if (\count($allReposPackages) > 0) {
  13779. return self::computeCheckForLowerPrioRepo($pool, $isVerbose, $packageName, $packages, $allReposPackages, 'constraint', $constraint);
  13780. }
  13781. $suffix = '';
  13782. if ($constraint instanceof Constraint && $constraint->getVersion() === 'dev-master') {
  13783. foreach ($packages as $candidate) {
  13784. if (in_array($candidate->getVersion(), ['dev-default', 'dev-main'], true)) {
  13785. $suffix = ' Perhaps dev-master was renamed to '.$candidate->getPrettyVersion().'?';
  13786. break;
  13787. }
  13788. }
  13789. }
  13790. $allReposPackages = $packages;
  13791. $topPackage = reset($allReposPackages);
  13792. if ($topPackage instanceof RootPackageInterface) {
  13793. $suffix = ' See https://getcomposer.org/dep-on-root for details and assistance.';
  13794. }
  13795. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose, $pool, $constraint).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match the constraint.' . $suffix];
  13796. }
  13797. if (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  13798. $illegalChars = Preg::replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  13799. return ["- Root composer.json requires $packageName, it ", 'could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.'];
  13800. }
  13801. $providersStr = self::getProvidersList($repositorySet, $packageName, 15);
  13802. if ($providersStr !== null) {
  13803. return ["- Root composer.json requires $packageName".self::constraintToText($constraint).", it ", "could not be found in any version, but the following packages provide it:\n".$providersStr." Consider requiring one of these to satisfy the $packageName requirement."];
  13804. }
  13805. return ["- Root composer.json requires $packageName, it ", "could not be found in any version, there may be a typo in the package name."];
  13806. }
  13807. public static function getPackageList(array $packages, bool $isVerbose, ?Pool $pool = null, ?ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
  13808. {
  13809. $prepared = [];
  13810. $hasDefaultBranch = [];
  13811. foreach ($packages as $package) {
  13812. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  13813. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion().($package instanceof AliasPackage ? ' (alias of '.$package->getAliasOf()->getPrettyVersion().')' : '');
  13814. if ($pool !== null && $constraint !== null) {
  13815. foreach ($pool->getRemovedVersions($package->getName(), $constraint) as $version => $prettyVersion) {
  13816. $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
  13817. }
  13818. }
  13819. if ($pool !== null && $useRemovedVersionGroup) {
  13820. foreach ($pool->getRemovedVersionsByPackage(spl_object_hash($package)) as $version => $prettyVersion) {
  13821. $prepared[$package->getName()]['versions'][$version] = $prettyVersion;
  13822. }
  13823. }
  13824. if ($package->isDefaultBranch()) {
  13825. $hasDefaultBranch[$package->getName()] = true;
  13826. }
  13827. }
  13828. $preparedStrings = [];
  13829. foreach ($prepared as $name => $package) {
  13830. if (isset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS], $hasDefaultBranch[$name])) {
  13831. unset($package['versions'][VersionParser::DEFAULT_BRANCH_ALIAS]);
  13832. }
  13833. uksort($package['versions'], 'version_compare');
  13834. if (!$isVerbose) {
  13835. $package['versions'] = self::condenseVersionList($package['versions'], 4);
  13836. }
  13837. $preparedStrings[] = $package['name'].'['.implode(', ', $package['versions']).']';
  13838. }
  13839. return implode(', ', $preparedStrings);
  13840. }
  13841. private static function getPlatformPackageVersion(Pool $pool, string $packageName, string $version): ?string
  13842. {
  13843. $available = $pool->whatProvides($packageName);
  13844. if (\count($available) > 0) {
  13845. $selected = null;
  13846. foreach ($available as $pkg) {
  13847. if ($pkg->getRepository() instanceof PlatformRepository) {
  13848. $selected = $pkg;
  13849. break;
  13850. }
  13851. }
  13852. if ($selected === null) {
  13853. $selected = reset($available);
  13854. }
  13855. if ($selected->getName() !== $packageName) {
  13856. foreach (array_merge(array_values($selected->getProvides()), array_values($selected->getReplaces())) as $link) {
  13857. if ($link->getTarget() === $packageName) {
  13858. return $link->getPrettyConstraint().' '.substr($link->getDescription(), 0, -1).'d by '.$selected->getPrettyString();
  13859. }
  13860. }
  13861. }
  13862. $version = $selected->getPrettyVersion();
  13863. $extra = $selected->getExtra();
  13864. if ($selected instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  13865. $version .= '; ' . str_replace('Package ', '', (string) $selected->getDescription());
  13866. }
  13867. } else {
  13868. return null;
  13869. }
  13870. return $version;
  13871. }
  13872. private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array
  13873. {
  13874. if (count($versions) <= $max) {
  13875. return array_values($versions);
  13876. }
  13877. $filtered = [];
  13878. $byMajor = [];
  13879. foreach ($versions as $version => $pretty) {
  13880. if (0 === stripos((string) $version, 'dev-')) {
  13881. $byMajor['dev'][] = $pretty;
  13882. } else {
  13883. $byMajor[Preg::replace('{^(\d+)\..*}', '$1', (string) $version)][] = $pretty;
  13884. }
  13885. }
  13886. foreach ($byMajor as $majorVersion => $versionsForMajor) {
  13887. $maxVersions = $majorVersion === 'dev' ? $maxDev : $max;
  13888. if (count($versionsForMajor) > $maxVersions) {
  13889. $filtered[] = $versionsForMajor[0];
  13890. $filtered[] = '...';
  13891. $filtered[] = $versionsForMajor[count($versionsForMajor) - 1];
  13892. } else {
  13893. $filtered = array_merge($filtered, $versionsForMajor);
  13894. }
  13895. }
  13896. return $filtered;
  13897. }
  13898. private static function hasMultipleNames(array $packages): bool
  13899. {
  13900. $name = null;
  13901. foreach ($packages as $package) {
  13902. if ($name === null || $name === $package->getName()) {
  13903. $name = $package->getName();
  13904. } else {
  13905. return true;
  13906. }
  13907. }
  13908. return false;
  13909. }
  13910. private static function computeCheckForLowerPrioRepo(Pool $pool, bool $isVerbose, string $packageName, array $higherRepoPackages, array $allReposPackages, string $reason, ?ConstraintInterface $constraint = null): array
  13911. {
  13912. $nextRepoPackages = [];
  13913. $nextRepo = null;
  13914. foreach ($allReposPackages as $package) {
  13915. if ($nextRepo === null || $nextRepo === $package->getRepository()) {
  13916. $nextRepoPackages[] = $package;
  13917. $nextRepo = $package->getRepository();
  13918. } else {
  13919. break;
  13920. }
  13921. }
  13922. assert(null !== $nextRepo);
  13923. if (\count($higherRepoPackages) > 0) {
  13924. $topPackage = reset($higherRepoPackages);
  13925. if ($topPackage instanceof RootPackageInterface) {
  13926. return [
  13927. "- Root composer.json requires $packageName".self::constraintToText($constraint).', it is ',
  13928. 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.$topPackage->getPrettyName().' '.$topPackage->getPrettyVersion().' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.',
  13929. ];
  13930. }
  13931. }
  13932. if ($nextRepo instanceof LockArrayRepository) {
  13933. $singular = count($higherRepoPackages) === 1;
  13934. $suggestion = 'Make sure you either fix the '.$reason.' or avoid updating this package to keep the one present in the lock file ('.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).').';
  13935. if ($nextRepoPackages[0]->getDistType() === 'path') {
  13936. $transportOptions = $nextRepoPackages[0]->getTransportOptions();
  13937. if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
  13938. $suggestion = 'Make sure you fix the '.$reason.' as packages installed from symlinked path repos are updated even in partial updates and the one from the lock file can thus not be used.';
  13939. }
  13940. }
  13941. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ',
  13942. 'found ' . self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' but ' . ($singular ? 'it does' : 'these do') . ' not match your '.$reason.' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. '.$suggestion,
  13943. ];
  13944. }
  13945. return ["- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages from the higher priority repository do not match your '.$reason.' and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.'];
  13946. }
  13947. protected static function constraintToText(?ConstraintInterface $constraint = null): string
  13948. {
  13949. if ($constraint instanceof Constraint && $constraint->getOperator() === Constraint::STR_OP_EQ && !str_starts_with($constraint->getVersion(), 'dev-')) {
  13950. if (!Preg::isMatch('{^\d+(?:\.\d+)*$}', $constraint->getPrettyString())) {
  13951. return ' '.$constraint->getPrettyString() .' (exact version match)';
  13952. }
  13953. $versions = [$constraint->getPrettyString()];
  13954. for ($i = 3 - substr_count($versions[0], '.'); $i > 0; $i--) {
  13955. $versions[] = end($versions) . '.0';
  13956. }
  13957. return ' ' . $constraint->getPrettyString() . ' (exact version match: ' . (count($versions) > 1 ? implode(', ', array_slice($versions, 0, -1)) . ' or ' . end($versions) : $versions[0]) . ')';
  13958. }
  13959. return $constraint !== null ? ' '.$constraint->getPrettyString() : '';
  13960. }
  13961. private static function getProvidersList(RepositorySet $repositorySet, string $packageName, int $maxProviders): ?string
  13962. {
  13963. $providers = $repositorySet->getProviders($packageName);
  13964. if (\count($providers) > 0) {
  13965. $providersStr = implode(array_map(static function ($p): string {
  13966. $description = $p['description'] !== '' && $p['description'] !== null ? ' '.substr($p['description'], 0, 100) : '';
  13967. return ' - '.$p['name'].$description."\n";
  13968. }, count($providers) > $maxProviders + 1 ? array_slice($providers, 0, $maxProviders) : $providers));
  13969. if (count($providers) > $maxProviders + 1) {
  13970. $providersStr .= ' ... and '.(count($providers) - $maxProviders).' more.'."\n";
  13971. }
  13972. return $providersStr;
  13973. }
  13974. return null;
  13975. }
  13976. }
  13977. <?php declare(strict_types=1);
  13978. namespace Composer\DependencyResolver;
  13979. use Composer\Package\BasePackage;
  13980. use Composer\Package\PackageInterface;
  13981. use Composer\Repository\LockArrayRepository;
  13982. use Composer\Semver\Constraint\ConstraintInterface;
  13983. use Composer\Semver\Constraint\MatchAllConstraint;
  13984. class Request
  13985. {
  13986. public const UPDATE_ONLY_LISTED = 0;
  13987. public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE = 1;
  13988. public const UPDATE_LISTED_WITH_TRANSITIVE_DEPS = 2;
  13989. protected $lockedRepository;
  13990. protected $requires = [];
  13991. protected $fixedPackages = [];
  13992. protected $lockedPackages = [];
  13993. protected $fixedLockedPackages = [];
  13994. protected $updateAllowList = [];
  13995. protected $updateAllowTransitiveDependencies = false;
  13996. private $restrictedPackages = null;
  13997. public function __construct(?LockArrayRepository $lockedRepository = null)
  13998. {
  13999. $this->lockedRepository = $lockedRepository;
  14000. }
  14001. public function requireName(string $packageName, ?ConstraintInterface $constraint = null): void
  14002. {
  14003. $packageName = strtolower($packageName);
  14004. if ($constraint === null) {
  14005. $constraint = new MatchAllConstraint();
  14006. }
  14007. if (isset($this->requires[$packageName])) {
  14008. throw new \LogicException('Overwriting requires seems like a bug ('.$packageName.' '.$this->requires[$packageName]->getPrettyString().' => '.$constraint->getPrettyString().', check why it is happening, might be a root alias');
  14009. }
  14010. $this->requires[$packageName] = $constraint;
  14011. }
  14012. public function fixPackage(BasePackage $package): void
  14013. {
  14014. $this->fixedPackages[spl_object_hash($package)] = $package;
  14015. }
  14016. public function lockPackage(BasePackage $package): void
  14017. {
  14018. $this->lockedPackages[spl_object_hash($package)] = $package;
  14019. }
  14020. public function fixLockedPackage(BasePackage $package): void
  14021. {
  14022. $this->fixedPackages[spl_object_hash($package)] = $package;
  14023. $this->fixedLockedPackages[spl_object_hash($package)] = $package;
  14024. }
  14025. public function unlockPackage(BasePackage $package): void
  14026. {
  14027. unset($this->lockedPackages[spl_object_hash($package)]);
  14028. }
  14029. public function setUpdateAllowList(array $updateAllowList, $updateAllowTransitiveDependencies): void
  14030. {
  14031. $this->updateAllowList = $updateAllowList;
  14032. $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
  14033. }
  14034. public function getUpdateAllowList(): array
  14035. {
  14036. return $this->updateAllowList;
  14037. }
  14038. public function getUpdateAllowTransitiveDependencies(): bool
  14039. {
  14040. return $this->updateAllowTransitiveDependencies !== self::UPDATE_ONLY_LISTED;
  14041. }
  14042. public function getUpdateAllowTransitiveRootDependencies(): bool
  14043. {
  14044. return $this->updateAllowTransitiveDependencies === self::UPDATE_LISTED_WITH_TRANSITIVE_DEPS;
  14045. }
  14046. public function getRequires(): array
  14047. {
  14048. return $this->requires;
  14049. }
  14050. public function getFixedPackages(): array
  14051. {
  14052. return $this->fixedPackages;
  14053. }
  14054. public function isFixedPackage(BasePackage $package): bool
  14055. {
  14056. return isset($this->fixedPackages[spl_object_hash($package)]);
  14057. }
  14058. public function getLockedPackages(): array
  14059. {
  14060. return $this->lockedPackages;
  14061. }
  14062. public function isLockedPackage(PackageInterface $package): bool
  14063. {
  14064. return isset($this->lockedPackages[spl_object_hash($package)]) || isset($this->fixedLockedPackages[spl_object_hash($package)]);
  14065. }
  14066. public function getFixedOrLockedPackages(): array
  14067. {
  14068. return array_merge($this->fixedPackages, $this->lockedPackages);
  14069. }
  14070. public function getPresentMap(bool $packageIds = false): array
  14071. {
  14072. $presentMap = [];
  14073. if ($this->lockedRepository !== null) {
  14074. foreach ($this->lockedRepository->getPackages() as $package) {
  14075. $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
  14076. }
  14077. }
  14078. foreach ($this->fixedPackages as $package) {
  14079. $presentMap[$packageIds ? $package->getId() : spl_object_hash($package)] = $package;
  14080. }
  14081. return $presentMap;
  14082. }
  14083. public function getFixedPackagesMap(): array
  14084. {
  14085. $fixedPackagesMap = [];
  14086. foreach ($this->fixedPackages as $package) {
  14087. $fixedPackagesMap[$package->getId()] = $package;
  14088. }
  14089. return $fixedPackagesMap;
  14090. }
  14091. public function getLockedRepository(): ?LockArrayRepository
  14092. {
  14093. return $this->lockedRepository;
  14094. }
  14095. public function restrictPackages(array $names): void
  14096. {
  14097. $this->restrictedPackages = $names;
  14098. }
  14099. public function getRestrictedPackages(): ?array
  14100. {
  14101. return $this->restrictedPackages;
  14102. }
  14103. }
  14104. <?php declare(strict_types=1);
  14105. namespace Composer\DependencyResolver;
  14106. use Composer\Package\AliasPackage;
  14107. use Composer\Package\BasePackage;
  14108. use Composer\Package\Link;
  14109. use Composer\Repository\PlatformRepository;
  14110. use Composer\Repository\RepositorySet;
  14111. use Composer\Package\Version\VersionParser;
  14112. use Composer\Semver\Constraint\Constraint;
  14113. use Composer\Semver\Constraint\ConstraintInterface;
  14114. abstract class Rule
  14115. {
  14116. public const RULE_ROOT_REQUIRE = 2;
  14117. public const RULE_FIXED = 3;
  14118. public const RULE_PACKAGE_CONFLICT = 6;
  14119. public const RULE_PACKAGE_REQUIRES = 7;
  14120. public const RULE_PACKAGE_SAME_NAME = 10;
  14121. public const RULE_LEARNED = 12;
  14122. public const RULE_PACKAGE_ALIAS = 13;
  14123. public const RULE_PACKAGE_INVERSE_ALIAS = 14;
  14124. private const BITFIELD_TYPE = 0;
  14125. private const BITFIELD_REASON = 8;
  14126. private const BITFIELD_DISABLED = 16;
  14127. protected $bitfield;
  14128. protected $request;
  14129. protected $reasonData;
  14130. public function __construct($reason, $reasonData)
  14131. {
  14132. $this->reasonData = $reasonData;
  14133. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  14134. ($reason << self::BITFIELD_REASON) |
  14135. (255 << self::BITFIELD_TYPE);
  14136. }
  14137. abstract public function getLiterals(): array;
  14138. abstract public function getHash();
  14139. abstract public function __toString(): string;
  14140. abstract public function equals(Rule $rule): bool;
  14141. public function getReason(): int
  14142. {
  14143. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  14144. }
  14145. public function getReasonData()
  14146. {
  14147. return $this->reasonData;
  14148. }
  14149. public function getRequiredPackage(): ?string
  14150. {
  14151. switch ($this->getReason()) {
  14152. case self::RULE_ROOT_REQUIRE:
  14153. return $this->getReasonData()['packageName'];
  14154. case self::RULE_FIXED:
  14155. return $this->getReasonData()['package']->getName();
  14156. case self::RULE_PACKAGE_REQUIRES:
  14157. return $this->getReasonData()->getTarget();
  14158. }
  14159. return null;
  14160. }
  14161. public function setType($type): void
  14162. {
  14163. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  14164. }
  14165. public function getType(): int
  14166. {
  14167. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  14168. }
  14169. public function disable(): void
  14170. {
  14171. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  14172. }
  14173. public function enable(): void
  14174. {
  14175. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  14176. }
  14177. public function isDisabled(): bool
  14178. {
  14179. return 0 !== (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  14180. }
  14181. public function isEnabled(): bool
  14182. {
  14183. return 0 === (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  14184. }
  14185. abstract public function isAssertion(): bool;
  14186. public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool): bool
  14187. {
  14188. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  14189. if (PlatformRepository::isPlatformPackage($this->getReasonData()->getTarget())) {
  14190. return false;
  14191. }
  14192. if ($request->getLockedRepository() !== null) {
  14193. foreach ($request->getLockedRepository()->getPackages() as $package) {
  14194. if ($package->getName() === $this->getReasonData()->getTarget()) {
  14195. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  14196. return true;
  14197. }
  14198. if (!$this->getReasonData()->getConstraint()->matches(new Constraint('=', $package->getVersion()))) {
  14199. return true;
  14200. }
  14201. if (!$request->isLockedPackage($package)) {
  14202. return true;
  14203. }
  14204. break;
  14205. }
  14206. }
  14207. }
  14208. }
  14209. if ($this->getReason() === self::RULE_ROOT_REQUIRE) {
  14210. if (PlatformRepository::isPlatformPackage($this->getReasonData()['packageName'])) {
  14211. return false;
  14212. }
  14213. if ($request->getLockedRepository() !== null) {
  14214. foreach ($request->getLockedRepository()->getPackages() as $package) {
  14215. if ($package->getName() === $this->getReasonData()['packageName']) {
  14216. if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
  14217. return true;
  14218. }
  14219. if (!$this->getReasonData()['constraint']->matches(new Constraint('=', $package->getVersion()))) {
  14220. return true;
  14221. }
  14222. break;
  14223. }
  14224. }
  14225. }
  14226. }
  14227. return false;
  14228. }
  14229. public function getSourcePackage(Pool $pool): BasePackage
  14230. {
  14231. $literals = $this->getLiterals();
  14232. switch ($this->getReason()) {
  14233. case self::RULE_PACKAGE_CONFLICT:
  14234. $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  14235. $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  14236. $reasonData = $this->getReasonData();
  14237. if ($reasonData->getSource() === $package1->getName()) {
  14238. [$package2, $package1] = [$package1, $package2];
  14239. }
  14240. return $package2;
  14241. case self::RULE_PACKAGE_REQUIRES:
  14242. $sourceLiteral = $literals[0];
  14243. $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
  14244. return $sourcePackage;
  14245. default:
  14246. throw new \LogicException('Not implemented');
  14247. }
  14248. }
  14249. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, array $installedMap = [], array $learnedPool = []): string
  14250. {
  14251. $literals = $this->getLiterals();
  14252. switch ($this->getReason()) {
  14253. case self::RULE_ROOT_REQUIRE:
  14254. $reasonData = $this->getReasonData();
  14255. $packageName = $reasonData['packageName'];
  14256. $constraint = $reasonData['constraint'];
  14257. $packages = $pool->whatProvides($packageName, $constraint);
  14258. if (0 === \count($packages)) {
  14259. return 'No package found to satisfy root composer.json require '.$packageName.' '.$constraint->getPrettyString();
  14260. }
  14261. $packagesNonAlias = array_values(array_filter($packages, static function ($p): bool {
  14262. return !($p instanceof AliasPackage);
  14263. }));
  14264. if (\count($packagesNonAlias) === 1) {
  14265. $package = $packagesNonAlias[0];
  14266. if ($request->isLockedPackage($package)) {
  14267. return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion()." and an update of this package was not requested.";
  14268. }
  14269. }
  14270. return 'Root composer.json requires '.$packageName.' '.$constraint->getPrettyString().' -> satisfiable by '.$this->formatPackagesUnique($pool, $packages, $isVerbose, $constraint).'.';
  14271. case self::RULE_FIXED:
  14272. $package = $this->deduplicateDefaultBranchAlias($this->getReasonData()['package']);
  14273. if ($request->isLockedPackage($package)) {
  14274. return $package->getPrettyName().' is locked to version '.$package->getPrettyVersion().' and an update of this package was not requested.';
  14275. }
  14276. return $package->getPrettyName().' is present at version '.$package->getPrettyVersion() . ' and cannot be modified by Composer';
  14277. case self::RULE_PACKAGE_CONFLICT:
  14278. $package1 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  14279. $package2 = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  14280. $conflictTarget = $package1->getPrettyString();
  14281. $reasonData = $this->getReasonData();
  14282. if ($reasonData->getSource() === $package1->getName()) {
  14283. [$package2, $package1] = [$package1, $package2];
  14284. $conflictTarget = $package1->getPrettyName().' '.$reasonData->getPrettyConstraint();
  14285. }
  14286. if ($reasonData->getTarget() !== $package1->getName()) {
  14287. $provideType = null;
  14288. $provided = null;
  14289. foreach ($package1->getProvides() as $provide) {
  14290. if ($provide->getTarget() === $reasonData->getTarget()) {
  14291. $provideType = 'provides';
  14292. $provided = $provide->getPrettyConstraint();
  14293. break;
  14294. }
  14295. }
  14296. foreach ($package1->getReplaces() as $replace) {
  14297. if ($replace->getTarget() === $reasonData->getTarget()) {
  14298. $provideType = 'replaces';
  14299. $provided = $replace->getPrettyConstraint();
  14300. break;
  14301. }
  14302. }
  14303. if (null !== $provideType) {
  14304. $conflictTarget = $reasonData->getTarget().' '.$reasonData->getPrettyConstraint().' ('.$package1->getPrettyString().' '.$provideType.' '.$reasonData->getTarget().' '.$provided.')';
  14305. }
  14306. }
  14307. return $package2->getPrettyString().' conflicts with '.$conflictTarget.'.';
  14308. case self::RULE_PACKAGE_REQUIRES:
  14309. assert(\count($literals) > 0);
  14310. $sourceLiteral = array_shift($literals);
  14311. $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));
  14312. $reasonData = $this->getReasonData();
  14313. $requires = [];
  14314. foreach ($literals as $literal) {
  14315. $requires[] = $pool->literalToPackage($literal);
  14316. }
  14317. $text = $reasonData->getPrettyString($sourcePackage);
  14318. if (\count($requires) > 0) {
  14319. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires, $isVerbose, $reasonData->getConstraint()) . '.';
  14320. } else {
  14321. $targetName = $reasonData->getTarget();
  14322. $reason = Problem::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $targetName, $reasonData->getConstraint());
  14323. return $text . ' -> ' . $reason[1];
  14324. }
  14325. return $text;
  14326. case self::RULE_PACKAGE_SAME_NAME:
  14327. $packageNames = [];
  14328. foreach ($literals as $literal) {
  14329. $package = $pool->literalToPackage($literal);
  14330. $packageNames[$package->getName()] = true;
  14331. }
  14332. unset($literal);
  14333. $replacedName = $this->getReasonData();
  14334. if (\count($packageNames) > 1) {
  14335. if (!isset($packageNames[$replacedName])) {
  14336. $reason = 'They '.(\count($literals) === 2 ? 'both' : 'all').' replace '.$replacedName.' and thus cannot coexist.';
  14337. } else {
  14338. $replacerNames = $packageNames;
  14339. unset($replacerNames[$replacedName]);
  14340. $replacerNames = array_keys($replacerNames);
  14341. if (\count($replacerNames) === 1) {
  14342. $reason = $replacerNames[0] . ' replaces ';
  14343. } else {
  14344. $reason = '['.implode(', ', $replacerNames).'] replace ';
  14345. }
  14346. $reason .= $replacedName.' and thus cannot coexist with it.';
  14347. }
  14348. $installedPackages = [];
  14349. $removablePackages = [];
  14350. foreach ($literals as $literal) {
  14351. if (isset($installedMap[abs($literal)])) {
  14352. $installedPackages[] = $pool->literalToPackage($literal);
  14353. } else {
  14354. $removablePackages[] = $pool->literalToPackage($literal);
  14355. }
  14356. }
  14357. if (\count($installedPackages) > 0 && \count($removablePackages) > 0) {
  14358. return $this->formatPackagesUnique($pool, $removablePackages, $isVerbose, null, true).' cannot be installed as that would require removing '.$this->formatPackagesUnique($pool, $installedPackages, $isVerbose, null, true).'. '.$reason;
  14359. }
  14360. return 'Only one of these can be installed: '.$this->formatPackagesUnique($pool, $literals, $isVerbose, null, true).'. '.$reason;
  14361. }
  14362. return 'You can only install one version of a package, so only one of these can be installed: ' . $this->formatPackagesUnique($pool, $literals, $isVerbose, null, true) . '.';
  14363. case self::RULE_LEARNED:
  14364. $learnedString = ' (conflict analysis result)';
  14365. if (\count($literals) === 1) {
  14366. $ruleText = $pool->literalToPrettyString($literals[0], $installedMap);
  14367. } else {
  14368. $groups = [];
  14369. foreach ($literals as $literal) {
  14370. $package = $pool->literalToPackage($literal);
  14371. if (isset($installedMap[$package->id])) {
  14372. $group = $literal > 0 ? 'keep' : 'remove';
  14373. } else {
  14374. $group = $literal > 0 ? 'install' : 'don\'t install';
  14375. }
  14376. $groups[$group][] = $this->deduplicateDefaultBranchAlias($package);
  14377. }
  14378. $ruleTexts = [];
  14379. foreach ($groups as $group => $packages) {
  14380. $ruleTexts[] = $group . (\count($packages) > 1 ? ' one of' : '').' ' . $this->formatPackagesUnique($pool, $packages, $isVerbose);
  14381. }
  14382. $ruleText = implode(' | ', $ruleTexts);
  14383. }
  14384. return 'Conclusion: '.$ruleText.$learnedString;
  14385. case self::RULE_PACKAGE_ALIAS:
  14386. $aliasPackage = $pool->literalToPackage($literals[0]);
  14387. if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  14388. return '';
  14389. }
  14390. $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[1]));
  14391. return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and thus requires it to be installed too.';
  14392. case self::RULE_PACKAGE_INVERSE_ALIAS:
  14393. $aliasPackage = $pool->literalToPackage($literals[1]);
  14394. if ($aliasPackage->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  14395. return '';
  14396. }
  14397. $package = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($literals[0]));
  14398. return $aliasPackage->getPrettyString() .' is an alias of '.$package->getPrettyString().' and must be installed with it.';
  14399. default:
  14400. $ruleText = '';
  14401. foreach ($literals as $i => $literal) {
  14402. if ($i !== 0) {
  14403. $ruleText .= '|';
  14404. }
  14405. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  14406. }
  14407. return '('.$ruleText.')';
  14408. }
  14409. }
  14410. protected function formatPackagesUnique(Pool $pool, array $literalsOrPackages, bool $isVerbose, ?ConstraintInterface $constraint = null, bool $useRemovedVersionGroup = false): string
  14411. {
  14412. $packages = [];
  14413. foreach ($literalsOrPackages as $package) {
  14414. $packages[] = \is_object($package) ? $package : $pool->literalToPackage($package);
  14415. }
  14416. return Problem::getPackageList($packages, $isVerbose, $pool, $constraint, $useRemovedVersionGroup);
  14417. }
  14418. private function deduplicateDefaultBranchAlias(BasePackage $package): BasePackage
  14419. {
  14420. if ($package instanceof AliasPackage && $package->getPrettyVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  14421. $package = $package->getAliasOf();
  14422. }
  14423. return $package;
  14424. }
  14425. }
  14426. <?php declare(strict_types=1);
  14427. namespace Composer\DependencyResolver;
  14428. class Rule2Literals extends Rule
  14429. {
  14430. protected $literal1;
  14431. protected $literal2;
  14432. public function __construct(int $literal1, int $literal2, $reason, $reasonData)
  14433. {
  14434. parent::__construct($reason, $reasonData);
  14435. if ($literal1 < $literal2) {
  14436. $this->literal1 = $literal1;
  14437. $this->literal2 = $literal2;
  14438. } else {
  14439. $this->literal1 = $literal2;
  14440. $this->literal2 = $literal1;
  14441. }
  14442. }
  14443. public function getLiterals(): array
  14444. {
  14445. return [$this->literal1, $this->literal2];
  14446. }
  14447. public function getHash()
  14448. {
  14449. return $this->literal1.','.$this->literal2;
  14450. }
  14451. public function equals(Rule $rule): bool
  14452. {
  14453. if ($rule instanceof self) {
  14454. if ($this->literal1 !== $rule->literal1) {
  14455. return false;
  14456. }
  14457. if ($this->literal2 !== $rule->literal2) {
  14458. return false;
  14459. }
  14460. return true;
  14461. }
  14462. $literals = $rule->getLiterals();
  14463. if (2 !== \count($literals)) {
  14464. return false;
  14465. }
  14466. if ($this->literal1 !== $literals[0]) {
  14467. return false;
  14468. }
  14469. if ($this->literal2 !== $literals[1]) {
  14470. return false;
  14471. }
  14472. return true;
  14473. }
  14474. public function isAssertion(): bool
  14475. {
  14476. return false;
  14477. }
  14478. public function __toString(): string
  14479. {
  14480. $result = $this->isDisabled() ? 'disabled(' : '(';
  14481. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  14482. return $result;
  14483. }
  14484. }
  14485. <?php declare(strict_types=1);
  14486. namespace Composer\DependencyResolver;
  14487. use Composer\Repository\RepositorySet;
  14488. class RuleSet implements \IteratorAggregate, \Countable
  14489. {
  14490. public const TYPE_PACKAGE = 0;
  14491. public const TYPE_REQUEST = 1;
  14492. public const TYPE_LEARNED = 4;
  14493. public $ruleById = [];
  14494. const TYPES = [
  14495. self::TYPE_PACKAGE => 'PACKAGE',
  14496. self::TYPE_REQUEST => 'REQUEST',
  14497. self::TYPE_LEARNED => 'LEARNED',
  14498. ];
  14499. protected $rules;
  14500. protected $nextRuleId = 0;
  14501. protected $rulesByHash = [];
  14502. public function __construct()
  14503. {
  14504. foreach ($this->getTypes() as $type) {
  14505. $this->rules[$type] = [];
  14506. }
  14507. }
  14508. public function add(Rule $rule, $type): void
  14509. {
  14510. if (!isset(self::TYPES[$type])) {
  14511. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  14512. }
  14513. $hash = $rule->getHash();
  14514. if (isset($this->rulesByHash[$hash])) {
  14515. $potentialDuplicates = $this->rulesByHash[$hash];
  14516. if (\is_array($potentialDuplicates)) {
  14517. foreach ($potentialDuplicates as $potentialDuplicate) {
  14518. if ($rule->equals($potentialDuplicate)) {
  14519. return;
  14520. }
  14521. }
  14522. } else {
  14523. if ($rule->equals($potentialDuplicates)) {
  14524. return;
  14525. }
  14526. }
  14527. }
  14528. if (!isset($this->rules[$type])) {
  14529. $this->rules[$type] = [];
  14530. }
  14531. $this->rules[$type][] = $rule;
  14532. $this->ruleById[$this->nextRuleId] = $rule;
  14533. $rule->setType($type);
  14534. $this->nextRuleId++;
  14535. if (!isset($this->rulesByHash[$hash])) {
  14536. $this->rulesByHash[$hash] = $rule;
  14537. } elseif (\is_array($this->rulesByHash[$hash])) {
  14538. $this->rulesByHash[$hash][] = $rule;
  14539. } else {
  14540. $originalRule = $this->rulesByHash[$hash];
  14541. $this->rulesByHash[$hash] = [$originalRule, $rule];
  14542. }
  14543. }
  14544. public function count(): int
  14545. {
  14546. return $this->nextRuleId;
  14547. }
  14548. public function ruleById(int $id): Rule
  14549. {
  14550. return $this->ruleById[$id];
  14551. }
  14552. public function getRules(): array
  14553. {
  14554. return $this->rules;
  14555. }
  14556. public function getIterator(): RuleSetIterator
  14557. {
  14558. return new RuleSetIterator($this->getRules());
  14559. }
  14560. public function getIteratorFor($types): RuleSetIterator
  14561. {
  14562. if (!\is_array($types)) {
  14563. $types = [$types];
  14564. }
  14565. $allRules = $this->getRules();
  14566. $rules = [];
  14567. foreach ($types as $type) {
  14568. $rules[$type] = $allRules[$type];
  14569. }
  14570. return new RuleSetIterator($rules);
  14571. }
  14572. public function getIteratorWithout($types): RuleSetIterator
  14573. {
  14574. if (!\is_array($types)) {
  14575. $types = [$types];
  14576. }
  14577. $rules = $this->getRules();
  14578. foreach ($types as $type) {
  14579. unset($rules[$type]);
  14580. }
  14581. return new RuleSetIterator($rules);
  14582. }
  14583. public function getTypes(): array
  14584. {
  14585. $types = self::TYPES;
  14586. return array_keys($types);
  14587. }
  14588. public function getPrettyString(?RepositorySet $repositorySet = null, ?Request $request = null, ?Pool $pool = null, bool $isVerbose = false): string
  14589. {
  14590. $string = "\n";
  14591. foreach ($this->rules as $type => $rules) {
  14592. $string .= str_pad(self::TYPES[$type], 8, ' ') . ": ";
  14593. foreach ($rules as $rule) {
  14594. $string .= ($repositorySet !== null && $request !== null && $pool !== null ? $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose) : $rule)."\n";
  14595. }
  14596. $string .= "\n\n";
  14597. }
  14598. return $string;
  14599. }
  14600. public function __toString(): string
  14601. {
  14602. return $this->getPrettyString();
  14603. }
  14604. }
  14605. <?php declare(strict_types=1);
  14606. namespace Composer\DependencyResolver;
  14607. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  14608. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  14609. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  14610. use Composer\Package\BasePackage;
  14611. use Composer\Package\AliasPackage;
  14612. class RuleSetGenerator
  14613. {
  14614. protected $policy;
  14615. protected $pool;
  14616. protected $rules;
  14617. protected $addedMap = [];
  14618. protected $addedPackagesByNames = [];
  14619. public function __construct(PolicyInterface $policy, Pool $pool)
  14620. {
  14621. $this->policy = $policy;
  14622. $this->pool = $pool;
  14623. $this->rules = new RuleSet;
  14624. }
  14625. protected function createRequireRule(BasePackage $package, array $providers, $reason, $reasonData): ?Rule
  14626. {
  14627. $literals = [-$package->id];
  14628. foreach ($providers as $provider) {
  14629. if ($provider === $package) {
  14630. return null;
  14631. }
  14632. $literals[] = $provider->id;
  14633. }
  14634. return new GenericRule($literals, $reason, $reasonData);
  14635. }
  14636. protected function createInstallOneOfRule(array $packages, $reason, $reasonData): Rule
  14637. {
  14638. $literals = [];
  14639. foreach ($packages as $package) {
  14640. $literals[] = $package->id;
  14641. }
  14642. return new GenericRule($literals, $reason, $reasonData);
  14643. }
  14644. protected function createRule2Literals(BasePackage $issuer, BasePackage $provider, $reason, $reasonData): ?Rule
  14645. {
  14646. if ($issuer === $provider) {
  14647. return null;
  14648. }
  14649. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  14650. }
  14651. protected function createMultiConflictRule(array $packages, $reason, $reasonData): Rule
  14652. {
  14653. $literals = [];
  14654. foreach ($packages as $package) {
  14655. $literals[] = -$package->id;
  14656. }
  14657. if (\count($literals) === 2) {
  14658. return new Rule2Literals($literals[0], $literals[1], $reason, $reasonData);
  14659. }
  14660. return new MultiConflictRule($literals, $reason, $reasonData);
  14661. }
  14662. private function addRule($type, ?Rule $newRule = null): void
  14663. {
  14664. if (null === $newRule) {
  14665. return;
  14666. }
  14667. $this->rules->add($newRule, $type);
  14668. }
  14669. protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter): void
  14670. {
  14671. $workQueue = new \SplQueue;
  14672. $workQueue->enqueue($package);
  14673. while (!$workQueue->isEmpty()) {
  14674. $package = $workQueue->dequeue();
  14675. if (isset($this->addedMap[$package->id])) {
  14676. continue;
  14677. }
  14678. $this->addedMap[$package->id] = $package;
  14679. if (!$package instanceof AliasPackage) {
  14680. foreach ($package->getNames(false) as $name) {
  14681. $this->addedPackagesByNames[$name][] = $package;
  14682. }
  14683. } else {
  14684. $workQueue->enqueue($package->getAliasOf());
  14685. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, [$package->getAliasOf()], Rule::RULE_PACKAGE_ALIAS, $package));
  14686. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package->getAliasOf(), [$package], Rule::RULE_PACKAGE_INVERSE_ALIAS, $package->getAliasOf()));
  14687. if (!$package->hasSelfVersionRequires()) {
  14688. continue;
  14689. }
  14690. }
  14691. foreach ($package->getRequires() as $link) {
  14692. $constraint = $link->getConstraint();
  14693. if ($platformRequirementFilter->isIgnored($link->getTarget())) {
  14694. continue;
  14695. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  14696. $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint);
  14697. }
  14698. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $constraint);
  14699. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  14700. foreach ($possibleRequires as $require) {
  14701. $workQueue->enqueue($require);
  14702. }
  14703. }
  14704. }
  14705. }
  14706. protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter): void
  14707. {
  14708. foreach ($this->addedMap as $package) {
  14709. foreach ($package->getConflicts() as $link) {
  14710. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  14711. continue;
  14712. }
  14713. $constraint = $link->getConstraint();
  14714. if ($platformRequirementFilter->isIgnored($link->getTarget())) {
  14715. continue;
  14716. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  14717. $constraint = $platformRequirementFilter->filterConstraint($link->getTarget(), $constraint, false);
  14718. }
  14719. $conflicts = $this->pool->whatProvides($link->getTarget(), $constraint);
  14720. foreach ($conflicts as $conflict) {
  14721. if (!$conflict instanceof AliasPackage || $conflict->getName() === $link->getTarget()) {
  14722. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  14723. }
  14724. }
  14725. }
  14726. }
  14727. foreach ($this->addedPackagesByNames as $name => $packages) {
  14728. if (\count($packages) > 1) {
  14729. $reason = Rule::RULE_PACKAGE_SAME_NAME;
  14730. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createMultiConflictRule($packages, $reason, $name));
  14731. }
  14732. }
  14733. }
  14734. protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
  14735. {
  14736. foreach ($request->getFixedPackages() as $package) {
  14737. if ($package->id === -1) {
  14738. if ($this->pool->isUnacceptableFixedOrLockedPackage($package)) {
  14739. continue;
  14740. }
  14741. throw new \LogicException("Fixed package ".$package->getPrettyString()." was not added to solver pool.");
  14742. }
  14743. $this->addRulesForPackage($package, $platformRequirementFilter);
  14744. $rule = $this->createInstallOneOfRule([$package], Rule::RULE_FIXED, [
  14745. 'package' => $package,
  14746. ]);
  14747. $this->addRule(RuleSet::TYPE_REQUEST, $rule);
  14748. }
  14749. foreach ($request->getRequires() as $packageName => $constraint) {
  14750. if ($platformRequirementFilter->isIgnored($packageName)) {
  14751. continue;
  14752. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  14753. $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
  14754. }
  14755. $packages = $this->pool->whatProvides($packageName, $constraint);
  14756. if (\count($packages) > 0) {
  14757. foreach ($packages as $package) {
  14758. $this->addRulesForPackage($package, $platformRequirementFilter);
  14759. }
  14760. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_ROOT_REQUIRE, [
  14761. 'packageName' => $packageName,
  14762. 'constraint' => $constraint,
  14763. ]);
  14764. $this->addRule(RuleSet::TYPE_REQUEST, $rule);
  14765. }
  14766. }
  14767. }
  14768. protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter): void
  14769. {
  14770. foreach ($this->pool->getPackages() as $package) {
  14771. if (!isset($this->addedMap[$package->id]) &&
  14772. $package instanceof AliasPackage &&
  14773. ($package->isRootPackageAlias() || isset($this->addedMap[$package->getAliasOf()->id]))
  14774. ) {
  14775. $this->addRulesForPackage($package, $platformRequirementFilter);
  14776. }
  14777. }
  14778. }
  14779. public function getRulesFor(Request $request, ?PlatformRequirementFilterInterface $platformRequirementFilter = null): RuleSet
  14780. {
  14781. $platformRequirementFilter = $platformRequirementFilter ?? PlatformRequirementFilterFactory::ignoreNothing();
  14782. $this->addRulesForRequest($request, $platformRequirementFilter);
  14783. $this->addRulesForRootAliases($platformRequirementFilter);
  14784. $this->addConflictRules($platformRequirementFilter);
  14785. $this->addedMap = $this->addedPackagesByNames = [];
  14786. $rules = $this->rules;
  14787. $this->rules = new RuleSet;
  14788. return $rules;
  14789. }
  14790. }
  14791. <?php declare(strict_types=1);
  14792. namespace Composer\DependencyResolver;
  14793. class RuleSetIterator implements \Iterator
  14794. {
  14795. protected $rules;
  14796. protected $types;
  14797. protected $currentOffset;
  14798. protected $currentType;
  14799. protected $currentTypeOffset;
  14800. public function __construct(array $rules)
  14801. {
  14802. $this->rules = $rules;
  14803. $this->types = array_keys($rules);
  14804. sort($this->types);
  14805. $this->rewind();
  14806. }
  14807. public function current(): Rule
  14808. {
  14809. return $this->rules[$this->currentType][$this->currentOffset];
  14810. }
  14811. public function key(): int
  14812. {
  14813. return $this->currentType;
  14814. }
  14815. public function next(): void
  14816. {
  14817. $this->currentOffset++;
  14818. if (!isset($this->rules[$this->currentType])) {
  14819. return;
  14820. }
  14821. if ($this->currentOffset >= \count($this->rules[$this->currentType])) {
  14822. $this->currentOffset = 0;
  14823. do {
  14824. $this->currentTypeOffset++;
  14825. if (!isset($this->types[$this->currentTypeOffset])) {
  14826. $this->currentType = -1;
  14827. break;
  14828. }
  14829. $this->currentType = $this->types[$this->currentTypeOffset];
  14830. } while (0 === \count($this->rules[$this->currentType]));
  14831. }
  14832. }
  14833. public function rewind(): void
  14834. {
  14835. $this->currentOffset = 0;
  14836. $this->currentTypeOffset = -1;
  14837. $this->currentType = -1;
  14838. do {
  14839. $this->currentTypeOffset++;
  14840. if (!isset($this->types[$this->currentTypeOffset])) {
  14841. $this->currentType = -1;
  14842. break;
  14843. }
  14844. $this->currentType = $this->types[$this->currentTypeOffset];
  14845. } while (0 === \count($this->rules[$this->currentType]));
  14846. }
  14847. public function valid(): bool
  14848. {
  14849. return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]);
  14850. }
  14851. }
  14852. <?php declare(strict_types=1);
  14853. namespace Composer\DependencyResolver;
  14854. class RuleWatchChain extends \SplDoublyLinkedList
  14855. {
  14856. public function seek(int $offset): void
  14857. {
  14858. $this->rewind();
  14859. for ($i = 0; $i < $offset; $i++, $this->next());
  14860. }
  14861. public function remove(): void
  14862. {
  14863. $offset = $this->key();
  14864. $this->offsetUnset($offset);
  14865. $this->seek($offset);
  14866. }
  14867. }
  14868. <?php declare(strict_types=1);
  14869. namespace Composer\DependencyResolver;
  14870. class RuleWatchGraph
  14871. {
  14872. protected $watchChains = [];
  14873. public function insert(RuleWatchNode $node): void
  14874. {
  14875. if ($node->getRule()->isAssertion()) {
  14876. return;
  14877. }
  14878. if (!$node->getRule() instanceof MultiConflictRule) {
  14879. foreach ([$node->watch1, $node->watch2] as $literal) {
  14880. if (!isset($this->watchChains[$literal])) {
  14881. $this->watchChains[$literal] = new RuleWatchChain;
  14882. }
  14883. $this->watchChains[$literal]->unshift($node);
  14884. }
  14885. } else {
  14886. foreach ($node->getRule()->getLiterals() as $literal) {
  14887. if (!isset($this->watchChains[$literal])) {
  14888. $this->watchChains[$literal] = new RuleWatchChain;
  14889. }
  14890. $this->watchChains[$literal]->unshift($node);
  14891. }
  14892. }
  14893. }
  14894. public function propagateLiteral(int $decidedLiteral, int $level, Decisions $decisions): ?Rule
  14895. {
  14896. $literal = -$decidedLiteral;
  14897. if (!isset($this->watchChains[$literal])) {
  14898. return null;
  14899. }
  14900. $chain = $this->watchChains[$literal];
  14901. $chain->rewind();
  14902. while ($chain->valid()) {
  14903. $node = $chain->current();
  14904. if (!$node->getRule() instanceof MultiConflictRule) {
  14905. $otherWatch = $node->getOtherWatch($literal);
  14906. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  14907. $ruleLiterals = $node->getRule()->getLiterals();
  14908. $alternativeLiterals = array_filter($ruleLiterals, static function ($ruleLiteral) use ($literal, $otherWatch, $decisions): bool {
  14909. return $literal !== $ruleLiteral &&
  14910. $otherWatch !== $ruleLiteral &&
  14911. !$decisions->conflict($ruleLiteral);
  14912. });
  14913. if (\count($alternativeLiterals) > 0) {
  14914. reset($alternativeLiterals);
  14915. $this->moveWatch($literal, current($alternativeLiterals), $node);
  14916. continue;
  14917. }
  14918. if ($decisions->conflict($otherWatch)) {
  14919. return $node->getRule();
  14920. }
  14921. $decisions->decide($otherWatch, $level, $node->getRule());
  14922. }
  14923. } else {
  14924. foreach ($node->getRule()->getLiterals() as $otherLiteral) {
  14925. if ($literal !== $otherLiteral && !$decisions->satisfy($otherLiteral)) {
  14926. if ($decisions->conflict($otherLiteral)) {
  14927. return $node->getRule();
  14928. }
  14929. $decisions->decide($otherLiteral, $level, $node->getRule());
  14930. }
  14931. }
  14932. }
  14933. $chain->next();
  14934. }
  14935. return null;
  14936. }
  14937. protected function moveWatch(int $fromLiteral, int $toLiteral, RuleWatchNode $node): void
  14938. {
  14939. if (!isset($this->watchChains[$toLiteral])) {
  14940. $this->watchChains[$toLiteral] = new RuleWatchChain;
  14941. }
  14942. $node->moveWatch($fromLiteral, $toLiteral);
  14943. $this->watchChains[$fromLiteral]->remove();
  14944. $this->watchChains[$toLiteral]->unshift($node);
  14945. }
  14946. }
  14947. <?php declare(strict_types=1);
  14948. namespace Composer\DependencyResolver;
  14949. class RuleWatchNode
  14950. {
  14951. public $watch1;
  14952. public $watch2;
  14953. protected $rule;
  14954. public function __construct(Rule $rule)
  14955. {
  14956. $this->rule = $rule;
  14957. $literals = $rule->getLiterals();
  14958. $literalCount = \count($literals);
  14959. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  14960. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  14961. }
  14962. public function watch2OnHighest(Decisions $decisions): void
  14963. {
  14964. $literals = $this->rule->getLiterals();
  14965. if (\count($literals) < 3 || $this->rule instanceof MultiConflictRule) {
  14966. return;
  14967. }
  14968. $watchLevel = 0;
  14969. foreach ($literals as $literal) {
  14970. $level = $decisions->decisionLevel($literal);
  14971. if ($level > $watchLevel) {
  14972. $this->watch2 = $literal;
  14973. $watchLevel = $level;
  14974. }
  14975. }
  14976. }
  14977. public function getRule(): Rule
  14978. {
  14979. return $this->rule;
  14980. }
  14981. public function getOtherWatch(int $literal): int
  14982. {
  14983. if ($this->watch1 === $literal) {
  14984. return $this->watch2;
  14985. }
  14986. return $this->watch1;
  14987. }
  14988. public function moveWatch(int $from, int $to): void
  14989. {
  14990. if ($this->watch1 === $from) {
  14991. $this->watch1 = $to;
  14992. } else {
  14993. $this->watch2 = $to;
  14994. }
  14995. }
  14996. }
  14997. <?php declare(strict_types=1);
  14998. namespace Composer\DependencyResolver;
  14999. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  15000. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  15001. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  15002. use Composer\IO\IOInterface;
  15003. use Composer\Package\BasePackage;
  15004. class Solver
  15005. {
  15006. private const BRANCH_LITERALS = 0;
  15007. private const BRANCH_LEVEL = 1;
  15008. protected $policy;
  15009. protected $pool;
  15010. protected $rules;
  15011. protected $watchGraph;
  15012. protected $decisions;
  15013. protected $fixedMap;
  15014. protected $propagateIndex;
  15015. protected $branches = [];
  15016. protected $problems = [];
  15017. protected $learnedPool = [];
  15018. protected $learnedWhy = [];
  15019. public $testFlagLearnedPositiveLiteral = false;
  15020. protected $io;
  15021. public function __construct(PolicyInterface $policy, Pool $pool, IOInterface $io)
  15022. {
  15023. $this->io = $io;
  15024. $this->policy = $policy;
  15025. $this->pool = $pool;
  15026. }
  15027. public function getRuleSetSize(): int
  15028. {
  15029. return \count($this->rules);
  15030. }
  15031. public function getPool(): Pool
  15032. {
  15033. return $this->pool;
  15034. }
  15035. private function makeAssertionRuleDecisions(): void
  15036. {
  15037. $decisionStart = \count($this->decisions) - 1;
  15038. $rulesCount = \count($this->rules);
  15039. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  15040. $rule = $this->rules->ruleById[$ruleIndex];
  15041. if (!$rule->isAssertion() || $rule->isDisabled()) {
  15042. continue;
  15043. }
  15044. $literals = $rule->getLiterals();
  15045. $literal = $literals[0];
  15046. if (!$this->decisions->decided($literal)) {
  15047. $this->decisions->decide($literal, 1, $rule);
  15048. continue;
  15049. }
  15050. if ($this->decisions->satisfy($literal)) {
  15051. continue;
  15052. }
  15053. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  15054. $rule->disable();
  15055. continue;
  15056. }
  15057. $conflict = $this->decisions->decisionRule($literal);
  15058. if (RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  15059. $problem = new Problem();
  15060. $problem->addRule($rule);
  15061. $problem->addRule($conflict);
  15062. $rule->disable();
  15063. $this->problems[] = $problem;
  15064. continue;
  15065. }
  15066. $problem = new Problem();
  15067. $problem->addRule($rule);
  15068. $problem->addRule($conflict);
  15069. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_REQUEST) as $assertRule) {
  15070. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  15071. continue;
  15072. }
  15073. $assertRuleLiterals = $assertRule->getLiterals();
  15074. $assertRuleLiteral = $assertRuleLiterals[0];
  15075. if (abs($literal) !== abs($assertRuleLiteral)) {
  15076. continue;
  15077. }
  15078. $problem->addRule($assertRule);
  15079. $assertRule->disable();
  15080. }
  15081. $this->problems[] = $problem;
  15082. $this->decisions->resetToOffset($decisionStart);
  15083. $ruleIndex = -1;
  15084. }
  15085. }
  15086. protected function setupFixedMap(Request $request): void
  15087. {
  15088. $this->fixedMap = [];
  15089. foreach ($request->getFixedPackages() as $package) {
  15090. $this->fixedMap[$package->id] = $package;
  15091. }
  15092. }
  15093. protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
  15094. {
  15095. foreach ($request->getRequires() as $packageName => $constraint) {
  15096. if ($platformRequirementFilter->isIgnored($packageName)) {
  15097. continue;
  15098. } elseif ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  15099. $constraint = $platformRequirementFilter->filterConstraint($packageName, $constraint);
  15100. }
  15101. if (0 === \count($this->pool->whatProvides($packageName, $constraint))) {
  15102. $problem = new Problem();
  15103. $problem->addRule(new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => $packageName, 'constraint' => $constraint]));
  15104. $this->problems[] = $problem;
  15105. }
  15106. }
  15107. }
  15108. public function solve(Request $request, ?PlatformRequirementFilterInterface $platformRequirementFilter = null): LockTransaction
  15109. {
  15110. $platformRequirementFilter = $platformRequirementFilter ?? PlatformRequirementFilterFactory::ignoreNothing();
  15111. $this->setupFixedMap($request);
  15112. $this->io->writeError('Generating rules', true, IOInterface::DEBUG);
  15113. $ruleSetGenerator = new RuleSetGenerator($this->policy, $this->pool);
  15114. $this->rules = $ruleSetGenerator->getRulesFor($request, $platformRequirementFilter);
  15115. unset($ruleSetGenerator);
  15116. $this->checkForRootRequireProblems($request, $platformRequirementFilter);
  15117. $this->decisions = new Decisions($this->pool);
  15118. $this->watchGraph = new RuleWatchGraph;
  15119. foreach ($this->rules as $rule) {
  15120. $this->watchGraph->insert(new RuleWatchNode($rule));
  15121. }
  15122. $this->makeAssertionRuleDecisions();
  15123. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  15124. $before = microtime(true);
  15125. $this->runSat();
  15126. $this->io->writeError('', true, IOInterface::DEBUG);
  15127. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  15128. if (\count($this->problems) > 0) {
  15129. throw new SolverProblemsException($this->problems, $this->learnedPool);
  15130. }
  15131. return new LockTransaction($this->pool, $request->getPresentMap(), $request->getFixedPackagesMap(), $this->decisions);
  15132. }
  15133. protected function propagate(int $level): ?Rule
  15134. {
  15135. while ($this->decisions->validOffset($this->propagateIndex)) {
  15136. $decision = $this->decisions->atOffset($this->propagateIndex);
  15137. $conflict = $this->watchGraph->propagateLiteral(
  15138. $decision[Decisions::DECISION_LITERAL],
  15139. $level,
  15140. $this->decisions
  15141. );
  15142. $this->propagateIndex++;
  15143. if ($conflict !== null) {
  15144. return $conflict;
  15145. }
  15146. }
  15147. return null;
  15148. }
  15149. private function revert(int $level): void
  15150. {
  15151. while (!$this->decisions->isEmpty()) {
  15152. $literal = $this->decisions->lastLiteral();
  15153. if ($this->decisions->undecided($literal)) {
  15154. break;
  15155. }
  15156. $decisionLevel = $this->decisions->decisionLevel($literal);
  15157. if ($decisionLevel <= $level) {
  15158. break;
  15159. }
  15160. $this->decisions->revertLast();
  15161. $this->propagateIndex = \count($this->decisions);
  15162. }
  15163. while (\count($this->branches) > 0 && $this->branches[\count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  15164. array_pop($this->branches);
  15165. }
  15166. }
  15167. private function setPropagateLearn(int $level, int $literal, Rule $rule): int
  15168. {
  15169. $level++;
  15170. $this->decisions->decide($literal, $level, $rule);
  15171. while (true) {
  15172. $rule = $this->propagate($level);
  15173. if (null === $rule) {
  15174. break;
  15175. }
  15176. if ($level === 1) {
  15177. $this->analyzeUnsolvable($rule);
  15178. return 0;
  15179. }
  15180. [$learnLiteral, $newLevel, $newRule, $why] = $this->analyze($level, $rule);
  15181. if ($newLevel <= 0 || $newLevel >= $level) {
  15182. throw new SolverBugException(
  15183. "Trying to revert to invalid level ".$newLevel." from level ".$level."."
  15184. );
  15185. }
  15186. $level = $newLevel;
  15187. $this->revert($level);
  15188. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  15189. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  15190. $ruleNode = new RuleWatchNode($newRule);
  15191. $ruleNode->watch2OnHighest($this->decisions);
  15192. $this->watchGraph->insert($ruleNode);
  15193. $this->decisions->decide($learnLiteral, $level, $newRule);
  15194. }
  15195. return $level;
  15196. }
  15197. private function selectAndInstall(int $level, array $decisionQueue, Rule $rule): int
  15198. {
  15199. $literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());
  15200. $selectedLiteral = array_shift($literals);
  15201. if (\count($literals) > 0) {
  15202. $this->branches[] = [$literals, $level];
  15203. }
  15204. return $this->setPropagateLearn($level, $selectedLiteral, $rule);
  15205. }
  15206. protected function analyze(int $level, Rule $rule): array
  15207. {
  15208. $analyzedRule = $rule;
  15209. $ruleLevel = 1;
  15210. $num = 0;
  15211. $l1num = 0;
  15212. $seen = [];
  15213. $learnedLiteral = null;
  15214. $otherLearnedLiterals = [];
  15215. $decisionId = \count($this->decisions);
  15216. $this->learnedPool[] = [];
  15217. while (true) {
  15218. $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
  15219. foreach ($rule->getLiterals() as $literal) {
  15220. if ($rule instanceof MultiConflictRule && !$this->decisions->decided($literal)) {
  15221. continue;
  15222. }
  15223. if ($this->decisions->satisfy($literal)) {
  15224. continue;
  15225. }
  15226. if (isset($seen[abs($literal)])) {
  15227. continue;
  15228. }
  15229. $seen[abs($literal)] = true;
  15230. $l = $this->decisions->decisionLevel($literal);
  15231. if (1 === $l) {
  15232. $l1num++;
  15233. } elseif ($level === $l) {
  15234. $num++;
  15235. } else {
  15236. $otherLearnedLiterals[] = $literal;
  15237. if ($l > $ruleLevel) {
  15238. $ruleLevel = $l;
  15239. }
  15240. }
  15241. }
  15242. unset($literal);
  15243. $l1retry = true;
  15244. while ($l1retry) {
  15245. $l1retry = false;
  15246. if (0 === $num && 0 === --$l1num) {
  15247. break 2;
  15248. }
  15249. while (true) {
  15250. if ($decisionId <= 0) {
  15251. throw new SolverBugException(
  15252. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  15253. );
  15254. }
  15255. $decisionId--;
  15256. $decision = $this->decisions->atOffset($decisionId);
  15257. $literal = $decision[Decisions::DECISION_LITERAL];
  15258. if (isset($seen[abs($literal)])) {
  15259. break;
  15260. }
  15261. }
  15262. unset($seen[abs($literal)]);
  15263. if (0 !== $num && 0 === --$num) {
  15264. if ($literal < 0) {
  15265. $this->testFlagLearnedPositiveLiteral = true;
  15266. }
  15267. $learnedLiteral = -$literal;
  15268. if (0 === $l1num) {
  15269. break 2;
  15270. }
  15271. foreach ($otherLearnedLiterals as $otherLiteral) {
  15272. unset($seen[abs($otherLiteral)]);
  15273. }
  15274. $l1num++;
  15275. $l1retry = true;
  15276. } else {
  15277. $decision = $this->decisions->atOffset($decisionId);
  15278. $rule = $decision[Decisions::DECISION_REASON];
  15279. if ($rule instanceof MultiConflictRule) {
  15280. foreach ($rule->getLiterals() as $ruleLiteral) {
  15281. if (!isset($seen[abs($ruleLiteral)]) && $this->decisions->satisfy(-$ruleLiteral)) {
  15282. $this->learnedPool[\count($this->learnedPool) - 1][] = $rule;
  15283. $l = $this->decisions->decisionLevel($ruleLiteral);
  15284. if (1 === $l) {
  15285. $l1num++;
  15286. } elseif ($level === $l) {
  15287. $num++;
  15288. } else {
  15289. $otherLearnedLiterals[] = $ruleLiteral;
  15290. if ($l > $ruleLevel) {
  15291. $ruleLevel = $l;
  15292. }
  15293. }
  15294. $seen[abs($ruleLiteral)] = true;
  15295. break;
  15296. }
  15297. }
  15298. $l1retry = true;
  15299. }
  15300. }
  15301. }
  15302. $decision = $this->decisions->atOffset($decisionId);
  15303. $rule = $decision[Decisions::DECISION_REASON];
  15304. }
  15305. $why = \count($this->learnedPool) - 1;
  15306. if (null === $learnedLiteral) {
  15307. throw new SolverBugException(
  15308. "Did not find a learnable literal in analyzed rule $analyzedRule."
  15309. );
  15310. }
  15311. array_unshift($otherLearnedLiterals, $learnedLiteral);
  15312. $newRule = new GenericRule($otherLearnedLiterals, Rule::RULE_LEARNED, $why);
  15313. return [$learnedLiteral, $ruleLevel, $newRule, $why];
  15314. }
  15315. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen): void
  15316. {
  15317. $why = spl_object_hash($conflictRule);
  15318. $ruleSeen[$why] = true;
  15319. if ($conflictRule->getType() === RuleSet::TYPE_LEARNED) {
  15320. $learnedWhy = $this->learnedWhy[$why];
  15321. $problemRules = $this->learnedPool[$learnedWhy];
  15322. foreach ($problemRules as $problemRule) {
  15323. if (!isset($ruleSeen[spl_object_hash($problemRule)])) {
  15324. $this->analyzeUnsolvableRule($problem, $problemRule, $ruleSeen);
  15325. }
  15326. }
  15327. return;
  15328. }
  15329. if ($conflictRule->getType() === RuleSet::TYPE_PACKAGE) {
  15330. return;
  15331. }
  15332. $problem->nextSection();
  15333. $problem->addRule($conflictRule);
  15334. }
  15335. private function analyzeUnsolvable(Rule $conflictRule): void
  15336. {
  15337. $problem = new Problem();
  15338. $problem->addRule($conflictRule);
  15339. $ruleSeen = [];
  15340. $this->analyzeUnsolvableRule($problem, $conflictRule, $ruleSeen);
  15341. $this->problems[] = $problem;
  15342. $seen = [];
  15343. $literals = $conflictRule->getLiterals();
  15344. foreach ($literals as $literal) {
  15345. if ($this->decisions->satisfy($literal)) {
  15346. continue;
  15347. }
  15348. $seen[abs($literal)] = true;
  15349. }
  15350. foreach ($this->decisions as $decision) {
  15351. $decisionLiteral = $decision[Decisions::DECISION_LITERAL];
  15352. if (!isset($seen[abs($decisionLiteral)])) {
  15353. continue;
  15354. }
  15355. $why = $decision[Decisions::DECISION_REASON];
  15356. $problem->addRule($why);
  15357. $this->analyzeUnsolvableRule($problem, $why, $ruleSeen);
  15358. $literals = $why->getLiterals();
  15359. foreach ($literals as $literal) {
  15360. if ($this->decisions->satisfy($literal)) {
  15361. continue;
  15362. }
  15363. $seen[abs($literal)] = true;
  15364. }
  15365. }
  15366. }
  15367. private function runSat(): void
  15368. {
  15369. $this->propagateIndex = 0;
  15370. $level = 1;
  15371. $systemLevel = $level + 1;
  15372. while (true) {
  15373. if (1 === $level) {
  15374. $conflictRule = $this->propagate($level);
  15375. if (null !== $conflictRule) {
  15376. $this->analyzeUnsolvable($conflictRule);
  15377. return;
  15378. }
  15379. }
  15380. if ($level < $systemLevel) {
  15381. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_REQUEST);
  15382. foreach ($iterator as $rule) {
  15383. if ($rule->isEnabled()) {
  15384. $decisionQueue = [];
  15385. $noneSatisfied = true;
  15386. foreach ($rule->getLiterals() as $literal) {
  15387. if ($this->decisions->satisfy($literal)) {
  15388. $noneSatisfied = false;
  15389. break;
  15390. }
  15391. if ($literal > 0 && $this->decisions->undecided($literal)) {
  15392. $decisionQueue[] = $literal;
  15393. }
  15394. }
  15395. if ($noneSatisfied && \count($decisionQueue) > 0) {
  15396. $prunedQueue = [];
  15397. foreach ($decisionQueue as $literal) {
  15398. if (isset($this->fixedMap[abs($literal)])) {
  15399. $prunedQueue[] = $literal;
  15400. }
  15401. }
  15402. if (\count($prunedQueue) > 0) {
  15403. $decisionQueue = $prunedQueue;
  15404. }
  15405. }
  15406. if ($noneSatisfied && \count($decisionQueue) > 0) {
  15407. $oLevel = $level;
  15408. $level = $this->selectAndInstall($level, $decisionQueue, $rule);
  15409. if (0 === $level) {
  15410. return;
  15411. }
  15412. if ($level <= $oLevel) {
  15413. break;
  15414. }
  15415. }
  15416. }
  15417. }
  15418. $systemLevel = $level + 1;
  15419. $iterator->next();
  15420. if ($iterator->valid()) {
  15421. continue;
  15422. }
  15423. }
  15424. if ($level < $systemLevel) {
  15425. $systemLevel = $level;
  15426. }
  15427. $rulesCount = \count($this->rules);
  15428. $pass = 1;
  15429. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  15430. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  15431. if ($i === $rulesCount) {
  15432. if (1 === $pass) {
  15433. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  15434. } else {
  15435. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  15436. }
  15437. $i = 0;
  15438. $pass++;
  15439. }
  15440. $rule = $this->rules->ruleById[$i];
  15441. $literals = $rule->getLiterals();
  15442. if ($rule->isDisabled()) {
  15443. continue;
  15444. }
  15445. $decisionQueue = [];
  15446. foreach ($literals as $literal) {
  15447. if ($literal <= 0) {
  15448. if (!$this->decisions->decidedInstall($literal)) {
  15449. continue 2;
  15450. }
  15451. } else {
  15452. if ($this->decisions->decidedInstall($literal)) {
  15453. continue 2;
  15454. }
  15455. if ($this->decisions->undecided($literal)) {
  15456. $decisionQueue[] = $literal;
  15457. }
  15458. }
  15459. }
  15460. if (\count($decisionQueue) < 2) {
  15461. continue;
  15462. }
  15463. $level = $this->selectAndInstall($level, $decisionQueue, $rule);
  15464. if (0 === $level) {
  15465. return;
  15466. }
  15467. $rulesCount = \count($this->rules);
  15468. $n = -1;
  15469. }
  15470. if ($level < $systemLevel) {
  15471. continue;
  15472. }
  15473. if (\count($this->branches) > 0) {
  15474. $lastLiteral = null;
  15475. $lastLevel = null;
  15476. $lastBranchIndex = 0;
  15477. $lastBranchOffset = 0;
  15478. for ($i = \count($this->branches) - 1; $i >= 0; $i--) {
  15479. [$literals, $l] = $this->branches[$i];
  15480. foreach ($literals as $offset => $literal) {
  15481. if ($literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  15482. $lastLiteral = $literal;
  15483. $lastBranchIndex = $i;
  15484. $lastBranchOffset = $offset;
  15485. $lastLevel = $l;
  15486. }
  15487. }
  15488. }
  15489. if ($lastLiteral !== null) {
  15490. assert($lastLevel !== null);
  15491. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  15492. $level = $lastLevel;
  15493. $this->revert($level);
  15494. $why = $this->decisions->lastReason();
  15495. $level = $this->setPropagateLearn($level, $lastLiteral, $why);
  15496. if ($level === 0) {
  15497. return;
  15498. }
  15499. continue;
  15500. }
  15501. }
  15502. break;
  15503. }
  15504. }
  15505. }
  15506. <?php declare(strict_types=1);
  15507. namespace Composer\DependencyResolver;
  15508. class SolverBugException extends \RuntimeException
  15509. {
  15510. public function __construct(string $message)
  15511. {
  15512. parent::__construct(
  15513. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  15514. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
  15515. );
  15516. }
  15517. }
  15518. <?php declare(strict_types=1);
  15519. namespace Composer\DependencyResolver;
  15520. use Composer\Util\IniHelper;
  15521. use Composer\Repository\RepositorySet;
  15522. class SolverProblemsException extends \RuntimeException
  15523. {
  15524. public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
  15525. protected $problems;
  15526. protected $learnedPool;
  15527. public function __construct(array $problems, array $learnedPool)
  15528. {
  15529. $this->problems = $problems;
  15530. $this->learnedPool = $learnedPool;
  15531. parent::__construct('Failed resolving dependencies with '.\count($problems).' problems, call getPrettyString to get formatted details', self::ERROR_DEPENDENCY_RESOLUTION_FAILED);
  15532. }
  15533. public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, bool $isVerbose, bool $isDevExtraction = false): string
  15534. {
  15535. $installedMap = $request->getPresentMap(true);
  15536. $missingExtensions = [];
  15537. $isCausedByLock = false;
  15538. $problems = [];
  15539. foreach ($this->problems as $problem) {
  15540. $problems[] = $problem->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $this->learnedPool)."\n";
  15541. $missingExtensions = array_merge($missingExtensions, $this->getExtensionProblems($problem->getReasons()));
  15542. $isCausedByLock = $isCausedByLock || $problem->isCausedByLock($repositorySet, $request, $pool);
  15543. }
  15544. $i = 1;
  15545. $text = "\n";
  15546. foreach (array_unique($problems) as $problem) {
  15547. $text .= " Problem ".($i++).$problem;
  15548. }
  15549. $hints = [];
  15550. if (!$isDevExtraction && (str_contains($text, 'could not be found') || str_contains($text, 'no matching package found'))) {
  15551. $hints[] = "Potential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  15552. }
  15553. if (\count($missingExtensions) > 0) {
  15554. $hints[] = $this->createExtensionHint($missingExtensions);
  15555. }
  15556. if ($isCausedByLock && !$isDevExtraction && !$request->getUpdateAllowTransitiveRootDependencies()) {
  15557. $hints[] = "Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.";
  15558. }
  15559. if (str_contains($text, 'found composer-plugin-api[2.0.0] but it does not match') && str_contains($text, '- ocramius/package-versions')) {
  15560. $hints[] = "<warning>ocramius/package-versions only provides support for Composer 2 in 1.8+, which requires PHP 7.4.</warning>\nIf you can not upgrade PHP you can require <info>composer/package-versions-deprecated</info> to resolve this with PHP 7.0+.";
  15561. }
  15562. if (!class_exists('PHPUnit\Framework\TestCase', false)) {
  15563. if (str_contains($text, 'found composer-plugin-api[2.0.0] but it does not match')) {
  15564. $hints[] = "You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.";
  15565. }
  15566. }
  15567. if (\count($hints) > 0) {
  15568. $text .= "\n" . implode("\n\n", $hints);
  15569. }
  15570. return $text;
  15571. }
  15572. public function getProblems(): array
  15573. {
  15574. return $this->problems;
  15575. }
  15576. private function createExtensionHint(array $missingExtensions): string
  15577. {
  15578. $paths = IniHelper::getAll();
  15579. if ('' === $paths[0]) {
  15580. if (count($paths) === 1) {
  15581. return '';
  15582. }
  15583. array_shift($paths);
  15584. }
  15585. $ignoreExtensionsArguments = implode(" ", array_map(static function ($extension) {
  15586. return "--ignore-platform-req=$extension";
  15587. }, array_unique($missingExtensions)));
  15588. $text = "To enable extensions, verify that they are enabled in your .ini files:\n - ";
  15589. $text .= implode("\n - ", $paths);
  15590. $text .= "\nYou can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.";
  15591. $text .= "\nAlternatively, you can run Composer with `$ignoreExtensionsArguments` to temporarily ignore these required extensions.";
  15592. return $text;
  15593. }
  15594. private function getExtensionProblems(array $reasonSets): array
  15595. {
  15596. $missingExtensions = [];
  15597. foreach ($reasonSets as $reasonSet) {
  15598. foreach ($reasonSet as $rule) {
  15599. $required = $rule->getRequiredPackage();
  15600. if (null !== $required && 0 === strpos($required, 'ext-')) {
  15601. $missingExtensions[$required] = 1;
  15602. }
  15603. }
  15604. }
  15605. return array_keys($missingExtensions);
  15606. }
  15607. }
  15608. <?php declare(strict_types=1);
  15609. namespace Composer\DependencyResolver;
  15610. use Composer\Package\AliasPackage;
  15611. use Composer\Package\Link;
  15612. use Composer\Package\PackageInterface;
  15613. use Composer\Repository\PlatformRepository;
  15614. use Composer\DependencyResolver\Operation\OperationInterface;
  15615. class Transaction
  15616. {
  15617. protected $operations;
  15618. protected $presentPackages;
  15619. protected $resultPackageMap;
  15620. protected $resultPackagesByName = [];
  15621. public function __construct(array $presentPackages, array $resultPackages)
  15622. {
  15623. $this->presentPackages = $presentPackages;
  15624. $this->setResultPackageMaps($resultPackages);
  15625. $this->operations = $this->calculateOperations();
  15626. }
  15627. public function getOperations(): array
  15628. {
  15629. return $this->operations;
  15630. }
  15631. private function setResultPackageMaps(array $resultPackages): void
  15632. {
  15633. $packageSort = static function (PackageInterface $a, PackageInterface $b): int {
  15634. if ($a->getName() === $b->getName()) {
  15635. if ($a instanceof AliasPackage !== $b instanceof AliasPackage) {
  15636. return $a instanceof AliasPackage ? -1 : 1;
  15637. }
  15638. return strcmp($b->getVersion(), $a->getVersion());
  15639. }
  15640. return strcmp($b->getName(), $a->getName());
  15641. };
  15642. $this->resultPackageMap = [];
  15643. foreach ($resultPackages as $package) {
  15644. $this->resultPackageMap[spl_object_hash($package)] = $package;
  15645. foreach ($package->getNames() as $name) {
  15646. $this->resultPackagesByName[$name][] = $package;
  15647. }
  15648. }
  15649. uasort($this->resultPackageMap, $packageSort);
  15650. foreach ($this->resultPackagesByName as $name => $packages) {
  15651. uasort($this->resultPackagesByName[$name], $packageSort);
  15652. }
  15653. }
  15654. protected function calculateOperations(): array
  15655. {
  15656. $operations = [];
  15657. $presentPackageMap = [];
  15658. $removeMap = [];
  15659. $presentAliasMap = [];
  15660. $removeAliasMap = [];
  15661. foreach ($this->presentPackages as $package) {
  15662. if ($package instanceof AliasPackage) {
  15663. $presentAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
  15664. $removeAliasMap[$package->getName().'::'.$package->getVersion()] = $package;
  15665. } else {
  15666. $presentPackageMap[$package->getName()] = $package;
  15667. $removeMap[$package->getName()] = $package;
  15668. }
  15669. }
  15670. $stack = $this->getRootPackages();
  15671. $visited = [];
  15672. $processed = [];
  15673. while (\count($stack) > 0) {
  15674. $package = array_pop($stack);
  15675. if (isset($processed[spl_object_hash($package)])) {
  15676. continue;
  15677. }
  15678. if (!isset($visited[spl_object_hash($package)])) {
  15679. $visited[spl_object_hash($package)] = true;
  15680. $stack[] = $package;
  15681. if ($package instanceof AliasPackage) {
  15682. $stack[] = $package->getAliasOf();
  15683. } else {
  15684. foreach ($package->getRequires() as $link) {
  15685. $possibleRequires = $this->getProvidersInResult($link);
  15686. foreach ($possibleRequires as $require) {
  15687. $stack[] = $require;
  15688. }
  15689. }
  15690. }
  15691. } elseif (!isset($processed[spl_object_hash($package)])) {
  15692. $processed[spl_object_hash($package)] = true;
  15693. if ($package instanceof AliasPackage) {
  15694. $aliasKey = $package->getName().'::'.$package->getVersion();
  15695. if (isset($presentAliasMap[$aliasKey])) {
  15696. unset($removeAliasMap[$aliasKey]);
  15697. } else {
  15698. $operations[] = new Operation\MarkAliasInstalledOperation($package);
  15699. }
  15700. } else {
  15701. if (isset($presentPackageMap[$package->getName()])) {
  15702. $source = $presentPackageMap[$package->getName()];
  15703. if ($package->getVersion() !== $presentPackageMap[$package->getName()]->getVersion() ||
  15704. $package->getDistReference() !== $presentPackageMap[$package->getName()]->getDistReference() ||
  15705. $package->getSourceReference() !== $presentPackageMap[$package->getName()]->getSourceReference()
  15706. ) {
  15707. $operations[] = new Operation\UpdateOperation($source, $package);
  15708. }
  15709. unset($removeMap[$package->getName()]);
  15710. } else {
  15711. $operations[] = new Operation\InstallOperation($package);
  15712. unset($removeMap[$package->getName()]);
  15713. }
  15714. }
  15715. }
  15716. }
  15717. foreach ($removeMap as $name => $package) {
  15718. array_unshift($operations, new Operation\UninstallOperation($package));
  15719. }
  15720. foreach ($removeAliasMap as $nameVersion => $package) {
  15721. $operations[] = new Operation\MarkAliasUninstalledOperation($package);
  15722. }
  15723. $operations = $this->movePluginsToFront($operations);
  15724. $operations = $this->moveUninstallsToFront($operations);
  15725. return $this->operations = $operations;
  15726. }
  15727. protected function getRootPackages(): array
  15728. {
  15729. $roots = $this->resultPackageMap;
  15730. foreach ($this->resultPackageMap as $packageHash => $package) {
  15731. if (!isset($roots[$packageHash])) {
  15732. continue;
  15733. }
  15734. foreach ($package->getRequires() as $link) {
  15735. $possibleRequires = $this->getProvidersInResult($link);
  15736. foreach ($possibleRequires as $require) {
  15737. if ($require !== $package) {
  15738. unset($roots[spl_object_hash($require)]);
  15739. }
  15740. }
  15741. }
  15742. }
  15743. return $roots;
  15744. }
  15745. protected function getProvidersInResult(Link $link): array
  15746. {
  15747. if (!isset($this->resultPackagesByName[$link->getTarget()])) {
  15748. return [];
  15749. }
  15750. return $this->resultPackagesByName[$link->getTarget()];
  15751. }
  15752. private function movePluginsToFront(array $operations): array
  15753. {
  15754. $dlModifyingPluginsNoDeps = [];
  15755. $dlModifyingPluginsWithDeps = [];
  15756. $dlModifyingPluginRequires = [];
  15757. $pluginsNoDeps = [];
  15758. $pluginsWithDeps = [];
  15759. $pluginRequires = [];
  15760. foreach (array_reverse($operations, true) as $idx => $op) {
  15761. if ($op instanceof Operation\InstallOperation) {
  15762. $package = $op->getPackage();
  15763. } elseif ($op instanceof Operation\UpdateOperation) {
  15764. $package = $op->getTargetPackage();
  15765. } else {
  15766. continue;
  15767. }
  15768. $extra = $package->getExtra();
  15769. $isDownloadsModifyingPlugin = $package->getType() === 'composer-plugin' && isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true;
  15770. if ($isDownloadsModifyingPlugin || \count(array_intersect($package->getNames(), $dlModifyingPluginRequires)) > 0) {
  15771. $requires = array_filter(array_keys($package->getRequires()), static function ($req): bool {
  15772. return !PlatformRepository::isPlatformPackage($req);
  15773. });
  15774. if ($isDownloadsModifyingPlugin && 0 === \count($requires)) {
  15775. array_unshift($dlModifyingPluginsNoDeps, $op);
  15776. } else {
  15777. $dlModifyingPluginRequires = array_merge($dlModifyingPluginRequires, $requires);
  15778. array_unshift($dlModifyingPluginsWithDeps, $op);
  15779. }
  15780. unset($operations[$idx]);
  15781. continue;
  15782. }
  15783. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  15784. if ($isPlugin || \count(array_intersect($package->getNames(), $pluginRequires)) > 0) {
  15785. $requires = array_filter(array_keys($package->getRequires()), static function ($req): bool {
  15786. return !PlatformRepository::isPlatformPackage($req);
  15787. });
  15788. if ($isPlugin && 0 === \count($requires)) {
  15789. array_unshift($pluginsNoDeps, $op);
  15790. } else {
  15791. $pluginRequires = array_merge($pluginRequires, $requires);
  15792. array_unshift($pluginsWithDeps, $op);
  15793. }
  15794. unset($operations[$idx]);
  15795. }
  15796. }
  15797. return array_merge($dlModifyingPluginsNoDeps, $dlModifyingPluginsWithDeps, $pluginsNoDeps, $pluginsWithDeps, $operations);
  15798. }
  15799. private function moveUninstallsToFront(array $operations): array
  15800. {
  15801. $uninstOps = [];
  15802. foreach ($operations as $idx => $op) {
  15803. if ($op instanceof Operation\UninstallOperation || $op instanceof Operation\MarkAliasUninstalledOperation) {
  15804. $uninstOps[] = $op;
  15805. unset($operations[$idx]);
  15806. }
  15807. }
  15808. return array_merge($uninstOps, $operations);
  15809. }
  15810. }
  15811. <?php declare(strict_types=1);
  15812. namespace Composer\Downloader;
  15813. use Composer\Package\PackageInterface;
  15814. use Composer\Util\Platform;
  15815. use Symfony\Component\Finder\Finder;
  15816. use React\Promise\PromiseInterface;
  15817. use Composer\DependencyResolver\Operation\InstallOperation;
  15818. abstract class ArchiveDownloader extends FileDownloader
  15819. {
  15820. protected $cleanupExecuted = [];
  15821. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  15822. {
  15823. unset($this->cleanupExecuted[$package->getName()]);
  15824. return parent::prepare($type, $package, $path, $prevPackage);
  15825. }
  15826. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  15827. {
  15828. $this->cleanupExecuted[$package->getName()] = true;
  15829. return parent::cleanup($type, $package, $path, $prevPackage);
  15830. }
  15831. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  15832. {
  15833. if ($output) {
  15834. $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
  15835. }
  15836. $vendorDir = $this->config->get('vendor-dir');
  15837. if (false === strpos($this->filesystem->normalizePath($vendorDir), $this->filesystem->normalizePath($path.DIRECTORY_SEPARATOR))) {
  15838. $this->filesystem->emptyDirectory($path);
  15839. }
  15840. do {
  15841. $temporaryDir = $vendorDir.'/composer/'.bin2hex(random_bytes(4));
  15842. } while (is_dir($temporaryDir));
  15843. $this->addCleanupPath($package, $temporaryDir);
  15844. if (!is_dir($path) || realpath($path) !== Platform::getCwd()) {
  15845. $this->addCleanupPath($package, $path);
  15846. }
  15847. $this->filesystem->ensureDirectoryExists($temporaryDir);
  15848. $fileName = $this->getFileName($package, $path);
  15849. $filesystem = $this->filesystem;
  15850. $cleanup = function () use ($path, $filesystem, $temporaryDir, $package) {
  15851. $this->clearLastCacheWrite($package);
  15852. $filesystem->removeDirectory($temporaryDir);
  15853. if (is_dir($path) && realpath($path) !== Platform::getCwd()) {
  15854. $filesystem->removeDirectory($path);
  15855. }
  15856. $this->removeCleanupPath($package, $temporaryDir);
  15857. $realpath = realpath($path);
  15858. if ($realpath !== false) {
  15859. $this->removeCleanupPath($package, $realpath);
  15860. }
  15861. };
  15862. try {
  15863. $promise = $this->extract($package, $fileName, $temporaryDir);
  15864. } catch (\Exception $e) {
  15865. $cleanup();
  15866. throw $e;
  15867. }
  15868. return $promise->then(function () use ($package, $filesystem, $fileName, $temporaryDir, $path): \React\Promise\PromiseInterface {
  15869. if (file_exists($fileName)) {
  15870. $filesystem->unlink($fileName);
  15871. }
  15872. $getFolderContent = static function ($dir): array {
  15873. $finder = Finder::create()
  15874. ->ignoreVCS(false)
  15875. ->ignoreDotFiles(false)
  15876. ->notName('.DS_Store')
  15877. ->depth(0)
  15878. ->in($dir);
  15879. return iterator_to_array($finder);
  15880. };
  15881. $renameRecursively = null;
  15882. $renameRecursively = static function ($from, $to) use ($filesystem, $getFolderContent, $package, &$renameRecursively) {
  15883. $contentDir = $getFolderContent($from);
  15884. foreach ($contentDir as $file) {
  15885. $file = (string) $file;
  15886. if (is_dir($to . '/' . basename($file))) {
  15887. if (!is_dir($file)) {
  15888. throw new \RuntimeException('Installing '.$package.' would lead to overwriting the '.$to.'/'.basename($file).' directory with a file from the package, invalid operation.');
  15889. }
  15890. $renameRecursively($file, $to . '/' . basename($file));
  15891. } else {
  15892. $filesystem->rename($file, $to . '/' . basename($file));
  15893. }
  15894. }
  15895. };
  15896. $renameAsOne = false;
  15897. if (!file_exists($path)) {
  15898. $renameAsOne = true;
  15899. } elseif ($filesystem->isDirEmpty($path)) {
  15900. try {
  15901. if ($filesystem->removeDirectoryPhp($path)) {
  15902. $renameAsOne = true;
  15903. }
  15904. } catch (\RuntimeException $e) {
  15905. }
  15906. }
  15907. $contentDir = $getFolderContent($temporaryDir);
  15908. $singleDirAtTopLevel = 1 === count($contentDir) && is_dir((string) reset($contentDir));
  15909. if ($renameAsOne) {
  15910. if ($singleDirAtTopLevel) {
  15911. $extractedDir = (string) reset($contentDir);
  15912. } else {
  15913. $extractedDir = $temporaryDir;
  15914. }
  15915. $filesystem->rename($extractedDir, $path);
  15916. } else {
  15917. $from = $temporaryDir;
  15918. if ($singleDirAtTopLevel) {
  15919. $from = (string) reset($contentDir);
  15920. }
  15921. $renameRecursively($from, $path);
  15922. }
  15923. $promise = $filesystem->removeDirectoryAsync($temporaryDir);
  15924. return $promise->then(function () use ($package, $path, $temporaryDir) {
  15925. $this->removeCleanupPath($package, $temporaryDir);
  15926. $this->removeCleanupPath($package, $path);
  15927. });
  15928. }, static function ($e) use ($cleanup) {
  15929. $cleanup();
  15930. throw $e;
  15931. });
  15932. }
  15933. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  15934. {
  15935. return ': Extracting archive';
  15936. }
  15937. abstract protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface;
  15938. }
  15939. <?php declare(strict_types=1);
  15940. namespace Composer\Downloader;
  15941. use Composer\Package\PackageInterface;
  15942. interface ChangeReportInterface
  15943. {
  15944. public function getLocalChanges(PackageInterface $package, string $path): ?string;
  15945. }
  15946. <?php declare(strict_types=1);
  15947. namespace Composer\Downloader;
  15948. use Composer\Package\PackageInterface;
  15949. use Composer\IO\IOInterface;
  15950. use Composer\Pcre\Preg;
  15951. use Composer\Util\Filesystem;
  15952. use Composer\Exception\IrrecoverableDownloadException;
  15953. use React\Promise\PromiseInterface;
  15954. class DownloadManager
  15955. {
  15956. private $io;
  15957. private $preferDist = false;
  15958. private $preferSource;
  15959. private $packagePreferences = [];
  15960. private $filesystem;
  15961. private $downloaders = [];
  15962. public function __construct(IOInterface $io, bool $preferSource = false, ?Filesystem $filesystem = null)
  15963. {
  15964. $this->io = $io;
  15965. $this->preferSource = $preferSource;
  15966. $this->filesystem = $filesystem ?: new Filesystem();
  15967. }
  15968. public function setPreferSource(bool $preferSource): self
  15969. {
  15970. $this->preferSource = $preferSource;
  15971. return $this;
  15972. }
  15973. public function setPreferDist(bool $preferDist): self
  15974. {
  15975. $this->preferDist = $preferDist;
  15976. return $this;
  15977. }
  15978. public function setPreferences(array $preferences): self
  15979. {
  15980. $this->packagePreferences = $preferences;
  15981. return $this;
  15982. }
  15983. public function setDownloader(string $type, DownloaderInterface $downloader): self
  15984. {
  15985. $type = strtolower($type);
  15986. $this->downloaders[$type] = $downloader;
  15987. return $this;
  15988. }
  15989. public function getDownloader(string $type): DownloaderInterface
  15990. {
  15991. $type = strtolower($type);
  15992. if (!isset($this->downloaders[$type])) {
  15993. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  15994. }
  15995. return $this->downloaders[$type];
  15996. }
  15997. public function getDownloaderForPackage(PackageInterface $package): ?DownloaderInterface
  15998. {
  15999. $installationSource = $package->getInstallationSource();
  16000. if ('metapackage' === $package->getType()) {
  16001. return null;
  16002. }
  16003. if ('dist' === $installationSource) {
  16004. $downloader = $this->getDownloader($package->getDistType());
  16005. } elseif ('source' === $installationSource) {
  16006. $downloader = $this->getDownloader($package->getSourceType());
  16007. } else {
  16008. throw new \InvalidArgumentException(
  16009. 'Package '.$package.' does not have an installation source set'
  16010. );
  16011. }
  16012. if ($installationSource !== $downloader->getInstallationSource()) {
  16013. throw new \LogicException(sprintf(
  16014. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  16015. get_class($downloader),
  16016. $downloader->getInstallationSource(),
  16017. $installationSource,
  16018. $package
  16019. ));
  16020. }
  16021. return $downloader;
  16022. }
  16023. public function getDownloaderType(DownloaderInterface $downloader): string
  16024. {
  16025. return array_search($downloader, $this->downloaders);
  16026. }
  16027. public function download(PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
  16028. {
  16029. $targetDir = $this->normalizeTargetDir($targetDir);
  16030. $this->filesystem->ensureDirectoryExists(dirname($targetDir));
  16031. $sources = $this->getAvailableSources($package, $prevPackage);
  16032. $io = $this->io;
  16033. $download = function ($retry = false) use (&$sources, $io, $package, $targetDir, &$download, $prevPackage) {
  16034. $source = array_shift($sources);
  16035. if ($retry) {
  16036. $io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  16037. }
  16038. $package->setInstallationSource($source);
  16039. $downloader = $this->getDownloaderForPackage($package);
  16040. if (!$downloader) {
  16041. return \React\Promise\resolve(null);
  16042. }
  16043. $handleError = static function ($e) use ($sources, $source, $package, $io, $download) {
  16044. if ($e instanceof \RuntimeException && !$e instanceof IrrecoverableDownloadException) {
  16045. if (!$sources) {
  16046. throw $e;
  16047. }
  16048. $io->writeError(
  16049. ' <warning>Failed to download '.
  16050. $package->getPrettyName().
  16051. ' from ' . $source . ': '.
  16052. $e->getMessage().'</warning>'
  16053. );
  16054. return $download(true);
  16055. }
  16056. throw $e;
  16057. };
  16058. try {
  16059. $result = $downloader->download($package, $targetDir, $prevPackage);
  16060. } catch (\Exception $e) {
  16061. return $handleError($e);
  16062. }
  16063. $res = $result->then(static function ($res) {
  16064. return $res;
  16065. }, $handleError);
  16066. return $res;
  16067. };
  16068. return $download();
  16069. }
  16070. public function prepare(string $type, PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
  16071. {
  16072. $targetDir = $this->normalizeTargetDir($targetDir);
  16073. $downloader = $this->getDownloaderForPackage($package);
  16074. if ($downloader) {
  16075. return $downloader->prepare($type, $package, $targetDir, $prevPackage);
  16076. }
  16077. return \React\Promise\resolve(null);
  16078. }
  16079. public function install(PackageInterface $package, string $targetDir): PromiseInterface
  16080. {
  16081. $targetDir = $this->normalizeTargetDir($targetDir);
  16082. $downloader = $this->getDownloaderForPackage($package);
  16083. if ($downloader) {
  16084. return $downloader->install($package, $targetDir);
  16085. }
  16086. return \React\Promise\resolve(null);
  16087. }
  16088. public function update(PackageInterface $initial, PackageInterface $target, string $targetDir): PromiseInterface
  16089. {
  16090. $targetDir = $this->normalizeTargetDir($targetDir);
  16091. $downloader = $this->getDownloaderForPackage($target);
  16092. $initialDownloader = $this->getDownloaderForPackage($initial);
  16093. if (!$initialDownloader && !$downloader) {
  16094. return \React\Promise\resolve(null);
  16095. }
  16096. if (!$downloader) {
  16097. return $initialDownloader->remove($initial, $targetDir);
  16098. }
  16099. $initialType = $this->getDownloaderType($initialDownloader);
  16100. $targetType = $this->getDownloaderType($downloader);
  16101. if ($initialType === $targetType) {
  16102. try {
  16103. return $downloader->update($initial, $target, $targetDir);
  16104. } catch (\RuntimeException $e) {
  16105. if (!$this->io->isInteractive()) {
  16106. throw $e;
  16107. }
  16108. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  16109. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ')) {
  16110. throw $e;
  16111. }
  16112. }
  16113. }
  16114. $promise = $initialDownloader->remove($initial, $targetDir);
  16115. return $promise->then(function ($res) use ($target, $targetDir): PromiseInterface {
  16116. return $this->install($target, $targetDir);
  16117. });
  16118. }
  16119. public function remove(PackageInterface $package, string $targetDir): PromiseInterface
  16120. {
  16121. $targetDir = $this->normalizeTargetDir($targetDir);
  16122. $downloader = $this->getDownloaderForPackage($package);
  16123. if ($downloader) {
  16124. return $downloader->remove($package, $targetDir);
  16125. }
  16126. return \React\Promise\resolve(null);
  16127. }
  16128. public function cleanup(string $type, PackageInterface $package, string $targetDir, ?PackageInterface $prevPackage = null): PromiseInterface
  16129. {
  16130. $targetDir = $this->normalizeTargetDir($targetDir);
  16131. $downloader = $this->getDownloaderForPackage($package);
  16132. if ($downloader) {
  16133. return $downloader->cleanup($type, $package, $targetDir, $prevPackage);
  16134. }
  16135. return \React\Promise\resolve(null);
  16136. }
  16137. protected function resolvePackageInstallPreference(PackageInterface $package): string
  16138. {
  16139. foreach ($this->packagePreferences as $pattern => $preference) {
  16140. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  16141. if (Preg::isMatch($pattern, $package->getName())) {
  16142. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  16143. return 'dist';
  16144. }
  16145. return 'source';
  16146. }
  16147. }
  16148. return $package->isDev() ? 'source' : 'dist';
  16149. }
  16150. private function getAvailableSources(PackageInterface $package, ?PackageInterface $prevPackage = null): array
  16151. {
  16152. $sourceType = $package->getSourceType();
  16153. $distType = $package->getDistType();
  16154. $sources = [];
  16155. if ($sourceType) {
  16156. $sources[] = 'source';
  16157. }
  16158. if ($distType) {
  16159. $sources[] = 'dist';
  16160. }
  16161. if (empty($sources)) {
  16162. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  16163. }
  16164. if (
  16165. $prevPackage
  16166. && in_array($prevPackage->getInstallationSource(), $sources, true)
  16167. && !(!$prevPackage->isDev() && $prevPackage->getInstallationSource() === 'dist' && $package->isDev())
  16168. ) {
  16169. $prevSource = $prevPackage->getInstallationSource();
  16170. usort($sources, static function ($a, $b) use ($prevSource): int {
  16171. return $a === $prevSource ? -1 : 1;
  16172. });
  16173. return $sources;
  16174. }
  16175. if (!$this->preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  16176. $sources = array_reverse($sources);
  16177. }
  16178. return $sources;
  16179. }
  16180. private function normalizeTargetDir(string $dir): string
  16181. {
  16182. if ($dir === '\\' || $dir === '/') {
  16183. return $dir;
  16184. }
  16185. return rtrim($dir, '\\/');
  16186. }
  16187. }
  16188. <?php declare(strict_types=1);
  16189. namespace Composer\Downloader;
  16190. use Composer\Package\PackageInterface;
  16191. use React\Promise\PromiseInterface;
  16192. interface DownloaderInterface
  16193. {
  16194. public function getInstallationSource(): string;
  16195. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
  16196. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
  16197. public function install(PackageInterface $package, string $path): PromiseInterface;
  16198. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface;
  16199. public function remove(PackageInterface $package, string $path): PromiseInterface;
  16200. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface;
  16201. }
  16202. <?php declare(strict_types=1);
  16203. namespace Composer\Downloader;
  16204. use Composer\Package\PackageInterface;
  16205. interface DvcsDownloaderInterface
  16206. {
  16207. public function getUnpushedChanges(PackageInterface $package, string $path): ?string;
  16208. }
  16209. <?php declare(strict_types=1);
  16210. namespace Composer\Downloader;
  16211. use Composer\Config;
  16212. use Composer\Cache;
  16213. use Composer\IO\IOInterface;
  16214. use Composer\IO\NullIO;
  16215. use Composer\Exception\IrrecoverableDownloadException;
  16216. use Composer\Package\Comparer\Comparer;
  16217. use Composer\DependencyResolver\Operation\UpdateOperation;
  16218. use Composer\DependencyResolver\Operation\InstallOperation;
  16219. use Composer\DependencyResolver\Operation\UninstallOperation;
  16220. use Composer\Package\PackageInterface;
  16221. use Composer\Plugin\PluginEvents;
  16222. use Composer\Plugin\PostFileDownloadEvent;
  16223. use Composer\Plugin\PreFileDownloadEvent;
  16224. use Composer\EventDispatcher\EventDispatcher;
  16225. use Composer\Util\Filesystem;
  16226. use Composer\Util\Http\Response;
  16227. use Composer\Util\Platform;
  16228. use Composer\Util\Silencer;
  16229. use Composer\Util\HttpDownloader;
  16230. use Composer\Util\Url as UrlUtil;
  16231. use Composer\Util\ProcessExecutor;
  16232. use React\Promise\PromiseInterface;
  16233. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  16234. {
  16235. protected $io;
  16236. protected $config;
  16237. protected $httpDownloader;
  16238. protected $filesystem;
  16239. protected $cache;
  16240. protected $eventDispatcher;
  16241. protected $process;
  16242. public static $downloadMetadata = [];
  16243. public static $responseHeaders = [];
  16244. private $lastCacheWrites = [];
  16245. private $additionalCleanupPaths = [];
  16246. public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null, ?Cache $cache = null, ?Filesystem $filesystem = null, ?ProcessExecutor $process = null)
  16247. {
  16248. $this->io = $io;
  16249. $this->config = $config;
  16250. $this->eventDispatcher = $eventDispatcher;
  16251. $this->httpDownloader = $httpDownloader;
  16252. $this->cache = $cache;
  16253. $this->process = $process ?? new ProcessExecutor($io);
  16254. $this->filesystem = $filesystem ?? new Filesystem($this->process);
  16255. if ($this->cache !== null && $this->cache->gcIsNecessary()) {
  16256. $this->io->writeError('Running cache garbage collection', true, IOInterface::VERY_VERBOSE);
  16257. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  16258. }
  16259. }
  16260. public function getInstallationSource(): string
  16261. {
  16262. return 'dist';
  16263. }
  16264. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  16265. {
  16266. if (null === $package->getDistUrl()) {
  16267. throw new \InvalidArgumentException('The given package is missing url information');
  16268. }
  16269. $cacheKeyGenerator = static function (PackageInterface $package, $key): string {
  16270. $cacheKey = hash('sha1', $key);
  16271. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  16272. };
  16273. $retries = 3;
  16274. $distUrls = $package->getDistUrls();
  16275. $urls = [];
  16276. foreach ($distUrls as $index => $url) {
  16277. $processedUrl = $this->processUrl($package, $url);
  16278. $urls[$index] = [
  16279. 'base' => $url,
  16280. 'processed' => $processedUrl,
  16281. 'cacheKey' => $cacheKeyGenerator($package, $processedUrl),
  16282. ];
  16283. }
  16284. assert(count($urls) > 0);
  16285. $fileName = $this->getFileName($package, $path);
  16286. $this->filesystem->ensureDirectoryExists($path);
  16287. $this->filesystem->ensureDirectoryExists(dirname($fileName));
  16288. $accept = null;
  16289. $reject = null;
  16290. $download = function () use ($output, $cacheKeyGenerator, $package, $fileName, &$urls, &$accept, &$reject) {
  16291. $url = reset($urls);
  16292. $index = key($urls);
  16293. if ($this->eventDispatcher !== null) {
  16294. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $url['processed'], 'package', $package);
  16295. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  16296. if ($preFileDownloadEvent->getCustomCacheKey() !== null) {
  16297. $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getCustomCacheKey());
  16298. } elseif ($preFileDownloadEvent->getProcessedUrl() !== $url['processed']) {
  16299. $url['cacheKey'] = $cacheKeyGenerator($package, $preFileDownloadEvent->getProcessedUrl());
  16300. }
  16301. $url['processed'] = $preFileDownloadEvent->getProcessedUrl();
  16302. }
  16303. $urls[$index] = $url;
  16304. $checksum = $package->getDistSha1Checksum();
  16305. $cacheKey = $url['cacheKey'];
  16306. if ($this->cache !== null && ($checksum === null || $checksum === '' || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  16307. if ($output) {
  16308. $this->io->writeError(" - Loading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) from cache", true, IOInterface::VERY_VERBOSE);
  16309. }
  16310. if (!$this->cache->isReadOnly()) {
  16311. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  16312. }
  16313. $result = \React\Promise\resolve($fileName);
  16314. } else {
  16315. if ($output) {
  16316. $this->io->writeError(" - Downloading <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  16317. }
  16318. $result = $this->httpDownloader->addCopy($url['processed'], $fileName, $package->getTransportOptions())
  16319. ->then($accept, $reject);
  16320. }
  16321. return $result->then(function ($result) use ($fileName, $checksum, $url, $package): string {
  16322. if (null === $result) {
  16323. return $fileName;
  16324. }
  16325. if (!file_exists($fileName)) {
  16326. throw new \UnexpectedValueException($url['base'].' could not be saved to '.$fileName.', make sure the'
  16327. .' directory is writable and you have internet connectivity');
  16328. }
  16329. if ($checksum !== null && $checksum !== '' && hash_file('sha1', $fileName) !== $checksum) {
  16330. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url['base'].')');
  16331. }
  16332. if ($this->eventDispatcher !== null) {
  16333. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, $fileName, $checksum, $url['processed'], 'package', $package);
  16334. $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  16335. }
  16336. return $fileName;
  16337. });
  16338. };
  16339. $accept = function (Response $response) use ($package, $fileName, &$urls): string {
  16340. $url = reset($urls);
  16341. $cacheKey = $url['cacheKey'];
  16342. $fileSize = @filesize($fileName);
  16343. if (false === $fileSize) {
  16344. $fileSize = $response->getHeader('Content-Length') ?? '?';
  16345. }
  16346. FileDownloader::$downloadMetadata[$package->getName()] = $fileSize;
  16347. if (Platform::getEnv('GITHUB_ACTIONS') !== false && Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') === false) {
  16348. FileDownloader::$responseHeaders[$package->getName()] = $response->getHeaders();
  16349. }
  16350. if ($this->cache !== null && !$this->cache->isReadOnly()) {
  16351. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  16352. $this->cache->copyFrom($cacheKey, $fileName);
  16353. }
  16354. $response->collect();
  16355. return $fileName;
  16356. };
  16357. $reject = function ($e) use (&$urls, $download, $fileName, $package, &$retries) {
  16358. if (file_exists($fileName)) {
  16359. $this->filesystem->unlink($fileName);
  16360. }
  16361. $this->clearLastCacheWrite($package);
  16362. if ($e instanceof IrrecoverableDownloadException) {
  16363. throw $e;
  16364. }
  16365. if ($e instanceof MaxFileSizeExceededException) {
  16366. throw $e;
  16367. }
  16368. if ($e instanceof TransportException) {
  16369. if (0 !== $e->getCode() && !in_array($e->getCode(), [500, 502, 503, 504], true)) {
  16370. $retries = 0;
  16371. }
  16372. }
  16373. if ($e instanceof TransportException && $e->getStatusCode() === 499) {
  16374. $retries = 0;
  16375. $urls = [];
  16376. }
  16377. if ($retries > 0) {
  16378. usleep(500000);
  16379. $retries--;
  16380. return $download();
  16381. }
  16382. array_shift($urls);
  16383. if (\count($urls) > 0) {
  16384. if ($this->io->isDebug()) {
  16385. $this->io->writeError(' Failed downloading '.$package->getName().': ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  16386. $this->io->writeError(' Trying the next URL for '.$package->getName());
  16387. } else {
  16388. $this->io->writeError(' Failed downloading '.$package->getName().', trying the next URL ('.$e->getCode().': '.$e->getMessage().')');
  16389. }
  16390. $retries = 3;
  16391. usleep(100000);
  16392. return $download();
  16393. }
  16394. throw $e;
  16395. };
  16396. return $download();
  16397. }
  16398. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  16399. {
  16400. return \React\Promise\resolve(null);
  16401. }
  16402. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  16403. {
  16404. $fileName = $this->getFileName($package, $path);
  16405. if (file_exists($fileName)) {
  16406. $this->filesystem->unlink($fileName);
  16407. }
  16408. $dirsToCleanUp = [
  16409. $path,
  16410. $this->config->get('vendor-dir').'/'.explode('/', $package->getPrettyName())[0],
  16411. $this->config->get('vendor-dir').'/composer/',
  16412. $this->config->get('vendor-dir'),
  16413. ];
  16414. if (isset($this->additionalCleanupPaths[$package->getName()])) {
  16415. foreach ($this->additionalCleanupPaths[$package->getName()] as $pathToClean) {
  16416. $this->filesystem->remove($pathToClean);
  16417. }
  16418. }
  16419. foreach ($dirsToCleanUp as $dir) {
  16420. if (is_dir($dir) && $this->filesystem->isDirEmpty($dir) && realpath($dir) !== Platform::getCwd()) {
  16421. $this->filesystem->removeDirectoryPhp($dir);
  16422. }
  16423. }
  16424. return \React\Promise\resolve(null);
  16425. }
  16426. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  16427. {
  16428. if ($output) {
  16429. $this->io->writeError(" - " . InstallOperation::format($package));
  16430. }
  16431. $vendorDir = $this->config->get('vendor-dir');
  16432. if (false === strpos($this->filesystem->normalizePath($vendorDir), $this->filesystem->normalizePath($path.DIRECTORY_SEPARATOR))) {
  16433. $this->filesystem->emptyDirectory($path);
  16434. }
  16435. $this->filesystem->ensureDirectoryExists($path);
  16436. $this->filesystem->rename($this->getFileName($package, $path), $path . '/' . $this->getDistPath($package, PATHINFO_BASENAME));
  16437. foreach ($package->getBinaries() as $bin) {
  16438. if (file_exists($path . '/' . $bin) && !is_executable($path . '/' . $bin)) {
  16439. Silencer::call('chmod', $path . '/' . $bin, 0777 & ~umask());
  16440. }
  16441. }
  16442. return \React\Promise\resolve(null);
  16443. }
  16444. protected function getDistPath(PackageInterface $package, int $component): string
  16445. {
  16446. return pathinfo((string) parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), $component);
  16447. }
  16448. protected function clearLastCacheWrite(PackageInterface $package): void
  16449. {
  16450. if ($this->cache !== null && isset($this->lastCacheWrites[$package->getName()])) {
  16451. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  16452. unset($this->lastCacheWrites[$package->getName()]);
  16453. }
  16454. }
  16455. protected function addCleanupPath(PackageInterface $package, string $path): void
  16456. {
  16457. $this->additionalCleanupPaths[$package->getName()][] = $path;
  16458. }
  16459. protected function removeCleanupPath(PackageInterface $package, string $path): void
  16460. {
  16461. if (isset($this->additionalCleanupPaths[$package->getName()])) {
  16462. $idx = array_search($path, $this->additionalCleanupPaths[$package->getName()], true);
  16463. if (false !== $idx) {
  16464. unset($this->additionalCleanupPaths[$package->getName()][$idx]);
  16465. }
  16466. }
  16467. }
  16468. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
  16469. {
  16470. $this->io->writeError(" - " . UpdateOperation::format($initial, $target) . $this->getInstallOperationAppendix($target, $path));
  16471. $promise = $this->remove($initial, $path, false);
  16472. return $promise->then(function () use ($target, $path): PromiseInterface {
  16473. return $this->install($target, $path, false);
  16474. });
  16475. }
  16476. public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  16477. {
  16478. if ($output) {
  16479. $this->io->writeError(" - " . UninstallOperation::format($package));
  16480. }
  16481. $promise = $this->filesystem->removeDirectoryAsync($path);
  16482. return $promise->then(static function ($result) use ($path): void {
  16483. if (!$result) {
  16484. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  16485. }
  16486. });
  16487. }
  16488. protected function getFileName(PackageInterface $package, string $path): string
  16489. {
  16490. $extension = $this->getDistPath($package, PATHINFO_EXTENSION);
  16491. if ($extension === '') {
  16492. $extension = $package->getDistType();
  16493. }
  16494. return rtrim($this->config->get('vendor-dir') . '/composer/tmp-' . hash('md5', $package . spl_object_hash($package)) . '.' . $extension, '.');
  16495. }
  16496. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  16497. {
  16498. return '';
  16499. }
  16500. protected function processUrl(PackageInterface $package, string $url): string
  16501. {
  16502. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  16503. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  16504. }
  16505. if ($package->getDistReference() !== null) {
  16506. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  16507. }
  16508. return $url;
  16509. }
  16510. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16511. {
  16512. $prevIO = $this->io;
  16513. $this->io = new NullIO;
  16514. $this->io->loadConfiguration($this->config);
  16515. $e = null;
  16516. $output = '';
  16517. $targetDir = Filesystem::trimTrailingSlash($path);
  16518. try {
  16519. if (is_dir($targetDir.'_compare')) {
  16520. $this->filesystem->removeDirectory($targetDir.'_compare');
  16521. }
  16522. $promise = $this->download($package, $targetDir.'_compare', null, false);
  16523. $promise->then(null, function ($ex) use (&$e) {
  16524. $e = $ex;
  16525. });
  16526. $this->httpDownloader->wait();
  16527. if ($e !== null) {
  16528. throw $e;
  16529. }
  16530. $promise = $this->install($package, $targetDir.'_compare', false);
  16531. $promise->then(null, function ($ex) use (&$e) {
  16532. $e = $ex;
  16533. });
  16534. $this->process->wait();
  16535. if ($e !== null) {
  16536. throw $e;
  16537. }
  16538. $comparer = new Comparer();
  16539. $comparer->setSource($targetDir.'_compare');
  16540. $comparer->setUpdate($targetDir);
  16541. $comparer->doCompare();
  16542. $output = $comparer->getChangedAsString(true);
  16543. $this->filesystem->removeDirectory($targetDir.'_compare');
  16544. } catch (\Exception $e) {
  16545. }
  16546. $this->io = $prevIO;
  16547. if ($e !== null) {
  16548. if ($this->io->isDebug()) {
  16549. throw $e;
  16550. }
  16551. return 'Failed to detect changes: ['.get_class($e).'] '.$e->getMessage();
  16552. }
  16553. $output = trim($output);
  16554. return strlen($output) > 0 ? $output : null;
  16555. }
  16556. }
  16557. <?php declare(strict_types=1);
  16558. namespace Composer\Downloader;
  16559. class FilesystemException extends \Exception
  16560. {
  16561. public function __construct(string $message = '', int $code = 0, ?\Exception $previous = null)
  16562. {
  16563. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  16564. }
  16565. }
  16566. <?php declare(strict_types=1);
  16567. namespace Composer\Downloader;
  16568. use Composer\Util\Platform;
  16569. use React\Promise\PromiseInterface;
  16570. use Composer\Package\PackageInterface;
  16571. use Composer\Pcre\Preg;
  16572. use Composer\Util\ProcessExecutor;
  16573. use RuntimeException;
  16574. class FossilDownloader extends VcsDownloader
  16575. {
  16576. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  16577. {
  16578. return \React\Promise\resolve(null);
  16579. }
  16580. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  16581. {
  16582. $this->config->prohibitUrlByConfig($url, $this->io);
  16583. $repoFile = $path . '.fossil';
  16584. $realPath = Platform::realpath($path);
  16585. $this->io->writeError("Cloning ".$package->getSourceReference());
  16586. $this->execute(['fossil', 'clone', '--', $url, $repoFile]);
  16587. $this->execute(['fossil', 'open', '--nested', '--', $repoFile], $realPath);
  16588. $this->execute(['fossil', 'update', '--', (string) $package->getSourceReference()], $realPath);
  16589. return \React\Promise\resolve(null);
  16590. }
  16591. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  16592. {
  16593. $this->config->prohibitUrlByConfig($url, $this->io);
  16594. $this->io->writeError(" Updating to ".$target->getSourceReference());
  16595. if (!$this->hasMetadataRepository($path)) {
  16596. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  16597. }
  16598. $realPath = Platform::realpath($path);
  16599. $this->execute(['fossil', 'pull'], $realPath);
  16600. $this->execute(['fossil', 'up', (string) $target->getSourceReference()], $realPath);
  16601. return \React\Promise\resolve(null);
  16602. }
  16603. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16604. {
  16605. if (!$this->hasMetadataRepository($path)) {
  16606. return null;
  16607. }
  16608. $this->process->execute(['fossil', 'changes'], $output, Platform::realpath($path));
  16609. $output = trim($output);
  16610. return strlen($output) > 0 ? $output : null;
  16611. }
  16612. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  16613. {
  16614. $this->execute(['fossil', 'timeline', '-t', 'ci', '-W', '0', '-n', '0', 'before', $toReference], Platform::realpath($path), $output);
  16615. $log = '';
  16616. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  16617. foreach ($this->process->splitLines($output) as $line) {
  16618. if (Preg::isMatch($match, $line)) {
  16619. break;
  16620. }
  16621. $log .= $line;
  16622. }
  16623. return $log;
  16624. }
  16625. private function execute(array $command, ?string $cwd = null, ?string &$output = null): void
  16626. {
  16627. if (0 !== $this->process->execute($command, $output, $cwd)) {
  16628. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  16629. }
  16630. }
  16631. protected function hasMetadataRepository(string $path): bool
  16632. {
  16633. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  16634. }
  16635. }
  16636. <?php declare(strict_types=1);
  16637. namespace Composer\Downloader;
  16638. use Composer\Config;
  16639. use Composer\IO\IOInterface;
  16640. use Composer\Package\PackageInterface;
  16641. use Composer\Pcre\Preg;
  16642. use Composer\Util\Filesystem;
  16643. use Composer\Util\Git as GitUtil;
  16644. use Composer\Util\Url;
  16645. use Composer\Util\Platform;
  16646. use Composer\Util\ProcessExecutor;
  16647. use Composer\Cache;
  16648. use React\Promise\PromiseInterface;
  16649. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  16650. {
  16651. private $hasStashedChanges = [];
  16652. private $hasDiscardedChanges = [];
  16653. private $gitUtil;
  16654. private $cachedPackages = [];
  16655. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?Filesystem $fs = null)
  16656. {
  16657. parent::__construct($io, $config, $process, $fs);
  16658. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  16659. }
  16660. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  16661. {
  16662. if (Filesystem::isLocalPath($url)) {
  16663. return \React\Promise\resolve(null);
  16664. }
  16665. GitUtil::cleanEnv();
  16666. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($url)).'/';
  16667. $gitVersion = GitUtil::getVersion($this->process);
  16668. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  16669. $this->io->writeError(" - Syncing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>) into cache");
  16670. $this->io->writeError(sprintf(' Cloning to cache at %s', $cachePath), true, IOInterface::DEBUG);
  16671. $ref = $package->getSourceReference();
  16672. if ($this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref, $package->getPrettyVersion()) && is_dir($cachePath)) {
  16673. $this->cachedPackages[$package->getId()][$ref] = true;
  16674. }
  16675. } elseif (null === $gitVersion) {
  16676. throw new \RuntimeException('git was not found in your PATH, skipping source download');
  16677. }
  16678. return \React\Promise\resolve(null);
  16679. }
  16680. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  16681. {
  16682. GitUtil::cleanEnv();
  16683. $path = $this->normalizePath($path);
  16684. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($url)).'/';
  16685. $ref = $package->getSourceReference();
  16686. if (!empty($this->cachedPackages[$package->getId()][$ref])) {
  16687. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  16688. $cloneFlags = ['--dissociate', '--reference', $cachePath];
  16689. $transportOptions = $package->getTransportOptions();
  16690. if (isset($transportOptions['git']['single_use_clone']) && $transportOptions['git']['single_use_clone']) {
  16691. $cloneFlags = [];
  16692. }
  16693. $commands = [
  16694. array_merge(['git', 'clone', '--no-checkout', $cachePath, $path], $cloneFlags),
  16695. ['git', 'remote', 'set-url', 'origin', '--', '%sanitizedUrl%'],
  16696. ['git', 'remote', 'add', 'composer', '--', '%sanitizedUrl%'],
  16697. ];
  16698. } else {
  16699. $msg = "Cloning ".$this->getShortHash($ref);
  16700. $commands = [
  16701. array_merge(['git', 'clone', '--no-checkout', '--', '%url%', $path]),
  16702. ['git', 'remote', 'add', 'composer', '--', '%url%'],
  16703. ['git', 'fetch', 'composer'],
  16704. ['git', 'remote', 'set-url', 'origin', '--', '%sanitizedUrl%'],
  16705. ['git', 'remote', 'set-url', 'composer', '--', '%sanitizedUrl%'],
  16706. ];
  16707. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  16708. throw new \RuntimeException('The required git reference for '.$package->getName().' is not in cache and network is disabled, aborting');
  16709. }
  16710. }
  16711. $this->io->writeError($msg);
  16712. $this->gitUtil->runCommands($commands, $url, $path, true);
  16713. $sourceUrl = $package->getSourceUrl();
  16714. if ($url !== $sourceUrl && $sourceUrl !== null) {
  16715. $this->updateOriginUrl($path, $sourceUrl);
  16716. } else {
  16717. $this->setPushUrl($path, $url);
  16718. }
  16719. if ($newRef = $this->updateToCommit($package, $path, (string) $ref, $package->getPrettyVersion())) {
  16720. if ($package->getDistReference() === $package->getSourceReference()) {
  16721. $package->setDistReference($newRef);
  16722. }
  16723. $package->setSourceReference($newRef);
  16724. }
  16725. return \React\Promise\resolve(null);
  16726. }
  16727. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  16728. {
  16729. GitUtil::cleanEnv();
  16730. $path = $this->normalizePath($path);
  16731. if (!$this->hasMetadataRepository($path)) {
  16732. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  16733. }
  16734. $cachePath = $this->config->get('cache-vcs-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($url)).'/';
  16735. $ref = $target->getSourceReference();
  16736. if (!empty($this->cachedPackages[$target->getId()][$ref])) {
  16737. $msg = "Checking out ".$this->getShortHash($ref).' from cache';
  16738. $remoteUrl = $cachePath;
  16739. } else {
  16740. $msg = "Checking out ".$this->getShortHash($ref);
  16741. $remoteUrl = '%url%';
  16742. if (Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  16743. throw new \RuntimeException('The required git reference for '.$target->getName().' is not in cache and network is disabled, aborting');
  16744. }
  16745. }
  16746. $this->io->writeError($msg);
  16747. if (0 !== $this->process->execute(['git', 'rev-parse', '--quiet', '--verify', $ref.'^{commit}'], $output, $path)) {
  16748. $commands = [
  16749. ['git', 'remote', 'set-url', 'composer', '--', $remoteUrl],
  16750. ['git', 'fetch', 'composer'],
  16751. ['git', 'fetch', '--tags', 'composer'],
  16752. ];
  16753. $this->gitUtil->runCommands($commands, $url, $path);
  16754. }
  16755. $command = ['git', 'remote', 'set-url', 'composer', '--', '%sanitizedUrl%'];
  16756. $this->gitUtil->runCommands([$command], $url, $path);
  16757. if ($newRef = $this->updateToCommit($target, $path, (string) $ref, $target->getPrettyVersion())) {
  16758. if ($target->getDistReference() === $target->getSourceReference()) {
  16759. $target->setDistReference($newRef);
  16760. }
  16761. $target->setSourceReference($newRef);
  16762. }
  16763. $updateOriginUrl = false;
  16764. if (
  16765. 0 === $this->process->execute(['git', 'remote', '-v'], $output, $path)
  16766. && Preg::isMatch('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  16767. && Preg::isMatch('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  16768. ) {
  16769. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  16770. $updateOriginUrl = true;
  16771. }
  16772. }
  16773. if ($updateOriginUrl && $target->getSourceUrl() !== null) {
  16774. $this->updateOriginUrl($path, $target->getSourceUrl());
  16775. }
  16776. return \React\Promise\resolve(null);
  16777. }
  16778. public function getLocalChanges(PackageInterface $package, string $path): ?string
  16779. {
  16780. GitUtil::cleanEnv();
  16781. if (!$this->hasMetadataRepository($path)) {
  16782. return null;
  16783. }
  16784. $command = ['git', 'status', '--porcelain', '--untracked-files=no'];
  16785. if (0 !== $this->process->execute($command, $output, $path)) {
  16786. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  16787. }
  16788. $output = trim($output);
  16789. return strlen($output) > 0 ? $output : null;
  16790. }
  16791. public function getUnpushedChanges(PackageInterface $package, string $path): ?string
  16792. {
  16793. GitUtil::cleanEnv();
  16794. $path = $this->normalizePath($path);
  16795. if (!$this->hasMetadataRepository($path)) {
  16796. return null;
  16797. }
  16798. $command = ['git', 'show-ref', '--head', '-d'];
  16799. if (0 !== $this->process->execute($command, $output, $path)) {
  16800. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  16801. }
  16802. $refs = trim($output);
  16803. if (!Preg::isMatchStrictGroups('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  16804. return null;
  16805. }
  16806. $headRef = $match[1];
  16807. if (!Preg::isMatchAllStrictGroups('{^'.preg_quote($headRef).' refs/heads/(.+)$}mi', $refs, $matches)) {
  16808. return null;
  16809. }
  16810. $candidateBranches = $matches[1];
  16811. $branch = $candidateBranches[0];
  16812. $unpushedChanges = null;
  16813. $branchNotFoundError = false;
  16814. for ($i = 0; $i <= 1; $i++) {
  16815. $remoteBranches = [];
  16816. foreach ($candidateBranches as $candidate) {
  16817. if (Preg::isMatchAllStrictGroups('{^[a-f0-9]+ refs/remotes/((?:[^/]+)/'.preg_quote($candidate).')$}mi', $refs, $matches)) {
  16818. foreach ($matches[1] as $match) {
  16819. $branch = $candidate;
  16820. $remoteBranches[] = $match;
  16821. }
  16822. break;
  16823. }
  16824. }
  16825. if (count($remoteBranches) === 0) {
  16826. $unpushedChanges = 'Branch ' . $branch . ' could not be found on any remote and appears to be unpushed';
  16827. $branchNotFoundError = true;
  16828. } else {
  16829. if ($branchNotFoundError) {
  16830. $unpushedChanges = null;
  16831. }
  16832. foreach ($remoteBranches as $remoteBranch) {
  16833. $command = ['git', 'diff', '--name-status', $remoteBranch.'...'.$branch, '--'];
  16834. if (0 !== $this->process->execute($command, $output, $path)) {
  16835. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  16836. }
  16837. $output = trim($output);
  16838. if ($unpushedChanges === null || strlen($output) < strlen($unpushedChanges)) {
  16839. $unpushedChanges = $output;
  16840. }
  16841. }
  16842. }
  16843. if ($unpushedChanges && $i === 0) {
  16844. $this->process->execute(['git', 'fetch', '--all'], $output, $path);
  16845. $command = ['git', 'show-ref', '--head', '-d'];
  16846. if (0 !== $this->process->execute($command, $output, $path)) {
  16847. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  16848. }
  16849. $refs = trim($output);
  16850. }
  16851. if (!$unpushedChanges) {
  16852. break;
  16853. }
  16854. }
  16855. return $unpushedChanges;
  16856. }
  16857. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  16858. {
  16859. GitUtil::cleanEnv();
  16860. $path = $this->normalizePath($path);
  16861. $unpushed = $this->getUnpushedChanges($package, $path);
  16862. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  16863. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  16864. }
  16865. if (null === ($changes = $this->getLocalChanges($package, $path))) {
  16866. return \React\Promise\resolve(null);
  16867. }
  16868. if (!$this->io->isInteractive()) {
  16869. $discardChanges = $this->config->get('discard-changes');
  16870. if (true === $discardChanges) {
  16871. return $this->discardChanges($path);
  16872. }
  16873. if ('stash' === $discardChanges) {
  16874. if (!$update) {
  16875. return parent::cleanChanges($package, $path, $update);
  16876. }
  16877. return $this->stashChanges($path);
  16878. }
  16879. return parent::cleanChanges($package, $path, $update);
  16880. }
  16881. $changes = array_map(static function ($elem): string {
  16882. return ' '.$elem;
  16883. }, Preg::split('{\s*\r?\n\s*}', $changes));
  16884. $this->io->writeError(' <error>'.$package->getPrettyName().' has modified files:</error>');
  16885. $this->io->writeError(array_slice($changes, 0, 10));
  16886. if (count($changes) > 10) {
  16887. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  16888. }
  16889. while (true) {
  16890. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  16891. case 'y':
  16892. $this->discardChanges($path);
  16893. break 2;
  16894. case 's':
  16895. if (!$update) {
  16896. goto help;
  16897. }
  16898. $this->stashChanges($path);
  16899. break 2;
  16900. case 'n':
  16901. throw new \RuntimeException('Update aborted');
  16902. case 'v':
  16903. $this->io->writeError($changes);
  16904. break;
  16905. case 'd':
  16906. $this->viewDiff($path);
  16907. break;
  16908. case '?':
  16909. default:
  16910. help :
  16911. $this->io->writeError([
  16912. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  16913. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  16914. ' v - view modified files',
  16915. ' d - view local modifications (diff)',
  16916. ]);
  16917. if ($update) {
  16918. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  16919. }
  16920. $this->io->writeError(' ? - print help');
  16921. break;
  16922. }
  16923. }
  16924. return \React\Promise\resolve(null);
  16925. }
  16926. protected function reapplyChanges(string $path): void
  16927. {
  16928. $path = $this->normalizePath($path);
  16929. if (!empty($this->hasStashedChanges[$path])) {
  16930. unset($this->hasStashedChanges[$path]);
  16931. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  16932. if (0 !== $this->process->execute(['git', 'stash', 'pop'], $output, $path)) {
  16933. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  16934. }
  16935. }
  16936. unset($this->hasDiscardedChanges[$path]);
  16937. }
  16938. protected function updateToCommit(PackageInterface $package, string $path, string $reference, string $prettyVersion): ?string
  16939. {
  16940. $force = !empty($this->hasDiscardedChanges[$path]) || !empty($this->hasStashedChanges[$path]) ? ['-f'] : [];
  16941. $branch = Preg::replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $prettyVersion);
  16942. $execute = function (array $command) use (&$output, $path) {
  16943. $output = '';
  16944. return 0 === $this->process->execute($command, $output, $path);
  16945. };
  16946. $branches = null;
  16947. if ($execute(['git', 'branch', '-r'])) {
  16948. $branches = $output;
  16949. }
  16950. $gitRef = $reference;
  16951. if (!Preg::isMatch('{^[a-f0-9]{40}$}', $reference)
  16952. && null !== $branches
  16953. && Preg::isMatch('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  16954. ) {
  16955. $command1 = array_merge(['git', 'checkout'], $force, ['-B', $branch, 'composer/'.$reference, '--']);
  16956. $command2 = ['git', 'reset', '--hard', 'composer/'.$reference, '--'];
  16957. if ($execute($command1) && $execute($command2)) {
  16958. return null;
  16959. }
  16960. }
  16961. if (Preg::isMatch('{^[a-f0-9]{40}$}', $reference)) {
  16962. if (null !== $branches && !Preg::isMatch('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && Preg::isMatch('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  16963. $branch = 'v' . $branch;
  16964. }
  16965. $command = ['git', 'checkout', $branch, '--'];
  16966. $fallbackCommand = array_merge(['git', 'checkout'], $force, ['-B', $branch, 'composer/'.$branch, '--']);
  16967. $resetCommand = ['git', 'reset', '--hard', $reference, '--'];
  16968. if (($execute($command) || $execute($fallbackCommand)) && $execute($resetCommand)) {
  16969. return null;
  16970. }
  16971. }
  16972. $command1 = array_merge(['git', 'checkout'], $force, [$gitRef, '--']);
  16973. $command2 = ['git', 'reset', '--hard', $gitRef, '--'];
  16974. if ($execute($command1) && $execute($command2)) {
  16975. return null;
  16976. }
  16977. $exceptionExtra = '';
  16978. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  16979. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  16980. $exceptionExtra = "\nIt looks like the commit hash is not available in the repository, maybe ".($package->isDev() ? 'the commit was removed from the branch' : 'the tag was recreated').'? Run "composer update '.$package->getPrettyName().'" to resolve this.';
  16981. }
  16982. $command = implode(' ', $command1). ' && '.implode(' ', $command2);
  16983. throw new \RuntimeException(Url::sanitize('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput() . $exceptionExtra));
  16984. }
  16985. protected function updateOriginUrl(string $path, string $url): void
  16986. {
  16987. $this->process->execute(['git', 'remote', 'set-url', 'origin', '--', $url], $output, $path);
  16988. $this->setPushUrl($path, $url);
  16989. }
  16990. protected function setPushUrl(string $path, string $url): void
  16991. {
  16992. if (Preg::isMatch('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  16993. $protocols = $this->config->get('github-protocols');
  16994. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  16995. if (!in_array('ssh', $protocols, true)) {
  16996. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  16997. }
  16998. $cmd = ['git', 'remote', 'set-url', '--push', 'origin', '--', $pushUrl];
  16999. $this->process->execute($cmd, $ignoredOutput, $path);
  17000. }
  17001. }
  17002. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  17003. {
  17004. $path = $this->normalizePath($path);
  17005. $command = array_merge(['git', 'log', $fromReference.'..'.$toReference, '--pretty=format:%h - %an: %s'], GitUtil::getNoShowSignatureFlags($this->process));
  17006. if (0 !== $this->process->execute($command, $output, $path)) {
  17007. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  17008. }
  17009. return $output;
  17010. }
  17011. protected function discardChanges(string $path): PromiseInterface
  17012. {
  17013. $path = $this->normalizePath($path);
  17014. if (0 !== $this->process->execute(['git', 'clean', '-df'], $output, $path)) {
  17015. throw new \RuntimeException("Could not reset changes\n\n:".$output);
  17016. }
  17017. if (0 !== $this->process->execute(['git', 'reset', '--hard'], $output, $path)) {
  17018. throw new \RuntimeException("Could not reset changes\n\n:".$output);
  17019. }
  17020. $this->hasDiscardedChanges[$path] = true;
  17021. return \React\Promise\resolve(null);
  17022. }
  17023. protected function stashChanges(string $path): PromiseInterface
  17024. {
  17025. $path = $this->normalizePath($path);
  17026. if (0 !== $this->process->execute(['git', 'stash', '--include-untracked'], $output, $path)) {
  17027. throw new \RuntimeException("Could not stash changes\n\n:".$output);
  17028. }
  17029. $this->hasStashedChanges[$path] = true;
  17030. return \React\Promise\resolve(null);
  17031. }
  17032. protected function viewDiff(string $path): void
  17033. {
  17034. $path = $this->normalizePath($path);
  17035. if (0 !== $this->process->execute(['git', 'diff', 'HEAD'], $output, $path)) {
  17036. throw new \RuntimeException("Could not view diff\n\n:".$output);
  17037. }
  17038. $this->io->writeError($output);
  17039. }
  17040. protected function normalizePath(string $path): string
  17041. {
  17042. if (Platform::isWindows() && strlen($path) > 0) {
  17043. $basePath = $path;
  17044. $removed = [];
  17045. while (!is_dir($basePath) && $basePath !== '\\') {
  17046. array_unshift($removed, basename($basePath));
  17047. $basePath = dirname($basePath);
  17048. }
  17049. if ($basePath === '\\') {
  17050. return $path;
  17051. }
  17052. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  17053. }
  17054. return $path;
  17055. }
  17056. protected function hasMetadataRepository(string $path): bool
  17057. {
  17058. $path = $this->normalizePath($path);
  17059. return is_dir($path.'/.git');
  17060. }
  17061. protected function getShortHash(string $reference): string
  17062. {
  17063. if (!$this->io->isVerbose() && Preg::isMatch('{^[0-9a-f]{40}$}', $reference)) {
  17064. return substr($reference, 0, 10);
  17065. }
  17066. return $reference;
  17067. }
  17068. }
  17069. <?php declare(strict_types=1);
  17070. namespace Composer\Downloader;
  17071. use React\Promise\PromiseInterface;
  17072. use Composer\Package\PackageInterface;
  17073. use Composer\Util\Platform;
  17074. use Composer\Util\ProcessExecutor;
  17075. class GzipDownloader extends ArchiveDownloader
  17076. {
  17077. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17078. {
  17079. $filename = pathinfo(parse_url(strtr((string) $package->getDistUrl(), '\\', '/'), PHP_URL_PATH), PATHINFO_FILENAME);
  17080. $targetFilepath = $path . DIRECTORY_SEPARATOR . $filename;
  17081. if (!Platform::isWindows()) {
  17082. $command = ['sh', '-c', 'gzip -cd -- "$0" > "$1"', $file, $targetFilepath];
  17083. if (0 === $this->process->execute($command, $ignoredOutput)) {
  17084. return \React\Promise\resolve(null);
  17085. }
  17086. if (extension_loaded('zlib')) {
  17087. $this->extractUsingExt($file, $targetFilepath);
  17088. return \React\Promise\resolve(null);
  17089. }
  17090. $processError = 'Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput();
  17091. throw new \RuntimeException($processError);
  17092. }
  17093. $this->extractUsingExt($file, $targetFilepath);
  17094. return \React\Promise\resolve(null);
  17095. }
  17096. private function extractUsingExt(string $file, string $targetFilepath): void
  17097. {
  17098. $archiveFile = gzopen($file, 'rb');
  17099. $targetFile = fopen($targetFilepath, 'wb');
  17100. while ($string = gzread($archiveFile, 4096)) {
  17101. fwrite($targetFile, $string, Platform::strlen($string));
  17102. }
  17103. gzclose($archiveFile);
  17104. fclose($targetFile);
  17105. }
  17106. }
  17107. <?php declare(strict_types=1);
  17108. namespace Composer\Downloader;
  17109. use React\Promise\PromiseInterface;
  17110. use Composer\Package\PackageInterface;
  17111. use Composer\Util\ProcessExecutor;
  17112. use Composer\Util\Hg as HgUtils;
  17113. class HgDownloader extends VcsDownloader
  17114. {
  17115. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  17116. {
  17117. if (null === HgUtils::getVersion($this->process)) {
  17118. throw new \RuntimeException('hg was not found in your PATH, skipping source download');
  17119. }
  17120. return \React\Promise\resolve(null);
  17121. }
  17122. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  17123. {
  17124. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  17125. $cloneCommand = static function (string $url) use ($path): array {
  17126. return ['hg', 'clone', '--', $url, $path];
  17127. };
  17128. $hgUtils->runCommand($cloneCommand, $url, $path);
  17129. $command = ['hg', 'up', '--', (string) $package->getSourceReference()];
  17130. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  17131. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  17132. }
  17133. return \React\Promise\resolve(null);
  17134. }
  17135. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  17136. {
  17137. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  17138. $ref = $target->getSourceReference();
  17139. $this->io->writeError(" Updating to ".$target->getSourceReference());
  17140. if (!$this->hasMetadataRepository($path)) {
  17141. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  17142. }
  17143. $command = static function ($url): array {
  17144. return ['hg', 'pull', '--', $url];
  17145. };
  17146. $hgUtils->runCommand($command, $url, $path);
  17147. $command = static function () use ($ref): array {
  17148. return ['hg', 'up', '--', $ref];
  17149. };
  17150. $hgUtils->runCommand($command, $url, $path);
  17151. return \React\Promise\resolve(null);
  17152. }
  17153. public function getLocalChanges(PackageInterface $package, string $path): ?string
  17154. {
  17155. if (!is_dir($path.'/.hg')) {
  17156. return null;
  17157. }
  17158. $this->process->execute(['hg', 'st'], $output, realpath($path));
  17159. $output = trim($output);
  17160. return strlen($output) > 0 ? $output : null;
  17161. }
  17162. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  17163. {
  17164. $command = ['hg', 'log', '-r', $fromReference.':'.$toReference, '--style', 'compact'];
  17165. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  17166. throw new \RuntimeException('Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput());
  17167. }
  17168. return $output;
  17169. }
  17170. protected function hasMetadataRepository(string $path): bool
  17171. {
  17172. return is_dir($path . '/.hg');
  17173. }
  17174. }
  17175. <?php declare(strict_types=1);
  17176. namespace Composer\Downloader;
  17177. class MaxFileSizeExceededException extends TransportException
  17178. {
  17179. }
  17180. <?php declare(strict_types=1);
  17181. namespace Composer\Downloader;
  17182. use React\Promise\PromiseInterface;
  17183. use Composer\Package\Archiver\ArchivableFilesFinder;
  17184. use Composer\Package\Dumper\ArrayDumper;
  17185. use Composer\Package\PackageInterface;
  17186. use Composer\Package\Version\VersionGuesser;
  17187. use Composer\Package\Version\VersionParser;
  17188. use Composer\Util\Platform;
  17189. use Composer\Util\Filesystem;
  17190. use Symfony\Component\Filesystem\Exception\IOException;
  17191. use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
  17192. use Composer\DependencyResolver\Operation\InstallOperation;
  17193. use Composer\DependencyResolver\Operation\UninstallOperation;
  17194. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  17195. {
  17196. private const STRATEGY_SYMLINK = 10;
  17197. private const STRATEGY_MIRROR = 20;
  17198. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  17199. {
  17200. $path = Filesystem::trimTrailingSlash($path);
  17201. $url = $package->getDistUrl();
  17202. if (null === $url) {
  17203. throw new \RuntimeException('The package '.$package->getPrettyName().' has no dist url configured, cannot download.');
  17204. }
  17205. $realUrl = realpath($url);
  17206. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  17207. throw new \RuntimeException(sprintf(
  17208. 'Source path "%s" is not found for package %s',
  17209. $url,
  17210. $package->getName()
  17211. ));
  17212. }
  17213. if (realpath($path) === $realUrl) {
  17214. return \React\Promise\resolve(null);
  17215. }
  17216. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  17217. throw new \RuntimeException(sprintf(
  17218. 'Package %s cannot install to "%s" inside its source at "%s"',
  17219. $package->getName(),
  17220. realpath($path),
  17221. $realUrl
  17222. ));
  17223. }
  17224. return \React\Promise\resolve(null);
  17225. }
  17226. public function install(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  17227. {
  17228. $path = Filesystem::trimTrailingSlash($path);
  17229. $url = $package->getDistUrl();
  17230. if (null === $url) {
  17231. throw new \RuntimeException('The package '.$package->getPrettyName().' has no dist url configured, cannot install.');
  17232. }
  17233. $realUrl = realpath($url);
  17234. if (false === $realUrl) {
  17235. throw new \RuntimeException('Failed to realpath '.$url);
  17236. }
  17237. if (realpath($path) === $realUrl) {
  17238. if ($output) {
  17239. $this->io->writeError(" - " . InstallOperation::format($package) . $this->getInstallOperationAppendix($package, $path));
  17240. }
  17241. return \React\Promise\resolve(null);
  17242. }
  17243. $transportOptions = $package->getTransportOptions() + ['relative' => true];
  17244. [$currentStrategy, $allowedStrategies] = $this->computeAllowedStrategies($transportOptions);
  17245. $symfonyFilesystem = new SymfonyFilesystem();
  17246. $this->filesystem->removeDirectory($path);
  17247. if ($output) {
  17248. $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
  17249. }
  17250. $isFallback = false;
  17251. if (self::STRATEGY_SYMLINK === $currentStrategy) {
  17252. try {
  17253. if (Platform::isWindows()) {
  17254. if ($output) {
  17255. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  17256. }
  17257. $this->filesystem->junction($realUrl, $path);
  17258. } else {
  17259. $path = rtrim($path, "/");
  17260. if ($output) {
  17261. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  17262. }
  17263. if ($transportOptions['relative'] === true) {
  17264. $absolutePath = $path;
  17265. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  17266. $absolutePath = Platform::getCwd() . DIRECTORY_SEPARATOR . $path;
  17267. }
  17268. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl, false, true);
  17269. $symfonyFilesystem->symlink($shortestPath.'/', $path);
  17270. } else {
  17271. $symfonyFilesystem->symlink($realUrl.'/', $path);
  17272. }
  17273. }
  17274. } catch (IOException $e) {
  17275. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  17276. if ($output) {
  17277. $this->io->writeError('');
  17278. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  17279. }
  17280. $currentStrategy = self::STRATEGY_MIRROR;
  17281. $isFallback = true;
  17282. } else {
  17283. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  17284. }
  17285. }
  17286. }
  17287. if (self::STRATEGY_MIRROR === $currentStrategy) {
  17288. $realUrl = $this->filesystem->normalizePath($realUrl);
  17289. if ($output) {
  17290. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  17291. }
  17292. $iterator = new ArchivableFilesFinder($realUrl, []);
  17293. $symfonyFilesystem->mirror($realUrl, $path, $iterator);
  17294. }
  17295. if ($output) {
  17296. $this->io->writeError('');
  17297. }
  17298. return \React\Promise\resolve(null);
  17299. }
  17300. public function remove(PackageInterface $package, string $path, bool $output = true): PromiseInterface
  17301. {
  17302. $path = Filesystem::trimTrailingSlash($path);
  17303. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  17304. if ($output) {
  17305. $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
  17306. }
  17307. if (!$this->filesystem->removeJunction($path)) {
  17308. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  17309. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  17310. }
  17311. return \React\Promise\resolve(null);
  17312. }
  17313. $url = $package->getDistUrl();
  17314. if (null === $url) {
  17315. throw new \RuntimeException('The package '.$package->getPrettyName().' has no dist url configured, cannot remove.');
  17316. }
  17317. $fs = new Filesystem;
  17318. $absPath = $fs->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path;
  17319. $absDistUrl = $fs->isAbsolutePath($url) ? $url : Platform::getCwd() . '/' . $url;
  17320. if ($fs->normalizePath($absPath) === $fs->normalizePath($absDistUrl)) {
  17321. if ($output) {
  17322. $this->io->writeError(" - " . UninstallOperation::format($package).", source is still present in $path");
  17323. }
  17324. return \React\Promise\resolve(null);
  17325. }
  17326. return parent::remove($package, $path, $output);
  17327. }
  17328. public function getVcsReference(PackageInterface $package, string $path): ?string
  17329. {
  17330. $path = Filesystem::trimTrailingSlash($path);
  17331. $parser = new VersionParser;
  17332. $guesser = new VersionGuesser($this->config, $this->process, $parser, $this->io);
  17333. $dumper = new ArrayDumper;
  17334. $packageConfig = $dumper->dump($package);
  17335. $packageVersion = $guesser->guessVersion($packageConfig, $path);
  17336. if ($packageVersion !== null) {
  17337. return $packageVersion['commit'];
  17338. }
  17339. return null;
  17340. }
  17341. protected function getInstallOperationAppendix(PackageInterface $package, string $path): string
  17342. {
  17343. $url = $package->getDistUrl();
  17344. if (null === $url) {
  17345. throw new \RuntimeException('The package '.$package->getPrettyName().' has no dist url configured, cannot install.');
  17346. }
  17347. $realUrl = realpath($url);
  17348. if (false === $realUrl) {
  17349. throw new \RuntimeException('Failed to realpath '.$url);
  17350. }
  17351. if (realpath($path) === $realUrl) {
  17352. return ': Source already present';
  17353. }
  17354. [$currentStrategy] = $this->computeAllowedStrategies($package->getTransportOptions());
  17355. if ($currentStrategy === self::STRATEGY_SYMLINK) {
  17356. if (Platform::isWindows()) {
  17357. return ': Junctioning from '.$package->getDistUrl();
  17358. }
  17359. return ': Symlinking from '.$package->getDistUrl();
  17360. }
  17361. return ': Mirroring from '.$package->getDistUrl();
  17362. }
  17363. private function computeAllowedStrategies(array $transportOptions): array
  17364. {
  17365. $currentStrategy = self::STRATEGY_SYMLINK;
  17366. $allowedStrategies = [self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR];
  17367. $mirrorPathRepos = Platform::getEnv('COMPOSER_MIRROR_PATH_REPOS');
  17368. if ((bool) $mirrorPathRepos) {
  17369. $currentStrategy = self::STRATEGY_MIRROR;
  17370. }
  17371. $symlinkOption = $transportOptions['symlink'] ?? null;
  17372. if (true === $symlinkOption) {
  17373. $currentStrategy = self::STRATEGY_SYMLINK;
  17374. $allowedStrategies = [self::STRATEGY_SYMLINK];
  17375. } elseif (false === $symlinkOption) {
  17376. $currentStrategy = self::STRATEGY_MIRROR;
  17377. $allowedStrategies = [self::STRATEGY_MIRROR];
  17378. }
  17379. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  17380. if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  17381. throw new \RuntimeException('You are on an old Windows / old PHP combo which does not allow Composer to use junctions/symlinks and this path repository has symlink:true in its options so copying is not allowed');
  17382. }
  17383. $currentStrategy = self::STRATEGY_MIRROR;
  17384. $allowedStrategies = [self::STRATEGY_MIRROR];
  17385. }
  17386. if (!Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !function_exists('symlink')) {
  17387. if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
  17388. throw new \RuntimeException('Your PHP has the symlink() function disabled which does not allow Composer to use symlinks and this path repository has symlink:true in its options so copying is not allowed');
  17389. }
  17390. $currentStrategy = self::STRATEGY_MIRROR;
  17391. $allowedStrategies = [self::STRATEGY_MIRROR];
  17392. }
  17393. return [$currentStrategy, $allowedStrategies];
  17394. }
  17395. private function safeJunctions(): bool
  17396. {
  17397. return function_exists('proc_open') &&
  17398. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  17399. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  17400. }
  17401. }
  17402. <?php declare(strict_types=1);
  17403. namespace Composer\Downloader;
  17404. use React\Promise\PromiseInterface;
  17405. use Composer\Package\PackageInterface;
  17406. use Composer\Repository\VcsRepository;
  17407. use Composer\Util\Perforce;
  17408. class PerforceDownloader extends VcsDownloader
  17409. {
  17410. protected $perforce;
  17411. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  17412. {
  17413. return \React\Promise\resolve(null);
  17414. }
  17415. public function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  17416. {
  17417. $ref = $package->getSourceReference();
  17418. $label = $this->getLabelFromSourceReference((string) $ref);
  17419. $this->io->writeError('Cloning ' . $ref);
  17420. $this->initPerforce($package, $path, $url);
  17421. $this->perforce->setStream($ref);
  17422. $this->perforce->p4Login();
  17423. $this->perforce->writeP4ClientSpec();
  17424. $this->perforce->connectClient();
  17425. $this->perforce->syncCodeBase($label);
  17426. $this->perforce->cleanupClientSpec();
  17427. return \React\Promise\resolve(null);
  17428. }
  17429. private function getLabelFromSourceReference(string $ref): ?string
  17430. {
  17431. $pos = strpos($ref, '@');
  17432. if (false !== $pos) {
  17433. return substr($ref, $pos + 1);
  17434. }
  17435. return null;
  17436. }
  17437. public function initPerforce(PackageInterface $package, string $path, string $url): void
  17438. {
  17439. if (!empty($this->perforce)) {
  17440. $this->perforce->initializePath($path);
  17441. return;
  17442. }
  17443. $repository = $package->getRepository();
  17444. $repoConfig = null;
  17445. if ($repository instanceof VcsRepository) {
  17446. $repoConfig = $this->getRepoConfig($repository);
  17447. }
  17448. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  17449. }
  17450. private function getRepoConfig(VcsRepository $repository): array
  17451. {
  17452. return $repository->getRepoConfig();
  17453. }
  17454. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  17455. {
  17456. return $this->doInstall($target, $path, $url);
  17457. }
  17458. public function getLocalChanges(PackageInterface $package, string $path): ?string
  17459. {
  17460. $this->io->writeError('Perforce driver does not check for local changes before overriding');
  17461. return null;
  17462. }
  17463. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  17464. {
  17465. return $this->perforce->getCommitLogs($fromReference, $toReference);
  17466. }
  17467. public function setPerforce(Perforce $perforce): void
  17468. {
  17469. $this->perforce = $perforce;
  17470. }
  17471. protected function hasMetadataRepository(string $path): bool
  17472. {
  17473. return true;
  17474. }
  17475. }
  17476. <?php declare(strict_types=1);
  17477. namespace Composer\Downloader;
  17478. use React\Promise\PromiseInterface;
  17479. use Composer\Package\PackageInterface;
  17480. class PharDownloader extends ArchiveDownloader
  17481. {
  17482. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17483. {
  17484. $archive = new \Phar($file);
  17485. $archive->extractTo($path, null, true);
  17486. return \React\Promise\resolve(null);
  17487. }
  17488. }
  17489. <?php declare(strict_types=1);
  17490. namespace Composer\Downloader;
  17491. use React\Promise\PromiseInterface;
  17492. use Composer\Util\IniHelper;
  17493. use Composer\Util\Platform;
  17494. use Composer\Util\ProcessExecutor;
  17495. use Composer\Package\PackageInterface;
  17496. use RarArchive;
  17497. class RarDownloader extends ArchiveDownloader
  17498. {
  17499. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17500. {
  17501. $processError = null;
  17502. if (!Platform::isWindows()) {
  17503. $command = ['sh', '-c', 'unrar x -- "$0" "$1" >/dev/null && chmod -R u+w "$1"', $file, $path];
  17504. if (0 === $this->process->execute($command, $ignoredOutput)) {
  17505. return \React\Promise\resolve(null);
  17506. }
  17507. $processError = 'Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput();
  17508. }
  17509. if (!class_exists('RarArchive')) {
  17510. $iniMessage = IniHelper::getMessage();
  17511. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  17512. . $iniMessage . "\n" . $processError;
  17513. if (!Platform::isWindows()) {
  17514. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  17515. }
  17516. throw new \RuntimeException($error);
  17517. }
  17518. $rarArchive = RarArchive::open($file);
  17519. if (false === $rarArchive) {
  17520. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  17521. }
  17522. $entries = $rarArchive->getEntries();
  17523. if (false === $entries) {
  17524. throw new \RuntimeException('Could not retrieve RAR archive entries');
  17525. }
  17526. foreach ($entries as $entry) {
  17527. if (false === $entry->extract($path)) {
  17528. throw new \RuntimeException('Could not extract entry');
  17529. }
  17530. }
  17531. $rarArchive->close();
  17532. return \React\Promise\resolve(null);
  17533. }
  17534. }
  17535. <?php declare(strict_types=1);
  17536. namespace Composer\Downloader;
  17537. use Composer\Package\PackageInterface;
  17538. use Composer\Pcre\Preg;
  17539. use Composer\Util\Svn as SvnUtil;
  17540. use Composer\Repository\VcsRepository;
  17541. use Composer\Util\ProcessExecutor;
  17542. use React\Promise\PromiseInterface;
  17543. class SvnDownloader extends VcsDownloader
  17544. {
  17545. protected $cacheCredentials = true;
  17546. protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface
  17547. {
  17548. SvnUtil::cleanEnv();
  17549. $util = new SvnUtil($url, $this->io, $this->config, $this->process);
  17550. if (null === $util->binaryVersion()) {
  17551. throw new \RuntimeException('svn was not found in your PATH, skipping source download');
  17552. }
  17553. return \React\Promise\resolve(null);
  17554. }
  17555. protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface
  17556. {
  17557. SvnUtil::cleanEnv();
  17558. $ref = $package->getSourceReference();
  17559. $repo = $package->getRepository();
  17560. if ($repo instanceof VcsRepository) {
  17561. $repoConfig = $repo->getRepoConfig();
  17562. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  17563. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  17564. }
  17565. }
  17566. $this->io->writeError(" Checking out ".$package->getSourceReference());
  17567. $this->execute($package, $url, ['svn', 'co'], sprintf("%s/%s", $url, $ref), null, $path);
  17568. return \React\Promise\resolve(null);
  17569. }
  17570. protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface
  17571. {
  17572. SvnUtil::cleanEnv();
  17573. $ref = $target->getSourceReference();
  17574. if (!$this->hasMetadataRepository($path)) {
  17575. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  17576. }
  17577. $util = new SvnUtil($url, $this->io, $this->config, $this->process);
  17578. $flags = [];
  17579. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  17580. $flags[] = '--ignore-ancestry';
  17581. }
  17582. $this->io->writeError(" Checking out " . $ref);
  17583. $this->execute($target, $url, array_merge(['svn', 'switch'], $flags), sprintf("%s/%s", $url, $ref), $path);
  17584. return \React\Promise\resolve(null);
  17585. }
  17586. public function getLocalChanges(PackageInterface $package, string $path): ?string
  17587. {
  17588. if (!$this->hasMetadataRepository($path)) {
  17589. return null;
  17590. }
  17591. $this->process->execute(['svn', 'status', '--ignore-externals'], $output, $path);
  17592. return Preg::isMatch('{^ *[^X ] +}m', $output) ? $output : null;
  17593. }
  17594. protected function execute(PackageInterface $package, string $baseUrl, array $command, string $url, ?string $cwd = null, ?string $path = null): string
  17595. {
  17596. $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
  17597. $util->setCacheCredentials($this->cacheCredentials);
  17598. try {
  17599. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  17600. } catch (\RuntimeException $e) {
  17601. throw new \RuntimeException(
  17602. $package->getPrettyName().' could not be downloaded, '.$e->getMessage()
  17603. );
  17604. }
  17605. }
  17606. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  17607. {
  17608. if (null === ($changes = $this->getLocalChanges($package, $path))) {
  17609. return \React\Promise\resolve(null);
  17610. }
  17611. if (!$this->io->isInteractive()) {
  17612. if (true === $this->config->get('discard-changes')) {
  17613. return $this->discardChanges($path);
  17614. }
  17615. return parent::cleanChanges($package, $path, $update);
  17616. }
  17617. $changes = array_map(static function ($elem): string {
  17618. return ' '.$elem;
  17619. }, Preg::split('{\s*\r?\n\s*}', $changes));
  17620. $countChanges = count($changes);
  17621. $this->io->writeError(sprintf(' <error>'.$package->getPrettyName().' has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  17622. $this->io->writeError(array_slice($changes, 0, 10));
  17623. if ($countChanges > 10) {
  17624. $remainingChanges = $countChanges - 10;
  17625. $this->io->writeError(
  17626. sprintf(
  17627. ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
  17628. $remainingChanges === 1 ? '' : 's'
  17629. )
  17630. );
  17631. }
  17632. while (true) {
  17633. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  17634. case 'y':
  17635. $this->discardChanges($path);
  17636. break 2;
  17637. case 'n':
  17638. throw new \RuntimeException('Update aborted');
  17639. case 'v':
  17640. $this->io->writeError($changes);
  17641. break;
  17642. case '?':
  17643. default:
  17644. $this->io->writeError([
  17645. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  17646. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  17647. ' v - view modified files',
  17648. ' ? - print help',
  17649. ]);
  17650. break;
  17651. }
  17652. }
  17653. return \React\Promise\resolve(null);
  17654. }
  17655. protected function getCommitLogs(string $fromReference, string $toReference, string $path): string
  17656. {
  17657. if (Preg::isMatch('{@(\d+)$}', $fromReference) && Preg::isMatch('{@(\d+)$}', $toReference)) {
  17658. $command = ['svn', 'info', '--non-interactive', '--xml', '--', $path];
  17659. if (0 !== $this->process->execute($command, $output, $path)) {
  17660. throw new \RuntimeException(
  17661. 'Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput()
  17662. );
  17663. }
  17664. $urlPattern = '#<url>(.*)</url>#';
  17665. if (Preg::isMatchStrictGroups($urlPattern, $output, $matches)) {
  17666. $baseUrl = $matches[1];
  17667. } else {
  17668. throw new \RuntimeException(
  17669. 'Unable to determine svn url for path '. $path
  17670. );
  17671. }
  17672. $fromRevision = Preg::replace('{.*@(\d+)$}', '$1', $fromReference);
  17673. $toRevision = Preg::replace('{.*@(\d+)$}', '$1', $toReference);
  17674. $command = ['svn', 'log', '-r', $fromRevision.':'.$toRevision, '--incremental'];
  17675. $util = new SvnUtil($baseUrl, $this->io, $this->config, $this->process);
  17676. $util->setCacheCredentials($this->cacheCredentials);
  17677. try {
  17678. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  17679. } catch (\RuntimeException $e) {
  17680. throw new \RuntimeException(
  17681. 'Failed to execute ' . implode(' ', $command) . "\n\n".$e->getMessage()
  17682. );
  17683. }
  17684. }
  17685. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  17686. }
  17687. protected function discardChanges(string $path): PromiseInterface
  17688. {
  17689. if (0 !== $this->process->execute(['svn', 'revert', '-R', '.'], $output, $path)) {
  17690. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  17691. }
  17692. return \React\Promise\resolve(null);
  17693. }
  17694. protected function hasMetadataRepository(string $path): bool
  17695. {
  17696. return is_dir($path.'/.svn');
  17697. }
  17698. }
  17699. <?php declare(strict_types=1);
  17700. namespace Composer\Downloader;
  17701. use Composer\Package\PackageInterface;
  17702. use React\Promise\PromiseInterface;
  17703. class TarDownloader extends ArchiveDownloader
  17704. {
  17705. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17706. {
  17707. $archive = new \PharData($file);
  17708. $archive->extractTo($path, null, true);
  17709. return \React\Promise\resolve(null);
  17710. }
  17711. }
  17712. <?php declare(strict_types=1);
  17713. namespace Composer\Downloader;
  17714. class TransportException extends \RuntimeException
  17715. {
  17716. protected $headers;
  17717. protected $response;
  17718. protected $statusCode;
  17719. protected $responseInfo = [];
  17720. public function __construct(string $message = "", int $code = 400, ?\Throwable $previous = null)
  17721. {
  17722. parent::__construct($message, $code, $previous);
  17723. }
  17724. public function setHeaders(array $headers): void
  17725. {
  17726. $this->headers = $headers;
  17727. }
  17728. public function getHeaders(): ?array
  17729. {
  17730. return $this->headers;
  17731. }
  17732. public function setResponse(?string $response): void
  17733. {
  17734. $this->response = $response;
  17735. }
  17736. public function getResponse(): ?string
  17737. {
  17738. return $this->response;
  17739. }
  17740. public function setStatusCode($statusCode): void
  17741. {
  17742. $this->statusCode = $statusCode;
  17743. }
  17744. public function getStatusCode(): ?int
  17745. {
  17746. return $this->statusCode;
  17747. }
  17748. public function getResponseInfo(): array
  17749. {
  17750. return $this->responseInfo;
  17751. }
  17752. public function setResponseInfo(array $responseInfo): void
  17753. {
  17754. $this->responseInfo = $responseInfo;
  17755. }
  17756. }
  17757. <?php declare(strict_types=1);
  17758. namespace Composer\Downloader;
  17759. use Composer\Package\PackageInterface;
  17760. interface VcsCapableDownloaderInterface
  17761. {
  17762. public function getVcsReference(PackageInterface $package, string $path): ?string;
  17763. }
  17764. <?php declare(strict_types=1);
  17765. namespace Composer\Downloader;
  17766. use Composer\Config;
  17767. use Composer\Package\Dumper\ArrayDumper;
  17768. use Composer\Package\PackageInterface;
  17769. use Composer\Package\Version\VersionGuesser;
  17770. use Composer\Package\Version\VersionParser;
  17771. use Composer\Util\ProcessExecutor;
  17772. use Composer\IO\IOInterface;
  17773. use Composer\Util\Filesystem;
  17774. use React\Promise\PromiseInterface;
  17775. use Composer\DependencyResolver\Operation\UpdateOperation;
  17776. use Composer\DependencyResolver\Operation\InstallOperation;
  17777. use Composer\DependencyResolver\Operation\UninstallOperation;
  17778. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  17779. {
  17780. protected $io;
  17781. protected $config;
  17782. protected $process;
  17783. protected $filesystem;
  17784. protected $hasCleanedChanges = [];
  17785. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?Filesystem $fs = null)
  17786. {
  17787. $this->io = $io;
  17788. $this->config = $config;
  17789. $this->process = $process ?? new ProcessExecutor($io);
  17790. $this->filesystem = $fs ?? new Filesystem($this->process);
  17791. }
  17792. public function getInstallationSource(): string
  17793. {
  17794. return 'source';
  17795. }
  17796. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  17797. {
  17798. if (!$package->getSourceReference()) {
  17799. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  17800. }
  17801. $urls = $this->prepareUrls($package->getSourceUrls());
  17802. while ($url = array_shift($urls)) {
  17803. try {
  17804. return $this->doDownload($package, $path, $url, $prevPackage);
  17805. } catch (\Exception $e) {
  17806. if ($e instanceof \PHPUnit\Framework\Exception) {
  17807. throw $e;
  17808. }
  17809. if ($this->io->isDebug()) {
  17810. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  17811. } elseif (count($urls)) {
  17812. $this->io->writeError(' Failed, trying the next URL');
  17813. }
  17814. if (!count($urls)) {
  17815. throw $e;
  17816. }
  17817. }
  17818. }
  17819. return \React\Promise\resolve(null);
  17820. }
  17821. public function prepare(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  17822. {
  17823. if ($type === 'update') {
  17824. $this->cleanChanges($prevPackage, $path, true);
  17825. $this->hasCleanedChanges[$prevPackage->getUniqueName()] = true;
  17826. } elseif ($type === 'install') {
  17827. $this->filesystem->emptyDirectory($path);
  17828. } elseif ($type === 'uninstall') {
  17829. $this->cleanChanges($package, $path, false);
  17830. }
  17831. return \React\Promise\resolve(null);
  17832. }
  17833. public function cleanup(string $type, PackageInterface $package, string $path, ?PackageInterface $prevPackage = null): PromiseInterface
  17834. {
  17835. if ($type === 'update' && isset($this->hasCleanedChanges[$prevPackage->getUniqueName()])) {
  17836. $this->reapplyChanges($path);
  17837. unset($this->hasCleanedChanges[$prevPackage->getUniqueName()]);
  17838. }
  17839. return \React\Promise\resolve(null);
  17840. }
  17841. public function install(PackageInterface $package, string $path): PromiseInterface
  17842. {
  17843. if (!$package->getSourceReference()) {
  17844. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  17845. }
  17846. $this->io->writeError(" - " . InstallOperation::format($package).': ', false);
  17847. $urls = $this->prepareUrls($package->getSourceUrls());
  17848. while ($url = array_shift($urls)) {
  17849. try {
  17850. $this->doInstall($package, $path, $url);
  17851. break;
  17852. } catch (\Exception $e) {
  17853. if ($e instanceof \PHPUnit\Framework\Exception) {
  17854. throw $e;
  17855. }
  17856. if ($this->io->isDebug()) {
  17857. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  17858. } elseif (count($urls)) {
  17859. $this->io->writeError(' Failed, trying the next URL');
  17860. }
  17861. if (!count($urls)) {
  17862. throw $e;
  17863. }
  17864. }
  17865. }
  17866. return \React\Promise\resolve(null);
  17867. }
  17868. public function update(PackageInterface $initial, PackageInterface $target, string $path): PromiseInterface
  17869. {
  17870. if (!$target->getSourceReference()) {
  17871. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  17872. }
  17873. $this->io->writeError(" - " . UpdateOperation::format($initial, $target).': ', false);
  17874. $urls = $this->prepareUrls($target->getSourceUrls());
  17875. $exception = null;
  17876. while ($url = array_shift($urls)) {
  17877. try {
  17878. $this->doUpdate($initial, $target, $path, $url);
  17879. $exception = null;
  17880. break;
  17881. } catch (\Exception $exception) {
  17882. if ($exception instanceof \PHPUnit\Framework\Exception) {
  17883. throw $exception;
  17884. }
  17885. if ($this->io->isDebug()) {
  17886. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  17887. } elseif (count($urls)) {
  17888. $this->io->writeError(' Failed, trying the next URL');
  17889. }
  17890. }
  17891. }
  17892. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  17893. $message = 'Pulling in changes:';
  17894. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  17895. if ('' === trim($logs)) {
  17896. $message = 'Rolling back changes:';
  17897. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  17898. }
  17899. if ('' !== trim($logs)) {
  17900. $logs = implode("\n", array_map(static function ($line): string {
  17901. return ' ' . $line;
  17902. }, explode("\n", $logs)));
  17903. $logs = str_replace('<', '\<', $logs);
  17904. $this->io->writeError(' '.$message);
  17905. $this->io->writeError($logs);
  17906. }
  17907. }
  17908. if (!$urls && $exception) {
  17909. throw $exception;
  17910. }
  17911. return \React\Promise\resolve(null);
  17912. }
  17913. public function remove(PackageInterface $package, string $path): PromiseInterface
  17914. {
  17915. $this->io->writeError(" - " . UninstallOperation::format($package));
  17916. $promise = $this->filesystem->removeDirectoryAsync($path);
  17917. return $promise->then(static function (bool $result) use ($path) {
  17918. if (!$result) {
  17919. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  17920. }
  17921. });
  17922. }
  17923. public function getVcsReference(PackageInterface $package, string $path): ?string
  17924. {
  17925. $parser = new VersionParser;
  17926. $guesser = new VersionGuesser($this->config, $this->process, $parser, $this->io);
  17927. $dumper = new ArrayDumper;
  17928. $packageConfig = $dumper->dump($package);
  17929. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  17930. return $packageVersion['commit'];
  17931. }
  17932. return null;
  17933. }
  17934. protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface
  17935. {
  17936. if (null !== $this->getLocalChanges($package, $path)) {
  17937. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  17938. }
  17939. return \React\Promise\resolve(null);
  17940. }
  17941. protected function reapplyChanges(string $path): void
  17942. {
  17943. }
  17944. abstract protected function doDownload(PackageInterface $package, string $path, string $url, ?PackageInterface $prevPackage = null): PromiseInterface;
  17945. abstract protected function doInstall(PackageInterface $package, string $path, string $url): PromiseInterface;
  17946. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, string $path, string $url): PromiseInterface;
  17947. abstract protected function getCommitLogs(string $fromReference, string $toReference, string $path): string;
  17948. abstract protected function hasMetadataRepository(string $path): bool;
  17949. private function prepareUrls(array $urls): array
  17950. {
  17951. foreach ($urls as $index => $url) {
  17952. if (Filesystem::isLocalPath($url)) {
  17953. $fileProtocol = 'file://';
  17954. $isFileProtocol = false;
  17955. if (0 === strpos($url, $fileProtocol)) {
  17956. $url = substr($url, strlen($fileProtocol));
  17957. $isFileProtocol = true;
  17958. }
  17959. if (false !== strpos($url, '%')) {
  17960. $url = rawurldecode($url);
  17961. }
  17962. $urls[$index] = realpath($url);
  17963. if ($isFileProtocol) {
  17964. $urls[$index] = $fileProtocol . $urls[$index];
  17965. }
  17966. }
  17967. }
  17968. return $urls;
  17969. }
  17970. }
  17971. <?php declare(strict_types=1);
  17972. namespace Composer\Downloader;
  17973. use React\Promise\PromiseInterface;
  17974. use Composer\Package\PackageInterface;
  17975. use Composer\Util\ProcessExecutor;
  17976. class XzDownloader extends ArchiveDownloader
  17977. {
  17978. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  17979. {
  17980. $command = ['tar', '-xJf', $file, '-C', $path];
  17981. if (0 === $this->process->execute($command, $ignoredOutput)) {
  17982. return \React\Promise\resolve(null);
  17983. }
  17984. $processError = 'Failed to execute ' . implode(' ', $command) . "\n\n" . $this->process->getErrorOutput();
  17985. throw new \RuntimeException($processError);
  17986. }
  17987. }
  17988. <?php declare(strict_types=1);
  17989. namespace Composer\Downloader;
  17990. use Composer\Package\PackageInterface;
  17991. use Composer\Pcre\Preg;
  17992. use Composer\Util\IniHelper;
  17993. use Composer\Util\Platform;
  17994. use Composer\Util\ProcessExecutor;
  17995. use Symfony\Component\Process\ExecutableFinder;
  17996. use Symfony\Component\Process\Process;
  17997. use React\Promise\PromiseInterface;
  17998. use ZipArchive;
  17999. class ZipDownloader extends ArchiveDownloader
  18000. {
  18001. private static $unzipCommands;
  18002. private static $hasZipArchive;
  18003. private static $isWindows;
  18004. private $zipArchiveObject;
  18005. public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null, bool $output = true): PromiseInterface
  18006. {
  18007. if (null === self::$unzipCommands) {
  18008. self::$unzipCommands = [];
  18009. $finder = new ExecutableFinder;
  18010. if (Platform::isWindows() && ($cmd = $finder->find('7z', null, ['C:\Program Files\7-Zip']))) {
  18011. self::$unzipCommands[] = ['7z', $cmd, 'x', '-bb0', '-y', '%file%', '-o%path%'];
  18012. }
  18013. if ($cmd = $finder->find('unzip')) {
  18014. self::$unzipCommands[] = ['unzip', $cmd, '-qq', '%file%', '-d', '%path%'];
  18015. }
  18016. if (!Platform::isWindows() && ($cmd = $finder->find('7z'))) {
  18017. self::$unzipCommands[] = ['7z', $cmd, 'x', '-bb0', '-y', '%file%', '-o%path%'];
  18018. }
  18019. if (!Platform::isWindows() && ($cmd = $finder->find('7zz'))) {
  18020. self::$unzipCommands[] = ['7zz', $cmd, 'x', '-bb0', '-y', '%file%', '-o%path%'];
  18021. }
  18022. }
  18023. $procOpenMissing = false;
  18024. if (!function_exists('proc_open')) {
  18025. self::$unzipCommands = [];
  18026. $procOpenMissing = true;
  18027. }
  18028. if (null === self::$hasZipArchive) {
  18029. self::$hasZipArchive = class_exists('ZipArchive');
  18030. }
  18031. if (!self::$hasZipArchive && !self::$unzipCommands) {
  18032. $iniMessage = IniHelper::getMessage();
  18033. if ($procOpenMissing) {
  18034. $error = "The zip extension is missing and unzip/7z commands cannot be called as proc_open is disabled, skipping.\n" . $iniMessage;
  18035. } else {
  18036. $error = "The zip extension and unzip/7z commands are both missing, skipping.\n" . $iniMessage;
  18037. }
  18038. throw new \RuntimeException($error);
  18039. }
  18040. if (null === self::$isWindows) {
  18041. self::$isWindows = Platform::isWindows();
  18042. if (!self::$isWindows && !self::$unzipCommands) {
  18043. if ($procOpenMissing) {
  18044. $this->io->writeError("<warning>proc_open is disabled so 'unzip' and '7z' commands cannot be used, zip files are being unpacked using the PHP zip extension.</warning>");
  18045. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  18046. $this->io->writeError("<warning>Enabling proc_open and installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
  18047. } else {
  18048. $this->io->writeError("<warning>As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  18049. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  18050. $this->io->writeError("<warning>Installing 'unzip' or '7z' (21.01+) may remediate them.</warning>");
  18051. }
  18052. }
  18053. }
  18054. return parent::download($package, $path, $prevPackage, $output);
  18055. }
  18056. private function extractWithSystemUnzip(PackageInterface $package, string $file, string $path): PromiseInterface
  18057. {
  18058. static $warned7ZipLinux = false;
  18059. $isLastChance = !self::$hasZipArchive;
  18060. if (0 === \count(self::$unzipCommands)) {
  18061. return $this->extractWithZipArchive($package, $file, $path);
  18062. }
  18063. $commandSpec = reset(self::$unzipCommands);
  18064. $executable = $commandSpec[0];
  18065. $command = array_slice($commandSpec, 1);
  18066. $map = [
  18067. '%file%' => strtr($file, '/', DIRECTORY_SEPARATOR),
  18068. '%path%' => strtr($path, '/', DIRECTORY_SEPARATOR),
  18069. ];
  18070. $command = array_map(static function ($value) use ($map) {
  18071. return strtr($value, $map);
  18072. }, $command);
  18073. if (!$warned7ZipLinux && !Platform::isWindows() && in_array($executable, ['7z', '7zz'], true)) {
  18074. $warned7ZipLinux = true;
  18075. if (0 === $this->process->execute([$commandSpec[1]], $output)) {
  18076. if (Preg::isMatchStrictGroups('{^\s*7-Zip(?: \[64\])? ([0-9.]+)}', $output, $match) && version_compare($match[1], '21.01', '<')) {
  18077. $this->io->writeError(' <warning>Unzipping using '.$executable.' '.$match[1].' may result in incorrect file permissions. Install '.$executable.' 21.01+ or unzip to ensure you get correct permissions.</warning>');
  18078. }
  18079. }
  18080. }
  18081. $io = $this->io;
  18082. $tryFallback = function (\Throwable $processError) use ($isLastChance, $io, $file, $path, $package, $executable): \React\Promise\PromiseInterface {
  18083. if ($isLastChance) {
  18084. throw $processError;
  18085. }
  18086. if (str_contains($processError->getMessage(), 'zip bomb')) {
  18087. throw $processError;
  18088. }
  18089. if (!is_file($file)) {
  18090. $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
  18091. $io->writeError(' <warning>This most likely is due to a custom installer plugin not handling the returned Promise from the downloader</warning>');
  18092. $io->writeError(' <warning>See https://github.com/composer/installers/commit/5006d0c28730ade233a8f42ec31ac68fb1c5c9bb for an example fix</warning>');
  18093. } else {
  18094. $io->writeError(' <warning>'.$processError->getMessage().'</warning>');
  18095. $io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  18096. $io->writeError(' Unzip with '.$executable.' command failed, falling back to ZipArchive class');
  18097. if (Platform::getEnv('GITHUB_ACTIONS') !== false && Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') === false) {
  18098. $io->writeError(' <warning>Additional debug info, please report to https://github.com/composer/composer/issues/11148 if you see this:</warning>');
  18099. $io->writeError('File size: '.@filesize($file));
  18100. $io->writeError('File SHA1: '.hash_file('sha1', $file));
  18101. $io->writeError('First 100 bytes (hex): '.bin2hex(substr((string) file_get_contents($file), 0, 100)));
  18102. $io->writeError('Last 100 bytes (hex): '.bin2hex(substr((string) file_get_contents($file), -100)));
  18103. if (strlen((string) $package->getDistUrl()) > 0) {
  18104. $io->writeError('Origin URL: '.$this->processUrl($package, (string) $package->getDistUrl()));
  18105. $io->writeError('Response Headers: '.json_encode(FileDownloader::$responseHeaders[$package->getName()] ?? []));
  18106. }
  18107. }
  18108. }
  18109. return $this->extractWithZipArchive($package, $file, $path);
  18110. };
  18111. try {
  18112. $promise = $this->process->executeAsync($command);
  18113. return $promise->then(function (Process $process) use ($tryFallback, $command, $package, $file) {
  18114. if (!$process->isSuccessful()) {
  18115. if (isset($this->cleanupExecuted[$package->getName()])) {
  18116. throw new \RuntimeException('Failed to extract '.$package->getName().' as the installation was aborted by another package operation.');
  18117. }
  18118. $output = $process->getErrorOutput();
  18119. $output = str_replace(', '.$file.'.zip or '.$file.'.ZIP', '', $output);
  18120. return $tryFallback(new \RuntimeException('Failed to extract '.$package->getName().': ('.$process->getExitCode().') '.implode(' ', $command)."\n\n".$output));
  18121. }
  18122. });
  18123. } catch (\Throwable $e) {
  18124. return $tryFallback($e);
  18125. }
  18126. }
  18127. private function extractWithZipArchive(PackageInterface $package, string $file, string $path): PromiseInterface
  18128. {
  18129. $processError = null;
  18130. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  18131. try {
  18132. if (!file_exists($file) || ($filesize = filesize($file)) === false || $filesize === 0) {
  18133. $retval = -1;
  18134. } else {
  18135. $retval = $zipArchive->open($file);
  18136. }
  18137. if (true === $retval) {
  18138. $totalSize = 0;
  18139. $archiveSize = filesize($file);
  18140. $totalFiles = $zipArchive->count();
  18141. if ($totalFiles > 0) {
  18142. for ($i = 0; $i < min($totalFiles, 5); $i++) {
  18143. $stat = $zipArchive->statIndex(random_int(0, $totalFiles - 1));
  18144. if ($stat === false) {
  18145. continue;
  18146. }
  18147. $totalSize += $stat['size'];
  18148. if ($stat['size'] > $stat['comp_size'] * 200) {
  18149. throw new \RuntimeException('Invalid zip file with compression ratio >99% (possible zip bomb)');
  18150. }
  18151. }
  18152. if ($archiveSize !== false && $totalSize > $archiveSize * 100 && $totalSize > 50*1024*1024) {
  18153. throw new \RuntimeException('Invalid zip file with compression ratio >99% (possible zip bomb)');
  18154. }
  18155. }
  18156. $extractResult = $zipArchive->extractTo($path);
  18157. if (true === $extractResult) {
  18158. $zipArchive->close();
  18159. return \React\Promise\resolve(null);
  18160. }
  18161. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  18162. } else {
  18163. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  18164. }
  18165. } catch (\ErrorException $e) {
  18166. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  18167. } catch (\Throwable $e) {
  18168. $processError = $e;
  18169. }
  18170. throw $processError;
  18171. }
  18172. protected function extract(PackageInterface $package, string $file, string $path): PromiseInterface
  18173. {
  18174. return $this->extractWithSystemUnzip($package, $file, $path);
  18175. }
  18176. protected function getErrorMessage(int $retval, string $file): string
  18177. {
  18178. switch ($retval) {
  18179. case ZipArchive::ER_EXISTS:
  18180. return sprintf("File '%s' already exists.", $file);
  18181. case ZipArchive::ER_INCONS:
  18182. return sprintf("Zip archive '%s' is inconsistent.", $file);
  18183. case ZipArchive::ER_INVAL:
  18184. return sprintf("Invalid argument (%s)", $file);
  18185. case ZipArchive::ER_MEMORY:
  18186. return sprintf("Malloc failure (%s)", $file);
  18187. case ZipArchive::ER_NOENT:
  18188. return sprintf("No such zip file: '%s'", $file);
  18189. case ZipArchive::ER_NOZIP:
  18190. return sprintf("'%s' is not a zip archive.", $file);
  18191. case ZipArchive::ER_OPEN:
  18192. return sprintf("Can't open zip file: %s", $file);
  18193. case ZipArchive::ER_READ:
  18194. return sprintf("Zip read error (%s)", $file);
  18195. case ZipArchive::ER_SEEK:
  18196. return sprintf("Zip seek error (%s)", $file);
  18197. case -1:
  18198. return sprintf("'%s' is a corrupted zip archive (0 bytes), try again.", $file);
  18199. default:
  18200. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  18201. }
  18202. }
  18203. }
  18204. <?php declare(strict_types=1);
  18205. namespace Composer\EventDispatcher;
  18206. class Event
  18207. {
  18208. protected $name;
  18209. protected $args;
  18210. protected $flags;
  18211. private $propagationStopped = false;
  18212. public function __construct(string $name, array $args = [], array $flags = [])
  18213. {
  18214. $this->name = $name;
  18215. $this->args = $args;
  18216. $this->flags = $flags;
  18217. }
  18218. public function getName(): string
  18219. {
  18220. return $this->name;
  18221. }
  18222. public function getArguments(): array
  18223. {
  18224. return $this->args;
  18225. }
  18226. public function getFlags(): array
  18227. {
  18228. return $this->flags;
  18229. }
  18230. public function isPropagationStopped(): bool
  18231. {
  18232. return $this->propagationStopped;
  18233. }
  18234. public function stopPropagation(): void
  18235. {
  18236. $this->propagationStopped = true;
  18237. }
  18238. }
  18239. <?php declare(strict_types=1);
  18240. namespace Composer\EventDispatcher;
  18241. use Composer\DependencyResolver\Transaction;
  18242. use Composer\Installer\InstallerEvent;
  18243. use Composer\IO\BufferIO;
  18244. use Composer\IO\ConsoleIO;
  18245. use Composer\IO\IOInterface;
  18246. use Composer\Composer;
  18247. use Composer\PartialComposer;
  18248. use Composer\Pcre\Preg;
  18249. use Composer\Plugin\CommandEvent;
  18250. use Composer\Plugin\PreCommandRunEvent;
  18251. use Composer\Util\Platform;
  18252. use Composer\DependencyResolver\Operation\OperationInterface;
  18253. use Composer\Repository\RepositoryInterface;
  18254. use Composer\Script;
  18255. use Composer\Installer\PackageEvent;
  18256. use Composer\Installer\BinaryInstaller;
  18257. use Composer\Util\ProcessExecutor;
  18258. use Composer\Script\Event as ScriptEvent;
  18259. use Composer\Autoload\ClassLoader;
  18260. use Symfony\Component\Console\Application;
  18261. use Symfony\Component\Console\Command\Command;
  18262. use Symfony\Component\Console\Input\StringInput;
  18263. use Symfony\Component\Console\Output\ConsoleOutput;
  18264. use Symfony\Component\Process\PhpExecutableFinder;
  18265. use Symfony\Component\Process\ExecutableFinder;
  18266. class EventDispatcher
  18267. {
  18268. protected $composer;
  18269. protected $io;
  18270. protected $loader;
  18271. protected $process;
  18272. protected $listeners = [];
  18273. protected $runScripts = true;
  18274. private $eventStack;
  18275. public function __construct(PartialComposer $composer, IOInterface $io, ?ProcessExecutor $process = null)
  18276. {
  18277. $this->composer = $composer;
  18278. $this->io = $io;
  18279. $this->process = $process ?? new ProcessExecutor($io);
  18280. $this->eventStack = [];
  18281. }
  18282. public function setRunScripts(bool $runScripts = true): self
  18283. {
  18284. $this->runScripts = $runScripts;
  18285. return $this;
  18286. }
  18287. public function dispatch(?string $eventName, ?Event $event = null): int
  18288. {
  18289. if (null === $event) {
  18290. if (null === $eventName) {
  18291. throw new \InvalidArgumentException('If no $event is passed in to '.__METHOD__.' you have to pass in an $eventName, got null.');
  18292. }
  18293. $event = new Event($eventName);
  18294. }
  18295. return $this->doDispatch($event);
  18296. }
  18297. public function dispatchScript(string $eventName, bool $devMode = false, array $additionalArgs = [], array $flags = []): int
  18298. {
  18299. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  18300. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  18301. }
  18302. public function dispatchPackageEvent(string $eventName, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation): int
  18303. {
  18304. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  18305. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $localRepo, $operations, $operation));
  18306. }
  18307. public function dispatchInstallerEvent(string $eventName, bool $devMode, bool $executeOperations, Transaction $transaction): int
  18308. {
  18309. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  18310. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $executeOperations, $transaction));
  18311. }
  18312. protected function doDispatch(Event $event)
  18313. {
  18314. if (Platform::getEnv('COMPOSER_DEBUG_EVENTS')) {
  18315. $details = null;
  18316. if ($event instanceof PackageEvent) {
  18317. $details = (string) $event->getOperation();
  18318. } elseif ($event instanceof CommandEvent) {
  18319. $details = $event->getCommandName();
  18320. } elseif ($event instanceof PreCommandRunEvent) {
  18321. $details = $event->getCommand();
  18322. }
  18323. $this->io->writeError('Dispatching <info>'.$event->getName().'</info>'.($details ? ' ('.$details.')' : '').' event');
  18324. }
  18325. $listeners = $this->getListeners($event);
  18326. $this->pushEvent($event);
  18327. $autoloadersBefore = spl_autoload_functions();
  18328. try {
  18329. $returnMax = 0;
  18330. foreach ($listeners as $callable) {
  18331. $return = 0;
  18332. $this->ensureBinDirIsInPath();
  18333. $additionalArgs = $event->getArguments();
  18334. if (is_string($callable) && str_contains($callable, '@no_additional_args')) {
  18335. $callable = Preg::replace('{ ?@no_additional_args}', '', $callable);
  18336. $additionalArgs = [];
  18337. }
  18338. $formattedEventNameWithArgs = $event->getName() . ($additionalArgs !== [] ? ' (' . implode(', ', $additionalArgs) . ')' : '');
  18339. if (!is_string($callable)) {
  18340. if (!is_callable($callable)) {
  18341. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  18342. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  18343. }
  18344. if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) {
  18345. $this->io->writeError(sprintf('> %s: %s', $formattedEventNameWithArgs, (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE);
  18346. }
  18347. $return = false === $callable($event) ? 1 : 0;
  18348. } elseif ($this->isComposerScript($callable)) {
  18349. $this->io->writeError(sprintf('> %s: %s', $formattedEventNameWithArgs, $callable), true, IOInterface::VERBOSE);
  18350. $script = explode(' ', substr($callable, 1));
  18351. $scriptName = $script[0];
  18352. unset($script[0]);
  18353. $index = array_search('@additional_args', $script, true);
  18354. if ($index !== false) {
  18355. $args = array_splice($script, $index, 0, $additionalArgs);
  18356. } else {
  18357. $args = array_merge($script, $additionalArgs);
  18358. }
  18359. $flags = $event->getFlags();
  18360. if (isset($flags['script-alias-input'])) {
  18361. $argsString = implode(' ', array_map(static function ($arg) { return ProcessExecutor::escape($arg); }, $script));
  18362. $flags['script-alias-input'] = $argsString . ' ' . $flags['script-alias-input'];
  18363. unset($argsString);
  18364. }
  18365. if (strpos($callable, '@composer ') === 0) {
  18366. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . ' ' . implode(' ', $args);
  18367. if (0 !== ($exitCode = $this->executeTty($exec))) {
  18368. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  18369. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  18370. }
  18371. } else {
  18372. if (!$this->getListeners(new Event($scriptName))) {
  18373. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  18374. }
  18375. try {
  18376. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  18377. $scriptEvent->setOriginatingEvent($event);
  18378. $return = $this->dispatch($scriptName, $scriptEvent);
  18379. } catch (ScriptExecutionException $e) {
  18380. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  18381. throw $e;
  18382. }
  18383. }
  18384. } elseif ($this->isPhpScript($callable)) {
  18385. $className = substr($callable, 0, strpos($callable, '::'));
  18386. $methodName = substr($callable, strpos($callable, '::') + 2);
  18387. if (!class_exists($className)) {
  18388. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  18389. continue;
  18390. }
  18391. if (!is_callable($callable)) {
  18392. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  18393. continue;
  18394. }
  18395. try {
  18396. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  18397. } catch (\Exception $e) {
  18398. $message = "Script %s handling the %s event terminated with an exception";
  18399. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  18400. throw $e;
  18401. }
  18402. } elseif ($this->isCommandClass($callable)) {
  18403. $className = $callable;
  18404. if (!class_exists($className)) {
  18405. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  18406. continue;
  18407. }
  18408. if (!is_a($className, Command::class, true)) {
  18409. $this->io->writeError('<warning>Class '.$className.' does not extend '.Command::class.', can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  18410. continue;
  18411. }
  18412. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($event->getName())))) {
  18413. $this->io->writeError('<warning>You cannot bind '.$event->getName().' to a Command class, use a non-reserved name</warning>', true, IOInterface::QUIET);
  18414. continue;
  18415. }
  18416. $app = new Application();
  18417. $app->setCatchExceptions(false);
  18418. if (method_exists($app, 'setCatchErrors')) {
  18419. $app->setCatchErrors(false);
  18420. }
  18421. $app->setAutoExit(false);
  18422. $cmd = new $className($event->getName());
  18423. $app->add($cmd);
  18424. $app->setDefaultCommand((string) $cmd->getName(), true);
  18425. try {
  18426. $args = implode(' ', array_map(static function ($arg) { return ProcessExecutor::escape($arg); }, $additionalArgs));
  18427. if ($this->io instanceof ConsoleIO) {
  18428. $reflProp = new \ReflectionProperty($this->io, 'output');
  18429. if (\PHP_VERSION_ID < 80100) {
  18430. $reflProp->setAccessible(true);
  18431. }
  18432. $output = $reflProp->getValue($this->io);
  18433. } else {
  18434. $output = new ConsoleOutput();
  18435. }
  18436. $return = $app->run(new StringInput($event->getFlags()['script-alias-input'] ?? $args), $output);
  18437. } catch (\Exception $e) {
  18438. $message = "Script %s handling the %s event terminated with an exception";
  18439. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  18440. throw $e;
  18441. }
  18442. } else {
  18443. $args = implode(' ', array_map(['Composer\Util\ProcessExecutor', 'escape'], $additionalArgs));
  18444. if (strpos($callable, '@putenv ') === 0) {
  18445. $exec = $callable;
  18446. } else {
  18447. if (str_contains($callable, '@additional_args')) {
  18448. $exec = str_replace('@additional_args', $args, $callable);
  18449. } else {
  18450. $exec = $callable . ($args === '' ? '' : ' '.$args);
  18451. }
  18452. }
  18453. if ($this->io->isVerbose()) {
  18454. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  18455. } elseif ($event->getName() !== '__exec_command') {
  18456. $this->io->writeError(sprintf('> %s', $exec));
  18457. }
  18458. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  18459. if (count($possibleLocalBinaries) > 0) {
  18460. foreach ($possibleLocalBinaries as $localExec) {
  18461. if (Preg::isMatch('{\b'.preg_quote($callable).'$}', $localExec)) {
  18462. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  18463. $exec = Preg::replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  18464. break;
  18465. }
  18466. }
  18467. }
  18468. if (strpos($exec, '@putenv ') === 0) {
  18469. if (false === strpos($exec, '=')) {
  18470. Platform::clearEnv(substr($exec, 8));
  18471. } else {
  18472. [$var, $value] = explode('=', substr($exec, 8), 2);
  18473. Platform::putEnv($var, $value);
  18474. }
  18475. continue;
  18476. }
  18477. if (strpos($exec, '@php ') === 0) {
  18478. $pathAndArgs = substr($exec, 5);
  18479. if (Platform::isWindows()) {
  18480. $pathAndArgs = Preg::replaceCallback('{^\S+}', static function ($path) {
  18481. return str_replace('/', '\\', $path[0]);
  18482. }, $pathAndArgs);
  18483. }
  18484. $matched = Preg::isMatchStrictGroups('{^[^\'"\s/\\\\]+}', $pathAndArgs, $match);
  18485. if ($matched && !file_exists($match[0])) {
  18486. $finder = new ExecutableFinder;
  18487. if ($pathToExec = $finder->find($match[0])) {
  18488. if (Platform::isWindows()) {
  18489. $execWithoutExt = Preg::replace('{\.(exe|bat|cmd|com)$}i', '', $pathToExec);
  18490. if (file_exists($execWithoutExt)) {
  18491. $pathToExec = $execWithoutExt;
  18492. }
  18493. unset($execWithoutExt);
  18494. }
  18495. $pathAndArgs = $pathToExec . substr($pathAndArgs, strlen($match[0]));
  18496. }
  18497. }
  18498. $exec = $this->getPhpExecCommand() . ' ' . $pathAndArgs;
  18499. } else {
  18500. $finder = new PhpExecutableFinder();
  18501. $phpPath = $finder->find(false);
  18502. if ($phpPath) {
  18503. Platform::putEnv('PHP_BINARY', $phpPath);
  18504. }
  18505. if (Platform::isWindows()) {
  18506. $exec = Preg::replaceCallback('{^\S+}', static function ($path) {
  18507. return str_replace('/', '\\', $path[0]);
  18508. }, $exec);
  18509. }
  18510. }
  18511. if (strpos($exec, 'composer ') === 0) {
  18512. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(Platform::getEnv('COMPOSER_BINARY')) . substr($exec, 8);
  18513. }
  18514. if (0 !== ($exitCode = $this->executeTty($exec))) {
  18515. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  18516. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  18517. }
  18518. }
  18519. $returnMax = max($returnMax, $return);
  18520. if ($event->isPropagationStopped()) {
  18521. break;
  18522. }
  18523. }
  18524. } finally {
  18525. $this->popEvent();
  18526. $knownIdentifiers = [];
  18527. foreach ($autoloadersBefore as $key => $cb) {
  18528. $knownIdentifiers[$this->getCallbackIdentifier($cb)] = ['key' => $key, 'callback' => $cb];
  18529. }
  18530. foreach (spl_autoload_functions() as $cb) {
  18531. if (isset($knownIdentifiers[$this->getCallbackIdentifier($cb)]) && $knownIdentifiers[$this->getCallbackIdentifier($cb)]['key'] === 0) {
  18532. break;
  18533. }
  18534. if ($cb instanceof ClassLoader) {
  18535. $cb->unregister();
  18536. $cb->register(false);
  18537. } else {
  18538. spl_autoload_unregister($cb);
  18539. spl_autoload_register($cb);
  18540. }
  18541. }
  18542. }
  18543. return $returnMax;
  18544. }
  18545. protected function executeTty(string $exec): int
  18546. {
  18547. if ($this->io->isInteractive()) {
  18548. return $this->process->executeTty($exec);
  18549. }
  18550. return $this->process->execute($exec);
  18551. }
  18552. protected function getPhpExecCommand(): string
  18553. {
  18554. $finder = new PhpExecutableFinder();
  18555. $phpPath = $finder->find(false);
  18556. if (!$phpPath) {
  18557. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  18558. }
  18559. $phpArgs = $finder->findArguments();
  18560. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  18561. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  18562. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  18563. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  18564. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  18565. }
  18566. protected function executeEventPhpScript(string $className, string $methodName, Event $event)
  18567. {
  18568. if ($this->io->isVerbose()) {
  18569. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  18570. } else {
  18571. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  18572. }
  18573. return $className::$methodName($event);
  18574. }
  18575. public function addListener(string $eventName, $listener, int $priority = 0): void
  18576. {
  18577. $this->listeners[$eventName][$priority][] = $listener;
  18578. }
  18579. public function removeListener($listener): void
  18580. {
  18581. foreach ($this->listeners as $eventName => $priorities) {
  18582. foreach ($priorities as $priority => $listeners) {
  18583. foreach ($listeners as $index => $candidate) {
  18584. if ($listener === $candidate || (is_array($candidate) && is_object($listener) && $candidate[0] === $listener)) {
  18585. unset($this->listeners[$eventName][$priority][$index]);
  18586. }
  18587. }
  18588. }
  18589. }
  18590. }
  18591. public function addSubscriber(EventSubscriberInterface $subscriber): void
  18592. {
  18593. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  18594. if (is_string($params)) {
  18595. $this->addListener($eventName, [$subscriber, $params]);
  18596. } elseif (is_string($params[0])) {
  18597. $this->addListener($eventName, [$subscriber, $params[0]], $params[1] ?? 0);
  18598. } else {
  18599. foreach ($params as $listener) {
  18600. $this->addListener($eventName, [$subscriber, $listener[0]], $listener[1] ?? 0);
  18601. }
  18602. }
  18603. }
  18604. }
  18605. protected function getListeners(Event $event): array
  18606. {
  18607. $scriptListeners = $this->runScripts ? $this->getScriptListeners($event) : [];
  18608. if (!isset($this->listeners[$event->getName()][0])) {
  18609. $this->listeners[$event->getName()][0] = [];
  18610. }
  18611. krsort($this->listeners[$event->getName()]);
  18612. $listeners = $this->listeners;
  18613. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  18614. return array_merge(...$listeners[$event->getName()]);
  18615. }
  18616. public function hasEventListeners(Event $event): bool
  18617. {
  18618. $listeners = $this->getListeners($event);
  18619. return count($listeners) > 0;
  18620. }
  18621. protected function getScriptListeners(Event $event): array
  18622. {
  18623. $package = $this->composer->getPackage();
  18624. $scripts = $package->getScripts();
  18625. if (empty($scripts[$event->getName()])) {
  18626. return [];
  18627. }
  18628. assert($this->composer instanceof Composer, new \LogicException('This should only be reached with a fully loaded Composer'));
  18629. if ($this->loader) {
  18630. $this->loader->unregister();
  18631. }
  18632. $generator = $this->composer->getAutoloadGenerator();
  18633. if ($event instanceof ScriptEvent) {
  18634. $generator->setDevMode($event->isDevMode());
  18635. }
  18636. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  18637. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  18638. $map = $generator->parseAutoloads($packageMap, $package);
  18639. $this->loader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
  18640. $this->loader->register(false);
  18641. return $scripts[$event->getName()];
  18642. }
  18643. protected function isPhpScript(string $callable): bool
  18644. {
  18645. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  18646. }
  18647. protected function isCommandClass(string $callable): bool
  18648. {
  18649. return str_contains($callable, '\\') && !str_contains($callable, ' ') && str_ends_with($callable, 'Command');
  18650. }
  18651. protected function isComposerScript(string $callable): bool
  18652. {
  18653. return strpos($callable, '@') === 0 && strpos($callable, '@php ') !== 0 && strpos($callable, '@putenv ') !== 0;
  18654. }
  18655. protected function pushEvent(Event $event): int
  18656. {
  18657. $eventName = $event->getName();
  18658. if (in_array($eventName, $this->eventStack)) {
  18659. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  18660. }
  18661. return array_push($this->eventStack, $eventName);
  18662. }
  18663. protected function popEvent(): ?string
  18664. {
  18665. return array_pop($this->eventStack);
  18666. }
  18667. private function ensureBinDirIsInPath(): void
  18668. {
  18669. $pathEnv = 'PATH';
  18670. if (!isset($_SERVER[$pathEnv]) && isset($_SERVER['Path'])) {
  18671. $pathEnv = 'Path';
  18672. }
  18673. $binDir = $this->composer->getConfig()->get('bin-dir');
  18674. if (is_dir($binDir)) {
  18675. $binDir = realpath($binDir);
  18676. $pathValue = (string) Platform::getEnv($pathEnv);
  18677. if (!Preg::isMatch('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $pathValue)) {
  18678. Platform::putEnv($pathEnv, $binDir.PATH_SEPARATOR.$pathValue);
  18679. }
  18680. }
  18681. }
  18682. private function getCallbackIdentifier($cb): string
  18683. {
  18684. if (is_string($cb)) {
  18685. return 'fn:'.$cb;
  18686. }
  18687. if (is_object($cb)) {
  18688. return 'obj:'.spl_object_hash($cb);
  18689. }
  18690. if (is_array($cb)) {
  18691. return 'array:'.(is_string($cb[0]) ? $cb[0] : get_class($cb[0]) .'#'.spl_object_hash($cb[0])).'::'.$cb[1];
  18692. }
  18693. return 'unsupported';
  18694. }
  18695. }
  18696. <?php declare(strict_types=1);
  18697. namespace Composer\EventDispatcher;
  18698. interface EventSubscriberInterface
  18699. {
  18700. public static function getSubscribedEvents();
  18701. }
  18702. <?php declare(strict_types=1);
  18703. namespace Composer\EventDispatcher;
  18704. class ScriptExecutionException extends \RuntimeException
  18705. {
  18706. }
  18707. <?php declare(strict_types=1);
  18708. namespace Composer\Exception;
  18709. class IrrecoverableDownloadException extends \RuntimeException
  18710. {
  18711. }
  18712. <?php declare(strict_types=1);
  18713. namespace Composer\Exception;
  18714. class NoSslException extends \RuntimeException
  18715. {
  18716. }
  18717. <?php declare(strict_types=1);
  18718. namespace Composer;
  18719. use Composer\Config\JsonConfigSource;
  18720. use Composer\Json\JsonFile;
  18721. use Composer\IO\IOInterface;
  18722. use Composer\Package\Archiver;
  18723. use Composer\Package\Version\VersionGuesser;
  18724. use Composer\Package\RootPackageInterface;
  18725. use Composer\Repository\FilesystemRepository;
  18726. use Composer\Repository\RepositoryManager;
  18727. use Composer\Repository\RepositoryFactory;
  18728. use Composer\Util\Filesystem;
  18729. use Composer\Util\Platform;
  18730. use Composer\Util\ProcessExecutor;
  18731. use Composer\Util\HttpDownloader;
  18732. use Composer\Util\Loop;
  18733. use Composer\Util\Silencer;
  18734. use Composer\Plugin\PluginEvents;
  18735. use Composer\EventDispatcher\Event;
  18736. use Phar;
  18737. use Symfony\Component\Console\Formatter\OutputFormatter;
  18738. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  18739. use Symfony\Component\Console\Output\ConsoleOutput;
  18740. use Composer\EventDispatcher\EventDispatcher;
  18741. use Composer\Autoload\AutoloadGenerator;
  18742. use Composer\Package\Version\VersionParser;
  18743. use Composer\Downloader\TransportException;
  18744. use Composer\Json\JsonValidationException;
  18745. use Composer\Repository\InstalledRepositoryInterface;
  18746. use UnexpectedValueException;
  18747. use ZipArchive;
  18748. class Factory
  18749. {
  18750. protected static function getHomeDir(): string
  18751. {
  18752. $home = Platform::getEnv('COMPOSER_HOME');
  18753. if ($home) {
  18754. return $home;
  18755. }
  18756. if (Platform::isWindows()) {
  18757. if (!Platform::getEnv('APPDATA')) {
  18758. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  18759. }
  18760. return rtrim(strtr(Platform::getEnv('APPDATA'), '\\', '/'), '/') . '/Composer';
  18761. }
  18762. $userDir = self::getUserDir();
  18763. $dirs = [];
  18764. if (self::useXdg()) {
  18765. $xdgConfig = Platform::getEnv('XDG_CONFIG_HOME');
  18766. if (!$xdgConfig) {
  18767. $xdgConfig = $userDir . '/.config';
  18768. }
  18769. $dirs[] = $xdgConfig . '/composer';
  18770. }
  18771. $dirs[] = $userDir . '/.composer';
  18772. foreach ($dirs as $dir) {
  18773. if (Silencer::call('is_dir', $dir)) {
  18774. return $dir;
  18775. }
  18776. }
  18777. return $dirs[0];
  18778. }
  18779. protected static function getCacheDir(string $home): string
  18780. {
  18781. $cacheDir = Platform::getEnv('COMPOSER_CACHE_DIR');
  18782. if ($cacheDir) {
  18783. return $cacheDir;
  18784. }
  18785. $homeEnv = Platform::getEnv('COMPOSER_HOME');
  18786. if ($homeEnv) {
  18787. return $homeEnv . '/cache';
  18788. }
  18789. if (Platform::isWindows()) {
  18790. if ($cacheDir = Platform::getEnv('LOCALAPPDATA')) {
  18791. $cacheDir .= '/Composer';
  18792. } else {
  18793. $cacheDir = $home . '/cache';
  18794. }
  18795. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  18796. }
  18797. $userDir = self::getUserDir();
  18798. if (PHP_OS === 'Darwin') {
  18799. if (is_dir($home . '/cache') && !is_dir($userDir . '/Library/Caches/composer')) {
  18800. Silencer::call('rename', $home . '/cache', $userDir . '/Library/Caches/composer');
  18801. }
  18802. return $userDir . '/Library/Caches/composer';
  18803. }
  18804. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  18805. return $home . '/cache';
  18806. }
  18807. if (self::useXdg()) {
  18808. $xdgCache = Platform::getEnv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  18809. return $xdgCache . '/composer';
  18810. }
  18811. return $home . '/cache';
  18812. }
  18813. protected static function getDataDir(string $home): string
  18814. {
  18815. $homeEnv = Platform::getEnv('COMPOSER_HOME');
  18816. if ($homeEnv) {
  18817. return $homeEnv;
  18818. }
  18819. if (Platform::isWindows()) {
  18820. return strtr($home, '\\', '/');
  18821. }
  18822. $userDir = self::getUserDir();
  18823. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  18824. $xdgData = Platform::getEnv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  18825. return $xdgData . '/composer';
  18826. }
  18827. return $home;
  18828. }
  18829. public static function createConfig(?IOInterface $io = null, ?string $cwd = null): Config
  18830. {
  18831. $cwd = $cwd ?? Platform::getCwd(true);
  18832. $config = new Config(true, $cwd);
  18833. $home = self::getHomeDir();
  18834. $config->merge([
  18835. 'config' => [
  18836. 'home' => $home,
  18837. 'cache-dir' => self::getCacheDir($home),
  18838. 'data-dir' => self::getDataDir($home),
  18839. ],
  18840. ], Config::SOURCE_DEFAULT);
  18841. $file = new JsonFile($config->get('home').'/config.json');
  18842. if ($file->exists()) {
  18843. if ($io instanceof IOInterface) {
  18844. $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
  18845. }
  18846. self::validateJsonSchema($io, $file);
  18847. $config->merge($file->read(), $file->getPath());
  18848. }
  18849. $config->setConfigSource(new JsonConfigSource($file));
  18850. $htaccessProtect = $config->get('htaccess-protect');
  18851. if ($htaccessProtect) {
  18852. $dirs = [$config->get('home'), $config->get('cache-dir'), $config->get('data-dir')];
  18853. foreach ($dirs as $dir) {
  18854. if (!file_exists($dir . '/.htaccess')) {
  18855. if (!is_dir($dir)) {
  18856. Silencer::call('mkdir', $dir, 0777, true);
  18857. }
  18858. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  18859. }
  18860. }
  18861. }
  18862. $file = new JsonFile($config->get('home').'/auth.json');
  18863. if ($file->exists()) {
  18864. if ($io instanceof IOInterface) {
  18865. $io->writeError('Loading config file ' . $file->getPath(), true, IOInterface::DEBUG);
  18866. }
  18867. self::validateJsonSchema($io, $file, JsonFile::AUTH_SCHEMA);
  18868. $config->merge(['config' => $file->read()], $file->getPath());
  18869. }
  18870. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  18871. self::loadComposerAuthEnv($config, $io);
  18872. return $config;
  18873. }
  18874. public static function getComposerFile(): string
  18875. {
  18876. $env = Platform::getEnv('COMPOSER');
  18877. if (is_string($env)) {
  18878. $env = trim($env);
  18879. if ('' !== $env) {
  18880. if (is_dir($env)) {
  18881. throw new \RuntimeException('The COMPOSER environment variable is set to '.$env.' which is a directory, this variable should point to a composer.json or be left unset.');
  18882. }
  18883. return $env;
  18884. }
  18885. }
  18886. return './composer.json';
  18887. }
  18888. public static function getLockFile(string $composerFile): string
  18889. {
  18890. return "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  18891. ? substr($composerFile, 0, -4).'lock'
  18892. : $composerFile . '.lock';
  18893. }
  18894. public static function createAdditionalStyles(): array
  18895. {
  18896. return [
  18897. 'highlight' => new OutputFormatterStyle('red'),
  18898. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  18899. ];
  18900. }
  18901. public static function createOutput(): ConsoleOutput
  18902. {
  18903. $styles = self::createAdditionalStyles();
  18904. $formatter = new OutputFormatter(false, $styles);
  18905. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  18906. }
  18907. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
  18908. {
  18909. if (is_string($localConfig) && is_file($localConfig) && null === $cwd) {
  18910. $cwd = dirname($localConfig);
  18911. }
  18912. $cwd = $cwd ?? Platform::getCwd(true);
  18913. if (null === $localConfig) {
  18914. $localConfig = static::getComposerFile();
  18915. }
  18916. $localConfigSource = Config::SOURCE_UNKNOWN;
  18917. if (is_string($localConfig)) {
  18918. $composerFile = $localConfig;
  18919. $file = new JsonFile($localConfig, null, $io);
  18920. if (!$file->exists()) {
  18921. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  18922. $message = 'Composer could not find a composer.json file in '.$cwd;
  18923. } else {
  18924. $message = 'Composer could not find the config file: '.$localConfig;
  18925. }
  18926. $instructions = $fullLoad ? 'To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage' : '';
  18927. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  18928. }
  18929. if (!Platform::isInputCompletionProcess()) {
  18930. try {
  18931. $file->validateSchema(JsonFile::LAX_SCHEMA);
  18932. } catch (JsonValidationException $e) {
  18933. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  18934. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  18935. throw new JsonValidationException($message);
  18936. }
  18937. }
  18938. $localConfig = $file->read();
  18939. $localConfigSource = $file->getPath();
  18940. }
  18941. $config = static::createConfig($io, $cwd);
  18942. $config->merge($localConfig, $localConfigSource);
  18943. if (isset($composerFile)) {
  18944. $io->writeError('Loading config file ' . $composerFile .' ('.realpath($composerFile).')', true, IOInterface::DEBUG);
  18945. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  18946. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  18947. if ($localAuthFile->exists()) {
  18948. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  18949. self::validateJsonSchema($io, $localAuthFile, JsonFile::AUTH_SCHEMA);
  18950. $config->merge(['config' => $localAuthFile->read()], $localAuthFile->getPath());
  18951. $config->setLocalAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  18952. }
  18953. }
  18954. self::loadComposerAuthEnv($config, $io);
  18955. $vendorDir = $config->get('vendor-dir');
  18956. $composer = $fullLoad ? new Composer() : new PartialComposer();
  18957. $composer->setConfig($config);
  18958. if ($fullLoad) {
  18959. $io->loadConfiguration($config);
  18960. if (false === $disablePlugins && false === $disableScripts && !class_exists('Composer\InstalledVersions', false) && file_exists($installedVersionsPath = $config->get('vendor-dir').'/composer/installed.php')) {
  18961. if (class_exists('Composer\InstalledVersions')) {
  18962. FilesystemRepository::safelyLoadInstalledVersions($installedVersionsPath);
  18963. }
  18964. }
  18965. }
  18966. $httpDownloader = self::createHttpDownloader($io, $config);
  18967. $process = new ProcessExecutor($io);
  18968. $loop = new Loop($httpDownloader, $process);
  18969. $composer->setLoop($loop);
  18970. $dispatcher = new EventDispatcher($composer, $io, $process);
  18971. $dispatcher->setRunScripts(!$disableScripts);
  18972. $composer->setEventDispatcher($dispatcher);
  18973. $rm = RepositoryFactory::manager($io, $config, $httpDownloader, $dispatcher, $process);
  18974. $composer->setRepositoryManager($rm);
  18975. if (!$fullLoad && !isset($localConfig['version'])) {
  18976. $localConfig['version'] = '1.0.0';
  18977. }
  18978. $parser = new VersionParser;
  18979. $guesser = new VersionGuesser($config, $process, $parser, $io);
  18980. $loader = $this->loadRootPackage($rm, $config, $parser, $guesser, $io);
  18981. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  18982. $composer->setPackage($package);
  18983. $this->addLocalRepository($io, $rm, $vendorDir, $package, $process);
  18984. $im = $this->createInstallationManager($loop, $io, $dispatcher);
  18985. $composer->setInstallationManager($im);
  18986. if ($composer instanceof Composer) {
  18987. $dm = $this->createDownloadManager($io, $config, $httpDownloader, $process, $dispatcher);
  18988. $composer->setDownloadManager($dm);
  18989. $generator = new AutoloadGenerator($dispatcher, $io);
  18990. $composer->setAutoloadGenerator($generator);
  18991. $am = $this->createArchiveManager($config, $dm, $loop);
  18992. $composer->setArchiveManager($am);
  18993. }
  18994. $this->createDefaultInstallers($im, $composer, $io, $process);
  18995. if ($composer instanceof Composer && isset($composerFile)) {
  18996. $lockFile = self::getLockFile($composerFile);
  18997. if (!$config->get('lock') && file_exists($lockFile)) {
  18998. $io->writeError('<warning>'.$lockFile.' is present but ignored as the "lock" config option is disabled.</warning>');
  18999. }
  19000. $locker = new Package\Locker($io, new JsonFile($config->get('lock') ? $lockFile : Platform::getDevNull(), null, $io), $im, file_get_contents($composerFile), $process);
  19001. $composer->setLocker($locker);
  19002. } elseif ($composer instanceof Composer) {
  19003. $locker = new Package\Locker($io, new JsonFile(Platform::getDevNull(), null, $io), $im, JsonFile::encode($localConfig), $process);
  19004. $composer->setLocker($locker);
  19005. }
  19006. if ($composer instanceof Composer) {
  19007. $globalComposer = null;
  19008. if (realpath($config->get('home')) !== $cwd) {
  19009. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins, $disableScripts);
  19010. }
  19011. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  19012. $composer->setPluginManager($pm);
  19013. if (realpath($config->get('home')) === $cwd) {
  19014. $pm->setRunningInGlobalDir(true);
  19015. }
  19016. $pm->loadInstalledPlugins();
  19017. }
  19018. if ($fullLoad) {
  19019. $initEvent = new Event(PluginEvents::INIT);
  19020. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  19021. $this->purgePackages($rm->getLocalRepository(), $im);
  19022. }
  19023. return $composer;
  19024. }
  19025. public static function createGlobal(IOInterface $io, bool $disablePlugins = false, bool $disableScripts = false): ?Composer
  19026. {
  19027. $factory = new static();
  19028. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true);
  19029. }
  19030. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, string $vendorDir, RootPackageInterface $rootPackage, ?ProcessExecutor $process = null): void
  19031. {
  19032. $fs = null;
  19033. if ($process) {
  19034. $fs = new Filesystem($process);
  19035. }
  19036. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io), true, $rootPackage, $fs));
  19037. }
  19038. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, bool $disableScripts, bool $fullLoad = false): ?PartialComposer
  19039. {
  19040. $disablePlugins = $disablePlugins === 'global' || $disablePlugins === true;
  19041. $composer = null;
  19042. try {
  19043. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad, $disableScripts);
  19044. } catch (\Exception $e) {
  19045. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  19046. }
  19047. return $composer;
  19048. }
  19049. public function createDownloadManager(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process, ?EventDispatcher $eventDispatcher = null): Downloader\DownloadManager
  19050. {
  19051. $cache = null;
  19052. if ($config->get('cache-files-ttl') > 0) {
  19053. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  19054. $cache->setReadOnly($config->get('cache-read-only'));
  19055. }
  19056. $fs = new Filesystem($process);
  19057. $dm = new Downloader\DownloadManager($io, false, $fs);
  19058. switch ($preferred = $config->get('preferred-install')) {
  19059. case 'dist':
  19060. $dm->setPreferDist(true);
  19061. break;
  19062. case 'source':
  19063. $dm->setPreferSource(true);
  19064. break;
  19065. case 'auto':
  19066. default:
  19067. break;
  19068. }
  19069. if (is_array($preferred)) {
  19070. $dm->setPreferences($preferred);
  19071. }
  19072. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $process, $fs));
  19073. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $process, $fs));
  19074. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $process, $fs));
  19075. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $process, $fs));
  19076. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config, $process, $fs));
  19077. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19078. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19079. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19080. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19081. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19082. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19083. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19084. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $httpDownloader, $eventDispatcher, $cache, $fs, $process));
  19085. return $dm;
  19086. }
  19087. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm, Loop $loop)
  19088. {
  19089. $am = new Archiver\ArchiveManager($dm, $loop);
  19090. if (class_exists(ZipArchive::class)) {
  19091. $am->addArchiver(new Archiver\ZipArchiver);
  19092. }
  19093. if (class_exists(Phar::class)) {
  19094. $am->addArchiver(new Archiver\PharArchiver);
  19095. }
  19096. return $am;
  19097. }
  19098. protected function createPluginManager(IOInterface $io, Composer $composer, ?PartialComposer $globalComposer = null, $disablePlugins = false): Plugin\PluginManager
  19099. {
  19100. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  19101. }
  19102. public function createInstallationManager(Loop $loop, IOInterface $io, ?EventDispatcher $eventDispatcher = null): Installer\InstallationManager
  19103. {
  19104. return new Installer\InstallationManager($loop, $io, $eventDispatcher);
  19105. }
  19106. protected function createDefaultInstallers(Installer\InstallationManager $im, PartialComposer $composer, IOInterface $io, ?ProcessExecutor $process = null): void
  19107. {
  19108. $fs = new Filesystem($process);
  19109. $binaryInstaller = new Installer\BinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $fs, rtrim($composer->getConfig()->get('vendor-dir'), '/'));
  19110. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null, $fs, $binaryInstaller));
  19111. $im->addInstaller(new Installer\PluginInstaller($io, $composer, $fs, $binaryInstaller));
  19112. $im->addInstaller(new Installer\MetapackageInstaller($io));
  19113. }
  19114. protected function purgePackages(InstalledRepositoryInterface $repo, Installer\InstallationManager $im): void
  19115. {
  19116. foreach ($repo->getPackages() as $package) {
  19117. if (!$im->isPackageInstalled($repo, $package)) {
  19118. $repo->removePackage($package);
  19119. }
  19120. }
  19121. }
  19122. protected function loadRootPackage(RepositoryManager $rm, Config $config, VersionParser $parser, VersionGuesser $guesser, IOInterface $io): Package\Loader\RootPackageLoader
  19123. {
  19124. return new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  19125. }
  19126. public static function create(IOInterface $io, $config = null, $disablePlugins = false, bool $disableScripts = false): Composer
  19127. {
  19128. $factory = new static();
  19129. if ($config !== null && $config !== self::getComposerFile() && $disablePlugins === false) {
  19130. $disablePlugins = 'local';
  19131. }
  19132. return $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
  19133. }
  19134. public static function createHttpDownloader(IOInterface $io, Config $config, array $options = []): HttpDownloader
  19135. {
  19136. static $warned = false;
  19137. $disableTls = false;
  19138. if (isset($_SERVER['argv']) && in_array('disable-tls', $_SERVER['argv']) && (in_array('conf', $_SERVER['argv']) || in_array('config', $_SERVER['argv']))) {
  19139. $warned = true;
  19140. $disableTls = !extension_loaded('openssl');
  19141. } elseif ($config->get('disable-tls') === true) {
  19142. if (!$warned) {
  19143. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  19144. }
  19145. $warned = true;
  19146. $disableTls = true;
  19147. } elseif (!extension_loaded('openssl')) {
  19148. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  19149. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  19150. }
  19151. $httpDownloaderOptions = [];
  19152. if ($disableTls === false) {
  19153. if ('' !== $config->get('cafile')) {
  19154. $httpDownloaderOptions['ssl']['cafile'] = $config->get('cafile');
  19155. }
  19156. if ('' !== $config->get('capath')) {
  19157. $httpDownloaderOptions['ssl']['capath'] = $config->get('capath');
  19158. }
  19159. $httpDownloaderOptions = array_replace_recursive($httpDownloaderOptions, $options);
  19160. }
  19161. try {
  19162. $httpDownloader = new HttpDownloader($io, $config, $httpDownloaderOptions, $disableTls);
  19163. } catch (TransportException $e) {
  19164. if (false !== strpos($e->getMessage(), 'cafile')) {
  19165. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  19166. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  19167. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  19168. }
  19169. throw $e;
  19170. }
  19171. return $httpDownloader;
  19172. }
  19173. private static function loadComposerAuthEnv(Config $config, ?IOInterface $io): void
  19174. {
  19175. $composerAuthEnv = Platform::getEnv('COMPOSER_AUTH');
  19176. if (false === $composerAuthEnv || '' === $composerAuthEnv) {
  19177. return;
  19178. }
  19179. $authData = json_decode($composerAuthEnv);
  19180. if (null === $authData) {
  19181. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  19182. }
  19183. if ($io instanceof IOInterface) {
  19184. $io->writeError('Loading auth config from COMPOSER_AUTH', true, IOInterface::DEBUG);
  19185. }
  19186. self::validateJsonSchema($io, $authData, JsonFile::AUTH_SCHEMA, 'COMPOSER_AUTH');
  19187. $authData = json_decode($composerAuthEnv, true);
  19188. if (null !== $authData) {
  19189. $config->merge(['config' => $authData], 'COMPOSER_AUTH');
  19190. }
  19191. }
  19192. private static function useXdg(): bool
  19193. {
  19194. foreach (array_keys($_SERVER) as $key) {
  19195. if (strpos((string) $key, 'XDG_') === 0) {
  19196. return true;
  19197. }
  19198. }
  19199. if (Silencer::call('is_dir', '/etc/xdg')) {
  19200. return true;
  19201. }
  19202. return false;
  19203. }
  19204. private static function getUserDir(): string
  19205. {
  19206. $home = Platform::getEnv('HOME');
  19207. if (!$home) {
  19208. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  19209. }
  19210. return rtrim(strtr($home, '\\', '/'), '/');
  19211. }
  19212. private static function validateJsonSchema(?IOInterface $io, $fileOrData, int $schema = JsonFile::LAX_SCHEMA, ?string $source = null): void
  19213. {
  19214. if (Platform::isInputCompletionProcess()) {
  19215. return;
  19216. }
  19217. try {
  19218. if ($fileOrData instanceof JsonFile) {
  19219. $fileOrData->validateSchema($schema);
  19220. } else {
  19221. if (null === $source) {
  19222. throw new \InvalidArgumentException('$source is required to be provided if $fileOrData is arbitrary data');
  19223. }
  19224. JsonFile::validateJsonSchema($source, $fileOrData, $schema);
  19225. }
  19226. } catch (JsonValidationException $e) {
  19227. $msg = $e->getMessage().', this may result in errors and should be resolved:'.PHP_EOL.' - '.implode(PHP_EOL.' - ', $e->getErrors());
  19228. if ($io instanceof IOInterface) {
  19229. $io->writeError('<warning>'.$msg.'</>');
  19230. } else {
  19231. throw new UnexpectedValueException($msg);
  19232. }
  19233. }
  19234. }
  19235. }
  19236. <?php declare(strict_types=1);
  19237. namespace Composer\Filter\PlatformRequirementFilter;
  19238. use Composer\Repository\PlatformRepository;
  19239. final class IgnoreAllPlatformRequirementFilter implements PlatformRequirementFilterInterface
  19240. {
  19241. public function isIgnored(string $req): bool
  19242. {
  19243. return PlatformRepository::isPlatformPackage($req);
  19244. }
  19245. public function isUpperBoundIgnored(string $req): bool
  19246. {
  19247. return $this->isIgnored($req);
  19248. }
  19249. }
  19250. <?php declare(strict_types=1);
  19251. namespace Composer\Filter\PlatformRequirementFilter;
  19252. use Composer\Package\BasePackage;
  19253. use Composer\Pcre\Preg;
  19254. use Composer\Repository\PlatformRepository;
  19255. use Composer\Semver\Constraint\Constraint;
  19256. use Composer\Semver\Constraint\ConstraintInterface;
  19257. use Composer\Semver\Constraint\MatchAllConstraint;
  19258. use Composer\Semver\Constraint\MultiConstraint;
  19259. use Composer\Semver\Interval;
  19260. use Composer\Semver\Intervals;
  19261. final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface
  19262. {
  19263. private $ignoreRegex;
  19264. private $ignoreUpperBoundRegex;
  19265. public function __construct(array $reqList)
  19266. {
  19267. $ignoreAll = $ignoreUpperBound = [];
  19268. foreach ($reqList as $req) {
  19269. if (substr($req, -1) === '+') {
  19270. $ignoreUpperBound[] = substr($req, 0, -1);
  19271. } else {
  19272. $ignoreAll[] = $req;
  19273. }
  19274. }
  19275. $this->ignoreRegex = BasePackage::packageNamesToRegexp($ignoreAll);
  19276. $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp($ignoreUpperBound);
  19277. }
  19278. public function isIgnored(string $req): bool
  19279. {
  19280. if (!PlatformRepository::isPlatformPackage($req)) {
  19281. return false;
  19282. }
  19283. return Preg::isMatch($this->ignoreRegex, $req);
  19284. }
  19285. public function isUpperBoundIgnored(string $req): bool
  19286. {
  19287. if (!PlatformRepository::isPlatformPackage($req)) {
  19288. return false;
  19289. }
  19290. return $this->isIgnored($req) || Preg::isMatch($this->ignoreUpperBoundRegex, $req);
  19291. }
  19292. public function filterConstraint(string $req, ConstraintInterface $constraint, bool $allowUpperBoundOverride = true): ConstraintInterface
  19293. {
  19294. if (!PlatformRepository::isPlatformPackage($req)) {
  19295. return $constraint;
  19296. }
  19297. if (!$allowUpperBoundOverride || !Preg::isMatch($this->ignoreUpperBoundRegex, $req)) {
  19298. return $constraint;
  19299. }
  19300. if (Preg::isMatch($this->ignoreRegex, $req)) {
  19301. return new MatchAllConstraint;
  19302. }
  19303. $intervals = Intervals::get($constraint);
  19304. $last = end($intervals['numeric']);
  19305. if ($last !== false && (string) $last->getEnd() !== (string) Interval::untilPositiveInfinity()) {
  19306. $constraint = new MultiConstraint([$constraint, new Constraint('>=', $last->getEnd()->getVersion())], false);
  19307. }
  19308. return $constraint;
  19309. }
  19310. }
  19311. <?php declare(strict_types=1);
  19312. namespace Composer\Filter\PlatformRequirementFilter;
  19313. final class IgnoreNothingPlatformRequirementFilter implements PlatformRequirementFilterInterface
  19314. {
  19315. public function isIgnored(string $req): bool
  19316. {
  19317. return false;
  19318. }
  19319. public function isUpperBoundIgnored(string $req): bool
  19320. {
  19321. return false;
  19322. }
  19323. }
  19324. <?php declare(strict_types=1);
  19325. namespace Composer\Filter\PlatformRequirementFilter;
  19326. final class PlatformRequirementFilterFactory
  19327. {
  19328. public static function fromBoolOrList($boolOrList): PlatformRequirementFilterInterface
  19329. {
  19330. if (is_bool($boolOrList)) {
  19331. return $boolOrList ? self::ignoreAll() : self::ignoreNothing();
  19332. }
  19333. if (is_array($boolOrList)) {
  19334. return new IgnoreListPlatformRequirementFilter($boolOrList);
  19335. }
  19336. throw new \InvalidArgumentException(
  19337. sprintf(
  19338. 'PlatformRequirementFilter: Unknown $boolOrList parameter %s. Please report at https://github.com/composer/composer/issues/new.',
  19339. gettype($boolOrList)
  19340. )
  19341. );
  19342. }
  19343. public static function ignoreAll(): PlatformRequirementFilterInterface
  19344. {
  19345. return new IgnoreAllPlatformRequirementFilter();
  19346. }
  19347. public static function ignoreNothing(): PlatformRequirementFilterInterface
  19348. {
  19349. return new IgnoreNothingPlatformRequirementFilter();
  19350. }
  19351. }
  19352. <?php declare(strict_types=1);
  19353. namespace Composer\Filter\PlatformRequirementFilter;
  19354. interface PlatformRequirementFilterInterface
  19355. {
  19356. public function isIgnored(string $req): bool;
  19357. public function isUpperBoundIgnored(string $req): bool;
  19358. }
  19359. <?php declare(strict_types=1);
  19360. namespace Composer\IO;
  19361. use Composer\Config;
  19362. use Composer\Pcre\Preg;
  19363. use Composer\Util\ProcessExecutor;
  19364. use Composer\Util\Silencer;
  19365. use Psr\Log\LogLevel;
  19366. abstract class BaseIO implements IOInterface
  19367. {
  19368. protected $authentications = [];
  19369. public function getAuthentications()
  19370. {
  19371. return $this->authentications;
  19372. }
  19373. public function resetAuthentications()
  19374. {
  19375. $this->authentications = [];
  19376. }
  19377. public function hasAuthentication($repositoryName)
  19378. {
  19379. return isset($this->authentications[$repositoryName]);
  19380. }
  19381. public function getAuthentication($repositoryName)
  19382. {
  19383. if (isset($this->authentications[$repositoryName])) {
  19384. return $this->authentications[$repositoryName];
  19385. }
  19386. return ['username' => null, 'password' => null];
  19387. }
  19388. public function setAuthentication($repositoryName, $username, $password = null)
  19389. {
  19390. $this->authentications[$repositoryName] = ['username' => $username, 'password' => $password];
  19391. }
  19392. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19393. {
  19394. $this->write($messages, $newline, $verbosity);
  19395. }
  19396. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19397. {
  19398. $this->writeError($messages, $newline, $verbosity);
  19399. }
  19400. protected function checkAndSetAuthentication(string $repositoryName, string $username, ?string $password = null)
  19401. {
  19402. if ($this->hasAuthentication($repositoryName)) {
  19403. $auth = $this->getAuthentication($repositoryName);
  19404. if ($auth['username'] === $username && $auth['password'] === $password) {
  19405. return;
  19406. }
  19407. $this->writeError(
  19408. sprintf(
  19409. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  19410. $repositoryName
  19411. )
  19412. );
  19413. }
  19414. $this->setAuthentication($repositoryName, $username, $password);
  19415. }
  19416. public function loadConfiguration(Config $config)
  19417. {
  19418. $bitbucketOauth = $config->get('bitbucket-oauth');
  19419. $githubOauth = $config->get('github-oauth');
  19420. $gitlabOauth = $config->get('gitlab-oauth');
  19421. $gitlabToken = $config->get('gitlab-token');
  19422. $httpBasic = $config->get('http-basic');
  19423. $bearerToken = $config->get('bearer');
  19424. foreach ($bitbucketOauth as $domain => $cred) {
  19425. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  19426. }
  19427. foreach ($githubOauth as $domain => $token) {
  19428. if ($domain !== 'github.com' && !in_array($domain, $config->get('github-domains'), true)) {
  19429. $this->debug($domain.' is not in the configured github-domains, adding it implicitly as authentication is configured for this domain');
  19430. $config->merge(['config' => ['github-domains' => array_merge($config->get('github-domains'), [$domain])]], 'implicit-due-to-auth');
  19431. }
  19432. if (!Preg::isMatch('{^[.A-Za-z0-9_]+$}', $token)) {
  19433. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  19434. }
  19435. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  19436. }
  19437. foreach ($gitlabOauth as $domain => $token) {
  19438. if ($domain !== 'gitlab.com' && !in_array($domain, $config->get('gitlab-domains'), true)) {
  19439. $this->debug($domain.' is not in the configured gitlab-domains, adding it implicitly as authentication is configured for this domain');
  19440. $config->merge(['config' => ['gitlab-domains' => array_merge($config->get('gitlab-domains'), [$domain])]], 'implicit-due-to-auth');
  19441. }
  19442. $token = is_array($token) ? $token["token"] : $token;
  19443. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  19444. }
  19445. foreach ($gitlabToken as $domain => $token) {
  19446. if ($domain !== 'gitlab.com' && !in_array($domain, $config->get('gitlab-domains'), true)) {
  19447. $this->debug($domain.' is not in the configured gitlab-domains, adding it implicitly as authentication is configured for this domain');
  19448. $config->merge(['config' => ['gitlab-domains' => array_merge($config->get('gitlab-domains'), [$domain])]], 'implicit-due-to-auth');
  19449. }
  19450. $username = is_array($token) ? $token["username"] : $token;
  19451. $password = is_array($token) ? $token["token"] : 'private-token';
  19452. $this->checkAndSetAuthentication($domain, $username, $password);
  19453. }
  19454. foreach ($httpBasic as $domain => $cred) {
  19455. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  19456. }
  19457. foreach ($bearerToken as $domain => $token) {
  19458. $this->checkAndSetAuthentication($domain, $token, 'bearer');
  19459. }
  19460. ProcessExecutor::setTimeout($config->get('process-timeout'));
  19461. }
  19462. public function emergency($message, array $context = []): void
  19463. {
  19464. $this->log(LogLevel::EMERGENCY, $message, $context);
  19465. }
  19466. public function alert($message, array $context = []): void
  19467. {
  19468. $this->log(LogLevel::ALERT, $message, $context);
  19469. }
  19470. public function critical($message, array $context = []): void
  19471. {
  19472. $this->log(LogLevel::CRITICAL, $message, $context);
  19473. }
  19474. public function error($message, array $context = []): void
  19475. {
  19476. $this->log(LogLevel::ERROR, $message, $context);
  19477. }
  19478. public function warning($message, array $context = []): void
  19479. {
  19480. $this->log(LogLevel::WARNING, $message, $context);
  19481. }
  19482. public function notice($message, array $context = []): void
  19483. {
  19484. $this->log(LogLevel::NOTICE, $message, $context);
  19485. }
  19486. public function info($message, array $context = []): void
  19487. {
  19488. $this->log(LogLevel::INFO, $message, $context);
  19489. }
  19490. public function debug($message, array $context = []): void
  19491. {
  19492. $this->log(LogLevel::DEBUG, $message, $context);
  19493. }
  19494. public function log($level, $message, array $context = []): void
  19495. {
  19496. $message = (string) $message;
  19497. if ($context !== []) {
  19498. $json = Silencer::call('json_encode', $context, JSON_INVALID_UTF8_IGNORE|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
  19499. if ($json !== false) {
  19500. $message .= ' ' . $json;
  19501. }
  19502. }
  19503. if (in_array($level, [LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR])) {
  19504. $this->writeError('<error>'.$message.'</error>');
  19505. } elseif ($level === LogLevel::WARNING) {
  19506. $this->writeError('<warning>'.$message.'</warning>');
  19507. } elseif ($level === LogLevel::NOTICE) {
  19508. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  19509. } elseif ($level === LogLevel::INFO) {
  19510. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  19511. } else {
  19512. $this->writeError($message, true, self::DEBUG);
  19513. }
  19514. }
  19515. }
  19516. <?php declare(strict_types=1);
  19517. namespace Composer\IO;
  19518. use Composer\Pcre\Preg;
  19519. use Symfony\Component\Console\Helper\QuestionHelper;
  19520. use Symfony\Component\Console\Input\InputInterface;
  19521. use Symfony\Component\Console\Output\OutputInterface;
  19522. use Symfony\Component\Console\Output\StreamOutput;
  19523. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  19524. use Symfony\Component\Console\Input\StreamableInputInterface;
  19525. use Symfony\Component\Console\Input\StringInput;
  19526. use Symfony\Component\Console\Helper\HelperSet;
  19527. class BufferIO extends ConsoleIO
  19528. {
  19529. public function __construct(string $input = '', int $verbosity = StreamOutput::VERBOSITY_NORMAL, ?OutputFormatterInterface $formatter = null)
  19530. {
  19531. $input = new StringInput($input);
  19532. $input->setInteractive(false);
  19533. $stream = fopen('php://memory', 'rw');
  19534. if ($stream === false) {
  19535. throw new \RuntimeException('Unable to open memory output stream');
  19536. }
  19537. $output = new StreamOutput($stream, $verbosity, $formatter !== null ? $formatter->isDecorated() : false, $formatter);
  19538. parent::__construct($input, $output, new HelperSet([
  19539. new QuestionHelper(),
  19540. ]));
  19541. }
  19542. public function getOutput(): string
  19543. {
  19544. assert($this->output instanceof StreamOutput);
  19545. fseek($this->output->getStream(), 0);
  19546. $output = (string) stream_get_contents($this->output->getStream());
  19547. $output = Preg::replaceCallback("{(?<=^|\n|\x08)(.+?)(\x08+)}", static function ($matches): string {
  19548. $pre = strip_tags($matches[1]);
  19549. if (strlen($pre) === strlen($matches[2])) {
  19550. return '';
  19551. }
  19552. return rtrim($matches[1])."\n";
  19553. }, $output);
  19554. return $output;
  19555. }
  19556. public function setUserInputs(array $inputs): void
  19557. {
  19558. if (!$this->input instanceof StreamableInputInterface) {
  19559. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  19560. }
  19561. $this->input->setStream($this->createStream($inputs));
  19562. $this->input->setInteractive(true);
  19563. }
  19564. private function createStream(array $inputs)
  19565. {
  19566. $stream = fopen('php://memory', 'r+');
  19567. if ($stream === false) {
  19568. throw new \RuntimeException('Unable to open memory output stream');
  19569. }
  19570. foreach ($inputs as $input) {
  19571. fwrite($stream, $input.PHP_EOL);
  19572. }
  19573. rewind($stream);
  19574. return $stream;
  19575. }
  19576. }
  19577. <?php declare(strict_types=1);
  19578. namespace Composer\IO;
  19579. use Composer\Question\StrictConfirmationQuestion;
  19580. use Symfony\Component\Console\Helper\HelperSet;
  19581. use Symfony\Component\Console\Helper\ProgressBar;
  19582. use Symfony\Component\Console\Helper\Table;
  19583. use Symfony\Component\Console\Input\InputInterface;
  19584. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  19585. use Symfony\Component\Console\Output\OutputInterface;
  19586. use Symfony\Component\Console\Question\ChoiceQuestion;
  19587. use Symfony\Component\Console\Question\Question;
  19588. class ConsoleIO extends BaseIO
  19589. {
  19590. protected $input;
  19591. protected $output;
  19592. protected $helperSet;
  19593. protected $lastMessage = '';
  19594. protected $lastMessageErr = '';
  19595. private $startTime;
  19596. private $verbosityMap;
  19597. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  19598. {
  19599. $this->input = $input;
  19600. $this->output = $output;
  19601. $this->helperSet = $helperSet;
  19602. $this->verbosityMap = [
  19603. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  19604. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  19605. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  19606. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  19607. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  19608. ];
  19609. }
  19610. public function enableDebugging(float $startTime)
  19611. {
  19612. $this->startTime = $startTime;
  19613. }
  19614. public function isInteractive()
  19615. {
  19616. return $this->input->isInteractive();
  19617. }
  19618. public function isDecorated()
  19619. {
  19620. return $this->output->isDecorated();
  19621. }
  19622. public function isVerbose()
  19623. {
  19624. return $this->output->isVerbose();
  19625. }
  19626. public function isVeryVerbose()
  19627. {
  19628. return $this->output->isVeryVerbose();
  19629. }
  19630. public function isDebug()
  19631. {
  19632. return $this->output->isDebug();
  19633. }
  19634. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19635. {
  19636. $this->doWrite($messages, $newline, false, $verbosity);
  19637. }
  19638. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19639. {
  19640. $this->doWrite($messages, $newline, true, $verbosity);
  19641. }
  19642. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19643. {
  19644. $this->doWrite($messages, $newline, false, $verbosity, true);
  19645. }
  19646. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
  19647. {
  19648. $this->doWrite($messages, $newline, true, $verbosity, true);
  19649. }
  19650. private function doWrite($messages, bool $newline, bool $stderr, int $verbosity, bool $raw = false): void
  19651. {
  19652. $sfVerbosity = $this->verbosityMap[$verbosity];
  19653. if ($sfVerbosity > $this->output->getVerbosity()) {
  19654. return;
  19655. }
  19656. if ($raw) {
  19657. $sfVerbosity |= OutputInterface::OUTPUT_RAW;
  19658. }
  19659. if (null !== $this->startTime) {
  19660. $memoryUsage = memory_get_usage() / 1024 / 1024;
  19661. $timeSpent = microtime(true) - $this->startTime;
  19662. $messages = array_map(static function ($message) use ($memoryUsage, $timeSpent): string {
  19663. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  19664. }, (array) $messages);
  19665. }
  19666. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  19667. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  19668. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  19669. return;
  19670. }
  19671. $this->output->write($messages, $newline, $sfVerbosity);
  19672. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  19673. }
  19674. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
  19675. {
  19676. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  19677. }
  19678. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
  19679. {
  19680. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  19681. }
  19682. private function doOverwrite($messages, bool $newline, ?int $size, bool $stderr, int $verbosity): void
  19683. {
  19684. $messages = implode($newline ? "\n" : '', (array) $messages);
  19685. if (!isset($size)) {
  19686. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  19687. }
  19688. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  19689. $this->doWrite($messages, false, $stderr, $verbosity);
  19690. $fill = $size - strlen(strip_tags($messages));
  19691. if ($fill > 0) {
  19692. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  19693. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  19694. }
  19695. if ($newline) {
  19696. $this->doWrite('', true, $stderr, $verbosity);
  19697. }
  19698. if ($stderr) {
  19699. $this->lastMessageErr = $messages;
  19700. } else {
  19701. $this->lastMessage = $messages;
  19702. }
  19703. }
  19704. public function getProgressBar(int $max = 0)
  19705. {
  19706. return new ProgressBar($this->getErrorOutput(), $max);
  19707. }
  19708. public function ask($question, $default = null)
  19709. {
  19710. $helper = $this->helperSet->get('question');
  19711. $question = new Question($question, $default);
  19712. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19713. }
  19714. public function askConfirmation($question, $default = true)
  19715. {
  19716. $helper = $this->helperSet->get('question');
  19717. $question = new StrictConfirmationQuestion($question, $default);
  19718. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19719. }
  19720. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  19721. {
  19722. $helper = $this->helperSet->get('question');
  19723. $question = new Question($question, $default);
  19724. $question->setValidator($validator);
  19725. $question->setMaxAttempts($attempts);
  19726. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19727. }
  19728. public function askAndHideAnswer($question)
  19729. {
  19730. $helper = $this->helperSet->get('question');
  19731. $question = new Question($question);
  19732. $question->setHidden(true);
  19733. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  19734. }
  19735. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  19736. {
  19737. $helper = $this->helperSet->get('question');
  19738. $question = new ChoiceQuestion($question, $choices, $default);
  19739. $question->setMaxAttempts($attempts ?: null);
  19740. $question->setErrorMessage($errorMessage);
  19741. $question->setMultiselect($multiselect);
  19742. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  19743. $isAssoc = (bool) \count(array_filter(array_keys($choices), 'is_string'));
  19744. if ($isAssoc) {
  19745. return $result;
  19746. }
  19747. if (!is_array($result)) {
  19748. return (string) array_search($result, $choices, true);
  19749. }
  19750. $results = [];
  19751. foreach ($choices as $index => $choice) {
  19752. if (in_array($choice, $result, true)) {
  19753. $results[] = (string) $index;
  19754. }
  19755. }
  19756. return $results;
  19757. }
  19758. public function getTable(): Table
  19759. {
  19760. return new Table($this->output);
  19761. }
  19762. private function getErrorOutput(): OutputInterface
  19763. {
  19764. if ($this->output instanceof ConsoleOutputInterface) {
  19765. return $this->output->getErrorOutput();
  19766. }
  19767. return $this->output;
  19768. }
  19769. }
  19770. <?php declare(strict_types=1);
  19771. namespace Composer\IO;
  19772. use Composer\Config;
  19773. use Psr\Log\LoggerInterface;
  19774. interface IOInterface extends LoggerInterface
  19775. {
  19776. public const QUIET = 1;
  19777. public const NORMAL = 2;
  19778. public const VERBOSE = 4;
  19779. public const VERY_VERBOSE = 8;
  19780. public const DEBUG = 16;
  19781. public function isInteractive();
  19782. public function isVerbose();
  19783. public function isVeryVerbose();
  19784. public function isDebug();
  19785. public function isDecorated();
  19786. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19787. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19788. public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19789. public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL);
  19790. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
  19791. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL);
  19792. public function ask(string $question, $default = null);
  19793. public function askConfirmation(string $question, bool $default = true);
  19794. public function askAndValidate(string $question, callable $validator, ?int $attempts = null, $default = null);
  19795. public function askAndHideAnswer(string $question);
  19796. public function select(string $question, array $choices, $default, $attempts = false, string $errorMessage = 'Value "%s" is invalid', bool $multiselect = false);
  19797. public function getAuthentications();
  19798. public function hasAuthentication(string $repositoryName);
  19799. public function getAuthentication(string $repositoryName);
  19800. public function setAuthentication(string $repositoryName, string $username, ?string $password = null);
  19801. public function loadConfiguration(Config $config);
  19802. }
  19803. <?php declare(strict_types=1);
  19804. namespace Composer\IO;
  19805. class NullIO extends BaseIO
  19806. {
  19807. public function isInteractive(): bool
  19808. {
  19809. return false;
  19810. }
  19811. public function isVerbose(): bool
  19812. {
  19813. return false;
  19814. }
  19815. public function isVeryVerbose(): bool
  19816. {
  19817. return false;
  19818. }
  19819. public function isDebug(): bool
  19820. {
  19821. return false;
  19822. }
  19823. public function isDecorated(): bool
  19824. {
  19825. return false;
  19826. }
  19827. public function write($messages, bool $newline = true, int $verbosity = self::NORMAL): void
  19828. {
  19829. }
  19830. public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL): void
  19831. {
  19832. }
  19833. public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
  19834. {
  19835. }
  19836. public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL): void
  19837. {
  19838. }
  19839. public function ask($question, $default = null)
  19840. {
  19841. return $default;
  19842. }
  19843. public function askConfirmation($question, $default = true): bool
  19844. {
  19845. return $default;
  19846. }
  19847. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  19848. {
  19849. return $default;
  19850. }
  19851. public function askAndHideAnswer($question): ?string
  19852. {
  19853. return null;
  19854. }
  19855. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  19856. {
  19857. return $default;
  19858. }
  19859. }
  19860. <?php declare(strict_types=1);
  19861. namespace Composer;
  19862. use Composer\Autoload\AutoloadGenerator;
  19863. use Composer\Console\GithubActionError;
  19864. use Composer\DependencyResolver\DefaultPolicy;
  19865. use Composer\DependencyResolver\LocalRepoTransaction;
  19866. use Composer\DependencyResolver\LockTransaction;
  19867. use Composer\DependencyResolver\Operation\UpdateOperation;
  19868. use Composer\DependencyResolver\Operation\InstallOperation;
  19869. use Composer\DependencyResolver\Operation\UninstallOperation;
  19870. use Composer\DependencyResolver\PoolOptimizer;
  19871. use Composer\DependencyResolver\Pool;
  19872. use Composer\DependencyResolver\Request;
  19873. use Composer\DependencyResolver\Solver;
  19874. use Composer\DependencyResolver\SolverProblemsException;
  19875. use Composer\DependencyResolver\PolicyInterface;
  19876. use Composer\Downloader\DownloadManager;
  19877. use Composer\Downloader\TransportException;
  19878. use Composer\EventDispatcher\EventDispatcher;
  19879. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  19880. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  19881. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  19882. use Composer\Installer\InstallationManager;
  19883. use Composer\Installer\InstallerEvents;
  19884. use Composer\Installer\SuggestedPackagesReporter;
  19885. use Composer\IO\IOInterface;
  19886. use Composer\Package\AliasPackage;
  19887. use Composer\Package\RootAliasPackage;
  19888. use Composer\Package\BasePackage;
  19889. use Composer\Package\CompletePackage;
  19890. use Composer\Package\CompletePackageInterface;
  19891. use Composer\Package\Link;
  19892. use Composer\Package\Loader\ArrayLoader;
  19893. use Composer\Package\Dumper\ArrayDumper;
  19894. use Composer\Package\Version\VersionParser;
  19895. use Composer\Package\Package;
  19896. use Composer\Repository\ArrayRepository;
  19897. use Composer\Repository\RepositorySet;
  19898. use Composer\Repository\CompositeRepository;
  19899. use Composer\Semver\Constraint\Constraint;
  19900. use Composer\Package\Locker;
  19901. use Composer\Package\RootPackageInterface;
  19902. use Composer\Repository\InstalledArrayRepository;
  19903. use Composer\Repository\InstalledRepositoryInterface;
  19904. use Composer\Repository\InstalledRepository;
  19905. use Composer\Repository\RootPackageRepository;
  19906. use Composer\Repository\PlatformRepository;
  19907. use Composer\Repository\RepositoryInterface;
  19908. use Composer\Repository\RepositoryManager;
  19909. use Composer\Repository\LockArrayRepository;
  19910. use Composer\Script\ScriptEvents;
  19911. use Composer\Semver\Constraint\ConstraintInterface;
  19912. use Composer\Advisory\Auditor;
  19913. use Composer\Util\Platform;
  19914. class Installer
  19915. {
  19916. public const ERROR_NONE = 0;
  19917. public const ERROR_GENERIC_FAILURE = 1;
  19918. public const ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE = 3;
  19919. public const ERROR_LOCK_FILE_INVALID = 4;
  19920. public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2;
  19921. public const ERROR_AUDIT_FAILED = 5;
  19922. public const ERROR_TRANSPORT_EXCEPTION = 100;
  19923. protected $io;
  19924. protected $config;
  19925. protected $package;
  19926. protected $fixedRootPackage;
  19927. protected $downloadManager;
  19928. protected $repositoryManager;
  19929. protected $locker;
  19930. protected $installationManager;
  19931. protected $eventDispatcher;
  19932. protected $autoloadGenerator;
  19933. protected $preferSource = false;
  19934. protected $preferDist = false;
  19935. protected $optimizeAutoloader = false;
  19936. protected $classMapAuthoritative = false;
  19937. protected $apcuAutoloader = false;
  19938. protected $apcuAutoloaderPrefix = null;
  19939. protected $devMode = false;
  19940. protected $dryRun = false;
  19941. protected $downloadOnly = false;
  19942. protected $verbose = false;
  19943. protected $update = false;
  19944. protected $install = true;
  19945. protected $dumpAutoloader = true;
  19946. protected $runScripts = true;
  19947. protected $preferStable = false;
  19948. protected $preferLowest = false;
  19949. protected $minimalUpdate = false;
  19950. protected $writeLock;
  19951. protected $executeOperations = true;
  19952. protected $audit = true;
  19953. protected $errorOnAudit = false;
  19954. protected $auditFormat = Auditor::FORMAT_SUMMARY;
  19955. private $ignoredTypes = ['php-ext', 'php-ext-zend'];
  19956. private $allowedTypes = null;
  19957. protected $updateMirrors = false;
  19958. protected $updateAllowList = null;
  19959. protected $updateAllowTransitiveDependencies = Request::UPDATE_ONLY_LISTED;
  19960. protected $suggestedPackagesReporter;
  19961. protected $platformRequirementFilter;
  19962. protected $additionalFixedRepository;
  19963. protected $temporaryConstraints = [];
  19964. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  19965. {
  19966. $this->io = $io;
  19967. $this->config = $config;
  19968. $this->package = $package;
  19969. $this->downloadManager = $downloadManager;
  19970. $this->repositoryManager = $repositoryManager;
  19971. $this->locker = $locker;
  19972. $this->installationManager = $installationManager;
  19973. $this->eventDispatcher = $eventDispatcher;
  19974. $this->autoloadGenerator = $autoloadGenerator;
  19975. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  19976. $this->platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  19977. $this->writeLock = $config->get('lock');
  19978. }
  19979. public function run(): int
  19980. {
  19981. gc_collect_cycles();
  19982. gc_disable();
  19983. if ($this->updateAllowList !== null && $this->updateMirrors) {
  19984. throw new \RuntimeException("The installer options updateMirrors and updateAllowList are mutually exclusive.");
  19985. }
  19986. $isFreshInstall = $this->repositoryManager->getLocalRepository()->isFresh();
  19987. if (!$this->update && !$this->locker->isLocked()) {
  19988. $this->io->writeError('<warning>No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.</warning>');
  19989. $this->update = true;
  19990. }
  19991. if ($this->dryRun) {
  19992. $this->verbose = true;
  19993. $this->runScripts = false;
  19994. $this->executeOperations = false;
  19995. $this->writeLock = false;
  19996. $this->dumpAutoloader = false;
  19997. $this->mockLocalRepositories($this->repositoryManager);
  19998. }
  19999. if ($this->downloadOnly) {
  20000. $this->dumpAutoloader = false;
  20001. }
  20002. if ($this->update && !$this->install) {
  20003. $this->dumpAutoloader = false;
  20004. }
  20005. if ($this->runScripts) {
  20006. Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
  20007. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  20008. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  20009. }
  20010. $this->downloadManager->setPreferSource($this->preferSource);
  20011. $this->downloadManager->setPreferDist($this->preferDist);
  20012. $localRepo = $this->repositoryManager->getLocalRepository();
  20013. try {
  20014. if ($this->update) {
  20015. $res = $this->doUpdate($localRepo, $this->install);
  20016. } else {
  20017. $res = $this->doInstall($localRepo);
  20018. }
  20019. if ($res !== 0) {
  20020. return $res;
  20021. }
  20022. } catch (\Exception $e) {
  20023. if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
  20024. $this->installationManager->notifyInstalls($this->io);
  20025. }
  20026. throw $e;
  20027. }
  20028. if ($this->executeOperations && $this->install && $this->config->get('notify-on-install')) {
  20029. $this->installationManager->notifyInstalls($this->io);
  20030. }
  20031. if ($this->update) {
  20032. $installedRepo = new InstalledRepository([
  20033. $this->locker->getLockedRepository($this->devMode),
  20034. $this->createPlatformRepo(false),
  20035. new RootPackageRepository(clone $this->package),
  20036. ]);
  20037. if ($isFreshInstall) {
  20038. $this->suggestedPackagesReporter->addSuggestionsFromPackage($this->package);
  20039. }
  20040. $this->suggestedPackagesReporter->outputMinimalistic($installedRepo);
  20041. }
  20042. $lockedRepository = $this->locker->getLockedRepository(true);
  20043. foreach ($lockedRepository->getPackages() as $package) {
  20044. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  20045. continue;
  20046. }
  20047. $replacement = is_string($package->getReplacementPackage())
  20048. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  20049. : 'No replacement was suggested';
  20050. $this->io->writeError(
  20051. sprintf(
  20052. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  20053. $package->getPrettyName(),
  20054. $replacement
  20055. )
  20056. );
  20057. }
  20058. if ($this->dumpAutoloader) {
  20059. if ($this->optimizeAutoloader) {
  20060. $this->io->writeError('<info>Generating optimized autoload files</info>');
  20061. } else {
  20062. $this->io->writeError('<info>Generating autoload files</info>');
  20063. }
  20064. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  20065. $this->autoloadGenerator->setApcu($this->apcuAutoloader, $this->apcuAutoloaderPrefix);
  20066. $this->autoloadGenerator->setRunScripts($this->runScripts);
  20067. $this->autoloadGenerator->setPlatformRequirementFilter($this->platformRequirementFilter);
  20068. $this
  20069. ->autoloadGenerator
  20070. ->dump(
  20071. $this->config,
  20072. $localRepo,
  20073. $this->package,
  20074. $this->installationManager,
  20075. 'composer',
  20076. $this->optimizeAutoloader,
  20077. null,
  20078. $this->locker
  20079. );
  20080. }
  20081. if ($this->install && $this->executeOperations) {
  20082. foreach ($localRepo->getPackages() as $package) {
  20083. $this->installationManager->ensureBinariesPresence($package);
  20084. }
  20085. }
  20086. $fundEnv = Platform::getEnv('COMPOSER_FUND');
  20087. $showFunding = true;
  20088. if (is_numeric($fundEnv)) {
  20089. $showFunding = intval($fundEnv) !== 0;
  20090. }
  20091. if ($showFunding) {
  20092. $fundingCount = 0;
  20093. foreach ($localRepo->getPackages() as $package) {
  20094. if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
  20095. $fundingCount++;
  20096. }
  20097. }
  20098. if ($fundingCount > 0) {
  20099. $this->io->writeError([
  20100. sprintf(
  20101. "<info>%d package%s you are using %s looking for funding.</info>",
  20102. $fundingCount,
  20103. 1 === $fundingCount ? '' : 's',
  20104. 1 === $fundingCount ? 'is' : 'are'
  20105. ),
  20106. '<info>Use the `composer fund` command to find out more!</info>',
  20107. ]);
  20108. }
  20109. }
  20110. if ($this->runScripts) {
  20111. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  20112. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  20113. }
  20114. if (!defined('HHVM_VERSION')) {
  20115. gc_enable();
  20116. }
  20117. if ($this->audit) {
  20118. if ($this->update && !$this->install) {
  20119. $packages = $lockedRepository->getCanonicalPackages();
  20120. $target = 'locked';
  20121. } else {
  20122. $packages = $localRepo->getCanonicalPackages();
  20123. $target = 'installed';
  20124. }
  20125. if (count($packages) > 0) {
  20126. try {
  20127. $auditor = new Auditor();
  20128. $repoSet = new RepositorySet();
  20129. foreach ($this->repositoryManager->getRepositories() as $repo) {
  20130. $repoSet->addRepository($repo);
  20131. }
  20132. $auditConfig = $this->config->get('audit');
  20133. return $auditor->audit($this->io, $repoSet, $packages, $this->auditFormat, true, $auditConfig['ignore'] ?? [], $auditConfig['abandoned'] ?? Auditor::ABANDONED_FAIL) > 0 && $this->errorOnAudit ? self::ERROR_AUDIT_FAILED : 0;
  20134. } catch (TransportException $e) {
  20135. $this->io->error('Failed to audit '.$target.' packages.');
  20136. if ($this->io->isVerbose()) {
  20137. $this->io->error('['.get_class($e).'] '.$e->getMessage());
  20138. }
  20139. }
  20140. } else {
  20141. $this->io->writeError('No '.$target.' packages - skipping audit.');
  20142. }
  20143. }
  20144. return 0;
  20145. }
  20146. protected function doUpdate(InstalledRepositoryInterface $localRepo, bool $doInstall): int
  20147. {
  20148. $platformRepo = $this->createPlatformRepo(true);
  20149. $aliases = $this->getRootAliases(true);
  20150. $lockedRepository = null;
  20151. try {
  20152. if ($this->locker->isLocked()) {
  20153. $lockedRepository = $this->locker->getLockedRepository(true);
  20154. }
  20155. } catch (\Seld\JsonLint\ParsingException $e) {
  20156. if ($this->updateAllowList !== null || $this->updateMirrors) {
  20157. throw $e;
  20158. }
  20159. }
  20160. if (($this->updateAllowList !== null || $this->updateMirrors) && !$lockedRepository) {
  20161. $this->io->writeError('<error>Cannot update ' . ($this->updateMirrors ? 'lock file information' : 'only a partial set of packages') . ' without a lock file present. Run `composer update` to generate a lock file.</error>', true, IOInterface::QUIET);
  20162. return self::ERROR_NO_LOCK_FILE_FOR_PARTIAL_UPDATE;
  20163. }
  20164. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  20165. $policy = $this->createPolicy(true, $lockedRepository);
  20166. $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
  20167. $repositories = $this->repositoryManager->getRepositories();
  20168. foreach ($repositories as $repository) {
  20169. $repositorySet->addRepository($repository);
  20170. }
  20171. if ($lockedRepository) {
  20172. $repositorySet->addRepository($lockedRepository);
  20173. }
  20174. $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
  20175. $this->requirePackagesForUpdate($request, $lockedRepository, true);
  20176. if ($this->updateAllowList !== null) {
  20177. $request->setUpdateAllowList($this->updateAllowList, $this->updateAllowTransitiveDependencies);
  20178. }
  20179. $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher, $this->createPoolOptimizer($policy), $this->ignoredTypes, $this->allowedTypes);
  20180. $this->io->writeError('<info>Updating dependencies</info>');
  20181. $solver = new Solver($policy, $pool, $this->io);
  20182. try {
  20183. $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  20184. $ruleSetSize = $solver->getRuleSetSize();
  20185. $solver = null;
  20186. } catch (SolverProblemsException $e) {
  20187. $err = 'Your requirements could not be resolved to an installable set of packages.';
  20188. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
  20189. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  20190. $this->io->writeError($prettyProblem);
  20191. if (!$this->devMode) {
  20192. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  20193. }
  20194. $ghe = new GithubActionError($this->io);
  20195. $ghe->emit($err."\n".$prettyProblem);
  20196. return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
  20197. }
  20198. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  20199. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  20200. $pool = null;
  20201. if (!$lockTransaction->getOperations()) {
  20202. $this->io->writeError('Nothing to modify in lock file');
  20203. }
  20204. $exitCode = $this->extractDevPackages($lockTransaction, $platformRepo, $aliases, $policy, $lockedRepository);
  20205. if ($exitCode !== 0) {
  20206. return $exitCode;
  20207. }
  20208. \Composer\Semver\CompilingMatcher::clear();
  20209. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  20210. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  20211. $installsUpdates = $uninstalls = [];
  20212. if ($lockTransaction->getOperations()) {
  20213. $installNames = $updateNames = $uninstallNames = [];
  20214. foreach ($lockTransaction->getOperations() as $operation) {
  20215. if ($operation instanceof InstallOperation) {
  20216. $installsUpdates[] = $operation;
  20217. $installNames[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  20218. } elseif ($operation instanceof UpdateOperation) {
  20219. if ($this->updateMirrors
  20220. && $operation->getInitialPackage()->getName() === $operation->getTargetPackage()->getName()
  20221. && $operation->getInitialPackage()->getVersion() === $operation->getTargetPackage()->getVersion()
  20222. ) {
  20223. continue;
  20224. }
  20225. $installsUpdates[] = $operation;
  20226. $updateNames[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  20227. } elseif ($operation instanceof UninstallOperation) {
  20228. $uninstalls[] = $operation;
  20229. $uninstallNames[] = $operation->getPackage()->getPrettyName();
  20230. }
  20231. }
  20232. if ($this->config->get('lock')) {
  20233. $this->io->writeError(sprintf(
  20234. "<info>Lock file operations: %d install%s, %d update%s, %d removal%s</info>",
  20235. count($installNames),
  20236. 1 === count($installNames) ? '' : 's',
  20237. count($updateNames),
  20238. 1 === count($updateNames) ? '' : 's',
  20239. count($uninstalls),
  20240. 1 === count($uninstalls) ? '' : 's'
  20241. ));
  20242. if ($installNames) {
  20243. $this->io->writeError("Installs: ".implode(', ', $installNames), true, IOInterface::VERBOSE);
  20244. }
  20245. if ($updateNames) {
  20246. $this->io->writeError("Updates: ".implode(', ', $updateNames), true, IOInterface::VERBOSE);
  20247. }
  20248. if ($uninstalls) {
  20249. $this->io->writeError("Removals: ".implode(', ', $uninstallNames), true, IOInterface::VERBOSE);
  20250. }
  20251. }
  20252. }
  20253. $sortByName = static function ($a, $b): int {
  20254. if ($a instanceof UpdateOperation) {
  20255. $a = $a->getTargetPackage()->getName();
  20256. } else {
  20257. $a = $a->getPackage()->getName();
  20258. }
  20259. if ($b instanceof UpdateOperation) {
  20260. $b = $b->getTargetPackage()->getName();
  20261. } else {
  20262. $b = $b->getPackage()->getName();
  20263. }
  20264. return strcmp($a, $b);
  20265. };
  20266. usort($uninstalls, $sortByName);
  20267. usort($installsUpdates, $sortByName);
  20268. foreach (array_merge($uninstalls, $installsUpdates) as $operation) {
  20269. if ($operation instanceof InstallOperation) {
  20270. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  20271. }
  20272. if ($this->config->get('lock') && (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug())) {
  20273. $sourceRepo = '';
  20274. if ($this->io->isVeryVerbose() && false === strpos($operation->getOperationType(), 'Alias')) {
  20275. $operationPkg = ($operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage());
  20276. if ($operationPkg->getRepository() !== null) {
  20277. $sourceRepo = ' from ' . $operationPkg->getRepository()->getRepoName();
  20278. }
  20279. }
  20280. $this->io->writeError(' - ' . $operation->show(true) . $sourceRepo);
  20281. }
  20282. }
  20283. $updatedLock = $this->locker->setLockData(
  20284. $lockTransaction->getNewLockPackages(false, $this->updateMirrors),
  20285. $lockTransaction->getNewLockPackages(true, $this->updateMirrors),
  20286. $platformReqs,
  20287. $platformDevReqs,
  20288. $lockTransaction->getAliases($aliases),
  20289. $this->package->getMinimumStability(),
  20290. $this->package->getStabilityFlags(),
  20291. $this->preferStable || $this->package->getPreferStable(),
  20292. $this->preferLowest,
  20293. $this->config->get('platform') ?: [],
  20294. $this->writeLock && $this->executeOperations
  20295. );
  20296. if ($updatedLock && $this->writeLock && $this->executeOperations) {
  20297. $this->io->writeError('<info>Writing lock file</info>');
  20298. }
  20299. if ($doInstall) {
  20300. return $this->doInstall($localRepo, true);
  20301. }
  20302. return 0;
  20303. }
  20304. protected function extractDevPackages(LockTransaction $lockTransaction, PlatformRepository $platformRepo, array $aliases, PolicyInterface $policy, ?LockArrayRepository $lockedRepository = null): int
  20305. {
  20306. if (!$this->package->getDevRequires()) {
  20307. return 0;
  20308. }
  20309. $resultRepo = new ArrayRepository([]);
  20310. $loader = new ArrayLoader(null, true);
  20311. $dumper = new ArrayDumper();
  20312. foreach ($lockTransaction->getNewLockPackages(false) as $pkg) {
  20313. $resultRepo->addPackage($loader->load($dumper->dump($pkg)));
  20314. }
  20315. $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
  20316. $repositorySet->addRepository($resultRepo);
  20317. $request = $this->createRequest($this->fixedRootPackage, $platformRepo);
  20318. $this->requirePackagesForUpdate($request, $lockedRepository, false);
  20319. $pool = $repositorySet->createPoolWithAllPackages();
  20320. $solver = new Solver($policy, $pool, $this->io);
  20321. try {
  20322. $nonDevLockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  20323. $solver = null;
  20324. } catch (SolverProblemsException $e) {
  20325. $err = 'Unable to find a compatible set of packages based on your non-dev requirements alone.';
  20326. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose(), true);
  20327. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  20328. $this->io->writeError('Your requirements can be resolved successfully when require-dev packages are present.');
  20329. $this->io->writeError('You may need to move packages from require-dev or some of their dependencies to require.');
  20330. $this->io->writeError($prettyProblem);
  20331. $ghe = new GithubActionError($this->io);
  20332. $ghe->emit($err."\n".$prettyProblem);
  20333. return $e->getCode();
  20334. }
  20335. $lockTransaction->setNonDevPackages($nonDevLockTransaction);
  20336. return 0;
  20337. }
  20338. protected function doInstall(InstalledRepositoryInterface $localRepo, bool $alreadySolved = false): int
  20339. {
  20340. if ($this->config->get('lock')) {
  20341. $this->io->writeError('<info>Installing dependencies from lock file'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  20342. }
  20343. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  20344. if (!$alreadySolved) {
  20345. $this->io->writeError('<info>Verifying lock file contents can be installed on current platform.</info>');
  20346. $platformRepo = $this->createPlatformRepo(false);
  20347. $policy = $this->createPolicy(false);
  20348. $repositorySet = $this->createRepositorySet(false, $platformRepo, [], $lockedRepository);
  20349. $repositorySet->addRepository($lockedRepository);
  20350. $request = $this->createRequest($this->fixedRootPackage, $platformRepo, $lockedRepository);
  20351. if (!$this->locker->isFresh()) {
  20352. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.</warning>', true, IOInterface::QUIET);
  20353. }
  20354. $missingRequirementInfo = $this->locker->getMissingRequirementInfo($this->package, $this->devMode);
  20355. if ($missingRequirementInfo !== []) {
  20356. $this->io->writeError($missingRequirementInfo);
  20357. if (!$this->config->get('allow-missing-requirements')) {
  20358. return self::ERROR_LOCK_FILE_INVALID;
  20359. }
  20360. }
  20361. foreach ($lockedRepository->getPackages() as $package) {
  20362. $request->fixLockedPackage($package);
  20363. }
  20364. $rootRequires = $this->package->getRequires();
  20365. if ($this->devMode) {
  20366. $rootRequires = array_merge($rootRequires, $this->package->getDevRequires());
  20367. }
  20368. foreach ($rootRequires as $link) {
  20369. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  20370. $request->requireName($link->getTarget(), $link->getConstraint());
  20371. }
  20372. }
  20373. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  20374. if (!isset($rootRequires[$link->getTarget()])) {
  20375. $request->requireName($link->getTarget(), $link->getConstraint());
  20376. }
  20377. }
  20378. unset($rootRequires, $link);
  20379. $pool = $repositorySet->createPool($request, $this->io, $this->eventDispatcher, null, $this->ignoredTypes, $this->allowedTypes);
  20380. $solver = new Solver($policy, $pool, $this->io);
  20381. try {
  20382. $lockTransaction = $solver->solve($request, $this->platformRequirementFilter);
  20383. $solver = null;
  20384. if (0 !== count($lockTransaction->getOperations())) {
  20385. $this->io->writeError('<error>Your lock file cannot be installed on this system without changes. Please run composer update.</error>', true, IOInterface::QUIET);
  20386. return self::ERROR_LOCK_FILE_INVALID;
  20387. }
  20388. } catch (SolverProblemsException $e) {
  20389. $err = 'Your lock file does not contain a compatible set of packages. Please run composer update.';
  20390. $prettyProblem = $e->getPrettyString($repositorySet, $request, $pool, $this->io->isVerbose());
  20391. $this->io->writeError('<error>'. $err .'</error>', true, IOInterface::QUIET);
  20392. $this->io->writeError($prettyProblem);
  20393. $ghe = new GithubActionError($this->io);
  20394. $ghe->emit($err."\n".$prettyProblem);
  20395. return max(self::ERROR_GENERIC_FAILURE, $e->getCode());
  20396. }
  20397. }
  20398. $localRepoTransaction = new LocalRepoTransaction($lockedRepository, $localRepo);
  20399. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_OPERATIONS_EXEC, $this->devMode, $this->executeOperations, $localRepoTransaction);
  20400. $installs = $updates = $uninstalls = [];
  20401. foreach ($localRepoTransaction->getOperations() as $operation) {
  20402. if ($operation instanceof InstallOperation) {
  20403. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  20404. } elseif ($operation instanceof UpdateOperation) {
  20405. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  20406. } elseif ($operation instanceof UninstallOperation) {
  20407. $uninstalls[] = $operation->getPackage()->getPrettyName();
  20408. }
  20409. }
  20410. if ($installs === [] && $updates === [] && $uninstalls === []) {
  20411. $this->io->writeError('Nothing to install, update or remove');
  20412. } else {
  20413. $this->io->writeError(sprintf(
  20414. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  20415. count($installs),
  20416. 1 === count($installs) ? '' : 's',
  20417. count($updates),
  20418. 1 === count($updates) ? '' : 's',
  20419. count($uninstalls),
  20420. 1 === count($uninstalls) ? '' : 's'
  20421. ));
  20422. if ($installs) {
  20423. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  20424. }
  20425. if ($updates) {
  20426. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  20427. }
  20428. if ($uninstalls) {
  20429. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  20430. }
  20431. }
  20432. if ($this->executeOperations) {
  20433. $localRepo->setDevPackageNames($this->locker->getDevPackageNames());
  20434. $this->installationManager->execute($localRepo, $localRepoTransaction->getOperations(), $this->devMode, $this->runScripts, $this->downloadOnly);
  20435. if (count($localRepoTransaction->getOperations()) > 0) {
  20436. $vendorDir = $this->config->get('vendor-dir');
  20437. if (is_dir($vendorDir)) {
  20438. @touch($vendorDir);
  20439. }
  20440. }
  20441. } else {
  20442. foreach ($localRepoTransaction->getOperations() as $operation) {
  20443. if (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug()) {
  20444. $this->io->writeError(' - ' . $operation->show(false));
  20445. }
  20446. }
  20447. }
  20448. return 0;
  20449. }
  20450. protected function createPlatformRepo(bool $forUpdate): PlatformRepository
  20451. {
  20452. if ($forUpdate) {
  20453. $platformOverrides = $this->config->get('platform') ?: [];
  20454. } else {
  20455. $platformOverrides = $this->locker->getPlatformOverrides();
  20456. }
  20457. return new PlatformRepository([], $platformOverrides);
  20458. }
  20459. private function createRepositorySet(bool $forUpdate, PlatformRepository $platformRepo, array $rootAliases = [], ?RepositoryInterface $lockedRepository = null): RepositorySet
  20460. {
  20461. if ($forUpdate) {
  20462. $minimumStability = $this->package->getMinimumStability();
  20463. $stabilityFlags = $this->package->getStabilityFlags();
  20464. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  20465. } else {
  20466. $minimumStability = $this->locker->getMinimumStability();
  20467. $stabilityFlags = $this->locker->getStabilityFlags();
  20468. $requires = [];
  20469. foreach ($lockedRepository->getPackages() as $package) {
  20470. $constraint = new Constraint('=', $package->getVersion());
  20471. $constraint->setPrettyString($package->getPrettyVersion());
  20472. $requires[$package->getName()] = $constraint;
  20473. }
  20474. }
  20475. $rootRequires = [];
  20476. foreach ($requires as $req => $constraint) {
  20477. if ($constraint instanceof Link) {
  20478. $constraint = $constraint->getConstraint();
  20479. }
  20480. if ($this->platformRequirementFilter->isIgnored($req)) {
  20481. continue;
  20482. } elseif ($this->platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter) {
  20483. $constraint = $this->platformRequirementFilter->filterConstraint($req, $constraint);
  20484. }
  20485. $rootRequires[$req] = $constraint;
  20486. }
  20487. $this->fixedRootPackage = clone $this->package;
  20488. $this->fixedRootPackage->setRequires([]);
  20489. $this->fixedRootPackage->setDevRequires([]);
  20490. $stabilityFlags[$this->package->getName()] = BasePackage::STABILITIES[VersionParser::parseStability($this->package->getVersion())];
  20491. $repositorySet = new RepositorySet($minimumStability, $stabilityFlags, $rootAliases, $this->package->getReferences(), $rootRequires, $this->temporaryConstraints);
  20492. $repositorySet->addRepository(new RootPackageRepository($this->fixedRootPackage));
  20493. $repositorySet->addRepository($platformRepo);
  20494. if ($this->additionalFixedRepository) {
  20495. $additionalFixedRepositories = $this->additionalFixedRepository;
  20496. if ($additionalFixedRepositories instanceof CompositeRepository) {
  20497. $additionalFixedRepositories = $additionalFixedRepositories->getRepositories();
  20498. } else {
  20499. $additionalFixedRepositories = [$additionalFixedRepositories];
  20500. }
  20501. foreach ($additionalFixedRepositories as $additionalFixedRepository) {
  20502. if ($additionalFixedRepository instanceof InstalledRepository || $additionalFixedRepository instanceof InstalledRepositoryInterface) {
  20503. $repositorySet->allowInstalledRepositories();
  20504. break;
  20505. }
  20506. }
  20507. $repositorySet->addRepository($this->additionalFixedRepository);
  20508. }
  20509. return $repositorySet;
  20510. }
  20511. private function createPolicy(bool $forUpdate, ?LockArrayRepository $lockedRepo = null): DefaultPolicy
  20512. {
  20513. $preferStable = null;
  20514. $preferLowest = null;
  20515. if (!$forUpdate) {
  20516. $preferStable = $this->locker->getPreferStable();
  20517. $preferLowest = $this->locker->getPreferLowest();
  20518. }
  20519. if (null === $preferStable) {
  20520. $preferStable = $this->preferStable || $this->package->getPreferStable();
  20521. }
  20522. if (null === $preferLowest) {
  20523. $preferLowest = $this->preferLowest;
  20524. }
  20525. $preferredVersions = null;
  20526. if ($forUpdate && $this->minimalUpdate && $this->updateAllowList !== null && $lockedRepo !== null) {
  20527. $preferredVersions = [];
  20528. foreach ($lockedRepo->getPackages() as $pkg) {
  20529. if ($pkg instanceof AliasPackage || in_array($pkg->getName(), $this->updateAllowList, true)) {
  20530. continue;
  20531. }
  20532. $preferredVersions[$pkg->getName()] = $pkg->getVersion();
  20533. }
  20534. }
  20535. return new DefaultPolicy($preferStable, $preferLowest, $preferredVersions);
  20536. }
  20537. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo, ?LockArrayRepository $lockedRepository = null): Request
  20538. {
  20539. $request = new Request($lockedRepository);
  20540. $request->fixPackage($rootPackage);
  20541. if ($rootPackage instanceof RootAliasPackage) {
  20542. $request->fixPackage($rootPackage->getAliasOf());
  20543. }
  20544. $fixedPackages = $platformRepo->getPackages();
  20545. if ($this->additionalFixedRepository) {
  20546. $fixedPackages = array_merge($fixedPackages, $this->additionalFixedRepository->getPackages());
  20547. }
  20548. $provided = $rootPackage->getProvides();
  20549. foreach ($fixedPackages as $package) {
  20550. if ($package->getRepository() !== $platformRepo
  20551. || !isset($provided[$package->getName()])
  20552. || !$provided[$package->getName()]->getConstraint()->matches(new Constraint('=', $package->getVersion()))
  20553. ) {
  20554. $request->fixPackage($package);
  20555. }
  20556. }
  20557. return $request;
  20558. }
  20559. private function requirePackagesForUpdate(Request $request, ?LockArrayRepository $lockedRepository = null, bool $includeDevRequires = true): void
  20560. {
  20561. if ($this->updateMirrors) {
  20562. $excludedPackages = [];
  20563. if (!$includeDevRequires) {
  20564. $excludedPackages = array_flip($this->locker->getDevPackageNames());
  20565. }
  20566. foreach ($lockedRepository->getPackages() as $lockedPackage) {
  20567. if (!$lockedPackage instanceof AliasPackage && !isset($excludedPackages[$lockedPackage->getName()])) {
  20568. $request->requireName($lockedPackage->getName(), new Constraint('==', $lockedPackage->getVersion()));
  20569. }
  20570. }
  20571. } else {
  20572. $links = $this->package->getRequires();
  20573. if ($includeDevRequires) {
  20574. $links = array_merge($links, $this->package->getDevRequires());
  20575. }
  20576. foreach ($links as $link) {
  20577. $request->requireName($link->getTarget(), $link->getConstraint());
  20578. }
  20579. }
  20580. }
  20581. private function getRootAliases(bool $forUpdate): array
  20582. {
  20583. if ($forUpdate) {
  20584. $aliases = $this->package->getAliases();
  20585. } else {
  20586. $aliases = $this->locker->getAliases();
  20587. }
  20588. return $aliases;
  20589. }
  20590. private function extractPlatformRequirements(array $links): array
  20591. {
  20592. $platformReqs = [];
  20593. foreach ($links as $link) {
  20594. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  20595. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  20596. }
  20597. }
  20598. return $platformReqs;
  20599. }
  20600. private function mockLocalRepositories(RepositoryManager $rm): void
  20601. {
  20602. $packages = [];
  20603. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  20604. $packages[(string) $package] = clone $package;
  20605. }
  20606. foreach ($packages as $key => $package) {
  20607. if ($package instanceof AliasPackage) {
  20608. $alias = (string) $package->getAliasOf();
  20609. $className = get_class($package);
  20610. $packages[$key] = new $className($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  20611. }
  20612. }
  20613. $rm->setLocalRepository(
  20614. new InstalledArrayRepository($packages)
  20615. );
  20616. }
  20617. private function createPoolOptimizer(PolicyInterface $policy): ?PoolOptimizer
  20618. {
  20619. if ('0' === Platform::getEnv('COMPOSER_POOL_OPTIMIZER')) {
  20620. $this->io->write('Pool Optimizer was disabled for debugging purposes.', true, IOInterface::DEBUG);
  20621. return null;
  20622. }
  20623. return new PoolOptimizer($policy);
  20624. }
  20625. public static function create(IOInterface $io, Composer $composer): self
  20626. {
  20627. return new static(
  20628. $io,
  20629. $composer->getConfig(),
  20630. $composer->getPackage(),
  20631. $composer->getDownloadManager(),
  20632. $composer->getRepositoryManager(),
  20633. $composer->getLocker(),
  20634. $composer->getInstallationManager(),
  20635. $composer->getEventDispatcher(),
  20636. $composer->getAutoloadGenerator()
  20637. );
  20638. }
  20639. public function setIgnoredTypes(array $types): self
  20640. {
  20641. $this->ignoredTypes = $types;
  20642. return $this;
  20643. }
  20644. public function setAllowedTypes(?array $types): self
  20645. {
  20646. $this->allowedTypes = $types;
  20647. return $this;
  20648. }
  20649. public function setAdditionalFixedRepository(RepositoryInterface $additionalFixedRepository): self
  20650. {
  20651. $this->additionalFixedRepository = $additionalFixedRepository;
  20652. return $this;
  20653. }
  20654. public function setTemporaryConstraints(array $constraints): self
  20655. {
  20656. $this->temporaryConstraints = $constraints;
  20657. return $this;
  20658. }
  20659. public function setDryRun(bool $dryRun = true): self
  20660. {
  20661. $this->dryRun = $dryRun;
  20662. return $this;
  20663. }
  20664. public function isDryRun(): bool
  20665. {
  20666. return $this->dryRun;
  20667. }
  20668. public function setDownloadOnly(bool $downloadOnly = true): self
  20669. {
  20670. $this->downloadOnly = $downloadOnly;
  20671. return $this;
  20672. }
  20673. public function setPreferSource(bool $preferSource = true): self
  20674. {
  20675. $this->preferSource = $preferSource;
  20676. return $this;
  20677. }
  20678. public function setPreferDist(bool $preferDist = true): self
  20679. {
  20680. $this->preferDist = $preferDist;
  20681. return $this;
  20682. }
  20683. public function setOptimizeAutoloader(bool $optimizeAutoloader): self
  20684. {
  20685. $this->optimizeAutoloader = $optimizeAutoloader;
  20686. if (!$this->optimizeAutoloader) {
  20687. $this->setClassMapAuthoritative(false);
  20688. }
  20689. return $this;
  20690. }
  20691. public function setClassMapAuthoritative(bool $classMapAuthoritative): self
  20692. {
  20693. $this->classMapAuthoritative = $classMapAuthoritative;
  20694. if ($this->classMapAuthoritative) {
  20695. $this->setOptimizeAutoloader(true);
  20696. }
  20697. return $this;
  20698. }
  20699. public function setApcuAutoloader(bool $apcuAutoloader, ?string $apcuAutoloaderPrefix = null): self
  20700. {
  20701. $this->apcuAutoloader = $apcuAutoloader;
  20702. $this->apcuAutoloaderPrefix = $apcuAutoloaderPrefix;
  20703. return $this;
  20704. }
  20705. public function setUpdate(bool $update): self
  20706. {
  20707. $this->update = $update;
  20708. return $this;
  20709. }
  20710. public function setInstall(bool $install): self
  20711. {
  20712. $this->install = $install;
  20713. return $this;
  20714. }
  20715. public function setDevMode(bool $devMode = true): self
  20716. {
  20717. $this->devMode = $devMode;
  20718. return $this;
  20719. }
  20720. public function setDumpAutoloader(bool $dumpAutoloader = true): self
  20721. {
  20722. $this->dumpAutoloader = $dumpAutoloader;
  20723. return $this;
  20724. }
  20725. public function setRunScripts(bool $runScripts = true): self
  20726. {
  20727. $this->runScripts = $runScripts;
  20728. return $this;
  20729. }
  20730. public function setConfig(Config $config): self
  20731. {
  20732. $this->config = $config;
  20733. return $this;
  20734. }
  20735. public function setVerbose(bool $verbose = true): self
  20736. {
  20737. $this->verbose = $verbose;
  20738. return $this;
  20739. }
  20740. public function isVerbose(): bool
  20741. {
  20742. return $this->verbose;
  20743. }
  20744. public function setIgnorePlatformRequirements($ignorePlatformReqs): self
  20745. {
  20746. trigger_error('Installer::setIgnorePlatformRequirements is deprecated since Composer 2.2, use setPlatformRequirementFilter instead.', E_USER_DEPRECATED);
  20747. return $this->setPlatformRequirementFilter(PlatformRequirementFilterFactory::fromBoolOrList($ignorePlatformReqs));
  20748. }
  20749. public function setPlatformRequirementFilter(PlatformRequirementFilterInterface $platformRequirementFilter): self
  20750. {
  20751. $this->platformRequirementFilter = $platformRequirementFilter;
  20752. return $this;
  20753. }
  20754. public function setUpdateMirrors(bool $updateMirrors): self
  20755. {
  20756. $this->updateMirrors = $updateMirrors;
  20757. return $this;
  20758. }
  20759. public function setUpdateAllowList(array $packages): self
  20760. {
  20761. if (count($packages) === 0) {
  20762. $this->updateAllowList = null;
  20763. } else {
  20764. $this->updateAllowList = array_values(array_unique(array_map('strtolower', $packages)));
  20765. }
  20766. return $this;
  20767. }
  20768. public function setUpdateAllowTransitiveDependencies(int $updateAllowTransitiveDependencies): self
  20769. {
  20770. if (!in_array($updateAllowTransitiveDependencies, [Request::UPDATE_ONLY_LISTED, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS_NO_ROOT_REQUIRE, Request::UPDATE_LISTED_WITH_TRANSITIVE_DEPS], true)) {
  20771. throw new \RuntimeException("Invalid value for updateAllowTransitiveDependencies supplied");
  20772. }
  20773. $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;
  20774. return $this;
  20775. }
  20776. public function setPreferStable(bool $preferStable = true): self
  20777. {
  20778. $this->preferStable = $preferStable;
  20779. return $this;
  20780. }
  20781. public function setPreferLowest(bool $preferLowest = true): self
  20782. {
  20783. $this->preferLowest = $preferLowest;
  20784. return $this;
  20785. }
  20786. public function setMinimalUpdate(bool $minimalUpdate = true): self
  20787. {
  20788. $this->minimalUpdate = $minimalUpdate;
  20789. return $this;
  20790. }
  20791. public function setWriteLock(bool $writeLock = true): self
  20792. {
  20793. $this->writeLock = $writeLock;
  20794. return $this;
  20795. }
  20796. public function setExecuteOperations(bool $executeOperations = true): self
  20797. {
  20798. $this->executeOperations = $executeOperations;
  20799. return $this;
  20800. }
  20801. public function setAudit(bool $audit): self
  20802. {
  20803. $this->audit = $audit;
  20804. return $this;
  20805. }
  20806. public function setErrorOnAudit(bool $errorOnAudit): self
  20807. {
  20808. $this->errorOnAudit = $errorOnAudit;
  20809. return $this;
  20810. }
  20811. public function setAuditFormat(string $auditFormat): self
  20812. {
  20813. $this->auditFormat = $auditFormat;
  20814. return $this;
  20815. }
  20816. public function disablePlugins(): self
  20817. {
  20818. $this->installationManager->disablePlugins();
  20819. return $this;
  20820. }
  20821. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter): self
  20822. {
  20823. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  20824. return $this;
  20825. }
  20826. }
  20827. <?php declare(strict_types=1);
  20828. namespace Composer\Installer;
  20829. use Composer\IO\IOInterface;
  20830. use Composer\Package\PackageInterface;
  20831. use Composer\Pcre\Preg;
  20832. use Composer\Util\Filesystem;
  20833. use Composer\Util\Platform;
  20834. use Composer\Util\ProcessExecutor;
  20835. use Composer\Util\Silencer;
  20836. class BinaryInstaller
  20837. {
  20838. protected $binDir;
  20839. protected $binCompat;
  20840. protected $io;
  20841. protected $filesystem;
  20842. private $vendorDir;
  20843. public function __construct(IOInterface $io, string $binDir, string $binCompat, ?Filesystem $filesystem = null, ?string $vendorDir = null)
  20844. {
  20845. $this->binDir = $binDir;
  20846. $this->binCompat = $binCompat;
  20847. $this->io = $io;
  20848. $this->filesystem = $filesystem ?: new Filesystem();
  20849. $this->vendorDir = $vendorDir;
  20850. }
  20851. public function installBinaries(PackageInterface $package, string $installPath, bool $warnOnOverwrite = true): void
  20852. {
  20853. $binaries = $this->getBinaries($package);
  20854. if (!$binaries) {
  20855. return;
  20856. }
  20857. Platform::workaroundFilesystemIssues();
  20858. foreach ($binaries as $bin) {
  20859. $binPath = $installPath.'/'.$bin;
  20860. if (!file_exists($binPath)) {
  20861. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  20862. continue;
  20863. }
  20864. if (is_dir($binPath)) {
  20865. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': found a directory at that path</warning>');
  20866. continue;
  20867. }
  20868. if (!$this->filesystem->isAbsolutePath($binPath)) {
  20869. $binPath = realpath($binPath);
  20870. }
  20871. $this->initializeBinDir();
  20872. $link = $this->binDir.'/'.basename($bin);
  20873. if (file_exists($link)) {
  20874. if (!is_link($link)) {
  20875. if ($warnOnOverwrite) {
  20876. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  20877. }
  20878. continue;
  20879. }
  20880. if (realpath($link) === realpath($binPath)) {
  20881. $this->filesystem->unlink($link);
  20882. }
  20883. }
  20884. $binCompat = $this->binCompat;
  20885. if ($binCompat === "auto" && (Platform::isWindows() || Platform::isWindowsSubsystemForLinux())) {
  20886. $binCompat = 'full';
  20887. }
  20888. if ($binCompat === "full") {
  20889. $this->installFullBinaries($binPath, $link, $bin, $package);
  20890. } else {
  20891. $this->installUnixyProxyBinaries($binPath, $link);
  20892. }
  20893. Silencer::call('chmod', $binPath, 0777 & ~umask());
  20894. }
  20895. }
  20896. public function removeBinaries(PackageInterface $package): void
  20897. {
  20898. $this->initializeBinDir();
  20899. $binaries = $this->getBinaries($package);
  20900. if (!$binaries) {
  20901. return;
  20902. }
  20903. foreach ($binaries as $bin) {
  20904. $link = $this->binDir.'/'.basename($bin);
  20905. if (is_link($link) || file_exists($link)) {
  20906. $this->filesystem->unlink($link);
  20907. }
  20908. if (is_file($link.'.bat')) {
  20909. $this->filesystem->unlink($link.'.bat');
  20910. }
  20911. }
  20912. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  20913. Silencer::call('rmdir', $this->binDir);
  20914. }
  20915. }
  20916. public static function determineBinaryCaller(string $bin): string
  20917. {
  20918. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  20919. return 'call';
  20920. }
  20921. $handle = fopen($bin, 'r');
  20922. $line = fgets($handle);
  20923. fclose($handle);
  20924. if (Preg::isMatchStrictGroups('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', (string) $line, $match)) {
  20925. return trim($match[1]);
  20926. }
  20927. return 'php';
  20928. }
  20929. protected function getBinaries(PackageInterface $package): array
  20930. {
  20931. return $package->getBinaries();
  20932. }
  20933. protected function installFullBinaries(string $binPath, string $link, string $bin, PackageInterface $package): void
  20934. {
  20935. if ('.bat' !== substr($binPath, -4)) {
  20936. $this->installUnixyProxyBinaries($binPath, $link);
  20937. $link .= '.bat';
  20938. if (file_exists($link)) {
  20939. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  20940. }
  20941. }
  20942. if (!file_exists($link)) {
  20943. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  20944. Silencer::call('chmod', $link, 0777 & ~umask());
  20945. }
  20946. }
  20947. protected function installUnixyProxyBinaries(string $binPath, string $link): void
  20948. {
  20949. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  20950. Silencer::call('chmod', $link, 0777 & ~umask());
  20951. }
  20952. protected function initializeBinDir(): void
  20953. {
  20954. $this->filesystem->ensureDirectoryExists($this->binDir);
  20955. $this->binDir = realpath($this->binDir);
  20956. }
  20957. protected function generateWindowsProxyCode(string $bin, string $link): string
  20958. {
  20959. $binPath = $this->filesystem->findShortestPath($link, $bin);
  20960. $caller = self::determineBinaryCaller($bin);
  20961. if ($caller === 'php') {
  20962. return "@ECHO OFF\r\n".
  20963. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  20964. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape(basename($link, '.bat')), '"\'')."\r\n".
  20965. "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
  20966. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  20967. }
  20968. return "@ECHO OFF\r\n".
  20969. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  20970. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  20971. "SET COMPOSER_RUNTIME_BIN_DIR=%~dp0\r\n".
  20972. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  20973. }
  20974. protected function generateUnixyProxyCode(string $bin, string $link): string
  20975. {
  20976. $binPath = $this->filesystem->findShortestPath($link, $bin);
  20977. $binDir = ProcessExecutor::escape(dirname($binPath));
  20978. $binFile = basename($binPath);
  20979. $binContents = (string) file_get_contents($bin, false, null, 0, 500);
  20980. if (Preg::isMatch('{^(#!.*\r?\n)?[\r\n\t ]*<\?php}', $binContents, $match)) {
  20981. $proxyCode = $match[1] === null ? '#!/usr/bin/env php' : trim($match[1]);
  20982. $binPathExported = $this->filesystem->findShortestPathCode($link, $bin, false, true);
  20983. $streamProxyCode = $streamHint = '';
  20984. $globalsCode = '$GLOBALS[\'_composer_bin_dir\'] = __DIR__;'."\n";
  20985. $phpunitHack1 = $phpunitHack2 = '';
  20986. if ($this->vendorDir !== null) {
  20987. $vendorDirReal = realpath($this->vendorDir);
  20988. if ($vendorDirReal === false) {
  20989. $vendorDirReal = $this->vendorDir;
  20990. }
  20991. $globalsCode .= '$GLOBALS[\'_composer_autoload_path\'] = ' . $this->filesystem->findShortestPathCode($link, $vendorDirReal . '/autoload.php', false, true).";\n";
  20992. }
  20993. if ($this->filesystem->normalizePath($bin) === $this->filesystem->normalizePath($this->vendorDir.'/phpunit/phpunit/phpunit')) {
  20994. $globalsCode .= '$GLOBALS[\'__PHPUNIT_ISOLATION_EXCLUDE_LIST\'] = $GLOBALS[\'__PHPUNIT_ISOLATION_BLACKLIST\'] = array(realpath('.$binPathExported.'));'."\n";
  20995. $phpunitHack1 = "'phpvfscomposer://'.";
  20996. $phpunitHack2 = '
  20997. $data = str_replace(\'__DIR__\', var_export(dirname($this->realpath), true), $data);
  20998. $data = str_replace(\'__FILE__\', var_export($this->realpath, true), $data);';
  20999. }
  21000. if (trim($match[0]) !== '<?php') {
  21001. $streamHint = ' using a stream wrapper to prevent the shebang from being output on PHP<8'."\n *";
  21002. $streamProxyCode = <<<STREAMPROXY
  21003. if (PHP_VERSION_ID < 80000) {
  21004. if (!class_exists('Composer\BinProxyWrapper')) {
  21005. /**
  21006. * @internal
  21007. */
  21008. final class BinProxyWrapper
  21009. {
  21010. private \$handle;
  21011. private \$position;
  21012. private \$realpath;
  21013. public function stream_open(\$path, \$mode, \$options, &\$opened_path)
  21014. {
  21015. // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
  21016. \$opened_path = substr(\$path, 17);
  21017. \$this->realpath = realpath(\$opened_path) ?: \$opened_path;
  21018. \$opened_path = $phpunitHack1\$this->realpath;
  21019. \$this->handle = fopen(\$this->realpath, \$mode);
  21020. \$this->position = 0;
  21021. return (bool) \$this->handle;
  21022. }
  21023. public function stream_read(\$count)
  21024. {
  21025. \$data = fread(\$this->handle, \$count);
  21026. if (\$this->position === 0) {
  21027. \$data = preg_replace('{^#!.*\\r?\\n}', '', \$data);
  21028. }$phpunitHack2
  21029. \$this->position += strlen(\$data);
  21030. return \$data;
  21031. }
  21032. public function stream_cast(\$castAs)
  21033. {
  21034. return \$this->handle;
  21035. }
  21036. public function stream_close()
  21037. {
  21038. fclose(\$this->handle);
  21039. }
  21040. public function stream_lock(\$operation)
  21041. {
  21042. return \$operation ? flock(\$this->handle, \$operation) : true;
  21043. }
  21044. public function stream_seek(\$offset, \$whence)
  21045. {
  21046. if (0 === fseek(\$this->handle, \$offset, \$whence)) {
  21047. \$this->position = ftell(\$this->handle);
  21048. return true;
  21049. }
  21050. return false;
  21051. }
  21052. public function stream_tell()
  21053. {
  21054. return \$this->position;
  21055. }
  21056. public function stream_eof()
  21057. {
  21058. return feof(\$this->handle);
  21059. }
  21060. public function stream_stat()
  21061. {
  21062. return array();
  21063. }
  21064. public function stream_set_option(\$option, \$arg1, \$arg2)
  21065. {
  21066. return true;
  21067. }
  21068. public function url_stat(\$path, \$flags)
  21069. {
  21070. \$path = substr(\$path, 17);
  21071. if (file_exists(\$path)) {
  21072. return stat(\$path);
  21073. }
  21074. return false;
  21075. }
  21076. }
  21077. }
  21078. if (
  21079. (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
  21080. || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
  21081. ) {
  21082. return include("phpvfscomposer://" . $binPathExported);
  21083. }
  21084. }
  21085. STREAMPROXY;
  21086. }
  21087. return $proxyCode . "\n" . <<<PROXY
  21088. <?php
  21089. /**
  21090. * Proxy PHP file generated by Composer
  21091. *
  21092. * This file includes the referenced bin path ($binPath)
  21093. *$streamHint
  21094. * @generated
  21095. */
  21096. namespace Composer;
  21097. $globalsCode
  21098. $streamProxyCode
  21099. return include $binPathExported;
  21100. PROXY;
  21101. }
  21102. return <<<PROXY
  21103. #!/usr/bin/env sh
  21104. # Support bash to support `source` with fallback on $0 if this does not run with bash
  21105. # https://stackoverflow.com/a/35006505/6512
  21106. selfArg="\$BASH_SOURCE"
  21107. if [ -z "\$selfArg" ]; then
  21108. selfArg="\$0"
  21109. fi
  21110. self=\$(realpath \$selfArg 2> /dev/null)
  21111. if [ -z "\$self" ]; then
  21112. self="\$selfArg"
  21113. fi
  21114. dir=\$(cd "\${self%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  21115. if [ -d /proc/cygdrive ]; then
  21116. case \$(which php) in
  21117. \$(readlink -n /proc/cygdrive)/*)
  21118. # We are in Cygwin using Windows php, so the path must be translated
  21119. dir=\$(cygpath -m "\$dir");
  21120. ;;
  21121. esac
  21122. fi
  21123. export COMPOSER_RUNTIME_BIN_DIR="\$(cd "\${self%[/\\\\]*}" > /dev/null; pwd)"
  21124. # If bash is sourcing this file, we have to source the target as well
  21125. bashSource="\$BASH_SOURCE"
  21126. if [ -n "\$bashSource" ]; then
  21127. if [ "\$bashSource" != "\$0" ]; then
  21128. source "\${dir}/$binFile" "\$@"
  21129. return
  21130. fi
  21131. fi
  21132. exec "\${dir}/$binFile" "\$@"
  21133. PROXY;
  21134. }
  21135. }
  21136. <?php declare(strict_types=1);
  21137. namespace Composer\Installer;
  21138. use Composer\Package\PackageInterface;
  21139. interface BinaryPresenceInterface
  21140. {
  21141. public function ensureBinariesPresence(PackageInterface $package);
  21142. }
  21143. <?php declare(strict_types=1);
  21144. namespace Composer\Installer;
  21145. use Composer\IO\IOInterface;
  21146. use Composer\IO\ConsoleIO;
  21147. use Composer\Package\PackageInterface;
  21148. use Composer\Package\AliasPackage;
  21149. use Composer\Repository\InstalledRepositoryInterface;
  21150. use Composer\DependencyResolver\Operation\OperationInterface;
  21151. use Composer\DependencyResolver\Operation\InstallOperation;
  21152. use Composer\DependencyResolver\Operation\UpdateOperation;
  21153. use Composer\DependencyResolver\Operation\UninstallOperation;
  21154. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  21155. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  21156. use Composer\Downloader\FileDownloader;
  21157. use Composer\EventDispatcher\EventDispatcher;
  21158. use Composer\Util\Loop;
  21159. use Composer\Util\Platform;
  21160. use React\Promise\PromiseInterface;
  21161. use Seld\Signal\SignalHandler;
  21162. class InstallationManager
  21163. {
  21164. private $installers = [];
  21165. private $cache = [];
  21166. private $notifiablePackages = [];
  21167. private $loop;
  21168. private $io;
  21169. private $eventDispatcher;
  21170. private $outputProgress;
  21171. public function __construct(Loop $loop, IOInterface $io, ?EventDispatcher $eventDispatcher = null)
  21172. {
  21173. $this->loop = $loop;
  21174. $this->io = $io;
  21175. $this->eventDispatcher = $eventDispatcher;
  21176. }
  21177. public function reset(): void
  21178. {
  21179. $this->notifiablePackages = [];
  21180. FileDownloader::$downloadMetadata = [];
  21181. }
  21182. public function addInstaller(InstallerInterface $installer): void
  21183. {
  21184. array_unshift($this->installers, $installer);
  21185. $this->cache = [];
  21186. }
  21187. public function removeInstaller(InstallerInterface $installer): void
  21188. {
  21189. if (false !== ($key = array_search($installer, $this->installers, true))) {
  21190. array_splice($this->installers, $key, 1);
  21191. $this->cache = [];
  21192. }
  21193. }
  21194. public function disablePlugins(): void
  21195. {
  21196. foreach ($this->installers as $i => $installer) {
  21197. if (!$installer instanceof PluginInstaller) {
  21198. continue;
  21199. }
  21200. $installer->disablePlugins();
  21201. }
  21202. }
  21203. public function getInstaller(string $type): InstallerInterface
  21204. {
  21205. $type = strtolower($type);
  21206. if (isset($this->cache[$type])) {
  21207. return $this->cache[$type];
  21208. }
  21209. foreach ($this->installers as $installer) {
  21210. if ($installer->supports($type)) {
  21211. return $this->cache[$type] = $installer;
  21212. }
  21213. }
  21214. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  21215. }
  21216. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
  21217. {
  21218. if ($package instanceof AliasPackage) {
  21219. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  21220. }
  21221. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  21222. }
  21223. public function ensureBinariesPresence(PackageInterface $package): void
  21224. {
  21225. try {
  21226. $installer = $this->getInstaller($package->getType());
  21227. } catch (\InvalidArgumentException $e) {
  21228. return;
  21229. }
  21230. if ($installer instanceof BinaryPresenceInterface) {
  21231. $installer->ensureBinariesPresence($package);
  21232. }
  21233. }
  21234. public function execute(InstalledRepositoryInterface $repo, array $operations, bool $devMode = true, bool $runScripts = true, bool $downloadOnly = false): void
  21235. {
  21236. $cleanupPromises = [];
  21237. $signalHandler = SignalHandler::create([SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP], function (string $signal, SignalHandler $handler) use (&$cleanupPromises) {
  21238. $this->io->writeError('Received '.$signal.', aborting', true, IOInterface::DEBUG);
  21239. $this->runCleanup($cleanupPromises);
  21240. $handler->exitWithLastSignal();
  21241. });
  21242. try {
  21243. $batches = [];
  21244. $batch = [];
  21245. foreach ($operations as $index => $operation) {
  21246. if ($operation instanceof UpdateOperation || $operation instanceof InstallOperation) {
  21247. $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
  21248. if ($package->getType() === 'composer-plugin') {
  21249. $extra = $package->getExtra();
  21250. if (isset($extra['plugin-modifies-downloads']) && $extra['plugin-modifies-downloads'] === true) {
  21251. if (count($batch) > 0) {
  21252. $batches[] = $batch;
  21253. }
  21254. $batches[] = [$index => $operation];
  21255. $batch = [];
  21256. continue;
  21257. }
  21258. }
  21259. }
  21260. $batch[$index] = $operation;
  21261. }
  21262. if (count($batch) > 0) {
  21263. $batches[] = $batch;
  21264. }
  21265. foreach ($batches as $batchToExecute) {
  21266. $this->downloadAndExecuteBatch($repo, $batchToExecute, $cleanupPromises, $devMode, $runScripts, $downloadOnly, $operations);
  21267. }
  21268. } catch (\Exception $e) {
  21269. $this->runCleanup($cleanupPromises);
  21270. throw $e;
  21271. } finally {
  21272. $signalHandler->unregister();
  21273. }
  21274. if ($downloadOnly) {
  21275. return;
  21276. }
  21277. $repo->write($devMode, $this);
  21278. }
  21279. private function downloadAndExecuteBatch(InstalledRepositoryInterface $repo, array $operations, array &$cleanupPromises, bool $devMode, bool $runScripts, bool $downloadOnly, array $allOperations): void
  21280. {
  21281. $promises = [];
  21282. foreach ($operations as $index => $operation) {
  21283. $opType = $operation->getOperationType();
  21284. if (!in_array($opType, ['update', 'install', 'uninstall'], true)) {
  21285. continue;
  21286. }
  21287. if ($opType === 'update') {
  21288. $package = $operation->getTargetPackage();
  21289. $initialPackage = $operation->getInitialPackage();
  21290. } else {
  21291. $package = $operation->getPackage();
  21292. $initialPackage = null;
  21293. }
  21294. $installer = $this->getInstaller($package->getType());
  21295. $cleanupPromises[$index] = static function () use ($opType, $installer, $package, $initialPackage): ?PromiseInterface {
  21296. if (null === $package->getInstallationSource()) {
  21297. return \React\Promise\resolve(null);
  21298. }
  21299. return $installer->cleanup($opType, $package, $initialPackage);
  21300. };
  21301. if ($opType !== 'uninstall') {
  21302. $promise = $installer->download($package, $initialPackage);
  21303. if (null !== $promise) {
  21304. $promises[] = $promise;
  21305. }
  21306. }
  21307. }
  21308. if (count($promises) > 0) {
  21309. $this->waitOnPromises($promises);
  21310. }
  21311. if ($downloadOnly) {
  21312. $this->runCleanup($cleanupPromises);
  21313. return;
  21314. }
  21315. $batches = [];
  21316. $batch = [];
  21317. foreach ($operations as $index => $operation) {
  21318. if ($operation instanceof InstallOperation || $operation instanceof UpdateOperation) {
  21319. $package = $operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage();
  21320. if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
  21321. if (count($batch) > 0) {
  21322. $batches[] = $batch;
  21323. }
  21324. $batches[] = [$index => $operation];
  21325. $batch = [];
  21326. continue;
  21327. }
  21328. }
  21329. $batch[$index] = $operation;
  21330. }
  21331. if (count($batch) > 0) {
  21332. $batches[] = $batch;
  21333. }
  21334. foreach ($batches as $batchToExecute) {
  21335. $this->executeBatch($repo, $batchToExecute, $cleanupPromises, $devMode, $runScripts, $allOperations);
  21336. }
  21337. }
  21338. private function executeBatch(InstalledRepositoryInterface $repo, array $operations, array $cleanupPromises, bool $devMode, bool $runScripts, array $allOperations): void
  21339. {
  21340. $promises = [];
  21341. $postExecCallbacks = [];
  21342. foreach ($operations as $index => $operation) {
  21343. $opType = $operation->getOperationType();
  21344. if (!in_array($opType, ['update', 'install', 'uninstall'], true)) {
  21345. if ($this->io->isDebug()) {
  21346. $this->io->writeError(' - ' . $operation->show(false));
  21347. }
  21348. $this->{$opType}($repo, $operation);
  21349. continue;
  21350. }
  21351. if ($opType === 'update') {
  21352. $package = $operation->getTargetPackage();
  21353. $initialPackage = $operation->getInitialPackage();
  21354. } else {
  21355. $package = $operation->getPackage();
  21356. $initialPackage = null;
  21357. }
  21358. $installer = $this->getInstaller($package->getType());
  21359. $eventName = [
  21360. 'install' => PackageEvents::PRE_PACKAGE_INSTALL,
  21361. 'update' => PackageEvents::PRE_PACKAGE_UPDATE,
  21362. 'uninstall' => PackageEvents::PRE_PACKAGE_UNINSTALL,
  21363. ][$opType];
  21364. if ($runScripts && $this->eventDispatcher !== null) {
  21365. $this->eventDispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
  21366. }
  21367. $dispatcher = $this->eventDispatcher;
  21368. $io = $this->io;
  21369. $promise = $installer->prepare($opType, $package, $initialPackage);
  21370. if (!$promise instanceof PromiseInterface) {
  21371. $promise = \React\Promise\resolve(null);
  21372. }
  21373. $promise = $promise->then(function () use ($opType, $repo, $operation) {
  21374. return $this->{$opType}($repo, $operation);
  21375. })->then($cleanupPromises[$index])
  21376. ->then(function () use ($devMode, $repo): void {
  21377. $repo->write($devMode, $this);
  21378. }, static function ($e) use ($opType, $package, $io): void {
  21379. $io->writeError(' <error>' . ucfirst($opType) .' of '.$package->getPrettyName().' failed</error>');
  21380. throw $e;
  21381. });
  21382. $eventName = [
  21383. 'install' => PackageEvents::POST_PACKAGE_INSTALL,
  21384. 'update' => PackageEvents::POST_PACKAGE_UPDATE,
  21385. 'uninstall' => PackageEvents::POST_PACKAGE_UNINSTALL,
  21386. ][$opType];
  21387. if ($runScripts && $dispatcher !== null) {
  21388. $postExecCallbacks[] = static function () use ($dispatcher, $eventName, $devMode, $repo, $allOperations, $operation): void {
  21389. $dispatcher->dispatchPackageEvent($eventName, $devMode, $repo, $allOperations, $operation);
  21390. };
  21391. }
  21392. $promises[] = $promise;
  21393. }
  21394. if (count($promises) > 0) {
  21395. $this->waitOnPromises($promises);
  21396. }
  21397. Platform::workaroundFilesystemIssues();
  21398. foreach ($postExecCallbacks as $cb) {
  21399. $cb();
  21400. }
  21401. }
  21402. private function waitOnPromises(array $promises): void
  21403. {
  21404. $progress = null;
  21405. if (
  21406. $this->outputProgress
  21407. && $this->io instanceof ConsoleIO
  21408. && !((bool) Platform::getEnv('CI'))
  21409. && !$this->io->isDebug()
  21410. && count($promises) > 1
  21411. ) {
  21412. $progress = $this->io->getProgressBar();
  21413. }
  21414. $this->loop->wait($promises, $progress);
  21415. if ($progress !== null) {
  21416. $progress->clear();
  21417. if (!$this->io->isDecorated()) {
  21418. $this->io->writeError('');
  21419. }
  21420. }
  21421. }
  21422. public function download(PackageInterface $package): ?PromiseInterface
  21423. {
  21424. $installer = $this->getInstaller($package->getType());
  21425. $promise = $installer->cleanup("install", $package);
  21426. return $promise;
  21427. }
  21428. public function install(InstalledRepositoryInterface $repo, InstallOperation $operation): ?PromiseInterface
  21429. {
  21430. $package = $operation->getPackage();
  21431. $installer = $this->getInstaller($package->getType());
  21432. $promise = $installer->install($repo, $package);
  21433. $this->markForNotification($package);
  21434. return $promise;
  21435. }
  21436. public function update(InstalledRepositoryInterface $repo, UpdateOperation $operation): ?PromiseInterface
  21437. {
  21438. $initial = $operation->getInitialPackage();
  21439. $target = $operation->getTargetPackage();
  21440. $initialType = $initial->getType();
  21441. $targetType = $target->getType();
  21442. if ($initialType === $targetType) {
  21443. $installer = $this->getInstaller($initialType);
  21444. $promise = $installer->update($repo, $initial, $target);
  21445. $this->markForNotification($target);
  21446. } else {
  21447. $promise = $this->getInstaller($initialType)->uninstall($repo, $initial);
  21448. if (!$promise instanceof PromiseInterface) {
  21449. $promise = \React\Promise\resolve(null);
  21450. }
  21451. $installer = $this->getInstaller($targetType);
  21452. $promise = $promise->then(static function () use ($installer, $repo, $target): PromiseInterface {
  21453. $promise = $installer->install($repo, $target);
  21454. if ($promise instanceof PromiseInterface) {
  21455. return $promise;
  21456. }
  21457. return \React\Promise\resolve(null);
  21458. });
  21459. }
  21460. return $promise;
  21461. }
  21462. public function uninstall(InstalledRepositoryInterface $repo, UninstallOperation $operation): ?PromiseInterface
  21463. {
  21464. $package = $operation->getPackage();
  21465. $installer = $this->getInstaller($package->getType());
  21466. return $installer->uninstall($repo, $package);
  21467. }
  21468. public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation): void
  21469. {
  21470. $package = $operation->getPackage();
  21471. if (!$repo->hasPackage($package)) {
  21472. $repo->addPackage(clone $package);
  21473. }
  21474. }
  21475. public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation): void
  21476. {
  21477. $package = $operation->getPackage();
  21478. $repo->removePackage($package);
  21479. }
  21480. public function getInstallPath(PackageInterface $package): ?string
  21481. {
  21482. $installer = $this->getInstaller($package->getType());
  21483. return $installer->getInstallPath($package);
  21484. }
  21485. public function setOutputProgress(bool $outputProgress): void
  21486. {
  21487. $this->outputProgress = $outputProgress;
  21488. }
  21489. public function notifyInstalls(IOInterface $io): void
  21490. {
  21491. $promises = [];
  21492. try {
  21493. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  21494. if (str_contains($repoUrl, '%package%')) {
  21495. foreach ($packages as $package) {
  21496. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  21497. $params = [
  21498. 'version' => $package->getPrettyVersion(),
  21499. 'version_normalized' => $package->getVersion(),
  21500. ];
  21501. $opts = [
  21502. 'retry-auth-failure' => false,
  21503. 'http' => [
  21504. 'method' => 'POST',
  21505. 'header' => ['Content-type: application/x-www-form-urlencoded'],
  21506. 'content' => http_build_query($params, '', '&'),
  21507. 'timeout' => 3,
  21508. ],
  21509. ];
  21510. $promises[] = $this->loop->getHttpDownloader()->add($url, $opts);
  21511. }
  21512. continue;
  21513. }
  21514. $postData = ['downloads' => []];
  21515. foreach ($packages as $package) {
  21516. $packageNotification = [
  21517. 'name' => $package->getPrettyName(),
  21518. 'version' => $package->getVersion(),
  21519. ];
  21520. if (strpos($repoUrl, 'packagist.org/') !== false) {
  21521. if (isset(FileDownloader::$downloadMetadata[$package->getName()])) {
  21522. $packageNotification['downloaded'] = FileDownloader::$downloadMetadata[$package->getName()];
  21523. } else {
  21524. $packageNotification['downloaded'] = false;
  21525. }
  21526. }
  21527. $postData['downloads'][] = $packageNotification;
  21528. }
  21529. $opts = [
  21530. 'retry-auth-failure' => false,
  21531. 'http' => [
  21532. 'method' => 'POST',
  21533. 'header' => ['Content-Type: application/json'],
  21534. 'content' => json_encode($postData),
  21535. 'timeout' => 6,
  21536. ],
  21537. ];
  21538. $promises[] = $this->loop->getHttpDownloader()->add($repoUrl, $opts);
  21539. }
  21540. $this->loop->wait($promises);
  21541. } catch (\Exception $e) {
  21542. }
  21543. $this->reset();
  21544. }
  21545. private function markForNotification(PackageInterface $package): void
  21546. {
  21547. if ($package->getNotificationUrl() !== null) {
  21548. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  21549. }
  21550. }
  21551. private function runCleanup(array $cleanupPromises): void
  21552. {
  21553. $promises = [];
  21554. $this->loop->abortJobs();
  21555. foreach ($cleanupPromises as $cleanup) {
  21556. $promises[] = new \React\Promise\Promise(static function ($resolve) use ($cleanup): void {
  21557. $promise = $cleanup();
  21558. if (!$promise instanceof PromiseInterface) {
  21559. $resolve(null);
  21560. } else {
  21561. $promise->then(static function () use ($resolve): void {
  21562. $resolve(null);
  21563. });
  21564. }
  21565. });
  21566. }
  21567. if (count($promises) > 0) {
  21568. $this->loop->wait($promises);
  21569. }
  21570. }
  21571. }
  21572. <?php declare(strict_types=1);
  21573. namespace Composer\Installer;
  21574. use Composer\Composer;
  21575. use Composer\DependencyResolver\Transaction;
  21576. use Composer\EventDispatcher\Event;
  21577. use Composer\IO\IOInterface;
  21578. class InstallerEvent extends Event
  21579. {
  21580. private $composer;
  21581. private $io;
  21582. private $devMode;
  21583. private $executeOperations;
  21584. private $transaction;
  21585. public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, bool $executeOperations, Transaction $transaction)
  21586. {
  21587. parent::__construct($eventName);
  21588. $this->composer = $composer;
  21589. $this->io = $io;
  21590. $this->devMode = $devMode;
  21591. $this->executeOperations = $executeOperations;
  21592. $this->transaction = $transaction;
  21593. }
  21594. public function getComposer(): Composer
  21595. {
  21596. return $this->composer;
  21597. }
  21598. public function getIO(): IOInterface
  21599. {
  21600. return $this->io;
  21601. }
  21602. public function isDevMode(): bool
  21603. {
  21604. return $this->devMode;
  21605. }
  21606. public function isExecutingOperations(): bool
  21607. {
  21608. return $this->executeOperations;
  21609. }
  21610. public function getTransaction(): ?Transaction
  21611. {
  21612. return $this->transaction;
  21613. }
  21614. }
  21615. <?php declare(strict_types=1);
  21616. namespace Composer\Installer;
  21617. class InstallerEvents
  21618. {
  21619. public const PRE_OPERATIONS_EXEC = 'pre-operations-exec';
  21620. }
  21621. <?php declare(strict_types=1);
  21622. namespace Composer\Installer;
  21623. use Composer\Package\PackageInterface;
  21624. use Composer\Repository\InstalledRepositoryInterface;
  21625. use InvalidArgumentException;
  21626. use React\Promise\PromiseInterface;
  21627. interface InstallerInterface
  21628. {
  21629. public function supports(string $packageType);
  21630. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  21631. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null);
  21632. public function prepare(string $type, PackageInterface $package, ?PackageInterface $prevPackage = null);
  21633. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  21634. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  21635. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  21636. public function cleanup(string $type, PackageInterface $package, ?PackageInterface $prevPackage = null);
  21637. public function getInstallPath(PackageInterface $package);
  21638. }
  21639. <?php declare(strict_types=1);
  21640. namespace Composer\Installer;
  21641. use Composer\Composer;
  21642. use Composer\IO\IOInterface;
  21643. use Composer\PartialComposer;
  21644. use Composer\Pcre\Preg;
  21645. use Composer\Repository\InstalledRepositoryInterface;
  21646. use Composer\Package\PackageInterface;
  21647. use Composer\Util\Filesystem;
  21648. use Composer\Util\Silencer;
  21649. use Composer\Util\Platform;
  21650. use React\Promise\PromiseInterface;
  21651. use Composer\Downloader\DownloadManager;
  21652. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  21653. {
  21654. protected $composer;
  21655. protected $vendorDir;
  21656. protected $downloadManager;
  21657. protected $io;
  21658. protected $type;
  21659. protected $filesystem;
  21660. protected $binaryInstaller;
  21661. public function __construct(IOInterface $io, PartialComposer $composer, ?string $type = 'library', ?Filesystem $filesystem = null, ?BinaryInstaller $binaryInstaller = null)
  21662. {
  21663. $this->composer = $composer;
  21664. $this->downloadManager = $composer instanceof Composer ? $composer->getDownloadManager() : null;
  21665. $this->io = $io;
  21666. $this->type = $type;
  21667. $this->filesystem = $filesystem ?: new Filesystem();
  21668. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  21669. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem, $this->vendorDir);
  21670. }
  21671. public function supports(string $packageType)
  21672. {
  21673. return $packageType === $this->type || null === $this->type;
  21674. }
  21675. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  21676. {
  21677. if (!$repo->hasPackage($package)) {
  21678. return false;
  21679. }
  21680. $installPath = $this->getInstallPath($package);
  21681. if (Filesystem::isReadable($installPath)) {
  21682. return true;
  21683. }
  21684. if (Platform::isWindows() && $this->filesystem->isJunction($installPath)) {
  21685. return true;
  21686. }
  21687. if (is_link($installPath)) {
  21688. if (realpath($installPath) === false) {
  21689. return false;
  21690. }
  21691. return true;
  21692. }
  21693. return false;
  21694. }
  21695. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  21696. {
  21697. $this->initializeVendorDir();
  21698. $downloadPath = $this->getInstallPath($package);
  21699. return $this->getDownloadManager()->download($package, $downloadPath, $prevPackage);
  21700. }
  21701. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21702. {
  21703. $this->initializeVendorDir();
  21704. $downloadPath = $this->getInstallPath($package);
  21705. return $this->getDownloadManager()->prepare($type, $package, $downloadPath, $prevPackage);
  21706. }
  21707. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21708. {
  21709. $this->initializeVendorDir();
  21710. $downloadPath = $this->getInstallPath($package);
  21711. return $this->getDownloadManager()->cleanup($type, $package, $downloadPath, $prevPackage);
  21712. }
  21713. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  21714. {
  21715. $this->initializeVendorDir();
  21716. $downloadPath = $this->getInstallPath($package);
  21717. if (!Filesystem::isReadable($downloadPath) && $repo->hasPackage($package)) {
  21718. $this->binaryInstaller->removeBinaries($package);
  21719. }
  21720. $promise = $this->installCode($package);
  21721. if (!$promise instanceof PromiseInterface) {
  21722. $promise = \React\Promise\resolve(null);
  21723. }
  21724. $binaryInstaller = $this->binaryInstaller;
  21725. $installPath = $this->getInstallPath($package);
  21726. return $promise->then(static function () use ($binaryInstaller, $installPath, $package, $repo): void {
  21727. $binaryInstaller->installBinaries($package, $installPath);
  21728. if (!$repo->hasPackage($package)) {
  21729. $repo->addPackage(clone $package);
  21730. }
  21731. });
  21732. }
  21733. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  21734. {
  21735. if (!$repo->hasPackage($initial)) {
  21736. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  21737. }
  21738. $this->initializeVendorDir();
  21739. $this->binaryInstaller->removeBinaries($initial);
  21740. $promise = $this->updateCode($initial, $target);
  21741. if (!$promise instanceof PromiseInterface) {
  21742. $promise = \React\Promise\resolve(null);
  21743. }
  21744. $binaryInstaller = $this->binaryInstaller;
  21745. $installPath = $this->getInstallPath($target);
  21746. return $promise->then(static function () use ($binaryInstaller, $installPath, $target, $initial, $repo): void {
  21747. $binaryInstaller->installBinaries($target, $installPath);
  21748. $repo->removePackage($initial);
  21749. if (!$repo->hasPackage($target)) {
  21750. $repo->addPackage(clone $target);
  21751. }
  21752. });
  21753. }
  21754. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  21755. {
  21756. if (!$repo->hasPackage($package)) {
  21757. throw new \InvalidArgumentException('Package is not installed: '.$package);
  21758. }
  21759. $promise = $this->removeCode($package);
  21760. if (!$promise instanceof PromiseInterface) {
  21761. $promise = \React\Promise\resolve(null);
  21762. }
  21763. $binaryInstaller = $this->binaryInstaller;
  21764. $downloadPath = $this->getPackageBasePath($package);
  21765. $filesystem = $this->filesystem;
  21766. return $promise->then(static function () use ($binaryInstaller, $filesystem, $downloadPath, $package, $repo): void {
  21767. $binaryInstaller->removeBinaries($package);
  21768. $repo->removePackage($package);
  21769. if (strpos($package->getName(), '/')) {
  21770. $packageVendorDir = dirname($downloadPath);
  21771. if (is_dir($packageVendorDir) && $filesystem->isDirEmpty($packageVendorDir)) {
  21772. Silencer::call('rmdir', $packageVendorDir);
  21773. }
  21774. }
  21775. });
  21776. }
  21777. public function getInstallPath(PackageInterface $package)
  21778. {
  21779. $this->initializeVendorDir();
  21780. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  21781. $targetDir = $package->getTargetDir();
  21782. return $basePath . ($targetDir ? '/'.$targetDir : '');
  21783. }
  21784. public function ensureBinariesPresence(PackageInterface $package)
  21785. {
  21786. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  21787. }
  21788. protected function getPackageBasePath(PackageInterface $package)
  21789. {
  21790. $installPath = $this->getInstallPath($package);
  21791. $targetDir = $package->getTargetDir();
  21792. if ($targetDir) {
  21793. return Preg::replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  21794. }
  21795. return $installPath;
  21796. }
  21797. protected function installCode(PackageInterface $package)
  21798. {
  21799. $downloadPath = $this->getInstallPath($package);
  21800. return $this->getDownloadManager()->install($package, $downloadPath);
  21801. }
  21802. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  21803. {
  21804. $initialDownloadPath = $this->getInstallPath($initial);
  21805. $targetDownloadPath = $this->getInstallPath($target);
  21806. if ($targetDownloadPath !== $initialDownloadPath) {
  21807. if (strpos($initialDownloadPath, $targetDownloadPath) === 0
  21808. || strpos($targetDownloadPath, $initialDownloadPath) === 0
  21809. ) {
  21810. $promise = $this->removeCode($initial);
  21811. if (!$promise instanceof PromiseInterface) {
  21812. $promise = \React\Promise\resolve(null);
  21813. }
  21814. return $promise->then(function () use ($target): PromiseInterface {
  21815. $promise = $this->installCode($target);
  21816. if ($promise instanceof PromiseInterface) {
  21817. return $promise;
  21818. }
  21819. return \React\Promise\resolve(null);
  21820. });
  21821. }
  21822. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  21823. }
  21824. return $this->getDownloadManager()->update($initial, $target, $targetDownloadPath);
  21825. }
  21826. protected function removeCode(PackageInterface $package)
  21827. {
  21828. $downloadPath = $this->getPackageBasePath($package);
  21829. return $this->getDownloadManager()->remove($package, $downloadPath);
  21830. }
  21831. protected function initializeVendorDir()
  21832. {
  21833. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  21834. $this->vendorDir = realpath($this->vendorDir);
  21835. }
  21836. protected function getDownloadManager(): DownloadManager
  21837. {
  21838. assert($this->downloadManager instanceof DownloadManager, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance to be able to install/... packages'));
  21839. return $this->downloadManager;
  21840. }
  21841. }
  21842. <?php declare(strict_types=1);
  21843. namespace Composer\Installer;
  21844. use Composer\Repository\InstalledRepositoryInterface;
  21845. use Composer\Package\PackageInterface;
  21846. use Composer\IO\IOInterface;
  21847. use Composer\DependencyResolver\Operation\UpdateOperation;
  21848. use Composer\DependencyResolver\Operation\InstallOperation;
  21849. use Composer\DependencyResolver\Operation\UninstallOperation;
  21850. class MetapackageInstaller implements InstallerInterface
  21851. {
  21852. private $io;
  21853. public function __construct(IOInterface $io)
  21854. {
  21855. $this->io = $io;
  21856. }
  21857. public function supports(string $packageType)
  21858. {
  21859. return $packageType === 'metapackage';
  21860. }
  21861. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  21862. {
  21863. return $repo->hasPackage($package);
  21864. }
  21865. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  21866. {
  21867. return \React\Promise\resolve(null);
  21868. }
  21869. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21870. {
  21871. return \React\Promise\resolve(null);
  21872. }
  21873. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21874. {
  21875. return \React\Promise\resolve(null);
  21876. }
  21877. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  21878. {
  21879. $this->io->writeError(" - " . InstallOperation::format($package));
  21880. $repo->addPackage(clone $package);
  21881. return \React\Promise\resolve(null);
  21882. }
  21883. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  21884. {
  21885. if (!$repo->hasPackage($initial)) {
  21886. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  21887. }
  21888. $this->io->writeError(" - " . UpdateOperation::format($initial, $target));
  21889. $repo->removePackage($initial);
  21890. $repo->addPackage(clone $target);
  21891. return \React\Promise\resolve(null);
  21892. }
  21893. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  21894. {
  21895. if (!$repo->hasPackage($package)) {
  21896. throw new \InvalidArgumentException('Package is not installed: '.$package);
  21897. }
  21898. $this->io->writeError(" - " . UninstallOperation::format($package));
  21899. $repo->removePackage($package);
  21900. return \React\Promise\resolve(null);
  21901. }
  21902. public function getInstallPath(PackageInterface $package)
  21903. {
  21904. return null;
  21905. }
  21906. }
  21907. <?php declare(strict_types=1);
  21908. namespace Composer\Installer;
  21909. use Composer\Repository\InstalledRepositoryInterface;
  21910. use Composer\Package\PackageInterface;
  21911. class NoopInstaller implements InstallerInterface
  21912. {
  21913. public function supports(string $packageType)
  21914. {
  21915. return true;
  21916. }
  21917. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  21918. {
  21919. return $repo->hasPackage($package);
  21920. }
  21921. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  21922. {
  21923. return \React\Promise\resolve(null);
  21924. }
  21925. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21926. {
  21927. return \React\Promise\resolve(null);
  21928. }
  21929. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  21930. {
  21931. return \React\Promise\resolve(null);
  21932. }
  21933. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  21934. {
  21935. if (!$repo->hasPackage($package)) {
  21936. $repo->addPackage(clone $package);
  21937. }
  21938. return \React\Promise\resolve(null);
  21939. }
  21940. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  21941. {
  21942. if (!$repo->hasPackage($initial)) {
  21943. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  21944. }
  21945. $repo->removePackage($initial);
  21946. if (!$repo->hasPackage($target)) {
  21947. $repo->addPackage(clone $target);
  21948. }
  21949. return \React\Promise\resolve(null);
  21950. }
  21951. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  21952. {
  21953. if (!$repo->hasPackage($package)) {
  21954. throw new \InvalidArgumentException('Package is not installed: '.$package);
  21955. }
  21956. $repo->removePackage($package);
  21957. return \React\Promise\resolve(null);
  21958. }
  21959. public function getInstallPath(PackageInterface $package)
  21960. {
  21961. $targetDir = $package->getTargetDir();
  21962. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  21963. }
  21964. }
  21965. <?php declare(strict_types=1);
  21966. namespace Composer\Installer;
  21967. use Composer\Composer;
  21968. use Composer\IO\IOInterface;
  21969. use Composer\DependencyResolver\Operation\OperationInterface;
  21970. use Composer\Repository\RepositoryInterface;
  21971. use Composer\EventDispatcher\Event;
  21972. class PackageEvent extends Event
  21973. {
  21974. private $composer;
  21975. private $io;
  21976. private $devMode;
  21977. private $localRepo;
  21978. private $operations;
  21979. private $operation;
  21980. public function __construct(string $eventName, Composer $composer, IOInterface $io, bool $devMode, RepositoryInterface $localRepo, array $operations, OperationInterface $operation)
  21981. {
  21982. parent::__construct($eventName);
  21983. $this->composer = $composer;
  21984. $this->io = $io;
  21985. $this->devMode = $devMode;
  21986. $this->localRepo = $localRepo;
  21987. $this->operations = $operations;
  21988. $this->operation = $operation;
  21989. }
  21990. public function getComposer(): Composer
  21991. {
  21992. return $this->composer;
  21993. }
  21994. public function getIO(): IOInterface
  21995. {
  21996. return $this->io;
  21997. }
  21998. public function isDevMode(): bool
  21999. {
  22000. return $this->devMode;
  22001. }
  22002. public function getLocalRepo(): RepositoryInterface
  22003. {
  22004. return $this->localRepo;
  22005. }
  22006. public function getOperations(): array
  22007. {
  22008. return $this->operations;
  22009. }
  22010. public function getOperation(): OperationInterface
  22011. {
  22012. return $this->operation;
  22013. }
  22014. }
  22015. <?php declare(strict_types=1);
  22016. namespace Composer\Installer;
  22017. class PackageEvents
  22018. {
  22019. public const PRE_PACKAGE_INSTALL = 'pre-package-install';
  22020. public const POST_PACKAGE_INSTALL = 'post-package-install';
  22021. public const PRE_PACKAGE_UPDATE = 'pre-package-update';
  22022. public const POST_PACKAGE_UPDATE = 'post-package-update';
  22023. public const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  22024. public const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  22025. }
  22026. <?php declare(strict_types=1);
  22027. namespace Composer\Installer;
  22028. use Composer\Composer;
  22029. use Composer\IO\IOInterface;
  22030. use Composer\PartialComposer;
  22031. use Composer\Repository\InstalledRepositoryInterface;
  22032. use Composer\Package\PackageInterface;
  22033. use Composer\Plugin\PluginManager;
  22034. use Composer\Util\Filesystem;
  22035. use Composer\Util\Platform;
  22036. use React\Promise\PromiseInterface;
  22037. class PluginInstaller extends LibraryInstaller
  22038. {
  22039. public function __construct(IOInterface $io, PartialComposer $composer, ?Filesystem $fs = null, ?BinaryInstaller $binaryInstaller = null)
  22040. {
  22041. parent::__construct($io, $composer, 'composer-plugin', $fs, $binaryInstaller);
  22042. }
  22043. public function supports(string $packageType)
  22044. {
  22045. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  22046. }
  22047. public function disablePlugins(): void
  22048. {
  22049. $this->getPluginManager()->disablePlugins();
  22050. }
  22051. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null)
  22052. {
  22053. if (($type === 'install' || $type === 'update') && !$this->getPluginManager()->arePluginsDisabled('local')) {
  22054. $this->getPluginManager()->isPluginAllowed($package->getName(), false, true === ($package->getExtra()['plugin-optional'] ?? false));
  22055. }
  22056. return parent::prepare($type, $package, $prevPackage);
  22057. }
  22058. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null)
  22059. {
  22060. $extra = $package->getExtra();
  22061. if (empty($extra['class'])) {
  22062. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  22063. }
  22064. return parent::download($package, $prevPackage);
  22065. }
  22066. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  22067. {
  22068. $promise = parent::install($repo, $package);
  22069. if (!$promise instanceof PromiseInterface) {
  22070. $promise = \React\Promise\resolve(null);
  22071. }
  22072. return $promise->then(function () use ($package, $repo): void {
  22073. try {
  22074. Platform::workaroundFilesystemIssues();
  22075. $this->getPluginManager()->registerPackage($package, true);
  22076. } catch (\Exception $e) {
  22077. $this->rollbackInstall($e, $repo, $package);
  22078. }
  22079. });
  22080. }
  22081. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  22082. {
  22083. $promise = parent::update($repo, $initial, $target);
  22084. if (!$promise instanceof PromiseInterface) {
  22085. $promise = \React\Promise\resolve(null);
  22086. }
  22087. return $promise->then(function () use ($initial, $target, $repo): void {
  22088. try {
  22089. Platform::workaroundFilesystemIssues();
  22090. $this->getPluginManager()->deactivatePackage($initial);
  22091. $this->getPluginManager()->registerPackage($target, true);
  22092. } catch (\Exception $e) {
  22093. $this->rollbackInstall($e, $repo, $target);
  22094. }
  22095. });
  22096. }
  22097. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  22098. {
  22099. $this->getPluginManager()->uninstallPackage($package);
  22100. return parent::uninstall($repo, $package);
  22101. }
  22102. private function rollbackInstall(\Exception $e, InstalledRepositoryInterface $repo, PackageInterface $package): void
  22103. {
  22104. $this->io->writeError('Plugin initialization failed ('.$e->getMessage().'), uninstalling plugin');
  22105. parent::uninstall($repo, $package);
  22106. throw $e;
  22107. }
  22108. protected function getPluginManager(): PluginManager
  22109. {
  22110. assert($this->composer instanceof Composer, new \LogicException(self::class.' should be initialized with a fully loaded Composer instance.'));
  22111. $pluginManager = $this->composer->getPluginManager();
  22112. return $pluginManager;
  22113. }
  22114. }
  22115. <?php declare(strict_types=1);
  22116. namespace Composer\Installer;
  22117. use React\Promise\PromiseInterface;
  22118. use Composer\Package\PackageInterface;
  22119. use Composer\Downloader\DownloadManager;
  22120. use Composer\Repository\InstalledRepositoryInterface;
  22121. use Composer\Util\Filesystem;
  22122. class ProjectInstaller implements InstallerInterface
  22123. {
  22124. private $installPath;
  22125. private $downloadManager;
  22126. private $filesystem;
  22127. public function __construct(string $installPath, DownloadManager $dm, Filesystem $fs)
  22128. {
  22129. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  22130. $this->downloadManager = $dm;
  22131. $this->filesystem = $fs;
  22132. }
  22133. public function supports(string $packageType): bool
  22134. {
  22135. return true;
  22136. }
  22137. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package): bool
  22138. {
  22139. return false;
  22140. }
  22141. public function download(PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
  22142. {
  22143. $installPath = $this->installPath;
  22144. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  22145. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  22146. }
  22147. if (!is_dir($installPath)) {
  22148. mkdir($installPath, 0777, true);
  22149. }
  22150. return $this->downloadManager->download($package, $installPath, $prevPackage);
  22151. }
  22152. public function prepare($type, PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
  22153. {
  22154. return $this->downloadManager->prepare($type, $package, $this->installPath, $prevPackage);
  22155. }
  22156. public function cleanup($type, PackageInterface $package, ?PackageInterface $prevPackage = null): ?PromiseInterface
  22157. {
  22158. return $this->downloadManager->cleanup($type, $package, $this->installPath, $prevPackage);
  22159. }
  22160. public function install(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
  22161. {
  22162. return $this->downloadManager->install($package, $this->installPath);
  22163. }
  22164. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target): ?PromiseInterface
  22165. {
  22166. throw new \InvalidArgumentException("not supported");
  22167. }
  22168. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package): ?PromiseInterface
  22169. {
  22170. throw new \InvalidArgumentException("not supported");
  22171. }
  22172. public function getInstallPath(PackageInterface $package): string
  22173. {
  22174. return $this->installPath;
  22175. }
  22176. }
  22177. <?php declare(strict_types=1);
  22178. namespace Composer\Installer;
  22179. use Composer\IO\IOInterface;
  22180. use Composer\Package\PackageInterface;
  22181. use Composer\Pcre\Preg;
  22182. use Composer\Repository\InstalledRepository;
  22183. use Symfony\Component\Console\Formatter\OutputFormatter;
  22184. class SuggestedPackagesReporter
  22185. {
  22186. public const MODE_LIST = 1;
  22187. public const MODE_BY_PACKAGE = 2;
  22188. public const MODE_BY_SUGGESTION = 4;
  22189. protected $suggestedPackages = [];
  22190. private $io;
  22191. public function __construct(IOInterface $io)
  22192. {
  22193. $this->io = $io;
  22194. }
  22195. public function getPackages(): array
  22196. {
  22197. return $this->suggestedPackages;
  22198. }
  22199. public function addPackage(string $source, string $target, string $reason): SuggestedPackagesReporter
  22200. {
  22201. $this->suggestedPackages[] = [
  22202. 'source' => $source,
  22203. 'target' => $target,
  22204. 'reason' => $reason,
  22205. ];
  22206. return $this;
  22207. }
  22208. public function addSuggestionsFromPackage(PackageInterface $package): SuggestedPackagesReporter
  22209. {
  22210. $source = $package->getPrettyName();
  22211. foreach ($package->getSuggests() as $target => $reason) {
  22212. $this->addPackage(
  22213. $source,
  22214. $target,
  22215. $reason
  22216. );
  22217. }
  22218. return $this;
  22219. }
  22220. public function output(int $mode, ?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): void
  22221. {
  22222. $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
  22223. $suggesters = [];
  22224. $suggested = [];
  22225. foreach ($suggestedPackages as $suggestion) {
  22226. $suggesters[$suggestion['source']][$suggestion['target']] = $suggestion['reason'];
  22227. $suggested[$suggestion['target']][$suggestion['source']] = $suggestion['reason'];
  22228. }
  22229. ksort($suggesters);
  22230. ksort($suggested);
  22231. if ($mode & self::MODE_LIST) {
  22232. foreach (array_keys($suggested) as $name) {
  22233. $this->io->write(sprintf('<info>%s</info>', $name));
  22234. }
  22235. return;
  22236. }
  22237. if ($mode & self::MODE_BY_PACKAGE) {
  22238. foreach ($suggesters as $suggester => $suggestions) {
  22239. $this->io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  22240. foreach ($suggestions as $suggestion => $reason) {
  22241. $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggestion, $this->escapeOutput($reason)));
  22242. }
  22243. $this->io->write('');
  22244. }
  22245. }
  22246. if ($mode & self::MODE_BY_SUGGESTION) {
  22247. if ($mode & self::MODE_BY_PACKAGE) {
  22248. $this->io->write(str_repeat('-', 78));
  22249. }
  22250. foreach ($suggested as $suggestion => $suggesters) {
  22251. $this->io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  22252. foreach ($suggesters as $suggester => $reason) {
  22253. $this->io->write(sprintf(' - <info>%s</info>' . ($reason ? ': %s' : ''), $suggester, $this->escapeOutput($reason)));
  22254. }
  22255. $this->io->write('');
  22256. }
  22257. }
  22258. if ($onlyDependentsOf) {
  22259. $allSuggestedPackages = $this->getFilteredSuggestions($installedRepo);
  22260. $diff = count($allSuggestedPackages) - count($suggestedPackages);
  22261. if ($diff) {
  22262. $this->io->write('<info>'.$diff.' additional suggestions</info> by transitive dependencies can be shown with <info>--all</info>');
  22263. }
  22264. }
  22265. }
  22266. public function outputMinimalistic(?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): void
  22267. {
  22268. $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
  22269. if ($suggestedPackages) {
  22270. $this->io->writeError('<info>'.count($suggestedPackages).' package suggestions were added by new dependencies, use `composer suggest` to see details.</info>');
  22271. }
  22272. }
  22273. private function getFilteredSuggestions(?InstalledRepository $installedRepo = null, ?PackageInterface $onlyDependentsOf = null): array
  22274. {
  22275. $suggestedPackages = $this->getPackages();
  22276. $installedNames = [];
  22277. if (null !== $installedRepo && !empty($suggestedPackages)) {
  22278. foreach ($installedRepo->getPackages() as $package) {
  22279. $installedNames = array_merge(
  22280. $installedNames,
  22281. $package->getNames()
  22282. );
  22283. }
  22284. }
  22285. $sourceFilter = [];
  22286. if ($onlyDependentsOf) {
  22287. $sourceFilter = array_map(static function ($link): string {
  22288. return $link->getTarget();
  22289. }, array_merge($onlyDependentsOf->getRequires(), $onlyDependentsOf->getDevRequires()));
  22290. $sourceFilter[] = $onlyDependentsOf->getName();
  22291. }
  22292. $suggestions = [];
  22293. foreach ($suggestedPackages as $suggestion) {
  22294. if (in_array($suggestion['target'], $installedNames) || ($sourceFilter && !in_array($suggestion['source'], $sourceFilter))) {
  22295. continue;
  22296. }
  22297. $suggestions[] = $suggestion;
  22298. }
  22299. return $suggestions;
  22300. }
  22301. private function escapeOutput(string $string): string
  22302. {
  22303. return OutputFormatter::escape(
  22304. $this->removeControlCharacters($string)
  22305. );
  22306. }
  22307. private function removeControlCharacters(string $string): string
  22308. {
  22309. return Preg::replace(
  22310. '/[[:cntrl:]]/',
  22311. '',
  22312. str_replace("\n", ' ', $string)
  22313. );
  22314. }
  22315. }
  22316. <?php declare(strict_types=1);
  22317. namespace Composer\Json;
  22318. use Composer\Pcre\Preg;
  22319. use Composer\Util\Filesystem;
  22320. use JsonSchema\Validator;
  22321. use Seld\JsonLint\JsonParser;
  22322. use Seld\JsonLint\ParsingException;
  22323. use Composer\Util\HttpDownloader;
  22324. use Composer\IO\IOInterface;
  22325. use Composer\Downloader\TransportException;
  22326. class JsonFile
  22327. {
  22328. public const LAX_SCHEMA = 1;
  22329. public const STRICT_SCHEMA = 2;
  22330. public const AUTH_SCHEMA = 3;
  22331. public const LOCK_SCHEMA = 4;
  22332. public const JSON_UNESCAPED_SLASHES = 64;
  22333. public const JSON_PRETTY_PRINT = 128;
  22334. public const JSON_UNESCAPED_UNICODE = 256;
  22335. public const COMPOSER_SCHEMA_PATH = __DIR__ . '/../../../res/composer-schema.json';
  22336. public const LOCK_SCHEMA_PATH = __DIR__ . '/../../../res/composer-lock-schema.json';
  22337. public const INDENT_DEFAULT = ' ';
  22338. private $path;
  22339. private $httpDownloader;
  22340. private $io;
  22341. private $indent = self::INDENT_DEFAULT;
  22342. public function __construct(string $path, ?HttpDownloader $httpDownloader = null, ?IOInterface $io = null)
  22343. {
  22344. $this->path = $path;
  22345. if (null === $httpDownloader && Preg::isMatch('{^https?://}i', $path)) {
  22346. throw new \InvalidArgumentException('http urls require a HttpDownloader instance to be passed');
  22347. }
  22348. $this->httpDownloader = $httpDownloader;
  22349. $this->io = $io;
  22350. }
  22351. public function getPath(): string
  22352. {
  22353. return $this->path;
  22354. }
  22355. public function exists(): bool
  22356. {
  22357. return is_file($this->path);
  22358. }
  22359. public function read()
  22360. {
  22361. try {
  22362. if ($this->httpDownloader) {
  22363. $json = $this->httpDownloader->get($this->path)->getBody();
  22364. } else {
  22365. if (!Filesystem::isReadable($this->path)) {
  22366. throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
  22367. }
  22368. if ($this->io && $this->io->isDebug()) {
  22369. $realpathInfo = '';
  22370. $realpath = realpath($this->path);
  22371. if (false !== $realpath && $realpath !== $this->path) {
  22372. $realpathInfo = ' (' . $realpath . ')';
  22373. }
  22374. $this->io->writeError('Reading ' . $this->path . $realpathInfo);
  22375. }
  22376. $json = file_get_contents($this->path);
  22377. }
  22378. } catch (TransportException $e) {
  22379. throw new \RuntimeException($e->getMessage(), 0, $e);
  22380. } catch (\Exception $e) {
  22381. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  22382. }
  22383. if ($json === false) {
  22384. throw new \RuntimeException('Could not read '.$this->path);
  22385. }
  22386. $this->indent = self::detectIndenting($json);
  22387. return static::parseJson($json, $this->path);
  22388. }
  22389. public function write(array $hash, int $options = JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
  22390. {
  22391. if ($this->path === 'php://memory') {
  22392. file_put_contents($this->path, static::encode($hash, $options, $this->indent));
  22393. return;
  22394. }
  22395. $dir = dirname($this->path);
  22396. if (!is_dir($dir)) {
  22397. if (file_exists($dir)) {
  22398. throw new \UnexpectedValueException(
  22399. realpath($dir).' exists and is not a directory.'
  22400. );
  22401. }
  22402. if (!@mkdir($dir, 0777, true)) {
  22403. throw new \UnexpectedValueException(
  22404. $dir.' does not exist and could not be created.'
  22405. );
  22406. }
  22407. }
  22408. $retries = 3;
  22409. while ($retries--) {
  22410. try {
  22411. $this->filePutContentsIfModified($this->path, static::encode($hash, $options, $this->indent). ($options & JSON_PRETTY_PRINT ? "\n" : ''));
  22412. break;
  22413. } catch (\Exception $e) {
  22414. if ($retries > 0) {
  22415. usleep(500000);
  22416. continue;
  22417. }
  22418. throw $e;
  22419. }
  22420. }
  22421. }
  22422. private function filePutContentsIfModified(string $path, string $content)
  22423. {
  22424. $currentContent = @file_get_contents($path);
  22425. if (false === $currentContent || $currentContent !== $content) {
  22426. return file_put_contents($path, $content);
  22427. }
  22428. return 0;
  22429. }
  22430. public function validateSchema(int $schema = self::STRICT_SCHEMA, ?string $schemaFile = null): bool
  22431. {
  22432. if (!Filesystem::isReadable($this->path)) {
  22433. throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
  22434. }
  22435. $content = file_get_contents($this->path);
  22436. $data = json_decode($content);
  22437. if (null === $data && 'null' !== $content) {
  22438. self::validateSyntax($content, $this->path);
  22439. }
  22440. return self::validateJsonSchema($this->path, $data, $schema, $schemaFile);
  22441. }
  22442. public static function validateJsonSchema(string $source, $data, int $schema, ?string $schemaFile = null): bool
  22443. {
  22444. $isComposerSchemaFile = false;
  22445. if (null === $schemaFile) {
  22446. if ($schema === self::LOCK_SCHEMA) {
  22447. $schemaFile = self::LOCK_SCHEMA_PATH;
  22448. } else {
  22449. $isComposerSchemaFile = true;
  22450. $schemaFile = self::COMPOSER_SCHEMA_PATH;
  22451. }
  22452. }
  22453. if (false === strpos($schemaFile, '://')) {
  22454. $schemaFile = 'file://' . $schemaFile;
  22455. }
  22456. $schemaData = (object) ['$ref' => $schemaFile];
  22457. if ($schema === self::LAX_SCHEMA) {
  22458. $schemaData->additionalProperties = true;
  22459. $schemaData->required = [];
  22460. } elseif ($schema === self::STRICT_SCHEMA && $isComposerSchemaFile) {
  22461. $schemaData->additionalProperties = false;
  22462. $schemaData->required = ['name', 'description'];
  22463. } elseif ($schema === self::AUTH_SCHEMA && $isComposerSchemaFile) {
  22464. $schemaData = (object) ['$ref' => $schemaFile.'#/properties/config', '$schema' => "https://json-schema.org/draft-04/schema#"];
  22465. }
  22466. $validator = new Validator();
  22467. $validator->check($data, $schemaData);
  22468. if (!$validator->isValid()) {
  22469. $errors = [];
  22470. foreach ((array) $validator->getErrors() as $error) {
  22471. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  22472. }
  22473. throw new JsonValidationException('"'.$source.'" does not match the expected JSON schema', $errors);
  22474. }
  22475. return true;
  22476. }
  22477. public static function encode($data, int $options = 448, string $indent = self::INDENT_DEFAULT): string
  22478. {
  22479. $json = json_encode($data, $options);
  22480. if (false === $json) {
  22481. self::throwEncodeError(json_last_error());
  22482. }
  22483. if (($options & JSON_PRETTY_PRINT) > 0 && $indent !== self::INDENT_DEFAULT ) {
  22484. return Preg::replaceCallback(
  22485. '#^ {4,}#m',
  22486. static function ($match) use ($indent): string {
  22487. return str_repeat($indent, (int)(strlen($match[0]) / 4));
  22488. },
  22489. $json
  22490. );
  22491. }
  22492. return $json;
  22493. }
  22494. private static function throwEncodeError(int $code): void
  22495. {
  22496. switch ($code) {
  22497. case JSON_ERROR_DEPTH:
  22498. $msg = 'Maximum stack depth exceeded';
  22499. break;
  22500. case JSON_ERROR_STATE_MISMATCH:
  22501. $msg = 'Underflow or the modes mismatch';
  22502. break;
  22503. case JSON_ERROR_CTRL_CHAR:
  22504. $msg = 'Unexpected control character found';
  22505. break;
  22506. case JSON_ERROR_UTF8:
  22507. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  22508. break;
  22509. default:
  22510. $msg = 'Unknown error';
  22511. }
  22512. throw new \RuntimeException('JSON encoding failed: '.$msg);
  22513. }
  22514. public static function parseJson(?string $json, ?string $file = null)
  22515. {
  22516. if (null === $json) {
  22517. return null;
  22518. }
  22519. $data = json_decode($json, true);
  22520. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  22521. self::validateSyntax($json, $file);
  22522. }
  22523. return $data;
  22524. }
  22525. protected static function validateSyntax(string $json, ?string $file = null): bool
  22526. {
  22527. $parser = new JsonParser();
  22528. $result = $parser->lint($json);
  22529. if (null === $result) {
  22530. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  22531. if ($file === null) {
  22532. throw new \UnexpectedValueException('The input is not UTF-8, could not parse as JSON');
  22533. } else {
  22534. throw new \UnexpectedValueException('"' . $file . '" is not UTF-8, could not parse as JSON');
  22535. }
  22536. }
  22537. return true;
  22538. }
  22539. if ($file === null) {
  22540. throw new ParsingException('The input does not contain valid JSON' . "\n" . $result->getMessage(),
  22541. $result->getDetails());
  22542. } else {
  22543. throw new ParsingException('"' . $file . '" does not contain valid JSON' . "\n" . $result->getMessage(),
  22544. $result->getDetails());
  22545. }
  22546. }
  22547. public static function detectIndenting(?string $json): string
  22548. {
  22549. if (Preg::isMatchStrictGroups('#^([ \t]+)"#m', $json ?? '', $match)) {
  22550. return $match[1];
  22551. }
  22552. return self::INDENT_DEFAULT;
  22553. }
  22554. }
  22555. <?php declare(strict_types=1);
  22556. namespace Composer\Json;
  22557. use Composer\Pcre\Preg;
  22558. class JsonFormatter
  22559. {
  22560. public static function format(string $json, bool $unescapeUnicode, bool $unescapeSlashes): string
  22561. {
  22562. $result = '';
  22563. $pos = 0;
  22564. $strLen = strlen($json);
  22565. $indentStr = ' ';
  22566. $newLine = "\n";
  22567. $outOfQuotes = true;
  22568. $buffer = '';
  22569. $noescape = true;
  22570. for ($i = 0; $i < $strLen; $i++) {
  22571. $char = substr($json, $i, 1);
  22572. if ('"' === $char && $noescape) {
  22573. $outOfQuotes = !$outOfQuotes;
  22574. }
  22575. if (!$outOfQuotes) {
  22576. $buffer .= $char;
  22577. $noescape = '\\' === $char ? !$noescape : true;
  22578. continue;
  22579. }
  22580. if ('' !== $buffer) {
  22581. if ($unescapeSlashes) {
  22582. $buffer = str_replace('\\/', '/', $buffer);
  22583. }
  22584. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  22585. $buffer = Preg::replaceCallback('/(\\\\+)u([0-9a-f]{4})/i', static function ($match): string {
  22586. $l = strlen($match[1]);
  22587. if ($l % 2) {
  22588. $code = hexdec($match[2]);
  22589. if (0xD800 <= $code && 0xDFFF >= $code) {
  22590. return $match[0];
  22591. }
  22592. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  22593. pack('H*', $match[2]),
  22594. 'UTF-8',
  22595. 'UCS-2BE'
  22596. );
  22597. }
  22598. return $match[0];
  22599. }, $buffer);
  22600. }
  22601. $result .= $buffer.$char;
  22602. $buffer = '';
  22603. continue;
  22604. }
  22605. if (':' === $char) {
  22606. $char .= ' ';
  22607. } elseif ('}' === $char || ']' === $char) {
  22608. $pos--;
  22609. $prevChar = substr($json, $i - 1, 1);
  22610. if ('{' !== $prevChar && '[' !== $prevChar) {
  22611. $result .= $newLine;
  22612. $result .= str_repeat($indentStr, $pos);
  22613. } else {
  22614. $result = rtrim($result);
  22615. }
  22616. }
  22617. $result .= $char;
  22618. if (',' === $char || '{' === $char || '[' === $char) {
  22619. $result .= $newLine;
  22620. if ('{' === $char || '[' === $char) {
  22621. $pos++;
  22622. }
  22623. $result .= str_repeat($indentStr, $pos);
  22624. }
  22625. }
  22626. return $result;
  22627. }
  22628. }
  22629. <?php declare(strict_types=1);
  22630. namespace Composer\Json;
  22631. use Composer\Pcre\Preg;
  22632. use Composer\Repository\PlatformRepository;
  22633. class JsonManipulator
  22634. {
  22635. private const DEFINES = '(?(DEFINE)
  22636. (?<number> -? (?= [1-9]|0(?!\d) ) \d++ (?:\.\d++)? (?:[eE] [+-]?+ \d++)? )
  22637. (?<boolean> true | false | null )
  22638. (?<string> " (?:[^"\\\\]*+ | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  22639. (?<array> \[ (?: (?&json) \s*+ (?: , (?&json) \s*+ )*+ )?+ \s*+ \] )
  22640. (?<pair> \s*+ (?&string) \s*+ : (?&json) \s*+ )
  22641. (?<object> \{ (?: (?&pair) (?: , (?&pair) )*+ )?+ \s*+ \} )
  22642. (?<json> \s*+ (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  22643. )';
  22644. private $contents;
  22645. private $newline;
  22646. private $indent;
  22647. public function __construct(string $contents)
  22648. {
  22649. $contents = trim($contents);
  22650. if ($contents === '') {
  22651. $contents = '{}';
  22652. }
  22653. if (!Preg::isMatch('#^\{(.*)\}$#s', $contents)) {
  22654. throw new \InvalidArgumentException('The json file must be an object ({})');
  22655. }
  22656. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  22657. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  22658. $this->detectIndenting();
  22659. }
  22660. public function getContents(): string
  22661. {
  22662. return $this->contents . $this->newline;
  22663. }
  22664. public function addLink(string $type, string $package, string $constraint, bool $sortPackages = false): bool
  22665. {
  22666. $decoded = JsonFile::parseJson($this->contents);
  22667. if (!isset($decoded[$type])) {
  22668. return $this->addMainKey($type, [$package => $constraint]);
  22669. }
  22670. $regex = '{'.self::DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  22671. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  22672. if (!Preg::isMatch($regex, $this->contents, $matches)) {
  22673. return false;
  22674. }
  22675. assert(is_string($matches['start']));
  22676. assert(is_string($matches['value']));
  22677. assert(is_string($matches['end']));
  22678. $links = $matches['value'];
  22679. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  22680. $regex = '{'.self::DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  22681. if (Preg::isMatch($regex, $links, $packageMatches)) {
  22682. assert(is_string($packageMatches['package']));
  22683. $existingPackage = $packageMatches['package'];
  22684. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  22685. $links = Preg::replaceCallback('{'.self::DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', static function ($m) use ($existingPackage, $constraint): string {
  22686. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  22687. }, $links);
  22688. } else {
  22689. if (Preg::isMatchStrictGroups('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  22690. $links = Preg::replace(
  22691. '{'.preg_quote($match[1]).'$}',
  22692. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  22693. $links
  22694. );
  22695. } else {
  22696. $links = '{' . $this->newline .
  22697. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  22698. $this->indent . '}';
  22699. }
  22700. }
  22701. if (true === $sortPackages) {
  22702. $requirements = json_decode($links, true);
  22703. $this->sortPackages($requirements);
  22704. $links = $this->format($requirements);
  22705. }
  22706. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  22707. return true;
  22708. }
  22709. private function sortPackages(array &$packages = []): void
  22710. {
  22711. $prefix = static function ($requirement): string {
  22712. if (PlatformRepository::isPlatformPackage($requirement)) {
  22713. return Preg::replace(
  22714. [
  22715. '/^php/',
  22716. '/^hhvm/',
  22717. '/^ext/',
  22718. '/^lib/',
  22719. '/^\D/',
  22720. ],
  22721. [
  22722. '0-$0',
  22723. '1-$0',
  22724. '2-$0',
  22725. '3-$0',
  22726. '4-$0',
  22727. ],
  22728. $requirement
  22729. );
  22730. }
  22731. return '5-'.$requirement;
  22732. };
  22733. uksort($packages, static function ($a, $b) use ($prefix): int {
  22734. return strnatcmp($prefix($a), $prefix($b));
  22735. });
  22736. }
  22737. public function addRepository(string $name, $config, bool $append = true): bool
  22738. {
  22739. return $this->addSubNode('repositories', $name, $config, $append);
  22740. }
  22741. public function removeRepository(string $name): bool
  22742. {
  22743. return $this->removeSubNode('repositories', $name);
  22744. }
  22745. public function addConfigSetting(string $name, $value): bool
  22746. {
  22747. return $this->addSubNode('config', $name, $value);
  22748. }
  22749. public function removeConfigSetting(string $name): bool
  22750. {
  22751. return $this->removeSubNode('config', $name);
  22752. }
  22753. public function addProperty(string $name, $value): bool
  22754. {
  22755. if (strpos($name, 'suggest.') === 0) {
  22756. return $this->addSubNode('suggest', substr($name, 8), $value);
  22757. }
  22758. if (strpos($name, 'extra.') === 0) {
  22759. return $this->addSubNode('extra', substr($name, 6), $value);
  22760. }
  22761. if (strpos($name, 'scripts.') === 0) {
  22762. return $this->addSubNode('scripts', substr($name, 8), $value);
  22763. }
  22764. return $this->addMainKey($name, $value);
  22765. }
  22766. public function removeProperty(string $name): bool
  22767. {
  22768. if (strpos($name, 'suggest.') === 0) {
  22769. return $this->removeSubNode('suggest', substr($name, 8));
  22770. }
  22771. if (strpos($name, 'extra.') === 0) {
  22772. return $this->removeSubNode('extra', substr($name, 6));
  22773. }
  22774. if (strpos($name, 'scripts.') === 0) {
  22775. return $this->removeSubNode('scripts', substr($name, 8));
  22776. }
  22777. if (strpos($name, 'autoload.') === 0) {
  22778. return $this->removeSubNode('autoload', substr($name, 9));
  22779. }
  22780. if (strpos($name, 'autoload-dev.') === 0) {
  22781. return $this->removeSubNode('autoload-dev', substr($name, 13));
  22782. }
  22783. return $this->removeMainKey($name);
  22784. }
  22785. public function addSubNode(string $mainNode, string $name, $value, bool $append = true): bool
  22786. {
  22787. $decoded = JsonFile::parseJson($this->contents);
  22788. $subName = null;
  22789. if (in_array($mainNode, ['config', 'extra', 'scripts']) && false !== strpos($name, '.')) {
  22790. [$name, $subName] = explode('.', $name, 2);
  22791. }
  22792. if (!isset($decoded[$mainNode])) {
  22793. if ($subName !== null) {
  22794. $this->addMainKey($mainNode, [$name => [$subName => $value]]);
  22795. } else {
  22796. $this->addMainKey($mainNode, [$name => $value]);
  22797. }
  22798. return true;
  22799. }
  22800. $nodeRegex = '{'.self::DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  22801. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  22802. try {
  22803. if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
  22804. return false;
  22805. }
  22806. } catch (\RuntimeException $e) {
  22807. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  22808. return false;
  22809. }
  22810. throw $e;
  22811. }
  22812. assert(is_string($match['start']));
  22813. assert(is_string($match['content']));
  22814. assert(is_string($match['end']));
  22815. $children = $match['content'];
  22816. if (!@json_decode($children)) {
  22817. return false;
  22818. }
  22819. $childRegex = '{'.self::DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  22820. if (Preg::isMatch($childRegex, $children, $matches)) {
  22821. $children = Preg::replaceCallback($childRegex, function ($matches) use ($subName, $value): string {
  22822. if ($subName !== null && is_string($matches['content'])) {
  22823. $curVal = json_decode($matches['content'], true);
  22824. if (!is_array($curVal)) {
  22825. $curVal = [];
  22826. }
  22827. $curVal[$subName] = $value;
  22828. $value = $curVal;
  22829. }
  22830. return $matches['start'] . $this->format($value, 1) . $matches['end'];
  22831. }, $children);
  22832. } else {
  22833. Preg::match('#^{ (?P<leadingspace>\s*?) (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  22834. $whitespace = '';
  22835. if (!empty($match['trailingspace'])) {
  22836. $whitespace = $match['trailingspace'];
  22837. }
  22838. if (!empty($match['content'])) {
  22839. if ($subName !== null) {
  22840. $value = [$subName => $value];
  22841. }
  22842. if ($append) {
  22843. $children = Preg::replace(
  22844. '#'.$whitespace.'}$#',
  22845. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  22846. $children
  22847. );
  22848. } else {
  22849. $whitespace = '';
  22850. if (!empty($match['leadingspace'])) {
  22851. $whitespace = $match['leadingspace'];
  22852. }
  22853. $children = Preg::replace(
  22854. '#^{'.$whitespace.'#',
  22855. addcslashes('{' . $whitespace . JsonFile::encode($name).': '.$this->format($value, 1) . ',' . $this->newline . $this->indent . $this->indent, '\\$'),
  22856. $children
  22857. );
  22858. }
  22859. } else {
  22860. if ($subName !== null) {
  22861. $value = [$subName => $value];
  22862. }
  22863. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  22864. }
  22865. }
  22866. $this->contents = Preg::replaceCallback($nodeRegex, static function ($m) use ($children): string {
  22867. return $m['start'] . $children . $m['end'];
  22868. }, $this->contents);
  22869. return true;
  22870. }
  22871. public function removeSubNode(string $mainNode, string $name): bool
  22872. {
  22873. $decoded = JsonFile::parseJson($this->contents);
  22874. if (empty($decoded[$mainNode])) {
  22875. return true;
  22876. }
  22877. $nodeRegex = '{'.self::DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  22878. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  22879. try {
  22880. if (!Preg::isMatch($nodeRegex, $this->contents, $match)) {
  22881. return false;
  22882. }
  22883. } catch (\RuntimeException $e) {
  22884. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  22885. return false;
  22886. }
  22887. throw $e;
  22888. }
  22889. assert(is_string($match['start']));
  22890. assert(is_string($match['content']));
  22891. assert(is_string($match['end']));
  22892. $children = $match['content'];
  22893. if (!@json_decode($children, true)) {
  22894. return false;
  22895. }
  22896. $subName = null;
  22897. if (in_array($mainNode, ['config', 'extra', 'scripts']) && false !== strpos($name, '.')) {
  22898. [$name, $subName] = explode('.', $name, 2);
  22899. }
  22900. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  22901. return true;
  22902. }
  22903. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  22904. if (Preg::isMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  22905. if (Preg::isMatchAll('{'.self::DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  22906. $bestMatch = '';
  22907. foreach ($matches[0] as $match) {
  22908. assert(is_string($match));
  22909. if (strlen($bestMatch) < strlen($match)) {
  22910. $bestMatch = $match;
  22911. }
  22912. }
  22913. $childrenClean = Preg::replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  22914. if (1 !== $count) {
  22915. $childrenClean = Preg::replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  22916. if (1 !== $count) {
  22917. return false;
  22918. }
  22919. }
  22920. }
  22921. } else {
  22922. $childrenClean = $children;
  22923. }
  22924. if (!isset($childrenClean)) {
  22925. throw new \InvalidArgumentException("JsonManipulator: \$childrenClean is not defined. Please report at https://github.com/composer/composer/issues/new.");
  22926. }
  22927. unset($match);
  22928. Preg::match('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  22929. if (empty($match['content'])) {
  22930. $newline = $this->newline;
  22931. $indent = $this->indent;
  22932. $this->contents = Preg::replaceCallback($nodeRegex, static function ($matches) use ($indent, $newline): string {
  22933. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  22934. }, $this->contents);
  22935. if ($subName !== null) {
  22936. $curVal = json_decode($children, true);
  22937. unset($curVal[$name][$subName]);
  22938. if ($curVal[$name] === []) {
  22939. $curVal[$name] = new \ArrayObject();
  22940. }
  22941. $this->addSubNode($mainNode, $name, $curVal[$name]);
  22942. }
  22943. return true;
  22944. }
  22945. $this->contents = Preg::replaceCallback($nodeRegex, function ($matches) use ($name, $subName, $childrenClean): string {
  22946. assert(is_string($matches['content']));
  22947. if ($subName !== null) {
  22948. $curVal = json_decode($matches['content'], true);
  22949. unset($curVal[$name][$subName]);
  22950. if ($curVal[$name] === []) {
  22951. $curVal[$name] = new \ArrayObject();
  22952. }
  22953. $childrenClean = $this->format($curVal, 0, true);
  22954. }
  22955. return $matches['start'] . $childrenClean . $matches['end'];
  22956. }, $this->contents);
  22957. return true;
  22958. }
  22959. public function addMainKey(string $key, $content): bool
  22960. {
  22961. $decoded = JsonFile::parseJson($this->contents);
  22962. $content = $this->format($content);
  22963. $regex = '{'.self::DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  22964. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  22965. if (isset($decoded[$key]) && Preg::isMatch($regex, $this->contents, $matches)) {
  22966. if (!@json_decode('{'.$matches['key'].'}')) {
  22967. return false;
  22968. }
  22969. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  22970. return true;
  22971. }
  22972. if (Preg::isMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  22973. $this->contents = Preg::replace(
  22974. '#'.$match[1].'\}$#',
  22975. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  22976. $this->contents
  22977. );
  22978. return true;
  22979. }
  22980. $this->contents = Preg::replace(
  22981. '#\}$#',
  22982. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  22983. $this->contents
  22984. );
  22985. return true;
  22986. }
  22987. public function removeMainKey(string $key): bool
  22988. {
  22989. $decoded = JsonFile::parseJson($this->contents);
  22990. if (!array_key_exists($key, $decoded)) {
  22991. return true;
  22992. }
  22993. $regex = '{'.self::DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  22994. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  22995. if (Preg::isMatch($regex, $this->contents, $matches)) {
  22996. assert(is_string($matches['start']));
  22997. assert(is_string($matches['removal']));
  22998. assert(is_string($matches['end']));
  22999. if (!@json_decode('{'.$matches['removal'].'}')) {
  23000. return false;
  23001. }
  23002. if (Preg::isMatchStrictGroups('#,\s*$#', $matches['start']) && Preg::isMatch('#^\}$#', $matches['end'])) {
  23003. $matches['start'] = rtrim(Preg::replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  23004. }
  23005. $this->contents = $matches['start'] . $matches['end'];
  23006. if (Preg::isMatch('#^\{\s*\}\s*$#', $this->contents)) {
  23007. $this->contents = "{\n}";
  23008. }
  23009. return true;
  23010. }
  23011. return false;
  23012. }
  23013. public function removeMainKeyIfEmpty(string $key): bool
  23014. {
  23015. $decoded = JsonFile::parseJson($this->contents);
  23016. if (!array_key_exists($key, $decoded)) {
  23017. return true;
  23018. }
  23019. if (is_array($decoded[$key]) && count($decoded[$key]) === 0) {
  23020. return $this->removeMainKey($key);
  23021. }
  23022. return true;
  23023. }
  23024. public function format($data, int $depth = 0, bool $wasObject = false): string
  23025. {
  23026. if ($data instanceof \stdClass || $data instanceof \ArrayObject) {
  23027. $data = (array) $data;
  23028. $wasObject = true;
  23029. }
  23030. if (is_array($data)) {
  23031. if (\count($data) === 0) {
  23032. return $wasObject ? '{' . $this->newline . str_repeat($this->indent, $depth + 1) . '}' : '[]';
  23033. }
  23034. if (array_is_list($data)) {
  23035. foreach ($data as $key => $val) {
  23036. $data[$key] = $this->format($val, $depth + 1);
  23037. }
  23038. return '['.implode(', ', $data).']';
  23039. }
  23040. $out = '{' . $this->newline;
  23041. $elems = [];
  23042. foreach ($data as $key => $val) {
  23043. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode((string) $key). ': '.$this->format($val, $depth + 1);
  23044. }
  23045. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  23046. }
  23047. return JsonFile::encode($data);
  23048. }
  23049. protected function detectIndenting(): void
  23050. {
  23051. $this->indent = JsonFile::detectIndenting($this->contents);
  23052. }
  23053. }
  23054. <?php declare(strict_types=1);
  23055. namespace Composer\Json;
  23056. use Exception;
  23057. class JsonValidationException extends Exception
  23058. {
  23059. protected $errors;
  23060. public function __construct(string $message, array $errors = [], ?Exception $previous = null)
  23061. {
  23062. $this->errors = $errors;
  23063. parent::__construct((string) $message, 0, $previous);
  23064. }
  23065. public function getErrors(): array
  23066. {
  23067. return $this->errors;
  23068. }
  23069. }
  23070. <?php declare(strict_types=1);
  23071. namespace Composer\PHPStan;
  23072. use Composer\Config;
  23073. use Composer\Json\JsonFile;
  23074. use PhpParser\Node\Expr\MethodCall;
  23075. use PHPStan\Analyser\Scope;
  23076. use PHPStan\Reflection\MethodReflection;
  23077. use PHPStan\Reflection\ParametersAcceptorSelector;
  23078. use PHPStan\Type\ArrayType;
  23079. use PHPStan\Type\BooleanType;
  23080. use PHPStan\Type\Constant\ConstantArrayType;
  23081. use PHPStan\Type\Constant\ConstantBooleanType;
  23082. use PHPStan\Type\Constant\ConstantStringType;
  23083. use PHPStan\Type\DynamicMethodReturnTypeExtension;
  23084. use PHPStan\Type\IntegerRangeType;
  23085. use PHPStan\Type\IntegerType;
  23086. use PHPStan\Type\MixedType;
  23087. use PHPStan\Type\StringType;
  23088. use PHPStan\Type\Type;
  23089. use PHPStan\Type\TypeCombinator;
  23090. use PHPStan\Type\TypeUtils;
  23091. use PHPStan\Type\UnionType;
  23092. final class ConfigReturnTypeExtension implements DynamicMethodReturnTypeExtension
  23093. {
  23094. private $properties = [];
  23095. public function __construct()
  23096. {
  23097. $schema = JsonFile::parseJson((string) file_get_contents(JsonFile::COMPOSER_SCHEMA_PATH));
  23098. foreach ($schema['properties']['config']['properties'] as $prop => $conf) {
  23099. $type = $this->parseType($conf, $prop);
  23100. $this->properties[$prop] = $type;
  23101. }
  23102. }
  23103. public function getClass(): string
  23104. {
  23105. return Config::class;
  23106. }
  23107. public function isMethodSupported(MethodReflection $methodReflection): bool
  23108. {
  23109. return strtolower($methodReflection->getName()) === 'get';
  23110. }
  23111. public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type
  23112. {
  23113. $args = $methodCall->getArgs();
  23114. if (count($args) < 1) {
  23115. return null;
  23116. }
  23117. $keyType = $scope->getType($args[0]->value);
  23118. if (method_exists($keyType, 'getConstantStrings')) {
  23119. $strings = $keyType->getConstantStrings();
  23120. } else {
  23121. $strings = TypeUtils::getConstantStrings($keyType);
  23122. }
  23123. if ($strings !== []) {
  23124. $types = [];
  23125. foreach($strings as $string) {
  23126. if (!isset($this->properties[$string->getValue()])) {
  23127. return null;
  23128. }
  23129. $types[] = $this->properties[$string->getValue()];
  23130. }
  23131. return TypeCombinator::union(...$types);
  23132. }
  23133. return null;
  23134. }
  23135. private function parseType(array $def, string $path): Type
  23136. {
  23137. if (isset($def['type'])) {
  23138. $types = [];
  23139. foreach ((array) $def['type'] as $type) {
  23140. switch ($type) {
  23141. case 'integer':
  23142. if (in_array($path, ['process-timeout', 'cache-ttl', 'cache-files-ttl', 'cache-files-maxsize'], true)) {
  23143. $types[] = IntegerRangeType::createAllGreaterThanOrEqualTo(0);
  23144. } else {
  23145. $types[] = new IntegerType();
  23146. }
  23147. break;
  23148. case 'string':
  23149. if ($path === 'cache-files-maxsize') {
  23150. } elseif ($path === 'discard-changes') {
  23151. $types[] = new ConstantStringType('stash');
  23152. } elseif ($path === 'use-parent-dir') {
  23153. $types[] = new ConstantStringType('prompt');
  23154. } elseif ($path === 'store-auths') {
  23155. $types[] = new ConstantStringType('prompt');
  23156. } elseif ($path === 'platform-check') {
  23157. $types[] = new ConstantStringType('php-only');
  23158. } elseif ($path === 'github-protocols') {
  23159. $types[] = new UnionType([new ConstantStringType('git'), new ConstantStringType('https'), new ConstantStringType('ssh'), new ConstantStringType('http')]);
  23160. } elseif (str_starts_with($path, 'preferred-install')) {
  23161. $types[] = new UnionType([new ConstantStringType('source'), new ConstantStringType('dist'), new ConstantStringType('auto')]);
  23162. } else {
  23163. $types[] = new StringType();
  23164. }
  23165. break;
  23166. case 'boolean':
  23167. if ($path === 'platform.additionalProperties') {
  23168. $types[] = new ConstantBooleanType(false);
  23169. } else {
  23170. $types[] = new BooleanType();
  23171. }
  23172. break;
  23173. case 'object':
  23174. $addlPropType = null;
  23175. if (isset($def['additionalProperties'])) {
  23176. $addlPropType = $this->parseType($def['additionalProperties'], $path.'.additionalProperties');
  23177. }
  23178. if (isset($def['properties'])) {
  23179. $keyNames = [];
  23180. $valTypes = [];
  23181. $optionalKeys = [];
  23182. $propIndex = 0;
  23183. foreach ($def['properties'] as $propName => $propdef) {
  23184. $keyNames[] = new ConstantStringType($propName);
  23185. $valType = $this->parseType($propdef, $path.'.'.$propName);
  23186. if (!isset($def['required']) || !in_array($propName, $def['required'], true)) {
  23187. $valType = TypeCombinator::addNull($valType);
  23188. $optionalKeys[] = $propIndex;
  23189. }
  23190. $valTypes[] = $valType;
  23191. $propIndex++;
  23192. }
  23193. if ($addlPropType !== null) {
  23194. $types[] = new ArrayType(TypeCombinator::union(new StringType(), ...$keyNames), TypeCombinator::union($addlPropType, ...$valTypes));
  23195. } else {
  23196. $types[] = new ConstantArrayType($keyNames, $valTypes, [0], $optionalKeys);
  23197. }
  23198. } else {
  23199. $types[] = new ArrayType(new StringType(), $addlPropType ?? new MixedType());
  23200. }
  23201. break;
  23202. case 'array':
  23203. if (isset($def['items'])) {
  23204. $valType = $this->parseType($def['items'], $path.'.items');
  23205. } else {
  23206. $valType = new MixedType();
  23207. }
  23208. $types[] = new ArrayType(new IntegerType(), $valType);
  23209. break;
  23210. default:
  23211. $types[] = new MixedType();
  23212. }
  23213. }
  23214. $type = TypeCombinator::union(...$types);
  23215. } elseif (isset($def['enum'])) {
  23216. $type = TypeCombinator::union(...array_map(static function (string $value): ConstantStringType {
  23217. return new ConstantStringType($value);
  23218. }, $def['enum']));
  23219. } else {
  23220. $type = new MixedType();
  23221. }
  23222. if ($path === 'allow-plugins' && time() < strtotime('2022-07-01')) {
  23223. $type = TypeCombinator::addNull($type);
  23224. }
  23225. if (in_array($path, ['autoloader-suffix', 'gitlab-protocol'], true)) {
  23226. $type = TypeCombinator::addNull($type);
  23227. }
  23228. return $type;
  23229. }
  23230. }
  23231. <?php declare(strict_types=1);
  23232. namespace Composer\PHPStan;
  23233. use Composer\DependencyResolver\Rule;
  23234. use Composer\Package\BasePackage;
  23235. use Composer\Package\Link;
  23236. use Composer\Semver\Constraint\ConstraintInterface;
  23237. use PhpParser\Node\Expr\MethodCall;
  23238. use PHPStan\Analyser\Scope;
  23239. use PHPStan\Reflection\MethodReflection;
  23240. use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
  23241. use PHPStan\Type\Constant\ConstantArrayType;
  23242. use PHPStan\Type\Constant\ConstantStringType;
  23243. use PHPStan\Type\Constant\ConstantIntegerType;
  23244. use PHPStan\Type\DynamicMethodReturnTypeExtension;
  23245. use PHPStan\Type\IntegerType;
  23246. use PHPStan\Type\StringType;
  23247. use PHPStan\Type\Type;
  23248. use PHPStan\Type\ObjectType;
  23249. use PHPStan\Type\TypeCombinator;
  23250. use PhpParser\Node\Identifier;
  23251. final class RuleReasonDataReturnTypeExtension implements DynamicMethodReturnTypeExtension
  23252. {
  23253. public function getClass(): string
  23254. {
  23255. return Rule::class;
  23256. }
  23257. public function isMethodSupported(MethodReflection $methodReflection): bool
  23258. {
  23259. return strtolower($methodReflection->getName()) === 'getreasondata';
  23260. }
  23261. public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
  23262. {
  23263. $reasonType = $scope->getType(new MethodCall($methodCall->var, new Identifier('getReason')));
  23264. $types = [
  23265. Rule::RULE_ROOT_REQUIRE => new ConstantArrayType([new ConstantStringType('packageName'), new ConstantStringType('constraint')], [new StringType, new ObjectType(ConstraintInterface::class)]),
  23266. Rule::RULE_FIXED => new ConstantArrayType([new ConstantStringType('package')], [new ObjectType(BasePackage::class)]),
  23267. Rule::RULE_PACKAGE_CONFLICT => new ObjectType(Link::class),
  23268. Rule::RULE_PACKAGE_REQUIRES => new ObjectType(Link::class),
  23269. Rule::RULE_PACKAGE_SAME_NAME => TypeCombinator::intersect(new StringType, new AccessoryNonEmptyStringType()),
  23270. Rule::RULE_LEARNED => new IntegerType(),
  23271. Rule::RULE_PACKAGE_ALIAS => new ObjectType(BasePackage::class),
  23272. Rule::RULE_PACKAGE_INVERSE_ALIAS => new ObjectType(BasePackage::class),
  23273. ];
  23274. foreach ($types as $const => $type) {
  23275. if ((new ConstantIntegerType($const))->isSuperTypeOf($reasonType)->yes()) {
  23276. return $type;
  23277. }
  23278. }
  23279. return TypeCombinator::union(...$types);
  23280. }
  23281. }
  23282. <?php declare(strict_types=1);
  23283. namespace Composer\Package;
  23284. use Composer\Semver\Constraint\Constraint;
  23285. use Composer\Package\Version\VersionParser;
  23286. class AliasPackage extends BasePackage
  23287. {
  23288. protected $version;
  23289. protected $prettyVersion;
  23290. protected $dev;
  23291. protected $rootPackageAlias = false;
  23292. protected $stability;
  23293. protected $hasSelfVersionRequires = false;
  23294. protected $aliasOf;
  23295. protected $requires;
  23296. protected $devRequires;
  23297. protected $conflicts;
  23298. protected $provides;
  23299. protected $replaces;
  23300. public function __construct(BasePackage $aliasOf, string $version, string $prettyVersion)
  23301. {
  23302. parent::__construct($aliasOf->getName());
  23303. $this->version = $version;
  23304. $this->prettyVersion = $prettyVersion;
  23305. $this->aliasOf = $aliasOf;
  23306. $this->stability = VersionParser::parseStability($version);
  23307. $this->dev = $this->stability === 'dev';
  23308. foreach (Link::$TYPES as $type) {
  23309. $links = $aliasOf->{'get' . ucfirst($type)}();
  23310. $this->{$type} = $this->replaceSelfVersionDependencies($links, $type);
  23311. }
  23312. }
  23313. public function getAliasOf()
  23314. {
  23315. return $this->aliasOf;
  23316. }
  23317. public function getVersion(): string
  23318. {
  23319. return $this->version;
  23320. }
  23321. public function getStability(): string
  23322. {
  23323. return $this->stability;
  23324. }
  23325. public function getPrettyVersion(): string
  23326. {
  23327. return $this->prettyVersion;
  23328. }
  23329. public function isDev(): bool
  23330. {
  23331. return $this->dev;
  23332. }
  23333. public function getRequires(): array
  23334. {
  23335. return $this->requires;
  23336. }
  23337. public function getConflicts(): array
  23338. {
  23339. return $this->conflicts;
  23340. }
  23341. public function getProvides(): array
  23342. {
  23343. return $this->provides;
  23344. }
  23345. public function getReplaces(): array
  23346. {
  23347. return $this->replaces;
  23348. }
  23349. public function getDevRequires(): array
  23350. {
  23351. return $this->devRequires;
  23352. }
  23353. public function setRootPackageAlias(bool $value): void
  23354. {
  23355. $this->rootPackageAlias = $value;
  23356. }
  23357. public function isRootPackageAlias(): bool
  23358. {
  23359. return $this->rootPackageAlias;
  23360. }
  23361. protected function replaceSelfVersionDependencies(array $links, $linkType): array
  23362. {
  23363. $prettyVersion = $this->prettyVersion;
  23364. if ($prettyVersion === VersionParser::DEFAULT_BRANCH_ALIAS) {
  23365. $prettyVersion = $this->aliasOf->getPrettyVersion();
  23366. }
  23367. if (\in_array($linkType, [Link::TYPE_CONFLICT, Link::TYPE_PROVIDE, Link::TYPE_REPLACE], true)) {
  23368. $newLinks = [];
  23369. foreach ($links as $link) {
  23370. if ('self.version' === $link->getPrettyConstraint()) {
  23371. $newLinks[] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
  23372. $constraint->setPrettyString($prettyVersion);
  23373. }
  23374. }
  23375. $links = array_merge($links, $newLinks);
  23376. } else {
  23377. foreach ($links as $index => $link) {
  23378. if ('self.version' === $link->getPrettyConstraint()) {
  23379. if ($linkType === Link::TYPE_REQUIRE) {
  23380. $this->hasSelfVersionRequires = true;
  23381. }
  23382. $links[$index] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
  23383. $constraint->setPrettyString($prettyVersion);
  23384. }
  23385. }
  23386. }
  23387. return $links;
  23388. }
  23389. public function hasSelfVersionRequires(): bool
  23390. {
  23391. return $this->hasSelfVersionRequires;
  23392. }
  23393. public function __toString(): string
  23394. {
  23395. return parent::__toString().' ('.($this->rootPackageAlias ? 'root ' : ''). 'alias of '.$this->aliasOf->getVersion().')';
  23396. }
  23397. public function getType(): string
  23398. {
  23399. return $this->aliasOf->getType();
  23400. }
  23401. public function getTargetDir(): ?string
  23402. {
  23403. return $this->aliasOf->getTargetDir();
  23404. }
  23405. public function getExtra(): array
  23406. {
  23407. return $this->aliasOf->getExtra();
  23408. }
  23409. public function setInstallationSource(?string $type): void
  23410. {
  23411. $this->aliasOf->setInstallationSource($type);
  23412. }
  23413. public function getInstallationSource(): ?string
  23414. {
  23415. return $this->aliasOf->getInstallationSource();
  23416. }
  23417. public function getSourceType(): ?string
  23418. {
  23419. return $this->aliasOf->getSourceType();
  23420. }
  23421. public function getSourceUrl(): ?string
  23422. {
  23423. return $this->aliasOf->getSourceUrl();
  23424. }
  23425. public function getSourceUrls(): array
  23426. {
  23427. return $this->aliasOf->getSourceUrls();
  23428. }
  23429. public function getSourceReference(): ?string
  23430. {
  23431. return $this->aliasOf->getSourceReference();
  23432. }
  23433. public function setSourceReference(?string $reference): void
  23434. {
  23435. $this->aliasOf->setSourceReference($reference);
  23436. }
  23437. public function setSourceMirrors(?array $mirrors): void
  23438. {
  23439. $this->aliasOf->setSourceMirrors($mirrors);
  23440. }
  23441. public function getSourceMirrors(): ?array
  23442. {
  23443. return $this->aliasOf->getSourceMirrors();
  23444. }
  23445. public function getDistType(): ?string
  23446. {
  23447. return $this->aliasOf->getDistType();
  23448. }
  23449. public function getDistUrl(): ?string
  23450. {
  23451. return $this->aliasOf->getDistUrl();
  23452. }
  23453. public function getDistUrls(): array
  23454. {
  23455. return $this->aliasOf->getDistUrls();
  23456. }
  23457. public function getDistReference(): ?string
  23458. {
  23459. return $this->aliasOf->getDistReference();
  23460. }
  23461. public function setDistReference(?string $reference): void
  23462. {
  23463. $this->aliasOf->setDistReference($reference);
  23464. }
  23465. public function getDistSha1Checksum(): ?string
  23466. {
  23467. return $this->aliasOf->getDistSha1Checksum();
  23468. }
  23469. public function setTransportOptions(array $options): void
  23470. {
  23471. $this->aliasOf->setTransportOptions($options);
  23472. }
  23473. public function getTransportOptions(): array
  23474. {
  23475. return $this->aliasOf->getTransportOptions();
  23476. }
  23477. public function setDistMirrors(?array $mirrors): void
  23478. {
  23479. $this->aliasOf->setDistMirrors($mirrors);
  23480. }
  23481. public function getDistMirrors(): ?array
  23482. {
  23483. return $this->aliasOf->getDistMirrors();
  23484. }
  23485. public function getAutoload(): array
  23486. {
  23487. return $this->aliasOf->getAutoload();
  23488. }
  23489. public function getDevAutoload(): array
  23490. {
  23491. return $this->aliasOf->getDevAutoload();
  23492. }
  23493. public function getIncludePaths(): array
  23494. {
  23495. return $this->aliasOf->getIncludePaths();
  23496. }
  23497. public function getPhpExt(): ?array
  23498. {
  23499. return $this->aliasOf->getPhpExt();
  23500. }
  23501. public function getReleaseDate(): ?\DateTimeInterface
  23502. {
  23503. return $this->aliasOf->getReleaseDate();
  23504. }
  23505. public function getBinaries(): array
  23506. {
  23507. return $this->aliasOf->getBinaries();
  23508. }
  23509. public function getSuggests(): array
  23510. {
  23511. return $this->aliasOf->getSuggests();
  23512. }
  23513. public function getNotificationUrl(): ?string
  23514. {
  23515. return $this->aliasOf->getNotificationUrl();
  23516. }
  23517. public function isDefaultBranch(): bool
  23518. {
  23519. return $this->aliasOf->isDefaultBranch();
  23520. }
  23521. public function setDistUrl(?string $url): void
  23522. {
  23523. $this->aliasOf->setDistUrl($url);
  23524. }
  23525. public function setDistType(?string $type): void
  23526. {
  23527. $this->aliasOf->setDistType($type);
  23528. }
  23529. public function setSourceDistReferences(string $reference): void
  23530. {
  23531. $this->aliasOf->setSourceDistReferences($reference);
  23532. }
  23533. }
  23534. <?php declare(strict_types=1);
  23535. namespace Composer\Package\Archiver;
  23536. use FilterIterator;
  23537. use Iterator;
  23538. use PharData;
  23539. use SplFileInfo;
  23540. class ArchivableFilesFilter extends FilterIterator
  23541. {
  23542. private $dirs = [];
  23543. public function accept(): bool
  23544. {
  23545. $file = $this->getInnerIterator()->current();
  23546. if ($file->isDir()) {
  23547. $this->dirs[] = (string) $file;
  23548. return false;
  23549. }
  23550. return true;
  23551. }
  23552. public function addEmptyDir(PharData $phar, string $sources): void
  23553. {
  23554. foreach ($this->dirs as $filepath) {
  23555. $localname = str_replace($sources . "/", '', $filepath);
  23556. $phar->addEmptyDir($localname);
  23557. }
  23558. }
  23559. }
  23560. <?php declare(strict_types=1);
  23561. namespace Composer\Package\Archiver;
  23562. use Composer\Pcre\Preg;
  23563. use Composer\Util\Filesystem;
  23564. use FilesystemIterator;
  23565. use FilterIterator;
  23566. use Iterator;
  23567. use Symfony\Component\Finder\Finder;
  23568. use Symfony\Component\Finder\SplFileInfo;
  23569. class ArchivableFilesFinder extends FilterIterator
  23570. {
  23571. protected $finder;
  23572. public function __construct(string $sources, array $excludes, bool $ignoreFilters = false)
  23573. {
  23574. $fs = new Filesystem();
  23575. $sourcesRealPath = realpath($sources);
  23576. if ($sourcesRealPath === false) {
  23577. throw new \RuntimeException('Could not realpath() the source directory "'.$sources.'"');
  23578. }
  23579. $sources = $fs->normalizePath($sourcesRealPath);
  23580. if ($ignoreFilters) {
  23581. $filters = [];
  23582. } else {
  23583. $filters = [
  23584. new GitExcludeFilter($sources),
  23585. new ComposerExcludeFilter($sources, $excludes),
  23586. ];
  23587. }
  23588. $this->finder = new Finder();
  23589. $filter = static function (\SplFileInfo $file) use ($sources, $filters, $fs): bool {
  23590. $realpath = $file->getRealPath();
  23591. if ($realpath === false) {
  23592. return false;
  23593. }
  23594. if ($file->isLink() && strpos($realpath, $sources) !== 0) {
  23595. return false;
  23596. }
  23597. $relativePath = Preg::replace(
  23598. '#^'.preg_quote($sources, '#').'#',
  23599. '',
  23600. $fs->normalizePath($realpath)
  23601. );
  23602. $exclude = false;
  23603. foreach ($filters as $filter) {
  23604. $exclude = $filter->filter($relativePath, $exclude);
  23605. }
  23606. return !$exclude;
  23607. };
  23608. $this->finder
  23609. ->in($sources)
  23610. ->filter($filter)
  23611. ->ignoreVCS(true)
  23612. ->ignoreDotFiles(false)
  23613. ->sortByName();
  23614. parent::__construct($this->finder->getIterator());
  23615. }
  23616. public function accept(): bool
  23617. {
  23618. $current = $this->getInnerIterator()->current();
  23619. if (!$current->isDir()) {
  23620. return true;
  23621. }
  23622. $iterator = new FilesystemIterator((string) $current, FilesystemIterator::SKIP_DOTS);
  23623. return !$iterator->valid();
  23624. }
  23625. }
  23626. <?php declare(strict_types=1);
  23627. namespace Composer\Package\Archiver;
  23628. use Composer\Downloader\DownloadManager;
  23629. use Composer\Package\RootPackageInterface;
  23630. use Composer\Pcre\Preg;
  23631. use Composer\Util\Filesystem;
  23632. use Composer\Util\Loop;
  23633. use Composer\Util\SyncHelper;
  23634. use Composer\Json\JsonFile;
  23635. use Composer\Package\CompletePackageInterface;
  23636. class ArchiveManager
  23637. {
  23638. protected $downloadManager;
  23639. protected $loop;
  23640. protected $archivers = [];
  23641. protected $overwriteFiles = true;
  23642. public function __construct(DownloadManager $downloadManager, Loop $loop)
  23643. {
  23644. $this->downloadManager = $downloadManager;
  23645. $this->loop = $loop;
  23646. }
  23647. public function addArchiver(ArchiverInterface $archiver): void
  23648. {
  23649. $this->archivers[] = $archiver;
  23650. }
  23651. public function setOverwriteFiles(bool $overwriteFiles): self
  23652. {
  23653. $this->overwriteFiles = $overwriteFiles;
  23654. return $this;
  23655. }
  23656. public function getPackageFilenameParts(CompletePackageInterface $package): array
  23657. {
  23658. $baseName = $package->getArchiveName();
  23659. if (null === $baseName) {
  23660. $baseName = Preg::replace('#[^a-z0-9-_]#i', '-', $package->getName());
  23661. }
  23662. $parts = [
  23663. 'base' => $baseName,
  23664. ];
  23665. $distReference = $package->getDistReference();
  23666. if (null !== $distReference && Preg::isMatch('{^[a-f0-9]{40}$}', $distReference)) {
  23667. $parts['dist_reference'] = $distReference;
  23668. $parts['dist_type'] = $package->getDistType();
  23669. } else {
  23670. $parts['version'] = $package->getPrettyVersion();
  23671. $parts['dist_reference'] = $distReference;
  23672. }
  23673. $sourceReference = $package->getSourceReference();
  23674. if (null !== $sourceReference) {
  23675. $parts['source_reference'] = substr(hash('sha1', $sourceReference), 0, 6);
  23676. }
  23677. $parts = array_filter($parts, function (?string $part) {
  23678. return $part !== null;
  23679. });
  23680. foreach ($parts as $key => $part) {
  23681. $parts[$key] = str_replace('/', '-', $part);
  23682. }
  23683. return $parts;
  23684. }
  23685. public function getPackageFilenameFromParts(array $parts): string
  23686. {
  23687. return implode('-', $parts);
  23688. }
  23689. public function getPackageFilename(CompletePackageInterface $package): string
  23690. {
  23691. return $this->getPackageFilenameFromParts($this->getPackageFilenameParts($package));
  23692. }
  23693. public function archive(CompletePackageInterface $package, string $format, string $targetDir, ?string $fileName = null, bool $ignoreFilters = false): string
  23694. {
  23695. if (empty($format)) {
  23696. throw new \InvalidArgumentException('Format must be specified');
  23697. }
  23698. $usableArchiver = null;
  23699. foreach ($this->archivers as $archiver) {
  23700. if ($archiver->supports($format, $package->getSourceType())) {
  23701. $usableArchiver = $archiver;
  23702. break;
  23703. }
  23704. }
  23705. if (null === $usableArchiver) {
  23706. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  23707. }
  23708. $filesystem = new Filesystem();
  23709. if ($package instanceof RootPackageInterface) {
  23710. $sourcePath = realpath('.');
  23711. } else {
  23712. $sourcePath = sys_get_temp_dir().'/composer_archive'.bin2hex(random_bytes(5));
  23713. $filesystem->ensureDirectoryExists($sourcePath);
  23714. try {
  23715. $promise = $this->downloadManager->download($package, $sourcePath);
  23716. SyncHelper::await($this->loop, $promise);
  23717. $promise = $this->downloadManager->install($package, $sourcePath);
  23718. SyncHelper::await($this->loop, $promise);
  23719. } catch (\Exception $e) {
  23720. $filesystem->removeDirectory($sourcePath);
  23721. throw $e;
  23722. }
  23723. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  23724. $jsonFile = new JsonFile($composerJsonPath);
  23725. $jsonData = $jsonFile->read();
  23726. if (!empty($jsonData['archive']['name'])) {
  23727. $package->setArchiveName($jsonData['archive']['name']);
  23728. }
  23729. if (!empty($jsonData['archive']['exclude'])) {
  23730. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  23731. }
  23732. }
  23733. }
  23734. $supportedFormats = $this->getSupportedFormats();
  23735. $packageNameParts = null === $fileName ?
  23736. $this->getPackageFilenameParts($package)
  23737. : ['base' => $fileName];
  23738. $packageName = $this->getPackageFilenameFromParts($packageNameParts);
  23739. $excludePatterns = $this->buildExcludePatterns($packageNameParts, $supportedFormats);
  23740. $filesystem->ensureDirectoryExists($targetDir);
  23741. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  23742. $filesystem->ensureDirectoryExists(dirname($target));
  23743. if (!$this->overwriteFiles && file_exists($target)) {
  23744. return $target;
  23745. }
  23746. $tempTarget = sys_get_temp_dir().'/composer_archive'.bin2hex(random_bytes(5)).'.'.$format;
  23747. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  23748. $archivePath = $usableArchiver->archive(
  23749. $sourcePath,
  23750. $tempTarget,
  23751. $format,
  23752. array_merge($excludePatterns, $package->getArchiveExcludes()),
  23753. $ignoreFilters
  23754. );
  23755. $filesystem->rename($archivePath, $target);
  23756. if (!$package instanceof RootPackageInterface) {
  23757. $filesystem->removeDirectory($sourcePath);
  23758. }
  23759. $filesystem->remove($tempTarget);
  23760. return $target;
  23761. }
  23762. private function buildExcludePatterns(array $parts, array $formats): array
  23763. {
  23764. $base = $parts['base'];
  23765. if (count($parts) > 1) {
  23766. $base .= '-*';
  23767. }
  23768. $patterns = [];
  23769. foreach ($formats as $format) {
  23770. $patterns[] = "$base.$format";
  23771. }
  23772. return $patterns;
  23773. }
  23774. private function getSupportedFormats(): array
  23775. {
  23776. $formats = [];
  23777. foreach ($this->archivers as $archiver) {
  23778. $items = [];
  23779. switch (get_class($archiver)) {
  23780. case ZipArchiver::class:
  23781. $items = ['zip'];
  23782. break;
  23783. case PharArchiver::class:
  23784. $items = ['zip', 'tar', 'tar.gz', 'tar.bz2'];
  23785. break;
  23786. }
  23787. $formats = array_merge($formats, $items);
  23788. }
  23789. return array_unique($formats);
  23790. }
  23791. }
  23792. <?php declare(strict_types=1);
  23793. namespace Composer\Package\Archiver;
  23794. interface ArchiverInterface
  23795. {
  23796. public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string;
  23797. public function supports(string $format, ?string $sourceType): bool;
  23798. }
  23799. <?php declare(strict_types=1);
  23800. namespace Composer\Package\Archiver;
  23801. use Composer\Pcre\Preg;
  23802. use Symfony\Component\Finder;
  23803. abstract class BaseExcludeFilter
  23804. {
  23805. protected $sourcePath;
  23806. protected $excludePatterns;
  23807. public function __construct(string $sourcePath)
  23808. {
  23809. $this->sourcePath = $sourcePath;
  23810. $this->excludePatterns = [];
  23811. }
  23812. public function filter(string $relativePath, bool $exclude): bool
  23813. {
  23814. foreach ($this->excludePatterns as $patternData) {
  23815. [$pattern, $negate, $stripLeadingSlash] = $patternData;
  23816. if ($stripLeadingSlash) {
  23817. $path = substr($relativePath, 1);
  23818. } else {
  23819. $path = $relativePath;
  23820. }
  23821. try {
  23822. if (Preg::isMatch($pattern, $path)) {
  23823. $exclude = !$negate;
  23824. }
  23825. } catch (\RuntimeException $e) {
  23826. }
  23827. }
  23828. return $exclude;
  23829. }
  23830. protected function parseLines(array $lines, callable $lineParser): array
  23831. {
  23832. return array_filter(
  23833. array_map(
  23834. static function ($line) use ($lineParser) {
  23835. $line = trim($line);
  23836. if (!$line || 0 === strpos($line, '#')) {
  23837. return null;
  23838. }
  23839. return $lineParser($line);
  23840. },
  23841. $lines
  23842. ),
  23843. static function ($pattern): bool {
  23844. return $pattern !== null;
  23845. }
  23846. );
  23847. }
  23848. protected function generatePatterns(array $rules): array
  23849. {
  23850. $patterns = [];
  23851. foreach ($rules as $rule) {
  23852. $patterns[] = $this->generatePattern($rule);
  23853. }
  23854. return $patterns;
  23855. }
  23856. protected function generatePattern(string $rule): array
  23857. {
  23858. $negate = false;
  23859. $pattern = '';
  23860. if ($rule !== '' && $rule[0] === '!') {
  23861. $negate = true;
  23862. $rule = ltrim($rule, '!');
  23863. }
  23864. $firstSlashPosition = strpos($rule, '/');
  23865. if (0 === $firstSlashPosition) {
  23866. $pattern = '^/';
  23867. } elseif (false === $firstSlashPosition || strlen($rule) - 1 === $firstSlashPosition) {
  23868. $pattern = '/';
  23869. }
  23870. $rule = trim($rule, '/');
  23871. $rule = substr(Finder\Glob::toRegex($rule), 2, -2);
  23872. return ['{'.$pattern.$rule.'(?=$|/)}', $negate, false];
  23873. }
  23874. }
  23875. <?php declare(strict_types=1);
  23876. namespace Composer\Package\Archiver;
  23877. class ComposerExcludeFilter extends BaseExcludeFilter
  23878. {
  23879. public function __construct(string $sourcePath, array $excludeRules)
  23880. {
  23881. parent::__construct($sourcePath);
  23882. $this->excludePatterns = $this->generatePatterns($excludeRules);
  23883. }
  23884. }
  23885. <?php declare(strict_types=1);
  23886. namespace Composer\Package\Archiver;
  23887. use Composer\Pcre\Preg;
  23888. class GitExcludeFilter extends BaseExcludeFilter
  23889. {
  23890. public function __construct(string $sourcePath)
  23891. {
  23892. parent::__construct($sourcePath);
  23893. if (file_exists($sourcePath.'/.gitattributes')) {
  23894. $this->excludePatterns = array_merge(
  23895. $this->excludePatterns,
  23896. $this->parseLines(
  23897. file($sourcePath.'/.gitattributes'),
  23898. [$this, 'parseGitAttributesLine']
  23899. )
  23900. );
  23901. }
  23902. }
  23903. public function parseGitAttributesLine(string $line): ?array
  23904. {
  23905. $parts = Preg::split('#\s+#', $line);
  23906. if (count($parts) === 2 && $parts[1] === 'export-ignore') {
  23907. return $this->generatePattern($parts[0]);
  23908. }
  23909. if (count($parts) === 2 && $parts[1] === '-export-ignore') {
  23910. return $this->generatePattern('!'.$parts[0]);
  23911. }
  23912. return null;
  23913. }
  23914. }
  23915. <?php declare(strict_types=1);
  23916. namespace Composer\Package\Archiver;
  23917. class PharArchiver implements ArchiverInterface
  23918. {
  23919. protected static $formats = [
  23920. 'zip' => \Phar::ZIP,
  23921. 'tar' => \Phar::TAR,
  23922. 'tar.gz' => \Phar::TAR,
  23923. 'tar.bz2' => \Phar::TAR,
  23924. ];
  23925. protected static $compressFormats = [
  23926. 'tar.gz' => \Phar::GZ,
  23927. 'tar.bz2' => \Phar::BZ2,
  23928. ];
  23929. public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string
  23930. {
  23931. $sources = realpath($sources);
  23932. if (file_exists($target)) {
  23933. unlink($target);
  23934. }
  23935. try {
  23936. $filename = substr($target, 0, strrpos($target, $format) - 1);
  23937. if (isset(static::$compressFormats[$format])) {
  23938. $target = $filename . '.tar';
  23939. }
  23940. $phar = new \PharData(
  23941. $target,
  23942. \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO,
  23943. '',
  23944. static::$formats[$format]
  23945. );
  23946. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  23947. $filesOnly = new ArchivableFilesFilter($files);
  23948. $phar->buildFromIterator($filesOnly, $sources);
  23949. $filesOnly->addEmptyDir($phar, $sources);
  23950. if (isset(static::$compressFormats[$format])) {
  23951. if (!$phar->canCompress(static::$compressFormats[$format])) {
  23952. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  23953. }
  23954. unlink($target);
  23955. $phar->compress(static::$compressFormats[$format]);
  23956. $target = $filename . '.' . $format;
  23957. }
  23958. return $target;
  23959. } catch (\UnexpectedValueException $e) {
  23960. $message = sprintf(
  23961. "Could not create archive '%s' from '%s': %s",
  23962. $target,
  23963. $sources,
  23964. $e->getMessage()
  23965. );
  23966. throw new \RuntimeException($message, $e->getCode(), $e);
  23967. }
  23968. }
  23969. public function supports(string $format, ?string $sourceType): bool
  23970. {
  23971. return isset(static::$formats[$format]);
  23972. }
  23973. }
  23974. <?php declare(strict_types=1);
  23975. namespace Composer\Package\Archiver;
  23976. use ZipArchive;
  23977. use Composer\Util\Filesystem;
  23978. class ZipArchiver implements ArchiverInterface
  23979. {
  23980. protected static $formats = [
  23981. 'zip' => true,
  23982. ];
  23983. public function archive(string $sources, string $target, string $format, array $excludes = [], bool $ignoreFilters = false): string
  23984. {
  23985. $fs = new Filesystem();
  23986. $sourcesRealpath = realpath($sources);
  23987. if (false !== $sourcesRealpath) {
  23988. $sources = $sourcesRealpath;
  23989. }
  23990. unset($sourcesRealpath);
  23991. $sources = $fs->normalizePath($sources);
  23992. $zip = new ZipArchive();
  23993. $res = $zip->open($target, ZipArchive::CREATE);
  23994. if ($res === true) {
  23995. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  23996. foreach ($files as $file) {
  23997. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  23998. $localname = $filepath;
  23999. if (strpos($localname, $sources . '/') === 0) {
  24000. $localname = substr($localname, strlen($sources . '/'));
  24001. }
  24002. if ($file->isDir()) {
  24003. $zip->addEmptyDir($localname);
  24004. } else {
  24005. $zip->addFile($filepath, $localname);
  24006. }
  24007. if (method_exists($zip, 'setExternalAttributesName')) {
  24008. $perms = fileperms($filepath);
  24009. $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
  24010. }
  24011. }
  24012. if ($zip->close()) {
  24013. return $target;
  24014. }
  24015. }
  24016. $message = sprintf(
  24017. "Could not create archive '%s' from '%s': %s",
  24018. $target,
  24019. $sources,
  24020. $zip->getStatusString()
  24021. );
  24022. throw new \RuntimeException($message);
  24023. }
  24024. public function supports(string $format, ?string $sourceType): bool
  24025. {
  24026. return isset(static::$formats[$format]) && $this->compressionAvailable();
  24027. }
  24028. private function compressionAvailable(): bool
  24029. {
  24030. return class_exists('ZipArchive');
  24031. }
  24032. }
  24033. <?php declare(strict_types=1);
  24034. namespace Composer\Package;
  24035. use Composer\Repository\RepositoryInterface;
  24036. use Composer\Repository\PlatformRepository;
  24037. abstract class BasePackage implements PackageInterface
  24038. {
  24039. public static $supportedLinkTypes = [
  24040. 'require' => ['description' => 'requires', 'method' => Link::TYPE_REQUIRE],
  24041. 'conflict' => ['description' => 'conflicts', 'method' => Link::TYPE_CONFLICT],
  24042. 'provide' => ['description' => 'provides', 'method' => Link::TYPE_PROVIDE],
  24043. 'replace' => ['description' => 'replaces', 'method' => Link::TYPE_REPLACE],
  24044. 'require-dev' => ['description' => 'requires (for development)', 'method' => Link::TYPE_DEV_REQUIRE],
  24045. ];
  24046. public const STABILITY_STABLE = 0;
  24047. public const STABILITY_RC = 5;
  24048. public const STABILITY_BETA = 10;
  24049. public const STABILITY_ALPHA = 15;
  24050. public const STABILITY_DEV = 20;
  24051. public const STABILITIES = [
  24052. 'stable' => self::STABILITY_STABLE,
  24053. 'RC' => self::STABILITY_RC,
  24054. 'beta' => self::STABILITY_BETA,
  24055. 'alpha' => self::STABILITY_ALPHA,
  24056. 'dev' => self::STABILITY_DEV,
  24057. ];
  24058. public static $stabilities = self::STABILITIES;
  24059. public $id;
  24060. protected $name;
  24061. protected $prettyName;
  24062. protected $repository = null;
  24063. public function __construct(string $name)
  24064. {
  24065. $this->prettyName = $name;
  24066. $this->name = strtolower($name);
  24067. $this->id = -1;
  24068. }
  24069. public function getName(): string
  24070. {
  24071. return $this->name;
  24072. }
  24073. public function getPrettyName(): string
  24074. {
  24075. return $this->prettyName;
  24076. }
  24077. public function getNames($provides = true): array
  24078. {
  24079. $names = [
  24080. $this->getName() => true,
  24081. ];
  24082. if ($provides) {
  24083. foreach ($this->getProvides() as $link) {
  24084. $names[$link->getTarget()] = true;
  24085. }
  24086. }
  24087. foreach ($this->getReplaces() as $link) {
  24088. $names[$link->getTarget()] = true;
  24089. }
  24090. return array_keys($names);
  24091. }
  24092. public function setId(int $id): void
  24093. {
  24094. $this->id = $id;
  24095. }
  24096. public function getId(): int
  24097. {
  24098. return $this->id;
  24099. }
  24100. public function setRepository(RepositoryInterface $repository): void
  24101. {
  24102. if ($this->repository && $repository !== $this->repository) {
  24103. throw new \LogicException(sprintf(
  24104. 'Package "%s" cannot be added to repository "%s" as it is already in repository "%s".',
  24105. $this->getPrettyName(),
  24106. $repository->getRepoName(),
  24107. $this->repository->getRepoName()
  24108. ));
  24109. }
  24110. $this->repository = $repository;
  24111. }
  24112. public function getRepository(): ?RepositoryInterface
  24113. {
  24114. return $this->repository;
  24115. }
  24116. public function isPlatform(): bool
  24117. {
  24118. return $this->getRepository() instanceof PlatformRepository;
  24119. }
  24120. public function getUniqueName(): string
  24121. {
  24122. return $this->getName().'-'.$this->getVersion();
  24123. }
  24124. public function equals(PackageInterface $package): bool
  24125. {
  24126. $self = $this;
  24127. if ($this instanceof AliasPackage) {
  24128. $self = $this->getAliasOf();
  24129. }
  24130. if ($package instanceof AliasPackage) {
  24131. $package = $package->getAliasOf();
  24132. }
  24133. return $package === $self;
  24134. }
  24135. public function __toString(): string
  24136. {
  24137. return $this->getUniqueName();
  24138. }
  24139. public function getPrettyString(): string
  24140. {
  24141. return $this->getPrettyName().' '.$this->getPrettyVersion();
  24142. }
  24143. public function getFullPrettyVersion(bool $truncate = true, int $displayMode = PackageInterface::DISPLAY_SOURCE_REF_IF_DEV): string
  24144. {
  24145. if ($displayMode === PackageInterface::DISPLAY_SOURCE_REF_IF_DEV &&
  24146. (!$this->isDev() || !\in_array($this->getSourceType(), ['hg', 'git']))
  24147. ) {
  24148. return $this->getPrettyVersion();
  24149. }
  24150. switch ($displayMode) {
  24151. case PackageInterface::DISPLAY_SOURCE_REF_IF_DEV:
  24152. case PackageInterface::DISPLAY_SOURCE_REF:
  24153. $reference = $this->getSourceReference();
  24154. break;
  24155. case PackageInterface::DISPLAY_DIST_REF:
  24156. $reference = $this->getDistReference();
  24157. break;
  24158. default:
  24159. throw new \UnexpectedValueException('Display mode '.$displayMode.' is not supported');
  24160. }
  24161. if (null === $reference) {
  24162. return $this->getPrettyVersion();
  24163. }
  24164. if ($truncate && \strlen($reference) === 40 && $this->getSourceType() !== 'svn') {
  24165. return $this->getPrettyVersion() . ' ' . substr($reference, 0, 7);
  24166. }
  24167. return $this->getPrettyVersion() . ' ' . $reference;
  24168. }
  24169. public function getStabilityPriority(): int
  24170. {
  24171. return self::STABILITIES[$this->getStability()];
  24172. }
  24173. public function __clone()
  24174. {
  24175. $this->repository = null;
  24176. $this->id = -1;
  24177. }
  24178. public static function packageNameToRegexp(string $allowPattern, string $wrap = '{^%s$}i'): string
  24179. {
  24180. $cleanedAllowPattern = str_replace('\\*', '.*', preg_quote($allowPattern));
  24181. return sprintf($wrap, $cleanedAllowPattern);
  24182. }
  24183. public static function packageNamesToRegexp(array $packageNames, string $wrap = '{^(?:%s)$}iD'): string
  24184. {
  24185. $packageNames = array_map(
  24186. static function ($packageName): string {
  24187. return BasePackage::packageNameToRegexp($packageName, '%s');
  24188. },
  24189. $packageNames
  24190. );
  24191. return sprintf($wrap, implode('|', $packageNames));
  24192. }
  24193. }
  24194. <?php declare(strict_types=1);
  24195. namespace Composer\Package\Comparer;
  24196. use Composer\Util\Platform;
  24197. class Comparer
  24198. {
  24199. private $source;
  24200. private $update;
  24201. private $changed;
  24202. public function setSource(string $source): void
  24203. {
  24204. $this->source = $source;
  24205. }
  24206. public function setUpdate(string $update): void
  24207. {
  24208. $this->update = $update;
  24209. }
  24210. public function getChanged(bool $explicated = false)
  24211. {
  24212. $changed = $this->changed;
  24213. if (!count($changed)) {
  24214. return false;
  24215. }
  24216. if ($explicated) {
  24217. foreach ($changed as $sectionKey => $itemSection) {
  24218. foreach ($itemSection as $itemKey => $item) {
  24219. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  24220. }
  24221. }
  24222. }
  24223. return $changed;
  24224. }
  24225. public function getChangedAsString(bool $toString = false, bool $explicated = false): string
  24226. {
  24227. $changed = $this->getChanged($explicated);
  24228. if (false === $changed) {
  24229. return '';
  24230. }
  24231. $strings = [];
  24232. foreach ($changed as $sectionKey => $itemSection) {
  24233. foreach ($itemSection as $itemKey => $item) {
  24234. $strings[] = $item."\r\n";
  24235. }
  24236. }
  24237. return trim(implode("\r\n", $strings));
  24238. }
  24239. public function doCompare(): void
  24240. {
  24241. $source = [];
  24242. $destination = [];
  24243. $this->changed = [];
  24244. $currentDirectory = Platform::getCwd();
  24245. chdir($this->source);
  24246. $source = $this->doTree('.', $source);
  24247. if (!is_array($source)) {
  24248. return;
  24249. }
  24250. chdir($currentDirectory);
  24251. chdir($this->update);
  24252. $destination = $this->doTree('.', $destination);
  24253. if (!is_array($destination)) {
  24254. exit;
  24255. }
  24256. chdir($currentDirectory);
  24257. foreach ($source as $dir => $value) {
  24258. foreach ($value as $file => $hash) {
  24259. if (isset($destination[$dir][$file])) {
  24260. if ($hash !== $destination[$dir][$file]) {
  24261. $this->changed['changed'][] = $dir.'/'.$file;
  24262. }
  24263. } else {
  24264. $this->changed['removed'][] = $dir.'/'.$file;
  24265. }
  24266. }
  24267. }
  24268. foreach ($destination as $dir => $value) {
  24269. foreach ($value as $file => $hash) {
  24270. if (!isset($source[$dir][$file])) {
  24271. $this->changed['added'][] = $dir.'/'.$file;
  24272. }
  24273. }
  24274. }
  24275. }
  24276. private function doTree(string $dir, array &$array)
  24277. {
  24278. if ($dh = opendir($dir)) {
  24279. while ($file = readdir($dh)) {
  24280. if ($file !== '.' && $file !== '..') {
  24281. if (is_link($dir.'/'.$file)) {
  24282. $array[$dir][$file] = readlink($dir.'/'.$file);
  24283. } elseif (is_dir($dir.'/'.$file)) {
  24284. if (!count($array)) {
  24285. $array[0] = 'Temp';
  24286. }
  24287. if (!$this->doTree($dir.'/'.$file, $array)) {
  24288. return false;
  24289. }
  24290. } elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {
  24291. $array[$dir][$file] = hash_file(\PHP_VERSION_ID > 80100 ? 'xxh3' : 'sha1', $dir.'/'.$file);
  24292. }
  24293. }
  24294. }
  24295. if (count($array) > 1 && isset($array['0'])) {
  24296. unset($array['0']);
  24297. }
  24298. return $array;
  24299. }
  24300. return false;
  24301. }
  24302. }
  24303. <?php declare(strict_types=1);
  24304. namespace Composer\Package;
  24305. class CompleteAliasPackage extends AliasPackage implements CompletePackageInterface
  24306. {
  24307. protected $aliasOf;
  24308. public function __construct(CompletePackage $aliasOf, string $version, string $prettyVersion)
  24309. {
  24310. parent::__construct($aliasOf, $version, $prettyVersion);
  24311. }
  24312. public function getAliasOf()
  24313. {
  24314. return $this->aliasOf;
  24315. }
  24316. public function getScripts(): array
  24317. {
  24318. return $this->aliasOf->getScripts();
  24319. }
  24320. public function setScripts(array $scripts): void
  24321. {
  24322. $this->aliasOf->setScripts($scripts);
  24323. }
  24324. public function getRepositories(): array
  24325. {
  24326. return $this->aliasOf->getRepositories();
  24327. }
  24328. public function setRepositories(array $repositories): void
  24329. {
  24330. $this->aliasOf->setRepositories($repositories);
  24331. }
  24332. public function getLicense(): array
  24333. {
  24334. return $this->aliasOf->getLicense();
  24335. }
  24336. public function setLicense(array $license): void
  24337. {
  24338. $this->aliasOf->setLicense($license);
  24339. }
  24340. public function getKeywords(): array
  24341. {
  24342. return $this->aliasOf->getKeywords();
  24343. }
  24344. public function setKeywords(array $keywords): void
  24345. {
  24346. $this->aliasOf->setKeywords($keywords);
  24347. }
  24348. public function getDescription(): ?string
  24349. {
  24350. return $this->aliasOf->getDescription();
  24351. }
  24352. public function setDescription(?string $description): void
  24353. {
  24354. $this->aliasOf->setDescription($description);
  24355. }
  24356. public function getHomepage(): ?string
  24357. {
  24358. return $this->aliasOf->getHomepage();
  24359. }
  24360. public function setHomepage(?string $homepage): void
  24361. {
  24362. $this->aliasOf->setHomepage($homepage);
  24363. }
  24364. public function getAuthors(): array
  24365. {
  24366. return $this->aliasOf->getAuthors();
  24367. }
  24368. public function setAuthors(array $authors): void
  24369. {
  24370. $this->aliasOf->setAuthors($authors);
  24371. }
  24372. public function getSupport(): array
  24373. {
  24374. return $this->aliasOf->getSupport();
  24375. }
  24376. public function setSupport(array $support): void
  24377. {
  24378. $this->aliasOf->setSupport($support);
  24379. }
  24380. public function getFunding(): array
  24381. {
  24382. return $this->aliasOf->getFunding();
  24383. }
  24384. public function setFunding(array $funding): void
  24385. {
  24386. $this->aliasOf->setFunding($funding);
  24387. }
  24388. public function isAbandoned(): bool
  24389. {
  24390. return $this->aliasOf->isAbandoned();
  24391. }
  24392. public function getReplacementPackage(): ?string
  24393. {
  24394. return $this->aliasOf->getReplacementPackage();
  24395. }
  24396. public function setAbandoned($abandoned): void
  24397. {
  24398. $this->aliasOf->setAbandoned($abandoned);
  24399. }
  24400. public function getArchiveName(): ?string
  24401. {
  24402. return $this->aliasOf->getArchiveName();
  24403. }
  24404. public function setArchiveName(?string $name): void
  24405. {
  24406. $this->aliasOf->setArchiveName($name);
  24407. }
  24408. public function getArchiveExcludes(): array
  24409. {
  24410. return $this->aliasOf->getArchiveExcludes();
  24411. }
  24412. public function setArchiveExcludes(array $excludes): void
  24413. {
  24414. $this->aliasOf->setArchiveExcludes($excludes);
  24415. }
  24416. }
  24417. <?php declare(strict_types=1);
  24418. namespace Composer\Package;
  24419. class CompletePackage extends Package implements CompletePackageInterface
  24420. {
  24421. protected $repositories = [];
  24422. protected $license = [];
  24423. protected $keywords = [];
  24424. protected $authors = [];
  24425. protected $description = null;
  24426. protected $homepage = null;
  24427. protected $scripts = [];
  24428. protected $support = [];
  24429. protected $funding = [];
  24430. protected $abandoned = false;
  24431. protected $archiveName = null;
  24432. protected $archiveExcludes = [];
  24433. public function setScripts(array $scripts): void
  24434. {
  24435. $this->scripts = $scripts;
  24436. }
  24437. public function getScripts(): array
  24438. {
  24439. return $this->scripts;
  24440. }
  24441. public function setRepositories(array $repositories): void
  24442. {
  24443. $this->repositories = $repositories;
  24444. }
  24445. public function getRepositories(): array
  24446. {
  24447. return $this->repositories;
  24448. }
  24449. public function setLicense(array $license): void
  24450. {
  24451. $this->license = $license;
  24452. }
  24453. public function getLicense(): array
  24454. {
  24455. return $this->license;
  24456. }
  24457. public function setKeywords(array $keywords): void
  24458. {
  24459. $this->keywords = $keywords;
  24460. }
  24461. public function getKeywords(): array
  24462. {
  24463. return $this->keywords;
  24464. }
  24465. public function setAuthors(array $authors): void
  24466. {
  24467. $this->authors = $authors;
  24468. }
  24469. public function getAuthors(): array
  24470. {
  24471. return $this->authors;
  24472. }
  24473. public function setDescription(?string $description): void
  24474. {
  24475. $this->description = $description;
  24476. }
  24477. public function getDescription(): ?string
  24478. {
  24479. return $this->description;
  24480. }
  24481. public function setHomepage(?string $homepage): void
  24482. {
  24483. $this->homepage = $homepage;
  24484. }
  24485. public function getHomepage(): ?string
  24486. {
  24487. return $this->homepage;
  24488. }
  24489. public function setSupport(array $support): void
  24490. {
  24491. $this->support = $support;
  24492. }
  24493. public function getSupport(): array
  24494. {
  24495. return $this->support;
  24496. }
  24497. public function setFunding(array $funding): void
  24498. {
  24499. $this->funding = $funding;
  24500. }
  24501. public function getFunding(): array
  24502. {
  24503. return $this->funding;
  24504. }
  24505. public function isAbandoned(): bool
  24506. {
  24507. return (bool) $this->abandoned;
  24508. }
  24509. public function setAbandoned($abandoned): void
  24510. {
  24511. $this->abandoned = $abandoned;
  24512. }
  24513. public function getReplacementPackage(): ?string
  24514. {
  24515. return \is_string($this->abandoned) ? $this->abandoned : null;
  24516. }
  24517. public function setArchiveName(?string $name): void
  24518. {
  24519. $this->archiveName = $name;
  24520. }
  24521. public function getArchiveName(): ?string
  24522. {
  24523. return $this->archiveName;
  24524. }
  24525. public function setArchiveExcludes(array $excludes): void
  24526. {
  24527. $this->archiveExcludes = $excludes;
  24528. }
  24529. public function getArchiveExcludes(): array
  24530. {
  24531. return $this->archiveExcludes;
  24532. }
  24533. }
  24534. <?php declare(strict_types=1);
  24535. namespace Composer\Package;
  24536. interface CompletePackageInterface extends PackageInterface
  24537. {
  24538. public function getScripts(): array;
  24539. public function setScripts(array $scripts): void;
  24540. public function getRepositories(): array;
  24541. public function setRepositories(array $repositories): void;
  24542. public function getLicense(): array;
  24543. public function setLicense(array $license): void;
  24544. public function getKeywords(): array;
  24545. public function setKeywords(array $keywords): void;
  24546. public function getDescription(): ?string;
  24547. public function setDescription(string $description): void;
  24548. public function getHomepage(): ?string;
  24549. public function setHomepage(string $homepage): void;
  24550. public function getAuthors(): array;
  24551. public function setAuthors(array $authors): void;
  24552. public function getSupport(): array;
  24553. public function setSupport(array $support): void;
  24554. public function getFunding(): array;
  24555. public function setFunding(array $funding): void;
  24556. public function isAbandoned(): bool;
  24557. public function getReplacementPackage(): ?string;
  24558. public function setAbandoned($abandoned): void;
  24559. public function getArchiveName(): ?string;
  24560. public function setArchiveName(string $name): void;
  24561. public function getArchiveExcludes(): array;
  24562. public function setArchiveExcludes(array $excludes): void;
  24563. }
  24564. <?php declare(strict_types=1);
  24565. namespace Composer\Package\Dumper;
  24566. use Composer\Package\BasePackage;
  24567. use Composer\Package\PackageInterface;
  24568. use Composer\Package\CompletePackageInterface;
  24569. use Composer\Package\RootPackageInterface;
  24570. class ArrayDumper
  24571. {
  24572. public function dump(PackageInterface $package): array
  24573. {
  24574. $keys = [
  24575. 'binaries' => 'bin',
  24576. 'type',
  24577. 'extra',
  24578. 'installationSource' => 'installation-source',
  24579. 'autoload',
  24580. 'devAutoload' => 'autoload-dev',
  24581. 'notificationUrl' => 'notification-url',
  24582. 'includePaths' => 'include-path',
  24583. 'phpExt' => 'php-ext',
  24584. ];
  24585. $data = [];
  24586. $data['name'] = $package->getPrettyName();
  24587. $data['version'] = $package->getPrettyVersion();
  24588. $data['version_normalized'] = $package->getVersion();
  24589. if ($package->getTargetDir() !== null) {
  24590. $data['target-dir'] = $package->getTargetDir();
  24591. }
  24592. if ($package->getSourceType() !== null) {
  24593. $data['source']['type'] = $package->getSourceType();
  24594. $data['source']['url'] = $package->getSourceUrl();
  24595. if (null !== ($value = $package->getSourceReference())) {
  24596. $data['source']['reference'] = $value;
  24597. }
  24598. if ($mirrors = $package->getSourceMirrors()) {
  24599. $data['source']['mirrors'] = $mirrors;
  24600. }
  24601. }
  24602. if ($package->getDistType() !== null) {
  24603. $data['dist']['type'] = $package->getDistType();
  24604. $data['dist']['url'] = $package->getDistUrl();
  24605. if (null !== ($value = $package->getDistReference())) {
  24606. $data['dist']['reference'] = $value;
  24607. }
  24608. if (null !== ($value = $package->getDistSha1Checksum())) {
  24609. $data['dist']['shasum'] = $value;
  24610. }
  24611. if ($mirrors = $package->getDistMirrors()) {
  24612. $data['dist']['mirrors'] = $mirrors;
  24613. }
  24614. }
  24615. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  24616. $links = $package->{'get'.ucfirst($opts['method'])}();
  24617. if (\count($links) === 0) {
  24618. continue;
  24619. }
  24620. foreach ($links as $link) {
  24621. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  24622. }
  24623. ksort($data[$type]);
  24624. }
  24625. $packages = $package->getSuggests();
  24626. if (\count($packages) > 0) {
  24627. ksort($packages);
  24628. $data['suggest'] = $packages;
  24629. }
  24630. if ($package->getReleaseDate() instanceof \DateTimeInterface) {
  24631. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  24632. }
  24633. if ($package->isDefaultBranch()) {
  24634. $data['default-branch'] = true;
  24635. }
  24636. $data = $this->dumpValues($package, $keys, $data);
  24637. if ($package instanceof CompletePackageInterface) {
  24638. if ($package->getArchiveName()) {
  24639. $data['archive']['name'] = $package->getArchiveName();
  24640. }
  24641. if ($package->getArchiveExcludes()) {
  24642. $data['archive']['exclude'] = $package->getArchiveExcludes();
  24643. }
  24644. $keys = [
  24645. 'scripts',
  24646. 'license',
  24647. 'authors',
  24648. 'description',
  24649. 'homepage',
  24650. 'keywords',
  24651. 'repositories',
  24652. 'support',
  24653. 'funding',
  24654. ];
  24655. $data = $this->dumpValues($package, $keys, $data);
  24656. if (isset($data['keywords']) && \is_array($data['keywords'])) {
  24657. sort($data['keywords']);
  24658. }
  24659. if ($package->isAbandoned()) {
  24660. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  24661. }
  24662. }
  24663. if ($package instanceof RootPackageInterface) {
  24664. $minimumStability = $package->getMinimumStability();
  24665. if ($minimumStability !== '') {
  24666. $data['minimum-stability'] = $minimumStability;
  24667. }
  24668. }
  24669. if (\count($package->getTransportOptions()) > 0) {
  24670. $data['transport-options'] = $package->getTransportOptions();
  24671. }
  24672. return $data;
  24673. }
  24674. private function dumpValues(PackageInterface $package, array $keys, array $data): array
  24675. {
  24676. foreach ($keys as $method => $key) {
  24677. if (is_numeric($method)) {
  24678. $method = $key;
  24679. }
  24680. $getter = 'get'.ucfirst($method);
  24681. $value = $package->{$getter}();
  24682. if (null !== $value && !(\is_array($value) && 0 === \count($value))) {
  24683. $data[$key] = $value;
  24684. }
  24685. }
  24686. return $data;
  24687. }
  24688. }
  24689. <?php declare(strict_types=1);
  24690. namespace Composer\Package;
  24691. use Composer\Semver\Constraint\ConstraintInterface;
  24692. class Link
  24693. {
  24694. public const TYPE_REQUIRE = 'requires';
  24695. public const TYPE_DEV_REQUIRE = 'devRequires';
  24696. public const TYPE_PROVIDE = 'provides';
  24697. public const TYPE_CONFLICT = 'conflicts';
  24698. public const TYPE_REPLACE = 'replaces';
  24699. public const TYPE_DOES_NOT_REQUIRE = 'does not require';
  24700. private const TYPE_UNKNOWN = 'relates to';
  24701. public static $TYPES = [
  24702. self::TYPE_REQUIRE,
  24703. self::TYPE_DEV_REQUIRE,
  24704. self::TYPE_PROVIDE,
  24705. self::TYPE_CONFLICT,
  24706. self::TYPE_REPLACE,
  24707. ];
  24708. protected $source;
  24709. protected $target;
  24710. protected $constraint;
  24711. protected $description;
  24712. protected $prettyConstraint;
  24713. public function __construct(
  24714. string $source,
  24715. string $target,
  24716. ConstraintInterface $constraint,
  24717. $description = self::TYPE_UNKNOWN,
  24718. ?string $prettyConstraint = null
  24719. ) {
  24720. $this->source = strtolower($source);
  24721. $this->target = strtolower($target);
  24722. $this->constraint = $constraint;
  24723. $this->description = self::TYPE_DEV_REQUIRE === $description ? 'requires (for development)' : $description;
  24724. $this->prettyConstraint = $prettyConstraint;
  24725. }
  24726. public function getDescription(): string
  24727. {
  24728. return $this->description;
  24729. }
  24730. public function getSource(): string
  24731. {
  24732. return $this->source;
  24733. }
  24734. public function getTarget(): string
  24735. {
  24736. return $this->target;
  24737. }
  24738. public function getConstraint(): ConstraintInterface
  24739. {
  24740. return $this->constraint;
  24741. }
  24742. public function getPrettyConstraint(): string
  24743. {
  24744. if (null === $this->prettyConstraint) {
  24745. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  24746. }
  24747. return $this->prettyConstraint;
  24748. }
  24749. public function __toString(): string
  24750. {
  24751. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  24752. }
  24753. public function getPrettyString(PackageInterface $sourcePackage): string
  24754. {
  24755. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString();
  24756. }
  24757. }
  24758. <?php declare(strict_types=1);
  24759. namespace Composer\Package\Loader;
  24760. use Composer\Package\BasePackage;
  24761. use Composer\Package\CompleteAliasPackage;
  24762. use Composer\Package\CompletePackage;
  24763. use Composer\Package\RootPackage;
  24764. use Composer\Package\PackageInterface;
  24765. use Composer\Package\CompletePackageInterface;
  24766. use Composer\Package\Link;
  24767. use Composer\Package\RootAliasPackage;
  24768. use Composer\Package\Version\VersionParser;
  24769. use Composer\Pcre\Preg;
  24770. class ArrayLoader implements LoaderInterface
  24771. {
  24772. protected $versionParser;
  24773. protected $loadOptions;
  24774. public function __construct(?VersionParser $parser = null, bool $loadOptions = false)
  24775. {
  24776. if (!$parser) {
  24777. $parser = new VersionParser;
  24778. }
  24779. $this->versionParser = $parser;
  24780. $this->loadOptions = $loadOptions;
  24781. }
  24782. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
  24783. {
  24784. if ($class !== 'Composer\Package\CompletePackage' && $class !== 'Composer\Package\RootPackage') {
  24785. trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
  24786. }
  24787. $package = $this->createObject($config, $class);
  24788. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  24789. if (!isset($config[$type]) || !is_array($config[$type])) {
  24790. continue;
  24791. }
  24792. $method = 'set'.ucfirst($opts['method']);
  24793. $package->{$method}(
  24794. $this->parseLinks(
  24795. $package->getName(),
  24796. $package->getPrettyVersion(),
  24797. $opts['method'],
  24798. $config[$type]
  24799. )
  24800. );
  24801. }
  24802. $package = $this->configureObject($package, $config);
  24803. return $package;
  24804. }
  24805. public function loadPackages(array $versions): array
  24806. {
  24807. $packages = [];
  24808. $linkCache = [];
  24809. foreach ($versions as $version) {
  24810. $package = $this->createObject($version, 'Composer\Package\CompletePackage');
  24811. $this->configureCachedLinks($linkCache, $package, $version);
  24812. $package = $this->configureObject($package, $version);
  24813. $packages[] = $package;
  24814. }
  24815. return $packages;
  24816. }
  24817. private function createObject(array $config, string $class): CompletePackage
  24818. {
  24819. if (!isset($config['name'])) {
  24820. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  24821. }
  24822. if (!isset($config['version']) || !is_scalar($config['version'])) {
  24823. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  24824. }
  24825. if (!is_string($config['version'])) {
  24826. $config['version'] = (string) $config['version'];
  24827. }
  24828. if (isset($config['version_normalized']) && is_string($config['version_normalized'])) {
  24829. $version = $config['version_normalized'];
  24830. if ($version === VersionParser::DEFAULT_BRANCH_ALIAS) {
  24831. $version = $this->versionParser->normalize($config['version']);
  24832. }
  24833. } else {
  24834. $version = $this->versionParser->normalize($config['version']);
  24835. }
  24836. return new $class($config['name'], $version, $config['version']);
  24837. }
  24838. private function configureObject(PackageInterface $package, array $config): BasePackage
  24839. {
  24840. if (!$package instanceof CompletePackage) {
  24841. throw new \LogicException('ArrayLoader expects instances of the Composer\Package\CompletePackage class to function correctly');
  24842. }
  24843. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  24844. if (isset($config['target-dir'])) {
  24845. $package->setTargetDir($config['target-dir']);
  24846. }
  24847. if (isset($config['extra']) && \is_array($config['extra'])) {
  24848. $package->setExtra($config['extra']);
  24849. }
  24850. if (isset($config['bin'])) {
  24851. if (!\is_array($config['bin'])) {
  24852. $config['bin'] = [$config['bin']];
  24853. }
  24854. foreach ($config['bin'] as $key => $bin) {
  24855. $config['bin'][$key] = ltrim($bin, '/');
  24856. }
  24857. $package->setBinaries($config['bin']);
  24858. }
  24859. if (isset($config['installation-source'])) {
  24860. $package->setInstallationSource($config['installation-source']);
  24861. }
  24862. if (isset($config['default-branch']) && $config['default-branch'] === true) {
  24863. $package->setIsDefaultBranch(true);
  24864. }
  24865. if (isset($config['source'])) {
  24866. if (!isset($config['source']['type'], $config['source']['url'], $config['source']['reference'])) {
  24867. throw new \UnexpectedValueException(sprintf(
  24868. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  24869. $config['name'],
  24870. json_encode($config['source'])
  24871. ));
  24872. }
  24873. $package->setSourceType($config['source']['type']);
  24874. $package->setSourceUrl($config['source']['url']);
  24875. $package->setSourceReference(isset($config['source']['reference']) ? (string) $config['source']['reference'] : null);
  24876. if (isset($config['source']['mirrors'])) {
  24877. $package->setSourceMirrors($config['source']['mirrors']);
  24878. }
  24879. }
  24880. if (isset($config['dist'])) {
  24881. if (!isset($config['dist']['type'], $config['dist']['url'])) {
  24882. throw new \UnexpectedValueException(sprintf(
  24883. "Package %s's dist key should be specified as ".
  24884. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  24885. $config['name'],
  24886. json_encode($config['dist'])
  24887. ));
  24888. }
  24889. $package->setDistType($config['dist']['type']);
  24890. $package->setDistUrl($config['dist']['url']);
  24891. $package->setDistReference(isset($config['dist']['reference']) ? (string) $config['dist']['reference'] : null);
  24892. $package->setDistSha1Checksum($config['dist']['shasum'] ?? null);
  24893. if (isset($config['dist']['mirrors'])) {
  24894. $package->setDistMirrors($config['dist']['mirrors']);
  24895. }
  24896. }
  24897. if (isset($config['suggest']) && \is_array($config['suggest'])) {
  24898. foreach ($config['suggest'] as $target => $reason) {
  24899. if ('self.version' === trim($reason)) {
  24900. $config['suggest'][$target] = $package->getPrettyVersion();
  24901. }
  24902. }
  24903. $package->setSuggests($config['suggest']);
  24904. }
  24905. if (isset($config['autoload'])) {
  24906. $package->setAutoload($config['autoload']);
  24907. }
  24908. if (isset($config['autoload-dev'])) {
  24909. $package->setDevAutoload($config['autoload-dev']);
  24910. }
  24911. if (isset($config['include-path'])) {
  24912. $package->setIncludePaths($config['include-path']);
  24913. }
  24914. if (isset($config['php-ext'])) {
  24915. $package->setPhpExt($config['php-ext']);
  24916. }
  24917. if (!empty($config['time'])) {
  24918. $time = Preg::isMatch('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  24919. try {
  24920. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  24921. $package->setReleaseDate($date);
  24922. } catch (\Exception $e) {
  24923. }
  24924. }
  24925. if (!empty($config['notification-url'])) {
  24926. $package->setNotificationUrl($config['notification-url']);
  24927. }
  24928. if ($package instanceof CompletePackageInterface) {
  24929. if (!empty($config['archive']['name'])) {
  24930. $package->setArchiveName($config['archive']['name']);
  24931. }
  24932. if (!empty($config['archive']['exclude'])) {
  24933. $package->setArchiveExcludes($config['archive']['exclude']);
  24934. }
  24935. if (isset($config['scripts']) && \is_array($config['scripts'])) {
  24936. foreach ($config['scripts'] as $event => $listeners) {
  24937. $config['scripts'][$event] = (array) $listeners;
  24938. }
  24939. foreach (['composer', 'php', 'putenv'] as $reserved) {
  24940. if (isset($config['scripts'][$reserved])) {
  24941. trigger_error('The `'.$reserved.'` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  24942. }
  24943. }
  24944. $package->setScripts($config['scripts']);
  24945. }
  24946. if (!empty($config['description']) && \is_string($config['description'])) {
  24947. $package->setDescription($config['description']);
  24948. }
  24949. if (!empty($config['homepage']) && \is_string($config['homepage'])) {
  24950. $package->setHomepage($config['homepage']);
  24951. }
  24952. if (!empty($config['keywords']) && \is_array($config['keywords'])) {
  24953. $package->setKeywords(array_map('strval', $config['keywords']));
  24954. }
  24955. if (!empty($config['license'])) {
  24956. $package->setLicense(\is_array($config['license']) ? $config['license'] : [$config['license']]);
  24957. }
  24958. if (!empty($config['authors']) && \is_array($config['authors'])) {
  24959. $package->setAuthors($config['authors']);
  24960. }
  24961. if (isset($config['support']) && \is_array($config['support'])) {
  24962. $package->setSupport($config['support']);
  24963. }
  24964. if (!empty($config['funding']) && \is_array($config['funding'])) {
  24965. $package->setFunding($config['funding']);
  24966. }
  24967. if (isset($config['abandoned'])) {
  24968. $package->setAbandoned($config['abandoned']);
  24969. }
  24970. }
  24971. if ($this->loadOptions && isset($config['transport-options'])) {
  24972. $package->setTransportOptions($config['transport-options']);
  24973. }
  24974. if ($aliasNormalized = $this->getBranchAlias($config)) {
  24975. $prettyAlias = Preg::replace('{(\.9{7})+}', '.x', $aliasNormalized);
  24976. if ($package instanceof RootPackage) {
  24977. return new RootAliasPackage($package, $aliasNormalized, $prettyAlias);
  24978. }
  24979. return new CompleteAliasPackage($package, $aliasNormalized, $prettyAlias);
  24980. }
  24981. return $package;
  24982. }
  24983. private function configureCachedLinks(array &$linkCache, PackageInterface $package, array $config): void
  24984. {
  24985. $name = $package->getName();
  24986. $prettyVersion = $package->getPrettyVersion();
  24987. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  24988. if (isset($config[$type])) {
  24989. $method = 'set'.ucfirst($opts['method']);
  24990. $links = [];
  24991. foreach ($config[$type] as $prettyTarget => $constraint) {
  24992. $target = strtolower($prettyTarget);
  24993. if ($target === $name) {
  24994. continue;
  24995. }
  24996. if ($constraint === 'self.version') {
  24997. $links[$target] = $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint);
  24998. } else {
  24999. if (!isset($linkCache[$name][$type][$target][$constraint])) {
  25000. $linkCache[$name][$type][$target][$constraint] = [$target, $this->createLink($name, $prettyVersion, $opts['method'], $target, $constraint)];
  25001. }
  25002. [$target, $link] = $linkCache[$name][$type][$target][$constraint];
  25003. $links[$target] = $link;
  25004. }
  25005. }
  25006. $package->{$method}($links);
  25007. }
  25008. }
  25009. }
  25010. public function parseLinks(string $source, string $sourceVersion, string $description, array $links): array
  25011. {
  25012. $res = [];
  25013. foreach ($links as $target => $constraint) {
  25014. if (!is_string($constraint)) {
  25015. continue;
  25016. }
  25017. $target = strtolower((string) $target);
  25018. $res[$target] = $this->createLink($source, $sourceVersion, $description, $target, $constraint);
  25019. }
  25020. return $res;
  25021. }
  25022. private function createLink(string $source, string $sourceVersion, string $description, string $target, string $prettyConstraint): Link
  25023. {
  25024. if (!\is_string($prettyConstraint)) {
  25025. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.\gettype($prettyConstraint) . ' (' . var_export($prettyConstraint, true) . ')');
  25026. }
  25027. if ('self.version' === $prettyConstraint) {
  25028. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  25029. } else {
  25030. $parsedConstraint = $this->versionParser->parseConstraints($prettyConstraint);
  25031. }
  25032. return new Link($source, $target, $parsedConstraint, $description, $prettyConstraint);
  25033. }
  25034. public function getBranchAlias(array $config): ?string
  25035. {
  25036. if (!isset($config['version']) || !is_scalar($config['version'])) {
  25037. throw new \UnexpectedValueException('no/invalid version defined');
  25038. }
  25039. if (!is_string($config['version'])) {
  25040. $config['version'] = (string) $config['version'];
  25041. }
  25042. if (strpos($config['version'], 'dev-') !== 0 && '-dev' !== substr($config['version'], -4)) {
  25043. return null;
  25044. }
  25045. if (isset($config['extra']['branch-alias']) && \is_array($config['extra']['branch-alias'])) {
  25046. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  25047. $sourceBranch = (string) $sourceBranch;
  25048. if ('-dev' !== substr($targetBranch, -4)) {
  25049. continue;
  25050. }
  25051. if ($targetBranch === VersionParser::DEFAULT_BRANCH_ALIAS) {
  25052. $validatedTargetBranch = VersionParser::DEFAULT_BRANCH_ALIAS;
  25053. } else {
  25054. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  25055. }
  25056. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  25057. continue;
  25058. }
  25059. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  25060. continue;
  25061. }
  25062. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  25063. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  25064. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  25065. ) {
  25066. continue;
  25067. }
  25068. return $validatedTargetBranch;
  25069. }
  25070. }
  25071. if (
  25072. isset($config['default-branch'])
  25073. && $config['default-branch'] === true
  25074. && false === $this->versionParser->parseNumericAliasPrefix(Preg::replace('{^v}', '', $config['version']))
  25075. ) {
  25076. return VersionParser::DEFAULT_BRANCH_ALIAS;
  25077. }
  25078. return null;
  25079. }
  25080. }
  25081. <?php declare(strict_types=1);
  25082. namespace Composer\Package\Loader;
  25083. class InvalidPackageException extends \Exception
  25084. {
  25085. private $errors;
  25086. private $warnings;
  25087. private $data;
  25088. public function __construct(array $errors, array $warnings, array $data)
  25089. {
  25090. $this->errors = $errors;
  25091. $this->warnings = $warnings;
  25092. $this->data = $data;
  25093. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  25094. }
  25095. public function getData(): array
  25096. {
  25097. return $this->data;
  25098. }
  25099. public function getErrors(): array
  25100. {
  25101. return $this->errors;
  25102. }
  25103. public function getWarnings(): array
  25104. {
  25105. return $this->warnings;
  25106. }
  25107. }
  25108. <?php declare(strict_types=1);
  25109. namespace Composer\Package\Loader;
  25110. use Composer\Json\JsonFile;
  25111. use Composer\Package\BasePackage;
  25112. use Composer\Package\CompletePackage;
  25113. use Composer\Package\CompleteAliasPackage;
  25114. use Composer\Package\RootPackage;
  25115. use Composer\Package\RootAliasPackage;
  25116. class JsonLoader
  25117. {
  25118. private $loader;
  25119. public function __construct(LoaderInterface $loader)
  25120. {
  25121. $this->loader = $loader;
  25122. }
  25123. public function load($json): BasePackage
  25124. {
  25125. if ($json instanceof JsonFile) {
  25126. $config = $json->read();
  25127. } elseif (file_exists($json)) {
  25128. $config = JsonFile::parseJson(file_get_contents($json), $json);
  25129. } elseif (is_string($json)) {
  25130. $config = JsonFile::parseJson($json);
  25131. } else {
  25132. throw new \InvalidArgumentException(sprintf(
  25133. "JsonLoader: Unknown \$json parameter %s. Please report at https://github.com/composer/composer/issues/new.",
  25134. gettype($json)
  25135. ));
  25136. }
  25137. return $this->loader->load($config);
  25138. }
  25139. }
  25140. <?php declare(strict_types=1);
  25141. namespace Composer\Package\Loader;
  25142. use Composer\Package\CompletePackage;
  25143. use Composer\Package\CompleteAliasPackage;
  25144. use Composer\Package\RootAliasPackage;
  25145. use Composer\Package\RootPackage;
  25146. use Composer\Package\BasePackage;
  25147. interface LoaderInterface
  25148. {
  25149. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage;
  25150. }
  25151. <?php declare(strict_types=1);
  25152. namespace Composer\Package\Loader;
  25153. use Composer\Package\BasePackage;
  25154. use Composer\Config;
  25155. use Composer\IO\IOInterface;
  25156. use Composer\Package\RootAliasPackage;
  25157. use Composer\Pcre\Preg;
  25158. use Composer\Repository\RepositoryFactory;
  25159. use Composer\Package\Version\VersionGuesser;
  25160. use Composer\Package\Version\VersionParser;
  25161. use Composer\Package\RootPackage;
  25162. use Composer\Repository\RepositoryManager;
  25163. use Composer\Util\Platform;
  25164. use Composer\Util\ProcessExecutor;
  25165. class RootPackageLoader extends ArrayLoader
  25166. {
  25167. private $manager;
  25168. private $config;
  25169. private $versionGuesser;
  25170. private $io;
  25171. public function __construct(RepositoryManager $manager, Config $config, ?VersionParser $parser = null, ?VersionGuesser $versionGuesser = null, ?IOInterface $io = null)
  25172. {
  25173. parent::__construct($parser);
  25174. $this->manager = $manager;
  25175. $this->config = $config;
  25176. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor($io), $this->versionParser, $io);
  25177. $this->io = $io;
  25178. }
  25179. public function load(array $config, string $class = 'Composer\Package\RootPackage', ?string $cwd = null): BasePackage
  25180. {
  25181. if ($class !== 'Composer\Package\RootPackage') {
  25182. trigger_error('The $class arg is deprecated, please reach out to Composer maintainers ASAP if you still need this.', E_USER_DEPRECATED);
  25183. }
  25184. if (!isset($config['name'])) {
  25185. $config['name'] = '__root__';
  25186. } elseif ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  25187. throw new \RuntimeException('Your package name '.$err);
  25188. }
  25189. $autoVersioned = false;
  25190. if (!isset($config['version'])) {
  25191. $commit = null;
  25192. if (Platform::getEnv('COMPOSER_ROOT_VERSION')) {
  25193. $config['version'] = $this->versionGuesser->getRootVersionFromEnv();
  25194. } else {
  25195. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?? Platform::getCwd(true));
  25196. if ($versionData) {
  25197. $config['version'] = $versionData['pretty_version'];
  25198. $config['version_normalized'] = $versionData['version'];
  25199. $commit = $versionData['commit'];
  25200. }
  25201. }
  25202. if (!isset($config['version'])) {
  25203. if ($this->io !== null && $config['name'] !== '__root__' && 'project' !== ($config['type'] ?? '')) {
  25204. $this->io->warning(
  25205. sprintf(
  25206. "Composer could not detect the root package (%s) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version",
  25207. $config['name']
  25208. )
  25209. );
  25210. }
  25211. $config['version'] = '1.0.0';
  25212. $autoVersioned = true;
  25213. }
  25214. if ($commit) {
  25215. $config['source'] = [
  25216. 'type' => '',
  25217. 'url' => '',
  25218. 'reference' => $commit,
  25219. ];
  25220. $config['dist'] = [
  25221. 'type' => '',
  25222. 'url' => '',
  25223. 'reference' => $commit,
  25224. ];
  25225. }
  25226. }
  25227. $package = parent::load($config, $class);
  25228. if ($package instanceof RootAliasPackage) {
  25229. $realPackage = $package->getAliasOf();
  25230. } else {
  25231. $realPackage = $package;
  25232. }
  25233. if (!$realPackage instanceof RootPackage) {
  25234. throw new \LogicException('Expecting a Composer\Package\RootPackage at this point');
  25235. }
  25236. if ($autoVersioned) {
  25237. $realPackage->replaceVersion($realPackage->getVersion(), RootPackage::DEFAULT_PRETTY_VERSION);
  25238. }
  25239. if (isset($config['minimum-stability'])) {
  25240. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  25241. }
  25242. $aliases = [];
  25243. $stabilityFlags = [];
  25244. $references = [];
  25245. foreach (['require', 'require-dev'] as $linkType) {
  25246. if (isset($config[$linkType])) {
  25247. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  25248. $method = 'get'.ucfirst($linkInfo['method']);
  25249. $links = [];
  25250. foreach ($realPackage->{$method}() as $link) {
  25251. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  25252. }
  25253. $aliases = $this->extractAliases($links, $aliases);
  25254. $stabilityFlags = self::extractStabilityFlags($links, $realPackage->getMinimumStability(), $stabilityFlags);
  25255. $references = self::extractReferences($links, $references);
  25256. if (isset($links[$config['name']])) {
  25257. throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  25258. 'Did you accidentally name your root package after an external package?', $config['name']));
  25259. }
  25260. }
  25261. }
  25262. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  25263. if (isset($config[$linkType])) {
  25264. foreach ($config[$linkType] as $linkName => $constraint) {
  25265. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  25266. throw new \RuntimeException($linkType.'.'.$err);
  25267. }
  25268. }
  25269. }
  25270. }
  25271. $realPackage->setAliases($aliases);
  25272. $realPackage->setStabilityFlags($stabilityFlags);
  25273. $realPackage->setReferences($references);
  25274. if (isset($config['prefer-stable'])) {
  25275. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  25276. }
  25277. if (isset($config['config'])) {
  25278. $realPackage->setConfig($config['config']);
  25279. }
  25280. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  25281. foreach ($repos as $repo) {
  25282. $this->manager->addRepository($repo);
  25283. }
  25284. $realPackage->setRepositories($this->config->getRepositories());
  25285. return $package;
  25286. }
  25287. private function extractAliases(array $requires, array $aliases): array
  25288. {
  25289. foreach ($requires as $reqName => $reqVersion) {
  25290. if (Preg::isMatchStrictGroups('{(?:^|\| *|, *)([^,\s#|]+)(?:#[^ ]+)? +as +([^,\s|]+)(?:$| *\|| *,)}', $reqVersion, $match)) {
  25291. $aliases[] = [
  25292. 'package' => strtolower($reqName),
  25293. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  25294. 'alias' => $match[2],
  25295. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  25296. ];
  25297. } elseif (strpos($reqVersion, ' as ') !== false) {
  25298. throw new \UnexpectedValueException('Invalid alias definition in "'.$reqName.'": "'.$reqVersion.'". Aliases should be in the form "exact-version as other-exact-version".');
  25299. }
  25300. }
  25301. return $aliases;
  25302. }
  25303. public static function extractStabilityFlags(array $requires, string $minimumStability, array $stabilityFlags): array
  25304. {
  25305. $stabilities = BasePackage::STABILITIES;
  25306. $minimumStability = $stabilities[$minimumStability];
  25307. foreach ($requires as $reqName => $reqVersion) {
  25308. $constraints = [];
  25309. $orSplit = Preg::split('{\s*\|\|?\s*}', trim($reqVersion));
  25310. foreach ($orSplit as $orConstraint) {
  25311. $andSplit = Preg::split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  25312. foreach ($andSplit as $andConstraint) {
  25313. $constraints[] = $andConstraint;
  25314. }
  25315. }
  25316. $matched = false;
  25317. foreach ($constraints as $constraint) {
  25318. if (Preg::isMatchStrictGroups('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  25319. $name = strtolower($reqName);
  25320. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  25321. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  25322. continue;
  25323. }
  25324. $stabilityFlags[$name] = $stability;
  25325. $matched = true;
  25326. }
  25327. }
  25328. if ($matched) {
  25329. continue;
  25330. }
  25331. foreach ($constraints as $constraint) {
  25332. $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  25333. if (Preg::isMatch('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  25334. $name = strtolower($reqName);
  25335. $stability = $stabilities[$stabilityName];
  25336. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  25337. continue;
  25338. }
  25339. $stabilityFlags[$name] = $stability;
  25340. }
  25341. }
  25342. }
  25343. return $stabilityFlags;
  25344. }
  25345. public static function extractReferences(array $requires, array $references): array
  25346. {
  25347. foreach ($requires as $reqName => $reqVersion) {
  25348. $reqVersion = Preg::replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  25349. if (Preg::isMatchStrictGroups('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  25350. $name = strtolower($reqName);
  25351. $references[$name] = $match[1];
  25352. }
  25353. }
  25354. return $references;
  25355. }
  25356. }
  25357. <?php declare(strict_types=1);
  25358. namespace Composer\Package\Loader;
  25359. use Composer\Package\BasePackage;
  25360. use Composer\Pcre\Preg;
  25361. use Composer\Semver\Constraint\Constraint;
  25362. use Composer\Package\Version\VersionParser;
  25363. use Composer\Repository\PlatformRepository;
  25364. use Composer\Semver\Constraint\MatchNoneConstraint;
  25365. use Composer\Semver\Intervals;
  25366. use Composer\Spdx\SpdxLicenses;
  25367. class ValidatingArrayLoader implements LoaderInterface
  25368. {
  25369. public const CHECK_ALL = 3;
  25370. public const CHECK_UNBOUND_CONSTRAINTS = 1;
  25371. public const CHECK_STRICT_CONSTRAINTS = 2;
  25372. private $loader;
  25373. private $versionParser;
  25374. private $errors;
  25375. private $warnings;
  25376. private $config;
  25377. private $flags;
  25378. public function __construct(LoaderInterface $loader, bool $strictName = true, ?VersionParser $parser = null, int $flags = 0)
  25379. {
  25380. $this->loader = $loader;
  25381. $this->versionParser = $parser ?? new VersionParser();
  25382. $this->flags = $flags;
  25383. if ($strictName !== true) {
  25384. trigger_error('$strictName must be set to true in ValidatingArrayLoader\'s constructor as of 2.2, and it will be removed in 3.0', E_USER_DEPRECATED);
  25385. }
  25386. }
  25387. public function load(array $config, string $class = 'Composer\Package\CompletePackage'): BasePackage
  25388. {
  25389. $this->errors = [];
  25390. $this->warnings = [];
  25391. $this->config = $config;
  25392. $this->validateString('name', true);
  25393. if (isset($config['name']) && null !== ($err = self::hasPackageNamingError($config['name']))) {
  25394. $this->errors[] = 'name : '.$err;
  25395. }
  25396. if (isset($this->config['version'])) {
  25397. if (!is_scalar($this->config['version'])) {
  25398. $this->validateString('version');
  25399. } else {
  25400. if (!is_string($this->config['version'])) {
  25401. $this->config['version'] = (string) $this->config['version'];
  25402. }
  25403. try {
  25404. $this->versionParser->normalize($this->config['version']);
  25405. } catch (\Exception $e) {
  25406. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  25407. unset($this->config['version']);
  25408. }
  25409. }
  25410. }
  25411. if (isset($this->config['config']['platform'])) {
  25412. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  25413. if (false === $platform) {
  25414. continue;
  25415. }
  25416. if (!is_string($platform)) {
  25417. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.gettype($platform).' '.var_export($platform, true).'): expected string or false';
  25418. continue;
  25419. }
  25420. try {
  25421. $this->versionParser->normalize($platform);
  25422. } catch (\Exception $e) {
  25423. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  25424. }
  25425. }
  25426. }
  25427. $this->validateRegex('type', '[A-Za-z0-9-]+');
  25428. $this->validateString('target-dir');
  25429. $this->validateArray('extra');
  25430. if (isset($this->config['bin'])) {
  25431. if (is_string($this->config['bin'])) {
  25432. $this->validateString('bin');
  25433. } else {
  25434. $this->validateFlatArray('bin');
  25435. }
  25436. }
  25437. $this->validateArray('scripts');
  25438. $this->validateString('description');
  25439. $this->validateUrl('homepage');
  25440. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  25441. $releaseDate = null;
  25442. $this->validateString('time');
  25443. if (isset($this->config['time'])) {
  25444. try {
  25445. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  25446. } catch (\Exception $e) {
  25447. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  25448. unset($this->config['time']);
  25449. }
  25450. }
  25451. if (isset($this->config['license']) && (null === $releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  25452. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  25453. $licenses = (array) $this->config['license'];
  25454. $licenseValidator = new SpdxLicenses();
  25455. foreach ($licenses as $license) {
  25456. if ('proprietary' === $license) {
  25457. continue;
  25458. }
  25459. $licenseToValidate = str_replace('proprietary', 'MIT', $license);
  25460. if (!$licenseValidator->validate($licenseToValidate)) {
  25461. if ($licenseValidator->validate(trim($licenseToValidate))) {
  25462. $this->warnings[] = sprintf(
  25463. 'License %s must not contain extra spaces, make sure to trim it.',
  25464. json_encode($license)
  25465. );
  25466. } else {
  25467. $this->warnings[] = sprintf(
  25468. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  25469. 'If the software is closed-source, you may use "proprietary" as license.',
  25470. json_encode($license)
  25471. );
  25472. }
  25473. }
  25474. }
  25475. }
  25476. }
  25477. if ($this->validateArray('authors')) {
  25478. foreach ($this->config['authors'] as $key => $author) {
  25479. if (!is_array($author)) {
  25480. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  25481. unset($this->config['authors'][$key]);
  25482. continue;
  25483. }
  25484. foreach (['homepage', 'email', 'name', 'role'] as $authorData) {
  25485. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  25486. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  25487. unset($this->config['authors'][$key][$authorData]);
  25488. }
  25489. }
  25490. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  25491. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  25492. unset($this->config['authors'][$key]['homepage']);
  25493. }
  25494. if (isset($author['email']) && false === filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  25495. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  25496. unset($this->config['authors'][$key]['email']);
  25497. }
  25498. if (\count($this->config['authors'][$key]) === 0) {
  25499. unset($this->config['authors'][$key]);
  25500. }
  25501. }
  25502. if (\count($this->config['authors']) === 0) {
  25503. unset($this->config['authors']);
  25504. }
  25505. }
  25506. if ($this->validateArray('support') && !empty($this->config['support'])) {
  25507. foreach (['issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat', 'security'] as $key) {
  25508. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  25509. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  25510. unset($this->config['support'][$key]);
  25511. }
  25512. }
  25513. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  25514. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  25515. unset($this->config['support']['email']);
  25516. }
  25517. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], ['irc', 'ircs'])) {
  25518. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> or ircs:// URL';
  25519. unset($this->config['support']['irc']);
  25520. }
  25521. foreach (['issues', 'forum', 'wiki', 'source', 'docs', 'chat', 'security'] as $key) {
  25522. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  25523. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  25524. unset($this->config['support'][$key]);
  25525. }
  25526. }
  25527. if (empty($this->config['support'])) {
  25528. unset($this->config['support']);
  25529. }
  25530. }
  25531. if ($this->validateArray('funding') && !empty($this->config['funding'])) {
  25532. foreach ($this->config['funding'] as $key => $fundingOption) {
  25533. if (!is_array($fundingOption)) {
  25534. $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
  25535. unset($this->config['funding'][$key]);
  25536. continue;
  25537. }
  25538. foreach (['type', 'url'] as $fundingData) {
  25539. if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
  25540. $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
  25541. unset($this->config['funding'][$key][$fundingData]);
  25542. }
  25543. }
  25544. if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
  25545. $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
  25546. unset($this->config['funding'][$key]['url']);
  25547. }
  25548. if (empty($this->config['funding'][$key])) {
  25549. unset($this->config['funding'][$key]);
  25550. }
  25551. }
  25552. if (empty($this->config['funding'])) {
  25553. unset($this->config['funding']);
  25554. }
  25555. }
  25556. $this->validateArray('php-ext');
  25557. if (isset($this->config['php-ext']) && !in_array($this->config['type'] ?? '', ['php-ext', 'php-ext-zend'], true)) {
  25558. $this->errors[] = 'php-ext can only be set by packages of type "php-ext" or "php-ext-zend" which must be C extensions';
  25559. unset($this->config['php-ext']);
  25560. }
  25561. $unboundConstraint = new Constraint('=', '10000000-dev');
  25562. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  25563. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  25564. foreach ($this->config[$linkType] as $package => $constraint) {
  25565. $package = (string) $package;
  25566. if (isset($this->config['name']) && 0 === strcasecmp($package, $this->config['name'])) {
  25567. $this->errors[] = $linkType.'.'.$package.' : a package cannot set a '.$linkType.' on itself';
  25568. unset($this->config[$linkType][$package]);
  25569. continue;
  25570. }
  25571. if ($err = self::hasPackageNamingError($package, true)) {
  25572. $this->warnings[] = $linkType.'.'.$err;
  25573. } elseif (!Preg::isMatch('{^[A-Za-z0-9_./-]+$}', $package)) {
  25574. $this->errors[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  25575. }
  25576. if (!is_string($constraint)) {
  25577. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  25578. unset($this->config[$linkType][$package]);
  25579. } elseif ('self.version' !== $constraint) {
  25580. try {
  25581. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  25582. } catch (\Exception $e) {
  25583. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  25584. unset($this->config[$linkType][$package]);
  25585. continue;
  25586. }
  25587. if (
  25588. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  25589. && 'require' === $linkType
  25590. && $linkConstraint->matches($unboundConstraint)
  25591. && !PlatformRepository::isPlatformPackage($package)
  25592. ) {
  25593. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  25594. } elseif (
  25595. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  25596. && 'require' === $linkType
  25597. && $linkConstraint instanceof Constraint && in_array($linkConstraint->getOperator(), ['==', '='], true)
  25598. && (new Constraint('>=', '1.0.0.0-dev'))->matches($linkConstraint)
  25599. ) {
  25600. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  25601. }
  25602. $compacted = Intervals::compactConstraint($linkConstraint);
  25603. if ($compacted instanceof MatchNoneConstraint) {
  25604. $this->warnings[] = $linkType.'.'.$package.' : this version constraint cannot possibly match anything ('.$constraint.')';
  25605. }
  25606. }
  25607. if ($linkType === 'conflict' && isset($this->config['replace']) && $keys = array_intersect_key($this->config['replace'], $this->config['conflict'])) {
  25608. $this->errors[] = $linkType.'.'.$package.' : you cannot conflict with a package that is also replaced, as replace already creates an implicit conflict rule';
  25609. unset($this->config[$linkType][$package]);
  25610. }
  25611. }
  25612. }
  25613. }
  25614. if ($this->validateArray('suggest') && isset($this->config['suggest'])) {
  25615. foreach ($this->config['suggest'] as $package => $description) {
  25616. if (!is_string($description)) {
  25617. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  25618. unset($this->config['suggest'][$package]);
  25619. }
  25620. }
  25621. }
  25622. if ($this->validateString('minimum-stability') && isset($this->config['minimum-stability'])) {
  25623. if (!isset(BasePackage::STABILITIES[strtolower($this->config['minimum-stability'])]) && $this->config['minimum-stability'] !== 'RC') {
  25624. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::STABILITIES));
  25625. unset($this->config['minimum-stability']);
  25626. }
  25627. }
  25628. if ($this->validateArray('autoload') && isset($this->config['autoload'])) {
  25629. $types = ['psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap'];
  25630. foreach ($this->config['autoload'] as $type => $typeConfig) {
  25631. if (!in_array($type, $types)) {
  25632. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  25633. unset($this->config['autoload'][$type]);
  25634. }
  25635. if ($type === 'psr-4') {
  25636. foreach ($typeConfig as $namespace => $dirs) {
  25637. if ($namespace !== '' && '\\' !== substr((string) $namespace, -1)) {
  25638. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  25639. }
  25640. }
  25641. }
  25642. }
  25643. }
  25644. if (isset($this->config['autoload']['psr-4']) && isset($this->config['target-dir'])) {
  25645. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  25646. unset($this->config['autoload']['psr-4']);
  25647. }
  25648. foreach (['source', 'dist'] as $srcType) {
  25649. if ($this->validateArray($srcType) && !empty($this->config[$srcType])) {
  25650. if (!isset($this->config[$srcType]['type'])) {
  25651. $this->errors[] = $srcType . '.type : must be present';
  25652. }
  25653. if (!isset($this->config[$srcType]['url'])) {
  25654. $this->errors[] = $srcType . '.url : must be present';
  25655. }
  25656. if ($srcType === 'source' && !isset($this->config[$srcType]['reference'])) {
  25657. $this->errors[] = $srcType . '.reference : must be present';
  25658. }
  25659. if (isset($this->config[$srcType]['type']) && !is_string($this->config[$srcType]['type'])) {
  25660. $this->errors[] = $srcType . '.type : should be a string, '.gettype($this->config[$srcType]['type']).' given';
  25661. }
  25662. if (isset($this->config[$srcType]['url']) && !is_string($this->config[$srcType]['url'])) {
  25663. $this->errors[] = $srcType . '.url : should be a string, '.gettype($this->config[$srcType]['url']).' given';
  25664. }
  25665. if (isset($this->config[$srcType]['reference']) && !is_string($this->config[$srcType]['reference']) && !is_int($this->config[$srcType]['reference'])) {
  25666. $this->errors[] = $srcType . '.reference : should be a string or int, '.gettype($this->config[$srcType]['reference']).' given';
  25667. }
  25668. if (isset($this->config[$srcType]['reference']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['reference'])) {
  25669. $this->errors[] = $srcType . '.reference : must not start with a "-", "'.$this->config[$srcType]['reference'].'" given';
  25670. }
  25671. if (isset($this->config[$srcType]['url']) && Preg::isMatch('{^\s*-}', (string) $this->config[$srcType]['url'])) {
  25672. $this->errors[] = $srcType . '.url : must not start with a "-", "'.$this->config[$srcType]['url'].'" given';
  25673. }
  25674. }
  25675. }
  25676. $this->validateFlatArray('include-path');
  25677. $this->validateArray('transport-options');
  25678. if (isset($this->config['extra']['branch-alias'])) {
  25679. if (!is_array($this->config['extra']['branch-alias'])) {
  25680. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  25681. } else {
  25682. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  25683. if (!is_string($targetBranch)) {
  25684. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.json_encode($targetBranch).') must be a string, "'.gettype($targetBranch).'" received.';
  25685. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  25686. continue;
  25687. }
  25688. if ('-dev' !== substr($targetBranch, -4)) {
  25689. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  25690. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  25691. continue;
  25692. }
  25693. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  25694. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  25695. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  25696. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  25697. continue;
  25698. }
  25699. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  25700. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  25701. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  25702. ) {
  25703. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  25704. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  25705. }
  25706. }
  25707. }
  25708. }
  25709. if ($this->errors) {
  25710. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  25711. }
  25712. $package = $this->loader->load($this->config, $class);
  25713. $this->config = [];
  25714. return $package;
  25715. }
  25716. public function getWarnings(): array
  25717. {
  25718. return $this->warnings;
  25719. }
  25720. public function getErrors(): array
  25721. {
  25722. return $this->errors;
  25723. }
  25724. public static function hasPackageNamingError(string $name, bool $isLink = false): ?string
  25725. {
  25726. if (PlatformRepository::isPlatformPackage($name)) {
  25727. return null;
  25728. }
  25729. if (!Preg::isMatch('{^[a-z0-9](?:[_.-]?[a-z0-9]++)*+/[a-z0-9](?:(?:[_.]|-{1,2})?[a-z0-9]++)*+$}iD', $name)) {
  25730. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".';
  25731. }
  25732. $reservedNames = ['nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9'];
  25733. $bits = explode('/', strtolower($name));
  25734. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  25735. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  25736. }
  25737. if (Preg::isMatch('{\.json$}', $name)) {
  25738. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  25739. }
  25740. if (Preg::isMatch('{[A-Z]}', $name)) {
  25741. if ($isLink) {
  25742. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  25743. }
  25744. $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  25745. $suggestName = strtolower($suggestName);
  25746. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  25747. }
  25748. return null;
  25749. }
  25750. private function validateRegex(string $property, string $regex, bool $mandatory = false): bool
  25751. {
  25752. if (!$this->validateString($property, $mandatory)) {
  25753. return false;
  25754. }
  25755. if (!Preg::isMatch('{^'.$regex.'$}u', $this->config[$property])) {
  25756. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  25757. if ($mandatory) {
  25758. $this->errors[] = $message;
  25759. } else {
  25760. $this->warnings[] = $message;
  25761. }
  25762. unset($this->config[$property]);
  25763. return false;
  25764. }
  25765. return true;
  25766. }
  25767. private function validateString(string $property, bool $mandatory = false): bool
  25768. {
  25769. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  25770. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  25771. unset($this->config[$property]);
  25772. return false;
  25773. }
  25774. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  25775. if ($mandatory) {
  25776. $this->errors[] = $property.' : must be present';
  25777. }
  25778. unset($this->config[$property]);
  25779. return false;
  25780. }
  25781. return true;
  25782. }
  25783. private function validateArray(string $property, bool $mandatory = false): bool
  25784. {
  25785. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  25786. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  25787. unset($this->config[$property]);
  25788. return false;
  25789. }
  25790. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  25791. if ($mandatory) {
  25792. $this->errors[] = $property.' : must be present and contain at least one element';
  25793. }
  25794. unset($this->config[$property]);
  25795. return false;
  25796. }
  25797. return true;
  25798. }
  25799. private function validateFlatArray(string $property, ?string $regex = null, bool $mandatory = false): bool
  25800. {
  25801. if (!$this->validateArray($property, $mandatory)) {
  25802. return false;
  25803. }
  25804. $pass = true;
  25805. foreach ($this->config[$property] as $key => $value) {
  25806. if (!is_string($value) && !is_numeric($value)) {
  25807. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  25808. unset($this->config[$property][$key]);
  25809. $pass = false;
  25810. continue;
  25811. }
  25812. if ($regex && !Preg::isMatch('{^'.$regex.'$}u', (string) $value)) {
  25813. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  25814. unset($this->config[$property][$key]);
  25815. $pass = false;
  25816. }
  25817. }
  25818. return $pass;
  25819. }
  25820. private function validateUrl(string $property, bool $mandatory = false): bool
  25821. {
  25822. if (!$this->validateString($property, $mandatory)) {
  25823. return false;
  25824. }
  25825. if (!$this->filterUrl($this->config[$property])) {
  25826. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  25827. unset($this->config[$property]);
  25828. return false;
  25829. }
  25830. return true;
  25831. }
  25832. private function filterUrl($value, array $schemes = ['http', 'https']): bool
  25833. {
  25834. if ($value === '') {
  25835. return true;
  25836. }
  25837. $bits = parse_url($value);
  25838. if (empty($bits['scheme']) || empty($bits['host'])) {
  25839. return false;
  25840. }
  25841. if (!in_array($bits['scheme'], $schemes, true)) {
  25842. return false;
  25843. }
  25844. return true;
  25845. }
  25846. }
  25847. <?php declare(strict_types=1);
  25848. namespace Composer\Package;
  25849. use Composer\Json\JsonFile;
  25850. use Composer\Installer\InstallationManager;
  25851. use Composer\Pcre\Preg;
  25852. use Composer\Repository\InstalledRepository;
  25853. use Composer\Repository\LockArrayRepository;
  25854. use Composer\Repository\PlatformRepository;
  25855. use Composer\Repository\RootPackageRepository;
  25856. use Composer\Util\ProcessExecutor;
  25857. use Composer\Package\Dumper\ArrayDumper;
  25858. use Composer\Package\Loader\ArrayLoader;
  25859. use Composer\Package\Version\VersionParser;
  25860. use Composer\Plugin\PluginInterface;
  25861. use Composer\Util\Git as GitUtil;
  25862. use Composer\IO\IOInterface;
  25863. use Seld\JsonLint\ParsingException;
  25864. class Locker
  25865. {
  25866. private $lockFile;
  25867. private $installationManager;
  25868. private $hash;
  25869. private $contentHash;
  25870. private $loader;
  25871. private $dumper;
  25872. private $process;
  25873. private $lockDataCache = null;
  25874. private $virtualFileWritten = false;
  25875. public function __construct(IOInterface $io, JsonFile $lockFile, InstallationManager $installationManager, string $composerFileContents, ?ProcessExecutor $process = null)
  25876. {
  25877. $this->lockFile = $lockFile;
  25878. $this->installationManager = $installationManager;
  25879. $this->hash = hash('md5', $composerFileContents);
  25880. $this->contentHash = self::getContentHash($composerFileContents);
  25881. $this->loader = new ArrayLoader(null, true);
  25882. $this->dumper = new ArrayDumper();
  25883. $this->process = $process ?? new ProcessExecutor($io);
  25884. }
  25885. public function getJsonFile(): JsonFile
  25886. {
  25887. return $this->lockFile;
  25888. }
  25889. public static function getContentHash(string $composerFileContents): string
  25890. {
  25891. $content = JsonFile::parseJson($composerFileContents, 'composer.json');
  25892. $relevantKeys = [
  25893. 'name',
  25894. 'version',
  25895. 'require',
  25896. 'require-dev',
  25897. 'conflict',
  25898. 'replace',
  25899. 'provide',
  25900. 'minimum-stability',
  25901. 'prefer-stable',
  25902. 'repositories',
  25903. 'extra',
  25904. ];
  25905. $relevantContent = [];
  25906. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  25907. $relevantContent[$key] = $content[$key];
  25908. }
  25909. if (isset($content['config']['platform'])) {
  25910. $relevantContent['config']['platform'] = $content['config']['platform'];
  25911. }
  25912. ksort($relevantContent);
  25913. return hash('md5', JsonFile::encode($relevantContent, 0));
  25914. }
  25915. public function isLocked(): bool
  25916. {
  25917. if (!$this->virtualFileWritten && !$this->lockFile->exists()) {
  25918. return false;
  25919. }
  25920. $data = $this->getLockData();
  25921. return isset($data['packages']);
  25922. }
  25923. public function isFresh(): bool
  25924. {
  25925. $lock = $this->lockFile->read();
  25926. if (!empty($lock['content-hash'])) {
  25927. return $this->contentHash === $lock['content-hash'];
  25928. }
  25929. if (!empty($lock['hash'])) {
  25930. return $this->hash === $lock['hash'];
  25931. }
  25932. return false;
  25933. }
  25934. public function getLockedRepository(bool $withDevReqs = false): LockArrayRepository
  25935. {
  25936. $lockData = $this->getLockData();
  25937. $packages = new LockArrayRepository();
  25938. $lockedPackages = $lockData['packages'];
  25939. if ($withDevReqs) {
  25940. if (isset($lockData['packages-dev'])) {
  25941. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  25942. } else {
  25943. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or delete it and run composer update to generate a new lock file.');
  25944. }
  25945. }
  25946. if (empty($lockedPackages)) {
  25947. return $packages;
  25948. }
  25949. if (isset($lockedPackages[0]['name'])) {
  25950. $packageByName = [];
  25951. foreach ($lockedPackages as $info) {
  25952. $package = $this->loader->load($info);
  25953. $packages->addPackage($package);
  25954. $packageByName[$package->getName()] = $package;
  25955. if ($package instanceof AliasPackage) {
  25956. $packageByName[$package->getAliasOf()->getName()] = $package->getAliasOf();
  25957. }
  25958. }
  25959. if (isset($lockData['aliases'])) {
  25960. foreach ($lockData['aliases'] as $alias) {
  25961. if (isset($packageByName[$alias['package']])) {
  25962. $aliasPkg = new CompleteAliasPackage($packageByName[$alias['package']], $alias['alias_normalized'], $alias['alias']);
  25963. $aliasPkg->setRootPackageAlias(true);
  25964. $packages->addPackage($aliasPkg);
  25965. }
  25966. }
  25967. }
  25968. return $packages;
  25969. }
  25970. throw new \RuntimeException('Your composer.lock is invalid. Run "composer update" to generate a new one.');
  25971. }
  25972. public function getDevPackageNames(): array
  25973. {
  25974. $names = [];
  25975. $lockData = $this->getLockData();
  25976. if (isset($lockData['packages-dev'])) {
  25977. foreach ($lockData['packages-dev'] as $package) {
  25978. $names[] = strtolower($package['name']);
  25979. }
  25980. }
  25981. return $names;
  25982. }
  25983. public function getPlatformRequirements(bool $withDevReqs = false): array
  25984. {
  25985. $lockData = $this->getLockData();
  25986. $requirements = [];
  25987. if (!empty($lockData['platform'])) {
  25988. $requirements = $this->loader->parseLinks(
  25989. '__root__',
  25990. '1.0.0',
  25991. Link::TYPE_REQUIRE,
  25992. $lockData['platform'] ?? []
  25993. );
  25994. }
  25995. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  25996. $devRequirements = $this->loader->parseLinks(
  25997. '__root__',
  25998. '1.0.0',
  25999. Link::TYPE_REQUIRE,
  26000. $lockData['platform-dev'] ?? []
  26001. );
  26002. $requirements = array_merge($requirements, $devRequirements);
  26003. }
  26004. return $requirements;
  26005. }
  26006. public function getMinimumStability(): string
  26007. {
  26008. $lockData = $this->getLockData();
  26009. return $lockData['minimum-stability'] ?? 'stable';
  26010. }
  26011. public function getStabilityFlags(): array
  26012. {
  26013. $lockData = $this->getLockData();
  26014. return $lockData['stability-flags'] ?? [];
  26015. }
  26016. public function getPreferStable(): ?bool
  26017. {
  26018. $lockData = $this->getLockData();
  26019. return $lockData['prefer-stable'] ?? null;
  26020. }
  26021. public function getPreferLowest(): ?bool
  26022. {
  26023. $lockData = $this->getLockData();
  26024. return $lockData['prefer-lowest'] ?? null;
  26025. }
  26026. public function getPlatformOverrides(): array
  26027. {
  26028. $lockData = $this->getLockData();
  26029. return $lockData['platform-overrides'] ?? [];
  26030. }
  26031. public function getAliases(): array
  26032. {
  26033. $lockData = $this->getLockData();
  26034. return $lockData['aliases'] ?? [];
  26035. }
  26036. public function getPluginApi()
  26037. {
  26038. $lockData = $this->getLockData();
  26039. return $lockData['plugin-api-version'] ?? '1.1.0';
  26040. }
  26041. public function getLockData(): array
  26042. {
  26043. if (null !== $this->lockDataCache) {
  26044. return $this->lockDataCache;
  26045. }
  26046. if (!$this->lockFile->exists()) {
  26047. throw new \LogicException('No lockfile found. Unable to read locked packages');
  26048. }
  26049. return $this->lockDataCache = $this->lockFile->read();
  26050. }
  26051. public function setLockData(array $packages, ?array $devPackages, array $platformReqs, array $platformDevReqs, array $aliases, string $minimumStability, array $stabilityFlags, bool $preferStable, bool $preferLowest, array $platformOverrides, bool $write = true): bool
  26052. {
  26053. $aliases = array_map(static function ($alias): array {
  26054. if (in_array($alias['version'], ['dev-master', 'dev-trunk', 'dev-default'], true)) {
  26055. $alias['version'] = VersionParser::DEFAULT_BRANCH_ALIAS;
  26056. }
  26057. return $alias;
  26058. }, $aliases);
  26059. $lock = [
  26060. '_readme' => ['This file locks the dependencies of your project to a known state',
  26061. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  26062. 'This file is @gener'.'ated automatically', ],
  26063. 'content-hash' => $this->contentHash,
  26064. 'packages' => $this->lockPackages($packages),
  26065. 'packages-dev' => null,
  26066. 'aliases' => $aliases,
  26067. 'minimum-stability' => $minimumStability,
  26068. 'stability-flags' => $stabilityFlags,
  26069. 'prefer-stable' => $preferStable,
  26070. 'prefer-lowest' => $preferLowest,
  26071. ];
  26072. if (null !== $devPackages) {
  26073. $lock['packages-dev'] = $this->lockPackages($devPackages);
  26074. }
  26075. $lock['platform'] = $platformReqs;
  26076. $lock['platform-dev'] = $platformDevReqs;
  26077. if (\count($platformOverrides) > 0) {
  26078. $lock['platform-overrides'] = $platformOverrides;
  26079. }
  26080. $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
  26081. $lock = $this->fixupJsonDataType($lock);
  26082. try {
  26083. $isLocked = $this->isLocked();
  26084. } catch (ParsingException $e) {
  26085. $isLocked = false;
  26086. }
  26087. if (!$isLocked || $lock !== $this->getLockData()) {
  26088. if ($write) {
  26089. $this->lockFile->write($lock);
  26090. $this->lockDataCache = null;
  26091. $this->virtualFileWritten = false;
  26092. } else {
  26093. $this->virtualFileWritten = true;
  26094. $this->lockDataCache = JsonFile::parseJson(JsonFile::encode($lock));
  26095. }
  26096. return true;
  26097. }
  26098. return false;
  26099. }
  26100. public function updateHash(JsonFile $composerJson, ?callable $dataProcessor = null): void
  26101. {
  26102. $contents = file_get_contents($composerJson->getPath());
  26103. if (false === $contents) {
  26104. throw new \RuntimeException('Unable to read '.$composerJson->getPath().' contents to update the lock file hash.');
  26105. }
  26106. $lockMtime = filemtime($this->lockFile->getPath());
  26107. $lockData = $this->lockFile->read();
  26108. $lockData['content-hash'] = Locker::getContentHash($contents);
  26109. if ($dataProcessor !== null) {
  26110. $lockData = $dataProcessor($lockData);
  26111. }
  26112. $this->lockFile->write($this->fixupJsonDataType($lockData));
  26113. $this->lockDataCache = null;
  26114. $this->virtualFileWritten = false;
  26115. if (is_int($lockMtime)) {
  26116. @touch($this->lockFile->getPath(), $lockMtime);
  26117. }
  26118. }
  26119. private function fixupJsonDataType(array $lockData): array
  26120. {
  26121. foreach (['stability-flags', 'platform', 'platform-dev'] as $key) {
  26122. if (isset($lockData[$key]) && is_array($lockData[$key]) && \count($lockData[$key]) === 0) {
  26123. $lockData[$key] = new \stdClass();
  26124. }
  26125. }
  26126. if (is_array($lockData['stability-flags'])) {
  26127. ksort($lockData['stability-flags']);
  26128. }
  26129. return $lockData;
  26130. }
  26131. private function lockPackages(array $packages): array
  26132. {
  26133. $locked = [];
  26134. foreach ($packages as $package) {
  26135. if ($package instanceof AliasPackage) {
  26136. continue;
  26137. }
  26138. $name = $package->getPrettyName();
  26139. $version = $package->getPrettyVersion();
  26140. if (!$name || !$version) {
  26141. throw new \LogicException(sprintf(
  26142. 'Package "%s" has no version or name and can not be locked',
  26143. $package
  26144. ));
  26145. }
  26146. $spec = $this->dumper->dump($package);
  26147. unset($spec['version_normalized']);
  26148. $time = $spec['time'] ?? null;
  26149. unset($spec['time']);
  26150. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  26151. $time = $this->getPackageTime($package) ?: $time;
  26152. }
  26153. if (null !== $time) {
  26154. $spec['time'] = $time;
  26155. }
  26156. unset($spec['installation-source']);
  26157. $locked[] = $spec;
  26158. }
  26159. usort($locked, static function ($a, $b) {
  26160. $comparison = strcmp($a['name'], $b['name']);
  26161. if (0 !== $comparison) {
  26162. return $comparison;
  26163. }
  26164. return strcmp($a['version'], $b['version']);
  26165. });
  26166. return $locked;
  26167. }
  26168. private function getPackageTime(PackageInterface $package): ?string
  26169. {
  26170. if (!function_exists('proc_open')) {
  26171. return null;
  26172. }
  26173. $path = $this->installationManager->getInstallPath($package);
  26174. if ($path === null) {
  26175. return null;
  26176. }
  26177. $path = realpath($path);
  26178. $sourceType = $package->getSourceType();
  26179. $datetime = null;
  26180. if ($path && in_array($sourceType, ['git', 'hg'])) {
  26181. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  26182. switch ($sourceType) {
  26183. case 'git':
  26184. GitUtil::cleanEnv();
  26185. $command = array_merge(['git', 'log', '-n1', '--pretty=%ct', (string) $sourceRef], GitUtil::getNoShowSignatureFlags($this->process));
  26186. if (0 === $this->process->execute($command, $output, $path) && Preg::isMatch('{^\s*\d+\s*$}', $output)) {
  26187. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  26188. }
  26189. break;
  26190. case 'hg':
  26191. if (0 === $this->process->execute(['hg', 'log', '--template', '{date|hgdate}', '-r', (string) $sourceRef], $output, $path) && Preg::isMatch('{^\s*(\d+)\s*}', $output, $match)) {
  26192. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  26193. }
  26194. break;
  26195. }
  26196. }
  26197. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  26198. }
  26199. public function getMissingRequirementInfo(RootPackageInterface $package, bool $includeDev): array
  26200. {
  26201. $missingRequirementInfo = [];
  26202. $missingRequirements = false;
  26203. $sets = [['repo' => $this->getLockedRepository(false), 'method' => 'getRequires', 'description' => 'Required']];
  26204. if ($includeDev === true) {
  26205. $sets[] = ['repo' => $this->getLockedRepository(true), 'method' => 'getDevRequires', 'description' => 'Required (in require-dev)'];
  26206. }
  26207. $rootRepo = new RootPackageRepository(clone $package);
  26208. foreach ($sets as $set) {
  26209. $installedRepo = new InstalledRepository([$set['repo'], $rootRepo]);
  26210. foreach (call_user_func([$package, $set['method']]) as $link) {
  26211. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  26212. continue;
  26213. }
  26214. if ($link->getPrettyConstraint() === 'self.version') {
  26215. continue;
  26216. }
  26217. if ($installedRepo->findPackagesWithReplacersAndProviders($link->getTarget(), $link->getConstraint()) === []) {
  26218. $results = $installedRepo->findPackagesWithReplacersAndProviders($link->getTarget());
  26219. if ($results !== []) {
  26220. $provider = reset($results);
  26221. $description = $provider->getPrettyVersion();
  26222. if ($provider->getName() !== $link->getTarget()) {
  26223. foreach (['getReplaces' => 'replaced as %s by %s', 'getProvides' => 'provided as %s by %s'] as $method => $text) {
  26224. foreach (call_user_func([$provider, $method]) as $providerLink) {
  26225. if ($providerLink->getTarget() === $link->getTarget()) {
  26226. $description = sprintf($text, $providerLink->getPrettyConstraint(), $provider->getPrettyName().' '.$provider->getPrettyVersion());
  26227. break 2;
  26228. }
  26229. }
  26230. }
  26231. }
  26232. $missingRequirementInfo[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is in the lock file as "'.$description.'" but that does not satisfy your constraint "'.$link->getPrettyConstraint().'".';
  26233. } else {
  26234. $missingRequirementInfo[] = '- ' . $set['description'].' package "' . $link->getTarget() . '" is not present in the lock file.';
  26235. }
  26236. $missingRequirements = true;
  26237. }
  26238. }
  26239. }
  26240. if ($missingRequirements) {
  26241. $missingRequirementInfo[] = 'This usually happens when composer files are incorrectly merged or the composer.json file is manually edited.';
  26242. $missingRequirementInfo[] = 'Read more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md';
  26243. $missingRequirementInfo[] = 'and prefer using the "require" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r';
  26244. }
  26245. return $missingRequirementInfo;
  26246. }
  26247. }
  26248. <?php declare(strict_types=1);
  26249. namespace Composer\Package;
  26250. use Composer\Package\Version\VersionParser;
  26251. use Composer\Pcre\Preg;
  26252. use Composer\Util\ComposerMirror;
  26253. class Package extends BasePackage
  26254. {
  26255. protected $type;
  26256. protected $targetDir;
  26257. protected $installationSource;
  26258. protected $sourceType;
  26259. protected $sourceUrl;
  26260. protected $sourceReference;
  26261. protected $sourceMirrors;
  26262. protected $distType;
  26263. protected $distUrl;
  26264. protected $distReference;
  26265. protected $distSha1Checksum;
  26266. protected $distMirrors;
  26267. protected $version;
  26268. protected $prettyVersion;
  26269. protected $releaseDate;
  26270. protected $extra = [];
  26271. protected $binaries = [];
  26272. protected $dev;
  26273. protected $stability;
  26274. protected $notificationUrl;
  26275. protected $requires = [];
  26276. protected $conflicts = [];
  26277. protected $provides = [];
  26278. protected $replaces = [];
  26279. protected $devRequires = [];
  26280. protected $suggests = [];
  26281. protected $autoload = [];
  26282. protected $devAutoload = [];
  26283. protected $includePaths = [];
  26284. protected $isDefaultBranch = false;
  26285. protected $transportOptions = [];
  26286. protected $phpExt = null;
  26287. public function __construct(string $name, string $version, string $prettyVersion)
  26288. {
  26289. parent::__construct($name);
  26290. $this->version = $version;
  26291. $this->prettyVersion = $prettyVersion;
  26292. $this->stability = VersionParser::parseStability($version);
  26293. $this->dev = $this->stability === 'dev';
  26294. }
  26295. public function isDev(): bool
  26296. {
  26297. return $this->dev;
  26298. }
  26299. public function setType(string $type): void
  26300. {
  26301. $this->type = $type;
  26302. }
  26303. public function getType(): string
  26304. {
  26305. return $this->type ?: 'library';
  26306. }
  26307. public function getStability(): string
  26308. {
  26309. return $this->stability;
  26310. }
  26311. public function setTargetDir(?string $targetDir): void
  26312. {
  26313. $this->targetDir = $targetDir;
  26314. }
  26315. public function getTargetDir(): ?string
  26316. {
  26317. if (null === $this->targetDir) {
  26318. return null;
  26319. }
  26320. return ltrim(Preg::replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  26321. }
  26322. public function setExtra(array $extra): void
  26323. {
  26324. $this->extra = $extra;
  26325. }
  26326. public function getExtra(): array
  26327. {
  26328. return $this->extra;
  26329. }
  26330. public function setBinaries(array $binaries): void
  26331. {
  26332. $this->binaries = $binaries;
  26333. }
  26334. public function getBinaries(): array
  26335. {
  26336. return $this->binaries;
  26337. }
  26338. public function setInstallationSource(?string $type): void
  26339. {
  26340. $this->installationSource = $type;
  26341. }
  26342. public function getInstallationSource(): ?string
  26343. {
  26344. return $this->installationSource;
  26345. }
  26346. public function setSourceType(?string $type): void
  26347. {
  26348. $this->sourceType = $type;
  26349. }
  26350. public function getSourceType(): ?string
  26351. {
  26352. return $this->sourceType;
  26353. }
  26354. public function setSourceUrl(?string $url): void
  26355. {
  26356. $this->sourceUrl = $url;
  26357. }
  26358. public function getSourceUrl(): ?string
  26359. {
  26360. return $this->sourceUrl;
  26361. }
  26362. public function setSourceReference(?string $reference): void
  26363. {
  26364. $this->sourceReference = $reference;
  26365. }
  26366. public function getSourceReference(): ?string
  26367. {
  26368. return $this->sourceReference;
  26369. }
  26370. public function setSourceMirrors(?array $mirrors): void
  26371. {
  26372. $this->sourceMirrors = $mirrors;
  26373. }
  26374. public function getSourceMirrors(): ?array
  26375. {
  26376. return $this->sourceMirrors;
  26377. }
  26378. public function getSourceUrls(): array
  26379. {
  26380. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  26381. }
  26382. public function setDistType(?string $type): void
  26383. {
  26384. $this->distType = $type === '' ? null : $type;
  26385. }
  26386. public function getDistType(): ?string
  26387. {
  26388. return $this->distType;
  26389. }
  26390. public function setDistUrl(?string $url): void
  26391. {
  26392. $this->distUrl = $url === '' ? null : $url;
  26393. }
  26394. public function getDistUrl(): ?string
  26395. {
  26396. return $this->distUrl;
  26397. }
  26398. public function setDistReference(?string $reference): void
  26399. {
  26400. $this->distReference = $reference;
  26401. }
  26402. public function getDistReference(): ?string
  26403. {
  26404. return $this->distReference;
  26405. }
  26406. public function setDistSha1Checksum(?string $sha1checksum): void
  26407. {
  26408. $this->distSha1Checksum = $sha1checksum;
  26409. }
  26410. public function getDistSha1Checksum(): ?string
  26411. {
  26412. return $this->distSha1Checksum;
  26413. }
  26414. public function setDistMirrors(?array $mirrors): void
  26415. {
  26416. $this->distMirrors = $mirrors;
  26417. }
  26418. public function getDistMirrors(): ?array
  26419. {
  26420. return $this->distMirrors;
  26421. }
  26422. public function getDistUrls(): array
  26423. {
  26424. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  26425. }
  26426. public function getTransportOptions(): array
  26427. {
  26428. return $this->transportOptions;
  26429. }
  26430. public function setTransportOptions(array $options): void
  26431. {
  26432. $this->transportOptions = $options;
  26433. }
  26434. public function getVersion(): string
  26435. {
  26436. return $this->version;
  26437. }
  26438. public function getPrettyVersion(): string
  26439. {
  26440. return $this->prettyVersion;
  26441. }
  26442. public function setReleaseDate(?\DateTimeInterface $releaseDate): void
  26443. {
  26444. $this->releaseDate = $releaseDate;
  26445. }
  26446. public function getReleaseDate(): ?\DateTimeInterface
  26447. {
  26448. return $this->releaseDate;
  26449. }
  26450. public function setRequires(array $requires): void
  26451. {
  26452. if (isset($requires[0])) {
  26453. $requires = $this->convertLinksToMap($requires, 'setRequires');
  26454. }
  26455. $this->requires = $requires;
  26456. }
  26457. public function getRequires(): array
  26458. {
  26459. return $this->requires;
  26460. }
  26461. public function setConflicts(array $conflicts): void
  26462. {
  26463. if (isset($conflicts[0])) {
  26464. $conflicts = $this->convertLinksToMap($conflicts, 'setConflicts');
  26465. }
  26466. $this->conflicts = $conflicts;
  26467. }
  26468. public function getConflicts(): array
  26469. {
  26470. return $this->conflicts;
  26471. }
  26472. public function setProvides(array $provides): void
  26473. {
  26474. if (isset($provides[0])) {
  26475. $provides = $this->convertLinksToMap($provides, 'setProvides');
  26476. }
  26477. $this->provides = $provides;
  26478. }
  26479. public function getProvides(): array
  26480. {
  26481. return $this->provides;
  26482. }
  26483. public function setReplaces(array $replaces): void
  26484. {
  26485. if (isset($replaces[0])) {
  26486. $replaces = $this->convertLinksToMap($replaces, 'setReplaces');
  26487. }
  26488. $this->replaces = $replaces;
  26489. }
  26490. public function getReplaces(): array
  26491. {
  26492. return $this->replaces;
  26493. }
  26494. public function setDevRequires(array $devRequires): void
  26495. {
  26496. if (isset($devRequires[0])) {
  26497. $devRequires = $this->convertLinksToMap($devRequires, 'setDevRequires');
  26498. }
  26499. $this->devRequires = $devRequires;
  26500. }
  26501. public function getDevRequires(): array
  26502. {
  26503. return $this->devRequires;
  26504. }
  26505. public function setSuggests(array $suggests): void
  26506. {
  26507. $this->suggests = $suggests;
  26508. }
  26509. public function getSuggests(): array
  26510. {
  26511. return $this->suggests;
  26512. }
  26513. public function setAutoload(array $autoload): void
  26514. {
  26515. $this->autoload = $autoload;
  26516. }
  26517. public function getAutoload(): array
  26518. {
  26519. return $this->autoload;
  26520. }
  26521. public function setDevAutoload(array $devAutoload): void
  26522. {
  26523. $this->devAutoload = $devAutoload;
  26524. }
  26525. public function getDevAutoload(): array
  26526. {
  26527. return $this->devAutoload;
  26528. }
  26529. public function setIncludePaths(array $includePaths): void
  26530. {
  26531. $this->includePaths = $includePaths;
  26532. }
  26533. public function getIncludePaths(): array
  26534. {
  26535. return $this->includePaths;
  26536. }
  26537. public function setPhpExt(?array $phpExt): void
  26538. {
  26539. $this->phpExt = $phpExt;
  26540. }
  26541. public function getPhpExt(): ?array
  26542. {
  26543. return $this->phpExt;
  26544. }
  26545. public function setNotificationUrl(string $notificationUrl): void
  26546. {
  26547. $this->notificationUrl = $notificationUrl;
  26548. }
  26549. public function getNotificationUrl(): ?string
  26550. {
  26551. return $this->notificationUrl;
  26552. }
  26553. public function setIsDefaultBranch(bool $defaultBranch): void
  26554. {
  26555. $this->isDefaultBranch = $defaultBranch;
  26556. }
  26557. public function isDefaultBranch(): bool
  26558. {
  26559. return $this->isDefaultBranch;
  26560. }
  26561. public function setSourceDistReferences(string $reference): void
  26562. {
  26563. $this->setSourceReference($reference);
  26564. if (
  26565. $this->getDistUrl() !== null
  26566. && Preg::isMatch('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $this->getDistUrl())
  26567. ) {
  26568. $this->setDistReference($reference);
  26569. $this->setDistUrl(Preg::replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $this->getDistUrl()));
  26570. } elseif ($this->getDistReference()) {
  26571. $this->setDistReference($reference);
  26572. }
  26573. }
  26574. public function replaceVersion(string $version, string $prettyVersion): void
  26575. {
  26576. $this->version = $version;
  26577. $this->prettyVersion = $prettyVersion;
  26578. $this->stability = VersionParser::parseStability($version);
  26579. $this->dev = $this->stability === 'dev';
  26580. }
  26581. protected function getUrls(?string $url, ?array $mirrors, ?string $ref, ?string $type, string $urlType): array
  26582. {
  26583. if (!$url) {
  26584. return [];
  26585. }
  26586. if ($urlType === 'dist' && false !== strpos($url, '%')) {
  26587. $url = ComposerMirror::processUrl($url, $this->name, $this->version, $ref, $type, $this->prettyVersion);
  26588. }
  26589. $urls = [$url];
  26590. if ($mirrors) {
  26591. foreach ($mirrors as $mirror) {
  26592. if ($urlType === 'dist') {
  26593. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type, $this->prettyVersion);
  26594. } elseif ($urlType === 'source' && $type === 'git') {
  26595. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  26596. } elseif ($urlType === 'source' && $type === 'hg') {
  26597. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  26598. } else {
  26599. continue;
  26600. }
  26601. if (!\in_array($mirrorUrl, $urls)) {
  26602. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  26603. $func($urls, $mirrorUrl);
  26604. }
  26605. }
  26606. }
  26607. return $urls;
  26608. }
  26609. private function convertLinksToMap(array $links, string $source): array
  26610. {
  26611. trigger_error('Package::'.$source.' must be called with a map of lowercased package name => Link object, got a indexed array, this is deprecated and you should fix your usage.');
  26612. $newLinks = [];
  26613. foreach ($links as $link) {
  26614. $newLinks[$link->getTarget()] = $link;
  26615. }
  26616. return $newLinks;
  26617. }
  26618. }
  26619. <?php declare(strict_types=1);
  26620. namespace Composer\Package;
  26621. use Composer\Repository\RepositoryInterface;
  26622. interface PackageInterface
  26623. {
  26624. public const DISPLAY_SOURCE_REF_IF_DEV = 0;
  26625. public const DISPLAY_SOURCE_REF = 1;
  26626. public const DISPLAY_DIST_REF = 2;
  26627. public function getName(): string;
  26628. public function getPrettyName(): string;
  26629. public function getNames(bool $provides = true): array;
  26630. public function setId(int $id): void;
  26631. public function getId(): int;
  26632. public function isDev(): bool;
  26633. public function getType(): string;
  26634. public function getTargetDir(): ?string;
  26635. public function getExtra(): array;
  26636. public function setInstallationSource(?string $type): void;
  26637. public function getInstallationSource(): ?string;
  26638. public function getSourceType(): ?string;
  26639. public function getSourceUrl(): ?string;
  26640. public function getSourceUrls(): array;
  26641. public function getSourceReference(): ?string;
  26642. public function getSourceMirrors(): ?array;
  26643. public function setSourceMirrors(?array $mirrors): void;
  26644. public function getDistType(): ?string;
  26645. public function getDistUrl(): ?string;
  26646. public function getDistUrls(): array;
  26647. public function getDistReference(): ?string;
  26648. public function getDistSha1Checksum(): ?string;
  26649. public function getDistMirrors(): ?array;
  26650. public function setDistMirrors(?array $mirrors): void;
  26651. public function getVersion(): string;
  26652. public function getPrettyVersion(): string;
  26653. public function getFullPrettyVersion(bool $truncate = true, int $displayMode = self::DISPLAY_SOURCE_REF_IF_DEV): string;
  26654. public function getReleaseDate(): ?\DateTimeInterface;
  26655. public function getStability(): string;
  26656. public function getRequires(): array;
  26657. public function getConflicts(): array;
  26658. public function getProvides(): array;
  26659. public function getReplaces(): array;
  26660. public function getDevRequires(): array;
  26661. public function getSuggests(): array;
  26662. public function getAutoload(): array;
  26663. public function getDevAutoload(): array;
  26664. public function getIncludePaths(): array;
  26665. public function getPhpExt(): ?array;
  26666. public function setRepository(RepositoryInterface $repository): void;
  26667. public function getRepository(): ?RepositoryInterface;
  26668. public function getBinaries(): array;
  26669. public function getUniqueName(): string;
  26670. public function getNotificationUrl(): ?string;
  26671. public function __toString(): string;
  26672. public function getPrettyString(): string;
  26673. public function isDefaultBranch(): bool;
  26674. public function getTransportOptions(): array;
  26675. public function setTransportOptions(array $options): void;
  26676. public function setSourceReference(?string $reference): void;
  26677. public function setDistUrl(?string $url): void;
  26678. public function setDistType(?string $type): void;
  26679. public function setDistReference(?string $reference): void;
  26680. public function setSourceDistReferences(string $reference): void;
  26681. }
  26682. <?php declare(strict_types=1);
  26683. namespace Composer\Package;
  26684. class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterface
  26685. {
  26686. protected $aliasOf;
  26687. public function __construct(RootPackage $aliasOf, string $version, string $prettyVersion)
  26688. {
  26689. parent::__construct($aliasOf, $version, $prettyVersion);
  26690. }
  26691. public function getAliasOf()
  26692. {
  26693. return $this->aliasOf;
  26694. }
  26695. public function getAliases(): array
  26696. {
  26697. return $this->aliasOf->getAliases();
  26698. }
  26699. public function getMinimumStability(): string
  26700. {
  26701. return $this->aliasOf->getMinimumStability();
  26702. }
  26703. public function getStabilityFlags(): array
  26704. {
  26705. return $this->aliasOf->getStabilityFlags();
  26706. }
  26707. public function getReferences(): array
  26708. {
  26709. return $this->aliasOf->getReferences();
  26710. }
  26711. public function getPreferStable(): bool
  26712. {
  26713. return $this->aliasOf->getPreferStable();
  26714. }
  26715. public function getConfig(): array
  26716. {
  26717. return $this->aliasOf->getConfig();
  26718. }
  26719. public function setRequires(array $requires): void
  26720. {
  26721. $this->requires = $this->replaceSelfVersionDependencies($requires, Link::TYPE_REQUIRE);
  26722. $this->aliasOf->setRequires($requires);
  26723. }
  26724. public function setDevRequires(array $devRequires): void
  26725. {
  26726. $this->devRequires = $this->replaceSelfVersionDependencies($devRequires, Link::TYPE_DEV_REQUIRE);
  26727. $this->aliasOf->setDevRequires($devRequires);
  26728. }
  26729. public function setConflicts(array $conflicts): void
  26730. {
  26731. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT);
  26732. $this->aliasOf->setConflicts($conflicts);
  26733. }
  26734. public function setProvides(array $provides): void
  26735. {
  26736. $this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE);
  26737. $this->aliasOf->setProvides($provides);
  26738. }
  26739. public function setReplaces(array $replaces): void
  26740. {
  26741. $this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE);
  26742. $this->aliasOf->setReplaces($replaces);
  26743. }
  26744. public function setAutoload(array $autoload): void
  26745. {
  26746. $this->aliasOf->setAutoload($autoload);
  26747. }
  26748. public function setDevAutoload(array $devAutoload): void
  26749. {
  26750. $this->aliasOf->setDevAutoload($devAutoload);
  26751. }
  26752. public function setStabilityFlags(array $stabilityFlags): void
  26753. {
  26754. $this->aliasOf->setStabilityFlags($stabilityFlags);
  26755. }
  26756. public function setMinimumStability(string $minimumStability): void
  26757. {
  26758. $this->aliasOf->setMinimumStability($minimumStability);
  26759. }
  26760. public function setPreferStable(bool $preferStable): void
  26761. {
  26762. $this->aliasOf->setPreferStable($preferStable);
  26763. }
  26764. public function setConfig(array $config): void
  26765. {
  26766. $this->aliasOf->setConfig($config);
  26767. }
  26768. public function setReferences(array $references): void
  26769. {
  26770. $this->aliasOf->setReferences($references);
  26771. }
  26772. public function setAliases(array $aliases): void
  26773. {
  26774. $this->aliasOf->setAliases($aliases);
  26775. }
  26776. public function setSuggests(array $suggests): void
  26777. {
  26778. $this->aliasOf->setSuggests($suggests);
  26779. }
  26780. public function setExtra(array $extra): void
  26781. {
  26782. $this->aliasOf->setExtra($extra);
  26783. }
  26784. public function __clone()
  26785. {
  26786. parent::__clone();
  26787. $this->aliasOf = clone $this->aliasOf;
  26788. }
  26789. }
  26790. <?php declare(strict_types=1);
  26791. namespace Composer\Package;
  26792. class RootPackage extends CompletePackage implements RootPackageInterface
  26793. {
  26794. public const DEFAULT_PRETTY_VERSION = '1.0.0+no-version-set';
  26795. protected $minimumStability = 'stable';
  26796. protected $preferStable = false;
  26797. protected $stabilityFlags = [];
  26798. protected $config = [];
  26799. protected $references = [];
  26800. protected $aliases = [];
  26801. public function setMinimumStability(string $minimumStability): void
  26802. {
  26803. $this->minimumStability = $minimumStability;
  26804. }
  26805. public function getMinimumStability(): string
  26806. {
  26807. return $this->minimumStability;
  26808. }
  26809. public function setStabilityFlags(array $stabilityFlags): void
  26810. {
  26811. $this->stabilityFlags = $stabilityFlags;
  26812. }
  26813. public function getStabilityFlags(): array
  26814. {
  26815. return $this->stabilityFlags;
  26816. }
  26817. public function setPreferStable(bool $preferStable): void
  26818. {
  26819. $this->preferStable = $preferStable;
  26820. }
  26821. public function getPreferStable(): bool
  26822. {
  26823. return $this->preferStable;
  26824. }
  26825. public function setConfig(array $config): void
  26826. {
  26827. $this->config = $config;
  26828. }
  26829. public function getConfig(): array
  26830. {
  26831. return $this->config;
  26832. }
  26833. public function setReferences(array $references): void
  26834. {
  26835. $this->references = $references;
  26836. }
  26837. public function getReferences(): array
  26838. {
  26839. return $this->references;
  26840. }
  26841. public function setAliases(array $aliases): void
  26842. {
  26843. $this->aliases = $aliases;
  26844. }
  26845. public function getAliases(): array
  26846. {
  26847. return $this->aliases;
  26848. }
  26849. }
  26850. <?php declare(strict_types=1);
  26851. namespace Composer\Package;
  26852. interface RootPackageInterface extends CompletePackageInterface
  26853. {
  26854. public function getAliases(): array;
  26855. public function getMinimumStability(): string;
  26856. public function getStabilityFlags(): array;
  26857. public function getReferences(): array;
  26858. public function getPreferStable(): bool;
  26859. public function getConfig(): array;
  26860. public function setRequires(array $requires): void;
  26861. public function setDevRequires(array $devRequires): void;
  26862. public function setConflicts(array $conflicts): void;
  26863. public function setProvides(array $provides): void;
  26864. public function setReplaces(array $replaces): void;
  26865. public function setAutoload(array $autoload): void;
  26866. public function setDevAutoload(array $devAutoload): void;
  26867. public function setStabilityFlags(array $stabilityFlags): void;
  26868. public function setMinimumStability(string $minimumStability): void;
  26869. public function setPreferStable(bool $preferStable): void;
  26870. public function setConfig(array $config): void;
  26871. public function setReferences(array $references): void;
  26872. public function setAliases(array $aliases): void;
  26873. public function setSuggests(array $suggests): void;
  26874. public function setExtra(array $extra): void;
  26875. }
  26876. <?php declare(strict_types=1);
  26877. namespace Composer\Package\Version;
  26878. use Composer\Package\BasePackage;
  26879. class StabilityFilter
  26880. {
  26881. public static function isPackageAcceptable(array $acceptableStabilities, array $stabilityFlags, array $names, string $stability): bool
  26882. {
  26883. foreach ($names as $name) {
  26884. if (isset($stabilityFlags[$name])) {
  26885. if (BasePackage::STABILITIES[$stability] <= $stabilityFlags[$name]) {
  26886. return true;
  26887. }
  26888. } elseif (isset($acceptableStabilities[$stability])) {
  26889. return true;
  26890. }
  26891. }
  26892. return false;
  26893. }
  26894. }
  26895. <?php declare(strict_types=1);
  26896. namespace Composer\Package\Version;
  26897. use Composer\Package\PackageInterface;
  26898. use Composer\Package\Loader\ArrayLoader;
  26899. use Composer\Package\Dumper\ArrayDumper;
  26900. use Composer\Pcre\Preg;
  26901. use Composer\Semver\Constraint\Constraint;
  26902. use Composer\Semver\Constraint\ConstraintInterface;
  26903. use Composer\Semver\Intervals;
  26904. use Composer\Util\Platform;
  26905. class VersionBumper
  26906. {
  26907. public function bumpRequirement(ConstraintInterface $constraint, PackageInterface $package): string
  26908. {
  26909. $parser = new VersionParser();
  26910. $prettyConstraint = $constraint->getPrettyString();
  26911. if (str_starts_with($constraint->getPrettyString(), 'dev-')) {
  26912. return $prettyConstraint;
  26913. }
  26914. $version = $package->getVersion();
  26915. if (str_starts_with($package->getVersion(), 'dev-')) {
  26916. $loader = new ArrayLoader($parser);
  26917. $dumper = new ArrayDumper();
  26918. $extra = $loader->getBranchAlias($dumper->dump($package));
  26919. if (null === $extra || $extra === VersionParser::DEFAULT_BRANCH_ALIAS) {
  26920. return $prettyConstraint;
  26921. }
  26922. $version = $extra;
  26923. }
  26924. $intervals = Intervals::get($constraint);
  26925. if (\count($intervals['branches']['names']) > 0) {
  26926. return $prettyConstraint;
  26927. }
  26928. $major = Preg::replace('{^(\d+).*}', '$1', $version);
  26929. $versionWithoutSuffix = Preg::replace('{(?:\.(?:0|9999999))+(-dev)?$}', '', $version);
  26930. $newPrettyConstraint = '^'.$versionWithoutSuffix;
  26931. if (!Preg::isMatch('{^\^\d+(\.\d+)*$}', $newPrettyConstraint)) {
  26932. return $prettyConstraint;
  26933. }
  26934. $pattern = '{
  26935. (?<=,|\ |\||^) # leading separator
  26936. (?P<constraint>
  26937. \^v?'.$major.'(?:\.\d+)* # e.g. ^2.anything
  26938. | ~v?'.$major.'(?:\.\d+){1,3} # e.g. ~2.2 or ~2.2.2 or ~2.2.2.2
  26939. | v?'.$major.'(?:\.[*x])+ # e.g. 2.* or 2.*.* or 2.x.x.x etc
  26940. | >=v?\d(?:\.\d+)* # e.g. >=2 or >=1.2 etc
  26941. | \* # full wildcard
  26942. )
  26943. (?=,|$|\ |\||@) # trailing separator
  26944. }x';
  26945. if (Preg::isMatchAllWithOffsets($pattern, $prettyConstraint, $matches)) {
  26946. $modified = $prettyConstraint;
  26947. foreach (array_reverse($matches['constraint']) as $match) {
  26948. assert(is_string($match[0]));
  26949. $suffix = '';
  26950. if (substr_count($match[0], '.') === 2 && substr_count($versionWithoutSuffix, '.') === 1) {
  26951. $suffix = '.0';
  26952. }
  26953. if (str_starts_with($match[0], '~') && substr_count($match[0], '.') !== 1) {
  26954. $versionBits = explode('.', $versionWithoutSuffix);
  26955. $versionBits = array_pad($versionBits, substr_count($match[0], '.') + 1, '0');
  26956. $replacement = '~'.implode('.', array_slice($versionBits, 0, substr_count($match[0], '.') + 1));
  26957. } elseif ($match[0] === '*' || str_starts_with($match[0], '>=')) {
  26958. $replacement = '>='.$versionWithoutSuffix.$suffix;
  26959. } else {
  26960. $replacement = $newPrettyConstraint.$suffix;
  26961. }
  26962. $modified = substr_replace($modified, $replacement, $match[1], Platform::strlen($match[0]));
  26963. }
  26964. $newConstraint = $parser->parseConstraints($modified);
  26965. if (Intervals::isSubsetOf($newConstraint, $constraint) && Intervals::isSubsetOf($constraint, $newConstraint)) {
  26966. return $prettyConstraint;
  26967. }
  26968. return $modified;
  26969. }
  26970. return $prettyConstraint;
  26971. }
  26972. }
  26973. <?php declare(strict_types=1);
  26974. namespace Composer\Package\Version;
  26975. use Composer\Config;
  26976. use Composer\IO\IOInterface;
  26977. use Composer\Pcre\Preg;
  26978. use Composer\Repository\Vcs\HgDriver;
  26979. use Composer\IO\NullIO;
  26980. use Composer\Semver\VersionParser as SemverVersionParser;
  26981. use Composer\Util\Git as GitUtil;
  26982. use Composer\Util\HttpDownloader;
  26983. use Composer\Util\Platform;
  26984. use Composer\Util\ProcessExecutor;
  26985. use Composer\Util\Svn as SvnUtil;
  26986. use React\Promise\CancellablePromiseInterface;
  26987. use Symfony\Component\Process\Process;
  26988. class VersionGuesser
  26989. {
  26990. private $config;
  26991. private $process;
  26992. private $versionParser;
  26993. private $io;
  26994. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser, ?IOInterface $io = null)
  26995. {
  26996. $this->config = $config;
  26997. $this->process = $process;
  26998. $this->versionParser = $versionParser;
  26999. $this->io = $io;
  27000. }
  27001. public function guessVersion(array $packageConfig, string $path): ?array
  27002. {
  27003. if (!function_exists('proc_open')) {
  27004. return null;
  27005. }
  27006. if (Platform::isInputCompletionProcess()) {
  27007. return null;
  27008. }
  27009. $versionData = $this->guessGitVersion($packageConfig, $path);
  27010. if (null !== $versionData['version']) {
  27011. return $this->postprocess($versionData);
  27012. }
  27013. $versionData = $this->guessHgVersion($packageConfig, $path);
  27014. if (null !== $versionData && null !== $versionData['version']) {
  27015. return $this->postprocess($versionData);
  27016. }
  27017. $versionData = $this->guessFossilVersion($path);
  27018. if (null !== $versionData['version']) {
  27019. return $this->postprocess($versionData);
  27020. }
  27021. $versionData = $this->guessSvnVersion($packageConfig, $path);
  27022. if (null !== $versionData && null !== $versionData['version']) {
  27023. return $this->postprocess($versionData);
  27024. }
  27025. return null;
  27026. }
  27027. private function postprocess(array $versionData): array
  27028. {
  27029. if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version']) {
  27030. unset($versionData['feature_version'], $versionData['feature_pretty_version']);
  27031. }
  27032. if ('-dev' === substr($versionData['version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['version'])) {
  27033. $versionData['pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['version']);
  27034. }
  27035. if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && Preg::isMatch('{\.9{7}}', $versionData['feature_version'])) {
  27036. $versionData['feature_pretty_version'] = Preg::replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
  27037. }
  27038. return $versionData;
  27039. }
  27040. private function guessGitVersion(array $packageConfig, string $path): array
  27041. {
  27042. GitUtil::cleanEnv();
  27043. $commit = null;
  27044. $version = null;
  27045. $prettyVersion = null;
  27046. $featureVersion = null;
  27047. $featurePrettyVersion = null;
  27048. $isDetached = false;
  27049. if (0 === $this->process->execute(['git', 'branch', '-a', '--no-color', '--no-abbrev', '-v'], $output, $path)) {
  27050. $branches = [];
  27051. $isFeatureBranch = false;
  27052. foreach ($this->process->splitLines($output) as $branch) {
  27053. if ($branch && Preg::isMatchStrictGroups('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  27054. if (
  27055. $match[1] === '(no branch)'
  27056. || strpos($match[1], '(detached ') === 0
  27057. || strpos($match[1], '(HEAD detached at') === 0
  27058. ) {
  27059. $version = 'dev-' . $match[2];
  27060. $prettyVersion = $version;
  27061. $isFeatureBranch = true;
  27062. $isDetached = true;
  27063. } else {
  27064. $version = $this->versionParser->normalizeBranch($match[1]);
  27065. $prettyVersion = 'dev-' . $match[1];
  27066. $isFeatureBranch = $this->isFeatureBranch($packageConfig, $match[1]);
  27067. }
  27068. $commit = $match[2];
  27069. }
  27070. if ($branch && !Preg::isMatchStrictGroups('{^ *.+/HEAD }', $branch)) {
  27071. if (Preg::isMatchStrictGroups('{^(?:\* )? *((?:remotes/(?:origin|upstream)/)?[^\s/]+) *([a-f0-9]+) .*$}', $branch, $match)) {
  27072. $branches[] = $match[1];
  27073. }
  27074. }
  27075. }
  27076. if ($isFeatureBranch) {
  27077. $featureVersion = $version;
  27078. $featurePrettyVersion = $prettyVersion;
  27079. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, ['git', 'rev-list', '%candidate%..%branch%'], $path);
  27080. $version = $result['version'];
  27081. $prettyVersion = $result['pretty_version'];
  27082. }
  27083. }
  27084. GitUtil::checkForRepoOwnershipError($this->process->getErrorOutput(), $path, $this->io);
  27085. if (!$version || $isDetached) {
  27086. $result = $this->versionFromGitTags($path);
  27087. if ($result) {
  27088. $version = $result['version'];
  27089. $prettyVersion = $result['pretty_version'];
  27090. $featureVersion = null;
  27091. $featurePrettyVersion = null;
  27092. }
  27093. }
  27094. if (null === $commit) {
  27095. $command = array_merge(['git', 'log', '--pretty=%H', '-n1', 'HEAD'], GitUtil::getNoShowSignatureFlags($this->process));
  27096. if (0 === $this->process->execute($command, $output, $path)) {
  27097. $commit = trim($output) ?: null;
  27098. }
  27099. }
  27100. if ($featureVersion) {
  27101. return ['version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion];
  27102. }
  27103. return ['version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion];
  27104. }
  27105. private function versionFromGitTags(string $path): ?array
  27106. {
  27107. if (0 === $this->process->execute(['git', 'describe', '--exact-match', '--tags'], $output, $path)) {
  27108. try {
  27109. $version = $this->versionParser->normalize(trim($output));
  27110. return ['version' => $version, 'pretty_version' => trim($output)];
  27111. } catch (\Exception $e) {
  27112. }
  27113. }
  27114. return null;
  27115. }
  27116. private function guessHgVersion(array $packageConfig, string $path): ?array
  27117. {
  27118. if (0 === $this->process->execute(['hg', 'branch'], $output, $path)) {
  27119. $branch = trim($output);
  27120. $version = $this->versionParser->normalizeBranch($branch);
  27121. $isFeatureBranch = 0 === strpos($version, 'dev-');
  27122. if (VersionParser::DEFAULT_BRANCH_ALIAS === $version) {
  27123. return ['version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch];
  27124. }
  27125. if (!$isFeatureBranch) {
  27126. return ['version' => $version, 'commit' => null, 'pretty_version' => $version];
  27127. }
  27128. $io = new NullIO();
  27129. $driver = new HgDriver(['url' => $path], $io, $this->config, new HttpDownloader($io, $this->config), $this->process);
  27130. $branches = array_map('strval', array_keys($driver->getBranches()));
  27131. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, ['hg', 'log', '-r', 'not ancestors(\'%candidate%\') and ancestors(\'%branch%\')', '--template', '"{node}\\n"'], $path);
  27132. $result['commit'] = '';
  27133. $result['feature_version'] = $version;
  27134. $result['feature_pretty_version'] = $version;
  27135. return $result;
  27136. }
  27137. return null;
  27138. }
  27139. private function guessFeatureVersion(array $packageConfig, ?string $version, array $branches, array $scmCmdline, string $path): array
  27140. {
  27141. $prettyVersion = $version;
  27142. if (!isset($packageConfig['extra']['branch-alias'][$version])
  27143. || strpos(json_encode($packageConfig), '"self.version"')
  27144. ) {
  27145. $branch = Preg::replace('{^dev-}', '', $version);
  27146. $length = PHP_INT_MAX;
  27147. if (!$this->isFeatureBranch($packageConfig, $branch)) {
  27148. return ['version' => $version, 'pretty_version' => $prettyVersion];
  27149. }
  27150. usort($branches, static function ($a, $b): int {
  27151. $aRemote = 0 === strpos($a, 'remotes/');
  27152. $bRemote = 0 === strpos($b, 'remotes/');
  27153. if ($aRemote !== $bRemote) {
  27154. return $aRemote ? 1 : -1;
  27155. }
  27156. return strnatcasecmp($b, $a);
  27157. });
  27158. $promises = [];
  27159. $this->process->setMaxJobs(30);
  27160. try {
  27161. $lastIndex = -1;
  27162. foreach ($branches as $index => $candidate) {
  27163. $candidateVersion = Preg::replace('{^remotes/\S+/}', '', $candidate);
  27164. if ($candidate === $branch || $this->isFeatureBranch($packageConfig, $candidateVersion)) {
  27165. continue;
  27166. }
  27167. $cmdLine = array_map(static function (string $component) use ($candidate, $branch) {
  27168. return str_replace(['%candidate%', '%branch%'], [$candidate, $branch], $component);
  27169. }, $scmCmdline);
  27170. $promises[] = $this->process->executeAsync($cmdLine, $path)->then(function (Process $process) use (&$lastIndex, $index, &$length, &$version, &$prettyVersion, $candidateVersion, &$promises): void {
  27171. if (!$process->isSuccessful()) {
  27172. return;
  27173. }
  27174. $output = $process->getOutput();
  27175. if (strlen($output) < $length || (strlen($output) === $length && $lastIndex < $index)) {
  27176. $lastIndex = $index;
  27177. $length = strlen($output);
  27178. $version = $this->versionParser->normalizeBranch($candidateVersion);
  27179. $prettyVersion = 'dev-' . $candidateVersion;
  27180. if ($length === 0) {
  27181. foreach ($promises as $promise) {
  27182. \React\Promise\resolve($promise)->cancel();
  27183. }
  27184. }
  27185. }
  27186. });
  27187. }
  27188. $this->process->wait();
  27189. } finally {
  27190. $this->process->resetMaxJobs();
  27191. }
  27192. }
  27193. return ['version' => $version, 'pretty_version' => $prettyVersion];
  27194. }
  27195. private function isFeatureBranch(array $packageConfig, ?string $branchName): bool
  27196. {
  27197. $nonFeatureBranches = '';
  27198. if (!empty($packageConfig['non-feature-branches'])) {
  27199. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  27200. }
  27201. return !Preg::isMatch('{^(' . $nonFeatureBranches . '|master|main|latest|next|current|support|tip|trunk|default|develop|\d+\..+)$}', $branchName, $match);
  27202. }
  27203. private function guessFossilVersion(string $path): array
  27204. {
  27205. $version = null;
  27206. $prettyVersion = null;
  27207. if (0 === $this->process->execute(['fossil', 'branch', 'list'], $output, $path)) {
  27208. $branch = trim($output);
  27209. $version = $this->versionParser->normalizeBranch($branch);
  27210. $prettyVersion = 'dev-' . $branch;
  27211. }
  27212. if (0 === $this->process->execute(['fossil', 'tag', 'list'], $output, $path)) {
  27213. try {
  27214. $version = $this->versionParser->normalize(trim($output));
  27215. $prettyVersion = trim($output);
  27216. } catch (\Exception $e) {
  27217. }
  27218. }
  27219. return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
  27220. }
  27221. private function guessSvnVersion(array $packageConfig, string $path): ?array
  27222. {
  27223. SvnUtil::cleanEnv();
  27224. if (0 === $this->process->execute(['svn', 'info', '--xml'], $output, $path)) {
  27225. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  27226. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  27227. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  27228. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  27229. if (Preg::isMatch($urlPattern, $output, $matches)) {
  27230. if (isset($matches[2], $matches[3]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  27231. $version = $this->versionParser->normalizeBranch($matches[3]);
  27232. $prettyVersion = 'dev-' . $matches[3];
  27233. return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
  27234. }
  27235. assert(is_string($matches[1]));
  27236. $prettyVersion = trim($matches[1]);
  27237. if ($prettyVersion === 'trunk') {
  27238. $version = 'dev-trunk';
  27239. } else {
  27240. $version = $this->versionParser->normalize($prettyVersion);
  27241. }
  27242. return ['version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion];
  27243. }
  27244. }
  27245. return null;
  27246. }
  27247. public function getRootVersionFromEnv(): string
  27248. {
  27249. $version = Platform::getEnv('COMPOSER_ROOT_VERSION');
  27250. if (!is_string($version) || $version === '') {
  27251. throw new \RuntimeException('COMPOSER_ROOT_VERSION not set or empty');
  27252. }
  27253. if (Preg::isMatch('{^(\d+(?:\.\d+)*)-dev$}i', $version, $match)) {
  27254. $version = $match[1].'.x-dev';
  27255. }
  27256. return $version;
  27257. }
  27258. }
  27259. <?php declare(strict_types=1);
  27260. namespace Composer\Package\Version;
  27261. use Composer\Pcre\Preg;
  27262. use Composer\Repository\PlatformRepository;
  27263. use Composer\Semver\VersionParser as SemverVersionParser;
  27264. use Composer\Semver\Semver;
  27265. use Composer\Semver\Constraint\ConstraintInterface;
  27266. class VersionParser extends SemverVersionParser
  27267. {
  27268. public const DEFAULT_BRANCH_ALIAS = '9999999-dev';
  27269. private static $constraints = [];
  27270. public function parseConstraints($constraints): ConstraintInterface
  27271. {
  27272. if (!isset(self::$constraints[$constraints])) {
  27273. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  27274. }
  27275. return self::$constraints[$constraints];
  27276. }
  27277. public function parseNameVersionPairs(array $pairs): array
  27278. {
  27279. $pairs = array_values($pairs);
  27280. $result = [];
  27281. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  27282. $pair = Preg::replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  27283. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !Preg::isMatch('{(?<=[a-z0-9_/-])\*|\*(?=[a-z0-9_/-])}i', $pairs[$i + 1]) && !PlatformRepository::isPlatformPackage($pairs[$i + 1])) {
  27284. $pair .= ' '.$pairs[$i + 1];
  27285. $i++;
  27286. }
  27287. if (strpos($pair, ' ')) {
  27288. [$name, $version] = explode(' ', $pair, 2);
  27289. $result[] = ['name' => $name, 'version' => $version];
  27290. } else {
  27291. $result[] = ['name' => $pair];
  27292. }
  27293. }
  27294. return $result;
  27295. }
  27296. public static function isUpgrade(string $normalizedFrom, string $normalizedTo): bool
  27297. {
  27298. if ($normalizedFrom === $normalizedTo) {
  27299. return true;
  27300. }
  27301. if (in_array($normalizedFrom, ['dev-master', 'dev-trunk', 'dev-default'], true)) {
  27302. $normalizedFrom = VersionParser::DEFAULT_BRANCH_ALIAS;
  27303. }
  27304. if (in_array($normalizedTo, ['dev-master', 'dev-trunk', 'dev-default'], true)) {
  27305. $normalizedTo = VersionParser::DEFAULT_BRANCH_ALIAS;
  27306. }
  27307. if (strpos($normalizedFrom, 'dev-') === 0 || strpos($normalizedTo, 'dev-') === 0) {
  27308. return true;
  27309. }
  27310. $sorted = Semver::sort([$normalizedTo, $normalizedFrom]);
  27311. return $sorted[0] === $normalizedFrom;
  27312. }
  27313. }
  27314. <?php declare(strict_types=1);
  27315. namespace Composer\Package\Version;
  27316. use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
  27317. use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;
  27318. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
  27319. use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
  27320. use Composer\IO\IOInterface;
  27321. use Composer\Package\BasePackage;
  27322. use Composer\Package\AliasPackage;
  27323. use Composer\Package\PackageInterface;
  27324. use Composer\Composer;
  27325. use Composer\Package\Loader\ArrayLoader;
  27326. use Composer\Package\Dumper\ArrayDumper;
  27327. use Composer\Pcre\Preg;
  27328. use Composer\Repository\RepositorySet;
  27329. use Composer\Repository\PlatformRepository;
  27330. use Composer\Semver\Constraint\Constraint;
  27331. use Composer\Semver\Constraint\ConstraintInterface;
  27332. class VersionSelector
  27333. {
  27334. private $repositorySet;
  27335. private $platformConstraints = [];
  27336. private $parser;
  27337. public function __construct(RepositorySet $repositorySet, ?PlatformRepository $platformRepo = null)
  27338. {
  27339. $this->repositorySet = $repositorySet;
  27340. if ($platformRepo) {
  27341. foreach ($platformRepo->getPackages() as $package) {
  27342. $this->platformConstraints[$package->getName()][] = new Constraint('==', $package->getVersion());
  27343. }
  27344. }
  27345. }
  27346. public function findBestCandidate(string $packageName, ?string $targetPackageVersion = null, string $preferredStability = 'stable', $platformRequirementFilter = null, int $repoSetFlags = 0, ?IOInterface $io = null, $showWarnings = true)
  27347. {
  27348. if (!isset(BasePackage::STABILITIES[$preferredStability])) {
  27349. throw new \UnexpectedValueException('Expected a valid stability name as 3rd argument, got '.$preferredStability);
  27350. }
  27351. if (null === $platformRequirementFilter) {
  27352. $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing();
  27353. } elseif (!($platformRequirementFilter instanceof PlatformRequirementFilterInterface)) {
  27354. trigger_error('VersionSelector::findBestCandidate with ignored platform reqs as bool|array is deprecated since Composer 2.2, use an instance of PlatformRequirementFilterInterface instead.', E_USER_DEPRECATED);
  27355. $platformRequirementFilter = PlatformRequirementFilterFactory::fromBoolOrList($platformRequirementFilter);
  27356. }
  27357. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  27358. $candidates = $this->repositorySet->findPackages(strtolower($packageName), $constraint, $repoSetFlags);
  27359. $minPriority = BasePackage::STABILITIES[$preferredStability];
  27360. usort($candidates, static function (PackageInterface $a, PackageInterface $b) use ($minPriority) {
  27361. $aPriority = $a->getStabilityPriority();
  27362. $bPriority = $b->getStabilityPriority();
  27363. if ($minPriority < $aPriority && $bPriority < $aPriority) {
  27364. return 1;
  27365. }
  27366. if ($minPriority < $aPriority && $aPriority < $bPriority) {
  27367. return -1;
  27368. }
  27369. if ($minPriority >= $aPriority && $minPriority < $bPriority) {
  27370. return -1;
  27371. }
  27372. return version_compare($b->getVersion(), $a->getVersion());
  27373. });
  27374. if (count($this->platformConstraints) > 0 && !($platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter)) {
  27375. $alreadyWarnedNames = [];
  27376. $alreadySeenNames = [];
  27377. foreach ($candidates as $pkg) {
  27378. $reqs = $pkg->getRequires();
  27379. $skip = false;
  27380. foreach ($reqs as $name => $link) {
  27381. if (!PlatformRepository::isPlatformPackage($name) || $platformRequirementFilter->isIgnored($name)) {
  27382. continue;
  27383. }
  27384. if (isset($this->platformConstraints[$name])) {
  27385. foreach ($this->platformConstraints[$name] as $providedConstraint) {
  27386. if ($link->getConstraint()->matches($providedConstraint)) {
  27387. continue 2;
  27388. }
  27389. if ($platformRequirementFilter instanceof IgnoreListPlatformRequirementFilter && $platformRequirementFilter->isUpperBoundIgnored($name)) {
  27390. $filteredConstraint = $platformRequirementFilter->filterConstraint($name, $link->getConstraint());
  27391. if ($filteredConstraint->matches($providedConstraint)) {
  27392. continue 2;
  27393. }
  27394. }
  27395. }
  27396. $reason = 'is not satisfied by your platform';
  27397. } else {
  27398. $reason = 'is missing from your platform';
  27399. }
  27400. $isLatestVersion = !isset($alreadySeenNames[$pkg->getName()]);
  27401. $alreadySeenNames[$pkg->getName()] = true;
  27402. if ($io !== null && ($showWarnings === true || (is_callable($showWarnings) && $showWarnings($pkg)))) {
  27403. $isFirstWarning = !isset($alreadyWarnedNames[$pkg->getName().'/'.$link->getTarget()]);
  27404. $alreadyWarnedNames[$pkg->getName().'/'.$link->getTarget()] = true;
  27405. $latest = $isLatestVersion ? "'s latest version" : '';
  27406. $io->writeError(
  27407. '<warning>Cannot use '.$pkg->getPrettyName().$latest.' '.$pkg->getPrettyVersion().' as it '.$link->getDescription().' '.$link->getTarget().' '.$link->getPrettyConstraint().' which '.$reason.'.</>',
  27408. true,
  27409. $isFirstWarning ? IOInterface::NORMAL : IOInterface::VERBOSE
  27410. );
  27411. }
  27412. $skip = true;
  27413. }
  27414. if ($skip) {
  27415. continue;
  27416. }
  27417. $package = $pkg;
  27418. break;
  27419. }
  27420. } else {
  27421. $package = count($candidates) > 0 ? $candidates[0] : null;
  27422. }
  27423. if (!isset($package)) {
  27424. return false;
  27425. }
  27426. if ($package instanceof AliasPackage && $package->getVersion() === VersionParser::DEFAULT_BRANCH_ALIAS) {
  27427. $package = $package->getAliasOf();
  27428. }
  27429. return $package;
  27430. }
  27431. public function findRecommendedRequireVersion(PackageInterface $package): string
  27432. {
  27433. if (0 === strpos($package->getName(), 'ext-')) {
  27434. $phpVersion = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  27435. $extVersion = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
  27436. if ($phpVersion === $extVersion) {
  27437. return '*';
  27438. }
  27439. }
  27440. $version = $package->getVersion();
  27441. if (!$package->isDev()) {
  27442. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  27443. }
  27444. $loader = new ArrayLoader($this->getParser());
  27445. $dumper = new ArrayDumper();
  27446. $extra = $loader->getBranchAlias($dumper->dump($package));
  27447. if ($extra && $extra !== VersionParser::DEFAULT_BRANCH_ALIAS) {
  27448. $extra = Preg::replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  27449. if ($count > 0) {
  27450. $extra = str_replace('.9999999', '.0', $extra);
  27451. return $this->transformVersion($extra, $extra, 'dev');
  27452. }
  27453. }
  27454. return $package->getPrettyVersion();
  27455. }
  27456. private function transformVersion(string $version, string $prettyVersion, string $stability): string
  27457. {
  27458. $semanticVersionParts = explode('.', $version);
  27459. if (count($semanticVersionParts) === 4 && Preg::isMatch('{^\d+\D?}', $semanticVersionParts[3])) {
  27460. if ($semanticVersionParts[0] === '0') {
  27461. unset($semanticVersionParts[3]);
  27462. } else {
  27463. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  27464. }
  27465. $version = implode('.', $semanticVersionParts);
  27466. } else {
  27467. return $prettyVersion;
  27468. }
  27469. if ($stability !== 'stable') {
  27470. $version .= '@'.$stability;
  27471. }
  27472. return '^' . $version;
  27473. }
  27474. private function getParser(): VersionParser
  27475. {
  27476. if ($this->parser === null) {
  27477. $this->parser = new VersionParser();
  27478. }
  27479. return $this->parser;
  27480. }
  27481. }
  27482. <?php declare(strict_types=1);
  27483. namespace Composer;
  27484. use Composer\Package\RootPackageInterface;
  27485. use Composer\Util\Loop;
  27486. use Composer\Repository\RepositoryManager;
  27487. use Composer\Installer\InstallationManager;
  27488. use Composer\EventDispatcher\EventDispatcher;
  27489. class PartialComposer
  27490. {
  27491. private $package;
  27492. private $loop;
  27493. private $repositoryManager;
  27494. private $installationManager;
  27495. private $config;
  27496. private $eventDispatcher;
  27497. public function setPackage(RootPackageInterface $package): void
  27498. {
  27499. $this->package = $package;
  27500. }
  27501. public function getPackage(): RootPackageInterface
  27502. {
  27503. return $this->package;
  27504. }
  27505. public function setConfig(Config $config): void
  27506. {
  27507. $this->config = $config;
  27508. }
  27509. public function getConfig(): Config
  27510. {
  27511. return $this->config;
  27512. }
  27513. public function setLoop(Loop $loop): void
  27514. {
  27515. $this->loop = $loop;
  27516. }
  27517. public function getLoop(): Loop
  27518. {
  27519. return $this->loop;
  27520. }
  27521. public function setRepositoryManager(RepositoryManager $manager): void
  27522. {
  27523. $this->repositoryManager = $manager;
  27524. }
  27525. public function getRepositoryManager(): RepositoryManager
  27526. {
  27527. return $this->repositoryManager;
  27528. }
  27529. public function setInstallationManager(InstallationManager $manager): void
  27530. {
  27531. $this->installationManager = $manager;
  27532. }
  27533. public function getInstallationManager(): InstallationManager
  27534. {
  27535. return $this->installationManager;
  27536. }
  27537. public function setEventDispatcher(EventDispatcher $eventDispatcher): void
  27538. {
  27539. $this->eventDispatcher = $eventDispatcher;
  27540. }
  27541. public function getEventDispatcher(): EventDispatcher
  27542. {
  27543. return $this->eventDispatcher;
  27544. }
  27545. }
  27546. <?php declare(strict_types=1);
  27547. namespace Composer\Platform;
  27548. use Composer\Util\Platform;
  27549. use Composer\Util\ProcessExecutor;
  27550. use Symfony\Component\Process\ExecutableFinder;
  27551. class HhvmDetector
  27552. {
  27553. private static $hhvmVersion = null;
  27554. private $executableFinder;
  27555. private $processExecutor;
  27556. public function __construct(?ExecutableFinder $executableFinder = null, ?ProcessExecutor $processExecutor = null)
  27557. {
  27558. $this->executableFinder = $executableFinder;
  27559. $this->processExecutor = $processExecutor;
  27560. }
  27561. public function reset(): void
  27562. {
  27563. self::$hhvmVersion = null;
  27564. }
  27565. public function getVersion(): ?string
  27566. {
  27567. if (null !== self::$hhvmVersion) {
  27568. return self::$hhvmVersion ?: null;
  27569. }
  27570. self::$hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  27571. if (self::$hhvmVersion === null && !Platform::isWindows()) {
  27572. self::$hhvmVersion = false;
  27573. $this->executableFinder = $this->executableFinder ?: new ExecutableFinder();
  27574. $hhvmPath = $this->executableFinder->find('hhvm');
  27575. if ($hhvmPath !== null) {
  27576. $this->processExecutor = $this->processExecutor ?? new ProcessExecutor();
  27577. $exitCode = $this->processExecutor->execute([$hhvmPath, '--php', '-d', 'hhvm.jit=0', '-r', 'echo HHVM_VERSION;'], self::$hhvmVersion);
  27578. if ($exitCode !== 0) {
  27579. self::$hhvmVersion = false;
  27580. }
  27581. }
  27582. }
  27583. return self::$hhvmVersion ?: null;
  27584. }
  27585. }
  27586. <?php declare(strict_types=1);
  27587. namespace Composer\Platform;
  27588. class Runtime
  27589. {
  27590. public function hasConstant(string $constant, ?string $class = null): bool
  27591. {
  27592. return defined(ltrim($class.'::'.$constant, ':'));
  27593. }
  27594. public function getConstant(string $constant, ?string $class = null)
  27595. {
  27596. return constant(ltrim($class.'::'.$constant, ':'));
  27597. }
  27598. public function hasFunction(string $fn): bool
  27599. {
  27600. return function_exists($fn);
  27601. }
  27602. public function invoke(callable $callable, array $arguments = [])
  27603. {
  27604. return $callable(...$arguments);
  27605. }
  27606. public function hasClass(string $class): bool
  27607. {
  27608. return class_exists($class, false);
  27609. }
  27610. public function construct(string $class, array $arguments = []): object
  27611. {
  27612. if (empty($arguments)) {
  27613. return new $class;
  27614. }
  27615. $refl = new \ReflectionClass($class);
  27616. return $refl->newInstanceArgs($arguments);
  27617. }
  27618. public function getExtensions(): array
  27619. {
  27620. return get_loaded_extensions();
  27621. }
  27622. public function getExtensionVersion(string $extension): string
  27623. {
  27624. $version = phpversion($extension);
  27625. if ($version === false) {
  27626. $version = '0';
  27627. }
  27628. return $version;
  27629. }
  27630. public function getExtensionInfo(string $extension): string
  27631. {
  27632. $reflector = new \ReflectionExtension($extension);
  27633. ob_start();
  27634. $reflector->info();
  27635. return ob_get_clean();
  27636. }
  27637. }
  27638. <?php declare(strict_types=1);
  27639. namespace Composer\Platform;
  27640. use Composer\Pcre\Preg;
  27641. class Version
  27642. {
  27643. public static function parseOpenssl(string $opensslVersion, ?bool &$isFips): ?string
  27644. {
  27645. $isFips = false;
  27646. if (!Preg::isMatchStrictGroups('/^(?<version>[0-9.]+)(?<patch>[a-z]{0,2})(?<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)(?:-\w+)?(?: \(.+?\))?$/', $opensslVersion, $matches)) {
  27647. return null;
  27648. }
  27649. $patch = '';
  27650. if (version_compare($matches['version'], '3.0.0', '<')) {
  27651. $patch = '.'.self::convertAlphaVersionToIntVersion($matches['patch']);
  27652. }
  27653. $isFips = strpos($matches['suffix'], 'fips') !== false;
  27654. $suffix = strtr('-'.ltrim($matches['suffix'], '-'), ['-fips' => '', '-pre' => '-alpha']);
  27655. return rtrim($matches['version'].$patch.$suffix, '-');
  27656. }
  27657. public static function parseLibjpeg(string $libjpegVersion): ?string
  27658. {
  27659. if (!Preg::isMatchStrictGroups('/^(?<major>\d+)(?<minor>[a-z]*)$/', $libjpegVersion, $matches)) {
  27660. return null;
  27661. }
  27662. return $matches['major'].'.'.self::convertAlphaVersionToIntVersion($matches['minor']);
  27663. }
  27664. public static function parseZoneinfoVersion(string $zoneinfoVersion): ?string
  27665. {
  27666. if (!Preg::isMatchStrictGroups('/^(?<year>\d{4})(?<revision>[a-z]*)$/', $zoneinfoVersion, $matches)) {
  27667. return null;
  27668. }
  27669. return $matches['year'].'.'.self::convertAlphaVersionToIntVersion($matches['revision']);
  27670. }
  27671. private static function convertAlphaVersionToIntVersion(string $alpha): int
  27672. {
  27673. return strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord', str_split($alpha)));
  27674. }
  27675. public static function convertLibxpmVersionId(int $versionId): string
  27676. {
  27677. return self::convertVersionId($versionId, 100);
  27678. }
  27679. public static function convertOpenldapVersionId(int $versionId): string
  27680. {
  27681. return self::convertVersionId($versionId, 100);
  27682. }
  27683. private static function convertVersionId(int $versionId, int $base): string
  27684. {
  27685. return sprintf(
  27686. '%d.%d.%d',
  27687. $versionId / ($base * $base),
  27688. (int) ($versionId / $base) % $base,
  27689. $versionId % $base
  27690. );
  27691. }
  27692. }
  27693. <?php declare(strict_types=1);
  27694. namespace Composer\Plugin\Capability;
  27695. interface Capability
  27696. {
  27697. }
  27698. <?php declare(strict_types=1);
  27699. namespace Composer\Plugin\Capability;
  27700. interface CommandProvider extends Capability
  27701. {
  27702. public function getCommands();
  27703. }
  27704. <?php declare(strict_types=1);
  27705. namespace Composer\Plugin;
  27706. interface Capable
  27707. {
  27708. public function getCapabilities();
  27709. }
  27710. <?php declare(strict_types=1);
  27711. namespace Composer\Plugin;
  27712. use Composer\EventDispatcher\Event;
  27713. use Symfony\Component\Console\Input\InputInterface;
  27714. use Symfony\Component\Console\Output\OutputInterface;
  27715. class CommandEvent extends Event
  27716. {
  27717. private $commandName;
  27718. private $input;
  27719. private $output;
  27720. public function __construct(string $name, string $commandName, InputInterface $input, OutputInterface $output, array $args = [], array $flags = [])
  27721. {
  27722. parent::__construct($name, $args, $flags);
  27723. $this->commandName = $commandName;
  27724. $this->input = $input;
  27725. $this->output = $output;
  27726. }
  27727. public function getInput(): InputInterface
  27728. {
  27729. return $this->input;
  27730. }
  27731. public function getOutput(): OutputInterface
  27732. {
  27733. return $this->output;
  27734. }
  27735. public function getCommandName(): string
  27736. {
  27737. return $this->commandName;
  27738. }
  27739. }
  27740. <?php declare(strict_types=1);
  27741. namespace Composer\Plugin;
  27742. use UnexpectedValueException;
  27743. class PluginBlockedException extends UnexpectedValueException
  27744. {
  27745. }
  27746. <?php declare(strict_types=1);
  27747. namespace Composer\Plugin;
  27748. class PluginEvents
  27749. {
  27750. public const INIT = 'init';
  27751. public const COMMAND = 'command';
  27752. public const PRE_FILE_DOWNLOAD = 'pre-file-download';
  27753. public const POST_FILE_DOWNLOAD = 'post-file-download';
  27754. public const PRE_COMMAND_RUN = 'pre-command-run';
  27755. public const PRE_POOL_CREATE = 'pre-pool-create';
  27756. }
  27757. <?php declare(strict_types=1);
  27758. namespace Composer\Plugin;
  27759. use Composer\Composer;
  27760. use Composer\IO\IOInterface;
  27761. interface PluginInterface
  27762. {
  27763. public const PLUGIN_API_VERSION = '2.6.0';
  27764. public function activate(Composer $composer, IOInterface $io);
  27765. public function deactivate(Composer $composer, IOInterface $io);
  27766. public function uninstall(Composer $composer, IOInterface $io);
  27767. }
  27768. <?php declare(strict_types=1);
  27769. namespace Composer\Plugin;
  27770. use Composer\Composer;
  27771. use Composer\EventDispatcher\EventSubscriberInterface;
  27772. use Composer\Installer\InstallerInterface;
  27773. use Composer\IO\IOInterface;
  27774. use Composer\Package\BasePackage;
  27775. use Composer\Package\CompletePackage;
  27776. use Composer\Package\Locker;
  27777. use Composer\Package\Package;
  27778. use Composer\Package\RootPackageInterface;
  27779. use Composer\Package\Version\VersionParser;
  27780. use Composer\PartialComposer;
  27781. use Composer\Pcre\Preg;
  27782. use Composer\Repository\RepositoryInterface;
  27783. use Composer\Repository\InstalledRepository;
  27784. use Composer\Repository\RepositoryUtils;
  27785. use Composer\Repository\RootPackageRepository;
  27786. use Composer\Package\PackageInterface;
  27787. use Composer\Package\Link;
  27788. use Composer\Semver\Constraint\Constraint;
  27789. use Composer\Plugin\Capability\Capability;
  27790. use Composer\Util\PackageSorter;
  27791. class PluginManager
  27792. {
  27793. protected $composer;
  27794. protected $io;
  27795. protected $globalComposer;
  27796. protected $versionParser;
  27797. protected $disablePlugins = false;
  27798. protected $plugins = [];
  27799. protected $registeredPlugins = [];
  27800. private $allowPluginRules;
  27801. private $allowGlobalPluginRules;
  27802. private $runningInGlobalDir = false;
  27803. private static $classCounter = 0;
  27804. public function __construct(IOInterface $io, Composer $composer, ?PartialComposer $globalComposer = null, $disablePlugins = false)
  27805. {
  27806. $this->io = $io;
  27807. $this->composer = $composer;
  27808. $this->globalComposer = $globalComposer;
  27809. $this->versionParser = new VersionParser();
  27810. $this->disablePlugins = $disablePlugins;
  27811. $this->allowPluginRules = $this->parseAllowedPlugins($composer->getConfig()->get('allow-plugins'), $composer->getLocker());
  27812. $this->allowGlobalPluginRules = $this->parseAllowedPlugins($globalComposer !== null ? $globalComposer->getConfig()->get('allow-plugins') : false);
  27813. }
  27814. public function setRunningInGlobalDir(bool $runningInGlobalDir): void
  27815. {
  27816. $this->runningInGlobalDir = $runningInGlobalDir;
  27817. }
  27818. public function loadInstalledPlugins(): void
  27819. {
  27820. if (!$this->arePluginsDisabled('local')) {
  27821. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  27822. $this->loadRepository($repo, false, $this->composer->getPackage());
  27823. }
  27824. if ($this->globalComposer !== null && !$this->arePluginsDisabled('global')) {
  27825. $this->loadRepository($this->globalComposer->getRepositoryManager()->getLocalRepository(), true);
  27826. }
  27827. }
  27828. public function deactivateInstalledPlugins(): void
  27829. {
  27830. if (!$this->arePluginsDisabled('local')) {
  27831. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  27832. $this->deactivateRepository($repo, false);
  27833. }
  27834. if ($this->globalComposer !== null && !$this->arePluginsDisabled('global')) {
  27835. $this->deactivateRepository($this->globalComposer->getRepositoryManager()->getLocalRepository(), true);
  27836. }
  27837. }
  27838. public function getPlugins(): array
  27839. {
  27840. return $this->plugins;
  27841. }
  27842. public function getGlobalComposer(): ?PartialComposer
  27843. {
  27844. return $this->globalComposer;
  27845. }
  27846. public function registerPackage(PackageInterface $package, bool $failOnMissingClasses = false, bool $isGlobalPlugin = false): void
  27847. {
  27848. if ($this->arePluginsDisabled($isGlobalPlugin ? 'global' : 'local')) {
  27849. $this->io->writeError('<warning>The "'.$package->getName().'" plugin was not loaded as plugins are disabled.</warning>');
  27850. return;
  27851. }
  27852. if ($package->getType() === 'composer-plugin') {
  27853. $requiresComposer = null;
  27854. foreach ($package->getRequires() as $link) {
  27855. if ('composer-plugin-api' === $link->getTarget()) {
  27856. $requiresComposer = $link->getConstraint();
  27857. break;
  27858. }
  27859. }
  27860. if (!$requiresComposer) {
  27861. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  27862. }
  27863. $currentPluginApiVersion = $this->getPluginApiVersion();
  27864. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  27865. if ($requiresComposer->getPrettyString() === $this->getPluginApiVersion()) {
  27866. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api '.$this->getPluginApiVersion().', this *WILL* break in the future and it should be fixed ASAP (require ^'.$this->getPluginApiVersion().' instead for example).</warning>');
  27867. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  27868. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  27869. return;
  27870. }
  27871. if ($package->getName() === 'symfony/flex' && Preg::isMatch('{^[0-9.]+$}', $package->getVersion()) && version_compare($package->getVersion(), '1.9.8', '<')) {
  27872. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'was skipped because it is not compatible with Composer 2+. Make sure to update it to version 1.9.8 or greater.</warning>');
  27873. return;
  27874. }
  27875. }
  27876. if (!$this->isPluginAllowed($package->getName(), $isGlobalPlugin, true === ($package->getExtra()['plugin-optional'] ?? false))) {
  27877. $this->io->writeError('Skipped loading "'.$package->getName() . '" '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'as it is not in config.allow-plugins', true, IOInterface::DEBUG);
  27878. return;
  27879. }
  27880. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  27881. if (isset($this->registeredPlugins[$package->getName()])) {
  27882. return;
  27883. }
  27884. $extra = $package->getExtra();
  27885. if (empty($extra['class'])) {
  27886. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  27887. }
  27888. $classes = is_array($extra['class']) ? $extra['class'] : [$extra['class']];
  27889. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  27890. $globalRepo = $this->globalComposer !== null ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  27891. $rootPackage = clone $this->composer->getPackage();
  27892. $rootPackageAutoloads = $rootPackage->getAutoload();
  27893. $rootPackageAutoloads['files'] = [];
  27894. $rootPackage->setAutoload($rootPackageAutoloads);
  27895. $rootPackageAutoloads = $rootPackage->getDevAutoload();
  27896. $rootPackageAutoloads['files'] = [];
  27897. $rootPackage->setDevAutoload($rootPackageAutoloads);
  27898. unset($rootPackageAutoloads);
  27899. $rootPackageRepo = new RootPackageRepository($rootPackage);
  27900. $installedRepo = new InstalledRepository([$localRepo, $rootPackageRepo]);
  27901. if ($globalRepo) {
  27902. $installedRepo->addRepository($globalRepo);
  27903. }
  27904. $autoloadPackages = [$package->getName() => $package];
  27905. $autoloadPackages = $this->collectDependencies($installedRepo, $autoloadPackages, $package);
  27906. $generator = $this->composer->getAutoloadGenerator();
  27907. $autoloads = [[$rootPackage, '']];
  27908. foreach ($autoloadPackages as $autoloadPackage) {
  27909. if ($autoloadPackage === $rootPackage) {
  27910. continue;
  27911. }
  27912. $installPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  27913. if ($installPath === null) {
  27914. continue;
  27915. }
  27916. $autoloads[] = [$autoloadPackage, $installPath];
  27917. }
  27918. $map = $generator->parseAutoloads($autoloads, $rootPackage);
  27919. $classLoader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
  27920. $classLoader->register(false);
  27921. foreach ($map['files'] as $fileIdentifier => $file) {
  27922. if ($fileIdentifier === '7e9bd612cc444b3eed788ebbe46263a0') {
  27923. continue;
  27924. }
  27925. \Composer\Autoload\composerRequire($fileIdentifier, $file);
  27926. }
  27927. foreach ($classes as $class) {
  27928. if (class_exists($class, false)) {
  27929. $class = trim($class, '\\');
  27930. $path = $classLoader->findFile($class);
  27931. $code = file_get_contents($path);
  27932. $separatorPos = strrpos($class, '\\');
  27933. $className = $class;
  27934. if ($separatorPos) {
  27935. $className = substr($class, $separatorPos + 1);
  27936. }
  27937. $code = Preg::replace('{^((?:(?:final|readonly)\s+)*(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  27938. $code = strtr($code, [
  27939. '__FILE__' => var_export($path, true),
  27940. '__DIR__' => var_export(dirname($path), true),
  27941. '__CLASS__' => var_export($class, true),
  27942. ]);
  27943. $code = Preg::replace('/^\s*<\?(php)?/i', '', $code, 1);
  27944. eval($code);
  27945. $class .= '_composer_tmp'.self::$classCounter;
  27946. self::$classCounter++;
  27947. }
  27948. if ($oldInstallerPlugin) {
  27949. if (!is_a($class, 'Composer\Installer\InstallerInterface', true)) {
  27950. throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Installer\InstallerInterface');
  27951. }
  27952. $this->io->writeError('<warning>Loading "'.$package->getName() . '" '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').'which is a legacy composer-installer built for Composer 1.x, it is likely to cause issues as you are running Composer 2.x.</warning>');
  27953. $installer = new $class($this->io, $this->composer);
  27954. $this->composer->getInstallationManager()->addInstaller($installer);
  27955. $this->registeredPlugins[$package->getName()] = $installer;
  27956. } elseif (class_exists($class)) {
  27957. if (!is_a($class, 'Composer\Plugin\PluginInterface', true)) {
  27958. throw new \RuntimeException('Could not activate plugin "'.$package->getName().'" as "'.$class.'" does not implement Composer\Plugin\PluginInterface');
  27959. }
  27960. $plugin = new $class();
  27961. $this->addPlugin($plugin, $isGlobalPlugin, $package);
  27962. $this->registeredPlugins[$package->getName()] = $plugin;
  27963. } elseif ($failOnMissingClasses) {
  27964. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  27965. }
  27966. }
  27967. }
  27968. public function deactivatePackage(PackageInterface $package): void
  27969. {
  27970. if (!isset($this->registeredPlugins[$package->getName()])) {
  27971. return;
  27972. }
  27973. $plugin = $this->registeredPlugins[$package->getName()];
  27974. unset($this->registeredPlugins[$package->getName()]);
  27975. if ($plugin instanceof InstallerInterface) {
  27976. $this->composer->getInstallationManager()->removeInstaller($plugin);
  27977. } else {
  27978. $this->removePlugin($plugin);
  27979. }
  27980. }
  27981. public function uninstallPackage(PackageInterface $package): void
  27982. {
  27983. if (!isset($this->registeredPlugins[$package->getName()])) {
  27984. return;
  27985. }
  27986. $plugin = $this->registeredPlugins[$package->getName()];
  27987. if ($plugin instanceof InstallerInterface) {
  27988. $this->deactivatePackage($package);
  27989. } else {
  27990. unset($this->registeredPlugins[$package->getName()]);
  27991. $this->removePlugin($plugin);
  27992. $this->uninstallPlugin($plugin);
  27993. }
  27994. }
  27995. protected function getPluginApiVersion(): string
  27996. {
  27997. return PluginInterface::PLUGIN_API_VERSION;
  27998. }
  27999. public function addPlugin(PluginInterface $plugin, bool $isGlobalPlugin = false, ?PackageInterface $sourcePackage = null): void
  28000. {
  28001. if ($this->arePluginsDisabled($isGlobalPlugin ? 'global' : 'local')) {
  28002. return;
  28003. }
  28004. if ($sourcePackage === null) {
  28005. trigger_error('Calling PluginManager::addPlugin without $sourcePackage is deprecated, if you are using this please get in touch with us to explain the use case', E_USER_DEPRECATED);
  28006. } elseif (!$this->isPluginAllowed($sourcePackage->getName(), $isGlobalPlugin, true === ($sourcePackage->getExtra()['plugin-optional'] ?? false))) {
  28007. $this->io->writeError('Skipped loading "'.get_class($plugin).' from '.$sourcePackage->getName() . '" '.($isGlobalPlugin || $this->runningInGlobalDir ? '(installed globally) ' : '').' as it is not in config.allow-plugins', true, IOInterface::DEBUG);
  28008. return;
  28009. }
  28010. $details = [];
  28011. if ($sourcePackage) {
  28012. $details[] = 'from '.$sourcePackage->getName();
  28013. }
  28014. if ($isGlobalPlugin || $this->runningInGlobalDir) {
  28015. $details[] = 'installed globally';
  28016. }
  28017. $this->io->writeError('Loading plugin '.get_class($plugin).($details ? ' ('.implode(', ', $details).')' : ''), true, IOInterface::DEBUG);
  28018. $this->plugins[] = $plugin;
  28019. $plugin->activate($this->composer, $this->io);
  28020. if ($plugin instanceof EventSubscriberInterface) {
  28021. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  28022. }
  28023. }
  28024. public function removePlugin(PluginInterface $plugin): void
  28025. {
  28026. $index = array_search($plugin, $this->plugins, true);
  28027. if ($index === false) {
  28028. return;
  28029. }
  28030. $this->io->writeError('Unloading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  28031. unset($this->plugins[$index]);
  28032. $plugin->deactivate($this->composer, $this->io);
  28033. $this->composer->getEventDispatcher()->removeListener($plugin);
  28034. }
  28035. public function uninstallPlugin(PluginInterface $plugin): void
  28036. {
  28037. $this->io->writeError('Uninstalling plugin '.get_class($plugin), true, IOInterface::DEBUG);
  28038. $plugin->uninstall($this->composer, $this->io);
  28039. }
  28040. private function loadRepository(RepositoryInterface $repo, bool $isGlobalRepo, ?RootPackageInterface $rootPackage = null): void
  28041. {
  28042. $packages = $repo->getPackages();
  28043. $weights = [];
  28044. foreach ($packages as $package) {
  28045. if ($package->getType() === 'composer-plugin') {
  28046. $extra = $package->getExtra();
  28047. if ($package->getName() === 'composer/installers' || true === ($extra['plugin-modifies-install-path'] ?? false)) {
  28048. $weights[$package->getName()] = -10000;
  28049. }
  28050. }
  28051. }
  28052. $sortedPackages = PackageSorter::sortPackages($packages, $weights);
  28053. if (!$isGlobalRepo) {
  28054. $requiredPackages = RepositoryUtils::filterRequiredPackages($packages, $rootPackage, true);
  28055. }
  28056. foreach ($sortedPackages as $package) {
  28057. if (!($package instanceof CompletePackage)) {
  28058. continue;
  28059. }
  28060. if (!in_array($package->getType(), ['composer-plugin', 'composer-installer'], true)) {
  28061. continue;
  28062. }
  28063. if (
  28064. !$isGlobalRepo
  28065. && !in_array($package, $requiredPackages, true)
  28066. && !$this->isPluginAllowed($package->getName(), false, true, false)
  28067. ) {
  28068. $this->io->writeError('<warning>The "'.$package->getName().'" plugin was not loaded as it is not listed in allow-plugins and is not required by the root package anymore.</warning>');
  28069. continue;
  28070. }
  28071. if ('composer-plugin' === $package->getType()) {
  28072. $this->registerPackage($package, false, $isGlobalRepo);
  28073. } elseif ('composer-installer' === $package->getType()) {
  28074. $this->registerPackage($package, false, $isGlobalRepo);
  28075. }
  28076. }
  28077. }
  28078. private function deactivateRepository(RepositoryInterface $repo, bool $isGlobalRepo): void
  28079. {
  28080. $packages = $repo->getPackages();
  28081. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  28082. foreach ($sortedPackages as $package) {
  28083. if (!($package instanceof CompletePackage)) {
  28084. continue;
  28085. }
  28086. if ('composer-plugin' === $package->getType()) {
  28087. $this->deactivatePackage($package);
  28088. } elseif ('composer-installer' === $package->getType()) {
  28089. $this->deactivatePackage($package);
  28090. }
  28091. }
  28092. }
  28093. private function collectDependencies(InstalledRepository $installedRepo, array $collected, PackageInterface $package): array
  28094. {
  28095. foreach ($package->getRequires() as $requireLink) {
  28096. foreach ($installedRepo->findPackagesWithReplacersAndProviders($requireLink->getTarget()) as $requiredPackage) {
  28097. if (!isset($collected[$requiredPackage->getName()])) {
  28098. $collected[$requiredPackage->getName()] = $requiredPackage;
  28099. $collected = $this->collectDependencies($installedRepo, $collected, $requiredPackage);
  28100. }
  28101. }
  28102. }
  28103. return $collected;
  28104. }
  28105. private function getInstallPath(PackageInterface $package, bool $global = false): ?string
  28106. {
  28107. if (!$global) {
  28108. return $this->composer->getInstallationManager()->getInstallPath($package);
  28109. }
  28110. assert(null !== $this->globalComposer);
  28111. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  28112. }
  28113. protected function getCapabilityImplementationClassName(PluginInterface $plugin, string $capability): ?string
  28114. {
  28115. if (!($plugin instanceof Capable)) {
  28116. return null;
  28117. }
  28118. $capabilities = (array) $plugin->getCapabilities();
  28119. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  28120. return trim($capabilities[$capability]);
  28121. }
  28122. if (
  28123. array_key_exists($capability, $capabilities)
  28124. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  28125. ) {
  28126. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], true));
  28127. }
  28128. return null;
  28129. }
  28130. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = []): ?Capability
  28131. {
  28132. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  28133. if (!class_exists($capabilityClass)) {
  28134. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  28135. }
  28136. $ctorArgs['plugin'] = $plugin;
  28137. $capabilityObj = new $capabilityClass($ctorArgs);
  28138. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  28139. throw new \RuntimeException(
  28140. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  28141. );
  28142. }
  28143. return $capabilityObj;
  28144. }
  28145. return null;
  28146. }
  28147. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = []): array
  28148. {
  28149. $capabilities = [];
  28150. foreach ($this->getPlugins() as $plugin) {
  28151. $capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs);
  28152. if (null !== $capability) {
  28153. $capabilities[] = $capability;
  28154. }
  28155. }
  28156. return $capabilities;
  28157. }
  28158. private function parseAllowedPlugins($allowPluginsConfig, ?Locker $locker = null): ?array
  28159. {
  28160. if ([] === $allowPluginsConfig && $locker !== null && $locker->isLocked() && version_compare($locker->getPluginApi(), '2.2.0', '<')) {
  28161. return null;
  28162. }
  28163. if (true === $allowPluginsConfig) {
  28164. return ['{}' => true];
  28165. }
  28166. if (false === $allowPluginsConfig) {
  28167. return ['{}' => false];
  28168. }
  28169. $rules = [];
  28170. foreach ($allowPluginsConfig as $pattern => $allow) {
  28171. $rules[BasePackage::packageNameToRegexp($pattern)] = $allow;
  28172. }
  28173. return $rules;
  28174. }
  28175. public function arePluginsDisabled($type)
  28176. {
  28177. return $this->disablePlugins === true || $this->disablePlugins === $type;
  28178. }
  28179. public function disablePlugins(): void
  28180. {
  28181. $this->disablePlugins = true;
  28182. }
  28183. public function isPluginAllowed(string $package, bool $isGlobalPlugin, bool $optional = false, bool $prompt = true): bool
  28184. {
  28185. if ($isGlobalPlugin) {
  28186. $rules = &$this->allowGlobalPluginRules;
  28187. } else {
  28188. $rules = &$this->allowPluginRules;
  28189. }
  28190. if ($rules === null) {
  28191. if (!$this->io->isInteractive()) {
  28192. $this->io->writeError('<warning>For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins</warning>');
  28193. $this->io->writeError('<warning>This warning will become an exception once you run composer update!</warning>');
  28194. $rules = ['{}' => true];
  28195. return true;
  28196. }
  28197. $rules = [];
  28198. }
  28199. foreach ($rules as $pattern => $allow) {
  28200. if (Preg::isMatch($pattern, $package)) {
  28201. return $allow === true;
  28202. }
  28203. }
  28204. if ($package === 'composer/package-versions-deprecated') {
  28205. return false;
  28206. }
  28207. if ($this->io->isInteractive() && $prompt) {
  28208. $composer = $isGlobalPlugin && $this->globalComposer !== null ? $this->globalComposer : $this->composer;
  28209. $this->io->writeError('<warning>'.$package.($isGlobalPlugin || $this->runningInGlobalDir ? ' (installed globally)' : '').' contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins</warning>');
  28210. $attempts = 0;
  28211. while (true) {
  28212. $default = '?';
  28213. if ($attempts > 5) {
  28214. $this->io->writeError('Too many failed prompts, aborting.');
  28215. break;
  28216. }
  28217. switch ($answer = $this->io->ask('Do you trust "<fg=green;options=bold>'.$package.'</>" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [<comment>y,n,d,?</comment>] ', $default)) {
  28218. case 'y':
  28219. case 'n':
  28220. case 'd':
  28221. $allow = $answer === 'y';
  28222. $rules[BasePackage::packageNameToRegexp($package)] = $allow;
  28223. if ($answer === 'y' || $answer === 'n') {
  28224. $allowPlugins = $composer->getConfig()->get('allow-plugins');
  28225. if (is_array($allowPlugins)) {
  28226. $allowPlugins[$package] = $allow;
  28227. if ($composer->getConfig()->get('sort-packages')) {
  28228. ksort($allowPlugins);
  28229. }
  28230. $composer->getConfig()->getConfigSource()->addConfigSetting('allow-plugins', $allowPlugins);
  28231. $composer->getConfig()->merge(['config' => ['allow-plugins' => $allowPlugins]]);
  28232. }
  28233. }
  28234. return $allow;
  28235. case '?':
  28236. default:
  28237. $attempts++;
  28238. $this->io->writeError([
  28239. 'y - add package to allow-plugins in composer.json and let it run immediately',
  28240. 'n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts',
  28241. 'd - discard this, do not change composer.json and do not allow the plugin to run',
  28242. '? - print help',
  28243. ]);
  28244. break;
  28245. }
  28246. }
  28247. } elseif ($optional) {
  28248. return false;
  28249. }
  28250. throw new PluginBlockedException(
  28251. $package.($isGlobalPlugin || $this->runningInGlobalDir ? ' (installed globally)' : '').' contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe.'.PHP_EOL.
  28252. 'You can run "composer '.($isGlobalPlugin || $this->runningInGlobalDir ? 'global ' : '').'config --no-plugins allow-plugins.'.$package.' [true|false]" to enable it (true) or disable it explicitly and suppress this exception (false)'.PHP_EOL.
  28253. 'See https://getcomposer.org/allow-plugins'
  28254. );
  28255. }
  28256. }
  28257. <?php declare(strict_types=1);
  28258. namespace Composer\Plugin;
  28259. use Composer\EventDispatcher\Event;
  28260. use Composer\Package\PackageInterface;
  28261. class PostFileDownloadEvent extends Event
  28262. {
  28263. private $fileName;
  28264. private $checksum;
  28265. private $url;
  28266. private $context;
  28267. private $type;
  28268. public function __construct(string $name, ?string $fileName, ?string $checksum, string $url, string $type, $context = null)
  28269. {
  28270. if ($context === null && $type instanceof PackageInterface) {
  28271. $context = $type;
  28272. $type = 'package';
  28273. trigger_error('PostFileDownloadEvent::__construct should receive a $type=package and the package object in $context since Composer 2.1.', E_USER_DEPRECATED);
  28274. }
  28275. parent::__construct($name);
  28276. $this->fileName = $fileName;
  28277. $this->checksum = $checksum;
  28278. $this->url = $url;
  28279. $this->context = $context;
  28280. $this->type = $type;
  28281. }
  28282. public function getFileName(): ?string
  28283. {
  28284. return $this->fileName;
  28285. }
  28286. public function getChecksum(): ?string
  28287. {
  28288. return $this->checksum;
  28289. }
  28290. public function getUrl(): string
  28291. {
  28292. return $this->url;
  28293. }
  28294. public function getContext()
  28295. {
  28296. return $this->context;
  28297. }
  28298. public function getPackage(): ?PackageInterface
  28299. {
  28300. trigger_error('PostFileDownloadEvent::getPackage is deprecated since Composer 2.1, use getContext instead.', E_USER_DEPRECATED);
  28301. $context = $this->getContext();
  28302. return $context instanceof PackageInterface ? $context : null;
  28303. }
  28304. public function getType(): string
  28305. {
  28306. return $this->type;
  28307. }
  28308. }
  28309. <?php declare(strict_types=1);
  28310. namespace Composer\Plugin;
  28311. use Composer\EventDispatcher\Event;
  28312. use Symfony\Component\Console\Input\InputInterface;
  28313. class PreCommandRunEvent extends Event
  28314. {
  28315. private $input;
  28316. private $command;
  28317. public function __construct(string $name, InputInterface $input, string $command)
  28318. {
  28319. parent::__construct($name);
  28320. $this->input = $input;
  28321. $this->command = $command;
  28322. }
  28323. public function getInput(): InputInterface
  28324. {
  28325. return $this->input;
  28326. }
  28327. public function getCommand(): string
  28328. {
  28329. return $this->command;
  28330. }
  28331. }
  28332. <?php declare(strict_types=1);
  28333. namespace Composer\Plugin;
  28334. use Composer\EventDispatcher\Event;
  28335. use Composer\Util\HttpDownloader;
  28336. class PreFileDownloadEvent extends Event
  28337. {
  28338. private $httpDownloader;
  28339. private $processedUrl;
  28340. private $customCacheKey;
  28341. private $type;
  28342. private $context;
  28343. private $transportOptions = [];
  28344. public function __construct(string $name, HttpDownloader $httpDownloader, string $processedUrl, string $type, $context = null)
  28345. {
  28346. parent::__construct($name);
  28347. $this->httpDownloader = $httpDownloader;
  28348. $this->processedUrl = $processedUrl;
  28349. $this->type = $type;
  28350. $this->context = $context;
  28351. }
  28352. public function getHttpDownloader(): HttpDownloader
  28353. {
  28354. return $this->httpDownloader;
  28355. }
  28356. public function getProcessedUrl(): string
  28357. {
  28358. return $this->processedUrl;
  28359. }
  28360. public function setProcessedUrl(string $processedUrl): void
  28361. {
  28362. $this->processedUrl = $processedUrl;
  28363. }
  28364. public function getCustomCacheKey(): ?string
  28365. {
  28366. return $this->customCacheKey;
  28367. }
  28368. public function setCustomCacheKey(?string $customCacheKey): void
  28369. {
  28370. $this->customCacheKey = $customCacheKey;
  28371. }
  28372. public function getType(): string
  28373. {
  28374. return $this->type;
  28375. }
  28376. public function getContext()
  28377. {
  28378. return $this->context;
  28379. }
  28380. public function getTransportOptions(): array
  28381. {
  28382. return $this->transportOptions;
  28383. }
  28384. public function setTransportOptions(array $options): void
  28385. {
  28386. $this->transportOptions = $options;
  28387. }
  28388. }
  28389. <?php declare(strict_types=1);
  28390. namespace Composer\Plugin;
  28391. use Composer\EventDispatcher\Event;
  28392. use Composer\Repository\RepositoryInterface;
  28393. use Composer\DependencyResolver\Request;
  28394. use Composer\Package\BasePackage;
  28395. class PrePoolCreateEvent extends Event
  28396. {
  28397. private $repositories;
  28398. private $request;
  28399. private $acceptableStabilities;
  28400. private $stabilityFlags;
  28401. private $rootAliases;
  28402. private $rootReferences;
  28403. private $packages;
  28404. private $unacceptableFixedPackages;
  28405. public function __construct(string $name, array $repositories, Request $request, array $acceptableStabilities, array $stabilityFlags, array $rootAliases, array $rootReferences, array $packages, array $unacceptableFixedPackages)
  28406. {
  28407. parent::__construct($name);
  28408. $this->repositories = $repositories;
  28409. $this->request = $request;
  28410. $this->acceptableStabilities = $acceptableStabilities;
  28411. $this->stabilityFlags = $stabilityFlags;
  28412. $this->rootAliases = $rootAliases;
  28413. $this->rootReferences = $rootReferences;
  28414. $this->packages = $packages;
  28415. $this->unacceptableFixedPackages = $unacceptableFixedPackages;
  28416. }
  28417. public function getRepositories(): array
  28418. {
  28419. return $this->repositories;
  28420. }
  28421. public function getRequest(): Request
  28422. {
  28423. return $this->request;
  28424. }
  28425. public function getAcceptableStabilities(): array
  28426. {
  28427. return $this->acceptableStabilities;
  28428. }
  28429. public function getStabilityFlags(): array
  28430. {
  28431. return $this->stabilityFlags;
  28432. }
  28433. public function getRootAliases(): array
  28434. {
  28435. return $this->rootAliases;
  28436. }
  28437. public function getRootReferences(): array
  28438. {
  28439. return $this->rootReferences;
  28440. }
  28441. public function getPackages(): array
  28442. {
  28443. return $this->packages;
  28444. }
  28445. public function getUnacceptableFixedPackages(): array
  28446. {
  28447. return $this->unacceptableFixedPackages;
  28448. }
  28449. public function setPackages(array $packages): void
  28450. {
  28451. $this->packages = $packages;
  28452. }
  28453. public function setUnacceptableFixedPackages(array $packages): void
  28454. {
  28455. $this->unacceptableFixedPackages = $packages;
  28456. }
  28457. }
  28458. <?php declare(strict_types=1);
  28459. namespace Composer\Question;
  28460. use Composer\Pcre\Preg;
  28461. use Symfony\Component\Console\Exception\InvalidArgumentException;
  28462. use Symfony\Component\Console\Question\Question;
  28463. class StrictConfirmationQuestion extends Question
  28464. {
  28465. private $trueAnswerRegex;
  28466. private $falseAnswerRegex;
  28467. public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y(?:es)?$/i', string $falseAnswerRegex = '/^no?$/i')
  28468. {
  28469. parent::__construct($question, $default);
  28470. $this->trueAnswerRegex = $trueAnswerRegex;
  28471. $this->falseAnswerRegex = $falseAnswerRegex;
  28472. $this->setNormalizer($this->getDefaultNormalizer());
  28473. $this->setValidator($this->getDefaultValidator());
  28474. }
  28475. private function getDefaultNormalizer(): callable
  28476. {
  28477. $default = $this->getDefault();
  28478. $trueRegex = $this->trueAnswerRegex;
  28479. $falseRegex = $this->falseAnswerRegex;
  28480. return static function ($answer) use ($default, $trueRegex, $falseRegex) {
  28481. if (is_bool($answer)) {
  28482. return $answer;
  28483. }
  28484. if (empty($answer) && !empty($default)) {
  28485. return $default;
  28486. }
  28487. if (Preg::isMatch($trueRegex, $answer)) {
  28488. return true;
  28489. }
  28490. if (Preg::isMatch($falseRegex, $answer)) {
  28491. return false;
  28492. }
  28493. return null;
  28494. };
  28495. }
  28496. private function getDefaultValidator(): callable
  28497. {
  28498. return static function ($answer): bool {
  28499. if (!is_bool($answer)) {
  28500. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  28501. }
  28502. return $answer;
  28503. };
  28504. }
  28505. }
  28506. <?php declare(strict_types=1);
  28507. namespace Composer\Repository;
  28508. use Composer\Semver\Constraint\ConstraintInterface;
  28509. use Composer\Advisory\PartialSecurityAdvisory;
  28510. use Composer\Advisory\SecurityAdvisory;
  28511. interface AdvisoryProviderInterface
  28512. {
  28513. public function hasSecurityAdvisories(): bool;
  28514. public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array;
  28515. }
  28516. <?php declare(strict_types=1);
  28517. namespace Composer\Repository;
  28518. use Composer\Package\AliasPackage;
  28519. use Composer\Package\BasePackage;
  28520. use Composer\Package\CompleteAliasPackage;
  28521. use Composer\Package\CompletePackage;
  28522. use Composer\Package\PackageInterface;
  28523. use Composer\Package\CompletePackageInterface;
  28524. use Composer\Package\Version\VersionParser;
  28525. use Composer\Package\Version\StabilityFilter;
  28526. use Composer\Pcre\Preg;
  28527. use Composer\Semver\Constraint\ConstraintInterface;
  28528. use Composer\Semver\Constraint\Constraint;
  28529. class ArrayRepository implements RepositoryInterface
  28530. {
  28531. protected $packages = null;
  28532. protected $packageMap = null;
  28533. public function __construct(array $packages = [])
  28534. {
  28535. foreach ($packages as $package) {
  28536. $this->addPackage($package);
  28537. }
  28538. }
  28539. public function getRepoName()
  28540. {
  28541. return 'array repo (defining '.$this->count().' package'.($this->count() > 1 ? 's' : '').')';
  28542. }
  28543. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = [])
  28544. {
  28545. $packages = $this->getPackages();
  28546. $result = [];
  28547. $namesFound = [];
  28548. foreach ($packages as $package) {
  28549. if (array_key_exists($package->getName(), $packageNameMap)) {
  28550. if (
  28551. (!$packageNameMap[$package->getName()] || $packageNameMap[$package->getName()]->matches(new Constraint('==', $package->getVersion())))
  28552. && StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, $package->getNames(), $package->getStability())
  28553. && !isset($alreadyLoaded[$package->getName()][$package->getVersion()])
  28554. ) {
  28555. $result[spl_object_hash($package)] = $package;
  28556. if ($package instanceof AliasPackage && !isset($result[spl_object_hash($package->getAliasOf())])) {
  28557. $result[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
  28558. }
  28559. }
  28560. $namesFound[$package->getName()] = true;
  28561. }
  28562. }
  28563. foreach ($packages as $package) {
  28564. if ($package instanceof AliasPackage) {
  28565. if (isset($result[spl_object_hash($package->getAliasOf())])) {
  28566. $result[spl_object_hash($package)] = $package;
  28567. }
  28568. }
  28569. }
  28570. return ['namesFound' => array_keys($namesFound), 'packages' => $result];
  28571. }
  28572. public function findPackage(string $name, $constraint)
  28573. {
  28574. $name = strtolower($name);
  28575. if (!$constraint instanceof ConstraintInterface) {
  28576. $versionParser = new VersionParser();
  28577. $constraint = $versionParser->parseConstraints($constraint);
  28578. }
  28579. foreach ($this->getPackages() as $package) {
  28580. if ($name === $package->getName()) {
  28581. $pkgConstraint = new Constraint('==', $package->getVersion());
  28582. if ($constraint->matches($pkgConstraint)) {
  28583. return $package;
  28584. }
  28585. }
  28586. }
  28587. return null;
  28588. }
  28589. public function findPackages(string $name, $constraint = null)
  28590. {
  28591. $name = strtolower($name);
  28592. $packages = [];
  28593. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  28594. $versionParser = new VersionParser();
  28595. $constraint = $versionParser->parseConstraints($constraint);
  28596. }
  28597. foreach ($this->getPackages() as $package) {
  28598. if ($name === $package->getName()) {
  28599. if (null === $constraint || $constraint->matches(new Constraint('==', $package->getVersion()))) {
  28600. $packages[] = $package;
  28601. }
  28602. }
  28603. }
  28604. return $packages;
  28605. }
  28606. public function search(string $query, int $mode = 0, ?string $type = null)
  28607. {
  28608. if ($mode === self::SEARCH_FULLTEXT) {
  28609. $regex = '{(?:'.implode('|', Preg::split('{\s+}', preg_quote($query))).')}i';
  28610. } else {
  28611. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  28612. }
  28613. $matches = [];
  28614. foreach ($this->getPackages() as $package) {
  28615. $name = $package->getName();
  28616. if ($mode === self::SEARCH_VENDOR) {
  28617. [$name] = explode('/', $name);
  28618. }
  28619. if (isset($matches[$name])) {
  28620. continue;
  28621. }
  28622. if (null !== $type && $package->getType() !== $type) {
  28623. continue;
  28624. }
  28625. if (Preg::isMatch($regex, $name)
  28626. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && Preg::isMatch($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  28627. ) {
  28628. if ($mode === self::SEARCH_VENDOR) {
  28629. $matches[$name] = [
  28630. 'name' => $name,
  28631. 'description' => null,
  28632. ];
  28633. } else {
  28634. $matches[$name] = [
  28635. 'name' => $package->getPrettyName(),
  28636. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  28637. ];
  28638. if ($package instanceof CompletePackageInterface && $package->isAbandoned()) {
  28639. $matches[$name]['abandoned'] = $package->getReplacementPackage() ?: true;
  28640. }
  28641. }
  28642. }
  28643. }
  28644. return array_values($matches);
  28645. }
  28646. public function hasPackage(PackageInterface $package)
  28647. {
  28648. if ($this->packageMap === null) {
  28649. $this->packageMap = [];
  28650. foreach ($this->getPackages() as $repoPackage) {
  28651. $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
  28652. }
  28653. }
  28654. return isset($this->packageMap[$package->getUniqueName()]);
  28655. }
  28656. public function addPackage(PackageInterface $package)
  28657. {
  28658. if (!$package instanceof BasePackage) {
  28659. throw new \InvalidArgumentException('Only subclasses of BasePackage are supported');
  28660. }
  28661. if (null === $this->packages) {
  28662. $this->initialize();
  28663. }
  28664. $package->setRepository($this);
  28665. $this->packages[] = $package;
  28666. if ($package instanceof AliasPackage) {
  28667. $aliasedPackage = $package->getAliasOf();
  28668. if (null === $aliasedPackage->getRepository()) {
  28669. $this->addPackage($aliasedPackage);
  28670. }
  28671. }
  28672. $this->packageMap = null;
  28673. }
  28674. public function getProviders(string $packageName)
  28675. {
  28676. $result = [];
  28677. foreach ($this->getPackages() as $candidate) {
  28678. if (isset($result[$candidate->getName()])) {
  28679. continue;
  28680. }
  28681. foreach ($candidate->getProvides() as $link) {
  28682. if ($packageName === $link->getTarget()) {
  28683. $result[$candidate->getName()] = [
  28684. 'name' => $candidate->getName(),
  28685. 'description' => $candidate instanceof CompletePackageInterface ? $candidate->getDescription() : null,
  28686. 'type' => $candidate->getType(),
  28687. ];
  28688. continue 2;
  28689. }
  28690. }
  28691. }
  28692. return $result;
  28693. }
  28694. protected function createAliasPackage(BasePackage $package, string $alias, string $prettyAlias)
  28695. {
  28696. while ($package instanceof AliasPackage) {
  28697. $package = $package->getAliasOf();
  28698. }
  28699. if ($package instanceof CompletePackage) {
  28700. return new CompleteAliasPackage($package, $alias, $prettyAlias);
  28701. }
  28702. return new AliasPackage($package, $alias, $prettyAlias);
  28703. }
  28704. public function removePackage(PackageInterface $package)
  28705. {
  28706. $packageId = $package->getUniqueName();
  28707. foreach ($this->getPackages() as $key => $repoPackage) {
  28708. if ($packageId === $repoPackage->getUniqueName()) {
  28709. array_splice($this->packages, $key, 1);
  28710. $this->packageMap = null;
  28711. return;
  28712. }
  28713. }
  28714. }
  28715. public function getPackages()
  28716. {
  28717. if (null === $this->packages) {
  28718. $this->initialize();
  28719. }
  28720. if (null === $this->packages) {
  28721. throw new \LogicException('initialize failed to initialize the packages array');
  28722. }
  28723. return $this->packages;
  28724. }
  28725. public function count(): int
  28726. {
  28727. if (null === $this->packages) {
  28728. $this->initialize();
  28729. }
  28730. return count($this->packages);
  28731. }
  28732. protected function initialize()
  28733. {
  28734. $this->packages = [];
  28735. }
  28736. }
  28737. <?php declare(strict_types=1);
  28738. namespace Composer\Repository;
  28739. use Composer\IO\IOInterface;
  28740. use Composer\Json\JsonFile;
  28741. use Composer\Package\BasePackage;
  28742. use Composer\Package\Loader\ArrayLoader;
  28743. use Composer\Package\Loader\LoaderInterface;
  28744. use Composer\Util\Platform;
  28745. use Composer\Util\Tar;
  28746. use Composer\Util\Zip;
  28747. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  28748. {
  28749. protected $loader;
  28750. protected $lookup;
  28751. protected $repoConfig;
  28752. private $io;
  28753. public function __construct(array $repoConfig, IOInterface $io)
  28754. {
  28755. parent::__construct();
  28756. if (!extension_loaded('zip')) {
  28757. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  28758. }
  28759. $this->loader = new ArrayLoader();
  28760. $this->lookup = Platform::expandPath($repoConfig['url']);
  28761. $this->io = $io;
  28762. $this->repoConfig = $repoConfig;
  28763. }
  28764. public function getRepoName()
  28765. {
  28766. return 'artifact repo ('.$this->lookup.')';
  28767. }
  28768. public function getRepoConfig()
  28769. {
  28770. return $this->repoConfig;
  28771. }
  28772. protected function initialize()
  28773. {
  28774. parent::initialize();
  28775. $this->scanDirectory($this->lookup);
  28776. }
  28777. private function scanDirectory(string $path): void
  28778. {
  28779. $io = $this->io;
  28780. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  28781. $iterator = new \RecursiveIteratorIterator($directory);
  28782. $regex = new \RegexIterator($iterator, '/^.+\.(zip|tar|gz|tgz)$/i');
  28783. foreach ($regex as $file) {
  28784. if (!$file->isFile()) {
  28785. continue;
  28786. }
  28787. $package = $this->getComposerInformation($file);
  28788. if (!$package) {
  28789. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  28790. continue;
  28791. }
  28792. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  28793. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  28794. $this->addPackage($package);
  28795. }
  28796. }
  28797. private function getComposerInformation(\SplFileInfo $file): ?BasePackage
  28798. {
  28799. $json = null;
  28800. $fileType = null;
  28801. $fileExtension = pathinfo($file->getPathname(), PATHINFO_EXTENSION);
  28802. if (in_array($fileExtension, ['gz', 'tar', 'tgz'], true)) {
  28803. $fileType = 'tar';
  28804. } elseif ($fileExtension === 'zip') {
  28805. $fileType = 'zip';
  28806. } else {
  28807. throw new \RuntimeException('Files with "'.$fileExtension.'" extensions aren\'t supported. Only ZIP and TAR/TAR.GZ/TGZ archives are supported.');
  28808. }
  28809. try {
  28810. if ($fileType === 'tar') {
  28811. $json = Tar::getComposerJson($file->getPathname());
  28812. } else {
  28813. $json = Zip::getComposerJson($file->getPathname());
  28814. }
  28815. } catch (\Exception $exception) {
  28816. $this->io->write('Failed loading package '.$file->getPathname().': '.$exception->getMessage(), false, IOInterface::VERBOSE);
  28817. }
  28818. if (null === $json) {
  28819. return null;
  28820. }
  28821. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  28822. $package['dist'] = [
  28823. 'type' => $fileType,
  28824. 'url' => strtr($file->getPathname(), '\\', '/'),
  28825. 'shasum' => hash_file('sha1', $file->getRealPath()),
  28826. ];
  28827. try {
  28828. $package = $this->loader->load($package);
  28829. } catch (\UnexpectedValueException $e) {
  28830. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  28831. }
  28832. return $package;
  28833. }
  28834. }
  28835. <?php declare(strict_types=1);
  28836. namespace Composer\Repository;
  28837. use Composer\Package\AliasPackage;
  28838. use Composer\Package\PackageInterface;
  28839. trait CanonicalPackagesTrait
  28840. {
  28841. public function getCanonicalPackages()
  28842. {
  28843. $packages = $this->getPackages();
  28844. $packagesByName = [];
  28845. foreach ($packages as $package) {
  28846. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  28847. $packagesByName[$package->getName()] = $package;
  28848. }
  28849. }
  28850. $canonicalPackages = [];
  28851. foreach ($packagesByName as $package) {
  28852. while ($package instanceof AliasPackage) {
  28853. $package = $package->getAliasOf();
  28854. }
  28855. $canonicalPackages[] = $package;
  28856. }
  28857. return $canonicalPackages;
  28858. }
  28859. }
  28860. <?php declare(strict_types=1);
  28861. namespace Composer\Repository;
  28862. use Composer\Advisory\PartialSecurityAdvisory;
  28863. use Composer\Advisory\SecurityAdvisory;
  28864. use Composer\Package\BasePackage;
  28865. use Composer\Package\Loader\ArrayLoader;
  28866. use Composer\Package\PackageInterface;
  28867. use Composer\Package\AliasPackage;
  28868. use Composer\Package\CompletePackage;
  28869. use Composer\Package\CompleteAliasPackage;
  28870. use Composer\Package\Version\VersionParser;
  28871. use Composer\Package\Version\StabilityFilter;
  28872. use Composer\Json\JsonFile;
  28873. use Composer\Cache;
  28874. use Composer\Config;
  28875. use Composer\IO\IOInterface;
  28876. use Composer\Pcre\Preg;
  28877. use Composer\Plugin\PostFileDownloadEvent;
  28878. use Composer\Semver\CompilingMatcher;
  28879. use Composer\Util\HttpDownloader;
  28880. use Composer\Util\Loop;
  28881. use Composer\Plugin\PluginEvents;
  28882. use Composer\Plugin\PreFileDownloadEvent;
  28883. use Composer\EventDispatcher\EventDispatcher;
  28884. use Composer\Downloader\TransportException;
  28885. use Composer\Semver\Constraint\ConstraintInterface;
  28886. use Composer\Semver\Constraint\Constraint;
  28887. use Composer\Semver\Constraint\MatchAllConstraint;
  28888. use Composer\Util\Http\Response;
  28889. use Composer\MetadataMinifier\MetadataMinifier;
  28890. use Composer\Util\Url;
  28891. use React\Promise\PromiseInterface;
  28892. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface, AdvisoryProviderInterface
  28893. {
  28894. private $repoConfig;
  28895. private $options;
  28896. private $url;
  28897. private $baseUrl;
  28898. private $io;
  28899. private $httpDownloader;
  28900. private $loop;
  28901. protected $cache;
  28902. protected $notifyUrl = null;
  28903. protected $searchUrl = null;
  28904. protected $providersApiUrl = null;
  28905. protected $hasProviders = false;
  28906. protected $providersUrl = null;
  28907. protected $listUrl = null;
  28908. protected $hasAvailablePackageList = false;
  28909. protected $availablePackages = null;
  28910. protected $availablePackagePatterns = null;
  28911. protected $lazyProvidersUrl = null;
  28912. protected $providerListing;
  28913. protected $loader;
  28914. private $allowSslDowngrade = false;
  28915. private $eventDispatcher;
  28916. private $sourceMirrors;
  28917. private $distMirrors;
  28918. private $degradedMode = false;
  28919. private $rootData;
  28920. private $hasPartialPackages = false;
  28921. private $partialPackagesByName = null;
  28922. private $displayedWarningAboutNonMatchingPackageIndex = false;
  28923. private $securityAdvisoryConfig = null;
  28924. private $freshMetadataUrls = [];
  28925. private $packagesNotFoundCache = [];
  28926. private $versionParser;
  28927. public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null)
  28928. {
  28929. parent::__construct();
  28930. if (!Preg::isMatch('{^[\w.]+\??://}', $repoConfig['url'])) {
  28931. if (($localFilePath = realpath($repoConfig['url'])) !== false) {
  28932. $repoConfig['url'] = 'file://'.$localFilePath;
  28933. } else {
  28934. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  28935. }
  28936. }
  28937. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  28938. if ($repoConfig['url'] === '') {
  28939. throw new \InvalidArgumentException('The repository url must not be an empty string');
  28940. }
  28941. if (str_starts_with($repoConfig['url'], 'https?')) {
  28942. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  28943. }
  28944. $urlBits = parse_url(strtr($repoConfig['url'], '\\', '/'));
  28945. if ($urlBits === false || empty($urlBits['scheme'])) {
  28946. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  28947. }
  28948. if (!isset($repoConfig['options'])) {
  28949. $repoConfig['options'] = [];
  28950. }
  28951. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  28952. $this->allowSslDowngrade = true;
  28953. }
  28954. $this->options = $repoConfig['options'];
  28955. $this->url = $repoConfig['url'];
  28956. if (Preg::isMatch('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  28957. $this->url = $match['proto'].'://repo.packagist.org';
  28958. }
  28959. $baseUrl = rtrim(Preg::replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  28960. assert($baseUrl !== '');
  28961. $this->baseUrl = $baseUrl;
  28962. $this->io = $io;
  28963. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->url)), 'a-z0-9.$~_');
  28964. $this->cache->setReadOnly($config->get('cache-read-only'));
  28965. $this->versionParser = new VersionParser();
  28966. $this->loader = new ArrayLoader($this->versionParser);
  28967. $this->httpDownloader = $httpDownloader;
  28968. $this->eventDispatcher = $eventDispatcher;
  28969. $this->repoConfig = $repoConfig;
  28970. $this->loop = new Loop($this->httpDownloader);
  28971. }
  28972. public function getRepoName()
  28973. {
  28974. return 'composer repo ('.Url::sanitize($this->url).')';
  28975. }
  28976. public function getRepoConfig()
  28977. {
  28978. return $this->repoConfig;
  28979. }
  28980. public function findPackage(string $name, $constraint)
  28981. {
  28982. $hasProviders = $this->hasProviders();
  28983. $name = strtolower($name);
  28984. if (!$constraint instanceof ConstraintInterface) {
  28985. $constraint = $this->versionParser->parseConstraints($constraint);
  28986. }
  28987. if ($this->lazyProvidersUrl) {
  28988. if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
  28989. return $this->filterPackages($this->whatProvides($name), $constraint, true);
  28990. }
  28991. if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
  28992. return null;
  28993. }
  28994. $packages = $this->loadAsyncPackages([$name => $constraint]);
  28995. if (count($packages['packages']) > 0) {
  28996. return reset($packages['packages']);
  28997. }
  28998. return null;
  28999. }
  29000. if ($hasProviders) {
  29001. foreach ($this->getProviderNames() as $providerName) {
  29002. if ($name === $providerName) {
  29003. return $this->filterPackages($this->whatProvides($providerName), $constraint, true);
  29004. }
  29005. }
  29006. return null;
  29007. }
  29008. return parent::findPackage($name, $constraint);
  29009. }
  29010. public function findPackages(string $name, $constraint = null)
  29011. {
  29012. $hasProviders = $this->hasProviders();
  29013. $name = strtolower($name);
  29014. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  29015. $constraint = $this->versionParser->parseConstraints($constraint);
  29016. }
  29017. if ($this->lazyProvidersUrl) {
  29018. if ($this->hasPartialPackages() && isset($this->partialPackagesByName[$name])) {
  29019. return $this->filterPackages($this->whatProvides($name), $constraint);
  29020. }
  29021. if ($this->hasAvailablePackageList && !$this->lazyProvidersRepoContains($name)) {
  29022. return [];
  29023. }
  29024. $result = $this->loadAsyncPackages([$name => $constraint]);
  29025. return $result['packages'];
  29026. }
  29027. if ($hasProviders) {
  29028. foreach ($this->getProviderNames() as $providerName) {
  29029. if ($name === $providerName) {
  29030. return $this->filterPackages($this->whatProvides($providerName), $constraint);
  29031. }
  29032. }
  29033. return [];
  29034. }
  29035. return parent::findPackages($name, $constraint);
  29036. }
  29037. private function filterPackages(array $packages, ?ConstraintInterface $constraint = null, bool $returnFirstMatch = false)
  29038. {
  29039. if (null === $constraint) {
  29040. if ($returnFirstMatch) {
  29041. return reset($packages);
  29042. }
  29043. return $packages;
  29044. }
  29045. $filteredPackages = [];
  29046. foreach ($packages as $package) {
  29047. $pkgConstraint = new Constraint('==', $package->getVersion());
  29048. if ($constraint->matches($pkgConstraint)) {
  29049. if ($returnFirstMatch) {
  29050. return $package;
  29051. }
  29052. $filteredPackages[] = $package;
  29053. }
  29054. }
  29055. if ($returnFirstMatch) {
  29056. return null;
  29057. }
  29058. return $filteredPackages;
  29059. }
  29060. public function getPackages()
  29061. {
  29062. $hasProviders = $this->hasProviders();
  29063. if ($this->lazyProvidersUrl) {
  29064. if (is_array($this->availablePackages) && !$this->availablePackagePatterns) {
  29065. $packageMap = [];
  29066. foreach ($this->availablePackages as $name) {
  29067. $packageMap[$name] = new MatchAllConstraint();
  29068. }
  29069. $result = $this->loadAsyncPackages($packageMap);
  29070. return array_values($result['packages']);
  29071. }
  29072. if ($this->hasPartialPackages()) {
  29073. if (!is_array($this->partialPackagesByName)) {
  29074. throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
  29075. }
  29076. return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages');
  29077. }
  29078. throw new \LogicException('Composer repositories that have lazy providers and no available-packages list can not load the complete list of packages, use getPackageNames instead.');
  29079. }
  29080. if ($hasProviders) {
  29081. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getPackageNames instead.');
  29082. }
  29083. return parent::getPackages();
  29084. }
  29085. public function getPackageNames(?string $packageFilter = null)
  29086. {
  29087. $hasProviders = $this->hasProviders();
  29088. $filterResults =
  29089. static function (array $results): array {
  29090. return $results;
  29091. }
  29092. ;
  29093. if (null !== $packageFilter && '' !== $packageFilter) {
  29094. $packageFilterRegex = BasePackage::packageNameToRegexp($packageFilter);
  29095. $filterResults =
  29096. static function (array $results) use ($packageFilterRegex): array {
  29097. return Preg::grep($packageFilterRegex, $results);
  29098. }
  29099. ;
  29100. }
  29101. if ($this->lazyProvidersUrl) {
  29102. if (is_array($this->availablePackages)) {
  29103. return $filterResults(array_keys($this->availablePackages));
  29104. }
  29105. if ($this->listUrl) {
  29106. return $this->loadPackageList($packageFilter);
  29107. }
  29108. if ($this->hasPartialPackages() && $this->partialPackagesByName !== null) {
  29109. return $filterResults(array_keys($this->partialPackagesByName));
  29110. }
  29111. return [];
  29112. }
  29113. if ($hasProviders) {
  29114. return $filterResults($this->getProviderNames());
  29115. }
  29116. $names = [];
  29117. foreach ($this->getPackages() as $package) {
  29118. $names[] = $package->getPrettyName();
  29119. }
  29120. return $filterResults($names);
  29121. }
  29122. private function getVendorNames(): array
  29123. {
  29124. $cacheKey = 'vendor-list.txt';
  29125. $cacheAge = $this->cache->getAge($cacheKey);
  29126. if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
  29127. $cachedData = explode("\n", $cachedData);
  29128. return $cachedData;
  29129. }
  29130. $names = $this->getPackageNames();
  29131. $uniques = [];
  29132. foreach ($names as $name) {
  29133. $uniques[explode('/', $name, 2)[0]] = true;
  29134. }
  29135. $vendors = array_keys($uniques);
  29136. if (!$this->cache->isReadOnly()) {
  29137. $this->cache->write($cacheKey, implode("\n", $vendors));
  29138. }
  29139. return $vendors;
  29140. }
  29141. private function loadPackageList(?string $packageFilter = null): array
  29142. {
  29143. if (null === $this->listUrl) {
  29144. throw new \LogicException('Make sure to call loadRootServerFile before loadPackageList');
  29145. }
  29146. $url = $this->listUrl;
  29147. if (is_string($packageFilter) && $packageFilter !== '') {
  29148. $url .= '?filter='.urlencode($packageFilter);
  29149. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  29150. return $result['packageNames'];
  29151. }
  29152. $cacheKey = 'package-list.txt';
  29153. $cacheAge = $this->cache->getAge($cacheKey);
  29154. if (false !== $cacheAge && $cacheAge < 600 && ($cachedData = $this->cache->read($cacheKey)) !== false) {
  29155. $cachedData = explode("\n", $cachedData);
  29156. return $cachedData;
  29157. }
  29158. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  29159. if (!$this->cache->isReadOnly()) {
  29160. $this->cache->write($cacheKey, implode("\n", $result['packageNames']));
  29161. }
  29162. return $result['packageNames'];
  29163. }
  29164. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = [])
  29165. {
  29166. $hasProviders = $this->hasProviders();
  29167. if (!$hasProviders && !$this->hasPartialPackages() && null === $this->lazyProvidersUrl) {
  29168. return parent::loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  29169. }
  29170. $packages = [];
  29171. $namesFound = [];
  29172. if ($hasProviders || $this->hasPartialPackages()) {
  29173. foreach ($packageNameMap as $name => $constraint) {
  29174. $matches = [];
  29175. if (!$hasProviders && !isset($this->partialPackagesByName[$name])) {
  29176. continue;
  29177. }
  29178. $candidates = $this->whatProvides($name, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  29179. foreach ($candidates as $candidate) {
  29180. if ($candidate->getName() !== $name) {
  29181. throw new \LogicException('whatProvides should never return a package with a different name than the requested one');
  29182. }
  29183. $namesFound[$name] = true;
  29184. if (!$constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
  29185. $matches[spl_object_hash($candidate)] = $candidate;
  29186. if ($candidate instanceof AliasPackage && !isset($matches[spl_object_hash($candidate->getAliasOf())])) {
  29187. $matches[spl_object_hash($candidate->getAliasOf())] = $candidate->getAliasOf();
  29188. }
  29189. }
  29190. }
  29191. foreach ($candidates as $candidate) {
  29192. if ($candidate instanceof AliasPackage) {
  29193. if (isset($matches[spl_object_hash($candidate->getAliasOf())])) {
  29194. $matches[spl_object_hash($candidate)] = $candidate;
  29195. }
  29196. }
  29197. }
  29198. $packages = array_merge($packages, $matches);
  29199. unset($packageNameMap[$name]);
  29200. }
  29201. }
  29202. if ($this->lazyProvidersUrl && count($packageNameMap)) {
  29203. if ($this->hasAvailablePackageList) {
  29204. foreach ($packageNameMap as $name => $constraint) {
  29205. if (!$this->lazyProvidersRepoContains(strtolower($name))) {
  29206. unset($packageNameMap[$name]);
  29207. }
  29208. }
  29209. }
  29210. $result = $this->loadAsyncPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  29211. $packages = array_merge($packages, $result['packages']);
  29212. $namesFound = array_merge($namesFound, $result['namesFound']);
  29213. }
  29214. return ['namesFound' => array_keys($namesFound), 'packages' => $packages];
  29215. }
  29216. public function search(string $query, int $mode = 0, ?string $type = null)
  29217. {
  29218. $this->loadRootServerFile(600);
  29219. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  29220. $url = str_replace(['%query%', '%type%'], [urlencode($query), $type], $this->searchUrl);
  29221. $search = $this->httpDownloader->get($url, $this->options)->decodeJson();
  29222. if (empty($search['results'])) {
  29223. return [];
  29224. }
  29225. $results = [];
  29226. foreach ($search['results'] as $result) {
  29227. if (!empty($result['virtual'])) {
  29228. continue;
  29229. }
  29230. $results[] = $result;
  29231. }
  29232. return $results;
  29233. }
  29234. if ($mode === self::SEARCH_VENDOR) {
  29235. $results = [];
  29236. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  29237. $vendorNames = $this->getVendorNames();
  29238. foreach (Preg::grep($regex, $vendorNames) as $name) {
  29239. $results[] = ['name' => $name, 'description' => ''];
  29240. }
  29241. return $results;
  29242. }
  29243. if ($this->hasProviders() || $this->lazyProvidersUrl) {
  29244. if (Preg::isMatchStrictGroups('{^\^(?P<query>(?P<vendor>[a-z0-9_.-]+)/[a-z0-9_.-]*)\*?$}i', $query, $match) && $this->listUrl !== null) {
  29245. $url = $this->listUrl . '?vendor='.urlencode($match['vendor']).'&filter='.urlencode($match['query'].'*');
  29246. $result = $this->httpDownloader->get($url, $this->options)->decodeJson();
  29247. $results = [];
  29248. foreach ($result['packageNames'] as $name) {
  29249. $results[] = ['name' => $name, 'description' => ''];
  29250. }
  29251. return $results;
  29252. }
  29253. $results = [];
  29254. $regex = '{(?:'.implode('|', Preg::split('{\s+}', $query)).')}i';
  29255. $packageNames = $this->getPackageNames();
  29256. foreach (Preg::grep($regex, $packageNames) as $name) {
  29257. $results[] = ['name' => $name, 'description' => ''];
  29258. }
  29259. return $results;
  29260. }
  29261. return parent::search($query, $mode);
  29262. }
  29263. public function hasSecurityAdvisories(): bool
  29264. {
  29265. $this->loadRootServerFile(600);
  29266. return $this->securityAdvisoryConfig !== null && ($this->securityAdvisoryConfig['metadata'] || $this->securityAdvisoryConfig['api-url'] !== null);
  29267. }
  29268. public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array
  29269. {
  29270. $this->loadRootServerFile(600);
  29271. if (null === $this->securityAdvisoryConfig) {
  29272. return ['namesFound' => [], 'advisories' => []];
  29273. }
  29274. $advisories = [];
  29275. $namesFound = [];
  29276. $apiUrl = $this->securityAdvisoryConfig['api-url'];
  29277. if ($this->hasAvailablePackageList) {
  29278. foreach ($packageConstraintMap as $name => $constraint) {
  29279. if (!$this->lazyProvidersRepoContains(strtolower($name))) {
  29280. unset($packageConstraintMap[$name]);
  29281. }
  29282. }
  29283. }
  29284. $parser = new VersionParser();
  29285. $create = function (array $data, string $name) use ($parser, $allowPartialAdvisories, &$packageConstraintMap): ?PartialSecurityAdvisory {
  29286. $advisory = PartialSecurityAdvisory::create($name, $data, $parser);
  29287. if (!$allowPartialAdvisories && !$advisory instanceof SecurityAdvisory) {
  29288. throw new \RuntimeException('Advisory for '.$name.' could not be loaded as a full advisory from '.$this->getRepoName() . PHP_EOL . var_export($data, true));
  29289. }
  29290. if (!$advisory->affectedVersions->matches($packageConstraintMap[$name])) {
  29291. return null;
  29292. }
  29293. return $advisory;
  29294. };
  29295. if ($this->securityAdvisoryConfig['metadata'] && ($allowPartialAdvisories || $apiUrl === null)) {
  29296. $promises = [];
  29297. foreach ($packageConstraintMap as $name => $constraint) {
  29298. $name = strtolower($name);
  29299. if (PlatformRepository::isPlatformPackage($name) || '__root__' === $name) {
  29300. continue;
  29301. }
  29302. $promises[] = $this->startCachedAsyncDownload($name, $name)
  29303. ->then(static function (array $spec) use (&$advisories, &$namesFound, &$packageConstraintMap, $name, $create): void {
  29304. [$response, ] = $spec;
  29305. if (!isset($response['security-advisories']) || !is_array($response['security-advisories'])) {
  29306. return;
  29307. }
  29308. $namesFound[$name] = true;
  29309. if (count($response['security-advisories']) > 0) {
  29310. $advisories[$name] = array_filter(array_map(
  29311. static function ($data) use ($name, $create) {
  29312. return $create($data, $name);
  29313. },
  29314. $response['security-advisories']
  29315. ));
  29316. }
  29317. unset($packageConstraintMap[$name]);
  29318. });
  29319. }
  29320. $this->loop->wait($promises);
  29321. }
  29322. if ($apiUrl !== null && count($packageConstraintMap) > 0) {
  29323. $options = $this->options;
  29324. $options['http']['method'] = 'POST';
  29325. if (isset($options['http']['header'])) {
  29326. $options['http']['header'] = (array) $options['http']['header'];
  29327. }
  29328. $options['http']['header'][] = 'Content-type: application/x-www-form-urlencoded';
  29329. $options['http']['timeout'] = 10;
  29330. $options['http']['content'] = http_build_query(['packages' => array_keys($packageConstraintMap)]);
  29331. $response = $this->httpDownloader->get($apiUrl, $options);
  29332. $warned = false;
  29333. foreach ($response->decodeJson()['advisories'] as $name => $list) {
  29334. if (!isset($packageConstraintMap[$name])) {
  29335. if (!$warned) {
  29336. $this->io->writeError('<warning>'.$this->getRepoName().' returned names which were not requested in response to the security-advisories API. '.$name.' was not requested but is present in the response. Requested names were: '.implode(', ', array_keys($packageConstraintMap)).'</warning>');
  29337. $warned = true;
  29338. }
  29339. continue;
  29340. }
  29341. if (count($list) > 0) {
  29342. $advisories[$name] = array_filter(array_map(
  29343. static function ($data) use ($name, $create) {
  29344. return $create($data, $name);
  29345. },
  29346. $list
  29347. ));
  29348. }
  29349. $namesFound[$name] = true;
  29350. }
  29351. }
  29352. return ['namesFound' => array_keys($namesFound), 'advisories' => array_filter($advisories)];
  29353. }
  29354. public function getProviders(string $packageName)
  29355. {
  29356. $this->loadRootServerFile();
  29357. $result = [];
  29358. if ($this->providersApiUrl) {
  29359. try {
  29360. $apiResult = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
  29361. } catch (TransportException $e) {
  29362. if ($e->getStatusCode() === 404) {
  29363. return $result;
  29364. }
  29365. throw $e;
  29366. }
  29367. foreach ($apiResult['providers'] as $provider) {
  29368. $result[$provider['name']] = $provider;
  29369. }
  29370. return $result;
  29371. }
  29372. if ($this->hasPartialPackages()) {
  29373. if (!is_array($this->partialPackagesByName)) {
  29374. throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
  29375. }
  29376. foreach ($this->partialPackagesByName as $versions) {
  29377. foreach ($versions as $candidate) {
  29378. if (isset($result[$candidate['name']]) || !isset($candidate['provide'][$packageName])) {
  29379. continue;
  29380. }
  29381. $result[$candidate['name']] = [
  29382. 'name' => $candidate['name'],
  29383. 'description' => $candidate['description'] ?? '',
  29384. 'type' => $candidate['type'] ?? '',
  29385. ];
  29386. }
  29387. }
  29388. }
  29389. if ($this->packages) {
  29390. $result = array_merge($result, parent::getProviders($packageName));
  29391. }
  29392. return $result;
  29393. }
  29394. private function getProviderNames(): array
  29395. {
  29396. $this->loadRootServerFile();
  29397. if (null === $this->providerListing) {
  29398. $data = $this->loadRootServerFile();
  29399. if (is_array($data)) {
  29400. $this->loadProviderListings($data);
  29401. }
  29402. }
  29403. if ($this->lazyProvidersUrl) {
  29404. return [];
  29405. }
  29406. if (null !== $this->providersUrl && null !== $this->providerListing) {
  29407. return array_keys($this->providerListing);
  29408. }
  29409. return [];
  29410. }
  29411. protected function configurePackageTransportOptions(PackageInterface $package): void
  29412. {
  29413. foreach ($package->getDistUrls() as $url) {
  29414. if (strpos($url, $this->baseUrl) === 0) {
  29415. $package->setTransportOptions($this->options);
  29416. return;
  29417. }
  29418. }
  29419. }
  29420. private function hasProviders(): bool
  29421. {
  29422. $this->loadRootServerFile();
  29423. return $this->hasProviders;
  29424. }
  29425. private function whatProvides(string $name, ?array $acceptableStabilities = null, ?array $stabilityFlags = null, array $alreadyLoaded = []): array
  29426. {
  29427. $packagesSource = null;
  29428. if (!$this->hasPartialPackages() || !isset($this->partialPackagesByName[$name])) {
  29429. if (PlatformRepository::isPlatformPackage($name) || '__root__' === $name) {
  29430. return [];
  29431. }
  29432. if (null === $this->providerListing) {
  29433. $data = $this->loadRootServerFile();
  29434. if (is_array($data)) {
  29435. $this->loadProviderListings($data);
  29436. }
  29437. }
  29438. $useLastModifiedCheck = false;
  29439. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  29440. $hash = null;
  29441. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  29442. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  29443. $useLastModifiedCheck = true;
  29444. } elseif ($this->providersUrl) {
  29445. if (!isset($this->providerListing[$name])) {
  29446. return [];
  29447. }
  29448. $hash = $this->providerListing[$name]['sha256'];
  29449. $url = str_replace(['%package%', '%hash%'], [$name, $hash], $this->providersUrl);
  29450. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  29451. } else {
  29452. return [];
  29453. }
  29454. $packages = null;
  29455. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  29456. $packages = json_decode($this->cache->read($cacheKey), true);
  29457. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  29458. } elseif ($useLastModifiedCheck) {
  29459. if ($contents = $this->cache->read($cacheKey)) {
  29460. $contents = json_decode($contents, true);
  29461. if (isset($alreadyLoaded[$name])) {
  29462. $packages = $contents;
  29463. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  29464. } elseif (isset($contents['last-modified'])) {
  29465. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  29466. $packages = true === $response ? $contents : $response;
  29467. $packagesSource = true === $response ? 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')' : 'downloaded file ('.Url::sanitize($url).')';
  29468. }
  29469. }
  29470. }
  29471. if (!$packages) {
  29472. try {
  29473. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  29474. $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
  29475. } catch (TransportException $e) {
  29476. if ($this->lazyProvidersUrl && in_array($e->getStatusCode(), [404, 499], true)) {
  29477. $packages = ['packages' => []];
  29478. $packagesSource = 'not-found file ('.Url::sanitize($url).')';
  29479. if ($e->getStatusCode() === 499) {
  29480. $this->io->error('<warning>' . $e->getMessage() . '</warning>');
  29481. }
  29482. } else {
  29483. throw $e;
  29484. }
  29485. }
  29486. }
  29487. $loadingPartialPackage = false;
  29488. } else {
  29489. $packages = ['packages' => ['versions' => $this->partialPackagesByName[$name]]];
  29490. $packagesSource = 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')';
  29491. $loadingPartialPackage = true;
  29492. }
  29493. $result = [];
  29494. $versionsToLoad = [];
  29495. foreach ($packages['packages'] as $versions) {
  29496. foreach ($versions as $version) {
  29497. $normalizedName = strtolower($version['name']);
  29498. if ($normalizedName !== $name) {
  29499. continue;
  29500. }
  29501. if (!$loadingPartialPackage && $this->hasPartialPackages() && isset($this->partialPackagesByName[$normalizedName])) {
  29502. continue;
  29503. }
  29504. if (!isset($versionsToLoad[$version['uid']])) {
  29505. if (!isset($version['version_normalized'])) {
  29506. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  29507. } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
  29508. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  29509. }
  29510. if (isset($alreadyLoaded[$name][$version['version_normalized']])) {
  29511. continue;
  29512. }
  29513. if ($this->isVersionAcceptable(null, $normalizedName, $version, $acceptableStabilities, $stabilityFlags)) {
  29514. $versionsToLoad[$version['uid']] = $version;
  29515. }
  29516. }
  29517. }
  29518. }
  29519. $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
  29520. $uids = array_keys($versionsToLoad);
  29521. foreach ($loadedPackages as $index => $package) {
  29522. $package->setRepository($this);
  29523. $uid = $uids[$index];
  29524. if ($package instanceof AliasPackage) {
  29525. $aliased = $package->getAliasOf();
  29526. $aliased->setRepository($this);
  29527. $result[$uid] = $aliased;
  29528. $result[$uid.'-alias'] = $package;
  29529. } else {
  29530. $result[$uid] = $package;
  29531. }
  29532. }
  29533. return $result;
  29534. }
  29535. protected function initialize()
  29536. {
  29537. parent::initialize();
  29538. $repoData = $this->loadDataFromServer();
  29539. foreach ($this->createPackages($repoData, 'root file ('.Url::sanitize($this->getPackagesJsonUrl()).')') as $package) {
  29540. $this->addPackage($package);
  29541. }
  29542. }
  29543. public function addPackage(PackageInterface $package)
  29544. {
  29545. parent::addPackage($package);
  29546. $this->configurePackageTransportOptions($package);
  29547. }
  29548. private function loadAsyncPackages(array $packageNames, ?array $acceptableStabilities = null, ?array $stabilityFlags = null, array $alreadyLoaded = []): array
  29549. {
  29550. $this->loadRootServerFile();
  29551. $packages = [];
  29552. $namesFound = [];
  29553. $promises = [];
  29554. if (null === $this->lazyProvidersUrl) {
  29555. throw new \LogicException('loadAsyncPackages only supports v2 protocol composer repos with a metadata-url');
  29556. }
  29557. foreach ($packageNames as $name => $constraint) {
  29558. if ($acceptableStabilities === null || $stabilityFlags === null || StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, [$name], 'dev')) {
  29559. $packageNames[$name.'~dev'] = $constraint;
  29560. }
  29561. if (isset($acceptableStabilities['dev']) && count($acceptableStabilities) === 1 && count($stabilityFlags) === 0) {
  29562. unset($packageNames[$name]);
  29563. }
  29564. }
  29565. foreach ($packageNames as $name => $constraint) {
  29566. $name = strtolower($name);
  29567. $realName = Preg::replace('{~dev$}', '', $name);
  29568. if (PlatformRepository::isPlatformPackage($realName) || '__root__' === $realName) {
  29569. continue;
  29570. }
  29571. $promises[] = $this->startCachedAsyncDownload($name, $realName)
  29572. ->then(function (array $spec) use (&$packages, &$namesFound, $realName, $constraint, $acceptableStabilities, $stabilityFlags, $alreadyLoaded): void {
  29573. [$response, $packagesSource] = $spec;
  29574. if (null === $response || !isset($response['packages'][$realName])) {
  29575. return;
  29576. }
  29577. $versions = $response['packages'][$realName];
  29578. if (isset($response['minified']) && $response['minified'] === 'composer/2.0') {
  29579. $versions = MetadataMinifier::expand($versions);
  29580. }
  29581. $namesFound[$realName] = true;
  29582. $versionsToLoad = [];
  29583. foreach ($versions as $version) {
  29584. if (!isset($version['version_normalized'])) {
  29585. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  29586. } elseif ($version['version_normalized'] === VersionParser::DEFAULT_BRANCH_ALIAS) {
  29587. $version['version_normalized'] = $this->versionParser->normalize($version['version']);
  29588. }
  29589. if (isset($alreadyLoaded[$realName][$version['version_normalized']])) {
  29590. continue;
  29591. }
  29592. if ($this->isVersionAcceptable($constraint, $realName, $version, $acceptableStabilities, $stabilityFlags)) {
  29593. $versionsToLoad[] = $version;
  29594. }
  29595. }
  29596. $loadedPackages = $this->createPackages($versionsToLoad, $packagesSource);
  29597. foreach ($loadedPackages as $package) {
  29598. $package->setRepository($this);
  29599. $packages[spl_object_hash($package)] = $package;
  29600. if ($package instanceof AliasPackage && !isset($packages[spl_object_hash($package->getAliasOf())])) {
  29601. $package->getAliasOf()->setRepository($this);
  29602. $packages[spl_object_hash($package->getAliasOf())] = $package->getAliasOf();
  29603. }
  29604. }
  29605. });
  29606. }
  29607. $this->loop->wait($promises);
  29608. return ['namesFound' => $namesFound, 'packages' => $packages];
  29609. }
  29610. private function startCachedAsyncDownload(string $fileName, ?string $packageName = null): PromiseInterface
  29611. {
  29612. if (null === $this->lazyProvidersUrl) {
  29613. throw new \LogicException('startCachedAsyncDownload only supports v2 protocol composer repos with a metadata-url');
  29614. }
  29615. $name = strtolower($fileName);
  29616. $packageName = $packageName ?? $name;
  29617. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  29618. $cacheKey = 'provider-'.strtr($name, '/', '~').'.json';
  29619. $lastModified = null;
  29620. if ($contents = $this->cache->read($cacheKey)) {
  29621. $contents = json_decode($contents, true);
  29622. $lastModified = $contents['last-modified'] ?? null;
  29623. }
  29624. return $this->asyncFetchFile($url, $cacheKey, $lastModified)
  29625. ->then(static function ($response) use ($url, $cacheKey, $contents, $packageName): array {
  29626. $packagesSource = 'downloaded file ('.Url::sanitize($url).')';
  29627. if (true === $response) {
  29628. $packagesSource = 'cached file ('.$cacheKey.' originating from '.Url::sanitize($url).')';
  29629. $response = $contents;
  29630. }
  29631. if (!isset($response['packages'][$packageName]) && !isset($response['security-advisories'])) {
  29632. return [null, $packagesSource];
  29633. }
  29634. return [$response, $packagesSource];
  29635. });
  29636. }
  29637. private function isVersionAcceptable(?ConstraintInterface $constraint, string $name, array $versionData, ?array $acceptableStabilities = null, ?array $stabilityFlags = null): bool
  29638. {
  29639. $versions = [$versionData['version_normalized']];
  29640. if ($alias = $this->loader->getBranchAlias($versionData)) {
  29641. $versions[] = $alias;
  29642. }
  29643. foreach ($versions as $version) {
  29644. if (null !== $acceptableStabilities && null !== $stabilityFlags && !StabilityFilter::isPackageAcceptable($acceptableStabilities, $stabilityFlags, [$name], VersionParser::parseStability($version))) {
  29645. continue;
  29646. }
  29647. if ($constraint && !CompilingMatcher::match($constraint, Constraint::OP_EQ, $version)) {
  29648. continue;
  29649. }
  29650. return true;
  29651. }
  29652. return false;
  29653. }
  29654. private function getPackagesJsonUrl(): string
  29655. {
  29656. $jsonUrlParts = parse_url(strtr($this->url, '\\', '/'));
  29657. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  29658. return $this->url;
  29659. }
  29660. return $this->url . '/packages.json';
  29661. }
  29662. protected function loadRootServerFile(?int $rootMaxAge = null)
  29663. {
  29664. if (null !== $this->rootData) {
  29665. return $this->rootData;
  29666. }
  29667. if (!extension_loaded('openssl') && strpos($this->url, 'https') === 0) {
  29668. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  29669. }
  29670. if ($cachedData = $this->cache->read('packages.json')) {
  29671. $cachedData = json_decode($cachedData, true);
  29672. if ($rootMaxAge !== null && ($age = $this->cache->getAge('packages.json')) !== false && $age <= $rootMaxAge) {
  29673. $data = $cachedData;
  29674. } elseif (isset($cachedData['last-modified'])) {
  29675. $response = $this->fetchFileIfLastModified($this->getPackagesJsonUrl(), 'packages.json', $cachedData['last-modified']);
  29676. $data = true === $response ? $cachedData : $response;
  29677. }
  29678. }
  29679. if (!isset($data)) {
  29680. $data = $this->fetchFile($this->getPackagesJsonUrl(), 'packages.json', null, true);
  29681. }
  29682. if (!empty($data['notify-batch'])) {
  29683. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  29684. } elseif (!empty($data['notify'])) {
  29685. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  29686. }
  29687. if (!empty($data['search'])) {
  29688. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  29689. }
  29690. if (!empty($data['mirrors'])) {
  29691. foreach ($data['mirrors'] as $mirror) {
  29692. if (!empty($mirror['git-url'])) {
  29693. $this->sourceMirrors['git'][] = ['url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred'])];
  29694. }
  29695. if (!empty($mirror['hg-url'])) {
  29696. $this->sourceMirrors['hg'][] = ['url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred'])];
  29697. }
  29698. if (!empty($mirror['dist-url'])) {
  29699. $this->distMirrors[] = [
  29700. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  29701. 'preferred' => !empty($mirror['preferred']),
  29702. ];
  29703. }
  29704. }
  29705. }
  29706. if (!empty($data['providers-lazy-url'])) {
  29707. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  29708. $this->hasProviders = true;
  29709. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  29710. }
  29711. if (!empty($data['metadata-url'])) {
  29712. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['metadata-url']);
  29713. $this->providersUrl = null;
  29714. $this->hasProviders = false;
  29715. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  29716. $this->allowSslDowngrade = false;
  29717. if (!empty($data['available-packages'])) {
  29718. $availPackages = array_map('strtolower', $data['available-packages']);
  29719. $this->availablePackages = array_combine($availPackages, $availPackages);
  29720. $this->hasAvailablePackageList = true;
  29721. }
  29722. if (!empty($data['available-package-patterns'])) {
  29723. $this->availablePackagePatterns = array_map(static function ($pattern): string {
  29724. return BasePackage::packageNameToRegexp($pattern);
  29725. }, $data['available-package-patterns']);
  29726. $this->hasAvailablePackageList = true;
  29727. }
  29728. unset($data['providers-url'], $data['providers'], $data['providers-includes']);
  29729. if (isset($data['security-advisories']) && is_array($data['security-advisories'])) {
  29730. $this->securityAdvisoryConfig = [
  29731. 'metadata' => $data['security-advisories']['metadata'] ?? false,
  29732. 'api-url' => isset($data['security-advisories']['api-url']) && is_string($data['security-advisories']['api-url']) ? $this->canonicalizeUrl($data['security-advisories']['api-url']) : null,
  29733. ];
  29734. if ($this->securityAdvisoryConfig['api-url'] === null && !$this->hasAvailablePackageList) {
  29735. throw new \UnexpectedValueException('Invalid security advisory configuration on '.$this->getRepoName().': If the repository does not provide a security-advisories.api-url then available-packages or available-package-patterns are required to be provided for performance reason.');
  29736. }
  29737. }
  29738. }
  29739. if ($this->allowSslDowngrade) {
  29740. $this->url = str_replace('https://', 'http://', $this->url);
  29741. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  29742. }
  29743. if (!empty($data['providers-url'])) {
  29744. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  29745. $this->hasProviders = true;
  29746. }
  29747. if (!empty($data['list'])) {
  29748. $this->listUrl = $this->canonicalizeUrl($data['list']);
  29749. }
  29750. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  29751. $this->hasProviders = true;
  29752. }
  29753. if (!empty($data['providers-api'])) {
  29754. $this->providersApiUrl = $this->canonicalizeUrl($data['providers-api']);
  29755. }
  29756. return $this->rootData = $data;
  29757. }
  29758. private function canonicalizeUrl(string $url): string
  29759. {
  29760. if (strlen($url) === 0) {
  29761. throw new \InvalidArgumentException('Expected a string with a value and not an empty string');
  29762. }
  29763. if (str_starts_with($url, '/')) {
  29764. if (Preg::isMatch('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  29765. return $matches[0] . $url;
  29766. }
  29767. return $this->url;
  29768. }
  29769. return $url;
  29770. }
  29771. private function loadDataFromServer(): array
  29772. {
  29773. $data = $this->loadRootServerFile();
  29774. if (true === $data) {
  29775. throw new \LogicException('loadRootServerFile should not return true during initialization');
  29776. }
  29777. return $this->loadIncludes($data);
  29778. }
  29779. private function hasPartialPackages(): bool
  29780. {
  29781. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  29782. $this->initializePartialPackages();
  29783. }
  29784. return $this->hasPartialPackages;
  29785. }
  29786. private function loadProviderListings($data): void
  29787. {
  29788. if (isset($data['providers'])) {
  29789. if (!is_array($this->providerListing)) {
  29790. $this->providerListing = [];
  29791. }
  29792. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  29793. }
  29794. if ($this->providersUrl && isset($data['provider-includes'])) {
  29795. $includes = $data['provider-includes'];
  29796. foreach ($includes as $include => $metadata) {
  29797. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  29798. $cacheKey = str_replace(['%hash%','$'], '', $include);
  29799. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  29800. $includedData = json_decode($this->cache->read($cacheKey), true);
  29801. } else {
  29802. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  29803. }
  29804. $this->loadProviderListings($includedData);
  29805. }
  29806. }
  29807. }
  29808. private function loadIncludes(array $data): array
  29809. {
  29810. $packages = [];
  29811. if (!isset($data['packages']) && !isset($data['includes'])) {
  29812. foreach ($data as $pkg) {
  29813. if (isset($pkg['versions']) && is_array($pkg['versions'])) {
  29814. foreach ($pkg['versions'] as $metadata) {
  29815. $packages[] = $metadata;
  29816. }
  29817. }
  29818. }
  29819. return $packages;
  29820. }
  29821. if (isset($data['packages'])) {
  29822. foreach ($data['packages'] as $package => $versions) {
  29823. $packageName = strtolower((string) $package);
  29824. foreach ($versions as $version => $metadata) {
  29825. $packages[] = $metadata;
  29826. if (!$this->displayedWarningAboutNonMatchingPackageIndex && $packageName !== strtolower((string) ($metadata['name'] ?? ''))) {
  29827. $this->displayedWarningAboutNonMatchingPackageIndex = true;
  29828. $this->io->writeError(sprintf("<warning>Warning: the packages key '%s' doesn't match the name defined in the package metadata '%s' in repository %s</warning>", $package, $metadata['name'] ?? '', $this->baseUrl));
  29829. }
  29830. }
  29831. }
  29832. }
  29833. if (isset($data['includes'])) {
  29834. foreach ($data['includes'] as $include => $metadata) {
  29835. if (isset($metadata['sha1']) && $this->cache->sha1((string) $include) === $metadata['sha1']) {
  29836. $includedData = json_decode($this->cache->read((string) $include), true);
  29837. } else {
  29838. $includedData = $this->fetchFile($include);
  29839. }
  29840. $packages = array_merge($packages, $this->loadIncludes($includedData));
  29841. }
  29842. }
  29843. return $packages;
  29844. }
  29845. private function createPackages(array $packages, ?string $source = null): array
  29846. {
  29847. if (!$packages) {
  29848. return [];
  29849. }
  29850. try {
  29851. foreach ($packages as &$data) {
  29852. if (!isset($data['notification-url'])) {
  29853. $data['notification-url'] = $this->notifyUrl;
  29854. }
  29855. }
  29856. $packageInstances = $this->loader->loadPackages($packages);
  29857. foreach ($packageInstances as $package) {
  29858. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  29859. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  29860. }
  29861. $package->setDistMirrors($this->distMirrors);
  29862. $this->configurePackageTransportOptions($package);
  29863. }
  29864. return $packageInstances;
  29865. } catch (\Exception $e) {
  29866. throw new \RuntimeException('Could not load packages '.($packages[0]['name'] ?? json_encode($packages)).' in '.$this->getRepoName().($source ? ' from '.$source : '').': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  29867. }
  29868. }
  29869. protected function fetchFile(string $filename, ?string $cacheKey = null, ?string $sha256 = null, bool $storeLastModifiedTime = false)
  29870. {
  29871. if ('' === $filename) {
  29872. throw new \InvalidArgumentException('$filename should not be an empty string');
  29873. }
  29874. if (null === $cacheKey) {
  29875. $cacheKey = $filename;
  29876. $filename = $this->baseUrl.'/'.$filename;
  29877. }
  29878. if (($pos = strpos($filename, '$')) && Preg::isMatch('{^https?://}i', $filename)) {
  29879. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  29880. }
  29881. $retries = 3;
  29882. while ($retries--) {
  29883. try {
  29884. $options = $this->options;
  29885. if ($this->eventDispatcher) {
  29886. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
  29887. $preFileDownloadEvent->setTransportOptions($this->options);
  29888. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  29889. $filename = $preFileDownloadEvent->getProcessedUrl();
  29890. $options = $preFileDownloadEvent->getTransportOptions();
  29891. }
  29892. $response = $this->httpDownloader->get($filename, $options);
  29893. $json = (string) $response->getBody();
  29894. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  29895. if ($this->allowSslDowngrade) {
  29896. $this->url = str_replace('http://', 'https://', $this->url);
  29897. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  29898. $filename = str_replace('http://', 'https://', $filename);
  29899. }
  29900. if ($retries > 0) {
  29901. usleep(100000);
  29902. continue;
  29903. }
  29904. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  29905. }
  29906. if ($this->eventDispatcher) {
  29907. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, $sha256, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
  29908. $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  29909. }
  29910. $data = $response->decodeJson();
  29911. HttpDownloader::outputWarnings($this->io, $this->url, $data);
  29912. if ($cacheKey && !$this->cache->isReadOnly()) {
  29913. if ($storeLastModifiedTime) {
  29914. $lastModifiedDate = $response->getHeader('last-modified');
  29915. if ($lastModifiedDate) {
  29916. $data['last-modified'] = $lastModifiedDate;
  29917. $json = JsonFile::encode($data, 0);
  29918. }
  29919. }
  29920. $this->cache->write($cacheKey, $json);
  29921. }
  29922. $response->collect();
  29923. break;
  29924. } catch (\Exception $e) {
  29925. if ($e instanceof \LogicException) {
  29926. throw $e;
  29927. }
  29928. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  29929. throw $e;
  29930. }
  29931. if ($e instanceof RepositorySecurityException) {
  29932. throw $e;
  29933. }
  29934. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  29935. if (!$this->degradedMode) {
  29936. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  29937. }
  29938. $this->degradedMode = true;
  29939. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  29940. break;
  29941. }
  29942. throw $e;
  29943. }
  29944. }
  29945. if (!isset($data)) {
  29946. throw new \LogicException("ComposerRepository: Undefined \$data. Please report at https://github.com/composer/composer/issues/new.");
  29947. }
  29948. return $data;
  29949. }
  29950. private function fetchFileIfLastModified(string $filename, string $cacheKey, string $lastModifiedTime)
  29951. {
  29952. if ('' === $filename) {
  29953. throw new \InvalidArgumentException('$filename should not be an empty string');
  29954. }
  29955. try {
  29956. $options = $this->options;
  29957. if ($this->eventDispatcher) {
  29958. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
  29959. $preFileDownloadEvent->setTransportOptions($this->options);
  29960. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  29961. $filename = $preFileDownloadEvent->getProcessedUrl();
  29962. $options = $preFileDownloadEvent->getTransportOptions();
  29963. }
  29964. if (isset($options['http']['header'])) {
  29965. $options['http']['header'] = (array) $options['http']['header'];
  29966. }
  29967. $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
  29968. $response = $this->httpDownloader->get($filename, $options);
  29969. $json = (string) $response->getBody();
  29970. if ($json === '' && $response->getStatusCode() === 304) {
  29971. return true;
  29972. }
  29973. if ($this->eventDispatcher) {
  29974. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
  29975. $this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  29976. }
  29977. $data = $response->decodeJson();
  29978. HttpDownloader::outputWarnings($this->io, $this->url, $data);
  29979. $lastModifiedDate = $response->getHeader('last-modified');
  29980. $response->collect();
  29981. if ($lastModifiedDate) {
  29982. $data['last-modified'] = $lastModifiedDate;
  29983. $json = JsonFile::encode($data, 0);
  29984. }
  29985. if (!$this->cache->isReadOnly()) {
  29986. $this->cache->write($cacheKey, $json);
  29987. }
  29988. return $data;
  29989. } catch (\Exception $e) {
  29990. if ($e instanceof \LogicException) {
  29991. throw $e;
  29992. }
  29993. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  29994. throw $e;
  29995. }
  29996. if (!$this->degradedMode) {
  29997. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  29998. }
  29999. $this->degradedMode = true;
  30000. return true;
  30001. }
  30002. }
  30003. private function asyncFetchFile(string $filename, string $cacheKey, ?string $lastModifiedTime = null): PromiseInterface
  30004. {
  30005. if ('' === $filename) {
  30006. throw new \InvalidArgumentException('$filename should not be an empty string');
  30007. }
  30008. if (isset($this->packagesNotFoundCache[$filename])) {
  30009. return \React\Promise\resolve(['packages' => []]);
  30010. }
  30011. if (isset($this->freshMetadataUrls[$filename]) && $lastModifiedTime) {
  30012. $promise = \React\Promise\resolve(true);
  30013. return $promise;
  30014. }
  30015. $httpDownloader = $this->httpDownloader;
  30016. $options = $this->options;
  30017. if ($this->eventDispatcher) {
  30018. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', ['repository' => $this]);
  30019. $preFileDownloadEvent->setTransportOptions($this->options);
  30020. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  30021. $filename = $preFileDownloadEvent->getProcessedUrl();
  30022. $options = $preFileDownloadEvent->getTransportOptions();
  30023. }
  30024. if ($lastModifiedTime) {
  30025. if (isset($options['http']['header'])) {
  30026. $options['http']['header'] = (array) $options['http']['header'];
  30027. }
  30028. $options['http']['header'][] = 'If-Modified-Since: '.$lastModifiedTime;
  30029. }
  30030. $io = $this->io;
  30031. $url = $this->url;
  30032. $cache = $this->cache;
  30033. $degradedMode = &$this->degradedMode;
  30034. $eventDispatcher = $this->eventDispatcher;
  30035. $accept = function ($response) use ($io, $url, $filename, $cache, $cacheKey, $eventDispatcher) {
  30036. if ($response->getStatusCode() === 404) {
  30037. $this->packagesNotFoundCache[$filename] = true;
  30038. return ['packages' => []];
  30039. }
  30040. $json = (string) $response->getBody();
  30041. if ($json === '' && $response->getStatusCode() === 304) {
  30042. $this->freshMetadataUrls[$filename] = true;
  30043. return true;
  30044. }
  30045. if ($eventDispatcher) {
  30046. $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', ['response' => $response, 'repository' => $this]);
  30047. $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
  30048. }
  30049. $data = $response->decodeJson();
  30050. HttpDownloader::outputWarnings($io, $url, $data);
  30051. $lastModifiedDate = $response->getHeader('last-modified');
  30052. $response->collect();
  30053. if ($lastModifiedDate) {
  30054. $data['last-modified'] = $lastModifiedDate;
  30055. $json = JsonFile::encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  30056. }
  30057. if (!$cache->isReadOnly()) {
  30058. $cache->write($cacheKey, $json);
  30059. }
  30060. $this->freshMetadataUrls[$filename] = true;
  30061. return $data;
  30062. };
  30063. $reject = function ($e) use ($filename, $accept, $io, $url, &$degradedMode, $lastModifiedTime) {
  30064. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  30065. $this->packagesNotFoundCache[$filename] = true;
  30066. return false;
  30067. }
  30068. if (!$degradedMode) {
  30069. $io->writeError('<warning>'.$url.' could not be fully loaded ('.$e->getMessage().'), package information was loaded from the local cache and may be out of date</warning>');
  30070. }
  30071. $degradedMode = true;
  30072. if ($lastModifiedTime) {
  30073. return $accept(new Response(['url' => $url], 304, [], ''));
  30074. }
  30075. if ($e instanceof TransportException && $e->getStatusCode() === 499) {
  30076. return $accept(new Response(['url' => $url], 404, [], ''));
  30077. }
  30078. throw $e;
  30079. };
  30080. return $httpDownloader->add($filename, $options)->then($accept, $reject);
  30081. }
  30082. private function initializePartialPackages(): void
  30083. {
  30084. $rootData = $this->loadRootServerFile();
  30085. if ($rootData === true) {
  30086. return;
  30087. }
  30088. $this->partialPackagesByName = [];
  30089. foreach ($rootData['packages'] as $package => $versions) {
  30090. foreach ($versions as $version) {
  30091. $versionPackageName = strtolower((string) ($version['name'] ?? ''));
  30092. $this->partialPackagesByName[$versionPackageName][] = $version;
  30093. if (!$this->displayedWarningAboutNonMatchingPackageIndex && $versionPackageName !== strtolower($package)) {
  30094. $this->io->writeError(sprintf("<warning>Warning: the packages key '%s' doesn't match the name defined in the package metadata '%s' in repository %s</warning>", $package, $version['name'] ?? '', $this->baseUrl));
  30095. $this->displayedWarningAboutNonMatchingPackageIndex = true;
  30096. }
  30097. }
  30098. }
  30099. $this->rootData = true;
  30100. }
  30101. protected function lazyProvidersRepoContains(string $name)
  30102. {
  30103. if (!$this->hasAvailablePackageList) {
  30104. throw new \LogicException('lazyProvidersRepoContains should not be called unless hasAvailablePackageList is true');
  30105. }
  30106. if (is_array($this->availablePackages) && isset($this->availablePackages[$name])) {
  30107. return true;
  30108. }
  30109. if (is_array($this->availablePackagePatterns)) {
  30110. foreach ($this->availablePackagePatterns as $providerRegex) {
  30111. if (Preg::isMatch($providerRegex, $name)) {
  30112. return true;
  30113. }
  30114. }
  30115. }
  30116. return false;
  30117. }
  30118. }
  30119. <?php declare(strict_types=1);
  30120. namespace Composer\Repository;
  30121. use Composer\Package\BasePackage;
  30122. use Composer\Package\PackageInterface;
  30123. class CompositeRepository implements RepositoryInterface
  30124. {
  30125. private $repositories;
  30126. public function __construct(array $repositories)
  30127. {
  30128. $this->repositories = [];
  30129. foreach ($repositories as $repo) {
  30130. $this->addRepository($repo);
  30131. }
  30132. }
  30133. public function getRepoName(): string
  30134. {
  30135. return 'composite repo ('.implode(', ', array_map(static function ($repo): string {
  30136. return $repo->getRepoName();
  30137. }, $this->repositories)).')';
  30138. }
  30139. public function getRepositories(): array
  30140. {
  30141. return $this->repositories;
  30142. }
  30143. public function hasPackage(PackageInterface $package): bool
  30144. {
  30145. foreach ($this->repositories as $repository) {
  30146. if ($repository->hasPackage($package)) {
  30147. return true;
  30148. }
  30149. }
  30150. return false;
  30151. }
  30152. public function findPackage($name, $constraint): ?BasePackage
  30153. {
  30154. foreach ($this->repositories as $repository) {
  30155. $package = $repository->findPackage($name, $constraint);
  30156. if (null !== $package) {
  30157. return $package;
  30158. }
  30159. }
  30160. return null;
  30161. }
  30162. public function findPackages($name, $constraint = null): array
  30163. {
  30164. $packages = [];
  30165. foreach ($this->repositories as $repository) {
  30166. $packages[] = $repository->findPackages($name, $constraint);
  30167. }
  30168. return $packages ? array_merge(...$packages) : [];
  30169. }
  30170. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []): array
  30171. {
  30172. $packages = [];
  30173. $namesFound = [];
  30174. foreach ($this->repositories as $repository) {
  30175. $result = $repository->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  30176. $packages[] = $result['packages'];
  30177. $namesFound[] = $result['namesFound'];
  30178. }
  30179. return [
  30180. 'packages' => $packages ? array_merge(...$packages) : [],
  30181. 'namesFound' => $namesFound ? array_unique(array_merge(...$namesFound)) : [],
  30182. ];
  30183. }
  30184. public function search(string $query, int $mode = 0, ?string $type = null): array
  30185. {
  30186. $matches = [];
  30187. foreach ($this->repositories as $repository) {
  30188. $matches[] = $repository->search($query, $mode, $type);
  30189. }
  30190. return \count($matches) > 0 ? array_merge(...$matches) : [];
  30191. }
  30192. public function getPackages(): array
  30193. {
  30194. $packages = [];
  30195. foreach ($this->repositories as $repository) {
  30196. $packages[] = $repository->getPackages();
  30197. }
  30198. return $packages ? array_merge(...$packages) : [];
  30199. }
  30200. public function getProviders($packageName): array
  30201. {
  30202. $results = [];
  30203. foreach ($this->repositories as $repository) {
  30204. $results[] = $repository->getProviders($packageName);
  30205. }
  30206. return $results ? array_merge(...$results) : [];
  30207. }
  30208. public function removePackage(PackageInterface $package): void
  30209. {
  30210. foreach ($this->repositories as $repository) {
  30211. if ($repository instanceof WritableRepositoryInterface) {
  30212. $repository->removePackage($package);
  30213. }
  30214. }
  30215. }
  30216. public function count(): int
  30217. {
  30218. $total = 0;
  30219. foreach ($this->repositories as $repository) {
  30220. $total += $repository->count();
  30221. }
  30222. return $total;
  30223. }
  30224. public function addRepository(RepositoryInterface $repository): void
  30225. {
  30226. if ($repository instanceof self) {
  30227. foreach ($repository->getRepositories() as $repo) {
  30228. $this->addRepository($repo);
  30229. }
  30230. } else {
  30231. $this->repositories[] = $repository;
  30232. }
  30233. }
  30234. }
  30235. <?php declare(strict_types=1);
  30236. namespace Composer\Repository;
  30237. interface ConfigurableRepositoryInterface
  30238. {
  30239. public function getRepoConfig();
  30240. }
  30241. <?php declare(strict_types=1);
  30242. namespace Composer\Repository;
  30243. use Composer\Json\JsonFile;
  30244. use Composer\Package\Loader\ArrayLoader;
  30245. use Composer\Package\PackageInterface;
  30246. use Composer\Package\RootAliasPackage;
  30247. use Composer\Package\RootPackageInterface;
  30248. use Composer\Package\AliasPackage;
  30249. use Composer\Package\Dumper\ArrayDumper;
  30250. use Composer\Installer\InstallationManager;
  30251. use Composer\Pcre\Preg;
  30252. use Composer\Util\Filesystem;
  30253. use Composer\Util\Platform;
  30254. class FilesystemRepository extends WritableArrayRepository
  30255. {
  30256. protected $file;
  30257. private $dumpVersions;
  30258. private $rootPackage;
  30259. private $filesystem;
  30260. private $devMode = null;
  30261. public function __construct(JsonFile $repositoryFile, bool $dumpVersions = false, ?RootPackageInterface $rootPackage = null, ?Filesystem $filesystem = null)
  30262. {
  30263. parent::__construct();
  30264. $this->file = $repositoryFile;
  30265. $this->dumpVersions = $dumpVersions;
  30266. $this->rootPackage = $rootPackage;
  30267. $this->filesystem = $filesystem ?: new Filesystem;
  30268. if ($dumpVersions && !$rootPackage) {
  30269. throw new \InvalidArgumentException('Expected a root package instance if $dumpVersions is true');
  30270. }
  30271. }
  30272. public function getDevMode()
  30273. {
  30274. return $this->devMode;
  30275. }
  30276. protected function initialize()
  30277. {
  30278. parent::initialize();
  30279. if (!$this->file->exists()) {
  30280. return;
  30281. }
  30282. try {
  30283. $data = $this->file->read();
  30284. if (isset($data['packages'])) {
  30285. $packages = $data['packages'];
  30286. } else {
  30287. $packages = $data;
  30288. }
  30289. if (isset($data['dev-package-names'])) {
  30290. $this->setDevPackageNames($data['dev-package-names']);
  30291. }
  30292. if (isset($data['dev'])) {
  30293. $this->devMode = $data['dev'];
  30294. }
  30295. if (!is_array($packages)) {
  30296. throw new \UnexpectedValueException('Could not parse package list from the repository');
  30297. }
  30298. } catch (\Exception $e) {
  30299. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  30300. }
  30301. $loader = new ArrayLoader(null, true);
  30302. foreach ($packages as $packageData) {
  30303. $package = $loader->load($packageData);
  30304. $this->addPackage($package);
  30305. }
  30306. }
  30307. public function reload()
  30308. {
  30309. $this->packages = null;
  30310. $this->initialize();
  30311. }
  30312. public function write(bool $devMode, InstallationManager $installationManager)
  30313. {
  30314. $data = ['packages' => [], 'dev' => $devMode, 'dev-package-names' => []];
  30315. $dumper = new ArrayDumper();
  30316. $repoDir = dirname($this->file->getPath());
  30317. $this->filesystem->ensureDirectoryExists($repoDir);
  30318. $repoDir = $this->filesystem->normalizePath(realpath($repoDir));
  30319. $installPaths = [];
  30320. foreach ($this->getCanonicalPackages() as $package) {
  30321. $pkgArray = $dumper->dump($package);
  30322. $path = $installationManager->getInstallPath($package);
  30323. $installPath = null;
  30324. if ('' !== $path && null !== $path) {
  30325. $normalizedPath = $this->filesystem->normalizePath($this->filesystem->isAbsolutePath($path) ? $path : Platform::getCwd() . '/' . $path);
  30326. $installPath = $this->filesystem->findShortestPath($repoDir, $normalizedPath, true);
  30327. }
  30328. $installPaths[$package->getName()] = $installPath;
  30329. $pkgArray['install-path'] = $installPath;
  30330. $data['packages'][] = $pkgArray;
  30331. if (in_array($package->getName(), $this->devPackageNames, true)) {
  30332. $data['dev-package-names'][] = $package->getName();
  30333. }
  30334. }
  30335. sort($data['dev-package-names']);
  30336. usort($data['packages'], static function ($a, $b): int {
  30337. return strcmp($a['name'], $b['name']);
  30338. });
  30339. $this->file->write($data);
  30340. if ($this->dumpVersions) {
  30341. $versions = $this->generateInstalledVersions($installationManager, $installPaths, $devMode, $repoDir);
  30342. $this->filesystem->filePutContentsIfModified($repoDir.'/installed.php', '<?php return ' . $this->dumpToPhpCode($versions) . ';'."\n");
  30343. $installedVersionsClass = file_get_contents(__DIR__.'/../InstalledVersions.php');
  30344. if ($installedVersionsClass !== false) {
  30345. $this->filesystem->filePutContentsIfModified($repoDir.'/InstalledVersions.php', $installedVersionsClass);
  30346. \Composer\InstalledVersions::reload($versions);
  30347. }
  30348. }
  30349. }
  30350. public static function safelyLoadInstalledVersions(string $path): bool
  30351. {
  30352. $installedVersionsData = @file_get_contents($path);
  30353. $pattern = <<<'REGEX'
  30354. {(?(DEFINE)
  30355. (?<number> -? \s*+ \d++ (?:\.\d++)? )
  30356. (?<boolean> true | false | null )
  30357. (?<strings> (?&string) (?: \s*+ \. \s*+ (?&string))*+ )
  30358. (?<string> (?: " (?:[^"\\$]*+ | \\ ["\\0] )* " | ' (?:[^'\\]*+ | \\ ['\\] )* ' ) )
  30359. (?<array> array\( \s*+ (?: (?:(?&number)|(?&strings)) \s*+ => \s*+ (?: (?:__DIR__ \s*+ \. \s*+)? (?&strings) | (?&value) ) \s*+, \s*+ )*+ \s*+ \) )
  30360. (?<value> (?: (?&number) | (?&boolean) | (?&strings) | (?&array) ) )
  30361. )
  30362. ^<\?php\s++return\s++(?&array)\s*+;$}ix
  30363. REGEX;
  30364. if (is_string($installedVersionsData) && Preg::isMatch($pattern, trim($installedVersionsData))) {
  30365. \Composer\InstalledVersions::reload(eval('?>'.Preg::replace('{=>\s*+__DIR__\s*+\.\s*+([\'"])}', '=> '.var_export(dirname($path), true).' . $1', $installedVersionsData)));
  30366. return true;
  30367. }
  30368. return false;
  30369. }
  30370. private function dumpToPhpCode(array $array = [], int $level = 0): string
  30371. {
  30372. $lines = "array(\n";
  30373. $level++;
  30374. foreach ($array as $key => $value) {
  30375. $lines .= str_repeat(' ', $level);
  30376. $lines .= is_int($key) ? $key . ' => ' : var_export($key, true) . ' => ';
  30377. if (is_array($value)) {
  30378. if (!empty($value)) {
  30379. $lines .= $this->dumpToPhpCode($value, $level);
  30380. } else {
  30381. $lines .= "array(),\n";
  30382. }
  30383. } elseif ($key === 'install_path' && is_string($value)) {
  30384. if ($this->filesystem->isAbsolutePath($value)) {
  30385. $lines .= var_export($value, true) . ",\n";
  30386. } else {
  30387. $lines .= "__DIR__ . " . var_export('/' . $value, true) . ",\n";
  30388. }
  30389. } elseif (is_string($value)) {
  30390. $lines .= var_export($value, true) . ",\n";
  30391. } elseif (is_bool($value)) {
  30392. $lines .= ($value ? 'true' : 'false') . ",\n";
  30393. } elseif (is_null($value)) {
  30394. $lines .= "null,\n";
  30395. } else {
  30396. throw new \UnexpectedValueException('Unexpected type '.gettype($value));
  30397. }
  30398. }
  30399. $lines .= str_repeat(' ', $level - 1) . ')' . ($level - 1 === 0 ? '' : ",\n");
  30400. return $lines;
  30401. }
  30402. private function generateInstalledVersions(InstallationManager $installationManager, array $installPaths, bool $devMode, string $repoDir): array
  30403. {
  30404. $devPackages = array_flip($this->devPackageNames);
  30405. $packages = $this->getPackages();
  30406. if (null === $this->rootPackage) {
  30407. throw new \LogicException('It should not be possible to dump packages if no root package is given');
  30408. }
  30409. $packages[] = $rootPackage = $this->rootPackage;
  30410. while ($rootPackage instanceof RootAliasPackage) {
  30411. $rootPackage = $rootPackage->getAliasOf();
  30412. $packages[] = $rootPackage;
  30413. }
  30414. $versions = [
  30415. 'root' => $this->dumpRootPackage($rootPackage, $installPaths, $devMode, $repoDir, $devPackages),
  30416. 'versions' => [],
  30417. ];
  30418. foreach ($packages as $package) {
  30419. if ($package instanceof AliasPackage) {
  30420. continue;
  30421. }
  30422. $versions['versions'][$package->getName()] = $this->dumpInstalledPackage($package, $installPaths, $repoDir, $devPackages);
  30423. }
  30424. foreach ($packages as $package) {
  30425. $isDevPackage = isset($devPackages[$package->getName()]);
  30426. foreach ($package->getReplaces() as $replace) {
  30427. if (PlatformRepository::isPlatformPackage($replace->getTarget())) {
  30428. continue;
  30429. }
  30430. if (!isset($versions['versions'][$replace->getTarget()]['dev_requirement'])) {
  30431. $versions['versions'][$replace->getTarget()]['dev_requirement'] = $isDevPackage;
  30432. } elseif (!$isDevPackage) {
  30433. $versions['versions'][$replace->getTarget()]['dev_requirement'] = false;
  30434. }
  30435. $replaced = $replace->getPrettyConstraint();
  30436. if ($replaced === 'self.version') {
  30437. $replaced = $package->getPrettyVersion();
  30438. }
  30439. if (!isset($versions['versions'][$replace->getTarget()]['replaced']) || !in_array($replaced, $versions['versions'][$replace->getTarget()]['replaced'], true)) {
  30440. $versions['versions'][$replace->getTarget()]['replaced'][] = $replaced;
  30441. }
  30442. }
  30443. foreach ($package->getProvides() as $provide) {
  30444. if (PlatformRepository::isPlatformPackage($provide->getTarget())) {
  30445. continue;
  30446. }
  30447. if (!isset($versions['versions'][$provide->getTarget()]['dev_requirement'])) {
  30448. $versions['versions'][$provide->getTarget()]['dev_requirement'] = $isDevPackage;
  30449. } elseif (!$isDevPackage) {
  30450. $versions['versions'][$provide->getTarget()]['dev_requirement'] = false;
  30451. }
  30452. $provided = $provide->getPrettyConstraint();
  30453. if ($provided === 'self.version') {
  30454. $provided = $package->getPrettyVersion();
  30455. }
  30456. if (!isset($versions['versions'][$provide->getTarget()]['provided']) || !in_array($provided, $versions['versions'][$provide->getTarget()]['provided'], true)) {
  30457. $versions['versions'][$provide->getTarget()]['provided'][] = $provided;
  30458. }
  30459. }
  30460. }
  30461. foreach ($packages as $package) {
  30462. if (!$package instanceof AliasPackage) {
  30463. continue;
  30464. }
  30465. $versions['versions'][$package->getName()]['aliases'][] = $package->getPrettyVersion();
  30466. if ($package instanceof RootPackageInterface) {
  30467. $versions['root']['aliases'][] = $package->getPrettyVersion();
  30468. }
  30469. }
  30470. ksort($versions['versions']);
  30471. ksort($versions);
  30472. return $versions;
  30473. }
  30474. private function dumpInstalledPackage(PackageInterface $package, array $installPaths, string $repoDir, array $devPackages): array
  30475. {
  30476. $reference = null;
  30477. if ($package->getInstallationSource()) {
  30478. $reference = $package->getInstallationSource() === 'source' ? $package->getSourceReference() : $package->getDistReference();
  30479. }
  30480. if (null === $reference) {
  30481. $reference = ($package->getSourceReference() ?: $package->getDistReference()) ?: null;
  30482. }
  30483. if ($package instanceof RootPackageInterface) {
  30484. $to = $this->filesystem->normalizePath(realpath(Platform::getCwd()));
  30485. $installPath = $this->filesystem->findShortestPath($repoDir, $to, true);
  30486. } else {
  30487. $installPath = $installPaths[$package->getName()];
  30488. }
  30489. $data = [
  30490. 'pretty_version' => $package->getPrettyVersion(),
  30491. 'version' => $package->getVersion(),
  30492. 'reference' => $reference,
  30493. 'type' => $package->getType(),
  30494. 'install_path' => $installPath,
  30495. 'aliases' => [],
  30496. 'dev_requirement' => isset($devPackages[$package->getName()]),
  30497. ];
  30498. return $data;
  30499. }
  30500. private function dumpRootPackage(RootPackageInterface $package, array $installPaths, bool $devMode, string $repoDir, array $devPackages)
  30501. {
  30502. $data = $this->dumpInstalledPackage($package, $installPaths, $repoDir, $devPackages);
  30503. return [
  30504. 'name' => $package->getName(),
  30505. 'pretty_version' => $data['pretty_version'],
  30506. 'version' => $data['version'],
  30507. 'reference' => $data['reference'],
  30508. 'type' => $data['type'],
  30509. 'install_path' => $data['install_path'],
  30510. 'aliases' => $data['aliases'],
  30511. 'dev' => $devMode,
  30512. ];
  30513. }
  30514. }
  30515. <?php declare(strict_types=1);
  30516. namespace Composer\Repository;
  30517. use Composer\Package\PackageInterface;
  30518. use Composer\Package\BasePackage;
  30519. use Composer\Pcre\Preg;
  30520. class FilterRepository implements RepositoryInterface, AdvisoryProviderInterface
  30521. {
  30522. private $only = null;
  30523. private $exclude = null;
  30524. private $canonical = true;
  30525. private $repo;
  30526. public function __construct(RepositoryInterface $repo, array $options)
  30527. {
  30528. if (isset($options['only'])) {
  30529. if (!is_array($options['only'])) {
  30530. throw new \InvalidArgumentException('"only" key for repository '.$repo->getRepoName().' should be an array');
  30531. }
  30532. $this->only = BasePackage::packageNamesToRegexp($options['only']);
  30533. }
  30534. if (isset($options['exclude'])) {
  30535. if (!is_array($options['exclude'])) {
  30536. throw new \InvalidArgumentException('"exclude" key for repository '.$repo->getRepoName().' should be an array');
  30537. }
  30538. $this->exclude = BasePackage::packageNamesToRegexp($options['exclude']);
  30539. }
  30540. if ($this->exclude && $this->only) {
  30541. throw new \InvalidArgumentException('Only one of "only" and "exclude" can be specified for repository '.$repo->getRepoName());
  30542. }
  30543. if (isset($options['canonical'])) {
  30544. if (!is_bool($options['canonical'])) {
  30545. throw new \InvalidArgumentException('"canonical" key for repository '.$repo->getRepoName().' should be a boolean');
  30546. }
  30547. $this->canonical = $options['canonical'];
  30548. }
  30549. $this->repo = $repo;
  30550. }
  30551. public function getRepoName(): string
  30552. {
  30553. return $this->repo->getRepoName();
  30554. }
  30555. public function getRepository(): RepositoryInterface
  30556. {
  30557. return $this->repo;
  30558. }
  30559. public function hasPackage(PackageInterface $package): bool
  30560. {
  30561. return $this->repo->hasPackage($package);
  30562. }
  30563. public function findPackage($name, $constraint): ?BasePackage
  30564. {
  30565. if (!$this->isAllowed($name)) {
  30566. return null;
  30567. }
  30568. return $this->repo->findPackage($name, $constraint);
  30569. }
  30570. public function findPackages($name, $constraint = null): array
  30571. {
  30572. if (!$this->isAllowed($name)) {
  30573. return [];
  30574. }
  30575. return $this->repo->findPackages($name, $constraint);
  30576. }
  30577. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []): array
  30578. {
  30579. foreach ($packageNameMap as $name => $constraint) {
  30580. if (!$this->isAllowed($name)) {
  30581. unset($packageNameMap[$name]);
  30582. }
  30583. }
  30584. if (!$packageNameMap) {
  30585. return ['namesFound' => [], 'packages' => []];
  30586. }
  30587. $result = $this->repo->loadPackages($packageNameMap, $acceptableStabilities, $stabilityFlags, $alreadyLoaded);
  30588. if (!$this->canonical) {
  30589. $result['namesFound'] = [];
  30590. }
  30591. return $result;
  30592. }
  30593. public function search(string $query, int $mode = 0, ?string $type = null): array
  30594. {
  30595. $result = [];
  30596. foreach ($this->repo->search($query, $mode, $type) as $package) {
  30597. if ($this->isAllowed($package['name'])) {
  30598. $result[] = $package;
  30599. }
  30600. }
  30601. return $result;
  30602. }
  30603. public function getPackages(): array
  30604. {
  30605. $result = [];
  30606. foreach ($this->repo->getPackages() as $package) {
  30607. if ($this->isAllowed($package->getName())) {
  30608. $result[] = $package;
  30609. }
  30610. }
  30611. return $result;
  30612. }
  30613. public function getProviders($packageName): array
  30614. {
  30615. $result = [];
  30616. foreach ($this->repo->getProviders($packageName) as $name => $provider) {
  30617. if ($this->isAllowed($provider['name'])) {
  30618. $result[$name] = $provider;
  30619. }
  30620. }
  30621. return $result;
  30622. }
  30623. public function count(): int
  30624. {
  30625. if ($this->repo->count() > 0) {
  30626. return count($this->getPackages());
  30627. }
  30628. return 0;
  30629. }
  30630. public function hasSecurityAdvisories(): bool
  30631. {
  30632. if (!$this->repo instanceof AdvisoryProviderInterface) {
  30633. return false;
  30634. }
  30635. return $this->repo->hasSecurityAdvisories();
  30636. }
  30637. public function getSecurityAdvisories(array $packageConstraintMap, bool $allowPartialAdvisories = false): array
  30638. {
  30639. if (!$this->repo instanceof AdvisoryProviderInterface) {
  30640. return ['namesFound' => [], 'advisories' => []];
  30641. }
  30642. foreach ($packageConstraintMap as $name => $constraint) {
  30643. if (!$this->isAllowed($name)) {
  30644. unset($packageConstraintMap[$name]);
  30645. }
  30646. }
  30647. return $this->repo->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories);
  30648. }
  30649. private function isAllowed(string $name): bool
  30650. {
  30651. if (!$this->only && !$this->exclude) {
  30652. return true;
  30653. }
  30654. if ($this->only) {
  30655. return Preg::isMatch($this->only, $name);
  30656. }
  30657. if ($this->exclude === null) {
  30658. return true;
  30659. }
  30660. return !Preg::isMatch($this->exclude, $name);
  30661. }
  30662. }
  30663. <?php declare(strict_types=1);
  30664. namespace Composer\Repository;
  30665. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  30666. {
  30667. public function getRepoName(): string
  30668. {
  30669. return 'installed '.parent::getRepoName();
  30670. }
  30671. public function isFresh(): bool
  30672. {
  30673. return $this->count() === 0;
  30674. }
  30675. }
  30676. <?php declare(strict_types=1);
  30677. namespace Composer\Repository;
  30678. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  30679. {
  30680. public function getRepoName()
  30681. {
  30682. return 'installed '.parent::getRepoName();
  30683. }
  30684. public function isFresh()
  30685. {
  30686. return !$this->file->exists();
  30687. }
  30688. }
  30689. <?php declare(strict_types=1);
  30690. namespace Composer\Repository;
  30691. use Composer\Package\BasePackage;
  30692. use Composer\Package\PackageInterface;
  30693. use Composer\Package\Version\VersionParser;
  30694. use Composer\Semver\Constraint\ConstraintInterface;
  30695. use Composer\Semver\Constraint\Constraint;
  30696. use Composer\Semver\Constraint\MatchAllConstraint;
  30697. use Composer\Package\RootPackageInterface;
  30698. use Composer\Package\Link;
  30699. class InstalledRepository extends CompositeRepository
  30700. {
  30701. public function findPackagesWithReplacersAndProviders(string $name, $constraint = null): array
  30702. {
  30703. $name = strtolower($name);
  30704. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  30705. $versionParser = new VersionParser();
  30706. $constraint = $versionParser->parseConstraints($constraint);
  30707. }
  30708. $matches = [];
  30709. foreach ($this->getRepositories() as $repo) {
  30710. foreach ($repo->getPackages() as $candidate) {
  30711. if ($name === $candidate->getName()) {
  30712. if (null === $constraint || $constraint->matches(new Constraint('==', $candidate->getVersion()))) {
  30713. $matches[] = $candidate;
  30714. }
  30715. continue;
  30716. }
  30717. foreach (array_merge($candidate->getProvides(), $candidate->getReplaces()) as $link) {
  30718. if (
  30719. $name === $link->getTarget()
  30720. && ($constraint === null || $constraint->matches($link->getConstraint()))
  30721. ) {
  30722. $matches[] = $candidate;
  30723. continue 2;
  30724. }
  30725. }
  30726. }
  30727. }
  30728. return $matches;
  30729. }
  30730. public function getDependents($needle, ?ConstraintInterface $constraint = null, bool $invert = false, bool $recurse = true, ?array $packagesFound = null): array
  30731. {
  30732. $needles = array_map('strtolower', (array) $needle);
  30733. $results = [];
  30734. if (null === $packagesFound) {
  30735. $packagesFound = $needles;
  30736. }
  30737. $rootPackage = null;
  30738. foreach ($this->getPackages() as $package) {
  30739. if ($package instanceof RootPackageInterface) {
  30740. $rootPackage = $package;
  30741. break;
  30742. }
  30743. }
  30744. foreach ($this->getPackages() as $package) {
  30745. $links = $package->getRequires();
  30746. $packagesInTree = $packagesFound;
  30747. if (!$invert) {
  30748. $links += $package->getReplaces();
  30749. foreach ($package->getReplaces() as $link) {
  30750. foreach ($needles as $needle) {
  30751. if ($link->getSource() === $needle) {
  30752. if ($constraint === null || ($link->getConstraint()->matches($constraint) === true)) {
  30753. if (in_array($link->getTarget(), $packagesInTree)) {
  30754. $results[] = [$package, $link, false];
  30755. continue;
  30756. }
  30757. $packagesInTree[] = $link->getTarget();
  30758. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : [];
  30759. $results[] = [$package, $link, $dependents];
  30760. $needles[] = $link->getTarget();
  30761. }
  30762. }
  30763. }
  30764. }
  30765. unset($needle);
  30766. }
  30767. if ($package instanceof RootPackageInterface) {
  30768. $links += $package->getDevRequires();
  30769. }
  30770. foreach ($links as $link) {
  30771. foreach ($needles as $needle) {
  30772. if ($link->getTarget() === $needle) {
  30773. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  30774. if (in_array($link->getSource(), $packagesInTree)) {
  30775. $results[] = [$package, $link, false];
  30776. continue;
  30777. }
  30778. $packagesInTree[] = $link->getSource();
  30779. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : [];
  30780. $results[] = [$package, $link, $dependents];
  30781. }
  30782. }
  30783. }
  30784. }
  30785. if ($invert && in_array($package->getName(), $needles, true)) {
  30786. foreach ($package->getConflicts() as $link) {
  30787. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  30788. $version = new Constraint('=', $pkg->getVersion());
  30789. if ($link->getConstraint()->matches($version) === $invert) {
  30790. $results[] = [$package, $link, false];
  30791. }
  30792. }
  30793. }
  30794. }
  30795. foreach ($package->getConflicts() as $link) {
  30796. if (in_array($link->getTarget(), $needles, true)) {
  30797. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  30798. $version = new Constraint('=', $pkg->getVersion());
  30799. if ($link->getConstraint()->matches($version) === $invert) {
  30800. $results[] = [$package, $link, false];
  30801. }
  30802. }
  30803. }
  30804. }
  30805. if ($invert && $constraint && in_array($package->getName(), $needles, true) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  30806. foreach ($package->getRequires() as $link) {
  30807. if (PlatformRepository::isPlatformPackage($link->getTarget())) {
  30808. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  30809. continue;
  30810. }
  30811. $platformPkg = $this->findPackage($link->getTarget(), '*');
  30812. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  30813. $results[] = [$package, new Link($package->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_REQUIRE, $link->getPrettyConstraint().' '.$description), false];
  30814. continue;
  30815. }
  30816. foreach ($this->getPackages() as $pkg) {
  30817. if (!in_array($link->getTarget(), $pkg->getNames())) {
  30818. continue;
  30819. }
  30820. $version = new Constraint('=', $pkg->getVersion());
  30821. if ($link->getTarget() !== $pkg->getName()) {
  30822. foreach (array_merge($pkg->getReplaces(), $pkg->getProvides()) as $prov) {
  30823. if ($link->getTarget() === $prov->getTarget()) {
  30824. $version = $prov->getConstraint();
  30825. break;
  30826. }
  30827. }
  30828. }
  30829. if (!$link->getConstraint()->matches($version)) {
  30830. if ($rootPackage) {
  30831. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  30832. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  30833. $results[] = [$package, $link, false];
  30834. $results[] = [$rootPackage, $rootReq, false];
  30835. continue 3;
  30836. }
  30837. }
  30838. $results[] = [$package, $link, false];
  30839. $results[] = [$rootPackage, new Link($rootPackage->getName(), $link->getTarget(), new MatchAllConstraint, Link::TYPE_DOES_NOT_REQUIRE, 'but ' . $pkg->getPrettyVersion() . ' is installed'), false];
  30840. } else {
  30841. $results[] = [$package, $link, false];
  30842. }
  30843. }
  30844. continue 2;
  30845. }
  30846. }
  30847. }
  30848. }
  30849. ksort($results);
  30850. return $results;
  30851. }
  30852. public function getRepoName(): string
  30853. {
  30854. return 'installed repo ('.implode(', ', array_map(static function ($repo): string {
  30855. return $repo->getRepoName();
  30856. }, $this->getRepositories())).')';
  30857. }
  30858. public function addRepository(RepositoryInterface $repository): void
  30859. {
  30860. if (
  30861. $repository instanceof LockArrayRepository
  30862. || $repository instanceof InstalledRepositoryInterface
  30863. || $repository instanceof RootPackageRepository
  30864. || $repository instanceof PlatformRepository
  30865. ) {
  30866. parent::addRepository($repository);
  30867. return;
  30868. }
  30869. throw new \LogicException('An InstalledRepository can not contain a repository of type '.get_class($repository).' ('.$repository->getRepoName().')');
  30870. }
  30871. }
  30872. <?php declare(strict_types=1);
  30873. namespace Composer\Repository;
  30874. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  30875. {
  30876. public function getDevMode();
  30877. public function isFresh();
  30878. }
  30879. <?php declare(strict_types=1);
  30880. namespace Composer\Repository;
  30881. class InvalidRepositoryException extends \Exception
  30882. {
  30883. }
  30884. <?php declare(strict_types=1);
  30885. namespace Composer\Repository;
  30886. class LockArrayRepository extends ArrayRepository
  30887. {
  30888. use CanonicalPackagesTrait;
  30889. public function getRepoName(): string
  30890. {
  30891. return 'lock repo';
  30892. }
  30893. }
  30894. <?php declare(strict_types=1);
  30895. namespace Composer\Repository;
  30896. use Composer\Package\Loader\ArrayLoader;
  30897. use Composer\Package\Loader\ValidatingArrayLoader;
  30898. use Composer\Pcre\Preg;
  30899. class PackageRepository extends ArrayRepository
  30900. {
  30901. private $config;
  30902. public function __construct(array $config)
  30903. {
  30904. parent::__construct();
  30905. $this->config = $config['package'];
  30906. if (!is_numeric(key($this->config))) {
  30907. $this->config = [$this->config];
  30908. }
  30909. }
  30910. protected function initialize(): void
  30911. {
  30912. parent::initialize();
  30913. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), true);
  30914. foreach ($this->config as $package) {
  30915. try {
  30916. $package = $loader->load($package);
  30917. } catch (\Exception $e) {
  30918. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  30919. }
  30920. $this->addPackage($package);
  30921. }
  30922. }
  30923. public function getRepoName(): string
  30924. {
  30925. return Preg::replace('{^array }', 'package ', parent::getRepoName());
  30926. }
  30927. }
  30928. <?php declare(strict_types=1);
  30929. namespace Composer\Repository;
  30930. use Composer\Config;
  30931. use Composer\EventDispatcher\EventDispatcher;
  30932. use Composer\IO\IOInterface;
  30933. use Composer\Json\JsonFile;
  30934. use Composer\Package\Loader\ArrayLoader;
  30935. use Composer\Package\Version\VersionGuesser;
  30936. use Composer\Package\Version\VersionParser;
  30937. use Composer\Pcre\Preg;
  30938. use Composer\Util\HttpDownloader;
  30939. use Composer\Util\Platform;
  30940. use Composer\Util\ProcessExecutor;
  30941. use Composer\Util\Filesystem;
  30942. use Composer\Util\Url;
  30943. use Composer\Util\Git as GitUtil;
  30944. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  30945. {
  30946. private $loader;
  30947. private $versionGuesser;
  30948. private $url;
  30949. private $repoConfig;
  30950. private $process;
  30951. private $options;
  30952. public function __construct(array $repoConfig, IOInterface $io, Config $config, ?HttpDownloader $httpDownloader = null, ?EventDispatcher $dispatcher = null, ?ProcessExecutor $process = null)
  30953. {
  30954. if (!isset($repoConfig['url'])) {
  30955. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  30956. }
  30957. $this->loader = new ArrayLoader(null, true);
  30958. $this->url = Platform::expandPath($repoConfig['url']);
  30959. $this->process = $process ?? new ProcessExecutor($io);
  30960. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser(), $io);
  30961. $this->repoConfig = $repoConfig;
  30962. $this->options = $repoConfig['options'] ?? [];
  30963. if (!isset($this->options['relative'])) {
  30964. $filesystem = new Filesystem();
  30965. $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
  30966. }
  30967. parent::__construct();
  30968. }
  30969. public function getRepoName(): string
  30970. {
  30971. return 'path repo ('.Url::sanitize($this->repoConfig['url']).')';
  30972. }
  30973. public function getRepoConfig(): array
  30974. {
  30975. return $this->repoConfig;
  30976. }
  30977. protected function initialize(): void
  30978. {
  30979. parent::initialize();
  30980. $urlMatches = $this->getUrlMatches();
  30981. if (empty($urlMatches)) {
  30982. if (Preg::isMatch('{[*{}]}', $this->url)) {
  30983. $url = $this->url;
  30984. while (Preg::isMatch('{[*{}]}', $url)) {
  30985. $url = dirname($url);
  30986. }
  30987. if (is_dir($url)) {
  30988. return;
  30989. }
  30990. }
  30991. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  30992. }
  30993. foreach ($urlMatches as $url) {
  30994. $path = realpath($url) . DIRECTORY_SEPARATOR;
  30995. $composerFilePath = $path.'composer.json';
  30996. if (!file_exists($composerFilePath)) {
  30997. continue;
  30998. }
  30999. $json = file_get_contents($composerFilePath);
  31000. $package = JsonFile::parseJson($json, $composerFilePath);
  31001. $package['dist'] = [
  31002. 'type' => 'path',
  31003. 'url' => $url,
  31004. ];
  31005. $reference = $this->options['reference'] ?? 'auto';
  31006. if ('none' === $reference) {
  31007. $package['dist']['reference'] = null;
  31008. } elseif ('config' === $reference || 'auto' === $reference) {
  31009. $package['dist']['reference'] = hash('sha1', $json . serialize($this->options));
  31010. }
  31011. $package['transport-options'] = array_intersect_key($this->options, ['symlink' => true, 'relative' => true]);
  31012. if (isset($package['name'], $this->options['versions'][$package['name']])) {
  31013. $package['version'] = $this->options['versions'][$package['name']];
  31014. }
  31015. if (!isset($package['version']) && ($rootVersion = Platform::getEnv('COMPOSER_ROOT_VERSION'))) {
  31016. if (
  31017. 0 === $this->process->execute(['git', 'rev-parse', 'HEAD'], $ref1, $path)
  31018. && 0 === $this->process->execute(['git', 'rev-parse', 'HEAD'], $ref2)
  31019. && $ref1 === $ref2
  31020. ) {
  31021. $package['version'] = $this->versionGuesser->getRootVersionFromEnv();
  31022. }
  31023. }
  31024. $output = '';
  31025. if ('auto' === $reference && is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute(array_merge(['git', 'log', '-n1', '--pretty=%H'], GitUtil::getNoShowSignatureFlags($this->process)), $output, $path)) {
  31026. $package['dist']['reference'] = trim($output);
  31027. }
  31028. if (!isset($package['version'])) {
  31029. $versionData = $this->versionGuesser->guessVersion($package, $path);
  31030. if (is_array($versionData) && $versionData['pretty_version']) {
  31031. if (!empty($versionData['feature_pretty_version'])) {
  31032. $package['version'] = $versionData['feature_pretty_version'];
  31033. $this->addPackage($this->loader->load($package));
  31034. }
  31035. $package['version'] = $versionData['pretty_version'];
  31036. } else {
  31037. $package['version'] = 'dev-main';
  31038. }
  31039. }
  31040. try {
  31041. $this->addPackage($this->loader->load($package));
  31042. } catch (\Exception $e) {
  31043. throw new \RuntimeException('Failed loading the package in '.$composerFilePath, 0, $e);
  31044. }
  31045. }
  31046. }
  31047. private function getUrlMatches(): array
  31048. {
  31049. $flags = GLOB_MARK | GLOB_ONLYDIR;
  31050. if (defined('GLOB_BRACE')) {
  31051. $flags |= GLOB_BRACE;
  31052. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  31053. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  31054. }
  31055. return array_map(static function ($val): string {
  31056. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  31057. }, glob($this->url, $flags));
  31058. }
  31059. }
  31060. <?php declare(strict_types=1);
  31061. namespace Composer\Repository;
  31062. class PearRepository extends ArrayRepository
  31063. {
  31064. public function __construct()
  31065. {
  31066. throw new \InvalidArgumentException('The PEAR repository has been removed from Composer 2.x');
  31067. }
  31068. }
  31069. <?php declare(strict_types=1);
  31070. namespace Composer\Repository;
  31071. use Composer\Composer;
  31072. use Composer\Package\CompletePackage;
  31073. use Composer\Package\CompletePackageInterface;
  31074. use Composer\Package\Link;
  31075. use Composer\Package\PackageInterface;
  31076. use Composer\Package\Version\VersionParser;
  31077. use Composer\Pcre\Preg;
  31078. use Composer\Platform\HhvmDetector;
  31079. use Composer\Platform\Runtime;
  31080. use Composer\Platform\Version;
  31081. use Composer\Plugin\PluginInterface;
  31082. use Composer\Semver\Constraint\Constraint;
  31083. use Composer\Util\Silencer;
  31084. use Composer\XdebugHandler\XdebugHandler;
  31085. class PlatformRepository extends ArrayRepository
  31086. {
  31087. public const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer(?:-(?:plugin|runtime)-api)?)$}iD';
  31088. private static $lastSeenPlatformPhp = null;
  31089. private $versionParser;
  31090. private $overrides = [];
  31091. private $disabledPackages = [];
  31092. private $runtime;
  31093. private $hhvmDetector;
  31094. public function __construct(array $packages = [], array $overrides = [], ?Runtime $runtime = null, ?HhvmDetector $hhvmDetector = null)
  31095. {
  31096. $this->runtime = $runtime ?: new Runtime();
  31097. $this->hhvmDetector = $hhvmDetector ?: new HhvmDetector();
  31098. foreach ($overrides as $name => $version) {
  31099. if (!is_string($version) && false !== $version) {
  31100. throw new \UnexpectedValueException('config.platform.'.$name.' should be a string or false, but got '.gettype($version).' '.var_export($version, true));
  31101. }
  31102. if ($name === 'php' && $version === false) {
  31103. throw new \UnexpectedValueException('config.platform.'.$name.' cannot be set to false as you cannot disable php entirely.');
  31104. }
  31105. $this->overrides[strtolower($name)] = ['name' => $name, 'version' => $version];
  31106. }
  31107. parent::__construct($packages);
  31108. }
  31109. public function getRepoName(): string
  31110. {
  31111. return 'platform repo';
  31112. }
  31113. public function isPlatformPackageDisabled(string $name): bool
  31114. {
  31115. return isset($this->disabledPackages[$name]);
  31116. }
  31117. public function getDisabledPackages(): array
  31118. {
  31119. return $this->disabledPackages;
  31120. }
  31121. protected function initialize(): void
  31122. {
  31123. parent::initialize();
  31124. $libraries = [];
  31125. $this->versionParser = new VersionParser();
  31126. foreach ($this->overrides as $override) {
  31127. if (!self::isPlatformPackage($override['name'])) {
  31128. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  31129. }
  31130. if ($override['version'] !== false) {
  31131. $this->addOverriddenPackage($override);
  31132. }
  31133. }
  31134. $prettyVersion = Composer::getVersion();
  31135. $version = $this->versionParser->normalize($prettyVersion);
  31136. $composer = new CompletePackage('composer', $version, $prettyVersion);
  31137. $composer->setDescription('Composer package');
  31138. $this->addPackage($composer);
  31139. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  31140. $version = $this->versionParser->normalize($prettyVersion);
  31141. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  31142. $composerPluginApi->setDescription('The Composer Plugin API');
  31143. $this->addPackage($composerPluginApi);
  31144. $prettyVersion = Composer::RUNTIME_API_VERSION;
  31145. $version = $this->versionParser->normalize($prettyVersion);
  31146. $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
  31147. $composerRuntimeApi->setDescription('The Composer Runtime API');
  31148. $this->addPackage($composerRuntimeApi);
  31149. try {
  31150. $prettyVersion = $this->runtime->getConstant('PHP_VERSION');
  31151. $version = $this->versionParser->normalize($prettyVersion);
  31152. } catch (\UnexpectedValueException $e) {
  31153. $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $this->runtime->getConstant('PHP_VERSION'));
  31154. $version = $this->versionParser->normalize($prettyVersion);
  31155. }
  31156. $php = new CompletePackage('php', $version, $prettyVersion);
  31157. $php->setDescription('The PHP interpreter');
  31158. $this->addPackage($php);
  31159. if ($this->runtime->getConstant('PHP_DEBUG')) {
  31160. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  31161. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  31162. $this->addPackage($phpdebug);
  31163. }
  31164. if ($this->runtime->hasConstant('PHP_ZTS') && $this->runtime->getConstant('PHP_ZTS')) {
  31165. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  31166. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  31167. $this->addPackage($phpzts);
  31168. }
  31169. if ($this->runtime->getConstant('PHP_INT_SIZE') === 8) {
  31170. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  31171. $php64->setDescription('The PHP interpreter, 64bit');
  31172. $this->addPackage($php64);
  31173. }
  31174. if ($this->runtime->hasConstant('AF_INET6') || Silencer::call([$this->runtime, 'invoke'], 'inet_pton', ['::']) !== false) {
  31175. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  31176. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  31177. $this->addPackage($phpIpv6);
  31178. }
  31179. $loadedExtensions = $this->runtime->getExtensions();
  31180. foreach ($loadedExtensions as $name) {
  31181. if (in_array($name, ['standard', 'Core'])) {
  31182. continue;
  31183. }
  31184. $this->addExtension($name, $this->runtime->getExtensionVersion($name));
  31185. }
  31186. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  31187. $this->addExtension('xdebug', $prettyVersion);
  31188. }
  31189. foreach ($loadedExtensions as $name) {
  31190. switch ($name) {
  31191. case 'amqp':
  31192. $info = $this->runtime->getExtensionInfo($name);
  31193. if (Preg::isMatch('/^librabbitmq version => (?<version>.+)$/im', $info, $librabbitmqMatches)) {
  31194. $this->addLibrary($libraries, $name.'-librabbitmq', $librabbitmqMatches['version'], 'AMQP librabbitmq version');
  31195. }
  31196. if (Preg::isMatchStrictGroups('/^AMQP protocol version => (?<version>.+)$/im', $info, $protocolMatches)) {
  31197. $this->addLibrary($libraries, $name.'-protocol', str_replace('-', '.', $protocolMatches['version']), 'AMQP protocol version');
  31198. }
  31199. break;
  31200. case 'bz2':
  31201. $info = $this->runtime->getExtensionInfo($name);
  31202. if (Preg::isMatch('/^BZip2 Version => (?<version>.*),/im', $info, $matches)) {
  31203. $this->addLibrary($libraries, $name, $matches['version']);
  31204. }
  31205. break;
  31206. case 'curl':
  31207. $curlVersion = $this->runtime->invoke('curl_version');
  31208. $this->addLibrary($libraries, $name, $curlVersion['version']);
  31209. $info = $this->runtime->getExtensionInfo($name);
  31210. if (Preg::isMatchStrictGroups('{^SSL Version => (?<library>[^/]+)/(?<version>.+)$}im', $info, $sslMatches)) {
  31211. $library = strtolower($sslMatches['library']);
  31212. if ($library === 'openssl') {
  31213. $parsedVersion = Version::parseOpenssl($sslMatches['version'], $isFips);
  31214. $this->addLibrary($libraries, $name.'-openssl'.($isFips ? '-fips' : ''), $parsedVersion, 'curl OpenSSL version ('.$parsedVersion.')', [], $isFips ? ['curl-openssl'] : []);
  31215. } else {
  31216. if ($library === '(securetransport) openssl') {
  31217. $shortlib = 'securetransport';
  31218. } else {
  31219. $shortlib = $library;
  31220. }
  31221. $this->addLibrary($libraries, $name.'-'.$shortlib, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', ['curl-openssl']);
  31222. }
  31223. }
  31224. if (Preg::isMatchStrictGroups('{^libSSH Version => (?<library>[^/]+)/(?<version>.+?)(?:/.*)?$}im', $info, $sshMatches)) {
  31225. $this->addLibrary($libraries, $name.'-'.strtolower($sshMatches['library']), $sshMatches['version'], 'curl '.$sshMatches['library'].' version');
  31226. }
  31227. if (Preg::isMatchStrictGroups('{^ZLib Version => (?<version>.+)$}im', $info, $zlibMatches)) {
  31228. $this->addLibrary($libraries, $name.'-zlib', $zlibMatches['version'], 'curl zlib version');
  31229. }
  31230. break;
  31231. case 'date':
  31232. $info = $this->runtime->getExtensionInfo($name);
  31233. if (Preg::isMatchStrictGroups('/^timelib version => (?<version>.+)$/im', $info, $timelibMatches)) {
  31234. $this->addLibrary($libraries, $name.'-timelib', $timelibMatches['version'], 'date timelib version');
  31235. }
  31236. if (Preg::isMatchStrictGroups('/^Timezone Database => (?<source>internal|external)$/im', $info, $zoneinfoSourceMatches)) {
  31237. $external = $zoneinfoSourceMatches['source'] === 'external';
  31238. if (Preg::isMatchStrictGroups('/^"Olson" Timezone Database Version => (?<version>.+?)(?:\.system)?$/im', $info, $zoneinfoMatches)) {
  31239. if ($external && in_array('timezonedb', $loadedExtensions, true)) {
  31240. $this->addLibrary($libraries, 'timezonedb-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date (replaced by timezonedb)', [$name.'-zoneinfo']);
  31241. } else {
  31242. $this->addLibrary($libraries, $name.'-zoneinfo', $zoneinfoMatches['version'], 'zoneinfo ("Olson") database for date');
  31243. }
  31244. }
  31245. }
  31246. break;
  31247. case 'fileinfo':
  31248. $info = $this->runtime->getExtensionInfo($name);
  31249. if (Preg::isMatch('/^libmagic => (?<version>.+)$/im', $info, $magicMatches)) {
  31250. $this->addLibrary($libraries, $name.'-libmagic', $magicMatches['version'], 'fileinfo libmagic version');
  31251. }
  31252. break;
  31253. case 'gd':
  31254. $this->addLibrary($libraries, $name, $this->runtime->getConstant('GD_VERSION'));
  31255. $info = $this->runtime->getExtensionInfo($name);
  31256. if (Preg::isMatchStrictGroups('/^libJPEG Version => (?<version>.+?)(?: compatible)?$/im', $info, $libjpegMatches)) {
  31257. $this->addLibrary($libraries, $name.'-libjpeg', Version::parseLibjpeg($libjpegMatches['version']), 'libjpeg version for gd');
  31258. }
  31259. if (Preg::isMatchStrictGroups('/^libPNG Version => (?<version>.+)$/im', $info, $libpngMatches)) {
  31260. $this->addLibrary($libraries, $name.'-libpng', $libpngMatches['version'], 'libpng version for gd');
  31261. }
  31262. if (Preg::isMatchStrictGroups('/^FreeType Version => (?<version>.+)$/im', $info, $freetypeMatches)) {
  31263. $this->addLibrary($libraries, $name.'-freetype', $freetypeMatches['version'], 'freetype version for gd');
  31264. }
  31265. if (Preg::isMatchStrictGroups('/^libXpm Version => (?<versionId>\d+)$/im', $info, $libxpmMatches)) {
  31266. $this->addLibrary($libraries, $name.'-libxpm', Version::convertLibxpmVersionId((int) $libxpmMatches['versionId']), 'libxpm version for gd');
  31267. }
  31268. break;
  31269. case 'gmp':
  31270. $this->addLibrary($libraries, $name, $this->runtime->getConstant('GMP_VERSION'));
  31271. break;
  31272. case 'iconv':
  31273. $this->addLibrary($libraries, $name, $this->runtime->getConstant('ICONV_VERSION'));
  31274. break;
  31275. case 'intl':
  31276. $info = $this->runtime->getExtensionInfo($name);
  31277. $description = 'The ICU unicode and globalization support library';
  31278. if ($this->runtime->hasConstant('INTL_ICU_VERSION')) {
  31279. $this->addLibrary($libraries, 'icu', $this->runtime->getConstant('INTL_ICU_VERSION'), $description);
  31280. } elseif (Preg::isMatch('/^ICU version => (?<version>.+)$/im', $info, $matches)) {
  31281. $this->addLibrary($libraries, 'icu', $matches['version'], $description);
  31282. }
  31283. if (Preg::isMatchStrictGroups('/^ICU TZData version => (?<version>.*)$/im', $info, $zoneinfoMatches) && null !== ($version = Version::parseZoneinfoVersion($zoneinfoMatches['version']))) {
  31284. $this->addLibrary($libraries, 'icu-zoneinfo', $version, 'zoneinfo ("Olson") database for icu');
  31285. }
  31286. if ($this->runtime->hasClass('ResourceBundle')) {
  31287. $resourceBundle = $this->runtime->invoke(['ResourceBundle', 'create'], ['root', 'ICUDATA', false]);
  31288. if ($resourceBundle !== null) {
  31289. $this->addLibrary($libraries, 'icu-cldr', $resourceBundle->get('Version'), 'ICU CLDR project version');
  31290. }
  31291. }
  31292. if ($this->runtime->hasClass('IntlChar')) {
  31293. $this->addLibrary($libraries, 'icu-unicode', implode('.', array_slice($this->runtime->invoke(['IntlChar', 'getUnicodeVersion']), 0, 3)), 'ICU unicode version');
  31294. }
  31295. break;
  31296. case 'imagick':
  31297. $imageMagickVersion = $this->runtime->construct('Imagick')->getVersion();
  31298. if (Preg::isMatch('/^ImageMagick (?<version>[\d.]+)(?:-(?<patch>\d+))?/', $imageMagickVersion['versionString'], $matches)) {
  31299. $version = $matches['version'];
  31300. if (isset($matches['patch'])) {
  31301. $version .= '.'.$matches['patch'];
  31302. }
  31303. $this->addLibrary($libraries, $name.'-imagemagick', $version, null, ['imagick']);
  31304. }
  31305. break;
  31306. case 'ldap':
  31307. $info = $this->runtime->getExtensionInfo($name);
  31308. if (Preg::isMatchStrictGroups('/^Vendor Version => (?<versionId>\d+)$/im', $info, $matches) && Preg::isMatchStrictGroups('/^Vendor Name => (?<vendor>.+)$/im', $info, $vendorMatches)) {
  31309. $this->addLibrary($libraries, $name.'-'.strtolower($vendorMatches['vendor']), Version::convertOpenldapVersionId((int) $matches['versionId']), $vendorMatches['vendor'].' version of ldap');
  31310. }
  31311. break;
  31312. case 'libxml':
  31313. $libxmlProvides = array_map(static function ($extension): string {
  31314. return $extension . '-libxml';
  31315. }, array_intersect($loadedExtensions, ['dom', 'simplexml', 'xml', 'xmlreader', 'xmlwriter']));
  31316. $this->addLibrary($libraries, $name, $this->runtime->getConstant('LIBXML_DOTTED_VERSION'), 'libxml library version', [], $libxmlProvides);
  31317. break;
  31318. case 'mbstring':
  31319. $info = $this->runtime->getExtensionInfo($name);
  31320. if (Preg::isMatch('/^libmbfl version => (?<version>.+)$/im', $info, $libmbflMatches)) {
  31321. $this->addLibrary($libraries, $name.'-libmbfl', $libmbflMatches['version'], 'mbstring libmbfl version');
  31322. }
  31323. if ($this->runtime->hasConstant('MB_ONIGURUMA_VERSION')) {
  31324. $this->addLibrary($libraries, $name.'-oniguruma', $this->runtime->getConstant('MB_ONIGURUMA_VERSION'), 'mbstring oniguruma version');
  31325. } elseif (Preg::isMatch('/^(?:oniguruma|Multibyte regex \(oniguruma\)) version => (?<version>.+)$/im', $info, $onigurumaMatches)) {
  31326. $this->addLibrary($libraries, $name.'-oniguruma', $onigurumaMatches['version'], 'mbstring oniguruma version');
  31327. }
  31328. break;
  31329. case 'memcached':
  31330. $info = $this->runtime->getExtensionInfo($name);
  31331. if (Preg::isMatch('/^libmemcached version => (?<version>.+)$/im', $info, $matches)) {
  31332. $this->addLibrary($libraries, $name.'-libmemcached', $matches['version'], 'libmemcached version');
  31333. }
  31334. break;
  31335. case 'openssl':
  31336. if (Preg::isMatchStrictGroups('{^(?:OpenSSL|LibreSSL)?\s*(?<version>\S+)}i', $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), $matches)) {
  31337. $parsedVersion = Version::parseOpenssl($matches['version'], $isFips);
  31338. $this->addLibrary($libraries, $name.($isFips ? '-fips' : ''), $parsedVersion, $this->runtime->getConstant('OPENSSL_VERSION_TEXT'), [], $isFips ? [$name] : []);
  31339. }
  31340. break;
  31341. case 'pcre':
  31342. $this->addLibrary($libraries, $name, Preg::replace('{^(\S+).*}', '$1', $this->runtime->getConstant('PCRE_VERSION')));
  31343. $info = $this->runtime->getExtensionInfo($name);
  31344. if (Preg::isMatchStrictGroups('/^PCRE Unicode Version => (?<version>.+)$/im', $info, $pcreUnicodeMatches)) {
  31345. $this->addLibrary($libraries, $name.'-unicode', $pcreUnicodeMatches['version'], 'PCRE Unicode version support');
  31346. }
  31347. break;
  31348. case 'mysqlnd':
  31349. case 'pdo_mysql':
  31350. $info = $this->runtime->getExtensionInfo($name);
  31351. if (Preg::isMatchStrictGroups('/^(?:Client API version|Version) => mysqlnd (?<version>.+?) /mi', $info, $matches)) {
  31352. $this->addLibrary($libraries, $name.'-mysqlnd', $matches['version'], 'mysqlnd library version for '.$name);
  31353. }
  31354. break;
  31355. case 'mongodb':
  31356. $info = $this->runtime->getExtensionInfo($name);
  31357. if (Preg::isMatchStrictGroups('/^libmongoc bundled version => (?<version>.+)$/im', $info, $libmongocMatches)) {
  31358. $this->addLibrary($libraries, $name.'-libmongoc', $libmongocMatches['version'], 'libmongoc version of mongodb');
  31359. }
  31360. if (Preg::isMatchStrictGroups('/^libbson bundled version => (?<version>.+)$/im', $info, $libbsonMatches)) {
  31361. $this->addLibrary($libraries, $name.'-libbson', $libbsonMatches['version'], 'libbson version of mongodb');
  31362. }
  31363. break;
  31364. case 'pgsql':
  31365. if ($this->runtime->hasConstant('PGSQL_LIBPQ_VERSION')) {
  31366. $this->addLibrary($libraries, 'pgsql-libpq', $this->runtime->getConstant('PGSQL_LIBPQ_VERSION'), 'libpq for pgsql');
  31367. break;
  31368. }
  31369. case 'pdo_pgsql':
  31370. $info = $this->runtime->getExtensionInfo($name);
  31371. if (Preg::isMatch('/^PostgreSQL\(libpq\) Version => (?<version>.*)$/im', $info, $matches)) {
  31372. $this->addLibrary($libraries, $name.'-libpq', $matches['version'], 'libpq for '.$name);
  31373. }
  31374. break;
  31375. case 'pq':
  31376. $info = $this->runtime->getExtensionInfo($name);
  31377. if (Preg::isMatch('/^libpq => (?<compiled>.+) => (?<linked>.+)$/im', $info, $matches)) {
  31378. $this->addLibrary($libraries, $name.'-libpq', $matches['linked'], 'libpq for '.$name);
  31379. }
  31380. break;
  31381. case 'rdkafka':
  31382. if ($this->runtime->hasConstant('RD_KAFKA_VERSION')) {
  31383. $libRdKafkaVersionInt = $this->runtime->getConstant('RD_KAFKA_VERSION');
  31384. $this->addLibrary($libraries, $name.'-librdkafka', sprintf('%d.%d.%d', ($libRdKafkaVersionInt & 0xFF000000) >> 24, ($libRdKafkaVersionInt & 0x00FF0000) >> 16, ($libRdKafkaVersionInt & 0x0000FF00) >> 8), 'librdkafka for '.$name);
  31385. }
  31386. break;
  31387. case 'libsodium':
  31388. case 'sodium':
  31389. if ($this->runtime->hasConstant('SODIUM_LIBRARY_VERSION')) {
  31390. $this->addLibrary($libraries, 'libsodium', $this->runtime->getConstant('SODIUM_LIBRARY_VERSION'));
  31391. $this->addLibrary($libraries, 'libsodium', $this->runtime->getConstant('SODIUM_LIBRARY_VERSION'));
  31392. }
  31393. break;
  31394. case 'sqlite3':
  31395. case 'pdo_sqlite':
  31396. $info = $this->runtime->getExtensionInfo($name);
  31397. if (Preg::isMatch('/^SQLite Library => (?<version>.+)$/im', $info, $matches)) {
  31398. $this->addLibrary($libraries, $name.'-sqlite', $matches['version']);
  31399. }
  31400. break;
  31401. case 'ssh2':
  31402. $info = $this->runtime->getExtensionInfo($name);
  31403. if (Preg::isMatch('/^libssh2 version => (?<version>.+)$/im', $info, $matches)) {
  31404. $this->addLibrary($libraries, $name.'-libssh2', $matches['version']);
  31405. }
  31406. break;
  31407. case 'xsl':
  31408. $this->addLibrary($libraries, 'libxslt', $this->runtime->getConstant('LIBXSLT_DOTTED_VERSION'), null, ['xsl']);
  31409. $info = $this->runtime->getExtensionInfo('xsl');
  31410. if (Preg::isMatch('/^libxslt compiled against libxml Version => (?<version>.+)$/im', $info, $matches)) {
  31411. $this->addLibrary($libraries, 'libxslt-libxml', $matches['version'], 'libxml version libxslt is compiled against');
  31412. }
  31413. break;
  31414. case 'yaml':
  31415. $info = $this->runtime->getExtensionInfo('yaml');
  31416. if (Preg::isMatch('/^LibYAML Version => (?<version>.+)$/im', $info, $matches)) {
  31417. $this->addLibrary($libraries, $name.'-libyaml', $matches['version'], 'libyaml version of yaml');
  31418. }
  31419. break;
  31420. case 'zip':
  31421. if ($this->runtime->hasConstant('LIBZIP_VERSION', 'ZipArchive')) {
  31422. $this->addLibrary($libraries, $name.'-libzip', $this->runtime->getConstant('LIBZIP_VERSION', 'ZipArchive'), null, ['zip']);
  31423. }
  31424. break;
  31425. case 'zlib':
  31426. if ($this->runtime->hasConstant('ZLIB_VERSION')) {
  31427. $this->addLibrary($libraries, $name, $this->runtime->getConstant('ZLIB_VERSION'));
  31428. } elseif (Preg::isMatch('/^Linked Version => (?<version>.+)$/im', $this->runtime->getExtensionInfo($name), $matches)) {
  31429. $this->addLibrary($libraries, $name, $matches['version']);
  31430. }
  31431. break;
  31432. default:
  31433. break;
  31434. }
  31435. }
  31436. $hhvmVersion = $this->hhvmDetector->getVersion();
  31437. if ($hhvmVersion) {
  31438. try {
  31439. $prettyVersion = $hhvmVersion;
  31440. $version = $this->versionParser->normalize($prettyVersion);
  31441. } catch (\UnexpectedValueException $e) {
  31442. $prettyVersion = Preg::replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  31443. $version = $this->versionParser->normalize($prettyVersion);
  31444. }
  31445. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  31446. $hhvm->setDescription('The HHVM Runtime (64bit)');
  31447. $this->addPackage($hhvm);
  31448. }
  31449. }
  31450. public function addPackage(PackageInterface $package): void
  31451. {
  31452. if (!$package instanceof CompletePackage) {
  31453. throw new \UnexpectedValueException('Expected CompletePackage but got '.get_class($package));
  31454. }
  31455. if (isset($this->overrides[$package->getName()])) {
  31456. if ($this->overrides[$package->getName()]['version'] === false) {
  31457. $this->addDisabledPackage($package);
  31458. return;
  31459. }
  31460. $overrider = $this->findPackage($package->getName(), '*');
  31461. if ($package->getVersion() === $overrider->getVersion()) {
  31462. $actualText = 'same as actual';
  31463. } else {
  31464. $actualText = 'actual: '.$package->getPrettyVersion();
  31465. }
  31466. if ($overrider instanceof CompletePackageInterface) {
  31467. $overrider->setDescription($overrider->getDescription().', '.$actualText);
  31468. }
  31469. return;
  31470. }
  31471. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  31472. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  31473. if ($package->getVersion() === $overrider->getVersion()) {
  31474. $actualText = 'same as actual';
  31475. } else {
  31476. $actualText = 'actual: '.$package->getPrettyVersion();
  31477. }
  31478. $overrider->setDescription($overrider->getDescription().', '.$actualText);
  31479. return;
  31480. }
  31481. parent::addPackage($package);
  31482. }
  31483. private function addOverriddenPackage(array $override, ?string $name = null): CompletePackage
  31484. {
  31485. $version = $this->versionParser->normalize($override['version']);
  31486. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  31487. $package->setDescription('Package overridden via config.platform');
  31488. $package->setExtra(['config.platform' => true]);
  31489. parent::addPackage($package);
  31490. if ($package->getName() === 'php') {
  31491. self::$lastSeenPlatformPhp = implode('.', array_slice(explode('.', $package->getVersion()), 0, 3));
  31492. }
  31493. return $package;
  31494. }
  31495. private function addDisabledPackage(CompletePackage $package): void
  31496. {
  31497. $package->setDescription($package->getDescription().'. <warning>Package disabled via config.platform</warning>');
  31498. $package->setExtra(['config.platform' => true]);
  31499. $this->disabledPackages[$package->getName()] = $package;
  31500. }
  31501. private function addExtension(string $name, string $prettyVersion): void
  31502. {
  31503. $extraDescription = null;
  31504. try {
  31505. $version = $this->versionParser->normalize($prettyVersion);
  31506. } catch (\UnexpectedValueException $e) {
  31507. $extraDescription = ' (actual version: '.$prettyVersion.')';
  31508. if (Preg::isMatchStrictGroups('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  31509. $prettyVersion = $match[1];
  31510. } else {
  31511. $prettyVersion = '0';
  31512. }
  31513. $version = $this->versionParser->normalize($prettyVersion);
  31514. }
  31515. $packageName = $this->buildPackageName($name);
  31516. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  31517. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  31518. $ext->setType('php-ext');
  31519. if ($name === 'uuid') {
  31520. $ext->setReplaces([
  31521. 'lib-uuid' => new Link('ext-uuid', 'lib-uuid', new Constraint('=', $version), Link::TYPE_REPLACE, $ext->getPrettyVersion()),
  31522. ]);
  31523. }
  31524. $this->addPackage($ext);
  31525. }
  31526. private function buildPackageName(string $name): string
  31527. {
  31528. return 'ext-' . str_replace(' ', '-', strtolower($name));
  31529. }
  31530. private function addLibrary(array &$libraries, string $name, ?string $prettyVersion, ?string $description = null, array $replaces = [], array $provides = []): void
  31531. {
  31532. if (null === $prettyVersion) {
  31533. return;
  31534. }
  31535. try {
  31536. $version = $this->versionParser->normalize($prettyVersion);
  31537. } catch (\UnexpectedValueException $e) {
  31538. return;
  31539. }
  31540. if (isset($libraries['lib-'.$name])) {
  31541. return;
  31542. }
  31543. $libraries['lib-'.$name] = true;
  31544. if ($description === null) {
  31545. $description = 'The '.$name.' library';
  31546. }
  31547. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  31548. $lib->setDescription($description);
  31549. $replaceLinks = [];
  31550. foreach ($replaces as $replace) {
  31551. $replace = strtolower($replace);
  31552. $replaceLinks[$replace] = new Link('lib-'.$name, 'lib-'.$replace, new Constraint('=', $version), Link::TYPE_REPLACE, $lib->getPrettyVersion());
  31553. }
  31554. $provideLinks = [];
  31555. foreach ($provides as $provide) {
  31556. $provide = strtolower($provide);
  31557. $provideLinks[$provide] = new Link('lib-'.$name, 'lib-'.$provide, new Constraint('=', $version), Link::TYPE_PROVIDE, $lib->getPrettyVersion());
  31558. }
  31559. $lib->setReplaces($replaceLinks);
  31560. $lib->setProvides($provideLinks);
  31561. $this->addPackage($lib);
  31562. }
  31563. public static function isPlatformPackage(string $name): bool
  31564. {
  31565. static $cache = [];
  31566. if (isset($cache[$name])) {
  31567. return $cache[$name];
  31568. }
  31569. return $cache[$name] = Preg::isMatch(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name);
  31570. }
  31571. public static function getPlatformPhpVersion(): ?string
  31572. {
  31573. return self::$lastSeenPlatformPhp;
  31574. }
  31575. public function search(string $query, int $mode = 0, ?string $type = null): array
  31576. {
  31577. if ($mode === self::SEARCH_VENDOR) {
  31578. return [];
  31579. }
  31580. return parent::search($query, $mode, $type);
  31581. }
  31582. }
  31583. <?php declare(strict_types=1);
  31584. namespace Composer\Repository;
  31585. use Composer\Factory;
  31586. use Composer\IO\IOInterface;
  31587. use Composer\Config;
  31588. use Composer\EventDispatcher\EventDispatcher;
  31589. use Composer\Pcre\Preg;
  31590. use Composer\Util\HttpDownloader;
  31591. use Composer\Util\ProcessExecutor;
  31592. use Composer\Json\JsonFile;
  31593. class RepositoryFactory
  31594. {
  31595. public static function configFromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false)
  31596. {
  31597. if (0 === strpos($repository, 'http')) {
  31598. $repoConfig = ['type' => 'composer', 'url' => $repository];
  31599. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  31600. $json = new JsonFile($repository, Factory::createHttpDownloader($io, $config));
  31601. $data = $json->read();
  31602. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  31603. $repoConfig = ['type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/')];
  31604. } elseif ($allowFilesystem) {
  31605. $repoConfig = ['type' => 'filesystem', 'json' => $json];
  31606. } else {
  31607. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  31608. }
  31609. } elseif (strpos($repository, '{') === 0) {
  31610. $repoConfig = JsonFile::parseJson($repository);
  31611. } else {
  31612. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  31613. }
  31614. return $repoConfig;
  31615. }
  31616. public static function fromString(IOInterface $io, Config $config, string $repository, bool $allowFilesystem = false, ?RepositoryManager $rm = null): RepositoryInterface
  31617. {
  31618. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  31619. return static::createRepo($io, $config, $repoConfig, $rm);
  31620. }
  31621. public static function createRepo(IOInterface $io, Config $config, array $repoConfig, ?RepositoryManager $rm = null): RepositoryInterface
  31622. {
  31623. if (!$rm) {
  31624. @trigger_error('Not passing a repository manager when calling createRepo is deprecated since Composer 2.3.6', E_USER_DEPRECATED);
  31625. $rm = static::manager($io, $config);
  31626. }
  31627. $repos = self::createRepos($rm, [$repoConfig]);
  31628. return reset($repos);
  31629. }
  31630. public static function defaultRepos(?IOInterface $io = null, ?Config $config = null, ?RepositoryManager $rm = null): array
  31631. {
  31632. if (null === $rm) {
  31633. @trigger_error('Not passing a repository manager when calling defaultRepos is deprecated since Composer 2.3.6, use defaultReposWithDefaultManager() instead if you cannot get a manager.', E_USER_DEPRECATED);
  31634. }
  31635. if (null === $config) {
  31636. $config = Factory::createConfig($io);
  31637. }
  31638. if (null !== $io) {
  31639. $io->loadConfiguration($config);
  31640. }
  31641. if (null === $rm) {
  31642. if (null === $io) {
  31643. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  31644. }
  31645. $rm = static::manager($io, $config, Factory::createHttpDownloader($io, $config));
  31646. }
  31647. return self::createRepos($rm, $config->getRepositories());
  31648. }
  31649. public static function manager(IOInterface $io, Config $config, ?HttpDownloader $httpDownloader = null, ?EventDispatcher $eventDispatcher = null, ?ProcessExecutor $process = null): RepositoryManager
  31650. {
  31651. if ($httpDownloader === null) {
  31652. $httpDownloader = Factory::createHttpDownloader($io, $config);
  31653. }
  31654. if ($process === null) {
  31655. $process = new ProcessExecutor($io);
  31656. $process->enableAsync();
  31657. }
  31658. $rm = new RepositoryManager($io, $config, $httpDownloader, $eventDispatcher, $process);
  31659. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  31660. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  31661. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  31662. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  31663. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  31664. $rm->setRepositoryClass('bitbucket', 'Composer\Repository\VcsRepository');
  31665. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  31666. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  31667. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  31668. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  31669. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  31670. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  31671. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  31672. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  31673. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  31674. return $rm;
  31675. }
  31676. public static function defaultReposWithDefaultManager(IOInterface $io): array
  31677. {
  31678. $manager = RepositoryFactory::manager($io, $config = Factory::createConfig($io));
  31679. $io->loadConfiguration($config);
  31680. return RepositoryFactory::defaultRepos($io, $config, $manager);
  31681. }
  31682. private static function createRepos(RepositoryManager $rm, array $repoConfigs): array
  31683. {
  31684. $repos = [];
  31685. foreach ($repoConfigs as $index => $repo) {
  31686. if (is_string($repo)) {
  31687. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  31688. }
  31689. if (!is_array($repo)) {
  31690. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  31691. }
  31692. if (!isset($repo['type'])) {
  31693. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  31694. }
  31695. $name = self::generateRepositoryName($index, $repo, $repos);
  31696. if ($repo['type'] === 'filesystem') {
  31697. $repos[$name] = new FilesystemRepository($repo['json']);
  31698. } else {
  31699. $repos[$name] = $rm->createRepository($repo['type'], $repo, (string) $index);
  31700. }
  31701. }
  31702. return $repos;
  31703. }
  31704. public static function generateRepositoryName($index, array $repo, array $existingRepos): string
  31705. {
  31706. $name = is_int($index) && isset($repo['url']) ? Preg::replace('{^https?://}i', '', $repo['url']) : (string) $index;
  31707. while (isset($existingRepos[$name])) {
  31708. $name .= '2';
  31709. }
  31710. return $name;
  31711. }
  31712. }
  31713. <?php declare(strict_types=1);
  31714. namespace Composer\Repository;
  31715. use Composer\Package\PackageInterface;
  31716. use Composer\Package\BasePackage;
  31717. use Composer\Semver\Constraint\ConstraintInterface;
  31718. interface RepositoryInterface extends \Countable
  31719. {
  31720. public const SEARCH_FULLTEXT = 0;
  31721. public const SEARCH_NAME = 1;
  31722. public const SEARCH_VENDOR = 2;
  31723. public function hasPackage(PackageInterface $package);
  31724. public function findPackage(string $name, $constraint);
  31725. public function findPackages(string $name, $constraint = null);
  31726. public function getPackages();
  31727. public function loadPackages(array $packageNameMap, array $acceptableStabilities, array $stabilityFlags, array $alreadyLoaded = []);
  31728. public function search(string $query, int $mode = 0, ?string $type = null);
  31729. public function getProviders(string $packageName);
  31730. public function getRepoName();
  31731. }
  31732. <?php declare(strict_types=1);
  31733. namespace Composer\Repository;
  31734. use Composer\IO\IOInterface;
  31735. use Composer\Config;
  31736. use Composer\EventDispatcher\EventDispatcher;
  31737. use Composer\Package\PackageInterface;
  31738. use Composer\Util\HttpDownloader;
  31739. use Composer\Util\ProcessExecutor;
  31740. class RepositoryManager
  31741. {
  31742. private $localRepository;
  31743. private $repositories = [];
  31744. private $repositoryClasses = [];
  31745. private $io;
  31746. private $config;
  31747. private $httpDownloader;
  31748. private $eventDispatcher;
  31749. private $process;
  31750. public function __construct(IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $eventDispatcher = null, ?ProcessExecutor $process = null)
  31751. {
  31752. $this->io = $io;
  31753. $this->config = $config;
  31754. $this->httpDownloader = $httpDownloader;
  31755. $this->eventDispatcher = $eventDispatcher;
  31756. $this->process = $process ?? new ProcessExecutor($io);
  31757. }
  31758. public function findPackage(string $name, $constraint): ?PackageInterface
  31759. {
  31760. foreach ($this->repositories as $repository) {
  31761. if ($package = $repository->findPackage($name, $constraint)) {
  31762. return $package;
  31763. }
  31764. }
  31765. return null;
  31766. }
  31767. public function findPackages(string $name, $constraint): array
  31768. {
  31769. $packages = [];
  31770. foreach ($this->getRepositories() as $repository) {
  31771. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  31772. }
  31773. return $packages;
  31774. }
  31775. public function addRepository(RepositoryInterface $repository): void
  31776. {
  31777. $this->repositories[] = $repository;
  31778. }
  31779. public function prependRepository(RepositoryInterface $repository): void
  31780. {
  31781. array_unshift($this->repositories, $repository);
  31782. }
  31783. public function createRepository(string $type, array $config, ?string $name = null): RepositoryInterface
  31784. {
  31785. if (!isset($this->repositoryClasses[$type])) {
  31786. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  31787. }
  31788. if (isset($config['packagist']) && false === $config['packagist']) {
  31789. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  31790. }
  31791. $class = $this->repositoryClasses[$type];
  31792. if (isset($config['only']) || isset($config['exclude']) || isset($config['canonical'])) {
  31793. $filterConfig = $config;
  31794. unset($config['only'], $config['exclude'], $config['canonical']);
  31795. }
  31796. $repository = new $class($config, $this->io, $this->config, $this->httpDownloader, $this->eventDispatcher, $this->process);
  31797. if (isset($filterConfig)) {
  31798. $repository = new FilterRepository($repository, $filterConfig);
  31799. }
  31800. return $repository;
  31801. }
  31802. public function setRepositoryClass(string $type, $class): void
  31803. {
  31804. $this->repositoryClasses[$type] = $class;
  31805. }
  31806. public function getRepositories(): array
  31807. {
  31808. return $this->repositories;
  31809. }
  31810. public function setLocalRepository(InstalledRepositoryInterface $repository): void
  31811. {
  31812. $this->localRepository = $repository;
  31813. }
  31814. public function getLocalRepository(): InstalledRepositoryInterface
  31815. {
  31816. return $this->localRepository;
  31817. }
  31818. }
  31819. <?php declare(strict_types=1);
  31820. namespace Composer\Repository;
  31821. class RepositorySecurityException extends \Exception
  31822. {
  31823. }
  31824. <?php declare(strict_types=1);
  31825. namespace Composer\Repository;
  31826. use Composer\DependencyResolver\PoolOptimizer;
  31827. use Composer\DependencyResolver\Pool;
  31828. use Composer\DependencyResolver\PoolBuilder;
  31829. use Composer\DependencyResolver\Request;
  31830. use Composer\EventDispatcher\EventDispatcher;
  31831. use Composer\Advisory\SecurityAdvisory;
  31832. use Composer\Advisory\PartialSecurityAdvisory;
  31833. use Composer\IO\IOInterface;
  31834. use Composer\IO\NullIO;
  31835. use Composer\Package\BasePackage;
  31836. use Composer\Package\AliasPackage;
  31837. use Composer\Package\CompleteAliasPackage;
  31838. use Composer\Package\CompletePackage;
  31839. use Composer\Package\PackageInterface;
  31840. use Composer\Semver\Constraint\Constraint;
  31841. use Composer\Semver\Constraint\ConstraintInterface;
  31842. use Composer\Package\Version\StabilityFilter;
  31843. use Composer\Semver\Constraint\MatchAllConstraint;
  31844. use Composer\Semver\Constraint\MultiConstraint;
  31845. class RepositorySet
  31846. {
  31847. public const ALLOW_UNACCEPTABLE_STABILITIES = 1;
  31848. public const ALLOW_SHADOWED_REPOSITORIES = 2;
  31849. private $rootAliases;
  31850. private $rootReferences;
  31851. private $repositories = [];
  31852. private $acceptableStabilities;
  31853. private $stabilityFlags;
  31854. private $rootRequires;
  31855. private $temporaryConstraints;
  31856. private $locked = false;
  31857. private $allowInstalledRepositories = false;
  31858. public function __construct(string $minimumStability = 'stable', array $stabilityFlags = [], array $rootAliases = [], array $rootReferences = [], array $rootRequires = [], array $temporaryConstraints = [])
  31859. {
  31860. $this->rootAliases = self::getRootAliasesPerPackage($rootAliases);
  31861. $this->rootReferences = $rootReferences;
  31862. $this->acceptableStabilities = [];
  31863. foreach (BasePackage::STABILITIES as $stability => $value) {
  31864. if ($value <= BasePackage::STABILITIES[$minimumStability]) {
  31865. $this->acceptableStabilities[$stability] = $value;
  31866. }
  31867. }
  31868. $this->stabilityFlags = $stabilityFlags;
  31869. $this->rootRequires = $rootRequires;
  31870. foreach ($rootRequires as $name => $constraint) {
  31871. if (PlatformRepository::isPlatformPackage($name)) {
  31872. unset($this->rootRequires[$name]);
  31873. }
  31874. }
  31875. $this->temporaryConstraints = $temporaryConstraints;
  31876. }
  31877. public function allowInstalledRepositories(bool $allow = true): void
  31878. {
  31879. $this->allowInstalledRepositories = $allow;
  31880. }
  31881. public function getRootRequires(): array
  31882. {
  31883. return $this->rootRequires;
  31884. }
  31885. public function getTemporaryConstraints(): array
  31886. {
  31887. return $this->temporaryConstraints;
  31888. }
  31889. public function addRepository(RepositoryInterface $repo): void
  31890. {
  31891. if ($this->locked) {
  31892. throw new \RuntimeException("Pool has already been created from this repository set, it cannot be modified anymore.");
  31893. }
  31894. if ($repo instanceof CompositeRepository) {
  31895. $repos = $repo->getRepositories();
  31896. } else {
  31897. $repos = [$repo];
  31898. }
  31899. foreach ($repos as $repo) {
  31900. $this->repositories[] = $repo;
  31901. }
  31902. }
  31903. public function findPackages(string $name, ?ConstraintInterface $constraint = null, int $flags = 0): array
  31904. {
  31905. $ignoreStability = ($flags & self::ALLOW_UNACCEPTABLE_STABILITIES) !== 0;
  31906. $loadFromAllRepos = ($flags & self::ALLOW_SHADOWED_REPOSITORIES) !== 0;
  31907. $packages = [];
  31908. if ($loadFromAllRepos) {
  31909. foreach ($this->repositories as $repository) {
  31910. $packages[] = $repository->findPackages($name, $constraint) ?: [];
  31911. }
  31912. } else {
  31913. foreach ($this->repositories as $repository) {
  31914. $result = $repository->loadPackages([$name => $constraint], $ignoreStability ? BasePackage::STABILITIES : $this->acceptableStabilities, $ignoreStability ? [] : $this->stabilityFlags);
  31915. $packages[] = $result['packages'];
  31916. foreach ($result['namesFound'] as $nameFound) {
  31917. if ($name === $nameFound) {
  31918. break 2;
  31919. }
  31920. }
  31921. }
  31922. }
  31923. $candidates = $packages ? array_merge(...$packages) : [];
  31924. if ($ignoreStability || !$loadFromAllRepos) {
  31925. return $candidates;
  31926. }
  31927. $result = [];
  31928. foreach ($candidates as $candidate) {
  31929. if ($this->isPackageAcceptable($candidate->getNames(), $candidate->getStability())) {
  31930. $result[] = $candidate;
  31931. }
  31932. }
  31933. return $result;
  31934. }
  31935. public function getSecurityAdvisories(array $packageNames, bool $allowPartialAdvisories = false): array
  31936. {
  31937. $map = [];
  31938. foreach ($packageNames as $name) {
  31939. $map[$name] = new MatchAllConstraint();
  31940. }
  31941. return $this->getSecurityAdvisoriesForConstraints($map, $allowPartialAdvisories);
  31942. }
  31943. public function getMatchingSecurityAdvisories(array $packages, bool $allowPartialAdvisories = false): array
  31944. {
  31945. $map = [];
  31946. foreach ($packages as $package) {
  31947. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  31948. continue;
  31949. }
  31950. if (isset($map[$package->getName()])) {
  31951. $map[$package->getName()] = new MultiConstraint([new Constraint('=', $package->getVersion()), $map[$package->getName()]], false);
  31952. } else {
  31953. $map[$package->getName()] = new Constraint('=', $package->getVersion());
  31954. }
  31955. }
  31956. return $this->getSecurityAdvisoriesForConstraints($map, $allowPartialAdvisories);
  31957. }
  31958. private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap, bool $allowPartialAdvisories): array
  31959. {
  31960. $repoAdvisories = [];
  31961. foreach ($this->repositories as $repository) {
  31962. if (!$repository instanceof AdvisoryProviderInterface || !$repository->hasSecurityAdvisories()) {
  31963. continue;
  31964. }
  31965. $repoAdvisories[] = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories)['advisories'];
  31966. }
  31967. $advisories = array_merge_recursive([], ...$repoAdvisories);
  31968. ksort($advisories);
  31969. return $advisories;
  31970. }
  31971. public function getProviders(string $packageName): array
  31972. {
  31973. $providers = [];
  31974. foreach ($this->repositories as $repository) {
  31975. if ($repoProviders = $repository->getProviders($packageName)) {
  31976. $providers = array_merge($providers, $repoProviders);
  31977. }
  31978. }
  31979. return $providers;
  31980. }
  31981. public function isPackageAcceptable(array $names, string $stability): bool
  31982. {
  31983. return StabilityFilter::isPackageAcceptable($this->acceptableStabilities, $this->stabilityFlags, $names, $stability);
  31984. }
  31985. public function createPool(Request $request, IOInterface $io, ?EventDispatcher $eventDispatcher = null, ?PoolOptimizer $poolOptimizer = null, array $ignoredTypes = [], ?array $allowedTypes = null): Pool
  31986. {
  31987. $poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $io, $eventDispatcher, $poolOptimizer, $this->temporaryConstraints);
  31988. $poolBuilder->setIgnoredTypes($ignoredTypes);
  31989. $poolBuilder->setAllowedTypes($allowedTypes);
  31990. foreach ($this->repositories as $repo) {
  31991. if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
  31992. throw new \LogicException('The pool can not accept packages from an installed repository');
  31993. }
  31994. }
  31995. $this->locked = true;
  31996. return $poolBuilder->buildPool($this->repositories, $request);
  31997. }
  31998. public function createPoolWithAllPackages(): Pool
  31999. {
  32000. foreach ($this->repositories as $repo) {
  32001. if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
  32002. throw new \LogicException('The pool can not accept packages from an installed repository');
  32003. }
  32004. }
  32005. $this->locked = true;
  32006. $packages = [];
  32007. foreach ($this->repositories as $repository) {
  32008. foreach ($repository->getPackages() as $package) {
  32009. $packages[] = $package;
  32010. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  32011. $alias = $this->rootAliases[$package->getName()][$package->getVersion()];
  32012. while ($package instanceof AliasPackage) {
  32013. $package = $package->getAliasOf();
  32014. }
  32015. if ($package instanceof CompletePackage) {
  32016. $aliasPackage = new CompleteAliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  32017. } else {
  32018. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  32019. }
  32020. $aliasPackage->setRootPackageAlias(true);
  32021. $packages[] = $aliasPackage;
  32022. }
  32023. }
  32024. }
  32025. return new Pool($packages);
  32026. }
  32027. public function createPoolForPackage(string $packageName, ?LockArrayRepository $lockedRepo = null): Pool
  32028. {
  32029. return $this->createPoolForPackages([$packageName], $lockedRepo);
  32030. }
  32031. public function createPoolForPackages(array $packageNames, ?LockArrayRepository $lockedRepo = null): Pool
  32032. {
  32033. $request = new Request($lockedRepo);
  32034. $allowedPackages = [];
  32035. foreach ($packageNames as $packageName) {
  32036. if (PlatformRepository::isPlatformPackage($packageName)) {
  32037. throw new \LogicException('createPoolForPackage(s) can not be used for platform packages, as they are never loaded by the PoolBuilder which expects them to be fixed. Use createPoolWithAllPackages or pass in a proper request with the platform packages you need fixed in it.');
  32038. }
  32039. $request->requireName($packageName);
  32040. $allowedPackages[] = strtolower($packageName);
  32041. }
  32042. if (count($allowedPackages) > 0) {
  32043. $request->restrictPackages($allowedPackages);
  32044. }
  32045. return $this->createPool($request, new NullIO());
  32046. }
  32047. private static function getRootAliasesPerPackage(array $aliases): array
  32048. {
  32049. $normalizedAliases = [];
  32050. foreach ($aliases as $alias) {
  32051. $normalizedAliases[$alias['package']][$alias['version']] = [
  32052. 'alias' => $alias['alias'],
  32053. 'alias_normalized' => $alias['alias_normalized'],
  32054. ];
  32055. }
  32056. return $normalizedAliases;
  32057. }
  32058. }
  32059. <?php declare(strict_types=1);
  32060. namespace Composer\Repository;
  32061. use Composer\Package\PackageInterface;
  32062. class RepositoryUtils
  32063. {
  32064. public static function filterRequiredPackages(array $packages, PackageInterface $requirer, bool $includeRequireDev = false, array $bucket = []): array
  32065. {
  32066. $requires = $requirer->getRequires();
  32067. if ($includeRequireDev) {
  32068. $requires = array_merge($requires, $requirer->getDevRequires());
  32069. }
  32070. foreach ($packages as $candidate) {
  32071. foreach ($candidate->getNames() as $name) {
  32072. if (isset($requires[$name])) {
  32073. if (!in_array($candidate, $bucket, true)) {
  32074. $bucket[] = $candidate;
  32075. $bucket = self::filterRequiredPackages($packages, $candidate, false, $bucket);
  32076. }
  32077. break;
  32078. }
  32079. }
  32080. }
  32081. return $bucket;
  32082. }
  32083. public static function flattenRepositories(RepositoryInterface $repo, bool $unwrapFilterRepos = true): array
  32084. {
  32085. if ($unwrapFilterRepos && $repo instanceof FilterRepository) {
  32086. $repo = $repo->getRepository();
  32087. }
  32088. if (!$repo instanceof CompositeRepository) {
  32089. return [$repo];
  32090. }
  32091. $repos = [];
  32092. foreach ($repo->getRepositories() as $r) {
  32093. foreach (self::flattenRepositories($r, $unwrapFilterRepos) as $r2) {
  32094. $repos[] = $r2;
  32095. }
  32096. }
  32097. return $repos;
  32098. }
  32099. }
  32100. <?php declare(strict_types=1);
  32101. namespace Composer\Repository;
  32102. use Composer\Package\RootPackageInterface;
  32103. class RootPackageRepository extends ArrayRepository
  32104. {
  32105. public function __construct(RootPackageInterface $package)
  32106. {
  32107. parent::__construct([$package]);
  32108. }
  32109. public function getRepoName(): string
  32110. {
  32111. return 'root package repo';
  32112. }
  32113. }
  32114. <?php declare(strict_types=1);
  32115. namespace Composer\Repository\Vcs;
  32116. use Composer\Cache;
  32117. use Composer\Config;
  32118. use Composer\Pcre\Preg;
  32119. use Composer\Util\ProcessExecutor;
  32120. use Composer\Util\Filesystem;
  32121. use Composer\IO\IOInterface;
  32122. class FossilDriver extends VcsDriver
  32123. {
  32124. protected $tags;
  32125. protected $branches;
  32126. protected $rootIdentifier = null;
  32127. protected $repoFile = null;
  32128. protected $checkoutDir;
  32129. public function initialize(): void
  32130. {
  32131. $this->checkFossil();
  32132. $this->config->prohibitUrlByConfig($this->url, $this->io);
  32133. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  32134. $this->checkoutDir = $this->url;
  32135. } else {
  32136. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  32137. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  32138. }
  32139. $localName = Preg::replace('{[^a-z0-9]}i', '-', $this->url);
  32140. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  32141. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  32142. $this->updateLocalRepo();
  32143. }
  32144. $this->getTags();
  32145. $this->getBranches();
  32146. }
  32147. protected function checkFossil(): void
  32148. {
  32149. if (0 !== $this->process->execute(['fossil', 'version'], $ignoredOutput)) {
  32150. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  32151. }
  32152. }
  32153. protected function updateLocalRepo(): void
  32154. {
  32155. assert($this->repoFile !== null);
  32156. $fs = new Filesystem();
  32157. $fs->ensureDirectoryExists($this->checkoutDir);
  32158. if (!is_writable(dirname($this->checkoutDir))) {
  32159. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  32160. }
  32161. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute(['fossil', 'info'], $output, $this->checkoutDir)) {
  32162. if (0 !== $this->process->execute(['fossil', 'pull'], $output, $this->checkoutDir)) {
  32163. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  32164. }
  32165. } else {
  32166. $fs->removeDirectory($this->checkoutDir);
  32167. $fs->remove($this->repoFile);
  32168. $fs->ensureDirectoryExists($this->checkoutDir);
  32169. if (0 !== $this->process->execute(['fossil', 'clone', '--', $this->url, $this->repoFile], $output)) {
  32170. $output = $this->process->getErrorOutput();
  32171. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  32172. }
  32173. if (0 !== $this->process->execute(['fossil', 'open', '--nested', '--', $this->repoFile], $output, $this->checkoutDir)) {
  32174. $output = $this->process->getErrorOutput();
  32175. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  32176. }
  32177. }
  32178. }
  32179. public function getRootIdentifier(): string
  32180. {
  32181. if (null === $this->rootIdentifier) {
  32182. $this->rootIdentifier = 'trunk';
  32183. }
  32184. return $this->rootIdentifier;
  32185. }
  32186. public function getUrl(): string
  32187. {
  32188. return $this->url;
  32189. }
  32190. public function getSource(string $identifier): array
  32191. {
  32192. return ['type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier];
  32193. }
  32194. public function getDist(string $identifier): ?array
  32195. {
  32196. return null;
  32197. }
  32198. public function getFileContent(string $file, string $identifier): ?string
  32199. {
  32200. $this->process->execute(['fossil', 'cat', '-r', $identifier, '--', $file], $content, $this->checkoutDir);
  32201. if ('' === trim($content)) {
  32202. return null;
  32203. }
  32204. return $content;
  32205. }
  32206. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  32207. {
  32208. $this->process->execute(['fossil', 'finfo', '-b', '-n', '1', 'composer.json'], $output, $this->checkoutDir);
  32209. [, $date] = explode(' ', trim($output), 3);
  32210. return new \DateTimeImmutable($date, new \DateTimeZone('UTC'));
  32211. }
  32212. public function getTags(): array
  32213. {
  32214. if (null === $this->tags) {
  32215. $tags = [];
  32216. $this->process->execute(['fossil', 'tag', 'list'], $output, $this->checkoutDir);
  32217. foreach ($this->process->splitLines($output) as $tag) {
  32218. $tags[$tag] = $tag;
  32219. }
  32220. $this->tags = $tags;
  32221. }
  32222. return $this->tags;
  32223. }
  32224. public function getBranches(): array
  32225. {
  32226. if (null === $this->branches) {
  32227. $branches = [];
  32228. $this->process->execute(['fossil', 'branch', 'list'], $output, $this->checkoutDir);
  32229. foreach ($this->process->splitLines($output) as $branch) {
  32230. $branch = trim(Preg::replace('/^\*/', '', trim($branch)));
  32231. $branches[$branch] = $branch;
  32232. }
  32233. $this->branches = $branches;
  32234. }
  32235. return $this->branches;
  32236. }
  32237. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  32238. {
  32239. if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  32240. return true;
  32241. }
  32242. if (Preg::isMatch('!/fossil/|\.fossil!', $url)) {
  32243. return true;
  32244. }
  32245. if (Filesystem::isLocalPath($url)) {
  32246. $url = Filesystem::getPlatformPath($url);
  32247. if (!is_dir($url)) {
  32248. return false;
  32249. }
  32250. $process = new ProcessExecutor($io);
  32251. if ($process->execute(['fossil', 'info'], $output, $url) === 0) {
  32252. return true;
  32253. }
  32254. }
  32255. return false;
  32256. }
  32257. }
  32258. <?php declare(strict_types=1);
  32259. namespace Composer\Repository\Vcs;
  32260. use Composer\Config;
  32261. use Composer\IO\IOInterface;
  32262. use Composer\Cache;
  32263. use Composer\Downloader\TransportException;
  32264. use Composer\Json\JsonFile;
  32265. use Composer\Pcre\Preg;
  32266. use Composer\Util\Bitbucket;
  32267. use Composer\Util\Http\Response;
  32268. class GitBitbucketDriver extends VcsDriver
  32269. {
  32270. protected $owner;
  32271. protected $repository;
  32272. private $hasIssues = false;
  32273. private $rootIdentifier;
  32274. private $tags;
  32275. private $branches;
  32276. private $branchesUrl = '';
  32277. private $tagsUrl = '';
  32278. private $homeUrl = '';
  32279. private $website = '';
  32280. private $cloneHttpsUrl = '';
  32281. private $repoData;
  32282. protected $fallbackDriver = null;
  32283. private $vcsType;
  32284. public function initialize(): void
  32285. {
  32286. if (!Preg::isMatchStrictGroups('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(?:\.git|/?)?$#i', $this->url, $match)) {
  32287. throw new \InvalidArgumentException(sprintf('The Bitbucket repository URL %s is invalid. It must be the HTTPS URL of a Bitbucket repository.', $this->url));
  32288. }
  32289. $this->owner = $match[1];
  32290. $this->repository = $match[2];
  32291. $this->originUrl = 'bitbucket.org';
  32292. $this->cache = new Cache(
  32293. $this->io,
  32294. implode('/', [
  32295. $this->config->get('cache-repo-dir'),
  32296. $this->originUrl,
  32297. $this->owner,
  32298. $this->repository,
  32299. ])
  32300. );
  32301. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  32302. }
  32303. public function getUrl(): string
  32304. {
  32305. if ($this->fallbackDriver) {
  32306. return $this->fallbackDriver->getUrl();
  32307. }
  32308. return $this->cloneHttpsUrl;
  32309. }
  32310. protected function getRepoData(): bool
  32311. {
  32312. $resource = sprintf(
  32313. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  32314. $this->owner,
  32315. $this->repository,
  32316. http_build_query(
  32317. ['fields' => '-project,-owner'],
  32318. '',
  32319. '&'
  32320. )
  32321. );
  32322. $repoData = $this->fetchWithOAuthCredentials($resource, true)->decodeJson();
  32323. if ($this->fallbackDriver) {
  32324. return false;
  32325. }
  32326. $this->parseCloneUrls($repoData['links']['clone']);
  32327. $this->hasIssues = !empty($repoData['has_issues']);
  32328. $this->branchesUrl = $repoData['links']['branches']['href'];
  32329. $this->tagsUrl = $repoData['links']['tags']['href'];
  32330. $this->homeUrl = $repoData['links']['html']['href'];
  32331. $this->website = $repoData['website'];
  32332. $this->vcsType = $repoData['scm'];
  32333. $this->repoData = $repoData;
  32334. return true;
  32335. }
  32336. public function getComposerInformation(string $identifier): ?array
  32337. {
  32338. if ($this->fallbackDriver) {
  32339. return $this->fallbackDriver->getComposerInformation($identifier);
  32340. }
  32341. if (!isset($this->infoCache[$identifier])) {
  32342. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  32343. $composer = JsonFile::parseJson($res);
  32344. } else {
  32345. $composer = $this->getBaseComposerInformation($identifier);
  32346. if ($this->shouldCache($identifier)) {
  32347. $this->cache->write($identifier, json_encode($composer));
  32348. }
  32349. }
  32350. if ($composer !== null) {
  32351. if (isset($composer['support']) && !is_array($composer['support'])) {
  32352. $composer['support'] = [];
  32353. }
  32354. if (!isset($composer['support']['source'])) {
  32355. $label = array_search(
  32356. $identifier,
  32357. $this->getTags()
  32358. ) ?: array_search(
  32359. $identifier,
  32360. $this->getBranches()
  32361. ) ?: $identifier;
  32362. if (array_key_exists($label, $tags = $this->getTags())) {
  32363. $hash = $tags[$label];
  32364. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  32365. $hash = $branches[$label];
  32366. }
  32367. if (!isset($hash)) {
  32368. $composer['support']['source'] = sprintf(
  32369. 'https://%s/%s/%s/src',
  32370. $this->originUrl,
  32371. $this->owner,
  32372. $this->repository
  32373. );
  32374. } else {
  32375. $composer['support']['source'] = sprintf(
  32376. 'https://%s/%s/%s/src/%s/?at=%s',
  32377. $this->originUrl,
  32378. $this->owner,
  32379. $this->repository,
  32380. $hash,
  32381. $label
  32382. );
  32383. }
  32384. }
  32385. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  32386. $composer['support']['issues'] = sprintf(
  32387. 'https://%s/%s/%s/issues',
  32388. $this->originUrl,
  32389. $this->owner,
  32390. $this->repository
  32391. );
  32392. }
  32393. if (!isset($composer['homepage'])) {
  32394. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  32395. }
  32396. }
  32397. $this->infoCache[$identifier] = $composer;
  32398. }
  32399. return $this->infoCache[$identifier];
  32400. }
  32401. public function getFileContent(string $file, string $identifier): ?string
  32402. {
  32403. if ($this->fallbackDriver) {
  32404. return $this->fallbackDriver->getFileContent($file, $identifier);
  32405. }
  32406. if (strpos($identifier, '/') !== false) {
  32407. $branches = $this->getBranches();
  32408. if (isset($branches[$identifier])) {
  32409. $identifier = $branches[$identifier];
  32410. }
  32411. }
  32412. $resource = sprintf(
  32413. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  32414. $this->owner,
  32415. $this->repository,
  32416. $identifier,
  32417. $file
  32418. );
  32419. return $this->fetchWithOAuthCredentials($resource)->getBody();
  32420. }
  32421. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  32422. {
  32423. if ($this->fallbackDriver) {
  32424. return $this->fallbackDriver->getChangeDate($identifier);
  32425. }
  32426. if (strpos($identifier, '/') !== false) {
  32427. $branches = $this->getBranches();
  32428. if (isset($branches[$identifier])) {
  32429. $identifier = $branches[$identifier];
  32430. }
  32431. }
  32432. $resource = sprintf(
  32433. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  32434. $this->owner,
  32435. $this->repository,
  32436. $identifier
  32437. );
  32438. $commit = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  32439. return new \DateTimeImmutable($commit['date']);
  32440. }
  32441. public function getSource(string $identifier): array
  32442. {
  32443. if ($this->fallbackDriver) {
  32444. return $this->fallbackDriver->getSource($identifier);
  32445. }
  32446. return ['type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier];
  32447. }
  32448. public function getDist(string $identifier): ?array
  32449. {
  32450. if ($this->fallbackDriver) {
  32451. return $this->fallbackDriver->getDist($identifier);
  32452. }
  32453. $url = sprintf(
  32454. 'https://bitbucket.org/%s/%s/get/%s.zip',
  32455. $this->owner,
  32456. $this->repository,
  32457. $identifier
  32458. );
  32459. return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
  32460. }
  32461. public function getTags(): array
  32462. {
  32463. if ($this->fallbackDriver) {
  32464. return $this->fallbackDriver->getTags();
  32465. }
  32466. if (null === $this->tags) {
  32467. $tags = [];
  32468. $resource = sprintf(
  32469. '%s?%s',
  32470. $this->tagsUrl,
  32471. http_build_query(
  32472. [
  32473. 'pagelen' => 100,
  32474. 'fields' => 'values.name,values.target.hash,next',
  32475. 'sort' => '-target.date',
  32476. ],
  32477. '',
  32478. '&'
  32479. )
  32480. );
  32481. $hasNext = true;
  32482. while ($hasNext) {
  32483. $tagsData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  32484. foreach ($tagsData['values'] as $data) {
  32485. $tags[$data['name']] = $data['target']['hash'];
  32486. }
  32487. if (empty($tagsData['next'])) {
  32488. $hasNext = false;
  32489. } else {
  32490. $resource = $tagsData['next'];
  32491. }
  32492. }
  32493. $this->tags = $tags;
  32494. }
  32495. return $this->tags;
  32496. }
  32497. public function getBranches(): array
  32498. {
  32499. if ($this->fallbackDriver) {
  32500. return $this->fallbackDriver->getBranches();
  32501. }
  32502. if (null === $this->branches) {
  32503. $branches = [];
  32504. $resource = sprintf(
  32505. '%s?%s',
  32506. $this->branchesUrl,
  32507. http_build_query(
  32508. [
  32509. 'pagelen' => 100,
  32510. 'fields' => 'values.name,values.target.hash,values.heads,next',
  32511. 'sort' => '-target.date',
  32512. ],
  32513. '',
  32514. '&'
  32515. )
  32516. );
  32517. $hasNext = true;
  32518. while ($hasNext) {
  32519. $branchData = $this->fetchWithOAuthCredentials($resource)->decodeJson();
  32520. foreach ($branchData['values'] as $data) {
  32521. $branches[$data['name']] = $data['target']['hash'];
  32522. }
  32523. if (empty($branchData['next'])) {
  32524. $hasNext = false;
  32525. } else {
  32526. $resource = $branchData['next'];
  32527. }
  32528. }
  32529. $this->branches = $branches;
  32530. }
  32531. return $this->branches;
  32532. }
  32533. protected function fetchWithOAuthCredentials(string $url, bool $fetchingRepoData = false): Response
  32534. {
  32535. try {
  32536. return parent::getContents($url);
  32537. } catch (TransportException $e) {
  32538. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->httpDownloader);
  32539. if (in_array($e->getCode(), [403, 404], true) || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  32540. if (!$this->io->hasAuthentication($this->originUrl)
  32541. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  32542. ) {
  32543. return parent::getContents($url);
  32544. }
  32545. if (!$this->io->isInteractive() && $fetchingRepoData) {
  32546. $this->attemptCloneFallback();
  32547. return new Response(['url' => 'dummy'], 200, [], 'null');
  32548. }
  32549. }
  32550. throw $e;
  32551. }
  32552. }
  32553. protected function generateSshUrl(): string
  32554. {
  32555. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  32556. }
  32557. protected function attemptCloneFallback(): bool
  32558. {
  32559. try {
  32560. $this->setupFallbackDriver($this->generateSshUrl());
  32561. return true;
  32562. } catch (\RuntimeException $e) {
  32563. $this->fallbackDriver = null;
  32564. $this->io->writeError(
  32565. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  32566. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  32567. );
  32568. throw $e;
  32569. }
  32570. }
  32571. protected function setupFallbackDriver(string $url): void
  32572. {
  32573. $this->fallbackDriver = new GitDriver(
  32574. ['url' => $url],
  32575. $this->io,
  32576. $this->config,
  32577. $this->httpDownloader,
  32578. $this->process
  32579. );
  32580. $this->fallbackDriver->initialize();
  32581. }
  32582. protected function parseCloneUrls(array $cloneLinks): void
  32583. {
  32584. foreach ($cloneLinks as $cloneLink) {
  32585. if ($cloneLink['name'] === 'https') {
  32586. $this->cloneHttpsUrl = Preg::replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  32587. }
  32588. }
  32589. }
  32590. public function getRootIdentifier(): string
  32591. {
  32592. if ($this->fallbackDriver) {
  32593. return $this->fallbackDriver->getRootIdentifier();
  32594. }
  32595. if (null === $this->rootIdentifier) {
  32596. if (!$this->getRepoData()) {
  32597. if (!$this->fallbackDriver) {
  32598. throw new \LogicException('A fallback driver should be setup if getRepoData returns false');
  32599. }
  32600. return $this->fallbackDriver->getRootIdentifier();
  32601. }
  32602. if ($this->vcsType !== 'git') {
  32603. throw new \RuntimeException(
  32604. $this->url.' does not appear to be a git repository, use '.
  32605. $this->cloneHttpsUrl.' but remember that Bitbucket no longer supports the mercurial repositories. '.
  32606. 'https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket'
  32607. );
  32608. }
  32609. $this->rootIdentifier = $this->repoData['mainbranch']['name'] ?? 'master';
  32610. }
  32611. return $this->rootIdentifier;
  32612. }
  32613. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  32614. {
  32615. if (!Preg::isMatch('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $url)) {
  32616. return false;
  32617. }
  32618. if (!extension_loaded('openssl')) {
  32619. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  32620. return false;
  32621. }
  32622. return true;
  32623. }
  32624. }
  32625. <?php declare(strict_types=1);
  32626. namespace Composer\Repository\Vcs;
  32627. use Composer\Pcre\Preg;
  32628. use Composer\Util\ProcessExecutor;
  32629. use Composer\Util\Filesystem;
  32630. use Composer\Util\Url;
  32631. use Composer\Util\Git as GitUtil;
  32632. use Composer\IO\IOInterface;
  32633. use Composer\Cache;
  32634. use Composer\Config;
  32635. class GitDriver extends VcsDriver
  32636. {
  32637. protected $tags;
  32638. protected $branches;
  32639. protected $rootIdentifier;
  32640. protected $repoDir;
  32641. public function initialize(): void
  32642. {
  32643. if (Filesystem::isLocalPath($this->url)) {
  32644. $this->url = Preg::replace('{[\\/]\.git/?$}', '', $this->url);
  32645. if (!is_dir($this->url)) {
  32646. throw new \RuntimeException('Failed to read package information from '.$this->url.' as the path does not exist');
  32647. }
  32648. $this->repoDir = $this->url;
  32649. $cacheUrl = realpath($this->url);
  32650. } else {
  32651. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  32652. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  32653. }
  32654. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->url)) . '/';
  32655. GitUtil::cleanEnv();
  32656. $fs = new Filesystem();
  32657. $fs->ensureDirectoryExists(dirname($this->repoDir));
  32658. if (!is_writable(dirname($this->repoDir))) {
  32659. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  32660. }
  32661. if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  32662. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  32663. }
  32664. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  32665. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  32666. if (!is_dir($this->repoDir)) {
  32667. throw new \RuntimeException('Failed to clone '.$this->url.' to read package information from it');
  32668. }
  32669. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  32670. }
  32671. $cacheUrl = $this->url;
  32672. }
  32673. $this->getTags();
  32674. $this->getBranches();
  32675. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($cacheUrl)));
  32676. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  32677. }
  32678. public function getRootIdentifier(): string
  32679. {
  32680. if (null === $this->rootIdentifier) {
  32681. $this->rootIdentifier = 'master';
  32682. $gitUtil = new GitUtil($this->io, $this->config, $this->process, new Filesystem());
  32683. if (!Filesystem::isLocalPath($this->url)) {
  32684. $defaultBranch = $gitUtil->getMirrorDefaultBranch($this->url, $this->repoDir, false);
  32685. if ($defaultBranch !== null) {
  32686. return $this->rootIdentifier = $defaultBranch;
  32687. }
  32688. }
  32689. $this->process->execute(['git', 'branch', '--no-color'], $output, $this->repoDir);
  32690. $branches = $this->process->splitLines($output);
  32691. if (!in_array('* master', $branches)) {
  32692. foreach ($branches as $branch) {
  32693. if ($branch && Preg::isMatchStrictGroups('{^\* +(\S+)}', $branch, $match)) {
  32694. $this->rootIdentifier = $match[1];
  32695. break;
  32696. }
  32697. }
  32698. }
  32699. }
  32700. return $this->rootIdentifier;
  32701. }
  32702. public function getUrl(): string
  32703. {
  32704. return $this->url;
  32705. }
  32706. public function getSource(string $identifier): array
  32707. {
  32708. return ['type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier];
  32709. }
  32710. public function getDist(string $identifier): ?array
  32711. {
  32712. return null;
  32713. }
  32714. public function getFileContent(string $file, string $identifier): ?string
  32715. {
  32716. if (isset($identifier[0]) && $identifier[0] === '-') {
  32717. throw new \RuntimeException('Invalid git identifier detected. Identifier must not start with a -, given: ' . $identifier);
  32718. }
  32719. $this->process->execute(['git', 'show', $identifier.':'.$file], $content, $this->repoDir);
  32720. if (trim($content) === '') {
  32721. return null;
  32722. }
  32723. return $content;
  32724. }
  32725. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  32726. {
  32727. $this->process->execute(['git', '-c', 'log.showSignature=false', 'log', '-1', '--format=%at', $identifier], $output, $this->repoDir);
  32728. return new \DateTimeImmutable('@'.trim($output), new \DateTimeZone('UTC'));
  32729. }
  32730. public function getTags(): array
  32731. {
  32732. if (null === $this->tags) {
  32733. $this->tags = [];
  32734. $this->process->execute(['git', 'show-ref', '--tags', '--dereference'], $output, $this->repoDir);
  32735. foreach ($this->process->splitLines($output) as $tag) {
  32736. if ($tag !== '' && Preg::isMatch('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  32737. $this->tags[$match[2]] = $match[1];
  32738. }
  32739. }
  32740. }
  32741. return $this->tags;
  32742. }
  32743. public function getBranches(): array
  32744. {
  32745. if (null === $this->branches) {
  32746. $branches = [];
  32747. $this->process->execute(['git', 'branch', '--no-color', '--no-abbrev', '-v'], $output, $this->repoDir);
  32748. foreach ($this->process->splitLines($output) as $branch) {
  32749. if ($branch !== '' && !Preg::isMatch('{^ *[^/]+/HEAD }', $branch)) {
  32750. if (Preg::isMatchStrictGroups('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match) && $match[1][0] !== '-') {
  32751. $branches[$match[1]] = $match[2];
  32752. }
  32753. }
  32754. }
  32755. $this->branches = $branches;
  32756. }
  32757. return $this->branches;
  32758. }
  32759. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  32760. {
  32761. if (Preg::isMatch('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  32762. return true;
  32763. }
  32764. if (Filesystem::isLocalPath($url)) {
  32765. $url = Filesystem::getPlatformPath($url);
  32766. if (!is_dir($url)) {
  32767. return false;
  32768. }
  32769. $process = new ProcessExecutor($io);
  32770. if ($process->execute(['git', 'tag'], $output, $url) === 0) {
  32771. return true;
  32772. }
  32773. GitUtil::checkForRepoOwnershipError($process->getErrorOutput(), $url);
  32774. }
  32775. if (!$deep) {
  32776. return false;
  32777. }
  32778. $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
  32779. GitUtil::cleanEnv();
  32780. try {
  32781. $gitUtil->runCommands([['git', 'ls-remote', '--heads', '--', '%url%']], $url, sys_get_temp_dir());
  32782. } catch (\RuntimeException $e) {
  32783. return false;
  32784. }
  32785. return true;
  32786. }
  32787. }
  32788. <?php declare(strict_types=1);
  32789. namespace Composer\Repository\Vcs;
  32790. use Composer\Config;
  32791. use Composer\Downloader\TransportException;
  32792. use Composer\Json\JsonFile;
  32793. use Composer\Cache;
  32794. use Composer\IO\IOInterface;
  32795. use Composer\Pcre\Preg;
  32796. use Composer\Util\GitHub;
  32797. use Composer\Util\Http\Response;
  32798. class GitHubDriver extends VcsDriver
  32799. {
  32800. protected $owner;
  32801. protected $repository;
  32802. protected $tags;
  32803. protected $branches;
  32804. protected $rootIdentifier;
  32805. protected $repoData;
  32806. protected $hasIssues = false;
  32807. protected $isPrivate = false;
  32808. private $isArchived = false;
  32809. private $fundingInfo;
  32810. protected $gitDriver = null;
  32811. public function initialize(): void
  32812. {
  32813. if (!Preg::isMatch('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $this->url, $match)) {
  32814. throw new \InvalidArgumentException(sprintf('The GitHub repository URL %s is invalid.', $this->url));
  32815. }
  32816. $this->owner = $match[3];
  32817. $this->repository = $match[4];
  32818. $this->originUrl = strtolower($match[1] ?? (string) $match[2]);
  32819. if ($this->originUrl === 'www.github.com') {
  32820. $this->originUrl = 'github.com';
  32821. }
  32822. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  32823. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  32824. if ($this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'])) {
  32825. $this->setupGitDriver($this->url);
  32826. return;
  32827. }
  32828. $this->fetchRootIdentifier();
  32829. }
  32830. public function getRepositoryUrl(): string
  32831. {
  32832. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  32833. }
  32834. public function getRootIdentifier(): string
  32835. {
  32836. if ($this->gitDriver) {
  32837. return $this->gitDriver->getRootIdentifier();
  32838. }
  32839. return $this->rootIdentifier;
  32840. }
  32841. public function getUrl(): string
  32842. {
  32843. if ($this->gitDriver) {
  32844. return $this->gitDriver->getUrl();
  32845. }
  32846. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  32847. }
  32848. protected function getApiUrl(): string
  32849. {
  32850. if ('github.com' === $this->originUrl) {
  32851. $apiUrl = 'api.github.com';
  32852. } else {
  32853. $apiUrl = $this->originUrl . '/api/v3';
  32854. }
  32855. return 'https://' . $apiUrl;
  32856. }
  32857. public function getSource(string $identifier): array
  32858. {
  32859. if ($this->gitDriver) {
  32860. return $this->gitDriver->getSource($identifier);
  32861. }
  32862. if ($this->isPrivate) {
  32863. $url = $this->generateSshUrl();
  32864. } else {
  32865. $url = $this->getUrl();
  32866. }
  32867. return ['type' => 'git', 'url' => $url, 'reference' => $identifier];
  32868. }
  32869. public function getDist(string $identifier): ?array
  32870. {
  32871. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  32872. return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
  32873. }
  32874. public function getComposerInformation(string $identifier): ?array
  32875. {
  32876. if ($this->gitDriver) {
  32877. return $this->gitDriver->getComposerInformation($identifier);
  32878. }
  32879. if (!isset($this->infoCache[$identifier])) {
  32880. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  32881. $composer = JsonFile::parseJson($res);
  32882. } else {
  32883. $composer = $this->getBaseComposerInformation($identifier);
  32884. if ($this->shouldCache($identifier)) {
  32885. $this->cache->write($identifier, json_encode($composer));
  32886. }
  32887. }
  32888. if ($composer !== null) {
  32889. if (isset($composer['support']) && !is_array($composer['support'])) {
  32890. $composer['support'] = [];
  32891. }
  32892. if (!isset($composer['support']['source'])) {
  32893. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  32894. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  32895. }
  32896. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  32897. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  32898. }
  32899. if (!isset($composer['abandoned']) && $this->isArchived) {
  32900. $composer['abandoned'] = true;
  32901. }
  32902. if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
  32903. $composer['funding'] = $funding;
  32904. }
  32905. }
  32906. $this->infoCache[$identifier] = $composer;
  32907. }
  32908. return $this->infoCache[$identifier];
  32909. }
  32910. private function getFundingInfo()
  32911. {
  32912. if (null !== $this->fundingInfo) {
  32913. return $this->fundingInfo;
  32914. }
  32915. if ($this->originUrl !== 'github.com') {
  32916. return $this->fundingInfo = false;
  32917. }
  32918. foreach ([$this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml'] as $file) {
  32919. try {
  32920. $response = $this->httpDownloader->get($file, [
  32921. 'retry-auth-failure' => false,
  32922. ])->decodeJson();
  32923. } catch (TransportException $e) {
  32924. continue;
  32925. }
  32926. if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
  32927. continue;
  32928. }
  32929. break;
  32930. }
  32931. if (empty($funding)) {
  32932. return $this->fundingInfo = false;
  32933. }
  32934. $result = [];
  32935. $key = null;
  32936. foreach (Preg::split('{\r?\n}', $funding) as $line) {
  32937. $line = trim($line);
  32938. if (Preg::isMatchStrictGroups('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
  32939. if ($match[2] === '[') {
  32940. $key = $match[1];
  32941. continue;
  32942. }
  32943. if (Preg::isMatchStrictGroups('{^\[(.*?)\](?:\s*#.*)?$}', $match[2], $match2)) {
  32944. foreach (array_map('trim', Preg::split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
  32945. $result[] = ['type' => $match[1], 'url' => trim($item, '"\' ')];
  32946. }
  32947. } elseif (Preg::isMatchStrictGroups('{^([^#].*?)(?:\s+#.*)?$}', $match[2], $match2)) {
  32948. $result[] = ['type' => $match[1], 'url' => trim($match2[1], '"\' ')];
  32949. }
  32950. $key = null;
  32951. } elseif (Preg::isMatchStrictGroups('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
  32952. $key = $match[1];
  32953. } elseif ($key !== null && (
  32954. Preg::isMatchStrictGroups('{^-\s*(.+)(?:\s+#.*)?$}', $line, $match)
  32955. || Preg::isMatchStrictGroups('{^(.+),(?:\s*#.*)?$}', $line, $match)
  32956. )) {
  32957. $result[] = ['type' => $key, 'url' => trim($match[1], '"\' ')];
  32958. } elseif ($key !== null && $line === ']') {
  32959. $key = null;
  32960. }
  32961. }
  32962. foreach ($result as $key => $item) {
  32963. switch ($item['type']) {
  32964. case 'tidelift':
  32965. $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
  32966. break;
  32967. case 'github':
  32968. $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
  32969. break;
  32970. case 'patreon':
  32971. $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
  32972. break;
  32973. case 'otechie':
  32974. $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
  32975. break;
  32976. case 'open_collective':
  32977. $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
  32978. break;
  32979. case 'liberapay':
  32980. $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
  32981. break;
  32982. case 'ko_fi':
  32983. $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
  32984. break;
  32985. case 'issuehunt':
  32986. $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
  32987. break;
  32988. case 'community_bridge':
  32989. $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
  32990. break;
  32991. case 'buy_me_a_coffee':
  32992. $result[$key]['url'] = 'https://www.buymeacoffee.com/' . basename($item['url']);
  32993. break;
  32994. }
  32995. }
  32996. return $this->fundingInfo = $result;
  32997. }
  32998. public function getFileContent(string $file, string $identifier): ?string
  32999. {
  33000. if ($this->gitDriver) {
  33001. return $this->gitDriver->getFileContent($file, $identifier);
  33002. }
  33003. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  33004. $resource = $this->getContents($resource)->decodeJson();
  33005. if ((!isset($resource['content']) || $resource['content'] === '') && $resource['encoding'] === 'none' && isset($resource['git_url'])) {
  33006. $resource = $this->getContents($resource['git_url'])->decodeJson();
  33007. }
  33008. if (!isset($resource['content']) || $resource['encoding'] !== 'base64' || false === ($content = base64_decode($resource['content']))) {
  33009. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  33010. }
  33011. return $content;
  33012. }
  33013. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  33014. {
  33015. if ($this->gitDriver) {
  33016. return $this->gitDriver->getChangeDate($identifier);
  33017. }
  33018. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  33019. $commit = $this->getContents($resource)->decodeJson();
  33020. return new \DateTimeImmutable($commit['commit']['committer']['date']);
  33021. }
  33022. public function getTags(): array
  33023. {
  33024. if ($this->gitDriver) {
  33025. return $this->gitDriver->getTags();
  33026. }
  33027. if (null === $this->tags) {
  33028. $tags = [];
  33029. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  33030. do {
  33031. $response = $this->getContents($resource);
  33032. $tagsData = $response->decodeJson();
  33033. foreach ($tagsData as $tag) {
  33034. $tags[$tag['name']] = $tag['commit']['sha'];
  33035. }
  33036. $resource = $this->getNextPage($response);
  33037. } while ($resource);
  33038. $this->tags = $tags;
  33039. }
  33040. return $this->tags;
  33041. }
  33042. public function getBranches(): array
  33043. {
  33044. if ($this->gitDriver) {
  33045. return $this->gitDriver->getBranches();
  33046. }
  33047. if (null === $this->branches) {
  33048. $branches = [];
  33049. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  33050. do {
  33051. $response = $this->getContents($resource);
  33052. $branchData = $response->decodeJson();
  33053. foreach ($branchData as $branch) {
  33054. $name = substr($branch['ref'], 11);
  33055. if ($name !== 'gh-pages') {
  33056. $branches[$name] = $branch['object']['sha'];
  33057. }
  33058. }
  33059. $resource = $this->getNextPage($response);
  33060. } while ($resource);
  33061. $this->branches = $branches;
  33062. }
  33063. return $this->branches;
  33064. }
  33065. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  33066. {
  33067. if (!Preg::isMatch('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#', $url, $matches)) {
  33068. return false;
  33069. }
  33070. $originUrl = $matches[2] ?? (string) $matches[3];
  33071. if (!in_array(strtolower(Preg::replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  33072. return false;
  33073. }
  33074. if (!extension_loaded('openssl')) {
  33075. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  33076. return false;
  33077. }
  33078. return true;
  33079. }
  33080. public function getRepoData(): ?array
  33081. {
  33082. $this->fetchRootIdentifier();
  33083. return $this->repoData;
  33084. }
  33085. protected function generateSshUrl(): string
  33086. {
  33087. if (false !== strpos($this->originUrl, ':')) {
  33088. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  33089. }
  33090. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  33091. }
  33092. protected function getContents(string $url, bool $fetchingRepoData = false): Response
  33093. {
  33094. try {
  33095. return parent::getContents($url);
  33096. } catch (TransportException $e) {
  33097. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->httpDownloader);
  33098. switch ($e->getCode()) {
  33099. case 401:
  33100. case 404:
  33101. if (!$fetchingRepoData) {
  33102. throw $e;
  33103. }
  33104. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  33105. return parent::getContents($url);
  33106. }
  33107. if (!$this->io->isInteractive()) {
  33108. $this->attemptCloneFallback();
  33109. return new Response(['url' => 'dummy'], 200, [], 'null');
  33110. }
  33111. $scopesIssued = [];
  33112. $scopesNeeded = [];
  33113. if ($headers = $e->getHeaders()) {
  33114. if ($scopes = Response::findHeaderValue($headers, 'X-OAuth-Scopes')) {
  33115. $scopesIssued = explode(' ', $scopes);
  33116. }
  33117. if ($scopes = Response::findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  33118. $scopesNeeded = explode(' ', $scopes);
  33119. }
  33120. }
  33121. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  33122. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  33123. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  33124. }
  33125. return parent::getContents($url);
  33126. case 403:
  33127. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  33128. return parent::getContents($url);
  33129. }
  33130. if (!$this->io->isInteractive() && $fetchingRepoData) {
  33131. $this->attemptCloneFallback();
  33132. return new Response(['url' => 'dummy'], 200, [], 'null');
  33133. }
  33134. $rateLimited = $gitHubUtil->isRateLimited((array) $e->getHeaders());
  33135. if (!$this->io->hasAuthentication($this->originUrl)) {
  33136. if (!$this->io->isInteractive()) {
  33137. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  33138. throw $e;
  33139. }
  33140. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  33141. return parent::getContents($url);
  33142. }
  33143. if ($rateLimited) {
  33144. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  33145. $this->io->writeError(sprintf(
  33146. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  33147. $rateLimit['limit'],
  33148. $rateLimit['reset']
  33149. ));
  33150. }
  33151. throw $e;
  33152. default:
  33153. throw $e;
  33154. }
  33155. }
  33156. }
  33157. protected function fetchRootIdentifier(): void
  33158. {
  33159. if ($this->repoData) {
  33160. return;
  33161. }
  33162. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  33163. try {
  33164. $this->repoData = $this->getContents($repoDataUrl, true)->decodeJson();
  33165. } catch (TransportException $e) {
  33166. if ($e->getCode() === 499) {
  33167. $this->attemptCloneFallback();
  33168. } else {
  33169. throw $e;
  33170. }
  33171. }
  33172. if (null === $this->repoData && null !== $this->gitDriver) {
  33173. return;
  33174. }
  33175. $this->owner = $this->repoData['owner']['login'];
  33176. $this->repository = $this->repoData['name'];
  33177. $this->isPrivate = !empty($this->repoData['private']);
  33178. if (isset($this->repoData['default_branch'])) {
  33179. $this->rootIdentifier = $this->repoData['default_branch'];
  33180. } elseif (isset($this->repoData['master_branch'])) {
  33181. $this->rootIdentifier = $this->repoData['master_branch'];
  33182. } else {
  33183. $this->rootIdentifier = 'master';
  33184. }
  33185. $this->hasIssues = !empty($this->repoData['has_issues']);
  33186. $this->isArchived = !empty($this->repoData['archived']);
  33187. }
  33188. protected function attemptCloneFallback(): bool
  33189. {
  33190. $this->isPrivate = true;
  33191. try {
  33192. $this->setupGitDriver($this->generateSshUrl());
  33193. return true;
  33194. } catch (\RuntimeException $e) {
  33195. $this->gitDriver = null;
  33196. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  33197. throw $e;
  33198. }
  33199. }
  33200. protected function setupGitDriver(string $url): void
  33201. {
  33202. $this->gitDriver = new GitDriver(
  33203. ['url' => $url],
  33204. $this->io,
  33205. $this->config,
  33206. $this->httpDownloader,
  33207. $this->process
  33208. );
  33209. $this->gitDriver->initialize();
  33210. }
  33211. protected function getNextPage(Response $response): ?string
  33212. {
  33213. $header = $response->getHeader('link');
  33214. if (!$header) {
  33215. return null;
  33216. }
  33217. $links = explode(',', $header);
  33218. foreach ($links as $link) {
  33219. if (Preg::isMatch('{<(.+?)>; *rel="next"}', $link, $match)) {
  33220. return $match[1];
  33221. }
  33222. }
  33223. return null;
  33224. }
  33225. }
  33226. <?php declare(strict_types=1);
  33227. namespace Composer\Repository\Vcs;
  33228. use Composer\Config;
  33229. use Composer\Cache;
  33230. use Composer\IO\IOInterface;
  33231. use Composer\Json\JsonFile;
  33232. use Composer\Downloader\TransportException;
  33233. use Composer\Pcre\Preg;
  33234. use Composer\Util\HttpDownloader;
  33235. use Composer\Util\GitLab;
  33236. use Composer\Util\Http\Response;
  33237. class GitLabDriver extends VcsDriver
  33238. {
  33239. private $scheme;
  33240. private $namespace;
  33241. private $repository;
  33242. private $project = null;
  33243. private $commits = [];
  33244. private $tags;
  33245. private $branches;
  33246. protected $gitDriver = null;
  33247. protected $protocol;
  33248. private $isPrivate = true;
  33249. private $hasNonstandardOrigin = false;
  33250. public const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  33251. public function initialize(): void
  33252. {
  33253. if (!Preg::isMatch(self::URL_REGEX, $this->url, $match)) {
  33254. throw new \InvalidArgumentException(sprintf('The GitLab repository URL %s is invalid. It must be the HTTP URL of a GitLab project.', $this->url));
  33255. }
  33256. $guessedDomain = $match['domain'] ?? (string) $match['domain2'];
  33257. $configuredDomains = $this->config->get('gitlab-domains');
  33258. $urlParts = explode('/', $match['parts']);
  33259. $this->scheme = in_array($match['scheme'], ['https', 'http'], true)
  33260. ? $match['scheme']
  33261. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  33262. ;
  33263. $origin = self::determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  33264. if (false === $origin) {
  33265. throw new \LogicException('It should not be possible to create a gitlab driver with an unparsable origin URL ('.$this->url.')');
  33266. }
  33267. $this->originUrl = $origin;
  33268. if (is_string($protocol = $this->config->get('gitlab-protocol'))) {
  33269. if (!in_array($protocol, ['git', 'http', 'https'], true)) {
  33270. throw new \RuntimeException('gitlab-protocol must be one of git, http.');
  33271. }
  33272. $this->protocol = $protocol === 'git' ? 'ssh' : 'http';
  33273. }
  33274. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  33275. $this->hasNonstandardOrigin = true;
  33276. }
  33277. $this->namespace = implode('/', $urlParts);
  33278. $this->repository = Preg::replace('#(\.git)$#', '', $match['repo']);
  33279. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  33280. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  33281. $this->fetchProject();
  33282. }
  33283. public function setHttpDownloader(HttpDownloader $httpDownloader): void
  33284. {
  33285. $this->httpDownloader = $httpDownloader;
  33286. }
  33287. public function getComposerInformation(string $identifier): ?array
  33288. {
  33289. if ($this->gitDriver) {
  33290. return $this->gitDriver->getComposerInformation($identifier);
  33291. }
  33292. if (!isset($this->infoCache[$identifier])) {
  33293. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  33294. $composer = JsonFile::parseJson($res);
  33295. } else {
  33296. $composer = $this->getBaseComposerInformation($identifier);
  33297. if ($this->shouldCache($identifier)) {
  33298. $this->cache->write($identifier, json_encode($composer));
  33299. }
  33300. }
  33301. if (null !== $composer) {
  33302. if (isset($composer['support']) && !is_array($composer['support'])) {
  33303. $composer['support'] = [];
  33304. }
  33305. if (!isset($composer['support']['source']) && isset($this->project['web_url'])) {
  33306. $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier;
  33307. $composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label);
  33308. }
  33309. if (!isset($composer['support']['issues']) && !empty($this->project['issues_enabled']) && isset($this->project['web_url'])) {
  33310. $composer['support']['issues'] = sprintf('%s/-/issues', $this->project['web_url']);
  33311. }
  33312. if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
  33313. $composer['abandoned'] = true;
  33314. }
  33315. }
  33316. $this->infoCache[$identifier] = $composer;
  33317. }
  33318. return $this->infoCache[$identifier];
  33319. }
  33320. public function getFileContent(string $file, string $identifier): ?string
  33321. {
  33322. if ($this->gitDriver) {
  33323. return $this->gitDriver->getFileContent($file, $identifier);
  33324. }
  33325. if (!Preg::isMatch('{[a-f0-9]{40}}i', $identifier)) {
  33326. $branches = $this->getBranches();
  33327. if (isset($branches[$identifier])) {
  33328. $identifier = $branches[$identifier];
  33329. }
  33330. }
  33331. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  33332. try {
  33333. $content = $this->getContents($resource)->getBody();
  33334. } catch (TransportException $e) {
  33335. if ($e->getCode() !== 404) {
  33336. throw $e;
  33337. }
  33338. return null;
  33339. }
  33340. return $content;
  33341. }
  33342. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  33343. {
  33344. if ($this->gitDriver) {
  33345. return $this->gitDriver->getChangeDate($identifier);
  33346. }
  33347. if (isset($this->commits[$identifier])) {
  33348. return new \DateTimeImmutable($this->commits[$identifier]['committed_date']);
  33349. }
  33350. return null;
  33351. }
  33352. public function getRepositoryUrl(): string
  33353. {
  33354. if ($this->protocol) {
  33355. return $this->project["{$this->protocol}_url_to_repo"];
  33356. }
  33357. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  33358. }
  33359. public function getUrl(): string
  33360. {
  33361. if ($this->gitDriver) {
  33362. return $this->gitDriver->getUrl();
  33363. }
  33364. return $this->project['web_url'];
  33365. }
  33366. public function getDist(string $identifier): ?array
  33367. {
  33368. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  33369. return ['type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => ''];
  33370. }
  33371. public function getSource(string $identifier): array
  33372. {
  33373. if ($this->gitDriver) {
  33374. return $this->gitDriver->getSource($identifier);
  33375. }
  33376. return ['type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier];
  33377. }
  33378. public function getRootIdentifier(): string
  33379. {
  33380. if ($this->gitDriver) {
  33381. return $this->gitDriver->getRootIdentifier();
  33382. }
  33383. return $this->project['default_branch'];
  33384. }
  33385. public function getBranches(): array
  33386. {
  33387. if ($this->gitDriver) {
  33388. return $this->gitDriver->getBranches();
  33389. }
  33390. if (null === $this->branches) {
  33391. $this->branches = $this->getReferences('branches');
  33392. }
  33393. return $this->branches;
  33394. }
  33395. public function getTags(): array
  33396. {
  33397. if ($this->gitDriver) {
  33398. return $this->gitDriver->getTags();
  33399. }
  33400. if (null === $this->tags) {
  33401. $this->tags = $this->getReferences('tags');
  33402. }
  33403. return $this->tags;
  33404. }
  33405. public function getApiUrl(): string
  33406. {
  33407. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  33408. }
  33409. private function urlEncodeAll(string $string): string
  33410. {
  33411. $encoded = '';
  33412. for ($i = 0; isset($string[$i]); $i++) {
  33413. $character = $string[$i];
  33414. if (!ctype_alnum($character) && !in_array($character, ['-', '_'], true)) {
  33415. $character = '%' . sprintf('%02X', ord($character));
  33416. }
  33417. $encoded .= $character;
  33418. }
  33419. return $encoded;
  33420. }
  33421. protected function getReferences(string $type): array
  33422. {
  33423. $perPage = 100;
  33424. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  33425. $references = [];
  33426. do {
  33427. $response = $this->getContents($resource);
  33428. $data = $response->decodeJson();
  33429. foreach ($data as $datum) {
  33430. $references[$datum['name']] = $datum['commit']['id'];
  33431. $this->commits[$datum['commit']['id']] = $datum['commit'];
  33432. }
  33433. if (count($data) >= $perPage) {
  33434. $resource = $this->getNextPage($response);
  33435. } else {
  33436. $resource = false;
  33437. }
  33438. } while ($resource);
  33439. return $references;
  33440. }
  33441. protected function fetchProject(): void
  33442. {
  33443. if (!is_null($this->project)) {
  33444. return;
  33445. }
  33446. $resource = $this->getApiUrl();
  33447. $this->project = $this->getContents($resource, true)->decodeJson();
  33448. if (isset($this->project['visibility'])) {
  33449. $this->isPrivate = $this->project['visibility'] !== 'public';
  33450. } else {
  33451. $this->isPrivate = false;
  33452. }
  33453. }
  33454. protected function attemptCloneFallback(): bool
  33455. {
  33456. if ($this->isPrivate === false) {
  33457. $url = $this->generatePublicUrl();
  33458. } else {
  33459. $url = $this->generateSshUrl();
  33460. }
  33461. try {
  33462. $this->setupGitDriver($url);
  33463. return true;
  33464. } catch (\RuntimeException $e) {
  33465. $this->gitDriver = null;
  33466. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  33467. throw $e;
  33468. }
  33469. }
  33470. protected function generateSshUrl(): string
  33471. {
  33472. if ($this->hasNonstandardOrigin) {
  33473. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  33474. }
  33475. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  33476. }
  33477. protected function generatePublicUrl(): string
  33478. {
  33479. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  33480. }
  33481. protected function setupGitDriver(string $url): void
  33482. {
  33483. $this->gitDriver = new GitDriver(
  33484. ['url' => $url],
  33485. $this->io,
  33486. $this->config,
  33487. $this->httpDownloader,
  33488. $this->process
  33489. );
  33490. $this->gitDriver->initialize();
  33491. }
  33492. protected function getContents(string $url, bool $fetchingRepoData = false): Response
  33493. {
  33494. try {
  33495. $response = parent::getContents($url);
  33496. if ($fetchingRepoData) {
  33497. $json = $response->decodeJson();
  33498. if (!isset($json['default_branch']) && isset($json['permissions'])) {
  33499. $this->isPrivate = $json['visibility'] !== 'public';
  33500. $moreThanGuestAccess = false;
  33501. foreach ($json['permissions'] as $permission) {
  33502. if ($permission && $permission['access_level'] > 10) {
  33503. $moreThanGuestAccess = true;
  33504. }
  33505. }
  33506. if (!$moreThanGuestAccess) {
  33507. $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
  33508. $this->attemptCloneFallback();
  33509. return new Response(['url' => 'dummy'], 200, [], 'null');
  33510. }
  33511. }
  33512. if (!isset($json['default_branch'])) {
  33513. if (isset($json['repository_access_level']) && $json['repository_access_level'] === 'disabled') {
  33514. throw new TransportException('The GitLab repository is disabled in the project', 400);
  33515. }
  33516. if (!empty($json['id'])) {
  33517. $this->isPrivate = false;
  33518. }
  33519. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  33520. }
  33521. }
  33522. return $response;
  33523. } catch (TransportException $e) {
  33524. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->httpDownloader);
  33525. switch ($e->getCode()) {
  33526. case 401:
  33527. case 404:
  33528. if (!$fetchingRepoData) {
  33529. throw $e;
  33530. }
  33531. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  33532. return parent::getContents($url);
  33533. }
  33534. if ($gitLabUtil->isOAuthExpired($this->originUrl) && $gitLabUtil->authorizeOAuthRefresh($this->scheme, $this->originUrl)) {
  33535. return parent::getContents($url);
  33536. }
  33537. if (!$this->io->isInteractive()) {
  33538. $this->attemptCloneFallback();
  33539. return new Response(['url' => 'dummy'], 200, [], 'null');
  33540. }
  33541. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  33542. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  33543. return parent::getContents($url);
  33544. case 403:
  33545. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  33546. return parent::getContents($url);
  33547. }
  33548. if (!$this->io->isInteractive() && $fetchingRepoData) {
  33549. $this->attemptCloneFallback();
  33550. return new Response(['url' => 'dummy'], 200, [], 'null');
  33551. }
  33552. throw $e;
  33553. default:
  33554. throw $e;
  33555. }
  33556. }
  33557. }
  33558. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  33559. {
  33560. if (!Preg::isMatch(self::URL_REGEX, $url, $match)) {
  33561. return false;
  33562. }
  33563. $scheme = $match['scheme'];
  33564. $guessedDomain = $match['domain'] ?? (string) $match['domain2'];
  33565. $urlParts = explode('/', $match['parts']);
  33566. if (false === self::determineOrigin($config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  33567. return false;
  33568. }
  33569. if ('https' === $scheme && !extension_loaded('openssl')) {
  33570. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  33571. return false;
  33572. }
  33573. return true;
  33574. }
  33575. public function getRepoData(): ?array
  33576. {
  33577. $this->fetchProject();
  33578. return $this->project;
  33579. }
  33580. protected function getNextPage(Response $response): ?string
  33581. {
  33582. $header = $response->getHeader('link');
  33583. $links = explode(',', $header);
  33584. foreach ($links as $link) {
  33585. if (Preg::isMatchStrictGroups('{<(.+?)>; *rel="next"}', $link, $match)) {
  33586. return $match[1];
  33587. }
  33588. }
  33589. return null;
  33590. }
  33591. private static function determineOrigin(array $configuredDomains, string $guessedDomain, array &$urlParts, ?string $portNumber)
  33592. {
  33593. $guessedDomain = strtolower($guessedDomain);
  33594. if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  33595. if (null !== $portNumber) {
  33596. return $guessedDomain.':'.$portNumber;
  33597. }
  33598. return $guessedDomain;
  33599. }
  33600. if (null !== $portNumber) {
  33601. $guessedDomain .= ':'.$portNumber;
  33602. }
  33603. while (null !== ($part = array_shift($urlParts))) {
  33604. $guessedDomain .= '/' . $part;
  33605. if (in_array($guessedDomain, $configuredDomains) || (null !== $portNumber && in_array(Preg::replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  33606. return $guessedDomain;
  33607. }
  33608. }
  33609. return false;
  33610. }
  33611. }
  33612. <?php declare(strict_types=1);
  33613. namespace Composer\Repository\Vcs;
  33614. use Composer\Config;
  33615. use Composer\Cache;
  33616. use Composer\Pcre\Preg;
  33617. use Composer\Util\Hg as HgUtils;
  33618. use Composer\Util\ProcessExecutor;
  33619. use Composer\Util\Filesystem;
  33620. use Composer\IO\IOInterface;
  33621. use Composer\Util\Url;
  33622. class HgDriver extends VcsDriver
  33623. {
  33624. protected $tags;
  33625. protected $branches;
  33626. protected $rootIdentifier;
  33627. protected $repoDir;
  33628. public function initialize(): void
  33629. {
  33630. if (Filesystem::isLocalPath($this->url)) {
  33631. $this->repoDir = $this->url;
  33632. } else {
  33633. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  33634. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  33635. }
  33636. $cacheDir = $this->config->get('cache-vcs-dir');
  33637. $this->repoDir = $cacheDir . '/' . Preg::replace('{[^a-z0-9]}i', '-', Url::sanitize($this->url)) . '/';
  33638. $fs = new Filesystem();
  33639. $fs->ensureDirectoryExists($cacheDir);
  33640. if (!is_writable(dirname($this->repoDir))) {
  33641. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  33642. }
  33643. $this->config->prohibitUrlByConfig($this->url, $this->io);
  33644. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  33645. if (is_dir($this->repoDir) && 0 === $this->process->execute(['hg', 'summary'], $output, $this->repoDir)) {
  33646. if (0 !== $this->process->execute(['hg', 'pull'], $output, $this->repoDir)) {
  33647. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  33648. }
  33649. } else {
  33650. $fs->removeDirectory($this->repoDir);
  33651. $repoDir = $this->repoDir;
  33652. $command = static function ($url) use ($repoDir): array {
  33653. return ['hg', 'clone', '--noupdate', '--', $url, $repoDir];
  33654. };
  33655. $hgUtils->runCommand($command, $this->url, null);
  33656. }
  33657. }
  33658. $this->getTags();
  33659. $this->getBranches();
  33660. }
  33661. public function getRootIdentifier(): string
  33662. {
  33663. if (null === $this->rootIdentifier) {
  33664. $this->process->execute(['hg', 'tip', '--template', '{node}'], $output, $this->repoDir);
  33665. $output = $this->process->splitLines($output);
  33666. $this->rootIdentifier = $output[0];
  33667. }
  33668. return $this->rootIdentifier;
  33669. }
  33670. public function getUrl(): string
  33671. {
  33672. return $this->url;
  33673. }
  33674. public function getSource(string $identifier): array
  33675. {
  33676. return ['type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier];
  33677. }
  33678. public function getDist(string $identifier): ?array
  33679. {
  33680. return null;
  33681. }
  33682. public function getFileContent(string $file, string $identifier): ?string
  33683. {
  33684. if (isset($identifier[0]) && $identifier[0] === '-') {
  33685. throw new \RuntimeException('Invalid hg identifier detected. Identifier must not start with a -, given: ' . $identifier);
  33686. }
  33687. $resource = ['hg', 'cat', '-r', $identifier, '--', $file];
  33688. $this->process->execute($resource, $content, $this->repoDir);
  33689. if (!trim($content)) {
  33690. return null;
  33691. }
  33692. return $content;
  33693. }
  33694. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  33695. {
  33696. $this->process->execute(
  33697. ['hg', 'log', '--template', '{date|rfc3339date}', '-r', $identifier],
  33698. $output,
  33699. $this->repoDir
  33700. );
  33701. return new \DateTimeImmutable(trim($output), new \DateTimeZone('UTC'));
  33702. }
  33703. public function getTags(): array
  33704. {
  33705. if (null === $this->tags) {
  33706. $tags = [];
  33707. $this->process->execute(['hg', 'tags'], $output, $this->repoDir);
  33708. foreach ($this->process->splitLines($output) as $tag) {
  33709. if ($tag && Preg::isMatchStrictGroups('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  33710. $tags[$match[1]] = $match[2];
  33711. }
  33712. }
  33713. unset($tags['tip']);
  33714. $this->tags = $tags;
  33715. }
  33716. return $this->tags;
  33717. }
  33718. public function getBranches(): array
  33719. {
  33720. if (null === $this->branches) {
  33721. $branches = [];
  33722. $bookmarks = [];
  33723. $this->process->execute(['hg', 'branches'], $output, $this->repoDir);
  33724. foreach ($this->process->splitLines($output) as $branch) {
  33725. if ($branch && Preg::isMatchStrictGroups('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match) && $match[1][0] !== '-') {
  33726. $branches[$match[1]] = $match[2];
  33727. }
  33728. }
  33729. $this->process->execute(['hg', 'bookmarks'], $output, $this->repoDir);
  33730. foreach ($this->process->splitLines($output) as $branch) {
  33731. if ($branch && Preg::isMatchStrictGroups('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match) && $match[1][0] !== '-') {
  33732. $bookmarks[$match[1]] = $match[2];
  33733. }
  33734. }
  33735. $this->branches = array_merge($bookmarks, $branches);
  33736. }
  33737. return $this->branches;
  33738. }
  33739. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  33740. {
  33741. if (Preg::isMatch('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  33742. return true;
  33743. }
  33744. if (Filesystem::isLocalPath($url)) {
  33745. $url = Filesystem::getPlatformPath($url);
  33746. if (!is_dir($url)) {
  33747. return false;
  33748. }
  33749. $process = new ProcessExecutor($io);
  33750. if ($process->execute(['hg', 'summary'], $output, $url) === 0) {
  33751. return true;
  33752. }
  33753. }
  33754. if (!$deep) {
  33755. return false;
  33756. }
  33757. $process = new ProcessExecutor($io);
  33758. $exit = $process->execute(['hg', 'identify', '--', $url], $ignored);
  33759. return $exit === 0;
  33760. }
  33761. }
  33762. <?php declare(strict_types=1);
  33763. namespace Composer\Repository\Vcs;
  33764. use Composer\Config;
  33765. use Composer\Cache;
  33766. use Composer\IO\IOInterface;
  33767. use Composer\Pcre\Preg;
  33768. use Composer\Util\ProcessExecutor;
  33769. use Composer\Util\Perforce;
  33770. use Composer\Util\Http\Response;
  33771. class PerforceDriver extends VcsDriver
  33772. {
  33773. protected $depot;
  33774. protected $branch;
  33775. protected $perforce = null;
  33776. public function initialize(): void
  33777. {
  33778. $this->depot = $this->repoConfig['depot'];
  33779. $this->branch = '';
  33780. if (!empty($this->repoConfig['branch'])) {
  33781. $this->branch = $this->repoConfig['branch'];
  33782. }
  33783. $this->initPerforce($this->repoConfig);
  33784. $this->perforce->p4Login();
  33785. $this->perforce->checkStream();
  33786. $this->perforce->writeP4ClientSpec();
  33787. $this->perforce->connectClient();
  33788. }
  33789. private function initPerforce(array $repoConfig): void
  33790. {
  33791. if (!empty($this->perforce)) {
  33792. return;
  33793. }
  33794. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  33795. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  33796. }
  33797. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  33798. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  33799. }
  33800. public function getFileContent(string $file, string $identifier): ?string
  33801. {
  33802. return $this->perforce->getFileContent($file, $identifier);
  33803. }
  33804. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  33805. {
  33806. return null;
  33807. }
  33808. public function getRootIdentifier(): string
  33809. {
  33810. return $this->branch;
  33811. }
  33812. public function getBranches(): array
  33813. {
  33814. return $this->perforce->getBranches();
  33815. }
  33816. public function getTags(): array
  33817. {
  33818. return $this->perforce->getTags();
  33819. }
  33820. public function getDist(string $identifier): ?array
  33821. {
  33822. return null;
  33823. }
  33824. public function getSource(string $identifier): array
  33825. {
  33826. return [
  33827. 'type' => 'perforce',
  33828. 'url' => $this->repoConfig['url'],
  33829. 'reference' => $identifier,
  33830. 'p4user' => $this->perforce->getUser(),
  33831. ];
  33832. }
  33833. public function getUrl(): string
  33834. {
  33835. return $this->url;
  33836. }
  33837. public function hasComposerFile(string $identifier): bool
  33838. {
  33839. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  33840. return !empty($composerInfo);
  33841. }
  33842. public function getContents(string $url): Response
  33843. {
  33844. throw new \BadMethodCallException('Not implemented/used in PerforceDriver');
  33845. }
  33846. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  33847. {
  33848. if ($deep || Preg::isMatch('#\b(perforce|p4)\b#i', $url)) {
  33849. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  33850. }
  33851. return false;
  33852. }
  33853. public function cleanup(): void
  33854. {
  33855. $this->perforce->cleanupClientSpec();
  33856. $this->perforce = null;
  33857. }
  33858. public function getDepot(): string
  33859. {
  33860. return $this->depot;
  33861. }
  33862. public function getBranch(): string
  33863. {
  33864. return $this->branch;
  33865. }
  33866. }
  33867. <?php declare(strict_types=1);
  33868. namespace Composer\Repository\Vcs;
  33869. use Composer\Cache;
  33870. use Composer\Config;
  33871. use Composer\Json\JsonFile;
  33872. use Composer\Pcre\Preg;
  33873. use Composer\Util\ProcessExecutor;
  33874. use Composer\Util\Filesystem;
  33875. use Composer\Util\Url;
  33876. use Composer\Util\Svn as SvnUtil;
  33877. use Composer\IO\IOInterface;
  33878. use Composer\Downloader\TransportException;
  33879. class SvnDriver extends VcsDriver
  33880. {
  33881. protected $baseUrl;
  33882. protected $tags;
  33883. protected $branches;
  33884. protected $rootIdentifier;
  33885. protected $trunkPath = 'trunk';
  33886. protected $branchesPath = 'branches';
  33887. protected $tagsPath = 'tags';
  33888. protected $packagePath = '';
  33889. protected $cacheCredentials = true;
  33890. private $util;
  33891. public function initialize(): void
  33892. {
  33893. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  33894. SvnUtil::cleanEnv();
  33895. if (isset($this->repoConfig['trunk-path'])) {
  33896. $this->trunkPath = $this->repoConfig['trunk-path'];
  33897. }
  33898. if (isset($this->repoConfig['branches-path'])) {
  33899. $this->branchesPath = $this->repoConfig['branches-path'];
  33900. }
  33901. if (isset($this->repoConfig['tags-path'])) {
  33902. $this->tagsPath = $this->repoConfig['tags-path'];
  33903. }
  33904. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  33905. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  33906. }
  33907. if (isset($this->repoConfig['package-path'])) {
  33908. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  33909. }
  33910. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  33911. $this->baseUrl = substr($this->url, 0, $pos);
  33912. }
  33913. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.Preg::replace('{[^a-z0-9.]}i', '-', Url::sanitize($this->baseUrl)));
  33914. $this->cache->setReadOnly($this->config->get('cache-read-only'));
  33915. $this->getBranches();
  33916. $this->getTags();
  33917. }
  33918. public function getRootIdentifier(): string
  33919. {
  33920. return $this->rootIdentifier ?: $this->trunkPath;
  33921. }
  33922. public function getUrl(): string
  33923. {
  33924. return $this->url;
  33925. }
  33926. public function getSource(string $identifier): array
  33927. {
  33928. return ['type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier];
  33929. }
  33930. public function getDist(string $identifier): ?array
  33931. {
  33932. return null;
  33933. }
  33934. protected function shouldCache(string $identifier): bool
  33935. {
  33936. return $this->cache && Preg::isMatch('{@\d+$}', $identifier);
  33937. }
  33938. public function getComposerInformation(string $identifier): ?array
  33939. {
  33940. if (!isset($this->infoCache[$identifier])) {
  33941. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  33942. if ($res === '""') {
  33943. $res = 'null';
  33944. $this->cache->write($identifier.'.json', json_encode(null));
  33945. }
  33946. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  33947. }
  33948. try {
  33949. $composer = $this->getBaseComposerInformation($identifier);
  33950. } catch (TransportException $e) {
  33951. $message = $e->getMessage();
  33952. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  33953. throw $e;
  33954. }
  33955. $composer = null;
  33956. }
  33957. if ($this->shouldCache($identifier)) {
  33958. $this->cache->write($identifier.'.json', json_encode($composer));
  33959. }
  33960. $this->infoCache[$identifier] = $composer;
  33961. }
  33962. if (!is_array($this->infoCache[$identifier])) {
  33963. return null;
  33964. }
  33965. return $this->infoCache[$identifier];
  33966. }
  33967. public function getFileContent(string $file, string $identifier): ?string
  33968. {
  33969. $identifier = '/' . trim($identifier, '/') . '/';
  33970. if (Preg::isMatch('{^(.+?)(@\d+)?/$}', $identifier, $match) && $match[2] !== null) {
  33971. $path = $match[1];
  33972. $rev = $match[2];
  33973. } else {
  33974. $path = $identifier;
  33975. $rev = '';
  33976. }
  33977. try {
  33978. $resource = $path.$file;
  33979. $output = $this->execute(['svn', 'cat'], $this->baseUrl . $resource . $rev);
  33980. if ('' === trim($output)) {
  33981. return null;
  33982. }
  33983. } catch (\RuntimeException $e) {
  33984. throw new TransportException($e->getMessage());
  33985. }
  33986. return $output;
  33987. }
  33988. public function getChangeDate(string $identifier): ?\DateTimeImmutable
  33989. {
  33990. $identifier = '/' . trim($identifier, '/') . '/';
  33991. if (Preg::isMatch('{^(.+?)(@\d+)?/$}', $identifier, $match) && null !== $match[2]) {
  33992. $path = $match[1];
  33993. $rev = $match[2];
  33994. } else {
  33995. $path = $identifier;
  33996. $rev = '';
  33997. }
  33998. $output = $this->execute(['svn', 'info'], $this->baseUrl . $path . $rev);
  33999. foreach ($this->process->splitLines($output) as $line) {
  34000. if ($line !== '' && Preg::isMatchStrictGroups('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  34001. return new \DateTimeImmutable($match[1], new \DateTimeZone('UTC'));
  34002. }
  34003. }
  34004. return null;
  34005. }
  34006. public function getTags(): array
  34007. {
  34008. if (null === $this->tags) {
  34009. $tags = [];
  34010. if ($this->tagsPath !== false) {
  34011. $output = $this->execute(['svn', 'ls', '--verbose'], $this->baseUrl . '/' . $this->tagsPath);
  34012. if ($output !== '') {
  34013. $lastRev = 0;
  34014. foreach ($this->process->splitLines($output) as $line) {
  34015. $line = trim($line);
  34016. if ($line !== '' && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  34017. if ($match[2] === './') {
  34018. $lastRev = (int) $match[1];
  34019. } else {
  34020. $tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  34021. '/' . $this->tagsPath . '/' . $match[2],
  34022. max($lastRev, (int) $match[1])
  34023. );
  34024. }
  34025. }
  34026. }
  34027. }
  34028. }
  34029. $this->tags = $tags;
  34030. }
  34031. return $this->tags;
  34032. }
  34033. public function getBranches(): array
  34034. {
  34035. if (null === $this->branches) {
  34036. $branches = [];
  34037. if (false === $this->trunkPath) {
  34038. $trunkParent = $this->baseUrl . '/';
  34039. } else {
  34040. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  34041. }
  34042. $output = $this->execute(['svn', 'ls', '--verbose'], $trunkParent);
  34043. if ($output !== '') {
  34044. foreach ($this->process->splitLines($output) as $line) {
  34045. $line = trim($line);
  34046. if ($line !== '' && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  34047. if ($match[2] === './') {
  34048. $branches['trunk'] = $this->buildIdentifier(
  34049. '/' . $this->trunkPath,
  34050. (int) $match[1]
  34051. );
  34052. $this->rootIdentifier = $branches['trunk'];
  34053. break;
  34054. }
  34055. }
  34056. }
  34057. }
  34058. unset($output);
  34059. if ($this->branchesPath !== false) {
  34060. $output = $this->execute(['svn', 'ls', '--verbose'], $this->baseUrl . '/' . $this->branchesPath);
  34061. if ($output !== '') {
  34062. $lastRev = 0;
  34063. foreach ($this->process->splitLines(trim($output)) as $line) {
  34064. $line = trim($line);
  34065. if ($line !== '' && Preg::isMatch('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  34066. if ($match[2] === './') {
  34067. $lastRev = (int) $match[1];
  34068. } else {
  34069. $branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  34070. '/' . $this->branchesPath . '/' . $match[2],
  34071. max($lastRev, (int) $match[1])
  34072. );
  34073. }
  34074. }
  34075. }
  34076. }
  34077. }
  34078. $this->branches = $branches;
  34079. }
  34080. return $this->branches;
  34081. }
  34082. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool
  34083. {
  34084. $url = self::normalizeUrl($url);
  34085. if (Preg::isMatch('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  34086. return true;
  34087. }
  34088. if (!$deep && !Filesystem::isLocalPath($url)) {
  34089. return false;
  34090. }
  34091. $process = new ProcessExecutor($io);
  34092. $exit = $process->execute(['svn', 'info', '--non-interactive', '--', $url], $ignoredOutput);
  34093. if ($exit === 0) {
  34094. return true;
  34095. }
  34096. if (false !== stripos($process->getErrorOutput(), 'authorization failed:')) {
  34097. return true;
  34098. }
  34099. if (false !== stripos($process->getErrorOutput(), 'Authentication failed')) {
  34100. return true;
  34101. }
  34102. return false;
  34103. }
  34104. protected static function normalizeUrl(string $url): string
  34105. {
  34106. $fs = new Filesystem();
  34107. if ($fs->isAbsolutePath($url)) {
  34108. return 'file://' . strtr($url, '\\', '/');
  34109. }
  34110. return $url;
  34111. }
  34112. protected function execute(array $command, string $url): string
  34113. {
  34114. if (null === $this->util) {
  34115. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  34116. $this->util->setCacheCredentials($this->cacheCredentials);
  34117. }
  34118. try {
  34119. return $this->util->execute($command, $url);
  34120. } catch (\RuntimeException $e) {
  34121. if (null === $this->util->binaryVersion()) {
  34122. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  34123. }
  34124. throw new \RuntimeException(
  34125. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  34126. );
  34127. }
  34128. }
  34129. protected function buildIdentifier(string $baseDir, int $revision): string
  34130. {
  34131. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  34132. }
  34133. }
  34134. <?php declare(strict_types=1);
  34135. namespace Composer\Repository\Vcs;
  34136. use Composer\Cache;
  34137. use Composer\Downloader\TransportException;
  34138. use Composer\Config;
  34139. use Composer\IO\IOInterface;
  34140. use Composer\Json\JsonFile;
  34141. use Composer\Pcre\Preg;
  34142. use Composer\Util\ProcessExecutor;
  34143. use Composer\Util\HttpDownloader;
  34144. use Composer\Util\Filesystem;
  34145. use Composer\Util\Http\Response;
  34146. abstract class VcsDriver implements VcsDriverInterface
  34147. {
  34148. protected $url;
  34149. protected $originUrl;
  34150. protected $repoConfig;
  34151. protected $io;
  34152. protected $config;
  34153. protected $process;
  34154. protected $httpDownloader;
  34155. protected $infoCache = [];
  34156. protected $cache;
  34157. final public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ProcessExecutor $process)
  34158. {
  34159. if (Filesystem::isLocalPath($repoConfig['url'])) {
  34160. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  34161. }
  34162. $this->url = $repoConfig['url'];
  34163. $this->originUrl = $repoConfig['url'];
  34164. $this->repoConfig = $repoConfig;
  34165. $this->io = $io;
  34166. $this->config = $config;
  34167. $this->httpDownloader = $httpDownloader;
  34168. $this->process = $process;
  34169. }
  34170. protected function shouldCache(string $identifier): bool
  34171. {
  34172. return $this->cache && Preg::isMatch('{^[a-f0-9]{40}$}iD', $identifier);
  34173. }
  34174. public function getComposerInformation(string $identifier): ?array
  34175. {
  34176. if (!isset($this->infoCache[$identifier])) {
  34177. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  34178. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  34179. }
  34180. $composer = $this->getBaseComposerInformation($identifier);
  34181. if ($this->shouldCache($identifier)) {
  34182. $this->cache->write($identifier, JsonFile::encode($composer, 0));
  34183. }
  34184. $this->infoCache[$identifier] = $composer;
  34185. }
  34186. return $this->infoCache[$identifier];
  34187. }
  34188. protected function getBaseComposerInformation(string $identifier): ?array
  34189. {
  34190. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  34191. if (!$composerFileContent) {
  34192. return null;
  34193. }
  34194. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  34195. if ([] === $composer || !is_array($composer)) {
  34196. return null;
  34197. }
  34198. if (empty($composer['time']) && null !== ($changeDate = $this->getChangeDate($identifier))) {
  34199. $composer['time'] = $changeDate->format(DATE_RFC3339);
  34200. }
  34201. return $composer;
  34202. }
  34203. public function hasComposerFile(string $identifier): bool
  34204. {
  34205. try {
  34206. return null !== $this->getComposerInformation($identifier);
  34207. } catch (TransportException $e) {
  34208. }
  34209. return false;
  34210. }
  34211. protected function getScheme(): string
  34212. {
  34213. if (extension_loaded('openssl')) {
  34214. return 'https';
  34215. }
  34216. return 'http';
  34217. }
  34218. protected function getContents(string $url): Response
  34219. {
  34220. $options = $this->repoConfig['options'] ?? [];
  34221. return $this->httpDownloader->get($url, $options);
  34222. }
  34223. public function cleanup(): void
  34224. {
  34225. }
  34226. }
  34227. <?php declare(strict_types=1);
  34228. namespace Composer\Repository\Vcs;
  34229. use Composer\Config;
  34230. use Composer\IO\IOInterface;
  34231. interface VcsDriverInterface
  34232. {
  34233. public function initialize(): void;
  34234. public function getComposerInformation(string $identifier): ?array;
  34235. public function getFileContent(string $file, string $identifier): ?string;
  34236. public function getChangeDate(string $identifier): ?\DateTimeImmutable;
  34237. public function getRootIdentifier(): string;
  34238. public function getBranches(): array;
  34239. public function getTags(): array;
  34240. public function getDist(string $identifier): ?array;
  34241. public function getSource(string $identifier): array;
  34242. public function getUrl(): string;
  34243. public function hasComposerFile(string $identifier): bool;
  34244. public function cleanup(): void;
  34245. public static function supports(IOInterface $io, Config $config, string $url, bool $deep = false): bool;
  34246. }
  34247. <?php declare(strict_types=1);
  34248. namespace Composer\Repository;
  34249. use Composer\Downloader\TransportException;
  34250. use Composer\Pcre\Preg;
  34251. use Composer\Repository\Vcs\VcsDriverInterface;
  34252. use Composer\Package\Version\VersionParser;
  34253. use Composer\Package\Loader\ArrayLoader;
  34254. use Composer\Package\Loader\ValidatingArrayLoader;
  34255. use Composer\Package\Loader\InvalidPackageException;
  34256. use Composer\Package\Loader\LoaderInterface;
  34257. use Composer\EventDispatcher\EventDispatcher;
  34258. use Composer\Util\Platform;
  34259. use Composer\Util\ProcessExecutor;
  34260. use Composer\Util\HttpDownloader;
  34261. use Composer\Util\Url;
  34262. use Composer\Semver\Constraint\Constraint;
  34263. use Composer\IO\IOInterface;
  34264. use Composer\Config;
  34265. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  34266. {
  34267. protected $url;
  34268. protected $packageName;
  34269. protected $isVerbose;
  34270. protected $isVeryVerbose;
  34271. protected $io;
  34272. protected $config;
  34273. protected $versionParser;
  34274. protected $type;
  34275. protected $loader;
  34276. protected $repoConfig;
  34277. protected $httpDownloader;
  34278. protected $processExecutor;
  34279. protected $branchErrorOccurred = false;
  34280. private $drivers;
  34281. private $driver;
  34282. private $versionCache;
  34283. private $emptyReferences = [];
  34284. private $versionTransportExceptions = [];
  34285. public function __construct(array $repoConfig, IOInterface $io, Config $config, HttpDownloader $httpDownloader, ?EventDispatcher $dispatcher = null, ?ProcessExecutor $process = null, ?array $drivers = null, ?VersionCacheInterface $versionCache = null)
  34286. {
  34287. parent::__construct();
  34288. $this->drivers = $drivers ?: [
  34289. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  34290. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  34291. 'bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  34292. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  34293. 'git' => 'Composer\Repository\Vcs\GitDriver',
  34294. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  34295. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  34296. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  34297. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  34298. ];
  34299. $this->url = $repoConfig['url'] = Platform::expandPath($repoConfig['url']);
  34300. $this->io = $io;
  34301. $this->type = $repoConfig['type'] ?? 'vcs';
  34302. $this->isVerbose = $io->isVerbose();
  34303. $this->isVeryVerbose = $io->isVeryVerbose();
  34304. $this->config = $config;
  34305. $this->repoConfig = $repoConfig;
  34306. $this->versionCache = $versionCache;
  34307. $this->httpDownloader = $httpDownloader;
  34308. $this->processExecutor = $process ?? new ProcessExecutor($io);
  34309. }
  34310. public function getRepoName()
  34311. {
  34312. $driverClass = get_class($this->getDriver());
  34313. $driverType = array_search($driverClass, $this->drivers);
  34314. if (!$driverType) {
  34315. $driverType = $driverClass;
  34316. }
  34317. return 'vcs repo ('.$driverType.' '.Url::sanitize($this->url).')';
  34318. }
  34319. public function getRepoConfig()
  34320. {
  34321. return $this->repoConfig;
  34322. }
  34323. public function setLoader(LoaderInterface $loader): void
  34324. {
  34325. $this->loader = $loader;
  34326. }
  34327. public function getDriver(): ?VcsDriverInterface
  34328. {
  34329. if ($this->driver) {
  34330. return $this->driver;
  34331. }
  34332. if (isset($this->drivers[$this->type])) {
  34333. $class = $this->drivers[$this->type];
  34334. $this->driver = new $class($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  34335. $this->driver->initialize();
  34336. return $this->driver;
  34337. }
  34338. foreach ($this->drivers as $driver) {
  34339. if ($driver::supports($this->io, $this->config, $this->url)) {
  34340. $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  34341. $this->driver->initialize();
  34342. return $this->driver;
  34343. }
  34344. }
  34345. foreach ($this->drivers as $driver) {
  34346. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  34347. $this->driver = new $driver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->processExecutor);
  34348. $this->driver->initialize();
  34349. return $this->driver;
  34350. }
  34351. }
  34352. return null;
  34353. }
  34354. public function hadInvalidBranches(): bool
  34355. {
  34356. return $this->branchErrorOccurred;
  34357. }
  34358. public function getEmptyReferences(): array
  34359. {
  34360. return $this->emptyReferences;
  34361. }
  34362. public function getVersionTransportExceptions(): array
  34363. {
  34364. return $this->versionTransportExceptions;
  34365. }
  34366. protected function initialize()
  34367. {
  34368. parent::initialize();
  34369. $isVerbose = $this->isVerbose;
  34370. $isVeryVerbose = $this->isVeryVerbose;
  34371. $driver = $this->getDriver();
  34372. if (!$driver) {
  34373. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  34374. }
  34375. $this->versionParser = new VersionParser;
  34376. if (!$this->loader) {
  34377. $this->loader = new ArrayLoader($this->versionParser);
  34378. }
  34379. $hasRootIdentifierComposerJson = false;
  34380. try {
  34381. $hasRootIdentifierComposerJson = $driver->hasComposerFile($driver->getRootIdentifier());
  34382. if ($hasRootIdentifierComposerJson) {
  34383. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  34384. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  34385. }
  34386. } catch (\Exception $e) {
  34387. if ($e instanceof TransportException && $this->shouldRethrowTransportException($e)) {
  34388. throw $e;
  34389. }
  34390. if ($isVeryVerbose) {
  34391. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  34392. }
  34393. }
  34394. foreach ($driver->getTags() as $tag => $identifier) {
  34395. $tag = (string) $tag;
  34396. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  34397. $tag = str_replace('release-', '', $tag);
  34398. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  34399. if ($cachedPackage) {
  34400. $this->addPackage($cachedPackage);
  34401. continue;
  34402. }
  34403. if ($cachedPackage === false) {
  34404. $this->emptyReferences[] = $identifier;
  34405. continue;
  34406. }
  34407. if (!$parsedTag = $this->validateTag($tag)) {
  34408. if ($isVeryVerbose) {
  34409. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  34410. }
  34411. continue;
  34412. }
  34413. if ($isVeryVerbose) {
  34414. $this->io->writeError($msg);
  34415. } elseif ($isVerbose) {
  34416. $this->io->overwriteError($msg, false);
  34417. }
  34418. try {
  34419. $data = $driver->getComposerInformation($identifier);
  34420. if (null === $data) {
  34421. if ($isVeryVerbose) {
  34422. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  34423. }
  34424. $this->emptyReferences[] = $identifier;
  34425. continue;
  34426. }
  34427. if (isset($data['version'])) {
  34428. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  34429. } else {
  34430. $data['version'] = $tag;
  34431. $data['version_normalized'] = $parsedTag;
  34432. }
  34433. $data['version'] = Preg::replace('{[.-]?dev$}i', '', $data['version']);
  34434. $data['version_normalized'] = Preg::replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  34435. unset($data['default-branch']);
  34436. if ($data['version_normalized'] !== $parsedTag) {
  34437. if ($isVeryVerbose) {
  34438. if (Preg::isMatch('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
  34439. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
  34440. } else {
  34441. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  34442. }
  34443. }
  34444. continue;
  34445. }
  34446. $tagPackageName = $this->packageName ?: ($data['name'] ?? '');
  34447. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  34448. if ($isVeryVerbose) {
  34449. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  34450. }
  34451. continue;
  34452. }
  34453. if ($isVeryVerbose) {
  34454. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  34455. }
  34456. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  34457. } catch (\Exception $e) {
  34458. if ($e instanceof TransportException) {
  34459. $this->versionTransportExceptions['tags'][$tag] = $e;
  34460. if ($e->getCode() === 404) {
  34461. $this->emptyReferences[] = $identifier;
  34462. }
  34463. if ($this->shouldRethrowTransportException($e)) {
  34464. throw $e;
  34465. }
  34466. }
  34467. if ($isVeryVerbose) {
  34468. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
  34469. }
  34470. continue;
  34471. }
  34472. }
  34473. if (!$isVeryVerbose) {
  34474. $this->io->overwriteError('', false);
  34475. }
  34476. $branches = $driver->getBranches();
  34477. if ($hasRootIdentifierComposerJson && isset($branches[$driver->getRootIdentifier()])) {
  34478. $branches = [$driver->getRootIdentifier() => $branches[$driver->getRootIdentifier()]] + $branches;
  34479. }
  34480. foreach ($branches as $branch => $identifier) {
  34481. $branch = (string) $branch;
  34482. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  34483. if ($isVeryVerbose) {
  34484. $this->io->writeError($msg);
  34485. } elseif ($isVerbose) {
  34486. $this->io->overwriteError($msg, false);
  34487. }
  34488. if (!$parsedBranch = $this->validateBranch($branch)) {
  34489. if ($isVeryVerbose) {
  34490. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  34491. }
  34492. continue;
  34493. }
  34494. if (strpos($parsedBranch, 'dev-') === 0 || VersionParser::DEFAULT_BRANCH_ALIAS === $parsedBranch) {
  34495. $version = 'dev-' . str_replace('#', '+', $branch);
  34496. $parsedBranch = str_replace('#', '+', $parsedBranch);
  34497. } else {
  34498. $prefix = strpos($branch, 'v') === 0 ? 'v' : '';
  34499. $version = $prefix . Preg::replace('{(\.9{7})+}', '.x', $parsedBranch);
  34500. }
  34501. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose, $driver->getRootIdentifier() === $branch);
  34502. if ($cachedPackage) {
  34503. $this->addPackage($cachedPackage);
  34504. continue;
  34505. }
  34506. if ($cachedPackage === false) {
  34507. $this->emptyReferences[] = $identifier;
  34508. continue;
  34509. }
  34510. try {
  34511. $data = $driver->getComposerInformation($identifier);
  34512. if (null === $data) {
  34513. if ($isVeryVerbose) {
  34514. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  34515. }
  34516. $this->emptyReferences[] = $identifier;
  34517. continue;
  34518. }
  34519. $data['version'] = $version;
  34520. $data['version_normalized'] = $parsedBranch;
  34521. unset($data['default-branch']);
  34522. if ($driver->getRootIdentifier() === $branch) {
  34523. $data['default-branch'] = true;
  34524. }
  34525. if ($isVeryVerbose) {
  34526. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  34527. }
  34528. $packageData = $this->preProcess($driver, $data, $identifier);
  34529. $package = $this->loader->load($packageData);
  34530. if ($this->loader instanceof ValidatingArrayLoader && \count($this->loader->getWarnings()) > 0) {
  34531. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  34532. }
  34533. $this->addPackage($package);
  34534. } catch (TransportException $e) {
  34535. $this->versionTransportExceptions['branches'][$branch] = $e;
  34536. if ($e->getCode() === 404) {
  34537. $this->emptyReferences[] = $identifier;
  34538. }
  34539. if ($this->shouldRethrowTransportException($e)) {
  34540. throw $e;
  34541. }
  34542. if ($isVeryVerbose) {
  34543. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
  34544. }
  34545. continue;
  34546. } catch (\Exception $e) {
  34547. if (!$isVeryVerbose) {
  34548. $this->io->writeError('');
  34549. }
  34550. $this->branchErrorOccurred = true;
  34551. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  34552. $this->io->writeError('');
  34553. continue;
  34554. }
  34555. }
  34556. $driver->cleanup();
  34557. if (!$isVeryVerbose) {
  34558. $this->io->overwriteError('', false);
  34559. }
  34560. if (!$this->getPackages()) {
  34561. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  34562. }
  34563. }
  34564. protected function preProcess(VcsDriverInterface $driver, array $data, string $identifier): array
  34565. {
  34566. $dataPackageName = $data['name'] ?? null;
  34567. $data['name'] = $this->packageName ?: $dataPackageName;
  34568. if (!isset($data['dist'])) {
  34569. $data['dist'] = $driver->getDist($identifier);
  34570. }
  34571. if (!isset($data['source'])) {
  34572. $data['source'] = $driver->getSource($identifier);
  34573. }
  34574. return $data;
  34575. }
  34576. private function validateBranch(string $branch)
  34577. {
  34578. try {
  34579. $normalizedBranch = $this->versionParser->normalizeBranch($branch);
  34580. $this->versionParser->parseConstraints($normalizedBranch);
  34581. return $normalizedBranch;
  34582. } catch (\Exception $e) {
  34583. }
  34584. return false;
  34585. }
  34586. private function validateTag(string $version)
  34587. {
  34588. try {
  34589. return $this->versionParser->normalize($version);
  34590. } catch (\Exception $e) {
  34591. }
  34592. return false;
  34593. }
  34594. private function getCachedPackageVersion(string $version, string $identifier, bool $isVerbose, bool $isVeryVerbose, bool $isDefaultBranch = false)
  34595. {
  34596. if (!$this->versionCache) {
  34597. return null;
  34598. }
  34599. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  34600. if ($cachedPackage === false) {
  34601. if ($isVeryVerbose) {
  34602. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  34603. }
  34604. return false;
  34605. }
  34606. if ($cachedPackage) {
  34607. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  34608. if ($isVeryVerbose) {
  34609. $this->io->writeError($msg);
  34610. } elseif ($isVerbose) {
  34611. $this->io->overwriteError($msg, false);
  34612. }
  34613. unset($cachedPackage['default-branch']);
  34614. if ($isDefaultBranch) {
  34615. $cachedPackage['default-branch'] = true;
  34616. }
  34617. if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
  34618. if ($isVeryVerbose) {
  34619. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  34620. }
  34621. $cachedPackage = null;
  34622. }
  34623. }
  34624. if ($cachedPackage) {
  34625. return $this->loader->load($cachedPackage);
  34626. }
  34627. return null;
  34628. }
  34629. private function shouldRethrowTransportException(TransportException $e): bool
  34630. {
  34631. return in_array($e->getCode(), [401, 403, 429], true) || $e->getCode() >= 500;
  34632. }
  34633. }
  34634. <?php declare(strict_types=1);
  34635. namespace Composer\Repository;
  34636. interface VersionCacheInterface
  34637. {
  34638. public function getVersionPackage(string $version, string $identifier);
  34639. }
  34640. <?php declare(strict_types=1);
  34641. namespace Composer\Repository;
  34642. use Composer\Installer\InstallationManager;
  34643. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  34644. {
  34645. use CanonicalPackagesTrait;
  34646. protected $devPackageNames = [];
  34647. private $devMode = null;
  34648. public function getDevMode()
  34649. {
  34650. return $this->devMode;
  34651. }
  34652. public function setDevPackageNames(array $devPackageNames)
  34653. {
  34654. $this->devPackageNames = $devPackageNames;
  34655. }
  34656. public function getDevPackageNames()
  34657. {
  34658. return $this->devPackageNames;
  34659. }
  34660. public function write(bool $devMode, InstallationManager $installationManager)
  34661. {
  34662. $this->devMode = $devMode;
  34663. }
  34664. public function reload()
  34665. {
  34666. $this->devMode = null;
  34667. }
  34668. }
  34669. <?php declare(strict_types=1);
  34670. namespace Composer\Repository;
  34671. use Composer\Package\PackageInterface;
  34672. use Composer\Installer\InstallationManager;
  34673. interface WritableRepositoryInterface extends RepositoryInterface
  34674. {
  34675. public function write(bool $devMode, InstallationManager $installationManager);
  34676. public function addPackage(PackageInterface $package);
  34677. public function removePackage(PackageInterface $package);
  34678. public function getCanonicalPackages();
  34679. public function reload();
  34680. public function setDevPackageNames(array $devPackageNames);
  34681. public function getDevPackageNames();
  34682. }
  34683. <?php declare(strict_types=1);
  34684. namespace Composer\Script;
  34685. use Composer\Composer;
  34686. use Composer\IO\IOInterface;
  34687. use Composer\EventDispatcher\Event as BaseEvent;
  34688. class Event extends BaseEvent
  34689. {
  34690. private $composer;
  34691. private $io;
  34692. private $devMode;
  34693. private $originatingEvent;
  34694. public function __construct(string $name, Composer $composer, IOInterface $io, bool $devMode = false, array $args = [], array $flags = [])
  34695. {
  34696. parent::__construct($name, $args, $flags);
  34697. $this->composer = $composer;
  34698. $this->io = $io;
  34699. $this->devMode = $devMode;
  34700. }
  34701. public function getComposer(): Composer
  34702. {
  34703. return $this->composer;
  34704. }
  34705. public function getIO(): IOInterface
  34706. {
  34707. return $this->io;
  34708. }
  34709. public function isDevMode(): bool
  34710. {
  34711. return $this->devMode;
  34712. }
  34713. public function getOriginatingEvent(): ?BaseEvent
  34714. {
  34715. return $this->originatingEvent;
  34716. }
  34717. public function setOriginatingEvent(BaseEvent $event): self
  34718. {
  34719. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  34720. return $this;
  34721. }
  34722. private function calculateOriginatingEvent(BaseEvent $event): BaseEvent
  34723. {
  34724. if ($event instanceof Event && $event->getOriginatingEvent()) {
  34725. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  34726. }
  34727. return $event;
  34728. }
  34729. }
  34730. <?php declare(strict_types=1);
  34731. namespace Composer\Script;
  34732. class ScriptEvents
  34733. {
  34734. public const PRE_INSTALL_CMD = 'pre-install-cmd';
  34735. public const POST_INSTALL_CMD = 'post-install-cmd';
  34736. public const PRE_UPDATE_CMD = 'pre-update-cmd';
  34737. public const POST_UPDATE_CMD = 'post-update-cmd';
  34738. public const PRE_STATUS_CMD = 'pre-status-cmd';
  34739. public const POST_STATUS_CMD = 'post-status-cmd';
  34740. public const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  34741. public const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  34742. public const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  34743. public const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  34744. public const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  34745. public const POST_ARCHIVE_CMD = 'post-archive-cmd';
  34746. }
  34747. <?php declare(strict_types=1);
  34748. namespace Composer\SelfUpdate;
  34749. use Composer\Pcre\Preg;
  34750. class Keys
  34751. {
  34752. public static function fingerprint(string $path): string
  34753. {
  34754. $hash = strtoupper(hash('sha256', Preg::replace('{\s}', '', file_get_contents($path))));
  34755. return implode(' ', [
  34756. substr($hash, 0, 8),
  34757. substr($hash, 8, 8),
  34758. substr($hash, 16, 8),
  34759. substr($hash, 24, 8),
  34760. '',
  34761. substr($hash, 32, 8),
  34762. substr($hash, 40, 8),
  34763. substr($hash, 48, 8),
  34764. substr($hash, 56, 8),
  34765. ]);
  34766. }
  34767. }
  34768. <?php declare(strict_types=1);
  34769. namespace Composer\SelfUpdate;
  34770. use Composer\IO\IOInterface;
  34771. use Composer\Pcre\Preg;
  34772. use Composer\Util\HttpDownloader;
  34773. use Composer\Config;
  34774. class Versions
  34775. {
  34776. public static $channels = self::CHANNELS;
  34777. public const CHANNELS = ['stable', 'preview', 'snapshot', '1', '2', '2.2'];
  34778. private $httpDownloader;
  34779. private $config;
  34780. private $channel;
  34781. private $versionsData = null;
  34782. public function __construct(Config $config, HttpDownloader $httpDownloader)
  34783. {
  34784. $this->httpDownloader = $httpDownloader;
  34785. $this->config = $config;
  34786. }
  34787. public function getChannel(): string
  34788. {
  34789. if ($this->channel) {
  34790. return $this->channel;
  34791. }
  34792. $channelFile = $this->config->get('home').'/update-channel';
  34793. if (file_exists($channelFile)) {
  34794. $channel = trim(file_get_contents($channelFile));
  34795. if (in_array($channel, ['stable', 'preview', 'snapshot', '2.2'], true)) {
  34796. return $this->channel = $channel;
  34797. }
  34798. }
  34799. return $this->channel = 'stable';
  34800. }
  34801. public function setChannel(string $channel, ?IOInterface $io = null): void
  34802. {
  34803. if (!in_array($channel, self::CHANNELS, true)) {
  34804. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::CHANNELS));
  34805. }
  34806. $channelFile = $this->config->get('home').'/update-channel';
  34807. $this->channel = $channel;
  34808. $storedChannel = Preg::isMatch('{^\d+$}D', $channel) ? 'stable' : $channel;
  34809. $previouslyStored = file_exists($channelFile) ? trim((string) file_get_contents($channelFile)) : null;
  34810. file_put_contents($channelFile, $storedChannel.PHP_EOL);
  34811. if ($io !== null && $previouslyStored !== $storedChannel) {
  34812. $io->writeError('Storing "<info>'.$storedChannel.'</info>" as default update channel for the next self-update run.');
  34813. }
  34814. }
  34815. public function getLatest(?string $channel = null): array
  34816. {
  34817. $versions = $this->getVersionsData();
  34818. foreach ($versions[$channel ?: $this->getChannel()] as $version) {
  34819. if ($version['min-php'] <= \PHP_VERSION_ID) {
  34820. return $version;
  34821. }
  34822. }
  34823. throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  34824. }
  34825. private function getVersionsData(): array
  34826. {
  34827. if (null === $this->versionsData) {
  34828. if ($this->config->get('disable-tls') === true) {
  34829. $protocol = 'http';
  34830. } else {
  34831. $protocol = 'https';
  34832. }
  34833. $this->versionsData = $this->httpDownloader->get($protocol . '://getcomposer.org/versions')->decodeJson();
  34834. }
  34835. return $this->versionsData;
  34836. }
  34837. }
  34838. <?php declare(strict_types=1);
  34839. namespace Composer\Util;
  34840. use Composer\Config;
  34841. use Composer\IO\IOInterface;
  34842. use Composer\Downloader\TransportException;
  34843. use Composer\Pcre\Preg;
  34844. class AuthHelper
  34845. {
  34846. protected $io;
  34847. protected $config;
  34848. private $displayedOriginAuthentications = [];
  34849. private $bitbucketRetry = [];
  34850. public function __construct(IOInterface $io, Config $config)
  34851. {
  34852. $this->io = $io;
  34853. $this->config = $config;
  34854. }
  34855. public function storeAuth(string $origin, $storeAuth): void
  34856. {
  34857. $store = false;
  34858. $configSource = $this->config->getAuthConfigSource();
  34859. if ($storeAuth === true) {
  34860. $store = $configSource;
  34861. } elseif ($storeAuth === 'prompt') {
  34862. $answer = $this->io->askAndValidate(
  34863. 'Do you want to store credentials for '.$origin.' in '.$configSource->getName().' ? [Yn] ',
  34864. static function ($value): string {
  34865. $input = strtolower(substr(trim($value), 0, 1));
  34866. if (in_array($input, ['y','n'])) {
  34867. return $input;
  34868. }
  34869. throw new \RuntimeException('Please answer (y)es or (n)o');
  34870. },
  34871. null,
  34872. 'y'
  34873. );
  34874. if ($answer === 'y') {
  34875. $store = $configSource;
  34876. }
  34877. }
  34878. if ($store) {
  34879. $store->addConfigSetting(
  34880. 'http-basic.'.$origin,
  34881. $this->io->getAuthentication($origin)
  34882. );
  34883. }
  34884. }
  34885. public function promptAuthIfNeeded(string $url, string $origin, int $statusCode, ?string $reason = null, array $headers = [], int $retryCount = 0): array
  34886. {
  34887. $storeAuth = false;
  34888. if (in_array($origin, $this->config->get('github-domains'), true)) {
  34889. $gitHubUtil = new GitHub($this->io, $this->config, null);
  34890. $message = "\n";
  34891. $rateLimited = $gitHubUtil->isRateLimited($headers);
  34892. $requiresSso = $gitHubUtil->requiresSso($headers);
  34893. if ($requiresSso) {
  34894. $ssoUrl = $gitHubUtil->getSsoUrl($headers);
  34895. $message = 'GitHub API token requires SSO authorization. Authorize this token at ' . $ssoUrl . "\n";
  34896. $this->io->writeError($message);
  34897. if (!$this->io->isInteractive()) {
  34898. throw new TransportException('Could not authenticate against ' . $origin, 403);
  34899. }
  34900. $this->io->ask('After authorizing your token, confirm that you would like to retry the request');
  34901. return ['retry' => true, 'storeAuth' => $storeAuth];
  34902. }
  34903. if ($rateLimited) {
  34904. $rateLimit = $gitHubUtil->getRateLimit($headers);
  34905. if ($this->io->hasAuthentication($origin)) {
  34906. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  34907. } else {
  34908. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  34909. }
  34910. $message = sprintf(
  34911. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$url.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  34912. $rateLimit['limit'],
  34913. $rateLimit['reset']
  34914. )."\n";
  34915. } else {
  34916. $message .= 'Could not fetch '.$url.', please ';
  34917. if ($this->io->hasAuthentication($origin)) {
  34918. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  34919. } else {
  34920. $message .= 'create a GitHub OAuth token to access private repos';
  34921. }
  34922. }
  34923. if (!$gitHubUtil->authorizeOAuth($origin)
  34924. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($origin, $message))
  34925. ) {
  34926. throw new TransportException('Could not authenticate against '.$origin, 401);
  34927. }
  34928. } elseif (in_array($origin, $this->config->get('gitlab-domains'), true)) {
  34929. $message = "\n".'Could not fetch '.$url.', enter your ' . $origin . ' credentials ' .($statusCode === 401 ? 'to access private repos' : 'to go over the API rate limit');
  34930. $gitLabUtil = new GitLab($this->io, $this->config, null);
  34931. $auth = null;
  34932. if ($this->io->hasAuthentication($origin)) {
  34933. $auth = $this->io->getAuthentication($origin);
  34934. if (in_array($auth['password'], ['gitlab-ci-token', 'private-token', 'oauth2'], true)) {
  34935. throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
  34936. }
  34937. }
  34938. if (!$gitLabUtil->authorizeOAuth($origin)
  34939. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively(parse_url($url, PHP_URL_SCHEME), $origin, $message))
  34940. ) {
  34941. throw new TransportException('Could not authenticate against '.$origin, 401);
  34942. }
  34943. if ($auth !== null && $this->io->hasAuthentication($origin)) {
  34944. if ($auth === $this->io->getAuthentication($origin)) {
  34945. throw new TransportException("Invalid credentials for '" . $url . "', aborting.", $statusCode);
  34946. }
  34947. }
  34948. } elseif ($origin === 'bitbucket.org' || $origin === 'api.bitbucket.org') {
  34949. $askForOAuthToken = true;
  34950. $origin = 'bitbucket.org';
  34951. if ($this->io->hasAuthentication($origin)) {
  34952. $auth = $this->io->getAuthentication($origin);
  34953. if ($auth['username'] !== 'x-token-auth') {
  34954. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  34955. $accessToken = $bitbucketUtil->requestToken($origin, $auth['username'], $auth['password']);
  34956. if (!empty($accessToken)) {
  34957. $this->io->setAuthentication($origin, 'x-token-auth', $accessToken);
  34958. $askForOAuthToken = false;
  34959. }
  34960. } elseif (!isset($this->bitbucketRetry[$url])) {
  34961. $askForOAuthToken = false;
  34962. $this->bitbucketRetry[$url] = true;
  34963. } else {
  34964. throw new TransportException('Could not authenticate against ' . $origin, 401);
  34965. }
  34966. }
  34967. if ($askForOAuthToken) {
  34968. $message = "\n".'Could not fetch ' . $url . ', please create a bitbucket OAuth token to ' . (($statusCode === 401 || $statusCode === 403) ? 'access private repos' : 'go over the API rate limit');
  34969. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  34970. if (!$bitBucketUtil->authorizeOAuth($origin)
  34971. && (!$this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($origin, $message))
  34972. ) {
  34973. throw new TransportException('Could not authenticate against ' . $origin, 401);
  34974. }
  34975. }
  34976. } else {
  34977. if ($statusCode === 404) {
  34978. return ['retry' => false, 'storeAuth' => false];
  34979. }
  34980. if (!$this->io->isInteractive()) {
  34981. if ($statusCode === 401) {
  34982. $message = "The '" . $url . "' URL required authentication (HTTP 401).\nYou must be using the interactive console to authenticate";
  34983. } elseif ($statusCode === 403) {
  34984. $message = "The '" . $url . "' URL could not be accessed (HTTP 403): " . $reason;
  34985. } else {
  34986. $message = "Unknown error code '" . $statusCode . "', reason: " . $reason;
  34987. }
  34988. throw new TransportException($message, $statusCode);
  34989. }
  34990. if ($this->io->hasAuthentication($origin)) {
  34991. if ($retryCount === 0) {
  34992. return ['retry' => true, 'storeAuth' => false];
  34993. }
  34994. throw new TransportException("Invalid credentials (HTTP $statusCode) for '$url', aborting.", $statusCode);
  34995. }
  34996. $this->io->writeError(' Authentication required (<info>'.$origin.'</info>):');
  34997. $username = $this->io->ask(' Username: ');
  34998. $password = $this->io->askAndHideAnswer(' Password: ');
  34999. $this->io->setAuthentication($origin, $username, $password);
  35000. $storeAuth = $this->config->get('store-auths');
  35001. }
  35002. return ['retry' => true, 'storeAuth' => $storeAuth];
  35003. }
  35004. public function addAuthenticationHeader(array $headers, string $origin, string $url): array
  35005. {
  35006. if ($this->io->hasAuthentication($origin)) {
  35007. $authenticationDisplayMessage = null;
  35008. $auth = $this->io->getAuthentication($origin);
  35009. if ($auth['password'] === 'bearer') {
  35010. $headers[] = 'Authorization: Bearer '.$auth['username'];
  35011. } elseif ('github.com' === $origin && 'x-oauth-basic' === $auth['password']) {
  35012. if (Preg::isMatch('{^https?://api\.github\.com/}', $url)) {
  35013. $headers[] = 'Authorization: token '.$auth['username'];
  35014. $authenticationDisplayMessage = 'Using GitHub token authentication';
  35015. }
  35016. } elseif (
  35017. in_array($origin, $this->config->get('gitlab-domains'), true)
  35018. && in_array($auth['password'], ['oauth2', 'private-token', 'gitlab-ci-token'], true)
  35019. ) {
  35020. if ($auth['password'] === 'oauth2') {
  35021. $headers[] = 'Authorization: Bearer '.$auth['username'];
  35022. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  35023. } else {
  35024. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  35025. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  35026. }
  35027. } elseif (
  35028. 'bitbucket.org' === $origin
  35029. && $url !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL
  35030. && 'x-token-auth' === $auth['username']
  35031. ) {
  35032. if (!$this->isPublicBitBucketDownload($url)) {
  35033. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  35034. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  35035. }
  35036. } else {
  35037. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  35038. $headers[] = 'Authorization: Basic '.$authStr;
  35039. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  35040. }
  35041. if ($authenticationDisplayMessage && (!isset($this->displayedOriginAuthentications[$origin]) || $this->displayedOriginAuthentications[$origin] !== $authenticationDisplayMessage)) {
  35042. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  35043. $this->displayedOriginAuthentications[$origin] = $authenticationDisplayMessage;
  35044. }
  35045. } elseif (in_array($origin, ['api.bitbucket.org', 'api.github.com'], true)) {
  35046. return $this->addAuthenticationHeader($headers, str_replace('api.', '', $origin), $url);
  35047. }
  35048. return $headers;
  35049. }
  35050. public function isPublicBitBucketDownload(string $urlToBitBucketFile): bool
  35051. {
  35052. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  35053. if (strpos($domain, 'bitbucket.org') === false) {
  35054. return true;
  35055. }
  35056. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  35057. $pathParts = explode('/', $path);
  35058. return count($pathParts) >= 4 && $pathParts[3] === 'downloads';
  35059. }
  35060. }
  35061. <?php declare(strict_types=1);
  35062. namespace Composer\Util;
  35063. use Composer\Factory;
  35064. use Composer\IO\IOInterface;
  35065. use Composer\Config;
  35066. use Composer\Downloader\TransportException;
  35067. class Bitbucket
  35068. {
  35069. private $io;
  35070. private $config;
  35071. private $process;
  35072. private $httpDownloader;
  35073. private $token = null;
  35074. private $time;
  35075. public const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  35076. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null, ?int $time = null)
  35077. {
  35078. $this->io = $io;
  35079. $this->config = $config;
  35080. $this->process = $process ?: new ProcessExecutor($io);
  35081. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  35082. $this->time = $time;
  35083. }
  35084. public function getToken(): string
  35085. {
  35086. if (!isset($this->token['access_token'])) {
  35087. return '';
  35088. }
  35089. return $this->token['access_token'];
  35090. }
  35091. public function authorizeOAuth(string $originUrl): bool
  35092. {
  35093. if ($originUrl !== 'bitbucket.org') {
  35094. return false;
  35095. }
  35096. if (0 === $this->process->execute(['git', 'config', 'bitbucket.accesstoken'], $output)) {
  35097. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  35098. return true;
  35099. }
  35100. return false;
  35101. }
  35102. private function requestAccessToken(): bool
  35103. {
  35104. try {
  35105. $response = $this->httpDownloader->get(self::OAUTH2_ACCESS_TOKEN_URL, [
  35106. 'retry-auth-failure' => false,
  35107. 'http' => [
  35108. 'method' => 'POST',
  35109. 'content' => 'grant_type=client_credentials',
  35110. ],
  35111. ]);
  35112. $token = $response->decodeJson();
  35113. if (!isset($token['expires_in']) || !isset($token['access_token'])) {
  35114. throw new \LogicException('Expected a token configured with expires_in and access_token present, got '.json_encode($token));
  35115. }
  35116. $this->token = $token;
  35117. } catch (TransportException $e) {
  35118. if ($e->getCode() === 400) {
  35119. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  35120. $this->io->writeError('This can have three reasons:');
  35121. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  35122. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  35123. $this->io->writeError('3. You are using an OAuth consumer, but didn\'t configure it as private consumer');
  35124. return false;
  35125. }
  35126. if (in_array($e->getCode(), [403, 401])) {
  35127. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  35128. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  35129. return false;
  35130. }
  35131. throw $e;
  35132. }
  35133. return true;
  35134. }
  35135. public function authorizeOAuthInteractively(string $originUrl, ?string $message = null): bool
  35136. {
  35137. if ($message) {
  35138. $this->io->writeError($message);
  35139. }
  35140. $localAuthConfig = $this->config->getLocalAuthConfigSource();
  35141. $url = 'https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/';
  35142. $this->io->writeError('Follow the instructions here:');
  35143. $this->io->writeError($url);
  35144. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName()));
  35145. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  35146. $storeInLocalAuthConfig = false;
  35147. if ($localAuthConfig !== null) {
  35148. $storeInLocalAuthConfig = $this->io->askConfirmation('A local auth config source was found, do you want to store the token there?', true);
  35149. }
  35150. $consumerKey = trim((string) $this->io->askAndHideAnswer('Consumer Key (hidden): '));
  35151. if (!$consumerKey) {
  35152. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  35153. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  35154. return false;
  35155. }
  35156. $consumerSecret = trim((string) $this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  35157. if (!$consumerSecret) {
  35158. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  35159. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  35160. return false;
  35161. }
  35162. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  35163. if (!$this->requestAccessToken()) {
  35164. return false;
  35165. }
  35166. $authConfigSource = $storeInLocalAuthConfig && $localAuthConfig !== null ? $localAuthConfig : $this->config->getAuthConfigSource();
  35167. $this->storeInAuthConfig($authConfigSource, $originUrl, $consumerKey, $consumerSecret);
  35168. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  35169. $this->io->writeError('<info>Consumer stored successfully.</info>');
  35170. return true;
  35171. }
  35172. public function requestToken(string $originUrl, string $consumerKey, string $consumerSecret): string
  35173. {
  35174. if ($this->token !== null || $this->getTokenFromConfig($originUrl)) {
  35175. return $this->token['access_token'];
  35176. }
  35177. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  35178. if (!$this->requestAccessToken()) {
  35179. return '';
  35180. }
  35181. $this->storeInAuthConfig($this->config->getLocalAuthConfigSource() ?? $this->config->getAuthConfigSource(), $originUrl, $consumerKey, $consumerSecret);
  35182. if (!isset($this->token['access_token'])) {
  35183. throw new \LogicException('Failed to initialize token above');
  35184. }
  35185. return $this->token['access_token'];
  35186. }
  35187. private function storeInAuthConfig(Config\ConfigSourceInterface $authConfigSource, string $originUrl, string $consumerKey, string $consumerSecret): void
  35188. {
  35189. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  35190. if (null === $this->token || !isset($this->token['expires_in'])) {
  35191. throw new \LogicException('Expected a token configured with expires_in present, got '.json_encode($this->token));
  35192. }
  35193. $time = null === $this->time ? time() : $this->time;
  35194. $consumer = [
  35195. "consumer-key" => $consumerKey,
  35196. "consumer-secret" => $consumerSecret,
  35197. "access-token" => $this->token['access_token'],
  35198. "access-token-expiration" => $time + $this->token['expires_in'],
  35199. ];
  35200. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  35201. }
  35202. private function getTokenFromConfig(string $originUrl): bool
  35203. {
  35204. $authConfig = $this->config->get('bitbucket-oauth');
  35205. if (
  35206. !isset($authConfig[$originUrl]['access-token'], $authConfig[$originUrl]['access-token-expiration'])
  35207. || time() > $authConfig[$originUrl]['access-token-expiration']
  35208. ) {
  35209. return false;
  35210. }
  35211. $this->token = [
  35212. 'access_token' => $authConfig[$originUrl]['access-token'],
  35213. ];
  35214. return true;
  35215. }
  35216. }
  35217. <?php declare(strict_types=1);
  35218. namespace Composer\Util;
  35219. use Composer\Pcre\Preg;
  35220. class ComposerMirror
  35221. {
  35222. public static function processUrl(string $mirrorUrl, string $packageName, string $version, ?string $reference, ?string $type, ?string $prettyVersion = null): string
  35223. {
  35224. if ($reference) {
  35225. $reference = Preg::isMatch('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : hash('md5', $reference);
  35226. }
  35227. $version = strpos($version, '/') === false ? $version : hash('md5', $version);
  35228. $from = ['%package%', '%version%', '%reference%', '%type%'];
  35229. $to = [$packageName, $version, $reference, $type];
  35230. if (null !== $prettyVersion) {
  35231. $from[] = '%prettyVersion%';
  35232. $to[] = $prettyVersion;
  35233. }
  35234. $url = str_replace($from, $to, $mirrorUrl);
  35235. assert($url !== '');
  35236. return $url;
  35237. }
  35238. public static function processGitUrl(string $mirrorUrl, string $packageName, string $url, ?string $type): string
  35239. {
  35240. if (Preg::isMatch('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  35241. $url = 'gh-'.$match[1].'/'.$match[2];
  35242. } elseif (Preg::isMatch('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  35243. $url = 'bb-'.$match[1].'/'.$match[2];
  35244. } else {
  35245. $url = Preg::replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  35246. }
  35247. return str_replace(
  35248. ['%package%', '%normalizedUrl%', '%type%'],
  35249. [$packageName, $url, $type],
  35250. $mirrorUrl
  35251. );
  35252. }
  35253. public static function processHgUrl(string $mirrorUrl, string $packageName, string $url, string $type): string
  35254. {
  35255. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  35256. }
  35257. }
  35258. <?php declare(strict_types=1);
  35259. namespace Composer\Util;
  35260. use Composer\Package\Loader\ArrayLoader;
  35261. use Composer\Package\Loader\ValidatingArrayLoader;
  35262. use Composer\Package\Loader\InvalidPackageException;
  35263. use Composer\Json\JsonValidationException;
  35264. use Composer\IO\IOInterface;
  35265. use Composer\Json\JsonFile;
  35266. use Composer\Pcre\Preg;
  35267. use Composer\Spdx\SpdxLicenses;
  35268. use Seld\JsonLint\DuplicateKeyException;
  35269. use Seld\JsonLint\JsonParser;
  35270. class ConfigValidator
  35271. {
  35272. public const CHECK_VERSION = 1;
  35273. private $io;
  35274. public function __construct(IOInterface $io)
  35275. {
  35276. $this->io = $io;
  35277. }
  35278. public function validate(string $file, int $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL, int $flags = self::CHECK_VERSION): array
  35279. {
  35280. $errors = [];
  35281. $publishErrors = [];
  35282. $warnings = [];
  35283. $laxValid = false;
  35284. $manifest = null;
  35285. try {
  35286. $json = new JsonFile($file, null, $this->io);
  35287. $manifest = $json->read();
  35288. $json->validateSchema(JsonFile::LAX_SCHEMA);
  35289. $laxValid = true;
  35290. $json->validateSchema();
  35291. } catch (JsonValidationException $e) {
  35292. foreach ($e->getErrors() as $message) {
  35293. if ($laxValid) {
  35294. $publishErrors[] = $message;
  35295. } else {
  35296. $errors[] = $message;
  35297. }
  35298. }
  35299. } catch (\Exception $e) {
  35300. $errors[] = $e->getMessage();
  35301. return [$errors, $publishErrors, $warnings];
  35302. }
  35303. if (is_array($manifest)) {
  35304. $jsonParser = new JsonParser();
  35305. try {
  35306. $jsonParser->parse((string) file_get_contents($file), JsonParser::DETECT_KEY_CONFLICTS);
  35307. } catch (DuplicateKeyException $e) {
  35308. $details = $e->getDetails();
  35309. $warnings[] = 'Key '.$details['key'].' is a duplicate in '.$file.' at line '.$details['line'];
  35310. }
  35311. }
  35312. if (empty($manifest['license'])) {
  35313. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  35314. } else {
  35315. $licenses = (array) $manifest['license'];
  35316. foreach ($licenses as $key => $license) {
  35317. if ('proprietary' === $license) {
  35318. unset($licenses[$key]);
  35319. }
  35320. }
  35321. $licenseValidator = new SpdxLicenses();
  35322. foreach ($licenses as $license) {
  35323. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  35324. if ($spdxLicense && $spdxLicense[3]) {
  35325. if (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  35326. $warnings[] = sprintf(
  35327. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  35328. $license
  35329. );
  35330. } elseif (Preg::isMatch('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  35331. $warnings[] = sprintf(
  35332. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  35333. $license
  35334. );
  35335. } else {
  35336. $warnings[] = sprintf(
  35337. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  35338. $license
  35339. );
  35340. }
  35341. }
  35342. }
  35343. }
  35344. if (($flags & self::CHECK_VERSION) && isset($manifest['version'])) {
  35345. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  35346. }
  35347. if (!empty($manifest['name']) && Preg::isMatch('{[A-Z]}', $manifest['name'])) {
  35348. $suggestName = Preg::replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  35349. $suggestName = strtolower($suggestName);
  35350. $publishErrors[] = sprintf(
  35351. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  35352. $manifest['name'],
  35353. $suggestName
  35354. );
  35355. }
  35356. if (!empty($manifest['type']) && $manifest['type'] === 'composer-installer') {
  35357. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  35358. }
  35359. if (isset($manifest['require'], $manifest['require-dev'])) {
  35360. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  35361. if (!empty($requireOverrides)) {
  35362. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  35363. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  35364. }
  35365. }
  35366. foreach (['provide', 'replace'] as $linkType) {
  35367. if (isset($manifest[$linkType])) {
  35368. foreach (['require', 'require-dev'] as $requireType) {
  35369. if (isset($manifest[$requireType])) {
  35370. foreach ($manifest[$linkType] as $provide => $constraint) {
  35371. if (isset($manifest[$requireType][$provide])) {
  35372. $warnings[] = 'The package ' . $provide . ' in '.$requireType.' is also listed in '.$linkType.' which satisfies the requirement. Remove it from '.$linkType.' if you wish to install it.';
  35373. }
  35374. }
  35375. }
  35376. }
  35377. }
  35378. }
  35379. $require = $manifest['require'] ?? [];
  35380. $requireDev = $manifest['require-dev'] ?? [];
  35381. $packages = array_merge($require, $requireDev);
  35382. foreach ($packages as $package => $version) {
  35383. if (Preg::isMatch('/#/', $version)) {
  35384. $warnings[] = sprintf(
  35385. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  35386. $package
  35387. );
  35388. }
  35389. }
  35390. $scriptsDescriptions = $manifest['scripts-descriptions'] ?? [];
  35391. $scripts = $manifest['scripts'] ?? [];
  35392. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  35393. if (!array_key_exists($scriptName, $scripts)) {
  35394. $warnings[] = sprintf(
  35395. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  35396. $scriptName
  35397. );
  35398. }
  35399. }
  35400. $scriptAliases = $manifest['scripts-aliases'] ?? [];
  35401. foreach ($scriptAliases as $scriptName => $scriptAlias) {
  35402. if (!array_key_exists($scriptName, $scripts)) {
  35403. $warnings[] = sprintf(
  35404. 'Aliases for non-existent script "%s" found in "scripts-aliases"',
  35405. $scriptName
  35406. );
  35407. }
  35408. }
  35409. if (isset($manifest['autoload']['psr-0'][''])) {
  35410. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  35411. }
  35412. if (isset($manifest['autoload']['psr-4'][''])) {
  35413. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  35414. }
  35415. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  35416. try {
  35417. if (!isset($manifest['version'])) {
  35418. $manifest['version'] = '1.0.0';
  35419. }
  35420. if (!isset($manifest['name'])) {
  35421. $manifest['name'] = 'dummy/dummy';
  35422. }
  35423. $loader->load($manifest);
  35424. } catch (InvalidPackageException $e) {
  35425. $errors = array_merge($errors, $e->getErrors());
  35426. }
  35427. $warnings = array_merge($warnings, $loader->getWarnings());
  35428. return [$errors, $publishErrors, $warnings];
  35429. }
  35430. }
  35431. <?php declare(strict_types=1);
  35432. namespace Composer\Util;
  35433. use Composer\IO\IOInterface;
  35434. class ErrorHandler
  35435. {
  35436. private static $io;
  35437. public static function handle(int $level, string $message, string $file, int $line): bool
  35438. {
  35439. $isDeprecationNotice = $level === E_DEPRECATED || $level === E_USER_DEPRECATED;
  35440. if (!$isDeprecationNotice && 0 === (error_reporting() & $level)) {
  35441. return true;
  35442. }
  35443. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  35444. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  35445. "\na legitimately suppressed error that you were not supposed to see.";
  35446. }
  35447. if (!$isDeprecationNotice) {
  35448. throw new \ErrorException($message, 0, $level, $file, $line);
  35449. }
  35450. if (self::$io !== null) {
  35451. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  35452. if (self::$io->isVerbose()) {
  35453. self::$io->writeError('<warning>Stack trace:</warning>');
  35454. self::$io->writeError(array_filter(array_map(static function ($a): ?string {
  35455. if (isset($a['line'], $a['file'])) {
  35456. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  35457. }
  35458. return null;
  35459. }, array_slice(debug_backtrace(), 2)), function (?string $line) {
  35460. return $line !== null;
  35461. }));
  35462. }
  35463. }
  35464. return true;
  35465. }
  35466. public static function register(?IOInterface $io = null): void
  35467. {
  35468. set_error_handler([__CLASS__, 'handle']);
  35469. error_reporting(E_ALL);
  35470. self::$io = $io;
  35471. }
  35472. }
  35473. <?php declare(strict_types=1);
  35474. namespace Composer\Util;
  35475. use Composer\Pcre\Preg;
  35476. use ErrorException;
  35477. use React\Promise\PromiseInterface;
  35478. use RecursiveDirectoryIterator;
  35479. use RecursiveIteratorIterator;
  35480. use Symfony\Component\Filesystem\Exception\IOException;
  35481. use Symfony\Component\Finder\Finder;
  35482. class Filesystem
  35483. {
  35484. private $processExecutor;
  35485. public function __construct(?ProcessExecutor $executor = null)
  35486. {
  35487. $this->processExecutor = $executor;
  35488. }
  35489. public function remove(string $file)
  35490. {
  35491. if (is_dir($file)) {
  35492. return $this->removeDirectory($file);
  35493. }
  35494. if (file_exists($file)) {
  35495. return $this->unlink($file);
  35496. }
  35497. return false;
  35498. }
  35499. public function isDirEmpty(string $dir)
  35500. {
  35501. $finder = Finder::create()
  35502. ->ignoreVCS(false)
  35503. ->ignoreDotFiles(false)
  35504. ->depth(0)
  35505. ->in($dir);
  35506. return \count($finder) === 0;
  35507. }
  35508. public function emptyDirectory(string $dir, bool $ensureDirectoryExists = true)
  35509. {
  35510. if (is_link($dir) && file_exists($dir)) {
  35511. $this->unlink($dir);
  35512. }
  35513. if ($ensureDirectoryExists) {
  35514. $this->ensureDirectoryExists($dir);
  35515. }
  35516. if (is_dir($dir)) {
  35517. $finder = Finder::create()
  35518. ->ignoreVCS(false)
  35519. ->ignoreDotFiles(false)
  35520. ->depth(0)
  35521. ->in($dir);
  35522. foreach ($finder as $path) {
  35523. $this->remove((string) $path);
  35524. }
  35525. }
  35526. }
  35527. public function removeDirectory(string $directory)
  35528. {
  35529. $edgeCaseResult = $this->removeEdgeCases($directory);
  35530. if ($edgeCaseResult !== null) {
  35531. return $edgeCaseResult;
  35532. }
  35533. if (Platform::isWindows()) {
  35534. $cmd = ['rmdir', '/S', '/Q', Platform::realpath($directory)];
  35535. } else {
  35536. $cmd = ['rm', '-rf', $directory];
  35537. }
  35538. $result = $this->getProcess()->execute($cmd, $output) === 0;
  35539. clearstatcache();
  35540. if ($result && !is_dir($directory)) {
  35541. return true;
  35542. }
  35543. return $this->removeDirectoryPhp($directory);
  35544. }
  35545. public function removeDirectoryAsync(string $directory)
  35546. {
  35547. $edgeCaseResult = $this->removeEdgeCases($directory);
  35548. if ($edgeCaseResult !== null) {
  35549. return \React\Promise\resolve($edgeCaseResult);
  35550. }
  35551. if (Platform::isWindows()) {
  35552. $cmd = ['rmdir', '/S', '/Q', Platform::realpath($directory)];
  35553. } else {
  35554. $cmd = ['rm', '-rf', $directory];
  35555. }
  35556. $promise = $this->getProcess()->executeAsync($cmd);
  35557. return $promise->then(function ($process) use ($directory) {
  35558. clearstatcache();
  35559. if ($process->isSuccessful()) {
  35560. if (!is_dir($directory)) {
  35561. return \React\Promise\resolve(true);
  35562. }
  35563. }
  35564. return \React\Promise\resolve($this->removeDirectoryPhp($directory));
  35565. });
  35566. }
  35567. private function removeEdgeCases(string $directory, bool $fallbackToPhp = true): ?bool
  35568. {
  35569. if ($this->isSymlinkedDirectory($directory)) {
  35570. return $this->unlinkSymlinkedDirectory($directory);
  35571. }
  35572. if ($this->isJunction($directory)) {
  35573. return $this->removeJunction($directory);
  35574. }
  35575. if (is_link($directory)) {
  35576. return unlink($directory);
  35577. }
  35578. if (!is_dir($directory) || !file_exists($directory)) {
  35579. return true;
  35580. }
  35581. if (Preg::isMatch('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  35582. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  35583. }
  35584. if (!\function_exists('proc_open') && $fallbackToPhp) {
  35585. return $this->removeDirectoryPhp($directory);
  35586. }
  35587. return null;
  35588. }
  35589. public function removeDirectoryPhp(string $directory)
  35590. {
  35591. $edgeCaseResult = $this->removeEdgeCases($directory, false);
  35592. if ($edgeCaseResult !== null) {
  35593. return $edgeCaseResult;
  35594. }
  35595. try {
  35596. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  35597. } catch (\UnexpectedValueException $e) {
  35598. clearstatcache();
  35599. usleep(100000);
  35600. if (!is_dir($directory)) {
  35601. return true;
  35602. }
  35603. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  35604. }
  35605. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  35606. foreach ($ri as $file) {
  35607. if ($file->isDir()) {
  35608. $this->rmdir($file->getPathname());
  35609. } else {
  35610. $this->unlink($file->getPathname());
  35611. }
  35612. }
  35613. unset($ri, $it, $file);
  35614. return $this->rmdir($directory);
  35615. }
  35616. public function ensureDirectoryExists(string $directory)
  35617. {
  35618. if (!is_dir($directory)) {
  35619. if (file_exists($directory)) {
  35620. throw new \RuntimeException(
  35621. $directory.' exists and is not a directory.'
  35622. );
  35623. }
  35624. if (is_link($directory) && !@$this->unlinkImplementation($directory)) {
  35625. throw new \RuntimeException('Could not delete symbolic link '.$directory.': '.(error_get_last()['message'] ?? ''));
  35626. }
  35627. if (!@mkdir($directory, 0777, true)) {
  35628. $e = new \RuntimeException($directory.' does not exist and could not be created: '.(error_get_last()['message'] ?? ''));
  35629. $normalized = $this->normalizePath($directory);
  35630. if ($normalized !== $directory) {
  35631. try {
  35632. $this->ensureDirectoryExists($normalized);
  35633. return;
  35634. } catch (\Throwable $ignoredEx) {}
  35635. }
  35636. throw $e;
  35637. }
  35638. }
  35639. }
  35640. public function unlink(string $path)
  35641. {
  35642. $unlinked = @$this->unlinkImplementation($path);
  35643. if (!$unlinked) {
  35644. if (Platform::isWindows()) {
  35645. usleep(350000);
  35646. $unlinked = @$this->unlinkImplementation($path);
  35647. }
  35648. if (!$unlinked) {
  35649. $error = error_get_last();
  35650. $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
  35651. if (Platform::isWindows()) {
  35652. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  35653. }
  35654. throw new \RuntimeException($message);
  35655. }
  35656. }
  35657. return true;
  35658. }
  35659. public function rmdir(string $path)
  35660. {
  35661. $deleted = @rmdir($path);
  35662. if (!$deleted) {
  35663. if (Platform::isWindows()) {
  35664. usleep(350000);
  35665. $deleted = @rmdir($path);
  35666. }
  35667. if (!$deleted) {
  35668. $error = error_get_last();
  35669. $message = 'Could not delete '.$path.': ' . ($error['message'] ?? '');
  35670. if (Platform::isWindows()) {
  35671. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  35672. }
  35673. throw new \RuntimeException($message);
  35674. }
  35675. }
  35676. return true;
  35677. }
  35678. public function copyThenRemove(string $source, string $target)
  35679. {
  35680. $this->copy($source, $target);
  35681. if (!is_dir($source)) {
  35682. $this->unlink($source);
  35683. return;
  35684. }
  35685. $this->removeDirectoryPhp($source);
  35686. }
  35687. public function copy(string $source, string $target)
  35688. {
  35689. $target = $this->normalizePath($target);
  35690. if (!is_dir($source)) {
  35691. try {
  35692. return copy($source, $target);
  35693. } catch (ErrorException $e) {
  35694. if (str_contains($e->getMessage(), 'Bad address')) {
  35695. $sourceHandle = fopen($source, 'r');
  35696. $targetHandle = fopen($target, 'w');
  35697. if (false === $sourceHandle || false === $targetHandle) {
  35698. throw $e;
  35699. }
  35700. while (!feof($sourceHandle)) {
  35701. if (false === fwrite($targetHandle, (string) fread($sourceHandle, 1024 * 1024))) {
  35702. throw $e;
  35703. }
  35704. }
  35705. fclose($sourceHandle);
  35706. fclose($targetHandle);
  35707. return true;
  35708. }
  35709. throw $e;
  35710. }
  35711. }
  35712. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  35713. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  35714. $this->ensureDirectoryExists($target);
  35715. $result = true;
  35716. foreach ($ri as $file) {
  35717. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathname();
  35718. if ($file->isDir()) {
  35719. $this->ensureDirectoryExists($targetPath);
  35720. } else {
  35721. $result = $result && copy($file->getPathname(), $targetPath);
  35722. }
  35723. }
  35724. return $result;
  35725. }
  35726. public function rename(string $source, string $target)
  35727. {
  35728. if (true === @rename($source, $target)) {
  35729. return;
  35730. }
  35731. if (!\function_exists('proc_open')) {
  35732. $this->copyThenRemove($source, $target);
  35733. return;
  35734. }
  35735. if (Platform::isWindows()) {
  35736. $result = $this->getProcess()->execute(['xcopy', $source, $target, '/E', '/I', '/Q', '/Y'], $output);
  35737. clearstatcache();
  35738. if (0 === $result) {
  35739. $this->remove($source);
  35740. return;
  35741. }
  35742. } else {
  35743. $result = $this->getProcess()->execute(['mv', $source, $target], $output);
  35744. clearstatcache();
  35745. if (0 === $result) {
  35746. return;
  35747. }
  35748. }
  35749. $this->copyThenRemove($source, $target);
  35750. }
  35751. public function findShortestPath(string $from, string $to, bool $directories = false, bool $preferRelative = false)
  35752. {
  35753. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  35754. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  35755. }
  35756. $from = $this->normalizePath($from);
  35757. $to = $this->normalizePath($to);
  35758. if ($directories) {
  35759. $from = rtrim($from, '/') . '/dummy_file';
  35760. }
  35761. if (\dirname($from) === \dirname($to)) {
  35762. return './'.basename($to);
  35763. }
  35764. $commonPath = $to;
  35765. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath)) {
  35766. $commonPath = strtr(\dirname($commonPath), '\\', '/');
  35767. }
  35768. if (0 !== strpos($from, $commonPath)) {
  35769. return $to;
  35770. }
  35771. $commonPath = rtrim($commonPath, '/') . '/';
  35772. $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/');
  35773. $commonPathCode = str_repeat('../', $sourcePathDepth);
  35774. if (!$preferRelative && '/' === $commonPath && $sourcePathDepth > 1) {
  35775. return $to;
  35776. }
  35777. $result = $commonPathCode . substr($to, \strlen($commonPath));
  35778. if (\strlen($result) === 0) {
  35779. return './';
  35780. }
  35781. return $result;
  35782. }
  35783. public function findShortestPathCode(string $from, string $to, bool $directories = false, bool $staticCode = false, bool $preferRelative = false)
  35784. {
  35785. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  35786. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  35787. }
  35788. $from = $this->normalizePath($from);
  35789. $to = $this->normalizePath($to);
  35790. if ($from === $to) {
  35791. return $directories ? '__DIR__' : '__FILE__';
  35792. }
  35793. $commonPath = $to;
  35794. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !Preg::isMatch('{^[A-Z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  35795. $commonPath = strtr(\dirname($commonPath), '\\', '/');
  35796. }
  35797. if (0 !== strpos($from, $commonPath) || '.' === $commonPath) {
  35798. return var_export($to, true);
  35799. }
  35800. $commonPath = rtrim($commonPath, '/') . '/';
  35801. if (str_starts_with($to, $from.'/')) {
  35802. return '__DIR__ . '.var_export((string) substr($to, \strlen($from)), true);
  35803. }
  35804. $sourcePathDepth = substr_count((string) substr($from, \strlen($commonPath)), '/') + (int) $directories;
  35805. if (!$preferRelative && '/' === $commonPath && $sourcePathDepth > 1) {
  35806. return var_export($to, true);
  35807. }
  35808. if ($staticCode) {
  35809. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  35810. } else {
  35811. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  35812. }
  35813. $relTarget = (string) substr($to, \strlen($commonPath));
  35814. return $commonPathCode . (\strlen($relTarget) > 0 ? '.' . var_export('/' . $relTarget, true) : '');
  35815. }
  35816. public function isAbsolutePath(string $path)
  35817. {
  35818. return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
  35819. }
  35820. public function size(string $path)
  35821. {
  35822. if (!file_exists($path)) {
  35823. throw new \RuntimeException("$path does not exist.");
  35824. }
  35825. if (is_dir($path)) {
  35826. return $this->directorySize($path);
  35827. }
  35828. return (int) filesize($path);
  35829. }
  35830. public function normalizePath(string $path)
  35831. {
  35832. $parts = [];
  35833. $path = strtr($path, '\\', '/');
  35834. $prefix = '';
  35835. $absolute = '';
  35836. if (strpos($path, '//') === 0 && \strlen($path) > 2) {
  35837. $absolute = '//';
  35838. $path = substr($path, 2);
  35839. }
  35840. if (Preg::isMatchStrictGroups('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  35841. $prefix = $match[1];
  35842. $path = substr($path, \strlen($prefix));
  35843. }
  35844. if (strpos($path, '/') === 0) {
  35845. $absolute = '/';
  35846. $path = substr($path, 1);
  35847. }
  35848. $up = false;
  35849. foreach (explode('/', $path) as $chunk) {
  35850. if ('..' === $chunk && (\strlen($absolute) > 0 || $up)) {
  35851. array_pop($parts);
  35852. $up = !(\count($parts) === 0 || '..' === end($parts));
  35853. } elseif ('.' !== $chunk && '' !== $chunk) {
  35854. $parts[] = $chunk;
  35855. $up = '..' !== $chunk;
  35856. }
  35857. }
  35858. $prefix = Preg::replaceCallback('{(^|://)[a-z]:$}i', static function (array $m) {
  35859. return strtoupper($m[0]);
  35860. }, $prefix);
  35861. return $prefix.$absolute.implode('/', $parts);
  35862. }
  35863. public static function trimTrailingSlash(string $path)
  35864. {
  35865. if (!Preg::isMatch('{^[/\\\\]+$}', $path)) {
  35866. $path = rtrim($path, '/\\');
  35867. }
  35868. return $path;
  35869. }
  35870. public static function isLocalPath(string $path)
  35871. {
  35872. if (Platform::isWindows()) {
  35873. return Preg::isMatch('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  35874. }
  35875. return Preg::isMatch('{^(file://|/|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  35876. }
  35877. public static function getPlatformPath(string $path)
  35878. {
  35879. if (Platform::isWindows()) {
  35880. $path = Preg::replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  35881. }
  35882. return Preg::replace('{^file://}i', '', $path);
  35883. }
  35884. public static function isReadable(string $path)
  35885. {
  35886. if (is_readable($path)) {
  35887. return true;
  35888. }
  35889. if (is_file($path)) {
  35890. return false !== Silencer::call('file_get_contents', $path, false, null, 0, 1);
  35891. }
  35892. if (is_dir($path)) {
  35893. return false !== Silencer::call('opendir', $path);
  35894. }
  35895. return false;
  35896. }
  35897. protected function directorySize(string $directory)
  35898. {
  35899. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  35900. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  35901. $size = 0;
  35902. foreach ($ri as $file) {
  35903. if ($file->isFile()) {
  35904. $size += $file->getSize();
  35905. }
  35906. }
  35907. return $size;
  35908. }
  35909. protected function getProcess()
  35910. {
  35911. if (null === $this->processExecutor) {
  35912. $this->processExecutor = new ProcessExecutor();
  35913. }
  35914. return $this->processExecutor;
  35915. }
  35916. private function unlinkImplementation(string $path): bool
  35917. {
  35918. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  35919. return rmdir($path);
  35920. }
  35921. return unlink($path);
  35922. }
  35923. public function relativeSymlink(string $target, string $link)
  35924. {
  35925. if (!function_exists('symlink')) {
  35926. return false;
  35927. }
  35928. $cwd = Platform::getCwd();
  35929. $relativePath = $this->findShortestPath($link, $target);
  35930. chdir(\dirname($link));
  35931. $result = @symlink($relativePath, $link);
  35932. chdir($cwd);
  35933. return $result;
  35934. }
  35935. public function isSymlinkedDirectory(string $directory)
  35936. {
  35937. if (!is_dir($directory)) {
  35938. return false;
  35939. }
  35940. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  35941. return is_link($resolved);
  35942. }
  35943. private function unlinkSymlinkedDirectory(string $directory): bool
  35944. {
  35945. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  35946. return $this->unlink($resolved);
  35947. }
  35948. private function resolveSymlinkedDirectorySymlink(string $pathname): string
  35949. {
  35950. if (!is_dir($pathname)) {
  35951. return $pathname;
  35952. }
  35953. $resolved = rtrim($pathname, '/');
  35954. if (0 === \strlen($resolved)) {
  35955. return $pathname;
  35956. }
  35957. return $resolved;
  35958. }
  35959. public function junction(string $target, string $junction)
  35960. {
  35961. if (!Platform::isWindows()) {
  35962. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  35963. }
  35964. if (!is_dir($target)) {
  35965. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  35966. }
  35967. if (!is_dir($junction) || $this->isJunction($junction)) {
  35968. @rmdir($junction);
  35969. }
  35970. $cmd = ['mklink', '/J', str_replace('/', DIRECTORY_SEPARATOR, $junction), Platform::realpath($target)];
  35971. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  35972. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  35973. }
  35974. clearstatcache(true, $junction);
  35975. }
  35976. public function isJunction(string $junction)
  35977. {
  35978. if (!Platform::isWindows()) {
  35979. return false;
  35980. }
  35981. clearstatcache(true, $junction);
  35982. if (!is_dir($junction) || is_link($junction)) {
  35983. return false;
  35984. }
  35985. $stat = lstat($junction);
  35986. return is_array($stat) ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  35987. }
  35988. public function removeJunction(string $junction)
  35989. {
  35990. if (!Platform::isWindows()) {
  35991. return false;
  35992. }
  35993. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  35994. if (!$this->isJunction($junction)) {
  35995. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  35996. }
  35997. return $this->rmdir($junction);
  35998. }
  35999. public function filePutContentsIfModified(string $path, string $content)
  36000. {
  36001. $currentContent = Silencer::call('file_get_contents', $path);
  36002. if (false === $currentContent || $currentContent !== $content) {
  36003. return file_put_contents($path, $content);
  36004. }
  36005. return 0;
  36006. }
  36007. public function safeCopy(string $source, string $target): void
  36008. {
  36009. if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
  36010. $sourceHandle = fopen($source, 'r');
  36011. assert($sourceHandle !== false, 'Could not open "'.$source.'" for reading.');
  36012. $targetHandle = fopen($target, 'w+');
  36013. assert($targetHandle !== false, 'Could not open "'.$target.'" for writing.');
  36014. stream_copy_to_stream($sourceHandle, $targetHandle);
  36015. fclose($sourceHandle);
  36016. fclose($targetHandle);
  36017. touch($target, (int) filemtime($source), (int) fileatime($source));
  36018. }
  36019. }
  36020. private function filesAreEqual(string $a, string $b): bool
  36021. {
  36022. if (filesize($a) !== filesize($b)) {
  36023. return false;
  36024. }
  36025. $aHandle = fopen($a, 'rb');
  36026. assert($aHandle !== false, 'Could not open "'.$a.'" for reading.');
  36027. $bHandle = fopen($b, 'rb');
  36028. assert($bHandle !== false, 'Could not open "'.$b.'" for reading.');
  36029. $result = true;
  36030. while (!feof($aHandle)) {
  36031. if (fread($aHandle, 8192) !== fread($bHandle, 8192)) {
  36032. $result = false;
  36033. break;
  36034. }
  36035. }
  36036. fclose($aHandle);
  36037. fclose($bHandle);
  36038. return $result;
  36039. }
  36040. }
  36041. <?php declare(strict_types=1);
  36042. namespace Composer\Util;
  36043. use Composer\Config;
  36044. use Composer\IO\IOInterface;
  36045. use Composer\Pcre\Preg;
  36046. class Git
  36047. {
  36048. private static $version = false;
  36049. protected $io;
  36050. protected $config;
  36051. protected $process;
  36052. protected $filesystem;
  36053. protected $httpDownloader;
  36054. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  36055. {
  36056. $this->io = $io;
  36057. $this->config = $config;
  36058. $this->process = $process;
  36059. $this->filesystem = $fs;
  36060. }
  36061. public static function checkForRepoOwnershipError(string $output, string $path, ?IOInterface $io = null): void
  36062. {
  36063. if (str_contains($output, 'fatal: detected dubious ownership')) {
  36064. $msg = 'The repository at "' . $path . '" does not have the correct ownership and git refuses to use it:' . PHP_EOL . PHP_EOL . $output;
  36065. if ($io === null) {
  36066. throw new \RuntimeException($msg);
  36067. }
  36068. $io->writeError('<warning>'.$msg.'</warning>');
  36069. }
  36070. }
  36071. public function setHttpDownloader(HttpDownloader $httpDownloader): void
  36072. {
  36073. $this->httpDownloader = $httpDownloader;
  36074. }
  36075. public function runCommands(array $commands, string $url, ?string $cwd, bool $initialClone = false, &$commandOutput = null): void
  36076. {
  36077. $callables = [];
  36078. foreach ($commands as $cmd) {
  36079. $callables[] = static function (string $url) use ($cmd): array {
  36080. $map = [
  36081. '%url%' => $url,
  36082. '%sanitizedUrl%' => Preg::replace('{://([^@]+?):(.+?)@}', '://', $url),
  36083. ];
  36084. return array_map(static function ($value) use ($map): string {
  36085. return $map[$value] ?? $value;
  36086. }, $cmd);
  36087. };
  36088. }
  36089. $this->runCommand($callables, $url, $cwd, $initialClone, $commandOutput);
  36090. }
  36091. public function runCommand($commandCallable, string $url, ?string $cwd, bool $initialClone = false, &$commandOutput = null): void
  36092. {
  36093. $commandCallables = is_callable($commandCallable) ? [$commandCallable] : $commandCallable;
  36094. $lastCommand = '';
  36095. $this->config->prohibitUrlByConfig($url, $this->io);
  36096. if ($initialClone) {
  36097. $origCwd = $cwd;
  36098. }
  36099. $runCommands = function ($url) use ($commandCallables, $cwd, &$commandOutput, &$lastCommand, $initialClone) {
  36100. $collectOutputs = !is_callable($commandOutput);
  36101. $outputs = [];
  36102. $status = 0;
  36103. $counter = 0;
  36104. foreach ($commandCallables as $callable) {
  36105. $lastCommand = $callable($url);
  36106. if ($collectOutputs) {
  36107. $outputs[] = '';
  36108. $output = &$outputs[count($outputs) - 1];
  36109. } else {
  36110. $output = &$commandOutput;
  36111. }
  36112. $status = $this->process->execute($lastCommand, $output, $initialClone && $counter === 0 ? null : $cwd);
  36113. if ($status !== 0) {
  36114. break;
  36115. }
  36116. $counter++;
  36117. }
  36118. if ($collectOutputs) {
  36119. $commandOutput = implode('', $outputs);
  36120. }
  36121. return $status;
  36122. };
  36123. if (Preg::isMatch('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  36124. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  36125. }
  36126. if (!$initialClone) {
  36127. $this->process->execute(['git', 'remote', '-v'], $output, $cwd);
  36128. if (Preg::isMatchStrictGroups('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  36129. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  36130. }
  36131. }
  36132. $protocols = $this->config->get('github-protocols');
  36133. if (Preg::isMatchStrictGroups('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  36134. $messages = [];
  36135. foreach ($protocols as $protocol) {
  36136. if ('ssh' === $protocol) {
  36137. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  36138. } else {
  36139. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  36140. }
  36141. if (0 === $runCommands($protoUrl)) {
  36142. return;
  36143. }
  36144. $messages[] = '- ' . $protoUrl . "\n" . Preg::replace('#^#m', ' ', $this->process->getErrorOutput());
  36145. if ($initialClone && isset($origCwd)) {
  36146. $this->filesystem->removeDirectory($origCwd);
  36147. }
  36148. }
  36149. if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
  36150. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  36151. }
  36152. }
  36153. $bypassSshForGitHub = Preg::isMatch('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  36154. $auth = null;
  36155. $credentials = [];
  36156. if ($bypassSshForGitHub || 0 !== $runCommands($url)) {
  36157. $errorMsg = $this->process->getErrorOutput();
  36158. if (Preg::isMatchStrictGroups('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  36159. || Preg::isMatchStrictGroups('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*?)(?:\.git)?$}i', $url, $match)
  36160. ) {
  36161. if (!$this->io->hasAuthentication($match[1])) {
  36162. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  36163. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  36164. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  36165. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  36166. }
  36167. }
  36168. if ($this->io->hasAuthentication($match[1])) {
  36169. $auth = $this->io->getAuthentication($match[1]);
  36170. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  36171. if (0 === $runCommands($authUrl)) {
  36172. return;
  36173. }
  36174. $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
  36175. $errorMsg = $this->process->getErrorOutput();
  36176. }
  36177. } elseif (
  36178. Preg::isMatchStrictGroups('{^(https?)://(bitbucket\.org)/(.*?)(?:\.git)?$}i', $url, $match)
  36179. || Preg::isMatchStrictGroups('{^(git)@(bitbucket\.org):(.+?\.git)$}i', $url, $match)
  36180. ) {
  36181. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->httpDownloader);
  36182. $domain = $match[2];
  36183. $repo_with_git_part = $match[3];
  36184. if (!str_ends_with($repo_with_git_part, '.git')) {
  36185. $repo_with_git_part .= '.git';
  36186. }
  36187. if (!$this->io->hasAuthentication($domain)) {
  36188. $message = 'Enter your Bitbucket credentials to access private repos';
  36189. if (!$bitbucketUtil->authorizeOAuth($domain) && $this->io->isInteractive()) {
  36190. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  36191. $accessToken = $bitbucketUtil->getToken();
  36192. $this->io->setAuthentication($domain, 'x-token-auth', $accessToken);
  36193. }
  36194. }
  36195. if ($this->io->hasAuthentication($domain)) {
  36196. $auth = $this->io->getAuthentication($domain);
  36197. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $domain . '/' . $repo_with_git_part;
  36198. if (0 === $runCommands($authUrl)) {
  36199. return;
  36200. }
  36201. if ($auth['username'] !== 'x-token-auth') {
  36202. $accessToken = $bitbucketUtil->requestToken($domain, $auth['username'], $auth['password']);
  36203. if (!empty($accessToken)) {
  36204. $this->io->setAuthentication($domain, 'x-token-auth', $accessToken);
  36205. }
  36206. }
  36207. }
  36208. if ($this->io->hasAuthentication($domain)) {
  36209. $auth = $this->io->getAuthentication($domain);
  36210. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $domain . '/' . $repo_with_git_part;
  36211. if (0 === $runCommands($authUrl)) {
  36212. return;
  36213. }
  36214. $credentials = [rawurlencode($auth['username']), rawurlencode($auth['password'])];
  36215. }
  36216. $sshUrl = 'git@bitbucket.org:' . $repo_with_git_part;
  36217. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  36218. if (0 === $runCommands($sshUrl)) {
  36219. return;
  36220. }
  36221. $errorMsg = $this->process->getErrorOutput();
  36222. } elseif (
  36223. Preg::isMatchStrictGroups('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
  36224. || Preg::isMatchStrictGroups('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}i', $url, $match)
  36225. ) {
  36226. if ($match[1] === 'git') {
  36227. $match[1] = 'https';
  36228. }
  36229. if (!$this->io->hasAuthentication($match[2])) {
  36230. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  36231. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  36232. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  36233. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  36234. }
  36235. }
  36236. if ($this->io->hasAuthentication($match[2])) {
  36237. $auth = $this->io->getAuthentication($match[2]);
  36238. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  36239. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode((string) $auth['username']) . '@' . $match[2] . '/' . $match[3];
  36240. } else {
  36241. $authUrl = $match[1] . '://' . rawurlencode((string) $auth['username']) . ':' . rawurlencode((string) $auth['password']) . '@' . $match[2] . '/' . $match[3];
  36242. }
  36243. if (0 === $runCommands($authUrl)) {
  36244. return;
  36245. }
  36246. $credentials = [rawurlencode((string) $auth['username']), rawurlencode((string) $auth['password'])];
  36247. $errorMsg = $this->process->getErrorOutput();
  36248. }
  36249. } elseif (null !== ($match = $this->getAuthenticationFailure($url))) {
  36250. if (str_contains($match[2], '@')) {
  36251. [$authParts, $match[2]] = explode('@', $match[2], 2);
  36252. }
  36253. $storeAuth = false;
  36254. if ($this->io->hasAuthentication($match[2])) {
  36255. $auth = $this->io->getAuthentication($match[2]);
  36256. } elseif ($this->io->isInteractive()) {
  36257. $defaultUsername = null;
  36258. if (isset($authParts) && $authParts !== '') {
  36259. if (str_contains($authParts, ':')) {
  36260. [$defaultUsername, ] = explode(':', $authParts, 2);
  36261. } else {
  36262. $defaultUsername = $authParts;
  36263. }
  36264. }
  36265. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  36266. $this->io->writeError('<warning>' . trim($errorMsg) . '</warning>', true, IOInterface::VERBOSE);
  36267. $auth = [
  36268. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  36269. 'password' => $this->io->askAndHideAnswer(' Password: '),
  36270. ];
  36271. $storeAuth = $this->config->get('store-auths');
  36272. }
  36273. if (null !== $auth) {
  36274. $authUrl = $match[1] . rawurlencode((string) $auth['username']) . ':' . rawurlencode((string) $auth['password']) . '@' . $match[2] . $match[3];
  36275. if (0 === $runCommands($authUrl)) {
  36276. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  36277. $authHelper = new AuthHelper($this->io, $this->config);
  36278. $authHelper->storeAuth($match[2], $storeAuth);
  36279. return;
  36280. }
  36281. $credentials = [rawurlencode((string) $auth['username']), rawurlencode((string) $auth['password'])];
  36282. $errorMsg = $this->process->getErrorOutput();
  36283. }
  36284. }
  36285. if ($initialClone && isset($origCwd)) {
  36286. $this->filesystem->removeDirectory($origCwd);
  36287. }
  36288. $lastCommand = implode(' ', $lastCommand);
  36289. if (count($credentials) > 0) {
  36290. $lastCommand = $this->maskCredentials($lastCommand, $credentials);
  36291. $errorMsg = $this->maskCredentials($errorMsg, $credentials);
  36292. }
  36293. $this->throwException('Failed to execute ' . $lastCommand . "\n\n" . $errorMsg, $url);
  36294. }
  36295. }
  36296. public function syncMirror(string $url, string $dir): bool
  36297. {
  36298. if ((bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK') && Platform::getEnv('COMPOSER_DISABLE_NETWORK') !== 'prime') {
  36299. $this->io->writeError('<warning>Aborting git mirror sync of '.$url.' as network is disabled</warning>');
  36300. return false;
  36301. }
  36302. if (is_dir($dir) && 0 === $this->process->execute(['git', 'rev-parse', '--git-dir'], $output, $dir) && trim($output) === '.') {
  36303. try {
  36304. $commands = [
  36305. ['git', 'remote', 'set-url', 'origin', '--', '%url%'],
  36306. ['git', 'remote', 'update', '--prune', 'origin'],
  36307. ['git', 'remote', 'set-url', 'origin', '--', '%sanitizedUrl%'],
  36308. ['git', 'gc', '--auto'],
  36309. ];
  36310. $this->runCommands($commands, $url, $dir);
  36311. } catch (\Exception $e) {
  36312. $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  36313. return false;
  36314. }
  36315. return true;
  36316. }
  36317. self::checkForRepoOwnershipError($this->process->getErrorOutput(), $dir);
  36318. $this->filesystem->removeDirectory($dir);
  36319. $this->runCommands([['git', 'clone', '--mirror', '--', '%url%', $dir]], $url, $dir, true);
  36320. return true;
  36321. }
  36322. public function fetchRefOrSyncMirror(string $url, string $dir, string $ref, ?string $prettyVersion = null): bool
  36323. {
  36324. if ($this->checkRefIsInMirror($dir, $ref)) {
  36325. if (Preg::isMatch('{^[a-f0-9]{40}$}', $ref) && $prettyVersion !== null) {
  36326. $branch = Preg::replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $prettyVersion);
  36327. $branches = null;
  36328. $tags = null;
  36329. if (0 === $this->process->execute(['git', 'branch'], $output, $dir)) {
  36330. $branches = $output;
  36331. }
  36332. if (0 === $this->process->execute(['git', 'tag'], $output, $dir)) {
  36333. $tags = $output;
  36334. }
  36335. if (null !== $branches && !Preg::isMatch('{^[\s*]*v?'.preg_quote($branch).'$}m', $branches)
  36336. && null !== $tags && !Preg::isMatch('{^[\s*]*'.preg_quote($branch).'$}m', $tags)
  36337. ) {
  36338. $this->syncMirror($url, $dir);
  36339. }
  36340. }
  36341. return true;
  36342. }
  36343. if ($this->syncMirror($url, $dir)) {
  36344. return $this->checkRefIsInMirror($dir, $ref);
  36345. }
  36346. return false;
  36347. }
  36348. public static function getNoShowSignatureFlag(ProcessExecutor $process): string
  36349. {
  36350. $gitVersion = self::getVersion($process);
  36351. if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
  36352. return ' --no-show-signature';
  36353. }
  36354. return '';
  36355. }
  36356. public static function getNoShowSignatureFlags(ProcessExecutor $process): array
  36357. {
  36358. $flags = static::getNoShowSignatureFlag($process);
  36359. if ('' === $flags) {
  36360. return [];
  36361. }
  36362. return explode(' ', substr($flags, 1));
  36363. }
  36364. private function checkRefIsInMirror(string $dir, string $ref): bool
  36365. {
  36366. if (is_dir($dir) && 0 === $this->process->execute(['git', 'rev-parse', '--git-dir'], $output, $dir) && trim($output) === '.') {
  36367. $exitCode = $this->process->execute(['git', 'rev-parse', '--quiet', '--verify', $ref.'^{commit}'], $ignoredOutput, $dir);
  36368. if ($exitCode === 0) {
  36369. return true;
  36370. }
  36371. }
  36372. self::checkForRepoOwnershipError($this->process->getErrorOutput(), $dir);
  36373. return false;
  36374. }
  36375. private function getAuthenticationFailure(string $url): ?array
  36376. {
  36377. if (!Preg::isMatchStrictGroups('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  36378. return null;
  36379. }
  36380. $authFailures = [
  36381. 'fatal: Authentication failed',
  36382. 'remote error: Invalid username or password.',
  36383. 'error: 401 Unauthorized',
  36384. 'fatal: unable to access',
  36385. 'fatal: could not read Username',
  36386. ];
  36387. $errorOutput = $this->process->getErrorOutput();
  36388. foreach ($authFailures as $authFailure) {
  36389. if (strpos($errorOutput, $authFailure) !== false) {
  36390. return $match;
  36391. }
  36392. }
  36393. return null;
  36394. }
  36395. public function getMirrorDefaultBranch(string $url, string $dir, bool $isLocalPathRepository): ?string
  36396. {
  36397. if ((bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK')) {
  36398. return null;
  36399. }
  36400. try {
  36401. if ($isLocalPathRepository) {
  36402. $this->process->execute(['git', 'remote', 'show', 'origin'], $output, $dir);
  36403. } else {
  36404. $commands = [
  36405. ['git', 'remote', 'set-url', 'origin', '--', '%url%'],
  36406. ['git', 'remote', 'show', 'origin'],
  36407. ['git', 'remote', 'set-url', 'origin', '--', '%sanitizedUrl%'],
  36408. ];
  36409. $this->runCommands($commands, $url, $dir, false, $output);
  36410. }
  36411. $lines = $this->process->splitLines($output);
  36412. foreach ($lines as $line) {
  36413. if (Preg::isMatch('{^\s*HEAD branch:\s(.+)\s*$}m', $line, $matches)) {
  36414. return $matches[1];
  36415. }
  36416. }
  36417. } catch (\Exception $e) {
  36418. $this->io->writeError('<error>Failed to fetch root identifier from remote: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  36419. }
  36420. return null;
  36421. }
  36422. public static function cleanEnv(): void
  36423. {
  36424. if (Platform::getEnv('GIT_ASKPASS') !== 'echo') {
  36425. Platform::putEnv('GIT_ASKPASS', 'echo');
  36426. }
  36427. if (Platform::getEnv('GIT_DIR')) {
  36428. Platform::clearEnv('GIT_DIR');
  36429. }
  36430. if (Platform::getEnv('GIT_WORK_TREE')) {
  36431. Platform::clearEnv('GIT_WORK_TREE');
  36432. }
  36433. if (Platform::getEnv('LANGUAGE') !== 'C') {
  36434. Platform::putEnv('LANGUAGE', 'C');
  36435. }
  36436. Platform::clearEnv('DYLD_LIBRARY_PATH');
  36437. }
  36438. public static function getGitHubDomainsRegex(Config $config): string
  36439. {
  36440. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  36441. }
  36442. public static function getGitLabDomainsRegex(Config $config): string
  36443. {
  36444. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  36445. }
  36446. private function throwException($message, string $url): void
  36447. {
  36448. clearstatcache();
  36449. if (0 !== $this->process->execute(['git', '--version'], $ignoredOutput)) {
  36450. throw new \RuntimeException(Url::sanitize('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  36451. }
  36452. throw new \RuntimeException(Url::sanitize($message));
  36453. }
  36454. public static function getVersion(ProcessExecutor $process): ?string
  36455. {
  36456. if (false === self::$version) {
  36457. self::$version = null;
  36458. if (0 === $process->execute(['git', '--version'], $output) && Preg::isMatch('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  36459. self::$version = $matches[1];
  36460. }
  36461. }
  36462. return self::$version;
  36463. }
  36464. private function maskCredentials(string $error, array $credentials): string
  36465. {
  36466. $maskedCredentials = [];
  36467. foreach ($credentials as $credential) {
  36468. if (in_array($credential, ['private-token', 'x-token-auth', 'oauth2', 'gitlab-ci-token', 'x-oauth-basic'])) {
  36469. $maskedCredentials[] = $credential;
  36470. } elseif (strlen($credential) > 6) {
  36471. $maskedCredentials[] = substr($credential, 0, 3) . '...' . substr($credential, -3);
  36472. } elseif (strlen($credential) > 3) {
  36473. $maskedCredentials[] = substr($credential, 0, 3) . '...';
  36474. } else {
  36475. $maskedCredentials[] = 'XXX';
  36476. }
  36477. }
  36478. return str_replace($credentials, $maskedCredentials, $error);
  36479. }
  36480. }
  36481. <?php declare(strict_types=1);
  36482. namespace Composer\Util;
  36483. use Composer\Factory;
  36484. use Composer\IO\IOInterface;
  36485. use Composer\Config;
  36486. use Composer\Downloader\TransportException;
  36487. use Composer\Pcre\Preg;
  36488. class GitHub
  36489. {
  36490. protected $io;
  36491. protected $config;
  36492. protected $process;
  36493. protected $httpDownloader;
  36494. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null)
  36495. {
  36496. $this->io = $io;
  36497. $this->config = $config;
  36498. $this->process = $process ?: new ProcessExecutor($io);
  36499. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  36500. }
  36501. public function authorizeOAuth(string $originUrl): bool
  36502. {
  36503. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  36504. return false;
  36505. }
  36506. if (0 === $this->process->execute(['git', 'config', 'github.accesstoken'], $output)) {
  36507. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  36508. return true;
  36509. }
  36510. return false;
  36511. }
  36512. public function authorizeOAuthInteractively(string $originUrl, ?string $message = null): bool
  36513. {
  36514. if ($message) {
  36515. $this->io->writeError($message);
  36516. }
  36517. $note = 'Composer';
  36518. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute(['hostname'], $output)) {
  36519. $note .= ' on ' . trim($output);
  36520. }
  36521. $note .= ' ' . date('Y-m-d Hi');
  36522. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=&description=' . str_replace('%20', '+', rawurlencode($note));
  36523. $this->io->writeError('When working with _public_ GitHub repositories only, head here to retrieve a token:');
  36524. $this->io->writeError($url);
  36525. $this->io->writeError('This token will have read-only permission for public information only.');
  36526. $localAuthConfig = $this->config->getLocalAuthConfigSource();
  36527. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  36528. $this->io->writeError('When you need to access _private_ GitHub repositories as well, go to:');
  36529. $this->io->writeError($url);
  36530. $this->io->writeError('Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.');
  36531. $this->io->writeError(sprintf('Tokens will be stored in plain text in "%s" for future use by Composer.', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName()));
  36532. $this->io->writeError('For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth');
  36533. $storeInLocalAuthConfig = false;
  36534. if ($localAuthConfig !== null) {
  36535. $storeInLocalAuthConfig = $this->io->askConfirmation('A local auth config source was found, do you want to store the token there?', true);
  36536. }
  36537. $token = trim((string) $this->io->askAndHideAnswer('Token (hidden): '));
  36538. if ($token === '') {
  36539. $this->io->writeError('<warning>No token given, aborting.</warning>');
  36540. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  36541. return false;
  36542. }
  36543. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  36544. try {
  36545. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  36546. $this->httpDownloader->get('https://'. $apiUrl, [
  36547. 'retry-auth-failure' => false,
  36548. ]);
  36549. } catch (TransportException $e) {
  36550. if (in_array($e->getCode(), [403, 401])) {
  36551. $this->io->writeError('<error>Invalid token provided.</error>');
  36552. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  36553. return false;
  36554. }
  36555. throw $e;
  36556. }
  36557. $authConfigSource = $storeInLocalAuthConfig && $localAuthConfig !== null ? $localAuthConfig : $this->config->getAuthConfigSource();
  36558. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  36559. $authConfigSource->addConfigSetting('github-oauth.'.$originUrl, $token);
  36560. $this->io->writeError('<info>Token stored successfully.</info>');
  36561. return true;
  36562. }
  36563. public function getRateLimit(array $headers): array
  36564. {
  36565. $rateLimit = [
  36566. 'limit' => '?',
  36567. 'reset' => '?',
  36568. ];
  36569. foreach ($headers as $header) {
  36570. $header = trim($header);
  36571. if (false === stripos($header, 'x-ratelimit-')) {
  36572. continue;
  36573. }
  36574. [$type, $value] = explode(':', $header, 2);
  36575. switch (strtolower($type)) {
  36576. case 'x-ratelimit-limit':
  36577. $rateLimit['limit'] = (int) trim($value);
  36578. break;
  36579. case 'x-ratelimit-reset':
  36580. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  36581. break;
  36582. }
  36583. }
  36584. return $rateLimit;
  36585. }
  36586. public function getSsoUrl(array $headers): ?string
  36587. {
  36588. foreach ($headers as $header) {
  36589. $header = trim($header);
  36590. if (false === stripos($header, 'x-github-sso: required')) {
  36591. continue;
  36592. }
  36593. if (Preg::isMatch('{\burl=(?P<url>[^\s;]+)}', $header, $match)) {
  36594. return $match['url'];
  36595. }
  36596. }
  36597. return null;
  36598. }
  36599. public function isRateLimited(array $headers): bool
  36600. {
  36601. foreach ($headers as $header) {
  36602. if (Preg::isMatch('{^x-ratelimit-remaining: *0$}i', trim($header))) {
  36603. return true;
  36604. }
  36605. }
  36606. return false;
  36607. }
  36608. public function requiresSso(array $headers): bool
  36609. {
  36610. foreach ($headers as $header) {
  36611. if (Preg::isMatch('{^x-github-sso: required}i', trim($header))) {
  36612. return true;
  36613. }
  36614. }
  36615. return false;
  36616. }
  36617. }
  36618. <?php declare(strict_types=1);
  36619. namespace Composer\Util;
  36620. use Composer\IO\IOInterface;
  36621. use Composer\Config;
  36622. use Composer\Factory;
  36623. use Composer\Downloader\TransportException;
  36624. use Composer\Pcre\Preg;
  36625. class GitLab
  36626. {
  36627. protected $io;
  36628. protected $config;
  36629. protected $process;
  36630. protected $httpDownloader;
  36631. public function __construct(IOInterface $io, Config $config, ?ProcessExecutor $process = null, ?HttpDownloader $httpDownloader = null)
  36632. {
  36633. $this->io = $io;
  36634. $this->config = $config;
  36635. $this->process = $process ?: new ProcessExecutor($io);
  36636. $this->httpDownloader = $httpDownloader ?: Factory::createHttpDownloader($this->io, $config);
  36637. }
  36638. public function authorizeOAuth(string $originUrl): bool
  36639. {
  36640. $bcOriginUrl = Preg::replace('{:\d+}', '', $originUrl);
  36641. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  36642. return false;
  36643. }
  36644. if (0 === $this->process->execute(['git', 'config', 'gitlab.accesstoken'], $output)) {
  36645. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  36646. return true;
  36647. }
  36648. if (0 === $this->process->execute(['git', 'config', 'gitlab.deploytoken.user'], $tokenUser) && 0 === $this->process->execute(['git', 'config', 'gitlab.deploytoken.token'], $tokenPassword)) {
  36649. $this->io->setAuthentication($originUrl, trim($tokenUser), trim($tokenPassword));
  36650. return true;
  36651. }
  36652. $authTokens = $this->config->get('gitlab-token');
  36653. if (isset($authTokens[$originUrl])) {
  36654. $token = $authTokens[$originUrl];
  36655. }
  36656. if (isset($authTokens[$bcOriginUrl])) {
  36657. $token = $authTokens[$bcOriginUrl];
  36658. }
  36659. if (isset($token)) {
  36660. $username = is_array($token) ? $token["username"] : $token;
  36661. $password = is_array($token) ? $token["token"] : 'private-token';
  36662. if (in_array($username, ['private-token', 'gitlab-ci-token', 'oauth2'], true)) {
  36663. $this->io->setAuthentication($originUrl, $password, $username);
  36664. } else {
  36665. $this->io->setAuthentication($originUrl, $username, $password);
  36666. }
  36667. return true;
  36668. }
  36669. return false;
  36670. }
  36671. public function authorizeOAuthInteractively(string $scheme, string $originUrl, ?string $message = null): bool
  36672. {
  36673. if ($message) {
  36674. $this->io->writeError($message);
  36675. }
  36676. $localAuthConfig = $this->config->getLocalAuthConfigSource();
  36677. $personalAccessTokenLink = $scheme.'://'.$originUrl.'/-/profile/personal_access_tokens';
  36678. $revokeLink = $scheme.'://'.$originUrl.'/-/profile/applications';
  36679. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', ($localAuthConfig !== null ? $localAuthConfig->getName() . ' OR ' : '') . $this->config->getAuthConfigSource()->getName()));
  36680. $this->io->writeError('To revoke access to this token you can visit:');
  36681. $this->io->writeError($revokeLink);
  36682. $this->io->writeError('Alternatively you can setup an personal access token on:');
  36683. $this->io->writeError($personalAccessTokenLink);
  36684. $this->io->writeError('and store it under "gitlab-token" see https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token for more details.');
  36685. $this->io->writeError('https://getcomposer.org/doc/articles/authentication-for-private-packages.md#gitlab-token');
  36686. $this->io->writeError('for more details.');
  36687. $storeInLocalAuthConfig = false;
  36688. if ($localAuthConfig !== null) {
  36689. $storeInLocalAuthConfig = $this->io->askConfirmation('A local auth config source was found, do you want to store the token there?', true);
  36690. }
  36691. $attemptCounter = 0;
  36692. while ($attemptCounter++ < 5) {
  36693. try {
  36694. $response = $this->createToken($scheme, $originUrl);
  36695. } catch (TransportException $e) {
  36696. if (in_array($e->getCode(), [403, 401])) {
  36697. if (401 === $e->getCode()) {
  36698. $response = json_decode($e->getResponse(), true);
  36699. if (isset($response['error']) && $response['error'] === 'invalid_grant') {
  36700. $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
  36701. } else {
  36702. $this->io->writeError('Bad credentials.');
  36703. }
  36704. } else {
  36705. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  36706. }
  36707. $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at:');
  36708. $this->io->writeError($scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  36709. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  36710. continue;
  36711. }
  36712. throw $e;
  36713. }
  36714. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  36715. $authConfigSource = $storeInLocalAuthConfig && $localAuthConfig !== null ? $localAuthConfig : $this->config->getAuthConfigSource();
  36716. if (isset($response['expires_in'])) {
  36717. $authConfigSource->addConfigSetting(
  36718. 'gitlab-oauth.'.$originUrl,
  36719. [
  36720. 'expires-at' => intval($response['created_at']) + intval($response['expires_in']),
  36721. 'refresh-token' => $response['refresh_token'],
  36722. 'token' => $response['access_token'],
  36723. ]
  36724. );
  36725. } else {
  36726. $authConfigSource->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  36727. }
  36728. return true;
  36729. }
  36730. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  36731. }
  36732. public function authorizeOAuthRefresh(string $scheme, string $originUrl): bool
  36733. {
  36734. try {
  36735. $response = $this->refreshToken($scheme, $originUrl);
  36736. } catch (TransportException $e) {
  36737. $this->io->writeError("Couldn't refresh access token: ".$e->getMessage());
  36738. return false;
  36739. }
  36740. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  36741. $this->config->getAuthConfigSource()->addConfigSetting(
  36742. 'gitlab-oauth.'.$originUrl,
  36743. [
  36744. 'expires-at' => intval($response['created_at']) + intval($response['expires_in']),
  36745. 'refresh-token' => $response['refresh_token'],
  36746. 'token' => $response['access_token'],
  36747. ]
  36748. );
  36749. return true;
  36750. }
  36751. private function createToken(string $scheme, string $originUrl): array
  36752. {
  36753. $username = $this->io->ask('Username: ');
  36754. $password = $this->io->askAndHideAnswer('Password: ');
  36755. $headers = ['Content-Type: application/x-www-form-urlencoded'];
  36756. $apiUrl = $originUrl;
  36757. $data = http_build_query([
  36758. 'username' => $username,
  36759. 'password' => $password,
  36760. 'grant_type' => 'password',
  36761. ], '', '&');
  36762. $options = [
  36763. 'retry-auth-failure' => false,
  36764. 'http' => [
  36765. 'method' => 'POST',
  36766. 'header' => $headers,
  36767. 'content' => $data,
  36768. ],
  36769. ];
  36770. $token = $this->httpDownloader->get($scheme.'://'.$apiUrl.'/oauth/token', $options)->decodeJson();
  36771. $this->io->writeError('Token successfully created');
  36772. return $token;
  36773. }
  36774. public function isOAuthExpired(string $originUrl): bool
  36775. {
  36776. $authTokens = $this->config->get('gitlab-oauth');
  36777. if (isset($authTokens[$originUrl]['expires-at'])) {
  36778. if ($authTokens[$originUrl]['expires-at'] < time()) {
  36779. return true;
  36780. }
  36781. }
  36782. return false;
  36783. }
  36784. private function refreshToken(string $scheme, string $originUrl): array
  36785. {
  36786. $authTokens = $this->config->get('gitlab-oauth');
  36787. if (!isset($authTokens[$originUrl]['refresh-token'])) {
  36788. throw new \RuntimeException('No GitLab refresh token present for '.$originUrl.'.');
  36789. }
  36790. $refreshToken = $authTokens[$originUrl]['refresh-token'];
  36791. $headers = ['Content-Type: application/x-www-form-urlencoded'];
  36792. $data = http_build_query([
  36793. 'refresh_token' => $refreshToken,
  36794. 'grant_type' => 'refresh_token',
  36795. ], '', '&');
  36796. $options = [
  36797. 'retry-auth-failure' => false,
  36798. 'http' => [
  36799. 'method' => 'POST',
  36800. 'header' => $headers,
  36801. 'content' => $data,
  36802. ],
  36803. ];
  36804. $token = $this->httpDownloader->get($scheme.'://'.$originUrl.'/oauth/token', $options)->decodeJson();
  36805. $this->io->writeError('GitLab token successfully refreshed', true, IOInterface::VERY_VERBOSE);
  36806. $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/-/profile/applications', true, IOInterface::VERY_VERBOSE);
  36807. return $token;
  36808. }
  36809. }
  36810. <?php declare(strict_types=1);
  36811. namespace Composer\Util;
  36812. use Composer\Config;
  36813. use Composer\IO\IOInterface;
  36814. use Composer\Pcre\Preg;
  36815. class Hg
  36816. {
  36817. private static $version = false;
  36818. private $io;
  36819. private $config;
  36820. private $process;
  36821. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  36822. {
  36823. $this->io = $io;
  36824. $this->config = $config;
  36825. $this->process = $process;
  36826. }
  36827. public function runCommand(callable $commandCallable, string $url, ?string $cwd): void
  36828. {
  36829. $this->config->prohibitUrlByConfig($url, $this->io);
  36830. $command = $commandCallable($url);
  36831. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  36832. return;
  36833. }
  36834. if (
  36835. Preg::isMatch('{^(?P<proto>ssh|https?)://(?:(?P<user>[^:@]+)(?::(?P<pass>[^:@]+))?@)?(?P<host>[^/]+)(?P<path>/.*)?}mi', $url, $matches)
  36836. && $this->io->hasAuthentication($matches['host'])
  36837. ) {
  36838. if ($matches['proto'] === 'ssh') {
  36839. $user = '';
  36840. if ($matches['user'] !== null) {
  36841. $user = rawurlencode($matches['user']) . '@';
  36842. }
  36843. $authenticatedUrl = $matches['proto'] . '://' . $user . $matches['host'] . $matches['path'];
  36844. } else {
  36845. $auth = $this->io->getAuthentication($matches['host']);
  36846. $authenticatedUrl = $matches['proto'] . '://' . rawurlencode((string) $auth['username']) . ':' . rawurlencode((string) $auth['password']) . '@' . $matches['host'] . $matches['path'];
  36847. }
  36848. $command = $commandCallable($authenticatedUrl);
  36849. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  36850. return;
  36851. }
  36852. $error = $this->process->getErrorOutput();
  36853. } else {
  36854. $error = 'The given URL (' .$url. ') does not match the required format (ssh|http(s)://(username:password@)example.com/path-to-repository)';
  36855. }
  36856. $this->throwException("Failed to clone $url, \n\n" . $error, $url);
  36857. }
  36858. private function throwException($message, string $url): void
  36859. {
  36860. if (null === self::getVersion($this->process)) {
  36861. throw new \RuntimeException(Url::sanitize(
  36862. 'Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()
  36863. ));
  36864. }
  36865. throw new \RuntimeException(Url::sanitize($message));
  36866. }
  36867. public static function getVersion(ProcessExecutor $process): ?string
  36868. {
  36869. if (false === self::$version) {
  36870. self::$version = null;
  36871. if (0 === $process->execute(['hg', '--version'], $output) && Preg::isMatch('/^.+? (\d+(?:\.\d+)+)(?:\+.*?)?\)?\r?\n/', $output, $matches)) {
  36872. self::$version = $matches[1];
  36873. }
  36874. }
  36875. return self::$version;
  36876. }
  36877. }
  36878. <?php declare(strict_types=1);
  36879. namespace Composer\Util\Http;
  36880. use Composer\Config;
  36881. use Composer\Downloader\MaxFileSizeExceededException;
  36882. use Composer\IO\IOInterface;
  36883. use Composer\Downloader\TransportException;
  36884. use Composer\Pcre\Preg;
  36885. use Composer\Util\Platform;
  36886. use Composer\Util\StreamContextFactory;
  36887. use Composer\Util\AuthHelper;
  36888. use Composer\Util\Url;
  36889. use Composer\Util\HttpDownloader;
  36890. use React\Promise\Promise;
  36891. use Symfony\Component\HttpFoundation\IpUtils;
  36892. class CurlDownloader
  36893. {
  36894. private $multiHandle;
  36895. private $shareHandle;
  36896. private $jobs = [];
  36897. private $io;
  36898. private $config;
  36899. private $authHelper;
  36900. private $selectTimeout = 5.0;
  36901. private $maxRedirects = 20;
  36902. private $maxRetries = 3;
  36903. protected $multiErrors = [
  36904. CURLM_BAD_HANDLE => ['CURLM_BAD_HANDLE', 'The passed-in handle is not a valid CURLM handle.'],
  36905. CURLM_BAD_EASY_HANDLE => ['CURLM_BAD_EASY_HANDLE', "An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle."],
  36906. CURLM_OUT_OF_MEMORY => ['CURLM_OUT_OF_MEMORY', 'You are doomed.'],
  36907. CURLM_INTERNAL_ERROR => ['CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!'],
  36908. ];
  36909. private static $options = [
  36910. 'http' => [
  36911. 'method' => CURLOPT_CUSTOMREQUEST,
  36912. 'content' => CURLOPT_POSTFIELDS,
  36913. 'header' => CURLOPT_HTTPHEADER,
  36914. 'timeout' => CURLOPT_TIMEOUT,
  36915. ],
  36916. 'ssl' => [
  36917. 'cafile' => CURLOPT_CAINFO,
  36918. 'capath' => CURLOPT_CAPATH,
  36919. 'verify_peer' => CURLOPT_SSL_VERIFYPEER,
  36920. 'verify_peer_name' => CURLOPT_SSL_VERIFYHOST,
  36921. 'local_cert' => CURLOPT_SSLCERT,
  36922. 'local_pk' => CURLOPT_SSLKEY,
  36923. 'passphrase' => CURLOPT_SSLKEYPASSWD,
  36924. ],
  36925. ];
  36926. private static $timeInfo = [
  36927. 'total_time' => true,
  36928. 'namelookup_time' => true,
  36929. 'connect_time' => true,
  36930. 'pretransfer_time' => true,
  36931. 'starttransfer_time' => true,
  36932. 'redirect_time' => true,
  36933. ];
  36934. public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false)
  36935. {
  36936. $this->io = $io;
  36937. $this->config = $config;
  36938. $this->multiHandle = $mh = curl_multi_init();
  36939. if (function_exists('curl_multi_setopt')) {
  36940. curl_multi_setopt($mh, CURLMOPT_PIPELINING, \PHP_VERSION_ID >= 70400 ? 2 : 3);
  36941. if (defined('CURLMOPT_MAX_HOST_CONNECTIONS') && !defined('HHVM_VERSION')) {
  36942. curl_multi_setopt($mh, CURLMOPT_MAX_HOST_CONNECTIONS, 8);
  36943. }
  36944. }
  36945. if (function_exists('curl_share_init')) {
  36946. $this->shareHandle = $sh = curl_share_init();
  36947. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
  36948. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
  36949. curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
  36950. }
  36951. $this->authHelper = new AuthHelper($io, $config);
  36952. }
  36953. public function download(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null): int
  36954. {
  36955. $attributes = [];
  36956. if (isset($options['retry-auth-failure'])) {
  36957. $attributes['retryAuthFailure'] = $options['retry-auth-failure'];
  36958. unset($options['retry-auth-failure']);
  36959. }
  36960. return $this->initDownload($resolve, $reject, $origin, $url, $options, $copyTo, $attributes);
  36961. }
  36962. private function initDownload(callable $resolve, callable $reject, string $origin, string $url, array $options, ?string $copyTo = null, array $attributes = []): int
  36963. {
  36964. $attributes = array_merge([
  36965. 'retryAuthFailure' => true,
  36966. 'redirects' => 0,
  36967. 'retries' => 0,
  36968. 'storeAuth' => false,
  36969. 'ipResolve' => null,
  36970. ], $attributes);
  36971. if ($attributes['ipResolve'] === null && Platform::getEnv('COMPOSER_IPRESOLVE') === '4') {
  36972. $attributes['ipResolve'] = 4;
  36973. } elseif ($attributes['ipResolve'] === null && Platform::getEnv('COMPOSER_IPRESOLVE') === '6') {
  36974. $attributes['ipResolve'] = 6;
  36975. }
  36976. $originalOptions = $options;
  36977. if (!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $url) || (false === strpos($url, '$') && false === strpos($url, '%24'))) {
  36978. $this->config->prohibitUrlByConfig($url, $this->io, $options);
  36979. }
  36980. $curlHandle = curl_init();
  36981. $headerHandle = fopen('php://temp/maxmemory:32768', 'w+b');
  36982. if (false === $headerHandle) {
  36983. throw new \RuntimeException('Failed to open a temp stream to store curl headers');
  36984. }
  36985. if ($copyTo !== null) {
  36986. $bodyTarget = $copyTo.'~';
  36987. } else {
  36988. $bodyTarget = 'php://temp/maxmemory:524288';
  36989. }
  36990. $errorMessage = '';
  36991. set_error_handler(static function (int $code, string $msg) use (&$errorMessage): bool {
  36992. if ($errorMessage) {
  36993. $errorMessage .= "\n";
  36994. }
  36995. $errorMessage .= Preg::replace('{^fopen\(.*?\): }', '', $msg);
  36996. return true;
  36997. });
  36998. $bodyHandle = fopen($bodyTarget, 'w+b');
  36999. restore_error_handler();
  37000. if (false === $bodyHandle) {
  37001. throw new TransportException('The "'.$url.'" file could not be written to '.($copyTo ?? 'a temporary file').': '.$errorMessage);
  37002. }
  37003. curl_setopt($curlHandle, CURLOPT_URL, $url);
  37004. curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, false);
  37005. curl_setopt($curlHandle, CURLOPT_CONNECTTIMEOUT, 10);
  37006. curl_setopt($curlHandle, CURLOPT_TIMEOUT, max((int) ini_get("default_socket_timeout"), 300));
  37007. curl_setopt($curlHandle, CURLOPT_WRITEHEADER, $headerHandle);
  37008. curl_setopt($curlHandle, CURLOPT_FILE, $bodyHandle);
  37009. curl_setopt($curlHandle, CURLOPT_ENCODING, "");
  37010. curl_setopt($curlHandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
  37011. if ($attributes['ipResolve'] === 4) {
  37012. curl_setopt($curlHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
  37013. } elseif ($attributes['ipResolve'] === 6) {
  37014. curl_setopt($curlHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
  37015. }
  37016. if (function_exists('curl_share_init')) {
  37017. curl_setopt($curlHandle, CURLOPT_SHARE, $this->shareHandle);
  37018. }
  37019. if (!isset($options['http']['header'])) {
  37020. $options['http']['header'] = [];
  37021. }
  37022. $options['http']['header'] = array_diff($options['http']['header'], ['Connection: close']);
  37023. $options['http']['header'][] = 'Connection: keep-alive';
  37024. $version = curl_version();
  37025. $features = $version['features'];
  37026. if (0 === strpos($url, 'https://') && \defined('CURL_VERSION_HTTP2') && \defined('CURL_HTTP_VERSION_2_0') && (CURL_VERSION_HTTP2 & $features) !== 0) {
  37027. curl_setopt($curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
  37028. }
  37029. if (isset($version['version']) && in_array($version['version'], ['8.7.0', '8.7.1'], true) && \defined('CURL_VERSION_LIBZ') && (CURL_VERSION_LIBZ & $features) !== 0) {
  37030. curl_setopt($curlHandle, CURLOPT_ENCODING, "gzip");
  37031. }
  37032. $options['http']['header'] = $this->authHelper->addAuthenticationHeader($options['http']['header'], $origin, $url);
  37033. $options = StreamContextFactory::initOptions($url, $options, true);
  37034. foreach (self::$options as $type => $curlOptions) {
  37035. foreach ($curlOptions as $name => $curlOption) {
  37036. if (isset($options[$type][$name])) {
  37037. if ($type === 'ssl' && $name === 'verify_peer_name') {
  37038. curl_setopt($curlHandle, $curlOption, $options[$type][$name] === true ? 2 : $options[$type][$name]);
  37039. } else {
  37040. curl_setopt($curlHandle, $curlOption, $options[$type][$name]);
  37041. }
  37042. }
  37043. }
  37044. }
  37045. $proxy = ProxyManager::getInstance()->getProxyForRequest($url);
  37046. curl_setopt_array($curlHandle, $proxy->getCurlOptions($options['ssl'] ?? []));
  37047. $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
  37048. $this->jobs[(int) $curlHandle] = [
  37049. 'url' => $url,
  37050. 'origin' => $origin,
  37051. 'attributes' => $attributes,
  37052. 'options' => $originalOptions,
  37053. 'progress' => $progress,
  37054. 'curlHandle' => $curlHandle,
  37055. 'filename' => $copyTo,
  37056. 'headerHandle' => $headerHandle,
  37057. 'bodyHandle' => $bodyHandle,
  37058. 'resolve' => $resolve,
  37059. 'reject' => $reject,
  37060. 'primaryIp' => '',
  37061. ];
  37062. $usingProxy = $proxy->getStatus(' using proxy (%s)');
  37063. $ifModified = false !== stripos(implode(',', $options['http']['header']), 'if-modified-since:') ? ' if modified' : '';
  37064. if ($attributes['redirects'] === 0 && $attributes['retries'] === 0) {
  37065. $this->io->writeError('Downloading ' . Url::sanitize($url) . $usingProxy . $ifModified, true, IOInterface::DEBUG);
  37066. }
  37067. $this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $curlHandle));
  37068. return (int) $curlHandle;
  37069. }
  37070. public function abortRequest(int $id): void
  37071. {
  37072. if (isset($this->jobs[$id], $this->jobs[$id]['curlHandle'])) {
  37073. $job = $this->jobs[$id];
  37074. curl_multi_remove_handle($this->multiHandle, $job['curlHandle']);
  37075. curl_close($job['curlHandle']);
  37076. if (is_resource($job['headerHandle'])) {
  37077. fclose($job['headerHandle']);
  37078. }
  37079. if (is_resource($job['bodyHandle'])) {
  37080. fclose($job['bodyHandle']);
  37081. }
  37082. if (null !== $job['filename']) {
  37083. @unlink($job['filename'].'~');
  37084. }
  37085. unset($this->jobs[$id]);
  37086. }
  37087. }
  37088. public function tick(): void
  37089. {
  37090. static $timeoutWarning = false;
  37091. if (count($this->jobs) === 0) {
  37092. return;
  37093. }
  37094. $active = true;
  37095. $this->checkCurlResult(curl_multi_exec($this->multiHandle, $active));
  37096. if (-1 === curl_multi_select($this->multiHandle, $this->selectTimeout)) {
  37097. usleep(150);
  37098. }
  37099. while ($progress = curl_multi_info_read($this->multiHandle)) {
  37100. $curlHandle = $progress['handle'];
  37101. $result = $progress['result'];
  37102. $i = (int) $curlHandle;
  37103. if (!isset($this->jobs[$i])) {
  37104. continue;
  37105. }
  37106. $progress = curl_getinfo($curlHandle);
  37107. if (false === $progress) {
  37108. throw new \RuntimeException('Failed getting info from curl handle '.$i.' ('.$this->jobs[$i]['url'].')');
  37109. }
  37110. $job = $this->jobs[$i];
  37111. unset($this->jobs[$i]);
  37112. $error = curl_error($curlHandle);
  37113. $errno = curl_errno($curlHandle);
  37114. curl_multi_remove_handle($this->multiHandle, $curlHandle);
  37115. curl_close($curlHandle);
  37116. $headers = null;
  37117. $statusCode = null;
  37118. $response = null;
  37119. try {
  37120. if (CURLE_OK !== $errno || $error || $result !== CURLE_OK) {
  37121. $errno = $errno ?: $result;
  37122. if (!$error && function_exists('curl_strerror')) {
  37123. $error = curl_strerror($errno);
  37124. }
  37125. $progress['error_code'] = $errno;
  37126. if (
  37127. (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
  37128. && (
  37129. in_array($errno, [7 , 16 , 92 , 6 ], true)
  37130. || (in_array($errno, [56 , 35 ], true) && str_contains((string) $error, 'Connection reset by peer'))
  37131. ) && $job['attributes']['retries'] < $this->maxRetries
  37132. ) {
  37133. $attributes = ['retries' => $job['attributes']['retries'] + 1];
  37134. if ($errno === 7 && !isset($job['attributes']['ipResolve'])) {
  37135. $attributes['ipResolve'] = 4;
  37136. }
  37137. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to curl error '. $errno, true, IOInterface::DEBUG);
  37138. $this->restartJobWithDelay($job, $job['url'], $attributes);
  37139. continue;
  37140. }
  37141. if ($errno === 55 ) {
  37142. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to curl error '. $errno, true, IOInterface::DEBUG);
  37143. $this->restartJobWithDelay($job, $job['url'], ['retries' => $job['attributes']['retries'] + 1]);
  37144. continue;
  37145. }
  37146. if ($errno === 28 && \PHP_VERSION_ID >= 70300 && $progress['namelookup_time'] === 0.0 && !$timeoutWarning) {
  37147. $timeoutWarning = true;
  37148. $this->io->writeError('<warning>A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.</warning>');
  37149. }
  37150. throw new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error);
  37151. }
  37152. $statusCode = $progress['http_code'];
  37153. rewind($job['headerHandle']);
  37154. $headers = explode("\r\n", rtrim(stream_get_contents($job['headerHandle'])));
  37155. fclose($job['headerHandle']);
  37156. if ($statusCode === 0) {
  37157. throw new \LogicException('Received unexpected http status code 0 without error for '.Url::sanitize($progress['url']).': headers '.var_export($headers, true).' curl info '.var_export($progress, true));
  37158. }
  37159. if (null !== $job['filename']) {
  37160. $contents = $job['filename'].'~';
  37161. if ($statusCode >= 300) {
  37162. rewind($job['bodyHandle']);
  37163. $contents = stream_get_contents($job['bodyHandle']);
  37164. }
  37165. $response = new CurlResponse(['url' => $job['url']], $statusCode, $headers, $contents, $progress);
  37166. $this->io->writeError('['.$statusCode.'] '.Url::sanitize($job['url']), true, IOInterface::DEBUG);
  37167. } else {
  37168. $maxFileSize = $job['options']['max_file_size'] ?? null;
  37169. rewind($job['bodyHandle']);
  37170. if ($maxFileSize !== null) {
  37171. $contents = stream_get_contents($job['bodyHandle'], $maxFileSize);
  37172. if ($contents !== false && Platform::strlen($contents) >= $maxFileSize) {
  37173. throw new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . Platform::strlen($contents) . ' of allowed ' . $maxFileSize . ' bytes');
  37174. }
  37175. } else {
  37176. $contents = stream_get_contents($job['bodyHandle']);
  37177. }
  37178. $response = new CurlResponse(['url' => $job['url']], $statusCode, $headers, $contents, $progress);
  37179. $this->io->writeError('['.$statusCode.'] '.Url::sanitize($job['url']), true, IOInterface::DEBUG);
  37180. }
  37181. fclose($job['bodyHandle']);
  37182. if ($response->getStatusCode() >= 400 && $response->getHeader('content-type') === 'application/json') {
  37183. HttpDownloader::outputWarnings($this->io, $job['origin'], json_decode($response->getBody(), true));
  37184. }
  37185. $result = $this->isAuthenticatedRetryNeeded($job, $response);
  37186. if ($result['retry']) {
  37187. $this->restartJob($job, $job['url'], ['storeAuth' => $result['storeAuth'], 'retries' => $job['attributes']['retries'] + 1]);
  37188. continue;
  37189. }
  37190. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $job['attributes']['redirects'] < $this->maxRedirects) {
  37191. $location = $this->handleRedirect($job, $response);
  37192. if ($location) {
  37193. $this->restartJob($job, $location, ['redirects' => $job['attributes']['redirects'] + 1]);
  37194. continue;
  37195. }
  37196. }
  37197. if ($statusCode >= 400 && $statusCode <= 599) {
  37198. if (
  37199. (!isset($job['options']['http']['method']) || $job['options']['http']['method'] === 'GET')
  37200. && in_array($statusCode, [423, 425, 500, 502, 503, 504, 507, 510], true)
  37201. && $job['attributes']['retries'] < $this->maxRetries
  37202. ) {
  37203. $this->io->writeError('Retrying ('.($job['attributes']['retries'] + 1).') ' . Url::sanitize($job['url']) . ' due to status code '. $statusCode, true, IOInterface::DEBUG);
  37204. $this->restartJobWithDelay($job, $job['url'], ['retries' => $job['attributes']['retries'] + 1]);
  37205. continue;
  37206. }
  37207. throw $this->failResponse($job, $response, $response->getStatusMessage());
  37208. }
  37209. if ($job['attributes']['storeAuth'] !== false) {
  37210. $this->authHelper->storeAuth($job['origin'], $job['attributes']['storeAuth']);
  37211. }
  37212. if (null !== $job['filename']) {
  37213. rename($job['filename'].'~', $job['filename']);
  37214. $job['resolve']($response);
  37215. } else {
  37216. $job['resolve']($response);
  37217. }
  37218. } catch (\Exception $e) {
  37219. if ($e instanceof TransportException) {
  37220. if (null !== $headers) {
  37221. $e->setHeaders($headers);
  37222. $e->setStatusCode($statusCode);
  37223. }
  37224. if (null !== $response) {
  37225. $e->setResponse($response->getBody());
  37226. }
  37227. $e->setResponseInfo($progress);
  37228. }
  37229. $this->rejectJob($job, $e);
  37230. }
  37231. }
  37232. foreach ($this->jobs as $i => $curlHandle) {
  37233. $curlHandle = $this->jobs[$i]['curlHandle'];
  37234. $progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
  37235. if ($this->jobs[$i]['progress'] !== $progress) {
  37236. $this->jobs[$i]['progress'] = $progress;
  37237. if (isset($this->jobs[$i]['options']['max_file_size'])) {
  37238. if ($this->jobs[$i]['options']['max_file_size'] < $progress['download_content_length']) {
  37239. $this->rejectJob($this->jobs[$i], new MaxFileSizeExceededException('Maximum allowed download size reached. Content-length header indicates ' . $progress['download_content_length'] . ' bytes. Allowed ' . $this->jobs[$i]['options']['max_file_size'] . ' bytes'));
  37240. }
  37241. if ($this->jobs[$i]['options']['max_file_size'] < $progress['size_download']) {
  37242. $this->rejectJob($this->jobs[$i], new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . $progress['size_download'] . ' of allowed ' . $this->jobs[$i]['options']['max_file_size'] . ' bytes'));
  37243. }
  37244. }
  37245. if (isset($progress['primary_ip']) && $progress['primary_ip'] !== $this->jobs[$i]['primaryIp']) {
  37246. if (
  37247. isset($this->jobs[$i]['options']['prevent_ip_access_callable']) &&
  37248. is_callable($this->jobs[$i]['options']['prevent_ip_access_callable']) &&
  37249. $this->jobs[$i]['options']['prevent_ip_access_callable']($progress['primary_ip'])
  37250. ) {
  37251. $this->rejectJob($this->jobs[$i], new TransportException(sprintf('IP "%s" is blocked for "%s".', $progress['primary_ip'], $progress['url'])));
  37252. }
  37253. $this->jobs[$i]['primaryIp'] = (string) $progress['primary_ip'];
  37254. }
  37255. }
  37256. }
  37257. }
  37258. private function handleRedirect(array $job, Response $response): string
  37259. {
  37260. if ($locationHeader = $response->getHeader('location')) {
  37261. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  37262. $targetUrl = $locationHeader;
  37263. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  37264. $targetUrl = parse_url($job['url'], PHP_URL_SCHEME).':'.$locationHeader;
  37265. } elseif ('/' === $locationHeader[0]) {
  37266. $urlHost = parse_url($job['url'], PHP_URL_HOST);
  37267. $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $job['url']);
  37268. } else {
  37269. $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $job['url']);
  37270. }
  37271. }
  37272. if (!empty($targetUrl)) {
  37273. $this->io->writeError(sprintf('Following redirect (%u) %s', $job['attributes']['redirects'] + 1, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
  37274. return $targetUrl;
  37275. }
  37276. throw new TransportException('The "'.$job['url'].'" file could not be downloaded, got redirect without Location ('.$response->getStatusMessage().')');
  37277. }
  37278. private function isAuthenticatedRetryNeeded(array $job, Response $response): array
  37279. {
  37280. if (in_array($response->getStatusCode(), [401, 403]) && $job['attributes']['retryAuthFailure']) {
  37281. $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], $response->getStatusCode(), $response->getStatusMessage(), $response->getHeaders(), $job['attributes']['retries']);
  37282. if ($result['retry']) {
  37283. return $result;
  37284. }
  37285. }
  37286. $locationHeader = $response->getHeader('location');
  37287. $needsAuthRetry = false;
  37288. if (
  37289. $job['origin'] === 'bitbucket.org'
  37290. && !$this->authHelper->isPublicBitBucketDownload($job['url'])
  37291. && substr($job['url'], -4) === '.zip'
  37292. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  37293. && Preg::isMatch('{^text/html\b}i', $response->getHeader('content-type'))
  37294. ) {
  37295. $needsAuthRetry = 'Bitbucket requires authentication and it was not provided';
  37296. }
  37297. if (
  37298. $response->getStatusCode() === 404
  37299. && in_array($job['origin'], $this->config->get('gitlab-domains'), true)
  37300. && false !== strpos($job['url'], 'archive.zip')
  37301. ) {
  37302. $needsAuthRetry = 'GitLab requires authentication and it was not provided';
  37303. }
  37304. if ($needsAuthRetry) {
  37305. if ($job['attributes']['retryAuthFailure']) {
  37306. $result = $this->authHelper->promptAuthIfNeeded($job['url'], $job['origin'], 401, null, [], $job['attributes']['retries']);
  37307. if ($result['retry']) {
  37308. return $result;
  37309. }
  37310. }
  37311. throw $this->failResponse($job, $response, $needsAuthRetry);
  37312. }
  37313. return ['retry' => false, 'storeAuth' => false];
  37314. }
  37315. private function restartJob(array $job, string $url, array $attributes = []): void
  37316. {
  37317. if (null !== $job['filename']) {
  37318. @unlink($job['filename'].'~');
  37319. }
  37320. $attributes = array_merge($job['attributes'], $attributes);
  37321. $origin = Url::getOrigin($this->config, $url);
  37322. $this->initDownload($job['resolve'], $job['reject'], $origin, $url, $job['options'], $job['filename'], $attributes);
  37323. }
  37324. private function restartJobWithDelay(array $job, string $url, array $attributes): void
  37325. {
  37326. if ($attributes['retries'] >= 3) {
  37327. usleep(500000);
  37328. } elseif ($attributes['retries'] >= 2) {
  37329. usleep(100000);
  37330. }
  37331. $this->restartJob($job, $url, $attributes);
  37332. }
  37333. private function failResponse(array $job, Response $response, string $errorMessage): TransportException
  37334. {
  37335. if (null !== $job['filename']) {
  37336. @unlink($job['filename'].'~');
  37337. }
  37338. $details = '';
  37339. if (in_array(strtolower((string) $response->getHeader('content-type')), ['application/json', 'application/json; charset=utf-8'], true)) {
  37340. $details = ':'.PHP_EOL.substr($response->getBody(), 0, 200).(strlen($response->getBody()) > 200 ? '...' : '');
  37341. }
  37342. return new TransportException('The "'.$job['url'].'" file could not be downloaded ('.$errorMessage.')' . $details, $response->getStatusCode());
  37343. }
  37344. private function rejectJob(array $job, \Exception $e): void
  37345. {
  37346. if (is_resource($job['headerHandle'])) {
  37347. fclose($job['headerHandle']);
  37348. }
  37349. if (is_resource($job['bodyHandle'])) {
  37350. fclose($job['bodyHandle']);
  37351. }
  37352. if (null !== $job['filename']) {
  37353. @unlink($job['filename'].'~');
  37354. }
  37355. $job['reject']($e);
  37356. }
  37357. private function checkCurlResult(int $code): void
  37358. {
  37359. if ($code !== CURLM_OK && $code !== CURLM_CALL_MULTI_PERFORM) {
  37360. throw new \RuntimeException(
  37361. isset($this->multiErrors[$code])
  37362. ? "cURL error: {$code} ({$this->multiErrors[$code][0]}): cURL message: {$this->multiErrors[$code][1]}"
  37363. : 'Unexpected cURL error: ' . $code
  37364. );
  37365. }
  37366. }
  37367. }
  37368. <?php declare(strict_types=1);
  37369. namespace Composer\Util\Http;
  37370. class CurlResponse extends Response
  37371. {
  37372. private $curlInfo;
  37373. public function __construct(array $request, ?int $code, array $headers, ?string $body, array $curlInfo)
  37374. {
  37375. parent::__construct($request, $code, $headers, $body);
  37376. $this->curlInfo = $curlInfo;
  37377. }
  37378. public function getCurlInfo(): array
  37379. {
  37380. return $this->curlInfo;
  37381. }
  37382. }
  37383. <?php declare(strict_types=1);
  37384. namespace Composer\Util\Http;
  37385. class ProxyItem
  37386. {
  37387. private $url;
  37388. private $safeUrl;
  37389. private $curlAuth;
  37390. private $optionsProxy;
  37391. private $optionsAuth;
  37392. public function __construct(string $proxyUrl, string $envName)
  37393. {
  37394. $syntaxError = sprintf('unsupported `%s` syntax', $envName);
  37395. if (strpbrk($proxyUrl, "\r\n\t") !== false) {
  37396. throw new \RuntimeException($syntaxError);
  37397. }
  37398. if (false === ($proxy = parse_url($proxyUrl))) {
  37399. throw new \RuntimeException($syntaxError);
  37400. }
  37401. if (!isset($proxy['host'])) {
  37402. throw new \RuntimeException('unable to find proxy host in ' . $envName);
  37403. }
  37404. $scheme = isset($proxy['scheme']) ? strtolower($proxy['scheme']) . '://' : 'http://';
  37405. $safe = '';
  37406. if (isset($proxy['user'])) {
  37407. $safe = '***';
  37408. $user = $proxy['user'];
  37409. $auth = rawurldecode($proxy['user']);
  37410. if (isset($proxy['pass'])) {
  37411. $safe .= ':***';
  37412. $user .= ':' . $proxy['pass'];
  37413. $auth .= ':' . rawurldecode($proxy['pass']);
  37414. }
  37415. $safe .= '@';
  37416. if (strlen($user) > 0) {
  37417. $this->curlAuth = $user;
  37418. $this->optionsAuth = 'Proxy-Authorization: Basic ' . base64_encode($auth);
  37419. }
  37420. }
  37421. $host = $proxy['host'];
  37422. $port = null;
  37423. if (isset($proxy['port'])) {
  37424. $port = $proxy['port'];
  37425. } elseif ($scheme === 'http://') {
  37426. $port = 80;
  37427. } elseif ($scheme === 'https://') {
  37428. $port = 443;
  37429. }
  37430. if ($port === null) {
  37431. throw new \RuntimeException('unable to find proxy port in ' . $envName);
  37432. }
  37433. if ($port === 0) {
  37434. throw new \RuntimeException('port 0 is reserved in ' . $envName);
  37435. }
  37436. $this->url = sprintf('%s%s:%d', $scheme, $host, $port);
  37437. $this->safeUrl = sprintf('%s%s%s:%d', $scheme, $safe, $host, $port);
  37438. $scheme = str_replace(['http://', 'https://'], ['tcp://', 'ssl://'], $scheme);
  37439. $this->optionsProxy = sprintf('%s%s:%d', $scheme, $host, $port);
  37440. }
  37441. public function toRequestProxy(string $scheme): RequestProxy
  37442. {
  37443. $options = ['http' => ['proxy' => $this->optionsProxy]];
  37444. if ($this->optionsAuth !== null) {
  37445. $options['http']['header'] = $this->optionsAuth;
  37446. }
  37447. if ($scheme === 'http') {
  37448. $options['http']['request_fulluri'] = true;
  37449. }
  37450. return new RequestProxy($this->url, $this->curlAuth, $options, $this->safeUrl);
  37451. }
  37452. }
  37453. <?php declare(strict_types=1);
  37454. namespace Composer\Util\Http;
  37455. use Composer\Downloader\TransportException;
  37456. use Composer\Util\NoProxyPattern;
  37457. class ProxyManager
  37458. {
  37459. private $error = null;
  37460. private $httpProxy = null;
  37461. private $httpsProxy = null;
  37462. private $noProxyHandler = null;
  37463. private static $instance = null;
  37464. private function __construct()
  37465. {
  37466. try {
  37467. $this->getProxyData();
  37468. } catch (\RuntimeException $e) {
  37469. $this->error = $e->getMessage();
  37470. }
  37471. }
  37472. public static function getInstance(): ProxyManager
  37473. {
  37474. if (self::$instance === null) {
  37475. self::$instance = new self();
  37476. }
  37477. return self::$instance;
  37478. }
  37479. public static function reset(): void
  37480. {
  37481. self::$instance = null;
  37482. }
  37483. public function getProxyForRequest(string $requestUrl): RequestProxy
  37484. {
  37485. if ($this->error !== null) {
  37486. throw new TransportException('Unable to use a proxy: '.$this->error);
  37487. }
  37488. $scheme = (string) parse_url($requestUrl, PHP_URL_SCHEME);
  37489. $proxy = $this->getProxyForScheme($scheme);
  37490. if ($proxy === null) {
  37491. return RequestProxy::none();
  37492. }
  37493. if ($this->noProxy($requestUrl)) {
  37494. return RequestProxy::noProxy();
  37495. }
  37496. return $proxy->toRequestProxy($scheme);
  37497. }
  37498. private function getProxyForScheme(string $scheme): ?ProxyItem
  37499. {
  37500. if ($scheme === 'http') {
  37501. return $this->httpProxy;
  37502. }
  37503. if ($scheme === 'https') {
  37504. return $this->httpsProxy;
  37505. }
  37506. return null;
  37507. }
  37508. private function getProxyData(): void
  37509. {
  37510. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  37511. [$env, $name] = $this->getProxyEnv('http_proxy');
  37512. if ($env !== null) {
  37513. $this->httpProxy = new ProxyItem($env, $name);
  37514. }
  37515. }
  37516. if ($this->httpProxy === null) {
  37517. [$env, $name] = $this->getProxyEnv('cgi_http_proxy');
  37518. if ($env !== null) {
  37519. $this->httpProxy = new ProxyItem($env, $name);
  37520. }
  37521. }
  37522. [$env, $name] = $this->getProxyEnv('https_proxy');
  37523. if ($env !== null) {
  37524. $this->httpsProxy = new ProxyItem($env, $name);
  37525. }
  37526. [$env, $name] = $this->getProxyEnv('no_proxy');
  37527. if ($env !== null) {
  37528. $this->noProxyHandler = new NoProxyPattern($env);
  37529. }
  37530. }
  37531. private function getProxyEnv(string $envName): array
  37532. {
  37533. $names = [strtolower($envName), strtoupper($envName)];
  37534. foreach ($names as $name) {
  37535. if (is_string($_SERVER[$name] ?? null)) {
  37536. if ($_SERVER[$name] !== '') {
  37537. return [$_SERVER[$name], $name];
  37538. }
  37539. }
  37540. }
  37541. return [null, ''];
  37542. }
  37543. private function noProxy(string $requestUrl): bool
  37544. {
  37545. if ($this->noProxyHandler === null) {
  37546. return false;
  37547. }
  37548. return $this->noProxyHandler->test($requestUrl);
  37549. }
  37550. }
  37551. <?php declare(strict_types=1);
  37552. namespace Composer\Util\Http;
  37553. use Composer\Downloader\TransportException;
  37554. class RequestProxy
  37555. {
  37556. private $contextOptions;
  37557. private $status;
  37558. private $url;
  37559. private $auth;
  37560. public function __construct(?string $url, ?string $auth, ?array $contextOptions, ?string $status)
  37561. {
  37562. $this->url = $url;
  37563. $this->auth = $auth;
  37564. $this->contextOptions = $contextOptions;
  37565. $this->status = $status;
  37566. }
  37567. public static function none(): RequestProxy
  37568. {
  37569. return new self(null, null, null, null);
  37570. }
  37571. public static function noProxy(): RequestProxy
  37572. {
  37573. return new self(null, null, null, 'excluded by no_proxy');
  37574. }
  37575. public function getContextOptions(): ?array
  37576. {
  37577. return $this->contextOptions;
  37578. }
  37579. public function getCurlOptions(array $sslOptions): array
  37580. {
  37581. if ($this->isSecure() && !$this->supportsSecureProxy()) {
  37582. throw new TransportException('Cannot use an HTTPS proxy. PHP >= 7.3 and cUrl >= 7.52.0 are required.');
  37583. }
  37584. $options = [CURLOPT_PROXY => (string) $this->url];
  37585. if ($this->url !== null) {
  37586. $options[CURLOPT_NOPROXY] = '';
  37587. }
  37588. if ($this->auth !== null) {
  37589. $options[CURLOPT_PROXYAUTH] = CURLAUTH_BASIC;
  37590. $options[CURLOPT_PROXYUSERPWD] = $this->auth;
  37591. }
  37592. if ($this->isSecure()) {
  37593. if (isset($sslOptions['cafile'])) {
  37594. $options[CURLOPT_PROXY_CAINFO] = $sslOptions['cafile'];
  37595. }
  37596. if (isset($sslOptions['capath'])) {
  37597. $options[CURLOPT_PROXY_CAPATH] = $sslOptions['capath'];
  37598. }
  37599. }
  37600. return $options;
  37601. }
  37602. public function getStatus(?string $format = null): string
  37603. {
  37604. if ($this->status === null) {
  37605. return '';
  37606. }
  37607. $format = $format ?? '%s';
  37608. if (strpos($format, '%s') !== false) {
  37609. return sprintf($format, $this->status);
  37610. }
  37611. throw new \InvalidArgumentException('String format specifier is missing');
  37612. }
  37613. public function isExcludedByNoProxy(): bool
  37614. {
  37615. return $this->status !== null && $this->url === null;
  37616. }
  37617. public function isSecure(): bool
  37618. {
  37619. return 0 === strpos((string) $this->url, 'https://');
  37620. }
  37621. public function supportsSecureProxy(): bool
  37622. {
  37623. if (false === ($version = curl_version()) || !defined('CURL_VERSION_HTTPS_PROXY')) {
  37624. return false;
  37625. }
  37626. $features = $version['features'];
  37627. return (bool) ($features & CURL_VERSION_HTTPS_PROXY);
  37628. }
  37629. }
  37630. <?php declare(strict_types=1);
  37631. namespace Composer\Util\Http;
  37632. use Composer\Json\JsonFile;
  37633. use Composer\Pcre\Preg;
  37634. use Composer\Util\HttpDownloader;
  37635. class Response
  37636. {
  37637. private $request;
  37638. private $code;
  37639. private $headers;
  37640. private $body;
  37641. public function __construct(array $request, ?int $code, array $headers, ?string $body)
  37642. {
  37643. if (!isset($request['url'])) {
  37644. throw new \LogicException('url key missing from request array');
  37645. }
  37646. $this->request = $request;
  37647. $this->code = (int) $code;
  37648. $this->headers = $headers;
  37649. $this->body = $body;
  37650. }
  37651. public function getStatusCode(): int
  37652. {
  37653. return $this->code;
  37654. }
  37655. public function getStatusMessage(): ?string
  37656. {
  37657. $value = null;
  37658. foreach ($this->headers as $header) {
  37659. if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
  37660. $value = $header;
  37661. }
  37662. }
  37663. return $value;
  37664. }
  37665. public function getHeaders(): array
  37666. {
  37667. return $this->headers;
  37668. }
  37669. public function getHeader(string $name): ?string
  37670. {
  37671. return self::findHeaderValue($this->headers, $name);
  37672. }
  37673. public function getBody(): ?string
  37674. {
  37675. return $this->body;
  37676. }
  37677. public function decodeJson()
  37678. {
  37679. return JsonFile::parseJson($this->body, $this->request['url']);
  37680. }
  37681. public function collect(): void
  37682. {
  37683. unset($this->request, $this->code, $this->headers, $this->body);
  37684. }
  37685. public static function findHeaderValue(array $headers, string $name): ?string
  37686. {
  37687. $value = null;
  37688. foreach ($headers as $header) {
  37689. if (Preg::isMatch('{^'.preg_quote($name).':\s*(.+?)\s*$}i', $header, $match)) {
  37690. $value = $match[1];
  37691. }
  37692. }
  37693. return $value;
  37694. }
  37695. }
  37696. <?php declare(strict_types=1);
  37697. namespace Composer\Util;
  37698. use Composer\Config;
  37699. use Composer\IO\IOInterface;
  37700. use Composer\Downloader\TransportException;
  37701. use Composer\Pcre\Preg;
  37702. use Composer\Util\Http\Response;
  37703. use Composer\Util\Http\CurlDownloader;
  37704. use Composer\Composer;
  37705. use Composer\Package\Version\VersionParser;
  37706. use Composer\Semver\Constraint\Constraint;
  37707. use Composer\Exception\IrrecoverableDownloadException;
  37708. use React\Promise\Promise;
  37709. use React\Promise\PromiseInterface;
  37710. class HttpDownloader
  37711. {
  37712. private const STATUS_QUEUED = 1;
  37713. private const STATUS_STARTED = 2;
  37714. private const STATUS_COMPLETED = 3;
  37715. private const STATUS_FAILED = 4;
  37716. private const STATUS_ABORTED = 5;
  37717. private $io;
  37718. private $config;
  37719. private $jobs = [];
  37720. private $options = [];
  37721. private $runningJobs = 0;
  37722. private $maxJobs = 12;
  37723. private $curl;
  37724. private $rfs;
  37725. private $idGen = 0;
  37726. private $disabled;
  37727. private $allowAsync = false;
  37728. public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false)
  37729. {
  37730. $this->io = $io;
  37731. $this->disabled = (bool) Platform::getEnv('COMPOSER_DISABLE_NETWORK');
  37732. if ($disableTls === false) {
  37733. $this->options = StreamContextFactory::getTlsDefaults($options, $io);
  37734. }
  37735. $this->options = array_replace_recursive($this->options, $options);
  37736. $this->config = $config;
  37737. if (self::isCurlEnabled()) {
  37738. $this->curl = new CurlDownloader($io, $config, $options, $disableTls);
  37739. }
  37740. $this->rfs = new RemoteFilesystem($io, $config, $options, $disableTls);
  37741. if (is_numeric($maxJobs = Platform::getEnv('COMPOSER_MAX_PARALLEL_HTTP'))) {
  37742. $this->maxJobs = max(1, min(50, (int) $maxJobs));
  37743. }
  37744. }
  37745. public function get(string $url, array $options = [])
  37746. {
  37747. if ('' === $url) {
  37748. throw new \InvalidArgumentException('$url must not be an empty string');
  37749. }
  37750. [$job, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null], true);
  37751. $promise->then(null, function (\Throwable $e) {
  37752. });
  37753. $this->wait($job['id']);
  37754. $response = $this->getResponse($job['id']);
  37755. return $response;
  37756. }
  37757. public function add(string $url, array $options = [])
  37758. {
  37759. if ('' === $url) {
  37760. throw new \InvalidArgumentException('$url must not be an empty string');
  37761. }
  37762. [, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => null]);
  37763. return $promise;
  37764. }
  37765. public function copy(string $url, string $to, array $options = [])
  37766. {
  37767. if ('' === $url) {
  37768. throw new \InvalidArgumentException('$url must not be an empty string');
  37769. }
  37770. [$job] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => $to], true);
  37771. $this->wait($job['id']);
  37772. return $this->getResponse($job['id']);
  37773. }
  37774. public function addCopy(string $url, string $to, array $options = [])
  37775. {
  37776. if ('' === $url) {
  37777. throw new \InvalidArgumentException('$url must not be an empty string');
  37778. }
  37779. [, $promise] = $this->addJob(['url' => $url, 'options' => $options, 'copyTo' => $to]);
  37780. return $promise;
  37781. }
  37782. public function getOptions()
  37783. {
  37784. return $this->options;
  37785. }
  37786. public function setOptions(array $options)
  37787. {
  37788. $this->options = array_replace_recursive($this->options, $options);
  37789. }
  37790. private function addJob(array $request, bool $sync = false): array
  37791. {
  37792. $request['options'] = array_replace_recursive($this->options, $request['options']);
  37793. $job = [
  37794. 'id' => $this->idGen++,
  37795. 'status' => self::STATUS_QUEUED,
  37796. 'request' => $request,
  37797. 'sync' => $sync,
  37798. 'origin' => Url::getOrigin($this->config, $request['url']),
  37799. ];
  37800. if (!$sync && !$this->allowAsync) {
  37801. throw new \LogicException('You must use the HttpDownloader instance which is part of a Composer\Loop instance to be able to run async http requests');
  37802. }
  37803. if (Preg::isMatchStrictGroups('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $request['url'], $match)) {
  37804. $this->io->setAuthentication($job['origin'], rawurldecode($match[1]), rawurldecode($match[2]));
  37805. }
  37806. $rfs = $this->rfs;
  37807. if ($this->canUseCurl($job)) {
  37808. $resolver = static function ($resolve, $reject) use (&$job): void {
  37809. $job['status'] = HttpDownloader::STATUS_QUEUED;
  37810. $job['resolve'] = $resolve;
  37811. $job['reject'] = $reject;
  37812. };
  37813. } else {
  37814. $resolver = static function ($resolve, $reject) use (&$job, $rfs): void {
  37815. $url = $job['request']['url'];
  37816. $options = $job['request']['options'];
  37817. $job['status'] = HttpDownloader::STATUS_STARTED;
  37818. if ($job['request']['copyTo']) {
  37819. $rfs->copy($job['origin'], $url, $job['request']['copyTo'], false , $options);
  37820. $headers = $rfs->getLastHeaders();
  37821. $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $job['request']['copyTo'].'~');
  37822. $resolve($response);
  37823. } else {
  37824. $body = $rfs->getContents($job['origin'], $url, false , $options);
  37825. $headers = $rfs->getLastHeaders();
  37826. $response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $body);
  37827. $resolve($response);
  37828. }
  37829. };
  37830. }
  37831. $curl = $this->curl;
  37832. $canceler = static function () use (&$job, $curl): void {
  37833. if ($job['status'] === HttpDownloader::STATUS_QUEUED) {
  37834. $job['status'] = HttpDownloader::STATUS_ABORTED;
  37835. }
  37836. if ($job['status'] !== HttpDownloader::STATUS_STARTED) {
  37837. return;
  37838. }
  37839. $job['status'] = HttpDownloader::STATUS_ABORTED;
  37840. if (isset($job['curl_id'])) {
  37841. $curl->abortRequest($job['curl_id']);
  37842. }
  37843. throw new IrrecoverableDownloadException('Download of ' . Url::sanitize($job['request']['url']) . ' canceled');
  37844. };
  37845. $promise = new Promise($resolver, $canceler);
  37846. $promise = $promise->then(function ($response) use (&$job) {
  37847. $job['status'] = HttpDownloader::STATUS_COMPLETED;
  37848. $job['response'] = $response;
  37849. $this->markJobDone();
  37850. return $response;
  37851. }, function ($e) use (&$job): void {
  37852. $job['status'] = HttpDownloader::STATUS_FAILED;
  37853. $job['exception'] = $e;
  37854. $this->markJobDone();
  37855. throw $e;
  37856. });
  37857. $this->jobs[$job['id']] = &$job;
  37858. if ($this->runningJobs < $this->maxJobs) {
  37859. $this->startJob($job['id']);
  37860. }
  37861. return [$job, $promise];
  37862. }
  37863. private function startJob(int $id): void
  37864. {
  37865. $job = &$this->jobs[$id];
  37866. if ($job['status'] !== self::STATUS_QUEUED) {
  37867. return;
  37868. }
  37869. $job['status'] = self::STATUS_STARTED;
  37870. $this->runningJobs++;
  37871. assert(isset($job['resolve']));
  37872. assert(isset($job['reject']));
  37873. $resolve = $job['resolve'];
  37874. $reject = $job['reject'];
  37875. $url = $job['request']['url'];
  37876. $options = $job['request']['options'];
  37877. $origin = $job['origin'];
  37878. if ($this->disabled) {
  37879. if (isset($job['request']['options']['http']['header']) && false !== stripos(implode('', $job['request']['options']['http']['header']), 'if-modified-since')) {
  37880. $resolve(new Response(['url' => $url], 304, [], ''));
  37881. } else {
  37882. $e = new TransportException('Network disabled, request canceled: '.Url::sanitize($url), 499);
  37883. $e->setStatusCode(499);
  37884. $reject($e);
  37885. }
  37886. return;
  37887. }
  37888. try {
  37889. if ($job['request']['copyTo']) {
  37890. $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options, $job['request']['copyTo']);
  37891. } else {
  37892. $job['curl_id'] = $this->curl->download($resolve, $reject, $origin, $url, $options);
  37893. }
  37894. } catch (\Exception $exception) {
  37895. $reject($exception);
  37896. }
  37897. }
  37898. private function markJobDone(): void
  37899. {
  37900. $this->runningJobs--;
  37901. }
  37902. public function wait(?int $index = null)
  37903. {
  37904. do {
  37905. $jobCount = $this->countActiveJobs($index);
  37906. } while ($jobCount);
  37907. }
  37908. public function enableAsync(): void
  37909. {
  37910. $this->allowAsync = true;
  37911. }
  37912. public function countActiveJobs(?int $index = null): int
  37913. {
  37914. if ($this->runningJobs < $this->maxJobs) {
  37915. foreach ($this->jobs as $job) {
  37916. if ($job['status'] === self::STATUS_QUEUED && $this->runningJobs < $this->maxJobs) {
  37917. $this->startJob($job['id']);
  37918. }
  37919. }
  37920. }
  37921. if ($this->curl) {
  37922. $this->curl->tick();
  37923. }
  37924. if (null !== $index) {
  37925. return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
  37926. }
  37927. $active = 0;
  37928. foreach ($this->jobs as $job) {
  37929. if ($job['status'] < self::STATUS_COMPLETED) {
  37930. $active++;
  37931. } elseif (!$job['sync']) {
  37932. unset($this->jobs[$job['id']]);
  37933. }
  37934. }
  37935. return $active;
  37936. }
  37937. private function getResponse(int $index): Response
  37938. {
  37939. if (!isset($this->jobs[$index])) {
  37940. throw new \LogicException('Invalid request id');
  37941. }
  37942. if ($this->jobs[$index]['status'] === self::STATUS_FAILED) {
  37943. assert(isset($this->jobs[$index]['exception']));
  37944. throw $this->jobs[$index]['exception'];
  37945. }
  37946. if (!isset($this->jobs[$index]['response'])) {
  37947. throw new \LogicException('Response not available yet, call wait() first');
  37948. }
  37949. $resp = $this->jobs[$index]['response'];
  37950. unset($this->jobs[$index]);
  37951. return $resp;
  37952. }
  37953. public static function outputWarnings(IOInterface $io, string $url, $data): void
  37954. {
  37955. $cleanMessage = static function ($msg) use ($io) {
  37956. if (!$io->isDecorated()) {
  37957. $msg = Preg::replace('{'.chr(27).'\\[[;\d]*m}u', '', $msg);
  37958. }
  37959. return $msg;
  37960. };
  37961. foreach (['warning', 'info'] as $type) {
  37962. if (empty($data[$type])) {
  37963. continue;
  37964. }
  37965. if (!empty($data[$type . '-versions'])) {
  37966. $versionParser = new VersionParser();
  37967. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  37968. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  37969. if (!$constraint->matches($composer)) {
  37970. continue;
  37971. }
  37972. }
  37973. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($data[$type]).'</'.$type.'>');
  37974. }
  37975. foreach (['warnings', 'infos'] as $key) {
  37976. if (empty($data[$key])) {
  37977. continue;
  37978. }
  37979. $versionParser = new VersionParser();
  37980. foreach ($data[$key] as $spec) {
  37981. $type = substr($key, 0, -1);
  37982. $constraint = $versionParser->parseConstraints($spec['versions']);
  37983. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  37984. if (!$constraint->matches($composer)) {
  37985. continue;
  37986. }
  37987. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.Url::sanitize($url).': '.$cleanMessage($spec['message']).'</'.$type.'>');
  37988. }
  37989. }
  37990. }
  37991. public static function getExceptionHints(\Throwable $e): ?array
  37992. {
  37993. if (!$e instanceof TransportException) {
  37994. return null;
  37995. }
  37996. if (
  37997. false !== strpos($e->getMessage(), 'Resolving timed out')
  37998. || false !== strpos($e->getMessage(), 'Could not resolve host')
  37999. ) {
  38000. Silencer::suppress();
  38001. $testConnectivity = file_get_contents('https://8.8.8.8', false, stream_context_create([
  38002. 'ssl' => ['verify_peer' => false],
  38003. 'http' => ['follow_location' => false, 'ignore_errors' => true],
  38004. ]));
  38005. Silencer::restore();
  38006. if (false !== $testConnectivity) {
  38007. return [
  38008. '<error>The following exception probably indicates you have misconfigured DNS resolver(s)</error>',
  38009. ];
  38010. }
  38011. return [
  38012. '<error>The following exception probably indicates you are offline or have misconfigured DNS resolver(s)</error>',
  38013. ];
  38014. }
  38015. return null;
  38016. }
  38017. private function canUseCurl(array $job): bool
  38018. {
  38019. if (!$this->curl) {
  38020. return false;
  38021. }
  38022. if (!Preg::isMatch('{^https?://}i', $job['request']['url'])) {
  38023. return false;
  38024. }
  38025. if (!empty($job['request']['options']['ssl']['allow_self_signed'])) {
  38026. return false;
  38027. }
  38028. return true;
  38029. }
  38030. public static function isCurlEnabled(): bool
  38031. {
  38032. return \extension_loaded('curl') && \function_exists('curl_multi_exec') && \function_exists('curl_multi_init');
  38033. }
  38034. }
  38035. <?php declare(strict_types=1);
  38036. namespace Composer\Util;
  38037. use Composer\XdebugHandler\XdebugHandler;
  38038. class IniHelper
  38039. {
  38040. public static function getAll(): array
  38041. {
  38042. return XdebugHandler::getAllIniFiles();
  38043. }
  38044. public static function getMessage(): string
  38045. {
  38046. $paths = self::getAll();
  38047. if (empty($paths[0])) {
  38048. array_shift($paths);
  38049. }
  38050. $ini = array_shift($paths);
  38051. if (empty($ini)) {
  38052. return 'A php.ini file does not exist. You will have to create one.';
  38053. }
  38054. if (!empty($paths)) {
  38055. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  38056. }
  38057. return 'The php.ini used by your command-line PHP is: '.$ini;
  38058. }
  38059. }
  38060. <?php declare(strict_types=1);
  38061. namespace Composer\Util;
  38062. use React\Promise\CancellablePromiseInterface;
  38063. use Symfony\Component\Console\Helper\ProgressBar;
  38064. use React\Promise\PromiseInterface;
  38065. class Loop
  38066. {
  38067. private $httpDownloader;
  38068. private $processExecutor;
  38069. private $currentPromises = [];
  38070. private $waitIndex = 0;
  38071. public function __construct(HttpDownloader $httpDownloader, ?ProcessExecutor $processExecutor = null)
  38072. {
  38073. $this->httpDownloader = $httpDownloader;
  38074. $this->httpDownloader->enableAsync();
  38075. $this->processExecutor = $processExecutor;
  38076. if ($this->processExecutor) {
  38077. $this->processExecutor->enableAsync();
  38078. }
  38079. }
  38080. public function getHttpDownloader(): HttpDownloader
  38081. {
  38082. return $this->httpDownloader;
  38083. }
  38084. public function getProcessExecutor(): ?ProcessExecutor
  38085. {
  38086. return $this->processExecutor;
  38087. }
  38088. public function wait(array $promises, ?ProgressBar $progress = null): void
  38089. {
  38090. $uncaught = null;
  38091. \React\Promise\all($promises)->then(
  38092. static function (): void {
  38093. },
  38094. static function (\Throwable $e) use (&$uncaught): void {
  38095. $uncaught = $e;
  38096. }
  38097. );
  38098. $waitIndex = $this->waitIndex++;
  38099. $this->currentPromises[$waitIndex] = $promises;
  38100. if ($progress) {
  38101. $totalJobs = 0;
  38102. $totalJobs += $this->httpDownloader->countActiveJobs();
  38103. if ($this->processExecutor) {
  38104. $totalJobs += $this->processExecutor->countActiveJobs();
  38105. }
  38106. $progress->start($totalJobs);
  38107. }
  38108. $lastUpdate = 0;
  38109. while (true) {
  38110. $activeJobs = 0;
  38111. $activeJobs += $this->httpDownloader->countActiveJobs();
  38112. if ($this->processExecutor) {
  38113. $activeJobs += $this->processExecutor->countActiveJobs();
  38114. }
  38115. if ($progress && microtime(true) - $lastUpdate > 0.1) {
  38116. $lastUpdate = microtime(true);
  38117. $progress->setProgress($progress->getMaxSteps() - $activeJobs);
  38118. }
  38119. if (!$activeJobs) {
  38120. break;
  38121. }
  38122. }
  38123. if ($progress) {
  38124. $progress->finish();
  38125. }
  38126. unset($this->currentPromises[$waitIndex]);
  38127. if (null !== $uncaught) {
  38128. throw $uncaught;
  38129. }
  38130. }
  38131. public function abortJobs(): void
  38132. {
  38133. foreach ($this->currentPromises as $promiseGroup) {
  38134. foreach ($promiseGroup as $promise) {
  38135. \React\Promise\resolve($promise)->cancel();
  38136. }
  38137. }
  38138. }
  38139. }
  38140. <?php declare(strict_types=1);
  38141. namespace Composer\Util;
  38142. @trigger_error('Composer\Util\MetadataMinifier is deprecated, use Composer\MetadataMinifier\MetadataMinifier from composer/metadata-minifier instead.', E_USER_DEPRECATED);
  38143. class MetadataMinifier extends \Composer\MetadataMinifier\MetadataMinifier
  38144. {
  38145. }
  38146. <?php declare(strict_types=1);
  38147. namespace Composer\Util;
  38148. use Composer\Pcre\Preg;
  38149. use stdClass;
  38150. class NoProxyPattern
  38151. {
  38152. protected $hostNames = [];
  38153. protected $rules = [];
  38154. protected $noproxy;
  38155. public function __construct(string $pattern)
  38156. {
  38157. $this->hostNames = Preg::split('{[\s,]+}', $pattern, -1, PREG_SPLIT_NO_EMPTY);
  38158. $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
  38159. }
  38160. public function test(string $url): bool
  38161. {
  38162. if ($this->noproxy) {
  38163. return true;
  38164. }
  38165. if (!$urlData = $this->getUrlData($url)) {
  38166. return false;
  38167. }
  38168. foreach ($this->hostNames as $index => $hostName) {
  38169. if ($this->match($index, $hostName, $urlData)) {
  38170. return true;
  38171. }
  38172. }
  38173. return false;
  38174. }
  38175. protected function getUrlData(string $url)
  38176. {
  38177. if (!$host = parse_url($url, PHP_URL_HOST)) {
  38178. return false;
  38179. }
  38180. $port = parse_url($url, PHP_URL_PORT);
  38181. if (empty($port)) {
  38182. switch (parse_url($url, PHP_URL_SCHEME)) {
  38183. case 'http':
  38184. $port = 80;
  38185. break;
  38186. case 'https':
  38187. $port = 443;
  38188. break;
  38189. }
  38190. }
  38191. $hostName = $host . ($port ? ':' . $port : '');
  38192. [$host, $port, $err] = $this->splitHostPort($hostName);
  38193. if ($err || !$this->ipCheckData($host, $ipdata)) {
  38194. return false;
  38195. }
  38196. return $this->makeData($host, $port, $ipdata);
  38197. }
  38198. protected function match(int $index, string $hostName, stdClass $url): bool
  38199. {
  38200. if (!$rule = $this->getRule($index, $hostName)) {
  38201. return false;
  38202. }
  38203. if ($rule->ipdata) {
  38204. if (!$url->ipdata) {
  38205. return false;
  38206. }
  38207. if ($rule->ipdata->netmask) {
  38208. return $this->matchRange($rule->ipdata, $url->ipdata);
  38209. }
  38210. $match = $rule->ipdata->ip === $url->ipdata->ip;
  38211. } else {
  38212. $haystack = substr($url->name, -strlen($rule->name));
  38213. $match = stripos($haystack, $rule->name) === 0;
  38214. }
  38215. if ($match && $rule->port) {
  38216. $match = $rule->port === $url->port;
  38217. }
  38218. return $match;
  38219. }
  38220. protected function matchRange(stdClass $network, stdClass $target): bool
  38221. {
  38222. $net = unpack('C*', $network->ip);
  38223. $mask = unpack('C*', $network->netmask);
  38224. $ip = unpack('C*', $target->ip);
  38225. if (false === $net) {
  38226. throw new \RuntimeException('Could not parse network IP '.$network->ip);
  38227. }
  38228. if (false === $mask) {
  38229. throw new \RuntimeException('Could not parse netmask '.$network->netmask);
  38230. }
  38231. if (false === $ip) {
  38232. throw new \RuntimeException('Could not parse target IP '.$target->ip);
  38233. }
  38234. for ($i = 1; $i < 17; ++$i) {
  38235. if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
  38236. return false;
  38237. }
  38238. }
  38239. return true;
  38240. }
  38241. private function getRule(int $index, string $hostName): ?stdClass
  38242. {
  38243. if (array_key_exists($index, $this->rules)) {
  38244. return $this->rules[$index];
  38245. }
  38246. $this->rules[$index] = null;
  38247. [$host, $port, $err] = $this->splitHostPort($hostName);
  38248. if ($err || !$this->ipCheckData($host, $ipdata, true)) {
  38249. return null;
  38250. }
  38251. $this->rules[$index] = $this->makeData($host, $port, $ipdata);
  38252. return $this->rules[$index];
  38253. }
  38254. private function ipCheckData(string $host, ?stdClass &$ipdata, bool $allowPrefix = false): bool
  38255. {
  38256. $ipdata = null;
  38257. $netmask = null;
  38258. $prefix = null;
  38259. $modified = false;
  38260. if (strpos($host, '/') !== false) {
  38261. [$host, $prefix] = explode('/', $host);
  38262. if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
  38263. return false;
  38264. }
  38265. $prefix = (int) $prefix;
  38266. $modified = true;
  38267. }
  38268. if (!filter_var($host, FILTER_VALIDATE_IP)) {
  38269. return !$modified;
  38270. }
  38271. [$ip, $size] = $this->ipGetAddr($host);
  38272. if ($prefix !== null) {
  38273. if ($prefix > $size * 8) {
  38274. return false;
  38275. }
  38276. [$ip, $netmask] = $this->ipGetNetwork($ip, $size, $prefix);
  38277. }
  38278. $ipdata = $this->makeIpData($ip, $size, $netmask);
  38279. return true;
  38280. }
  38281. private function ipGetAddr(string $host): array
  38282. {
  38283. $ip = inet_pton($host);
  38284. $size = strlen($ip);
  38285. $mapped = $this->ipMapTo6($ip, $size);
  38286. return [$mapped, $size];
  38287. }
  38288. private function ipGetMask(int $prefix, int $size): string
  38289. {
  38290. $mask = '';
  38291. if ($ones = floor($prefix / 8)) {
  38292. $mask = str_repeat(chr(255), (int) $ones);
  38293. }
  38294. if ($remainder = $prefix % 8) {
  38295. $mask .= chr(0xff ^ (0xff >> $remainder));
  38296. }
  38297. $mask = str_pad($mask, $size, chr(0));
  38298. return $this->ipMapTo6($mask, $size);
  38299. }
  38300. private function ipGetNetwork(string $rangeIp, int $size, int $prefix): array
  38301. {
  38302. $netmask = $this->ipGetMask($prefix, $size);
  38303. $mask = unpack('C*', $netmask);
  38304. $ip = unpack('C*', $rangeIp);
  38305. $net = '';
  38306. if (false === $mask) {
  38307. throw new \RuntimeException('Could not parse netmask '.$netmask);
  38308. }
  38309. if (false === $ip) {
  38310. throw new \RuntimeException('Could not parse range IP '.$rangeIp);
  38311. }
  38312. for ($i = 1; $i < 17; ++$i) {
  38313. $net .= chr($ip[$i] & $mask[$i]);
  38314. }
  38315. return [$net, $netmask];
  38316. }
  38317. private function ipMapTo6(string $binary, int $size): string
  38318. {
  38319. if ($size === 4) {
  38320. $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
  38321. $binary = $prefix . $binary;
  38322. }
  38323. return $binary;
  38324. }
  38325. private function makeData(string $host, int $port, ?stdClass $ipdata): stdClass
  38326. {
  38327. return (object) [
  38328. 'host' => $host,
  38329. 'name' => '.' . ltrim($host, '.'),
  38330. 'port' => $port,
  38331. 'ipdata' => $ipdata,
  38332. ];
  38333. }
  38334. private function makeIpData(string $ip, int $size, ?string $netmask): stdClass
  38335. {
  38336. return (object) [
  38337. 'ip' => $ip,
  38338. 'size' => $size,
  38339. 'netmask' => $netmask,
  38340. ];
  38341. }
  38342. private function splitHostPort(string $hostName): array
  38343. {
  38344. $error = ['', '', true];
  38345. $port = 0;
  38346. $ip6 = '';
  38347. if ($hostName[0] === '[') {
  38348. $index = strpos($hostName, ']');
  38349. if (false === $index || $index < 3) {
  38350. return $error;
  38351. }
  38352. $ip6 = substr($hostName, 1, $index - 1);
  38353. $hostName = substr($hostName, $index + 1);
  38354. if (strpbrk($hostName, '[]') !== false || substr_count($hostName, ':') > 1) {
  38355. return $error;
  38356. }
  38357. }
  38358. if (substr_count($hostName, ':') === 1) {
  38359. $index = strpos($hostName, ':');
  38360. $port = substr($hostName, $index + 1);
  38361. $hostName = substr($hostName, 0, $index);
  38362. if (!$this->validateInt($port, 1, 65535)) {
  38363. return $error;
  38364. }
  38365. $port = (int) $port;
  38366. }
  38367. $host = $ip6 . $hostName;
  38368. return [$host, $port, false];
  38369. }
  38370. private function validateInt(string $int, int $min, int $max): bool
  38371. {
  38372. $options = [
  38373. 'options' => [
  38374. 'min_range' => $min,
  38375. 'max_range' => $max,
  38376. ],
  38377. ];
  38378. return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
  38379. }
  38380. }
  38381. <?php declare(strict_types=1);
  38382. namespace Composer\Util;
  38383. use Composer\Package\CompletePackageInterface;
  38384. use Composer\Package\PackageInterface;
  38385. class PackageInfo
  38386. {
  38387. public static function getViewSourceUrl(PackageInterface $package): ?string
  38388. {
  38389. if ($package instanceof CompletePackageInterface && isset($package->getSupport()['source']) && '' !== $package->getSupport()['source']) {
  38390. return $package->getSupport()['source'];
  38391. }
  38392. return $package->getSourceUrl();
  38393. }
  38394. public static function getViewSourceOrHomepageUrl(PackageInterface $package): ?string
  38395. {
  38396. $url = self::getViewSourceUrl($package) ?? ($package instanceof CompletePackageInterface ? $package->getHomepage() : null);
  38397. if ($url === '') {
  38398. return null;
  38399. }
  38400. return $url;
  38401. }
  38402. }
  38403. <?php declare(strict_types=1);
  38404. namespace Composer\Util;
  38405. use Composer\Package\PackageInterface;
  38406. use Composer\Package\RootPackageInterface;
  38407. class PackageSorter
  38408. {
  38409. public static function getMostCurrentVersion(array $packages): ?PackageInterface
  38410. {
  38411. if (count($packages) === 0) {
  38412. return null;
  38413. }
  38414. $highest = reset($packages);
  38415. foreach ($packages as $candidate) {
  38416. if ($candidate->isDefaultBranch()) {
  38417. return $candidate;
  38418. }
  38419. if (version_compare($highest->getVersion(), $candidate->getVersion(), '<')) {
  38420. $highest = $candidate;
  38421. }
  38422. }
  38423. return $highest;
  38424. }
  38425. public static function sortPackagesAlphabetically(array $packages): array
  38426. {
  38427. usort($packages, static function (PackageInterface $a, PackageInterface $b) {
  38428. return $a->getName() <=> $b->getName();
  38429. });
  38430. return $packages;
  38431. }
  38432. public static function sortPackages(array $packages, array $weights = []): array
  38433. {
  38434. $usageList = [];
  38435. foreach ($packages as $package) {
  38436. $links = $package->getRequires();
  38437. if ($package instanceof RootPackageInterface) {
  38438. $links = array_merge($links, $package->getDevRequires());
  38439. }
  38440. foreach ($links as $link) {
  38441. $target = $link->getTarget();
  38442. $usageList[$target][] = $package->getName();
  38443. }
  38444. }
  38445. $computing = [];
  38446. $computed = [];
  38447. $computeImportance = static function ($name) use (&$computeImportance, &$computing, &$computed, $usageList, $weights) {
  38448. if (isset($computed[$name])) {
  38449. return $computed[$name];
  38450. }
  38451. if (isset($computing[$name])) {
  38452. return 0;
  38453. }
  38454. $computing[$name] = true;
  38455. $weight = $weights[$name] ?? 0;
  38456. if (isset($usageList[$name])) {
  38457. foreach ($usageList[$name] as $user) {
  38458. $weight -= 1 - $computeImportance($user);
  38459. }
  38460. }
  38461. unset($computing[$name]);
  38462. $computed[$name] = $weight;
  38463. return $weight;
  38464. };
  38465. $weightedPackages = [];
  38466. foreach ($packages as $index => $package) {
  38467. $name = $package->getName();
  38468. $weight = $computeImportance($name);
  38469. $weightedPackages[] = ['name' => $name, 'weight' => $weight, 'index' => $index];
  38470. }
  38471. usort($weightedPackages, static function (array $a, array $b): int {
  38472. if ($a['weight'] !== $b['weight']) {
  38473. return $a['weight'] - $b['weight'];
  38474. }
  38475. return strnatcasecmp($a['name'], $b['name']);
  38476. });
  38477. $sortedPackages = [];
  38478. foreach ($weightedPackages as $pkg) {
  38479. $sortedPackages[] = $packages[$pkg['index']];
  38480. }
  38481. return $sortedPackages;
  38482. }
  38483. }
  38484. <?php declare(strict_types=1);
  38485. namespace Composer\Util;
  38486. use Composer\IO\IOInterface;
  38487. use Composer\Pcre\Preg;
  38488. use Symfony\Component\Process\ExecutableFinder;
  38489. use Symfony\Component\Process\Process;
  38490. class Perforce
  38491. {
  38492. protected $path;
  38493. protected $p4Depot;
  38494. protected $p4Client;
  38495. protected $p4User;
  38496. protected $p4Password;
  38497. protected $p4Port;
  38498. protected $p4Stream;
  38499. protected $p4ClientSpec;
  38500. protected $p4DepotType;
  38501. protected $p4Branch;
  38502. protected $process;
  38503. protected $uniquePerforceClientName;
  38504. protected $windowsFlag;
  38505. protected $commandResult;
  38506. protected $io;
  38507. protected $filesystem;
  38508. public function __construct($repoConfig, string $port, string $path, ProcessExecutor $process, bool $isWindows, IOInterface $io)
  38509. {
  38510. $this->windowsFlag = $isWindows;
  38511. $this->p4Port = $port;
  38512. $this->initializePath($path);
  38513. $this->process = $process;
  38514. $this->initialize($repoConfig);
  38515. $this->io = $io;
  38516. }
  38517. public static function create($repoConfig, string $port, string $path, ProcessExecutor $process, IOInterface $io): self
  38518. {
  38519. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  38520. }
  38521. public static function checkServerExists(string $url, ProcessExecutor $processExecutor): bool
  38522. {
  38523. return 0 === $processExecutor->execute(['p4', '-p', $url, 'info', '-s'], $ignoredOutput);
  38524. }
  38525. public function initialize($repoConfig): void
  38526. {
  38527. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  38528. if (!$repoConfig) {
  38529. return;
  38530. }
  38531. if (isset($repoConfig['unique_perforce_client_name'])) {
  38532. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  38533. }
  38534. if (isset($repoConfig['depot'])) {
  38535. $this->p4Depot = $repoConfig['depot'];
  38536. }
  38537. if (isset($repoConfig['branch'])) {
  38538. $this->p4Branch = $repoConfig['branch'];
  38539. }
  38540. if (isset($repoConfig['p4user'])) {
  38541. $this->p4User = $repoConfig['p4user'];
  38542. } else {
  38543. $this->p4User = $this->getP4variable('P4USER');
  38544. }
  38545. if (isset($repoConfig['p4password'])) {
  38546. $this->p4Password = $repoConfig['p4password'];
  38547. }
  38548. }
  38549. public function initializeDepotAndBranch(?string $depot, ?string $branch): void
  38550. {
  38551. if (isset($depot)) {
  38552. $this->p4Depot = $depot;
  38553. }
  38554. if (isset($branch)) {
  38555. $this->p4Branch = $branch;
  38556. }
  38557. }
  38558. public function generateUniquePerforceClientName(): string
  38559. {
  38560. return gethostname() . "_" . time();
  38561. }
  38562. public function cleanupClientSpec(): void
  38563. {
  38564. $client = $this->getClient();
  38565. $task = 'client -d ' . ProcessExecutor::escape($client);
  38566. $useP4Client = false;
  38567. $command = $this->generateP4Command($task, $useP4Client);
  38568. $this->executeCommand($command);
  38569. $clientSpec = $this->getP4ClientSpec();
  38570. $fileSystem = $this->getFilesystem();
  38571. $fileSystem->remove($clientSpec);
  38572. }
  38573. protected function executeCommand($command): int
  38574. {
  38575. $this->commandResult = '';
  38576. return $this->process->execute($command, $this->commandResult);
  38577. }
  38578. public function getClient(): string
  38579. {
  38580. if (!isset($this->p4Client)) {
  38581. $cleanStreamName = str_replace(['//', '/', '@'], ['', '_', ''], $this->getStream());
  38582. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  38583. }
  38584. return $this->p4Client;
  38585. }
  38586. protected function getPath(): string
  38587. {
  38588. return $this->path;
  38589. }
  38590. public function initializePath(string $path): void
  38591. {
  38592. $this->path = $path;
  38593. $fs = $this->getFilesystem();
  38594. $fs->ensureDirectoryExists($path);
  38595. }
  38596. protected function getPort(): string
  38597. {
  38598. return $this->p4Port;
  38599. }
  38600. public function setStream(string $stream): void
  38601. {
  38602. $this->p4Stream = $stream;
  38603. $index = strrpos($stream, '/');
  38604. if ($index > 2) {
  38605. $this->p4DepotType = 'stream';
  38606. }
  38607. }
  38608. public function isStream(): bool
  38609. {
  38610. return is_string($this->p4DepotType) && (strcmp($this->p4DepotType, 'stream') === 0);
  38611. }
  38612. public function getStream(): string
  38613. {
  38614. if (!isset($this->p4Stream)) {
  38615. if ($this->isStream()) {
  38616. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  38617. } else {
  38618. $this->p4Stream = '//' . $this->p4Depot;
  38619. }
  38620. }
  38621. return $this->p4Stream;
  38622. }
  38623. public function getStreamWithoutLabel(string $stream): string
  38624. {
  38625. $index = strpos($stream, '@');
  38626. if ($index === false) {
  38627. return $stream;
  38628. }
  38629. return substr($stream, 0, $index);
  38630. }
  38631. public function getP4ClientSpec(): string
  38632. {
  38633. return $this->path . '/' . $this->getClient() . '.p4.spec';
  38634. }
  38635. public function getUser(): ?string
  38636. {
  38637. return $this->p4User;
  38638. }
  38639. public function setUser(?string $user): void
  38640. {
  38641. $this->p4User = $user;
  38642. }
  38643. public function queryP4User(): void
  38644. {
  38645. $this->getUser();
  38646. if (strlen((string) $this->p4User) > 0) {
  38647. return;
  38648. }
  38649. $this->p4User = $this->getP4variable('P4USER');
  38650. if (strlen((string) $this->p4User) > 0) {
  38651. return;
  38652. }
  38653. $this->p4User = $this->io->ask('Enter P4 User:');
  38654. if ($this->windowsFlag) {
  38655. $command = $this->getP4Executable().' set P4USER=' . $this->p4User;
  38656. } else {
  38657. $command = 'export P4USER=' . $this->p4User;
  38658. }
  38659. $this->executeCommand($command);
  38660. }
  38661. protected function getP4variable(string $name): ?string
  38662. {
  38663. if ($this->windowsFlag) {
  38664. $command = $this->getP4Executable().' set';
  38665. $this->executeCommand($command);
  38666. $result = trim($this->commandResult);
  38667. $resArray = explode(PHP_EOL, $result);
  38668. foreach ($resArray as $line) {
  38669. $fields = explode('=', $line);
  38670. if (strcmp($name, $fields[0]) === 0) {
  38671. $index = strpos($fields[1], ' ');
  38672. if ($index === false) {
  38673. $value = $fields[1];
  38674. } else {
  38675. $value = substr($fields[1], 0, $index);
  38676. }
  38677. $value = trim($value);
  38678. return $value;
  38679. }
  38680. }
  38681. return null;
  38682. }
  38683. $command = 'echo $' . $name;
  38684. $this->executeCommand($command);
  38685. $result = trim($this->commandResult);
  38686. return $result;
  38687. }
  38688. public function queryP4Password(): ?string
  38689. {
  38690. if (isset($this->p4Password)) {
  38691. return $this->p4Password;
  38692. }
  38693. $password = $this->getP4variable('P4PASSWD');
  38694. if (strlen((string) $password) <= 0) {
  38695. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  38696. }
  38697. $this->p4Password = $password;
  38698. return $password;
  38699. }
  38700. public function generateP4Command(string $command, bool $useClient = true): string
  38701. {
  38702. $p4Command = $this->getP4Executable().' ';
  38703. $p4Command .= '-u ' . $this->getUser() . ' ';
  38704. if ($useClient) {
  38705. $p4Command .= '-c ' . $this->getClient() . ' ';
  38706. }
  38707. $p4Command .= '-p ' . $this->getPort() . ' ' . $command;
  38708. return $p4Command;
  38709. }
  38710. public function isLoggedIn(): bool
  38711. {
  38712. $command = $this->generateP4Command('login -s', false);
  38713. $exitCode = $this->executeCommand($command);
  38714. if ($exitCode) {
  38715. $errorOutput = $this->process->getErrorOutput();
  38716. $index = strpos($errorOutput, $this->getUser());
  38717. if ($index === false) {
  38718. $index = strpos($errorOutput, 'p4');
  38719. if ($index === false) {
  38720. return false;
  38721. }
  38722. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  38723. }
  38724. throw new \Exception('Invalid user name: ' . $this->getUser());
  38725. }
  38726. return true;
  38727. }
  38728. public function connectClient(): void
  38729. {
  38730. $p4CreateClientCommand = $this->generateP4Command(
  38731. 'client -i < ' . ProcessExecutor::escape($this->getP4ClientSpec())
  38732. );
  38733. $this->executeCommand($p4CreateClientCommand);
  38734. }
  38735. public function syncCodeBase(?string $sourceReference): void
  38736. {
  38737. $prevDir = Platform::getCwd();
  38738. chdir($this->path);
  38739. $p4SyncCommand = $this->generateP4Command('sync -f ');
  38740. if (null !== $sourceReference) {
  38741. $p4SyncCommand .= '@' . $sourceReference;
  38742. }
  38743. $this->executeCommand($p4SyncCommand);
  38744. chdir($prevDir);
  38745. }
  38746. public function writeClientSpecToFile($spec): void
  38747. {
  38748. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  38749. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  38750. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  38751. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  38752. fwrite($spec, 'Description:' . PHP_EOL);
  38753. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  38754. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  38755. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  38756. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  38757. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  38758. if ($this->isStream()) {
  38759. fwrite($spec, 'Stream:' . PHP_EOL);
  38760. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  38761. } else {
  38762. fwrite(
  38763. $spec,
  38764. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  38765. );
  38766. }
  38767. }
  38768. public function writeP4ClientSpec(): void
  38769. {
  38770. $clientSpec = $this->getP4ClientSpec();
  38771. $spec = fopen($clientSpec, 'w');
  38772. try {
  38773. $this->writeClientSpecToFile($spec);
  38774. } catch (\Exception $e) {
  38775. fclose($spec);
  38776. throw $e;
  38777. }
  38778. fclose($spec);
  38779. }
  38780. protected function read($pipe, $name): void
  38781. {
  38782. if (feof($pipe)) {
  38783. return;
  38784. }
  38785. $line = fgets($pipe);
  38786. while ($line !== false) {
  38787. $line = fgets($pipe);
  38788. }
  38789. }
  38790. public function windowsLogin(?string $password): int
  38791. {
  38792. $command = $this->generateP4Command(' login -a');
  38793. $process = Process::fromShellCommandline($command, null, null, $password);
  38794. return $process->run();
  38795. }
  38796. public function p4Login(): void
  38797. {
  38798. $this->queryP4User();
  38799. if (!$this->isLoggedIn()) {
  38800. $password = $this->queryP4Password();
  38801. if ($this->windowsFlag) {
  38802. $this->windowsLogin($password);
  38803. } else {
  38804. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  38805. $exitCode = $this->executeCommand($command);
  38806. if ($exitCode) {
  38807. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  38808. }
  38809. }
  38810. }
  38811. }
  38812. public function getComposerInformation(string $identifier): ?array
  38813. {
  38814. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  38815. if (!$composerFileContent) {
  38816. return null;
  38817. }
  38818. return json_decode($composerFileContent, true);
  38819. }
  38820. public function getFileContent(string $file, string $identifier): ?string
  38821. {
  38822. $path = $this->getFilePath($file, $identifier);
  38823. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  38824. $this->executeCommand($command);
  38825. $result = $this->commandResult;
  38826. if (!trim($result)) {
  38827. return null;
  38828. }
  38829. return $result;
  38830. }
  38831. public function getFilePath(string $file, string $identifier): ?string
  38832. {
  38833. $index = strpos($identifier, '@');
  38834. if ($index === false) {
  38835. return $identifier. '/' . $file;
  38836. }
  38837. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  38838. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  38839. $this->executeCommand($command);
  38840. $result = $this->commandResult;
  38841. $index2 = strpos($result, 'no such file(s).');
  38842. if ($index2 === false) {
  38843. $index3 = strpos($result, 'change');
  38844. if ($index3 !== false) {
  38845. $phrase = trim(substr($result, $index3));
  38846. $fields = explode(' ', $phrase);
  38847. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  38848. }
  38849. }
  38850. return null;
  38851. }
  38852. public function getBranches(): array
  38853. {
  38854. $possibleBranches = [];
  38855. if (!$this->isStream()) {
  38856. $possibleBranches[$this->p4Branch] = $this->getStream();
  38857. } else {
  38858. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  38859. $this->executeCommand($command);
  38860. $result = $this->commandResult;
  38861. $resArray = explode(PHP_EOL, $result);
  38862. foreach ($resArray as $line) {
  38863. $resBits = explode(' ', $line);
  38864. if (count($resBits) > 4) {
  38865. $branch = Preg::replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  38866. $possibleBranches[$branch] = $resBits[1];
  38867. }
  38868. }
  38869. }
  38870. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  38871. $this->executeCommand($command);
  38872. $result = $this->commandResult;
  38873. $resArray = explode(PHP_EOL, $result);
  38874. $lastCommit = $resArray[0];
  38875. $lastCommitArr = explode(' ', $lastCommit);
  38876. $lastCommitNum = $lastCommitArr[1];
  38877. return ['master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum];
  38878. }
  38879. public function getTags(): array
  38880. {
  38881. $command = $this->generateP4Command('labels');
  38882. $this->executeCommand($command);
  38883. $result = $this->commandResult;
  38884. $resArray = explode(PHP_EOL, $result);
  38885. $tags = [];
  38886. foreach ($resArray as $line) {
  38887. if (strpos($line, 'Label') !== false) {
  38888. $fields = explode(' ', $line);
  38889. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  38890. }
  38891. }
  38892. return $tags;
  38893. }
  38894. public function checkStream(): bool
  38895. {
  38896. $command = $this->generateP4Command('depots', false);
  38897. $this->executeCommand($command);
  38898. $result = $this->commandResult;
  38899. $resArray = explode(PHP_EOL, $result);
  38900. foreach ($resArray as $line) {
  38901. if (strpos($line, 'Depot') !== false) {
  38902. $fields = explode(' ', $line);
  38903. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  38904. $this->p4DepotType = $fields[3];
  38905. return $this->isStream();
  38906. }
  38907. }
  38908. }
  38909. return false;
  38910. }
  38911. protected function getChangeList(string $reference): mixed
  38912. {
  38913. $index = strpos($reference, '@');
  38914. if ($index === false) {
  38915. return null;
  38916. }
  38917. $label = substr($reference, $index);
  38918. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  38919. $this->executeCommand($command);
  38920. $changes = $this->commandResult;
  38921. if (strpos($changes, 'Change') !== 0) {
  38922. return null;
  38923. }
  38924. $fields = explode(' ', $changes);
  38925. return $fields[1];
  38926. }
  38927. public function getCommitLogs(string $fromReference, string $toReference): mixed
  38928. {
  38929. $fromChangeList = $this->getChangeList($fromReference);
  38930. if ($fromChangeList === null) {
  38931. return null;
  38932. }
  38933. $toChangeList = $this->getChangeList($toReference);
  38934. if ($toChangeList === null) {
  38935. return null;
  38936. }
  38937. $index = strpos($fromReference, '@');
  38938. $main = substr($fromReference, 0, $index) . '/...';
  38939. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  38940. $this->executeCommand($command);
  38941. return $this->commandResult;
  38942. }
  38943. public function getFilesystem(): Filesystem
  38944. {
  38945. if (null === $this->filesystem) {
  38946. $this->filesystem = new Filesystem($this->process);
  38947. }
  38948. return $this->filesystem;
  38949. }
  38950. public function setFilesystem(Filesystem $fs): void
  38951. {
  38952. $this->filesystem = $fs;
  38953. }
  38954. private function getP4Executable(): string
  38955. {
  38956. static $p4Executable;
  38957. if ($p4Executable) {
  38958. return $p4Executable;
  38959. }
  38960. $finder = new ExecutableFinder();
  38961. return $p4Executable = $finder->find('p4') ?? 'p4';
  38962. }
  38963. }
  38964. <?php declare(strict_types=1);
  38965. namespace Composer\Util;
  38966. use Composer\Pcre\Preg;
  38967. class Platform
  38968. {
  38969. private static $isVirtualBoxGuest = null;
  38970. private static $isWindowsSubsystemForLinux = null;
  38971. private static $isDocker = null;
  38972. public static function getCwd(bool $allowEmpty = false): string
  38973. {
  38974. $cwd = getcwd();
  38975. if (false === $cwd) {
  38976. $cwd = realpath('');
  38977. }
  38978. if (false === $cwd) {
  38979. if ($allowEmpty) {
  38980. return '';
  38981. }
  38982. throw new \RuntimeException('Could not determine the current working directory');
  38983. }
  38984. return $cwd;
  38985. }
  38986. public static function realpath(string $path): string
  38987. {
  38988. $realPath = realpath($path);
  38989. if ($realPath === false) {
  38990. return $path;
  38991. }
  38992. return $realPath;
  38993. }
  38994. public static function getEnv(string $name)
  38995. {
  38996. if (array_key_exists($name, $_SERVER)) {
  38997. return (string) $_SERVER[$name];
  38998. }
  38999. if (array_key_exists($name, $_ENV)) {
  39000. return (string) $_ENV[$name];
  39001. }
  39002. return getenv($name);
  39003. }
  39004. public static function putEnv(string $name, string $value): void
  39005. {
  39006. putenv($name . '=' . $value);
  39007. $_SERVER[$name] = $_ENV[$name] = $value;
  39008. }
  39009. public static function clearEnv(string $name): void
  39010. {
  39011. putenv($name);
  39012. unset($_SERVER[$name], $_ENV[$name]);
  39013. }
  39014. public static function expandPath(string $path): string
  39015. {
  39016. if (Preg::isMatch('#^~[\\/]#', $path)) {
  39017. return self::getUserDirectory() . substr($path, 1);
  39018. }
  39019. return Preg::replaceCallback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', static function ($matches): string {
  39020. if (Platform::isWindows() && $matches['var'] === 'HOME') {
  39021. if ((bool) Platform::getEnv('HOME')) {
  39022. return Platform::getEnv('HOME') . $matches['path'];
  39023. }
  39024. return Platform::getEnv('USERPROFILE') . $matches['path'];
  39025. }
  39026. return Platform::getEnv($matches['var']) . $matches['path'];
  39027. }, $path);
  39028. }
  39029. public static function getUserDirectory(): string
  39030. {
  39031. if (false !== ($home = self::getEnv('HOME'))) {
  39032. return $home;
  39033. }
  39034. if (self::isWindows() && false !== ($home = self::getEnv('USERPROFILE'))) {
  39035. return $home;
  39036. }
  39037. if (\function_exists('posix_getuid') && \function_exists('posix_getpwuid')) {
  39038. $info = posix_getpwuid(posix_getuid());
  39039. if (is_array($info)) {
  39040. return $info['dir'];
  39041. }
  39042. }
  39043. throw new \RuntimeException('Could not determine user directory');
  39044. }
  39045. public static function isWindowsSubsystemForLinux(): bool
  39046. {
  39047. if (null === self::$isWindowsSubsystemForLinux) {
  39048. self::$isWindowsSubsystemForLinux = false;
  39049. if (self::isWindows()) {
  39050. return self::$isWindowsSubsystemForLinux = false;
  39051. }
  39052. if (
  39053. !(bool) ini_get('open_basedir')
  39054. && is_readable('/proc/version')
  39055. && false !== stripos((string)Silencer::call('file_get_contents', '/proc/version'), 'microsoft')
  39056. && !self::isDocker()
  39057. ) {
  39058. return self::$isWindowsSubsystemForLinux = true;
  39059. }
  39060. }
  39061. return self::$isWindowsSubsystemForLinux;
  39062. }
  39063. public static function isWindows(): bool
  39064. {
  39065. return \defined('PHP_WINDOWS_VERSION_BUILD');
  39066. }
  39067. public static function isDocker(): bool
  39068. {
  39069. if (null !== self::$isDocker) {
  39070. return self::$isDocker;
  39071. }
  39072. if ((bool) ini_get('open_basedir')) {
  39073. return self::$isDocker = false;
  39074. }
  39075. if (file_exists('/.dockerenv') || file_exists('/run/.containerenv') || file_exists('/var/run/.containerenv')) {
  39076. return self::$isDocker = true;
  39077. }
  39078. $cgroups = [
  39079. '/proc/self/mountinfo',
  39080. '/proc/1/cgroup',
  39081. ];
  39082. foreach ($cgroups as $cgroup) {
  39083. if (!is_readable($cgroup)) {
  39084. continue;
  39085. }
  39086. try {
  39087. $data = @file_get_contents($cgroup);
  39088. } catch (\Throwable $e) {
  39089. break;
  39090. }
  39091. if (is_string($data) && str_contains($data, '/var/lib/docker/')) {
  39092. return self::$isDocker = true;
  39093. }
  39094. }
  39095. return self::$isDocker = false;
  39096. }
  39097. public static function strlen(string $str): int
  39098. {
  39099. static $useMbString = null;
  39100. if (null === $useMbString) {
  39101. $useMbString = \function_exists('mb_strlen') && (bool) ini_get('mbstring.func_overload');
  39102. }
  39103. if ($useMbString) {
  39104. return mb_strlen($str, '8bit');
  39105. }
  39106. return \strlen($str);
  39107. }
  39108. public static function isTty($fd = null): bool
  39109. {
  39110. if ($fd === null) {
  39111. $fd = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w');
  39112. if ($fd === false) {
  39113. return false;
  39114. }
  39115. }
  39116. if (in_array(strtoupper((string) self::getEnv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {
  39117. return true;
  39118. }
  39119. if (function_exists('stream_isatty')) {
  39120. return stream_isatty($fd);
  39121. }
  39122. if (function_exists('posix_isatty') && posix_isatty($fd)) {
  39123. return true;
  39124. }
  39125. $stat = @fstat($fd);
  39126. if ($stat === false) {
  39127. return false;
  39128. }
  39129. return 0020000 === ($stat['mode'] & 0170000);
  39130. }
  39131. public static function isInputCompletionProcess(): bool
  39132. {
  39133. return '_complete' === ($_SERVER['argv'][1] ?? null);
  39134. }
  39135. public static function workaroundFilesystemIssues(): void
  39136. {
  39137. if (self::isVirtualBoxGuest()) {
  39138. usleep(200000);
  39139. }
  39140. }
  39141. private static function isVirtualBoxGuest(): bool
  39142. {
  39143. if (null === self::$isVirtualBoxGuest) {
  39144. self::$isVirtualBoxGuest = false;
  39145. if (self::isWindows()) {
  39146. return self::$isVirtualBoxGuest;
  39147. }
  39148. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  39149. $processUser = posix_getpwuid(posix_geteuid());
  39150. if (is_array($processUser) && $processUser['name'] === 'vagrant') {
  39151. return self::$isVirtualBoxGuest = true;
  39152. }
  39153. }
  39154. if (self::getEnv('COMPOSER_RUNTIME_ENV') === 'virtualbox') {
  39155. return self::$isVirtualBoxGuest = true;
  39156. }
  39157. if (defined('PHP_OS_FAMILY') && PHP_OS_FAMILY === 'Linux') {
  39158. $process = new ProcessExecutor();
  39159. try {
  39160. if (0 === $process->execute(['lsmod'], $output) && str_contains($output, 'vboxguest')) {
  39161. return self::$isVirtualBoxGuest = true;
  39162. }
  39163. } catch (\Exception $e) {
  39164. }
  39165. }
  39166. }
  39167. return self::$isVirtualBoxGuest;
  39168. }
  39169. public static function getDevNull(): string
  39170. {
  39171. if (self::isWindows()) {
  39172. return 'NUL';
  39173. }
  39174. return '/dev/null';
  39175. }
  39176. }
  39177. <?php declare(strict_types=1);
  39178. namespace Composer\Util;
  39179. use Composer\IO\IOInterface;
  39180. use Composer\Pcre\Preg;
  39181. use Seld\Signal\SignalHandler;
  39182. use Symfony\Component\Process\Exception\ProcessSignaledException;
  39183. use Symfony\Component\Process\Process;
  39184. use Symfony\Component\Process\Exception\RuntimeException;
  39185. use React\Promise\Promise;
  39186. use React\Promise\PromiseInterface;
  39187. use Symfony\Component\Process\ExecutableFinder;
  39188. class ProcessExecutor
  39189. {
  39190. private const STATUS_QUEUED = 1;
  39191. private const STATUS_STARTED = 2;
  39192. private const STATUS_COMPLETED = 3;
  39193. private const STATUS_FAILED = 4;
  39194. private const STATUS_ABORTED = 5;
  39195. private const BUILTIN_CMD_COMMANDS = [
  39196. 'assoc', 'break', 'call', 'cd', 'chdir', 'cls', 'color', 'copy', 'date',
  39197. 'del', 'dir', 'echo', 'endlocal', 'erase', 'exit', 'for', 'ftype', 'goto',
  39198. 'help', 'if', 'label', 'md', 'mkdir', 'mklink', 'move', 'path', 'pause',
  39199. 'popd', 'prompt', 'pushd', 'rd', 'rem', 'ren', 'rename', 'rmdir', 'set',
  39200. 'setlocal', 'shift', 'start', 'time', 'title', 'type', 'ver', 'vol',
  39201. ];
  39202. private const GIT_CMDS_NEED_GIT_DIR = [
  39203. ['show'],
  39204. ['log'],
  39205. ['branch'],
  39206. ['remote', 'set-url']
  39207. ];
  39208. protected static $timeout = 300;
  39209. protected $captureOutput = false;
  39210. protected $errorOutput = '';
  39211. protected $io;
  39212. private $jobs = [];
  39213. private $runningJobs = 0;
  39214. private $maxJobs = 10;
  39215. private $idGen = 0;
  39216. private $allowAsync = false;
  39217. private static $executables = [];
  39218. public function __construct(?IOInterface $io = null)
  39219. {
  39220. $this->io = $io;
  39221. }
  39222. public function execute($command, &$output = null, ?string $cwd = null): int
  39223. {
  39224. if (func_num_args() > 1) {
  39225. return $this->doExecute($command, $cwd, false, $output);
  39226. }
  39227. return $this->doExecute($command, $cwd, false);
  39228. }
  39229. public function executeTty($command, ?string $cwd = null): int
  39230. {
  39231. if (Platform::isTty()) {
  39232. return $this->doExecute($command, $cwd, true);
  39233. }
  39234. return $this->doExecute($command, $cwd, false);
  39235. }
  39236. private function runProcess($command, ?string $cwd, ?array $env, bool $tty, &$output = null): ?int
  39237. {
  39238. if (is_string($command)) {
  39239. if (Platform::isWindows() && Preg::isMatch('{^([^:/\\\\]++) }', $command, $match)) {
  39240. $command = substr_replace($command, self::escape(self::getExecutable($match[1])), 0, strlen($match[1]));
  39241. }
  39242. $process = Process::fromShellCommandline($command, $cwd, $env, null, static::getTimeout());
  39243. } else {
  39244. if (Platform::isWindows() && \strlen($command[0]) === strcspn($command[0], ':/\\')) {
  39245. $command[0] = self::getExecutable($command[0]);
  39246. }
  39247. $process = new Process($command, $cwd, $env, null, static::getTimeout());
  39248. }
  39249. if (! Platform::isWindows() && $tty) {
  39250. try {
  39251. $process->setTty(true);
  39252. } catch (RuntimeException $e) {
  39253. }
  39254. }
  39255. $callback = is_callable($output) ? $output : function (string $type, string $buffer): void {
  39256. $this->outputHandler($type, $buffer);
  39257. };
  39258. $signalHandler = SignalHandler::create(
  39259. [SignalHandler::SIGINT, SignalHandler::SIGTERM, SignalHandler::SIGHUP],
  39260. function (string $signal) {
  39261. if ($this->io !== null) {
  39262. $this->io->writeError(
  39263. 'Received '.$signal.', aborting when child process is done',
  39264. true,
  39265. IOInterface::DEBUG
  39266. );
  39267. }
  39268. }
  39269. );
  39270. try {
  39271. $process->run($callback);
  39272. if ($this->captureOutput && !is_callable($output)) {
  39273. $output = $process->getOutput();
  39274. }
  39275. $this->errorOutput = $process->getErrorOutput();
  39276. } catch (ProcessSignaledException $e) {
  39277. if ($signalHandler->isTriggered()) {
  39278. $signalHandler->exitWithLastSignal();
  39279. }
  39280. } finally {
  39281. $signalHandler->unregister();
  39282. }
  39283. return $process->getExitCode();
  39284. }
  39285. private function doExecute($command, ?string $cwd, bool $tty, &$output = null): int
  39286. {
  39287. $this->outputCommandRun($command, $cwd, false);
  39288. $this->captureOutput = func_num_args() > 3;
  39289. $this->errorOutput = '';
  39290. $env = null;
  39291. $requiresGitDirEnv = $this->requiresGitDirEnv($command);
  39292. if ($cwd !== null && $requiresGitDirEnv) {
  39293. $isBareRepository = !is_dir(sprintf('%s/.git', rtrim($cwd, '/')));
  39294. if ($isBareRepository) {
  39295. $configValue = '';
  39296. $this->runProcess(['git', 'config', 'safe.bareRepository'], $cwd, ['GIT_DIR' => $cwd], $tty, $configValue);
  39297. $configValue = trim($configValue);
  39298. if ($configValue === 'explicit') {
  39299. $env = ['GIT_DIR' => $cwd];
  39300. }
  39301. }
  39302. }
  39303. return $this->runProcess($command, $cwd, $env, $tty, $output);
  39304. }
  39305. public function executeAsync($command, ?string $cwd = null): PromiseInterface
  39306. {
  39307. if (!$this->allowAsync) {
  39308. throw new \LogicException('You must use the ProcessExecutor instance which is part of a Composer\Loop instance to be able to run async processes');
  39309. }
  39310. $job = [
  39311. 'id' => $this->idGen++,
  39312. 'status' => self::STATUS_QUEUED,
  39313. 'command' => $command,
  39314. 'cwd' => $cwd,
  39315. ];
  39316. $resolver = static function ($resolve, $reject) use (&$job): void {
  39317. $job['status'] = ProcessExecutor::STATUS_QUEUED;
  39318. $job['resolve'] = $resolve;
  39319. $job['reject'] = $reject;
  39320. };
  39321. $canceler = static function () use (&$job): void {
  39322. if ($job['status'] === ProcessExecutor::STATUS_QUEUED) {
  39323. $job['status'] = ProcessExecutor::STATUS_ABORTED;
  39324. }
  39325. if ($job['status'] !== ProcessExecutor::STATUS_STARTED) {
  39326. return;
  39327. }
  39328. $job['status'] = ProcessExecutor::STATUS_ABORTED;
  39329. try {
  39330. if (defined('SIGINT')) {
  39331. $job['process']->signal(SIGINT);
  39332. }
  39333. } catch (\Exception $e) {
  39334. }
  39335. $job['process']->stop(1);
  39336. throw new \RuntimeException('Aborted process');
  39337. };
  39338. $promise = new Promise($resolver, $canceler);
  39339. $promise = $promise->then(function () use (&$job) {
  39340. if ($job['process']->isSuccessful()) {
  39341. $job['status'] = ProcessExecutor::STATUS_COMPLETED;
  39342. } else {
  39343. $job['status'] = ProcessExecutor::STATUS_FAILED;
  39344. }
  39345. $this->markJobDone();
  39346. return $job['process'];
  39347. }, function ($e) use (&$job): void {
  39348. $job['status'] = ProcessExecutor::STATUS_FAILED;
  39349. $this->markJobDone();
  39350. throw $e;
  39351. });
  39352. $this->jobs[$job['id']] = &$job;
  39353. if ($this->runningJobs < $this->maxJobs) {
  39354. $this->startJob($job['id']);
  39355. }
  39356. return $promise;
  39357. }
  39358. protected function outputHandler(string $type, string $buffer): void
  39359. {
  39360. if ($this->captureOutput) {
  39361. return;
  39362. }
  39363. if (null === $this->io) {
  39364. echo $buffer;
  39365. return;
  39366. }
  39367. if (Process::ERR === $type) {
  39368. $this->io->writeErrorRaw($buffer, false);
  39369. } else {
  39370. $this->io->writeRaw($buffer, false);
  39371. }
  39372. }
  39373. private function startJob(int $id): void
  39374. {
  39375. $job = &$this->jobs[$id];
  39376. if ($job['status'] !== self::STATUS_QUEUED) {
  39377. return;
  39378. }
  39379. $job['status'] = self::STATUS_STARTED;
  39380. $this->runningJobs++;
  39381. $command = $job['command'];
  39382. $cwd = $job['cwd'];
  39383. $this->outputCommandRun($command, $cwd, true);
  39384. try {
  39385. if (is_string($command)) {
  39386. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  39387. } else {
  39388. $process = new Process($command, $cwd, null, null, static::getTimeout());
  39389. }
  39390. } catch (\Throwable $e) {
  39391. $job['reject']($e);
  39392. return;
  39393. }
  39394. $job['process'] = $process;
  39395. try {
  39396. $process->start();
  39397. } catch (\Throwable $e) {
  39398. $job['reject']($e);
  39399. return;
  39400. }
  39401. }
  39402. public function setMaxJobs(int $maxJobs): void
  39403. {
  39404. $this->maxJobs = $maxJobs;
  39405. }
  39406. public function resetMaxJobs(): void
  39407. {
  39408. $this->maxJobs = 10;
  39409. }
  39410. public function wait($index = null): void
  39411. {
  39412. while (true) {
  39413. if (0 === $this->countActiveJobs($index)) {
  39414. return;
  39415. }
  39416. usleep(1000);
  39417. }
  39418. }
  39419. public function enableAsync(): void
  39420. {
  39421. $this->allowAsync = true;
  39422. }
  39423. public function countActiveJobs($index = null): int
  39424. {
  39425. foreach ($this->jobs as $job) {
  39426. if ($job['status'] === self::STATUS_STARTED) {
  39427. if (!$job['process']->isRunning()) {
  39428. call_user_func($job['resolve'], $job['process']);
  39429. }
  39430. $job['process']->checkTimeout();
  39431. }
  39432. if ($this->runningJobs < $this->maxJobs) {
  39433. if ($job['status'] === self::STATUS_QUEUED) {
  39434. $this->startJob($job['id']);
  39435. }
  39436. }
  39437. }
  39438. if (null !== $index) {
  39439. return $this->jobs[$index]['status'] < self::STATUS_COMPLETED ? 1 : 0;
  39440. }
  39441. $active = 0;
  39442. foreach ($this->jobs as $job) {
  39443. if ($job['status'] < self::STATUS_COMPLETED) {
  39444. $active++;
  39445. } else {
  39446. unset($this->jobs[$job['id']]);
  39447. }
  39448. }
  39449. return $active;
  39450. }
  39451. private function markJobDone(): void
  39452. {
  39453. $this->runningJobs--;
  39454. }
  39455. public function splitLines(?string $output): array
  39456. {
  39457. $output = trim((string) $output);
  39458. return $output === '' ? [] : Preg::split('{\r?\n}', $output);
  39459. }
  39460. public function getErrorOutput(): string
  39461. {
  39462. return $this->errorOutput;
  39463. }
  39464. public static function getTimeout(): int
  39465. {
  39466. return static::$timeout;
  39467. }
  39468. public static function setTimeout(int $timeout): void
  39469. {
  39470. static::$timeout = $timeout;
  39471. }
  39472. public static function escape($argument): string
  39473. {
  39474. return self::escapeArgument($argument);
  39475. }
  39476. private function outputCommandRun($command, ?string $cwd, bool $async): void
  39477. {
  39478. if (null === $this->io || !$this->io->isDebug()) {
  39479. return;
  39480. }
  39481. $commandString = is_string($command) ? $command : implode(' ', array_map(self::class.'::escape', $command));
  39482. $safeCommand = Preg::replaceCallback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', static function ($m): string {
  39483. if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
  39484. return '://***:***@';
  39485. }
  39486. if (Preg::isMatch('{^[a-f0-9]{12,}$}', $m['user'])) {
  39487. return '://***:***@';
  39488. }
  39489. return '://'.$m['user'].':***@';
  39490. }, $commandString);
  39491. $safeCommand = Preg::replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  39492. $this->io->writeError('Executing'.($async ? ' async' : '').' command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  39493. }
  39494. private static function escapeArgument($argument): string
  39495. {
  39496. if ('' === ($argument = (string) $argument)) {
  39497. return escapeshellarg($argument);
  39498. }
  39499. if (!Platform::isWindows()) {
  39500. return "'".str_replace("'", "'\\''", $argument)."'";
  39501. }
  39502. $argument = strtr($argument, [
  39503. "\n" => ' ',
  39504. "\u{ff02}" => '"',
  39505. "\u{02ba}" => '"',
  39506. "\u{301d}" => '"',
  39507. "\u{301e}" => '"',
  39508. "\u{030e}" => '"',
  39509. "\u{ff1a}" => ':',
  39510. "\u{0589}" => ':',
  39511. "\u{2236}" => ':',
  39512. "\u{ff0f}" => '/',
  39513. "\u{2044}" => '/',
  39514. "\u{2215}" => '/',
  39515. "\u{00b4}" => '/',
  39516. ]);
  39517. $quote = strpbrk($argument, " \t,") !== false;
  39518. $argument = Preg::replace('/(\\\\*)"/', '$1$1\\"', $argument, -1, $dquotes);
  39519. $meta = $dquotes > 0 || Preg::isMatch('/%[^%]+%|![^!]+!/', $argument);
  39520. if (!$meta && !$quote) {
  39521. $quote = strpbrk($argument, '^&|<>()') !== false;
  39522. }
  39523. if ($quote) {
  39524. $argument = '"'.Preg::replace('/(\\\\*)$/', '$1$1', $argument).'"';
  39525. }
  39526. if ($meta) {
  39527. $argument = Preg::replace('/(["^&|<>()%])/', '^$1', $argument);
  39528. $argument = Preg::replace('/(!)/', '^^$1', $argument);
  39529. }
  39530. return $argument;
  39531. }
  39532. public function requiresGitDirEnv($command): bool
  39533. {
  39534. $cmd = !is_array($command) ? explode(' ', $command) : $command;
  39535. if ($cmd[0] !== 'git') {
  39536. return false;
  39537. }
  39538. foreach (self::GIT_CMDS_NEED_GIT_DIR as $gitCmd) {
  39539. if (array_intersect($cmd, $gitCmd) === $gitCmd) {
  39540. return true;
  39541. }
  39542. }
  39543. return false;
  39544. }
  39545. private static function getExecutable(string $name): string
  39546. {
  39547. if (\in_array(strtolower($name), self::BUILTIN_CMD_COMMANDS, true)) {
  39548. return $name;
  39549. }
  39550. if (!isset(self::$executables[$name])) {
  39551. $path = (new ExecutableFinder())->find($name, $name);
  39552. if ($path !== null) {
  39553. self::$executables[$name] = $path;
  39554. }
  39555. }
  39556. return self::$executables[$name] ?? $name;
  39557. }
  39558. }
  39559. <?php declare(strict_types=1);
  39560. namespace Composer\Util;
  39561. use Composer\Config;
  39562. use Composer\Downloader\MaxFileSizeExceededException;
  39563. use Composer\IO\IOInterface;
  39564. use Composer\Downloader\TransportException;
  39565. use Composer\Pcre\Preg;
  39566. use Composer\Util\Http\Response;
  39567. use Composer\Util\Http\ProxyManager;
  39568. class RemoteFilesystem
  39569. {
  39570. private $io;
  39571. private $config;
  39572. private $scheme;
  39573. private $bytesMax;
  39574. private $originUrl;
  39575. private $fileUrl;
  39576. private $fileName;
  39577. private $retry = false;
  39578. private $progress;
  39579. private $lastProgress;
  39580. private $options = [];
  39581. private $disableTls = false;
  39582. private $lastHeaders;
  39583. private $storeAuth = false;
  39584. private $authHelper;
  39585. private $degradedMode = false;
  39586. private $redirects;
  39587. private $maxRedirects = 20;
  39588. public function __construct(IOInterface $io, Config $config, array $options = [], bool $disableTls = false, ?AuthHelper $authHelper = null)
  39589. {
  39590. $this->io = $io;
  39591. if ($disableTls === false) {
  39592. $this->options = StreamContextFactory::getTlsDefaults($options, $io);
  39593. } else {
  39594. $this->disableTls = true;
  39595. }
  39596. $this->options = array_replace_recursive($this->options, $options);
  39597. $this->config = $config;
  39598. $this->authHelper = $authHelper ?? new AuthHelper($io, $config);
  39599. }
  39600. public function copy(string $originUrl, string $fileUrl, string $fileName, bool $progress = true, array $options = [])
  39601. {
  39602. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  39603. }
  39604. public function getContents(string $originUrl, string $fileUrl, bool $progress = true, array $options = [])
  39605. {
  39606. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  39607. }
  39608. public function getOptions()
  39609. {
  39610. return $this->options;
  39611. }
  39612. public function setOptions(array $options)
  39613. {
  39614. $this->options = array_replace_recursive($this->options, $options);
  39615. }
  39616. public function isTlsDisabled()
  39617. {
  39618. return $this->disableTls === true;
  39619. }
  39620. public function getLastHeaders()
  39621. {
  39622. return $this->lastHeaders;
  39623. }
  39624. public static function findStatusCode(array $headers)
  39625. {
  39626. $value = null;
  39627. foreach ($headers as $header) {
  39628. if (Preg::isMatch('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  39629. $value = (int) $match[1];
  39630. }
  39631. }
  39632. return $value;
  39633. }
  39634. public function findStatusMessage(array $headers)
  39635. {
  39636. $value = null;
  39637. foreach ($headers as $header) {
  39638. if (Preg::isMatch('{^HTTP/\S+ \d+}i', $header)) {
  39639. $value = $header;
  39640. }
  39641. }
  39642. return $value;
  39643. }
  39644. protected function get(string $originUrl, string $fileUrl, array $additionalOptions = [], ?string $fileName = null, bool $progress = true)
  39645. {
  39646. $this->scheme = parse_url(strtr($fileUrl, '\\', '/'), PHP_URL_SCHEME);
  39647. $this->bytesMax = 0;
  39648. $this->originUrl = $originUrl;
  39649. $this->fileUrl = $fileUrl;
  39650. $this->fileName = $fileName;
  39651. $this->progress = $progress;
  39652. $this->lastProgress = null;
  39653. $retryAuthFailure = true;
  39654. $this->lastHeaders = [];
  39655. $this->redirects = 1;
  39656. $tempAdditionalOptions = $additionalOptions;
  39657. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  39658. $retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  39659. unset($tempAdditionalOptions['retry-auth-failure']);
  39660. }
  39661. $isRedirect = false;
  39662. if (isset($tempAdditionalOptions['redirects'])) {
  39663. $this->redirects = $tempAdditionalOptions['redirects'];
  39664. $isRedirect = true;
  39665. unset($tempAdditionalOptions['redirects']);
  39666. }
  39667. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  39668. unset($tempAdditionalOptions);
  39669. $origFileUrl = $fileUrl;
  39670. if (isset($options['prevent_ip_access_callable'])) {
  39671. throw new \RuntimeException("RemoteFilesystem doesn't support the 'prevent_ip_access_callable' config.");
  39672. }
  39673. if (isset($options['gitlab-token'])) {
  39674. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  39675. unset($options['gitlab-token']);
  39676. }
  39677. if (isset($options['http'])) {
  39678. $options['http']['ignore_errors'] = true;
  39679. }
  39680. if ($this->degradedMode && strpos($fileUrl, 'http://repo.packagist.org/') === 0) {
  39681. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  39682. $degradedPackagist = true;
  39683. }
  39684. $maxFileSize = null;
  39685. if (isset($options['max_file_size'])) {
  39686. $maxFileSize = $options['max_file_size'];
  39687. unset($options['max_file_size']);
  39688. }
  39689. $ctx = StreamContextFactory::getContext($fileUrl, $options, ['notification' => [$this, 'callbackGet']]);
  39690. $proxy = ProxyManager::getInstance()->getProxyForRequest($fileUrl);
  39691. $usingProxy = $proxy->getStatus(' using proxy (%s)');
  39692. $this->io->writeError((strpos($origFileUrl, 'http') === 0 ? 'Downloading ' : 'Reading ') . Url::sanitize($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  39693. unset($origFileUrl, $proxy, $usingProxy);
  39694. if ((!Preg::isMatch('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist)) {
  39695. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  39696. }
  39697. if ($this->progress && !$isRedirect) {
  39698. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  39699. }
  39700. $errorMessage = '';
  39701. $errorCode = 0;
  39702. $result = false;
  39703. set_error_handler(static function ($code, $msg) use (&$errorMessage): bool {
  39704. if ($errorMessage) {
  39705. $errorMessage .= "\n";
  39706. }
  39707. $errorMessage .= Preg::replace('{^file_get_contents\(.*?\): }', '', $msg);
  39708. return true;
  39709. });
  39710. $http_response_header = [];
  39711. try {
  39712. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header, $maxFileSize);
  39713. if (!empty($http_response_header[0])) {
  39714. $statusCode = self::findStatusCode($http_response_header);
  39715. if ($statusCode >= 400 && Response::findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  39716. HttpDownloader::outputWarnings($this->io, $originUrl, json_decode($result, true));
  39717. }
  39718. if (in_array($statusCode, [401, 403]) && $retryAuthFailure) {
  39719. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $http_response_header);
  39720. }
  39721. }
  39722. $contentLength = !empty($http_response_header[0]) ? Response::findHeaderValue($http_response_header, 'content-length') : null;
  39723. if ($contentLength && Platform::strlen($result) < $contentLength) {
  39724. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  39725. $e->setHeaders($http_response_header);
  39726. $e->setStatusCode(self::findStatusCode($http_response_header));
  39727. try {
  39728. $e->setResponse($this->decodeResult($result, $http_response_header));
  39729. } catch (\Exception $discarded) {
  39730. $e->setResponse($this->normalizeResult($result));
  39731. }
  39732. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  39733. throw $e;
  39734. }
  39735. } catch (\Exception $e) {
  39736. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  39737. $e->setHeaders($http_response_header);
  39738. $e->setStatusCode(self::findStatusCode($http_response_header));
  39739. }
  39740. if ($e instanceof TransportException && $result !== false) {
  39741. $e->setResponse($this->decodeResult($result, $http_response_header));
  39742. }
  39743. $result = false;
  39744. }
  39745. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  39746. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  39747. }
  39748. restore_error_handler();
  39749. if (isset($e) && !$this->retry) {
  39750. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  39751. $this->degradedMode = true;
  39752. $this->io->writeError('');
  39753. $this->io->writeError([
  39754. '<error>'.$e->getMessage().'</error>',
  39755. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  39756. ]);
  39757. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  39758. }
  39759. throw $e;
  39760. }
  39761. $statusCode = null;
  39762. $contentType = null;
  39763. $locationHeader = null;
  39764. if (!empty($http_response_header[0])) {
  39765. $statusCode = self::findStatusCode($http_response_header);
  39766. $contentType = Response::findHeaderValue($http_response_header, 'content-type');
  39767. $locationHeader = Response::findHeaderValue($http_response_header, 'location');
  39768. }
  39769. if ($originUrl === 'bitbucket.org'
  39770. && !$this->authHelper->isPublicBitBucketDownload($fileUrl)
  39771. && substr($fileUrl, -4) === '.zip'
  39772. && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
  39773. && $contentType && Preg::isMatch('{^text/html\b}i', $contentType)
  39774. ) {
  39775. $result = false;
  39776. if ($retryAuthFailure) {
  39777. $this->promptAuthAndRetry(401);
  39778. }
  39779. }
  39780. if ($statusCode === 404
  39781. && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  39782. && false !== strpos($fileUrl, 'archive.zip')
  39783. ) {
  39784. $result = false;
  39785. if ($retryAuthFailure) {
  39786. $this->promptAuthAndRetry(401);
  39787. }
  39788. }
  39789. $hasFollowedRedirect = false;
  39790. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  39791. $hasFollowedRedirect = true;
  39792. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  39793. }
  39794. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  39795. if (!$this->retry) {
  39796. if ($this->progress && !$isRedirect) {
  39797. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  39798. }
  39799. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  39800. $e->setHeaders($http_response_header);
  39801. $e->setResponse($this->decodeResult($result, $http_response_header));
  39802. $e->setStatusCode($statusCode);
  39803. throw $e;
  39804. }
  39805. $result = false;
  39806. }
  39807. if ($this->progress && !$this->retry && !$isRedirect) {
  39808. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  39809. }
  39810. if ($result && extension_loaded('zlib') && strpos($fileUrl, 'http') === 0 && !$hasFollowedRedirect) {
  39811. try {
  39812. $result = $this->decodeResult($result, $http_response_header);
  39813. } catch (\Exception $e) {
  39814. if ($this->degradedMode) {
  39815. throw $e;
  39816. }
  39817. $this->degradedMode = true;
  39818. $this->io->writeError([
  39819. '',
  39820. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  39821. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  39822. ]);
  39823. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  39824. }
  39825. }
  39826. if (false !== $result && null !== $fileName && !$isRedirect) {
  39827. if ('' === $result) {
  39828. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  39829. }
  39830. $errorMessage = '';
  39831. set_error_handler(static function ($code, $msg) use (&$errorMessage): bool {
  39832. if ($errorMessage) {
  39833. $errorMessage .= "\n";
  39834. }
  39835. $errorMessage .= Preg::replace('{^file_put_contents\(.*?\): }', '', $msg);
  39836. return true;
  39837. });
  39838. $result = (bool) file_put_contents($fileName, $result);
  39839. restore_error_handler();
  39840. if (false === $result) {
  39841. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  39842. }
  39843. }
  39844. if ($this->retry) {
  39845. $this->retry = false;
  39846. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  39847. if ($this->storeAuth) {
  39848. $this->authHelper->storeAuth($this->originUrl, $this->storeAuth);
  39849. $this->storeAuth = false;
  39850. }
  39851. return $result;
  39852. }
  39853. if (false === $result) {
  39854. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  39855. if (!empty($http_response_header[0])) {
  39856. $e->setHeaders($http_response_header);
  39857. }
  39858. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  39859. $this->degradedMode = true;
  39860. $this->io->writeError('');
  39861. $this->io->writeError([
  39862. '<error>'.$e->getMessage().'</error>',
  39863. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  39864. ]);
  39865. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  39866. }
  39867. throw $e;
  39868. }
  39869. if (!empty($http_response_header[0])) {
  39870. $this->lastHeaders = $http_response_header;
  39871. }
  39872. return $result;
  39873. }
  39874. protected function getRemoteContents(string $originUrl, string $fileUrl, $context, ?array &$responseHeaders = null, ?int $maxFileSize = null)
  39875. {
  39876. $result = false;
  39877. try {
  39878. $e = null;
  39879. if ($maxFileSize !== null) {
  39880. $result = file_get_contents($fileUrl, false, $context, 0, $maxFileSize);
  39881. } else {
  39882. $result = file_get_contents($fileUrl, false, $context);
  39883. }
  39884. } catch (\Throwable $e) {
  39885. }
  39886. if ($result !== false && $maxFileSize !== null && Platform::strlen($result) >= $maxFileSize) {
  39887. throw new MaxFileSizeExceededException('Maximum allowed download size reached. Downloaded ' . Platform::strlen($result) . ' of allowed ' . $maxFileSize . ' bytes');
  39888. }
  39889. if (\PHP_VERSION_ID >= 80400) {
  39890. $responseHeaders = http_get_last_response_headers();
  39891. http_clear_last_response_headers();
  39892. } else {
  39893. $responseHeaders = $http_response_header ?? [];
  39894. }
  39895. if (null !== $e) {
  39896. throw $e;
  39897. }
  39898. return $result;
  39899. }
  39900. protected function callbackGet(int $notificationCode, int $severity, ?string $message, int $messageCode, int $bytesTransferred, int $bytesMax)
  39901. {
  39902. switch ($notificationCode) {
  39903. case STREAM_NOTIFY_FAILURE:
  39904. if (400 === $messageCode) {
  39905. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  39906. }
  39907. break;
  39908. case STREAM_NOTIFY_FILE_SIZE_IS:
  39909. $this->bytesMax = $bytesMax;
  39910. break;
  39911. case STREAM_NOTIFY_PROGRESS:
  39912. if ($this->bytesMax > 0 && $this->progress) {
  39913. $progression = min(100, (int) round($bytesTransferred / $this->bytesMax * 100));
  39914. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  39915. $this->lastProgress = $progression;
  39916. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  39917. }
  39918. }
  39919. break;
  39920. default:
  39921. break;
  39922. }
  39923. }
  39924. protected function promptAuthAndRetry($httpStatus, ?string $reason = null, array $headers = [])
  39925. {
  39926. $result = $this->authHelper->promptAuthIfNeeded($this->fileUrl, $this->originUrl, $httpStatus, $reason, $headers, 1 );
  39927. $this->storeAuth = $result['storeAuth'];
  39928. $this->retry = $result['retry'];
  39929. if ($this->retry) {
  39930. throw new TransportException('RETRY');
  39931. }
  39932. }
  39933. protected function getOptionsForUrl(string $originUrl, array $additionalOptions)
  39934. {
  39935. $tlsOptions = [];
  39936. $headers = [];
  39937. if (extension_loaded('zlib')) {
  39938. $headers[] = 'Accept-Encoding: gzip';
  39939. }
  39940. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  39941. if (!$this->degradedMode) {
  39942. $options['http']['protocol_version'] = 1.1;
  39943. $headers[] = 'Connection: close';
  39944. }
  39945. $headers = $this->authHelper->addAuthenticationHeader($headers, $originUrl, $this->fileUrl);
  39946. $options['http']['follow_location'] = 0;
  39947. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  39948. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  39949. }
  39950. foreach ($headers as $header) {
  39951. $options['http']['header'][] = $header;
  39952. }
  39953. return $options;
  39954. }
  39955. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  39956. {
  39957. if ($locationHeader = Response::findHeaderValue($http_response_header, 'location')) {
  39958. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  39959. $targetUrl = $locationHeader;
  39960. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  39961. $targetUrl = $this->scheme.':'.$locationHeader;
  39962. } elseif ('/' === $locationHeader[0]) {
  39963. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  39964. $targetUrl = Preg::replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  39965. } else {
  39966. $targetUrl = Preg::replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  39967. }
  39968. }
  39969. if (!empty($targetUrl)) {
  39970. $this->redirects++;
  39971. $this->io->writeError('', true, IOInterface::DEBUG);
  39972. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, Url::sanitize($targetUrl)), true, IOInterface::DEBUG);
  39973. $additionalOptions['redirects'] = $this->redirects;
  39974. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  39975. }
  39976. if (!$this->retry) {
  39977. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  39978. $e->setHeaders($http_response_header);
  39979. $e->setResponse($this->decodeResult($result, $http_response_header));
  39980. throw $e;
  39981. }
  39982. return false;
  39983. }
  39984. private function decodeResult($result, array $http_response_header): ?string
  39985. {
  39986. if ($result && extension_loaded('zlib')) {
  39987. $contentEncoding = Response::findHeaderValue($http_response_header, 'content-encoding');
  39988. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  39989. if ($decode) {
  39990. $result = zlib_decode($result);
  39991. if ($result === false) {
  39992. throw new TransportException('Failed to decode zlib stream');
  39993. }
  39994. }
  39995. }
  39996. return $this->normalizeResult($result);
  39997. }
  39998. private function normalizeResult($result): ?string
  39999. {
  40000. if ($result === false) {
  40001. return null;
  40002. }
  40003. return $result;
  40004. }
  40005. }
  40006. <?php declare(strict_types=1);
  40007. namespace Composer\Util;
  40008. class Silencer
  40009. {
  40010. private static $stack = [];
  40011. public static function suppress(?int $mask = null): int
  40012. {
  40013. if (!isset($mask)) {
  40014. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED;
  40015. }
  40016. $old = error_reporting();
  40017. self::$stack[] = $old;
  40018. error_reporting($old & ~$mask);
  40019. return $old;
  40020. }
  40021. public static function restore(): void
  40022. {
  40023. if (!empty(self::$stack)) {
  40024. error_reporting(array_pop(self::$stack));
  40025. }
  40026. }
  40027. public static function call(callable $callable, ...$parameters)
  40028. {
  40029. try {
  40030. self::suppress();
  40031. $result = $callable(...$parameters);
  40032. self::restore();
  40033. return $result;
  40034. } catch (\Exception $e) {
  40035. self::restore();
  40036. throw $e;
  40037. }
  40038. }
  40039. }
  40040. <?php declare(strict_types=1);
  40041. namespace Composer\Util;
  40042. use Composer\Composer;
  40043. use Composer\CaBundle\CaBundle;
  40044. use Composer\Downloader\TransportException;
  40045. use Composer\Repository\PlatformRepository;
  40046. use Composer\Util\Http\ProxyManager;
  40047. use Psr\Log\LoggerInterface;
  40048. final class StreamContextFactory
  40049. {
  40050. public static function getContext(string $url, array $defaultOptions = [], array $defaultParams = [])
  40051. {
  40052. $options = ['http' => [
  40053. 'follow_location' => 1,
  40054. 'max_redirects' => 20,
  40055. ]];
  40056. $options = array_replace_recursive($options, self::initOptions($url, $defaultOptions));
  40057. unset($defaultOptions['http']['header']);
  40058. $options = array_replace_recursive($options, $defaultOptions);
  40059. if (isset($options['http']['header'])) {
  40060. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  40061. }
  40062. return stream_context_create($options, $defaultParams);
  40063. }
  40064. public static function initOptions(string $url, array $options, bool $forCurl = false): array
  40065. {
  40066. if (!isset($options['http']['header'])) {
  40067. $options['http']['header'] = [];
  40068. }
  40069. if (is_string($options['http']['header'])) {
  40070. $options['http']['header'] = explode("\r\n", $options['http']['header']);
  40071. }
  40072. if (!$forCurl) {
  40073. $proxy = ProxyManager::getInstance()->getProxyForRequest($url);
  40074. $proxyOptions = $proxy->getContextOptions();
  40075. if ($proxyOptions !== null) {
  40076. $isHttpsRequest = 0 === strpos($url, 'https://');
  40077. if ($proxy->isSecure()) {
  40078. if (!extension_loaded('openssl')) {
  40079. throw new TransportException('You must enable the openssl extension to use a secure proxy.');
  40080. }
  40081. if ($isHttpsRequest) {
  40082. throw new TransportException('You must enable the curl extension to make https requests through a secure proxy.');
  40083. }
  40084. } elseif ($isHttpsRequest && !extension_loaded('openssl')) {
  40085. throw new TransportException('You must enable the openssl extension to make https requests through a proxy.');
  40086. }
  40087. if (isset($proxyOptions['http']['header'])) {
  40088. $options['http']['header'][] = $proxyOptions['http']['header'];
  40089. unset($proxyOptions['http']['header']);
  40090. }
  40091. $options = array_replace_recursive($options, $proxyOptions);
  40092. }
  40093. }
  40094. if (defined('HHVM_VERSION')) {
  40095. $phpVersion = 'HHVM ' . HHVM_VERSION;
  40096. } else {
  40097. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  40098. }
  40099. if ($forCurl) {
  40100. $curl = curl_version();
  40101. $httpVersion = 'cURL '.$curl['version'];
  40102. } else {
  40103. $httpVersion = 'streams';
  40104. }
  40105. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  40106. $platformPhpVersion = PlatformRepository::getPlatformPhpVersion();
  40107. $options['http']['header'][] = sprintf(
  40108. 'User-Agent: Composer/%s (%s; %s; %s; %s%s%s)',
  40109. Composer::getVersion(),
  40110. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  40111. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  40112. $phpVersion,
  40113. $httpVersion,
  40114. $platformPhpVersion ? '; Platform-PHP '.$platformPhpVersion : '',
  40115. Platform::getEnv('CI') ? '; CI' : ''
  40116. );
  40117. }
  40118. return $options;
  40119. }
  40120. public static function getTlsDefaults(array $options, ?LoggerInterface $logger = null): array
  40121. {
  40122. $ciphers = implode(':', [
  40123. 'ECDHE-RSA-AES128-GCM-SHA256',
  40124. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  40125. 'ECDHE-RSA-AES256-GCM-SHA384',
  40126. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  40127. 'DHE-RSA-AES128-GCM-SHA256',
  40128. 'DHE-DSS-AES128-GCM-SHA256',
  40129. 'kEDH+AESGCM',
  40130. 'ECDHE-RSA-AES128-SHA256',
  40131. 'ECDHE-ECDSA-AES128-SHA256',
  40132. 'ECDHE-RSA-AES128-SHA',
  40133. 'ECDHE-ECDSA-AES128-SHA',
  40134. 'ECDHE-RSA-AES256-SHA384',
  40135. 'ECDHE-ECDSA-AES256-SHA384',
  40136. 'ECDHE-RSA-AES256-SHA',
  40137. 'ECDHE-ECDSA-AES256-SHA',
  40138. 'DHE-RSA-AES128-SHA256',
  40139. 'DHE-RSA-AES128-SHA',
  40140. 'DHE-DSS-AES128-SHA256',
  40141. 'DHE-RSA-AES256-SHA256',
  40142. 'DHE-DSS-AES256-SHA',
  40143. 'DHE-RSA-AES256-SHA',
  40144. 'AES128-GCM-SHA256',
  40145. 'AES256-GCM-SHA384',
  40146. 'AES128-SHA256',
  40147. 'AES256-SHA256',
  40148. 'AES128-SHA',
  40149. 'AES256-SHA',
  40150. 'AES',
  40151. 'CAMELLIA',
  40152. 'DES-CBC3-SHA',
  40153. '!aNULL',
  40154. '!eNULL',
  40155. '!EXPORT',
  40156. '!DES',
  40157. '!RC4',
  40158. '!MD5',
  40159. '!PSK',
  40160. '!aECDH',
  40161. '!EDH-DSS-DES-CBC3-SHA',
  40162. '!EDH-RSA-DES-CBC3-SHA',
  40163. '!KRB5-DES-CBC3-SHA',
  40164. ]);
  40165. $defaults = [
  40166. 'ssl' => [
  40167. 'ciphers' => $ciphers,
  40168. 'verify_peer' => true,
  40169. 'verify_depth' => 7,
  40170. 'SNI_enabled' => true,
  40171. 'capture_peer_cert' => true,
  40172. ],
  40173. ];
  40174. if (isset($options['ssl'])) {
  40175. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  40176. }
  40177. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  40178. $result = CaBundle::getSystemCaRootBundlePath($logger);
  40179. if (is_dir($result)) {
  40180. $defaults['ssl']['capath'] = $result;
  40181. } else {
  40182. $defaults['ssl']['cafile'] = $result;
  40183. }
  40184. }
  40185. if (isset($defaults['ssl']['cafile']) && (!Filesystem::isReadable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $logger))) {
  40186. throw new TransportException('The configured cafile was not valid or could not be read.');
  40187. }
  40188. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !Filesystem::isReadable($defaults['ssl']['capath']))) {
  40189. throw new TransportException('The configured capath was not valid or could not be read.');
  40190. }
  40191. $defaults['ssl']['disable_compression'] = true;
  40192. return $defaults;
  40193. }
  40194. private static function fixHttpHeaderField($header): array
  40195. {
  40196. if (!is_array($header)) {
  40197. $header = explode("\r\n", $header);
  40198. }
  40199. uasort($header, static function ($el): int {
  40200. return stripos($el, 'content-type') === 0 ? 1 : -1;
  40201. });
  40202. return $header;
  40203. }
  40204. }
  40205. <?php declare(strict_types=1);
  40206. namespace Composer\Util;
  40207. use Composer\Config;
  40208. use Composer\IO\IOInterface;
  40209. use Composer\Pcre\Preg;
  40210. class Svn
  40211. {
  40212. private const MAX_QTY_AUTH_TRIES = 5;
  40213. protected $credentials;
  40214. protected $hasAuth;
  40215. protected $io;
  40216. protected $url;
  40217. protected $cacheCredentials = true;
  40218. protected $process;
  40219. protected $qtyAuthTries = 0;
  40220. protected $config;
  40221. private static $version;
  40222. public function __construct(string $url, IOInterface $io, Config $config, ?ProcessExecutor $process = null)
  40223. {
  40224. $this->url = $url;
  40225. $this->io = $io;
  40226. $this->config = $config;
  40227. $this->process = $process ?: new ProcessExecutor($io);
  40228. }
  40229. public static function cleanEnv(): void
  40230. {
  40231. Platform::clearEnv('DYLD_LIBRARY_PATH');
  40232. }
  40233. public function execute(array $command, string $url, ?string $cwd = null, ?string $path = null, bool $verbose = false): string
  40234. {
  40235. $this->config->prohibitUrlByConfig($url, $this->io);
  40236. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  40237. }
  40238. public function executeLocal(array $command, string $path, ?string $cwd = null, bool $verbose = false): string
  40239. {
  40240. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  40241. }
  40242. private function executeWithAuthRetry(array $svnCommand, ?string $cwd, string $url, ?string $path, bool $verbose): ?string
  40243. {
  40244. $command = $this->getCommand($svnCommand, $url, $path);
  40245. $output = null;
  40246. $io = $this->io;
  40247. $handler = static function ($type, $buffer) use (&$output, $io, $verbose) {
  40248. if ($type !== 'out') {
  40249. return null;
  40250. }
  40251. if (strpos($buffer, 'Redirecting to URL ') === 0) {
  40252. return null;
  40253. }
  40254. $output .= $buffer;
  40255. if ($verbose) {
  40256. $io->writeError($buffer, false);
  40257. }
  40258. };
  40259. $status = $this->process->execute($command, $handler, $cwd);
  40260. if (0 === $status) {
  40261. return $output;
  40262. }
  40263. $errorOutput = $this->process->getErrorOutput();
  40264. $fullOutput = trim(implode("\n", [$output, $errorOutput]));
  40265. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  40266. && false === stripos($fullOutput, 'authorization failed')
  40267. && false === stripos($fullOutput, 'svn: E170001:')
  40268. && false === stripos($fullOutput, 'svn: E215004:')) {
  40269. throw new \RuntimeException($fullOutput);
  40270. }
  40271. if (!$this->hasAuth()) {
  40272. $this->doAuthDance();
  40273. }
  40274. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  40275. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  40276. }
  40277. throw new \RuntimeException(
  40278. 'wrong credentials provided ('.$fullOutput.')'
  40279. );
  40280. }
  40281. public function setCacheCredentials(bool $cacheCredentials): void
  40282. {
  40283. $this->cacheCredentials = $cacheCredentials;
  40284. }
  40285. protected function doAuthDance(): Svn
  40286. {
  40287. if (!$this->io->isInteractive()) {
  40288. throw new \RuntimeException(
  40289. 'can not ask for authentication in non interactive mode'
  40290. );
  40291. }
  40292. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  40293. $this->hasAuth = true;
  40294. $this->credentials = [
  40295. 'username' => (string) $this->io->ask("Username: ", ''),
  40296. 'password' => (string) $this->io->askAndHideAnswer("Password: "),
  40297. ];
  40298. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ");
  40299. return $this;
  40300. }
  40301. protected function getCommand(array $cmd, string $url, ?string $path = null): array
  40302. {
  40303. $cmd = array_merge(
  40304. $cmd,
  40305. ['--non-interactive'],
  40306. $this->getCredentialArgs(),
  40307. ['--', $url]
  40308. );
  40309. if ($path !== null) {
  40310. $cmd[] = $path;
  40311. }
  40312. return $cmd;
  40313. }
  40314. protected function getCredentialArgs(): array
  40315. {
  40316. if (!$this->hasAuth()) {
  40317. return [];
  40318. }
  40319. return array_merge(
  40320. $this->getAuthCacheArgs(),
  40321. ['--username', $this->getUsername(), '--password', $this->getPassword()]
  40322. );
  40323. }
  40324. protected function getPassword(): string
  40325. {
  40326. if ($this->credentials === null) {
  40327. throw new \LogicException("No svn auth detected.");
  40328. }
  40329. return $this->credentials['password'];
  40330. }
  40331. protected function getUsername(): string
  40332. {
  40333. if ($this->credentials === null) {
  40334. throw new \LogicException("No svn auth detected.");
  40335. }
  40336. return $this->credentials['username'];
  40337. }
  40338. protected function hasAuth(): bool
  40339. {
  40340. if (null !== $this->hasAuth) {
  40341. return $this->hasAuth;
  40342. }
  40343. if (false === $this->createAuthFromConfig()) {
  40344. $this->createAuthFromUrl();
  40345. }
  40346. return (bool) $this->hasAuth;
  40347. }
  40348. protected function getAuthCacheArgs(): array
  40349. {
  40350. return $this->cacheCredentials ? [] : ['--no-auth-cache'];
  40351. }
  40352. private function createAuthFromConfig(): bool
  40353. {
  40354. if (!$this->config->has('http-basic')) {
  40355. return $this->hasAuth = false;
  40356. }
  40357. $authConfig = $this->config->get('http-basic');
  40358. $host = parse_url($this->url, PHP_URL_HOST);
  40359. if (isset($authConfig[$host])) {
  40360. $this->credentials = [
  40361. 'username' => $authConfig[$host]['username'],
  40362. 'password' => $authConfig[$host]['password'],
  40363. ];
  40364. return $this->hasAuth = true;
  40365. }
  40366. return $this->hasAuth = false;
  40367. }
  40368. private function createAuthFromUrl(): bool
  40369. {
  40370. $uri = parse_url($this->url);
  40371. if (empty($uri['user'])) {
  40372. return $this->hasAuth = false;
  40373. }
  40374. $this->credentials = [
  40375. 'username' => $uri['user'],
  40376. 'password' => !empty($uri['pass']) ? $uri['pass'] : '',
  40377. ];
  40378. return $this->hasAuth = true;
  40379. }
  40380. public function binaryVersion(): ?string
  40381. {
  40382. if (!self::$version) {
  40383. if (0 === $this->process->execute(['svn', '--version'], $output)) {
  40384. if (Preg::isMatch('{(\d+(?:\.\d+)+)}', $output, $match)) {
  40385. self::$version = $match[1];
  40386. }
  40387. }
  40388. }
  40389. return self::$version;
  40390. }
  40391. }
  40392. <?php declare(strict_types=1);
  40393. namespace Composer\Util;
  40394. use Composer\Downloader\DownloaderInterface;
  40395. use Composer\Downloader\DownloadManager;
  40396. use Composer\Package\PackageInterface;
  40397. use React\Promise\PromiseInterface;
  40398. class SyncHelper
  40399. {
  40400. public static function downloadAndInstallPackageSync(Loop $loop, $downloader, string $path, PackageInterface $package, ?PackageInterface $prevPackage = null): void
  40401. {
  40402. assert($downloader instanceof DownloaderInterface || $downloader instanceof DownloadManager);
  40403. $type = $prevPackage !== null ? 'update' : 'install';
  40404. try {
  40405. self::await($loop, $downloader->download($package, $path, $prevPackage));
  40406. self::await($loop, $downloader->prepare($type, $package, $path, $prevPackage));
  40407. if ($type === 'update' && $prevPackage !== null) {
  40408. self::await($loop, $downloader->update($package, $prevPackage, $path));
  40409. } else {
  40410. self::await($loop, $downloader->install($package, $path));
  40411. }
  40412. } catch (\Exception $e) {
  40413. self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
  40414. throw $e;
  40415. }
  40416. self::await($loop, $downloader->cleanup($type, $package, $path, $prevPackage));
  40417. }
  40418. public static function await(Loop $loop, ?PromiseInterface $promise = null): void
  40419. {
  40420. if ($promise !== null) {
  40421. $loop->wait([$promise]);
  40422. }
  40423. }
  40424. }
  40425. <?php declare(strict_types=1);
  40426. namespace Composer\Util;
  40427. class Tar
  40428. {
  40429. public static function getComposerJson(string $pathToArchive): ?string
  40430. {
  40431. $phar = new \PharData($pathToArchive);
  40432. if (!$phar->valid()) {
  40433. return null;
  40434. }
  40435. return self::extractComposerJsonFromFolder($phar);
  40436. }
  40437. private static function extractComposerJsonFromFolder(\PharData $phar): string
  40438. {
  40439. if (isset($phar['composer.json'])) {
  40440. return $phar['composer.json']->getContent();
  40441. }
  40442. $topLevelPaths = [];
  40443. foreach ($phar as $folderFile) {
  40444. $name = $folderFile->getBasename();
  40445. if ($folderFile->isDir()) {
  40446. $topLevelPaths[$name] = true;
  40447. if (\count($topLevelPaths) > 1) {
  40448. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  40449. }
  40450. }
  40451. }
  40452. $composerJsonPath = key($topLevelPaths).'/composer.json';
  40453. if ($topLevelPaths && isset($phar[$composerJsonPath])) {
  40454. return $phar[$composerJsonPath]->getContent();
  40455. }
  40456. throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
  40457. }
  40458. }
  40459. <?php declare(strict_types=1);
  40460. namespace Composer\Util;
  40461. use Composer\CaBundle\CaBundle;
  40462. use Composer\Pcre\Preg;
  40463. final class TlsHelper
  40464. {
  40465. public static function checkCertificateHost($certificate, string $hostname, ?string &$cn = null): bool
  40466. {
  40467. $names = self::getCertificateNames($certificate);
  40468. if (empty($names)) {
  40469. return false;
  40470. }
  40471. $combinedNames = array_merge($names['san'], [$names['cn']]);
  40472. $hostname = strtolower($hostname);
  40473. foreach ($combinedNames as $certName) {
  40474. $matcher = self::certNameMatcher($certName);
  40475. if ($matcher && $matcher($hostname)) {
  40476. $cn = $names['cn'];
  40477. return true;
  40478. }
  40479. }
  40480. return false;
  40481. }
  40482. public static function getCertificateNames($certificate): ?array
  40483. {
  40484. if (is_array($certificate)) {
  40485. $info = $certificate;
  40486. } elseif (CaBundle::isOpensslParseSafe()) {
  40487. $info = openssl_x509_parse($certificate, false);
  40488. }
  40489. if (!isset($info['subject']['commonName'])) {
  40490. return null;
  40491. }
  40492. $commonName = strtolower($info['subject']['commonName']);
  40493. $subjectAltNames = [];
  40494. if (isset($info['extensions']['subjectAltName'])) {
  40495. $subjectAltNames = Preg::split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  40496. $subjectAltNames = array_filter(
  40497. array_map(static function ($name): ?string {
  40498. if (0 === strpos($name, 'DNS:')) {
  40499. return strtolower(ltrim(substr($name, 4)));
  40500. }
  40501. return null;
  40502. }, $subjectAltNames),
  40503. function (?string $san) {
  40504. return $san !== null;
  40505. }
  40506. );
  40507. $subjectAltNames = array_values($subjectAltNames);
  40508. }
  40509. return [
  40510. 'cn' => $commonName,
  40511. 'san' => $subjectAltNames,
  40512. ];
  40513. }
  40514. public static function getCertificateFingerprint(string $certificate): string
  40515. {
  40516. $pubkey = openssl_get_publickey($certificate);
  40517. if ($pubkey === false) {
  40518. throw new \RuntimeException('Failed to retrieve the public key from certificate');
  40519. }
  40520. $pubkeydetails = openssl_pkey_get_details($pubkey);
  40521. $pubkeypem = $pubkeydetails['key'];
  40522. $start = '-----BEGIN PUBLIC KEY-----';
  40523. $end = '-----END PUBLIC KEY-----';
  40524. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  40525. $der = base64_decode($pemtrim);
  40526. return hash('sha1', $der);
  40527. }
  40528. public static function isOpensslParseSafe(): bool
  40529. {
  40530. return CaBundle::isOpensslParseSafe();
  40531. }
  40532. private static function certNameMatcher(string $certName): ?callable
  40533. {
  40534. $wildcards = substr_count($certName, '*');
  40535. if (0 === $wildcards) {
  40536. return static function ($hostname) use ($certName): bool {
  40537. return $hostname === $certName;
  40538. };
  40539. }
  40540. if (1 === $wildcards) {
  40541. $components = explode('.', $certName);
  40542. if (3 > count($components)) {
  40543. return null;
  40544. }
  40545. $firstComponent = $components[0];
  40546. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  40547. return null;
  40548. }
  40549. $wildcardRegex = preg_quote($certName);
  40550. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  40551. $wildcardRegex = "{^{$wildcardRegex}$}";
  40552. return static function ($hostname) use ($wildcardRegex): bool {
  40553. return Preg::isMatch($wildcardRegex, $hostname);
  40554. };
  40555. }
  40556. return null;
  40557. }
  40558. }
  40559. <?php declare(strict_types=1);
  40560. namespace Composer\Util;
  40561. use Composer\Config;
  40562. use Composer\Pcre\Preg;
  40563. class Url
  40564. {
  40565. public static function updateDistReference(Config $config, string $url, string $ref): string
  40566. {
  40567. $host = parse_url($url, PHP_URL_HOST);
  40568. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  40569. if (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  40570. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  40571. } elseif (Preg::isMatch('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  40572. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  40573. } elseif (Preg::isMatch('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  40574. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  40575. }
  40576. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  40577. if (Preg::isMatch('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  40578. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  40579. }
  40580. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  40581. if (Preg::isMatch('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  40582. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  40583. }
  40584. } elseif (in_array($host, $config->get('github-domains'), true)) {
  40585. $url = Preg::replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  40586. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  40587. $url = Preg::replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  40588. }
  40589. assert($url !== '');
  40590. return $url;
  40591. }
  40592. public static function getOrigin(Config $config, string $url): string
  40593. {
  40594. if (0 === strpos($url, 'file://')) {
  40595. return $url;
  40596. }
  40597. $origin = (string) parse_url($url, PHP_URL_HOST);
  40598. if ($port = parse_url($url, PHP_URL_PORT)) {
  40599. $origin .= ':'.$port;
  40600. }
  40601. if (str_ends_with($origin, '.github.com') && $origin !== 'codeload.github.com') {
  40602. return 'github.com';
  40603. }
  40604. if ($origin === 'repo.packagist.org') {
  40605. return 'packagist.org';
  40606. }
  40607. if ($origin === '') {
  40608. $origin = $url;
  40609. }
  40610. if (
  40611. false === strpos($origin, '/')
  40612. && !in_array($origin, $config->get('gitlab-domains'), true)
  40613. ) {
  40614. foreach ($config->get('gitlab-domains') as $gitlabDomain) {
  40615. if ($gitlabDomain !== '' && str_starts_with($gitlabDomain, $origin)) {
  40616. return $gitlabDomain;
  40617. }
  40618. }
  40619. }
  40620. return $origin;
  40621. }
  40622. public static function sanitize(string $url): string
  40623. {
  40624. $url = Preg::replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  40625. $url = Preg::replaceCallback('{^(?P<prefix>[a-z0-9]+://)?(?P<user>[^:/\s@]+):(?P<password>[^@\s/]+)@}i', static function ($m): string {
  40626. if (Preg::isMatch('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+|github_pat_[a-zA-Z0-9_]+)$}', $m['user'])) {
  40627. return $m['prefix'].'***:***@';
  40628. }
  40629. return $m['prefix'].$m['user'].':***@';
  40630. }, $url);
  40631. return $url;
  40632. }
  40633. }
  40634. <?php declare(strict_types=1);
  40635. namespace Composer\Util;
  40636. class Zip
  40637. {
  40638. public static function getComposerJson(string $pathToZip): ?string
  40639. {
  40640. if (!extension_loaded('zip')) {
  40641. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  40642. }
  40643. $zip = new \ZipArchive();
  40644. if ($zip->open($pathToZip) !== true) {
  40645. return null;
  40646. }
  40647. if (0 === $zip->numFiles) {
  40648. $zip->close();
  40649. return null;
  40650. }
  40651. $foundFileIndex = self::locateFile($zip, 'composer.json');
  40652. $content = null;
  40653. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  40654. $stream = $zip->getStream($configurationFileName);
  40655. if (false !== $stream) {
  40656. $content = stream_get_contents($stream);
  40657. }
  40658. $zip->close();
  40659. return $content;
  40660. }
  40661. private static function locateFile(\ZipArchive $zip, string $filename): int
  40662. {
  40663. if (false !== ($index = $zip->locateName($filename)) && $zip->getFromIndex($index) !== false) {
  40664. return $index;
  40665. }
  40666. $topLevelPaths = [];
  40667. for ($i = 0; $i < $zip->numFiles; $i++) {
  40668. $name = $zip->getNameIndex($i);
  40669. $dirname = dirname($name);
  40670. if (strpos($name, '__MACOSX') !== false) {
  40671. continue;
  40672. }
  40673. if ($dirname === '.') {
  40674. $topLevelPaths[$name] = true;
  40675. if (\count($topLevelPaths) > 1) {
  40676. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  40677. }
  40678. continue;
  40679. }
  40680. if (false === strpos($dirname, '\\') && false === strpos($dirname, '/')) {
  40681. $topLevelPaths[$dirname.'/'] = true;
  40682. if (\count($topLevelPaths) > 1) {
  40683. throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
  40684. }
  40685. }
  40686. }
  40687. if ($topLevelPaths && false !== ($index = $zip->locateName(key($topLevelPaths).$filename)) && $zip->getFromIndex($index) !== false) {
  40688. return $index;
  40689. }
  40690. throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');
  40691. }
  40692. }
  40693. <?php declare(strict_types=1);
  40694. use Composer\Autoload\ClassLoader;
  40695. function includeIfExists(string $file): ?ClassLoader
  40696. {
  40697. return file_exists($file) ? include $file : null;
  40698. }
  40699. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  40700. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  40701. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  40702. exit(1);
  40703. }
  40704. return $loader;
  40705. <?php
  40706. /*
  40707. * This file is part of Composer.
  40708. *
  40709. * (c) Nils Adermann <naderman@naderman.de>
  40710. * Jordi Boggiano <j.boggiano@seld.be>
  40711. *
  40712. * For the full copyright and license information, please view the LICENSE
  40713. * file that was distributed with this source code.
  40714. */
  40715. namespace Composer\Autoload;
  40716. /**
  40717. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  40718. *
  40719. * $loader = new \Composer\Autoload\ClassLoader();
  40720. *
  40721. * // register classes with namespaces
  40722. * $loader->add('Symfony\Component', __DIR__.'/component');
  40723. * $loader->add('Symfony', __DIR__.'/framework');
  40724. *
  40725. * // activate the autoloader
  40726. * $loader->register();
  40727. *
  40728. * // to enable searching the include path (eg. for PEAR packages)
  40729. * $loader->setUseIncludePath(true);
  40730. *
  40731. * In this example, if you try to use a class in the Symfony\Component
  40732. * namespace or one of its children (Symfony\Component\Console for instance),
  40733. * the autoloader will first look for the class under the component/
  40734. * directory, and it will then fallback to the framework/ directory if not
  40735. * found before giving up.
  40736. *
  40737. * This class is loosely based on the Symfony UniversalClassLoader.
  40738. *
  40739. * @author Fabien Potencier <fabien@symfony.com>
  40740. * @author Jordi Boggiano <j.boggiano@seld.be>
  40741. * @see https://www.php-fig.org/psr/psr-0/
  40742. * @see https://www.php-fig.org/psr/psr-4/
  40743. */
  40744. class ClassLoader
  40745. {
  40746. /** @var \Closure(string):void */
  40747. private static $includeFile;
  40748. /** @var string|null */
  40749. private $vendorDir;
  40750. // PSR-4
  40751. /**
  40752. * @var array<string, array<string, int>>
  40753. */
  40754. private $prefixLengthsPsr4 = array();
  40755. /**
  40756. * @var array<string, list<string>>
  40757. */
  40758. private $prefixDirsPsr4 = array();
  40759. /**
  40760. * @var list<string>
  40761. */
  40762. private $fallbackDirsPsr4 = array();
  40763. // PSR-0
  40764. /**
  40765. * List of PSR-0 prefixes
  40766. *
  40767. * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
  40768. *
  40769. * @var array<string, array<string, list<string>>>
  40770. */
  40771. private $prefixesPsr0 = array();
  40772. /**
  40773. * @var list<string>
  40774. */
  40775. private $fallbackDirsPsr0 = array();
  40776. /** @var bool */
  40777. private $useIncludePath = false;
  40778. /**
  40779. * @var array<string, string>
  40780. */
  40781. private $classMap = array();
  40782. /** @var bool */
  40783. private $classMapAuthoritative = false;
  40784. /**
  40785. * @var array<string, bool>
  40786. */
  40787. private $missingClasses = array();
  40788. /** @var string|null */
  40789. private $apcuPrefix;
  40790. /**
  40791. * @var array<string, self>
  40792. */
  40793. private static $registeredLoaders = array();
  40794. /**
  40795. * @param string|null $vendorDir
  40796. */
  40797. public function __construct($vendorDir = null)
  40798. {
  40799. $this->vendorDir = $vendorDir;
  40800. self::initializeIncludeClosure();
  40801. }
  40802. /**
  40803. * @return array<string, list<string>>
  40804. */
  40805. public function getPrefixes()
  40806. {
  40807. if (!empty($this->prefixesPsr0)) {
  40808. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  40809. }
  40810. return array();
  40811. }
  40812. /**
  40813. * @return array<string, list<string>>
  40814. */
  40815. public function getPrefixesPsr4()
  40816. {
  40817. return $this->prefixDirsPsr4;
  40818. }
  40819. /**
  40820. * @return list<string>
  40821. */
  40822. public function getFallbackDirs()
  40823. {
  40824. return $this->fallbackDirsPsr0;
  40825. }
  40826. /**
  40827. * @return list<string>
  40828. */
  40829. public function getFallbackDirsPsr4()
  40830. {
  40831. return $this->fallbackDirsPsr4;
  40832. }
  40833. /**
  40834. * @return array<string, string> Array of classname => path
  40835. */
  40836. public function getClassMap()
  40837. {
  40838. return $this->classMap;
  40839. }
  40840. /**
  40841. * @param array<string, string> $classMap Class to filename map
  40842. *
  40843. * @return void
  40844. */
  40845. public function addClassMap(array $classMap)
  40846. {
  40847. if ($this->classMap) {
  40848. $this->classMap = array_merge($this->classMap, $classMap);
  40849. } else {
  40850. $this->classMap = $classMap;
  40851. }
  40852. }
  40853. /**
  40854. * Registers a set of PSR-0 directories for a given prefix, either
  40855. * appending or prepending to the ones previously set for this prefix.
  40856. *
  40857. * @param string $prefix The prefix
  40858. * @param list<string>|string $paths The PSR-0 root directories
  40859. * @param bool $prepend Whether to prepend the directories
  40860. *
  40861. * @return void
  40862. */
  40863. public function add($prefix, $paths, $prepend = false)
  40864. {
  40865. $paths = (array) $paths;
  40866. if (!$prefix) {
  40867. if ($prepend) {
  40868. $this->fallbackDirsPsr0 = array_merge(
  40869. $paths,
  40870. $this->fallbackDirsPsr0
  40871. );
  40872. } else {
  40873. $this->fallbackDirsPsr0 = array_merge(
  40874. $this->fallbackDirsPsr0,
  40875. $paths
  40876. );
  40877. }
  40878. return;
  40879. }
  40880. $first = $prefix[0];
  40881. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  40882. $this->prefixesPsr0[$first][$prefix] = $paths;
  40883. return;
  40884. }
  40885. if ($prepend) {
  40886. $this->prefixesPsr0[$first][$prefix] = array_merge(
  40887. $paths,
  40888. $this->prefixesPsr0[$first][$prefix]
  40889. );
  40890. } else {
  40891. $this->prefixesPsr0[$first][$prefix] = array_merge(
  40892. $this->prefixesPsr0[$first][$prefix],
  40893. $paths
  40894. );
  40895. }
  40896. }
  40897. /**
  40898. * Registers a set of PSR-4 directories for a given namespace, either
  40899. * appending or prepending to the ones previously set for this namespace.
  40900. *
  40901. * @param string $prefix The prefix/namespace, with trailing '\\'
  40902. * @param list<string>|string $paths The PSR-4 base directories
  40903. * @param bool $prepend Whether to prepend the directories
  40904. *
  40905. * @throws \InvalidArgumentException
  40906. *
  40907. * @return void
  40908. */
  40909. public function addPsr4($prefix, $paths, $prepend = false)
  40910. {
  40911. $paths = (array) $paths;
  40912. if (!$prefix) {
  40913. // Register directories for the root namespace.
  40914. if ($prepend) {
  40915. $this->fallbackDirsPsr4 = array_merge(
  40916. $paths,
  40917. $this->fallbackDirsPsr4
  40918. );
  40919. } else {
  40920. $this->fallbackDirsPsr4 = array_merge(
  40921. $this->fallbackDirsPsr4,
  40922. $paths
  40923. );
  40924. }
  40925. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  40926. // Register directories for a new namespace.
  40927. $length = strlen($prefix);
  40928. if ('\\' !== $prefix[$length - 1]) {
  40929. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  40930. }
  40931. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  40932. $this->prefixDirsPsr4[$prefix] = $paths;
  40933. } elseif ($prepend) {
  40934. // Prepend directories for an already registered namespace.
  40935. $this->prefixDirsPsr4[$prefix] = array_merge(
  40936. $paths,
  40937. $this->prefixDirsPsr4[$prefix]
  40938. );
  40939. } else {
  40940. // Append directories for an already registered namespace.
  40941. $this->prefixDirsPsr4[$prefix] = array_merge(
  40942. $this->prefixDirsPsr4[$prefix],
  40943. $paths
  40944. );
  40945. }
  40946. }
  40947. /**
  40948. * Registers a set of PSR-0 directories for a given prefix,
  40949. * replacing any others previously set for this prefix.
  40950. *
  40951. * @param string $prefix The prefix
  40952. * @param list<string>|string $paths The PSR-0 base directories
  40953. *
  40954. * @return void
  40955. */
  40956. public function set($prefix, $paths)
  40957. {
  40958. if (!$prefix) {
  40959. $this->fallbackDirsPsr0 = (array) $paths;
  40960. } else {
  40961. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  40962. }
  40963. }
  40964. /**
  40965. * Registers a set of PSR-4 directories for a given namespace,
  40966. * replacing any others previously set for this namespace.
  40967. *
  40968. * @param string $prefix The prefix/namespace, with trailing '\\'
  40969. * @param list<string>|string $paths The PSR-4 base directories
  40970. *
  40971. * @throws \InvalidArgumentException
  40972. *
  40973. * @return void
  40974. */
  40975. public function setPsr4($prefix, $paths)
  40976. {
  40977. if (!$prefix) {
  40978. $this->fallbackDirsPsr4 = (array) $paths;
  40979. } else {
  40980. $length = strlen($prefix);
  40981. if ('\\' !== $prefix[$length - 1]) {
  40982. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  40983. }
  40984. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  40985. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  40986. }
  40987. }
  40988. /**
  40989. * Turns on searching the include path for class files.
  40990. *
  40991. * @param bool $useIncludePath
  40992. *
  40993. * @return void
  40994. */
  40995. public function setUseIncludePath($useIncludePath)
  40996. {
  40997. $this->useIncludePath = $useIncludePath;
  40998. }
  40999. /**
  41000. * Can be used to check if the autoloader uses the include path to check
  41001. * for classes.
  41002. *
  41003. * @return bool
  41004. */
  41005. public function getUseIncludePath()
  41006. {
  41007. return $this->useIncludePath;
  41008. }
  41009. /**
  41010. * Turns off searching the prefix and fallback directories for classes
  41011. * that have not been registered with the class map.
  41012. *
  41013. * @param bool $classMapAuthoritative
  41014. *
  41015. * @return void
  41016. */
  41017. public function setClassMapAuthoritative($classMapAuthoritative)
  41018. {
  41019. $this->classMapAuthoritative = $classMapAuthoritative;
  41020. }
  41021. /**
  41022. * Should class lookup fail if not found in the current class map?
  41023. *
  41024. * @return bool
  41025. */
  41026. public function isClassMapAuthoritative()
  41027. {
  41028. return $this->classMapAuthoritative;
  41029. }
  41030. /**
  41031. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  41032. *
  41033. * @param string|null $apcuPrefix
  41034. *
  41035. * @return void
  41036. */
  41037. public function setApcuPrefix($apcuPrefix)
  41038. {
  41039. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  41040. }
  41041. /**
  41042. * The APCu prefix in use, or null if APCu caching is not enabled.
  41043. *
  41044. * @return string|null
  41045. */
  41046. public function getApcuPrefix()
  41047. {
  41048. return $this->apcuPrefix;
  41049. }
  41050. /**
  41051. * Registers this instance as an autoloader.
  41052. *
  41053. * @param bool $prepend Whether to prepend the autoloader or not
  41054. *
  41055. * @return void
  41056. */
  41057. public function register($prepend = false)
  41058. {
  41059. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  41060. if (null === $this->vendorDir) {
  41061. return;
  41062. }
  41063. if ($prepend) {
  41064. self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
  41065. } else {
  41066. unset(self::$registeredLoaders[$this->vendorDir]);
  41067. self::$registeredLoaders[$this->vendorDir] = $this;
  41068. }
  41069. }
  41070. /**
  41071. * Unregisters this instance as an autoloader.
  41072. *
  41073. * @return void
  41074. */
  41075. public function unregister()
  41076. {
  41077. spl_autoload_unregister(array($this, 'loadClass'));
  41078. if (null !== $this->vendorDir) {
  41079. unset(self::$registeredLoaders[$this->vendorDir]);
  41080. }
  41081. }
  41082. /**
  41083. * Loads the given class or interface.
  41084. *
  41085. * @param string $class The name of the class
  41086. * @return true|null True if loaded, null otherwise
  41087. */
  41088. public function loadClass($class)
  41089. {
  41090. if ($file = $this->findFile($class)) {
  41091. $includeFile = self::$includeFile;
  41092. $includeFile($file);
  41093. return true;
  41094. }
  41095. return null;
  41096. }
  41097. /**
  41098. * Finds the path to the file where the class is defined.
  41099. *
  41100. * @param string $class The name of the class
  41101. *
  41102. * @return string|false The path if found, false otherwise
  41103. */
  41104. public function findFile($class)
  41105. {
  41106. // class map lookup
  41107. if (isset($this->classMap[$class])) {
  41108. return $this->classMap[$class];
  41109. }
  41110. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  41111. return false;
  41112. }
  41113. if (null !== $this->apcuPrefix) {
  41114. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  41115. if ($hit) {
  41116. return $file;
  41117. }
  41118. }
  41119. $file = $this->findFileWithExtension($class, '.php');
  41120. // Search for Hack files if we are running on HHVM
  41121. if (false === $file && defined('HHVM_VERSION')) {
  41122. $file = $this->findFileWithExtension($class, '.hh');
  41123. }
  41124. if (null !== $this->apcuPrefix) {
  41125. apcu_add($this->apcuPrefix.$class, $file);
  41126. }
  41127. if (false === $file) {
  41128. // Remember that this class does not exist.
  41129. $this->missingClasses[$class] = true;
  41130. }
  41131. return $file;
  41132. }
  41133. /**
  41134. * Returns the currently registered loaders keyed by their corresponding vendor directories.
  41135. *
  41136. * @return array<string, self>
  41137. */
  41138. public static function getRegisteredLoaders()
  41139. {
  41140. return self::$registeredLoaders;
  41141. }
  41142. /**
  41143. * @param string $class
  41144. * @param string $ext
  41145. * @return string|false
  41146. */
  41147. private function findFileWithExtension($class, $ext)
  41148. {
  41149. // PSR-4 lookup
  41150. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  41151. $first = $class[0];
  41152. if (isset($this->prefixLengthsPsr4[$first])) {
  41153. $subPath = $class;
  41154. while (false !== $lastPos = strrpos($subPath, '\\')) {
  41155. $subPath = substr($subPath, 0, $lastPos);
  41156. $search = $subPath . '\\';
  41157. if (isset($this->prefixDirsPsr4[$search])) {
  41158. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  41159. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  41160. if (file_exists($file = $dir . $pathEnd)) {
  41161. return $file;
  41162. }
  41163. }
  41164. }
  41165. }
  41166. }
  41167. // PSR-4 fallback dirs
  41168. foreach ($this->fallbackDirsPsr4 as $dir) {
  41169. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  41170. return $file;
  41171. }
  41172. }
  41173. // PSR-0 lookup
  41174. if (false !== $pos = strrpos($class, '\\')) {
  41175. // namespaced class name
  41176. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  41177. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  41178. } else {
  41179. // PEAR-like class name
  41180. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  41181. }
  41182. if (isset($this->prefixesPsr0[$first])) {
  41183. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  41184. if (0 === strpos($class, $prefix)) {
  41185. foreach ($dirs as $dir) {
  41186. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  41187. return $file;
  41188. }
  41189. }
  41190. }
  41191. }
  41192. }
  41193. // PSR-0 fallback dirs
  41194. foreach ($this->fallbackDirsPsr0 as $dir) {
  41195. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  41196. return $file;
  41197. }
  41198. }
  41199. // PSR-0 include paths.
  41200. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  41201. return $file;
  41202. }
  41203. return false;
  41204. }
  41205. /**
  41206. * @return void
  41207. */
  41208. private static function initializeIncludeClosure()
  41209. {
  41210. if (self::$includeFile !== null) {
  41211. return;
  41212. }
  41213. /**
  41214. * Scope isolated include.
  41215. *
  41216. * Prevents access to $this/self from included files.
  41217. *
  41218. * @param string $file
  41219. * @return void
  41220. */
  41221. self::$includeFile = \Closure::bind(static function($file) {
  41222. include $file;
  41223. }, null, null);
  41224. }
  41225. }
  41226. <?php
  41227. /*
  41228. * This file is part of Composer.
  41229. *
  41230. * (c) Nils Adermann <naderman@naderman.de>
  41231. * Jordi Boggiano <j.boggiano@seld.be>
  41232. *
  41233. * For the full copyright and license information, please view the LICENSE
  41234. * file that was distributed with this source code.
  41235. */
  41236. namespace Composer;
  41237. use Composer\Autoload\ClassLoader;
  41238. use Composer\Semver\VersionParser;
  41239. /**
  41240. * This class is copied in every Composer installed project and available to all
  41241. *
  41242. * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
  41243. *
  41244. * To require its presence, you can require `composer-runtime-api ^2.0`
  41245. *
  41246. * @final
  41247. */
  41248. class InstalledVersions
  41249. {
  41250. /**
  41251. * @var mixed[]|null
  41252. * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
  41253. */
  41254. private static $installed;
  41255. /**
  41256. * @var bool|null
  41257. */
  41258. private static $canGetVendors;
  41259. /**
  41260. * @var array[]
  41261. * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
  41262. */
  41263. private static $installedByVendor = array();
  41264. /**
  41265. * Returns a list of all package names which are present, either by being installed, replaced or provided
  41266. *
  41267. * @return string[]
  41268. * @psalm-return list<string>
  41269. */
  41270. public static function getInstalledPackages()
  41271. {
  41272. $packages = array();
  41273. foreach (self::getInstalled() as $installed) {
  41274. $packages[] = array_keys($installed['versions']);
  41275. }
  41276. if (1 === \count($packages)) {
  41277. return $packages[0];
  41278. }
  41279. return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
  41280. }
  41281. /**
  41282. * Returns a list of all package names with a specific type e.g. 'library'
  41283. *
  41284. * @param string $type
  41285. * @return string[]
  41286. * @psalm-return list<string>
  41287. */
  41288. public static function getInstalledPackagesByType($type)
  41289. {
  41290. $packagesByType = array();
  41291. foreach (self::getInstalled() as $installed) {
  41292. foreach ($installed['versions'] as $name => $package) {
  41293. if (isset($package['type']) && $package['type'] === $type) {
  41294. $packagesByType[] = $name;
  41295. }
  41296. }
  41297. }
  41298. return $packagesByType;
  41299. }
  41300. /**
  41301. * Checks whether the given package is installed
  41302. *
  41303. * This also returns true if the package name is provided or replaced by another package
  41304. *
  41305. * @param string $packageName
  41306. * @param bool $includeDevRequirements
  41307. * @return bool
  41308. */
  41309. public static function isInstalled($packageName, $includeDevRequirements = true)
  41310. {
  41311. foreach (self::getInstalled() as $installed) {
  41312. if (isset($installed['versions'][$packageName])) {
  41313. return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
  41314. }
  41315. }
  41316. return false;
  41317. }
  41318. /**
  41319. * Checks whether the given package satisfies a version constraint
  41320. *
  41321. * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
  41322. *
  41323. * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
  41324. *
  41325. * @param VersionParser $parser Install composer/semver to have access to this class and functionality
  41326. * @param string $packageName
  41327. * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
  41328. * @return bool
  41329. */
  41330. public static function satisfies(VersionParser $parser, $packageName, $constraint)
  41331. {
  41332. $constraint = $parser->parseConstraints((string) $constraint);
  41333. $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
  41334. return $provided->matches($constraint);
  41335. }
  41336. /**
  41337. * Returns a version constraint representing all the range(s) which are installed for a given package
  41338. *
  41339. * It is easier to use this via isInstalled() with the $constraint argument if you need to check
  41340. * whether a given version of a package is installed, and not just whether it exists
  41341. *
  41342. * @param string $packageName
  41343. * @return string Version constraint usable with composer/semver
  41344. */
  41345. public static function getVersionRanges($packageName)
  41346. {
  41347. foreach (self::getInstalled() as $installed) {
  41348. if (!isset($installed['versions'][$packageName])) {
  41349. continue;
  41350. }
  41351. $ranges = array();
  41352. if (isset($installed['versions'][$packageName]['pretty_version'])) {
  41353. $ranges[] = $installed['versions'][$packageName]['pretty_version'];
  41354. }
  41355. if (array_key_exists('aliases', $installed['versions'][$packageName])) {
  41356. $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
  41357. }
  41358. if (array_key_exists('replaced', $installed['versions'][$packageName])) {
  41359. $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
  41360. }
  41361. if (array_key_exists('provided', $installed['versions'][$packageName])) {
  41362. $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
  41363. }
  41364. return implode(' || ', $ranges);
  41365. }
  41366. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  41367. }
  41368. /**
  41369. * @param string $packageName
  41370. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
  41371. */
  41372. public static function getVersion($packageName)
  41373. {
  41374. foreach (self::getInstalled() as $installed) {
  41375. if (!isset($installed['versions'][$packageName])) {
  41376. continue;
  41377. }
  41378. if (!isset($installed['versions'][$packageName]['version'])) {
  41379. return null;
  41380. }
  41381. return $installed['versions'][$packageName]['version'];
  41382. }
  41383. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  41384. }
  41385. /**
  41386. * @param string $packageName
  41387. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
  41388. */
  41389. public static function getPrettyVersion($packageName)
  41390. {
  41391. foreach (self::getInstalled() as $installed) {
  41392. if (!isset($installed['versions'][$packageName])) {
  41393. continue;
  41394. }
  41395. if (!isset($installed['versions'][$packageName]['pretty_version'])) {
  41396. return null;
  41397. }
  41398. return $installed['versions'][$packageName]['pretty_version'];
  41399. }
  41400. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  41401. }
  41402. /**
  41403. * @param string $packageName
  41404. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
  41405. */
  41406. public static function getReference($packageName)
  41407. {
  41408. foreach (self::getInstalled() as $installed) {
  41409. if (!isset($installed['versions'][$packageName])) {
  41410. continue;
  41411. }
  41412. if (!isset($installed['versions'][$packageName]['reference'])) {
  41413. return null;
  41414. }
  41415. return $installed['versions'][$packageName]['reference'];
  41416. }
  41417. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  41418. }
  41419. /**
  41420. * @param string $packageName
  41421. * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
  41422. */
  41423. public static function getInstallPath($packageName)
  41424. {
  41425. foreach (self::getInstalled() as $installed) {
  41426. if (!isset($installed['versions'][$packageName])) {
  41427. continue;
  41428. }
  41429. return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
  41430. }
  41431. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  41432. }
  41433. /**
  41434. * @return array
  41435. * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
  41436. */
  41437. public static function getRootPackage()
  41438. {
  41439. $installed = self::getInstalled();
  41440. return $installed[0]['root'];
  41441. }
  41442. /**
  41443. * Returns the raw installed.php data for custom implementations
  41444. *
  41445. * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
  41446. * @return array[]
  41447. * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
  41448. */
  41449. public static function getRawData()
  41450. {
  41451. @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
  41452. if (null === self::$installed) {
  41453. // only require the installed.php file if this file is loaded from its dumped location,
  41454. // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
  41455. if (substr(__DIR__, -8, 1) !== 'C') {
  41456. self::$installed = include __DIR__ . '/installed.php';
  41457. } else {
  41458. self::$installed = array();
  41459. }
  41460. }
  41461. return self::$installed;
  41462. }
  41463. /**
  41464. * Returns the raw data of all installed.php which are currently loaded for custom implementations
  41465. *
  41466. * @return array[]
  41467. * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
  41468. */
  41469. public static function getAllRawData()
  41470. {
  41471. return self::getInstalled();
  41472. }
  41473. /**
  41474. * Lets you reload the static array from another file
  41475. *
  41476. * This is only useful for complex integrations in which a project needs to use
  41477. * this class but then also needs to execute another project's autoloader in process,
  41478. * and wants to ensure both projects have access to their version of installed.php.
  41479. *
  41480. * A typical case would be PHPUnit, where it would need to make sure it reads all
  41481. * the data it needs from this class, then call reload() with
  41482. * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
  41483. * the project in which it runs can then also use this class safely, without
  41484. * interference between PHPUnit's dependencies and the project's dependencies.
  41485. *
  41486. * @param array[] $data A vendor/composer/installed.php data set
  41487. * @return void
  41488. *
  41489. * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
  41490. */
  41491. public static function reload($data)
  41492. {
  41493. self::$installed = $data;
  41494. self::$installedByVendor = array();
  41495. }
  41496. /**
  41497. * @return array[]
  41498. * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
  41499. */
  41500. private static function getInstalled()
  41501. {
  41502. if (null === self::$canGetVendors) {
  41503. self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
  41504. }
  41505. $installed = array();
  41506. if (self::$canGetVendors) {
  41507. foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
  41508. if (isset(self::$installedByVendor[$vendorDir])) {
  41509. $installed[] = self::$installedByVendor[$vendorDir];
  41510. } elseif (is_file($vendorDir.'/composer/installed.php')) {
  41511. /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
  41512. $required = require $vendorDir.'/composer/installed.php';
  41513. $installed[] = self::$installedByVendor[$vendorDir] = $required;
  41514. if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
  41515. self::$installed = $installed[count($installed) - 1];
  41516. }
  41517. }
  41518. }
  41519. }
  41520. if (null === self::$installed) {
  41521. // only require the installed.php file if this file is loaded from its dumped location,
  41522. // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
  41523. if (substr(__DIR__, -8, 1) !== 'C') {
  41524. /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
  41525. $required = require __DIR__ . '/installed.php';
  41526. self::$installed = $required;
  41527. } else {
  41528. self::$installed = array();
  41529. }
  41530. }
  41531. if (self::$installed !== array()) {
  41532. $installed[] = self::$installed;
  41533. }
  41534. return $installed;
  41535. }
  41536. }
  41537. {
  41538. "$schema": "https://json-schema.org/draft-04/schema#",
  41539. "title": "Composer Lock File",
  41540. "type": "object",
  41541. "required": [ "content-hash", "packages", "packages-dev" ],
  41542. "additionalProperties": true,
  41543. "properties": {
  41544. "_readme": {
  41545. "type": "array",
  41546. "items": {
  41547. "type": "string"
  41548. },
  41549. "description": "Informational text for humans reading the file"
  41550. },
  41551. "content-hash": {
  41552. "type": "string",
  41553. "description": "Hash of all relevant properties of the composer.json that was used to create this lock file."
  41554. },
  41555. "packages": {
  41556. "type": "array",
  41557. "description": "An array of packages that are required.",
  41558. "items": {
  41559. "$ref": "./composer-schema.json",
  41560. "required": ["name", "version"]
  41561. }
  41562. },
  41563. "packages-dev": {
  41564. "type": "array",
  41565. "description": "An array of packages that are required in require-dev.",
  41566. "items": {
  41567. "$ref": "./composer-schema.json"
  41568. }
  41569. },
  41570. "aliases": {
  41571. "type": "array",
  41572. "description": "Inline aliases defined in the root package.",
  41573. "items": {
  41574. "type": "object",
  41575. "required": [ "package", "version", "alias", "alias_normalized" ],
  41576. "properties": {
  41577. "package": {
  41578. "type": "string"
  41579. },
  41580. "version": {
  41581. "type": "string"
  41582. },
  41583. "alias": {
  41584. "type": "string"
  41585. },
  41586. "alias_normalized": {
  41587. "type": "string"
  41588. }
  41589. }
  41590. }
  41591. },
  41592. "minimum-stability": {
  41593. "type": "string",
  41594. "description": "The minimum-stability used to generate this lock file."
  41595. },
  41596. "stability-flags": {
  41597. "type": "object",
  41598. "description": "Root package stability flags changing the minimum-stability for specific packages.",
  41599. "additionalProperties": {
  41600. "type": "integer"
  41601. }
  41602. },
  41603. "prefer-stable": {
  41604. "type": "boolean",
  41605. "description": "Whether the --prefer-stable flag was used when building this lock file."
  41606. },
  41607. "prefer-lowest": {
  41608. "type": "boolean",
  41609. "description": "Whether the --prefer-lowest flag was used when building this lock file."
  41610. },
  41611. "platform": {
  41612. "type": "object",
  41613. "description": "Platform requirements of the root package.",
  41614. "additionalProperties": {
  41615. "type": "string"
  41616. }
  41617. },
  41618. "platform-dev": {
  41619. "type": "object",
  41620. "description": "Platform dev-requirements of the root package.",
  41621. "additionalProperties": {
  41622. "type": "string"
  41623. }
  41624. },
  41625. "platform-overrides": {
  41626. "type": "object",
  41627. "description": "Platform config overrides of the root package.",
  41628. "additionalProperties": {
  41629. "type": "string"
  41630. }
  41631. },
  41632. "plugin-api-version": {
  41633. "type": "string",
  41634. "description": "The composer-plugin-api version that was used to generate this lock file."
  41635. }
  41636. }
  41637. }
  41638. {
  41639. "$schema": "https://json-schema.org/draft-04/schema#",
  41640. "title": "Composer Package Repository",
  41641. "type": "object",
  41642. "oneOf": [
  41643. { "required": [ "packages" ] },
  41644. { "required": [ "providers" ] },
  41645. { "required": [ "provider-includes", "providers-url" ] },
  41646. { "required": [ "metadata-url" ] }
  41647. ],
  41648. "properties": {
  41649. "packages": {
  41650. "type": ["object", "array"],
  41651. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  41652. "additionalProperties": { "$ref": "#/definitions/versions" }
  41653. },
  41654. "metadata-url": {
  41655. "type": "string",
  41656. "description": "Endpoint to retrieve package metadata data from, in Composer v2 format, e.g. '/p2/%package%.json'."
  41657. },
  41658. "available-packages": {
  41659. "type": "array",
  41660. "items": {
  41661. "type": "string"
  41662. },
  41663. "description": "If your repository only has a small number of packages, and you want to avoid serving many 404s, specify all the package names that your repository contains here."
  41664. },
  41665. "available-package-patterns": {
  41666. "type": "array",
  41667. "items": {
  41668. "type": "string"
  41669. },
  41670. "description": "If your repository only has a small number of packages, and you want to avoid serving many 404s, specify package name patterns containing wildcards (*) that your repository contains here."
  41671. },
  41672. "security-advisories": {
  41673. "type": "array",
  41674. "items": {
  41675. "type": "object",
  41676. "required": ["metadata", "api-url"],
  41677. "properties": {
  41678. "metadata": {
  41679. "type": "boolean",
  41680. "description": "Whether metadata files contain security advisory data or whether it should always be queried using the API URL."
  41681. },
  41682. "api-url": {
  41683. "type": "string",
  41684. "description": "Endpoint to call to retrieve security advisories data."
  41685. }
  41686. }
  41687. }
  41688. },
  41689. "metadata-changes-url": {
  41690. "type": "string",
  41691. "description": "Endpoint to retrieve package metadata updates from. This should receive a timestamp since last call to be able to return new changes. e.g. '/metadata/changes.json'."
  41692. },
  41693. "providers-api": {
  41694. "type": "string",
  41695. "description": "Endpoint to retrieve package names providing a given name from, e.g. '/providers/%package%.json'."
  41696. },
  41697. "notify-batch": {
  41698. "type": "string",
  41699. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  41700. },
  41701. "search": {
  41702. "type": "string",
  41703. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  41704. },
  41705. "list": {
  41706. "type": "string",
  41707. "description": "Endpoint that provides a full list of packages present in the repository. It should accept an optional `?filter=xx` query param, which can contain `*` as wildcards matching any substring. e.g. '/list.json'."
  41708. },
  41709. "warnings": {
  41710. "type": "array",
  41711. "items": {
  41712. "type": "object",
  41713. "required": ["message", "versions"],
  41714. "properties": {
  41715. "message": {
  41716. "type": "string",
  41717. "description": "A message that will be output by Composer as a warning when this source is consulted."
  41718. },
  41719. "versions": {
  41720. "type": "string",
  41721. "description": "A version constraint to limit to which Composer versions the warning should be shown."
  41722. }
  41723. }
  41724. }
  41725. },
  41726. "infos": {
  41727. "type": "array",
  41728. "items": {
  41729. "type": "object",
  41730. "required": ["message", "versions"],
  41731. "properties": {
  41732. "message": {
  41733. "type": "string",
  41734. "description": "A message that will be output by Composer as info when this source is consulted."
  41735. },
  41736. "versions": {
  41737. "type": "string",
  41738. "description": "A version constraint to limit to which Composer versions the info should be shown."
  41739. }
  41740. }
  41741. }
  41742. },
  41743. "providers-url": {
  41744. "type": "string",
  41745. "description": "DEPRECATED: Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  41746. },
  41747. "provider-includes": {
  41748. "type": "object",
  41749. "description": "DEPRECATED: A hashmap of provider listings.",
  41750. "additionalProperties": { "$ref": "#/definitions/provider" }
  41751. },
  41752. "providers": {
  41753. "type": "object",
  41754. "description": "DEPRECATED: A hashmap of package names in the form of <vendor>/<name>.",
  41755. "additionalProperties": { "$ref": "#/definitions/provider" }
  41756. },
  41757. "warning": {
  41758. "type": "string",
  41759. "description": "DEPRECATED: A message that will be output by Composer as a warning when this source is consulted."
  41760. },
  41761. "warning-versions": {
  41762. "type": "string",
  41763. "description": "DEPRECATED: A version constraint to limit to which Composer versions the warning should be shown."
  41764. },
  41765. "info": {
  41766. "type": "string",
  41767. "description": "DEPRECATED: A message that will be output by Composer as a info when this source is consulted."
  41768. },
  41769. "info-versions": {
  41770. "type": "string",
  41771. "description": "DEPRECATED: A version constraint to limit to which Composer versions the info should be shown."
  41772. }
  41773. },
  41774. "definitions": {
  41775. "versions": {
  41776. "type": "object",
  41777. "description": "A hashmap of versions and their metadata.",
  41778. "additionalProperties": { "$ref": "#/definitions/version" }
  41779. },
  41780. "version": {
  41781. "type": "object",
  41782. "oneOf": [
  41783. { "$ref": "#/definitions/package" },
  41784. { "$ref": "#/definitions/metapackage" }
  41785. ]
  41786. },
  41787. "package-base": {
  41788. "properties": {
  41789. "name": { "type": "string" },
  41790. "type": { "type": "string" },
  41791. "version": { "type": "string" },
  41792. "version_normalized": {
  41793. "type": "string",
  41794. "description": "Normalized version, optional but can save computational time on client side."
  41795. },
  41796. "autoload": { "type": "object" },
  41797. "require": { "type": "object" },
  41798. "replace": { "type": "object" },
  41799. "conflict": { "type": "object" },
  41800. "provide": { "type": "object" },
  41801. "time": { "type": "string" }
  41802. },
  41803. "additionalProperties": true
  41804. },
  41805. "package": {
  41806. "allOf": [
  41807. { "$ref": "#/definitions/package-base" },
  41808. {
  41809. "properties": {
  41810. "dist": { "type": "object" },
  41811. "source": { "type": "object" }
  41812. }
  41813. },
  41814. { "oneOf": [
  41815. { "required": [ "name", "version", "source" ] },
  41816. { "required": [ "name", "version", "dist" ] }
  41817. ] }
  41818. ]
  41819. },
  41820. "metapackage": {
  41821. "allOf": [
  41822. { "$ref": "#/definitions/package-base" },
  41823. {
  41824. "properties": {
  41825. "type": { "type": "string", "enum": [ "metapackage" ] }
  41826. },
  41827. "required": [ "name", "version", "type" ]
  41828. }
  41829. ]
  41830. },
  41831. "provider": {
  41832. "type": "object",
  41833. "properties": {
  41834. "sha256": {
  41835. "type": "string",
  41836. "description": "Hash value that can be used to validate the resource."
  41837. }
  41838. }
  41839. }
  41840. }
  41841. }
  41842. {
  41843. "$schema": "https://json-schema.org/draft-04/schema#",
  41844. "title": "Composer Package",
  41845. "type": "object",
  41846. "properties": {
  41847. "name": {
  41848. "type": "string",
  41849. "description": "Package name, including 'vendor-name/' prefix.",
  41850. "pattern": "^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9](([_.]|-{1,2})?[a-z0-9]+)*$"
  41851. },
  41852. "description": {
  41853. "type": "string",
  41854. "description": "Short package description."
  41855. },
  41856. "license": {
  41857. "type": ["string", "array"],
  41858. "description": "License name. Or an array of license names."
  41859. },
  41860. "type": {
  41861. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  41862. "type": "string",
  41863. "pattern": "^[a-z0-9-]+$"
  41864. },
  41865. "abandoned": {
  41866. "type": ["boolean", "string"],
  41867. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  41868. },
  41869. "version": {
  41870. "type": "string",
  41871. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  41872. "pattern": "^v?\\d+(\\.\\d+){0,3}|^dev-"
  41873. },
  41874. "default-branch": {
  41875. "type": ["boolean"],
  41876. "description": "Internal use only, do not specify this in composer.json. Indicates whether this version is the default branch of the linked VCS repository. Defaults to false."
  41877. },
  41878. "non-feature-branches": {
  41879. "type": ["array"],
  41880. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  41881. "items": {
  41882. "type": "string"
  41883. }
  41884. },
  41885. "keywords": {
  41886. "type": "array",
  41887. "items": {
  41888. "type": "string",
  41889. "description": "A tag/keyword that this package relates to."
  41890. }
  41891. },
  41892. "readme": {
  41893. "type": "string",
  41894. "description": "Relative path to the readme document."
  41895. },
  41896. "time": {
  41897. "type": "string",
  41898. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  41899. },
  41900. "authors": {
  41901. "$ref": "#/definitions/authors"
  41902. },
  41903. "homepage": {
  41904. "type": "string",
  41905. "description": "Homepage URL for the project.",
  41906. "format": "uri"
  41907. },
  41908. "support": {
  41909. "type": "object",
  41910. "properties": {
  41911. "email": {
  41912. "type": "string",
  41913. "description": "Email address for support.",
  41914. "format": "email"
  41915. },
  41916. "issues": {
  41917. "type": "string",
  41918. "description": "URL to the issue tracker.",
  41919. "format": "uri"
  41920. },
  41921. "forum": {
  41922. "type": "string",
  41923. "description": "URL to the forum.",
  41924. "format": "uri"
  41925. },
  41926. "wiki": {
  41927. "type": "string",
  41928. "description": "URL to the wiki.",
  41929. "format": "uri"
  41930. },
  41931. "irc": {
  41932. "type": "string",
  41933. "description": "IRC channel for support, as irc://server/channel.",
  41934. "format": "uri"
  41935. },
  41936. "chat": {
  41937. "type": "string",
  41938. "description": "URL to the support chat.",
  41939. "format": "uri"
  41940. },
  41941. "source": {
  41942. "type": "string",
  41943. "description": "URL to browse or download the sources.",
  41944. "format": "uri"
  41945. },
  41946. "docs": {
  41947. "type": "string",
  41948. "description": "URL to the documentation.",
  41949. "format": "uri"
  41950. },
  41951. "rss": {
  41952. "type": "string",
  41953. "description": "URL to the RSS feed.",
  41954. "format": "uri"
  41955. },
  41956. "security": {
  41957. "type": "string",
  41958. "description": "URL to the vulnerability disclosure policy (VDP).",
  41959. "format": "uri"
  41960. }
  41961. }
  41962. },
  41963. "funding": {
  41964. "type": "array",
  41965. "description": "A list of options to fund the development and maintenance of the package.",
  41966. "items": {
  41967. "type": "object",
  41968. "properties": {
  41969. "type": {
  41970. "type": "string",
  41971. "description": "Type of funding or platform through which funding is possible."
  41972. },
  41973. "url": {
  41974. "type": "string",
  41975. "description": "URL to a website with details on funding and a way to fund the package.",
  41976. "format": "uri"
  41977. }
  41978. }
  41979. }
  41980. },
  41981. "source": {
  41982. "$ref": "#/definitions/source"
  41983. },
  41984. "dist": {
  41985. "$ref": "#/definitions/dist"
  41986. },
  41987. "_comment": {
  41988. "type": ["array", "string"],
  41989. "description": "A key to store comments in"
  41990. },
  41991. "require": {
  41992. "type": "object",
  41993. "description": "This is an object of package name (keys) and version constraints (values) that are required to run this package.",
  41994. "additionalProperties": {
  41995. "type": "string"
  41996. }
  41997. },
  41998. "require-dev": {
  41999. "type": "object",
  42000. "description": "This is an object of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  42001. "additionalProperties": {
  42002. "type": "string"
  42003. }
  42004. },
  42005. "replace": {
  42006. "type": "object",
  42007. "description": "This is an object of package name (keys) and version constraints (values) that can be replaced by this package.",
  42008. "additionalProperties": {
  42009. "type": "string"
  42010. }
  42011. },
  42012. "conflict": {
  42013. "type": "object",
  42014. "description": "This is an object of package name (keys) and version constraints (values) that conflict with this package.",
  42015. "additionalProperties": {
  42016. "type": "string"
  42017. }
  42018. },
  42019. "provide": {
  42020. "type": "object",
  42021. "description": "This is an object of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  42022. "additionalProperties": {
  42023. "type": "string"
  42024. }
  42025. },
  42026. "suggest": {
  42027. "type": "object",
  42028. "description": "This is an object of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  42029. "additionalProperties": {
  42030. "type": "string"
  42031. }
  42032. },
  42033. "repositories": {
  42034. "type": ["object", "array"],
  42035. "description": "A set of additional repositories where packages can be found.",
  42036. "additionalProperties": {
  42037. "anyOf": [
  42038. { "$ref": "#/definitions/repository" },
  42039. { "type": "boolean", "enum": [false] }
  42040. ]
  42041. },
  42042. "items": {
  42043. "anyOf": [
  42044. { "$ref": "#/definitions/repository" },
  42045. {
  42046. "type": "object",
  42047. "additionalProperties": { "type": "boolean", "enum": [false] },
  42048. "minProperties": 1,
  42049. "maxProperties": 1
  42050. }
  42051. ]
  42052. }
  42053. },
  42054. "minimum-stability": {
  42055. "type": ["string"],
  42056. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  42057. "enum": ["dev", "alpha", "beta", "rc", "RC", "stable"]
  42058. },
  42059. "prefer-stable": {
  42060. "type": ["boolean"],
  42061. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  42062. },
  42063. "autoload": {
  42064. "$ref": "#/definitions/autoload"
  42065. },
  42066. "autoload-dev": {
  42067. "type": "object",
  42068. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  42069. "properties": {
  42070. "psr-0": {
  42071. "type": "object",
  42072. "description": "This is an object of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  42073. "additionalProperties": {
  42074. "type": ["string", "array"],
  42075. "items": {
  42076. "type": "string"
  42077. }
  42078. }
  42079. },
  42080. "psr-4": {
  42081. "type": "object",
  42082. "description": "This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  42083. "additionalProperties": {
  42084. "type": ["string", "array"],
  42085. "items": {
  42086. "type": "string"
  42087. }
  42088. }
  42089. },
  42090. "classmap": {
  42091. "type": "array",
  42092. "description": "This is an array of paths that contain classes to be included in the class-map generation process."
  42093. },
  42094. "files": {
  42095. "type": "array",
  42096. "description": "This is an array of files that are always required on every request."
  42097. }
  42098. }
  42099. },
  42100. "target-dir": {
  42101. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  42102. "type": "string"
  42103. },
  42104. "include-path": {
  42105. "type": ["array"],
  42106. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  42107. "items": {
  42108. "type": "string"
  42109. }
  42110. },
  42111. "bin": {
  42112. "type": ["string", "array"],
  42113. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  42114. "items": {
  42115. "type": "string"
  42116. }
  42117. },
  42118. "archive": {
  42119. "type": ["object"],
  42120. "description": "Options for creating package archives for distribution.",
  42121. "properties": {
  42122. "name": {
  42123. "type": "string",
  42124. "description": "A base name for archive."
  42125. },
  42126. "exclude": {
  42127. "type": "array",
  42128. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  42129. }
  42130. }
  42131. },
  42132. "php-ext": {
  42133. "type": "object",
  42134. "description": "Settings for PHP extension packages.",
  42135. "properties": {
  42136. "extension-name": {
  42137. "type": "string",
  42138. "description": "If specified, this will be used as the name of the extension, where needed by tooling. If this is not specified, the extension name will be derived from the Composer package name (e.g. `vendor/name` would become `ext-name`). The extension name may be specified with or without the `ext-` prefix, and tools that use this must normalise this appropriately.",
  42139. "example": "ext-xdebug"
  42140. },
  42141. "priority": {
  42142. "type": "integer",
  42143. "description": "This is used to add a prefix to the INI file, e.g. `90-xdebug.ini` which affects the loading order. The priority is a number in the range 10-99 inclusive, with 10 being the highest priority (i.e. will be processed first), and 99 being the lowest priority (i.e. will be processed last). There are two digits so that the files sort correctly on any platform, whether the sorting is natural or not.",
  42144. "minimum": 10,
  42145. "maximum": 99,
  42146. "example": 80,
  42147. "default": 80
  42148. },
  42149. "support-zts": {
  42150. "type": "boolean",
  42151. "description": "Does this package support Zend Thread Safety",
  42152. "example": false,
  42153. "default": true
  42154. },
  42155. "support-nts": {
  42156. "type": "boolean",
  42157. "description": "Does this package support non-Thread Safe mode",
  42158. "example": false,
  42159. "default": true
  42160. },
  42161. "configure-options": {
  42162. "type": "array",
  42163. "description": "These configure options make up the flags that can be passed to ./configure when installing the extension.",
  42164. "items": {
  42165. "type": "object",
  42166. "required": ["name"],
  42167. "properties": {
  42168. "name": {
  42169. "type": "string",
  42170. "description": "The name of the flag, this would typically be prefixed with `--`, for example, the value 'the-flag' would be passed as `./configure --the-flag`.",
  42171. "example": "without-xdebug-compression",
  42172. "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-_]*$"
  42173. },
  42174. "needs-value": {
  42175. "type": "boolean",
  42176. "description": "If this is set to true, the flag needs a value (e.g. --with-somelib=<path>), otherwise it is a flag without a value (e.g. --enable-some-feature).",
  42177. "example": false,
  42178. "default": false
  42179. },
  42180. "description": {
  42181. "type": "string",
  42182. "description": "The description of what the flag does or means.",
  42183. "example": "Disable compression through zlib"
  42184. }
  42185. }
  42186. }
  42187. }
  42188. }
  42189. },
  42190. "config": {
  42191. "type": "object",
  42192. "description": "Composer options.",
  42193. "properties": {
  42194. "platform": {
  42195. "type": "object",
  42196. "description": "This is an object of package name (keys) and version (values) that will be used to mock the platform packages on this machine, the version can be set to false to make it appear like the package is not present.",
  42197. "additionalProperties": {
  42198. "type": ["string", "boolean"]
  42199. }
  42200. },
  42201. "allow-plugins": {
  42202. "type": ["object", "boolean"],
  42203. "description": "This is an object of {\"pattern\": true|false} with packages which are allowed to be loaded as plugins, or true to allow all, false to allow none. Defaults to {} which prompts when an unknown plugin is added.",
  42204. "additionalProperties": {
  42205. "type": ["boolean"]
  42206. }
  42207. },
  42208. "process-timeout": {
  42209. "type": "integer",
  42210. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  42211. },
  42212. "use-include-path": {
  42213. "type": "boolean",
  42214. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  42215. },
  42216. "use-parent-dir": {
  42217. "type": ["string", "boolean"],
  42218. "description": "When running Composer in a directory where there is no composer.json, if there is one present in a directory above Composer will by default ask you whether you want to use that directory's composer.json instead. One of: true (always use parent if needed), false (never ask or use it) or \"prompt\" (ask every time), defaults to prompt."
  42219. },
  42220. "preferred-install": {
  42221. "type": ["string", "object"],
  42222. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or an object of {\"pattern\": \"preference\"}.",
  42223. "additionalProperties": {
  42224. "type": ["string"]
  42225. }
  42226. },
  42227. "audit": {
  42228. "type": "object",
  42229. "description": "Security audit configuration options",
  42230. "properties": {
  42231. "ignore": {
  42232. "anyOf": [
  42233. {
  42234. "type": "object",
  42235. "description": "A list of advisory ids, remote ids or CVE ids (keys) and the explanations (values) for why they're being ignored. The listed items are reported but let the audit command pass.",
  42236. "additionalProperties": {
  42237. "type": ["string", "string"]
  42238. }
  42239. },
  42240. {
  42241. "type": "array",
  42242. "description": "A set of advisory ids, remote ids or CVE ids that are reported but let the audit command pass.",
  42243. "items": {
  42244. "type": "string"
  42245. }
  42246. }
  42247. ]
  42248. },
  42249. "abandoned": {
  42250. "enum": ["ignore", "report", "fail"],
  42251. "description": "Whether abandoned packages should be ignored, reported as problems or cause an audit failure."
  42252. }
  42253. }
  42254. },
  42255. "notify-on-install": {
  42256. "type": "boolean",
  42257. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  42258. },
  42259. "github-protocols": {
  42260. "type": "array",
  42261. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"https\", \"ssh\", \"git\"].",
  42262. "items": {
  42263. "type": "string"
  42264. }
  42265. },
  42266. "github-oauth": {
  42267. "type": "object",
  42268. "description": "An object of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  42269. "additionalProperties": {
  42270. "type": "string"
  42271. }
  42272. },
  42273. "gitlab-oauth": {
  42274. "type": "object",
  42275. "description": "An object of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":{\"expires-at\":\"<expiration date>\", \"refresh-token\":\"<refresh token>\", \"token\":\"<token>\"}}.",
  42276. "additionalProperties": {
  42277. "type": ["string", "object"],
  42278. "required": [ "token"],
  42279. "properties": {
  42280. "expires-at": {
  42281. "type": "integer",
  42282. "description": "The expiration date for this GitLab token"
  42283. },
  42284. "refresh-token": {
  42285. "type": "string",
  42286. "description": "The refresh token used for GitLab authentication"
  42287. },
  42288. "token": {
  42289. "type": "string",
  42290. "description": "The token used for GitLab authentication"
  42291. }
  42292. }
  42293. }
  42294. },
  42295. "gitlab-token": {
  42296. "type": "object",
  42297. "description": "An object of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}, or an object with username and token keys.",
  42298. "additionalProperties": {
  42299. "type": ["string", "object"],
  42300. "required": ["username", "token"],
  42301. "properties": {
  42302. "username": {
  42303. "type": "string",
  42304. "description": "The username used for GitLab authentication"
  42305. },
  42306. "token": {
  42307. "type": "string",
  42308. "description": "The token used for GitLab authentication"
  42309. }
  42310. }
  42311. }
  42312. },
  42313. "gitlab-protocol": {
  42314. "enum": ["git", "http", "https"],
  42315. "description": "A protocol to force use of when creating a repository URL for the `source` value of the package metadata. One of `git` or `http`. By default, Composer will generate a git URL for private repositories and http one for public repos."
  42316. },
  42317. "bearer": {
  42318. "type": "object",
  42319. "description": "An object of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
  42320. "additionalProperties": {
  42321. "type": "string"
  42322. }
  42323. },
  42324. "disable-tls": {
  42325. "type": "boolean",
  42326. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  42327. },
  42328. "secure-http": {
  42329. "type": "boolean",
  42330. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  42331. },
  42332. "secure-svn-domains": {
  42333. "type": "array",
  42334. "description": "A list of domains which should be trusted/marked as using a secure Subversion/SVN transport. By default svn:// protocol is seen as insecure and will throw. This is a better/safer alternative to disabling `secure-http` altogether.",
  42335. "items": {
  42336. "type": "string"
  42337. }
  42338. },
  42339. "cafile": {
  42340. "type": "string",
  42341. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  42342. },
  42343. "capath": {
  42344. "type": "string",
  42345. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  42346. },
  42347. "http-basic": {
  42348. "type": "object",
  42349. "description": "An object of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  42350. "additionalProperties": {
  42351. "type": "object",
  42352. "required": ["username", "password"],
  42353. "properties": {
  42354. "username": {
  42355. "type": "string",
  42356. "description": "The username used for HTTP Basic authentication"
  42357. },
  42358. "password": {
  42359. "type": "string",
  42360. "description": "The password used for HTTP Basic authentication"
  42361. }
  42362. }
  42363. }
  42364. },
  42365. "store-auths": {
  42366. "type": ["string", "boolean"],
  42367. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  42368. },
  42369. "vendor-dir": {
  42370. "type": "string",
  42371. "description": "The location where all packages are installed, defaults to \"vendor\"."
  42372. },
  42373. "bin-dir": {
  42374. "type": "string",
  42375. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  42376. },
  42377. "data-dir": {
  42378. "type": "string",
  42379. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  42380. },
  42381. "cache-dir": {
  42382. "type": "string",
  42383. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  42384. },
  42385. "cache-files-dir": {
  42386. "type": "string",
  42387. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  42388. },
  42389. "cache-repo-dir": {
  42390. "type": "string",
  42391. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  42392. },
  42393. "cache-vcs-dir": {
  42394. "type": "string",
  42395. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  42396. },
  42397. "cache-ttl": {
  42398. "type": "integer",
  42399. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  42400. },
  42401. "cache-files-ttl": {
  42402. "type": "integer",
  42403. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  42404. },
  42405. "cache-files-maxsize": {
  42406. "type": ["string", "integer"],
  42407. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  42408. },
  42409. "cache-read-only": {
  42410. "type": ["boolean"],
  42411. "description": "Whether to use the Composer cache in read-only mode."
  42412. },
  42413. "bin-compat": {
  42414. "enum": ["auto", "full", "proxy", "symlink"],
  42415. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed), can be \"full\" (compatible with both Windows and Unix-based systems) and \"proxy\" (only bash-style proxy)."
  42416. },
  42417. "discard-changes": {
  42418. "type": ["string", "boolean"],
  42419. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  42420. },
  42421. "autoloader-suffix": {
  42422. "type": "string",
  42423. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  42424. },
  42425. "optimize-autoloader": {
  42426. "type": "boolean",
  42427. "description": "Always optimize when dumping the autoloader."
  42428. },
  42429. "prepend-autoloader": {
  42430. "type": "boolean",
  42431. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  42432. },
  42433. "classmap-authoritative": {
  42434. "type": "boolean",
  42435. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  42436. },
  42437. "apcu-autoloader": {
  42438. "type": "boolean",
  42439. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  42440. },
  42441. "github-domains": {
  42442. "type": "array",
  42443. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  42444. "items": {
  42445. "type": "string"
  42446. }
  42447. },
  42448. "github-expose-hostname": {
  42449. "type": "boolean",
  42450. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  42451. },
  42452. "gitlab-domains": {
  42453. "type": "array",
  42454. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  42455. "items": {
  42456. "type": "string"
  42457. }
  42458. },
  42459. "bitbucket-oauth": {
  42460. "type": "object",
  42461. "description": "An object of domain name => {\"consumer-key\": \"...\", \"consumer-secret\": \"...\"}.",
  42462. "additionalProperties": {
  42463. "type": "object",
  42464. "required": ["consumer-key", "consumer-secret"],
  42465. "properties": {
  42466. "consumer-key": {
  42467. "type": "string",
  42468. "description": "The consumer-key used for OAuth authentication"
  42469. },
  42470. "consumer-secret": {
  42471. "type": "string",
  42472. "description": "The consumer-secret used for OAuth authentication"
  42473. },
  42474. "access-token": {
  42475. "type": "string",
  42476. "description": "The OAuth token retrieved from Bitbucket's API, this is written by Composer and you should not set it nor modify it."
  42477. },
  42478. "access-token-expiration": {
  42479. "type": "integer",
  42480. "description": "The generated token's expiration timestamp, this is written by Composer and you should not set it nor modify it."
  42481. }
  42482. }
  42483. }
  42484. },
  42485. "use-github-api": {
  42486. "type": "boolean",
  42487. "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
  42488. },
  42489. "archive-format": {
  42490. "type": "string",
  42491. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  42492. },
  42493. "archive-dir": {
  42494. "type": "string",
  42495. "description": "The default archive path when not provided on cli, defaults to \".\"."
  42496. },
  42497. "htaccess-protect": {
  42498. "type": "boolean",
  42499. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  42500. },
  42501. "sort-packages": {
  42502. "type": "boolean",
  42503. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  42504. },
  42505. "lock": {
  42506. "type": "boolean",
  42507. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  42508. },
  42509. "platform-check": {
  42510. "type": ["boolean", "string"],
  42511. "description": "Defaults to \"php-only\" which checks only the PHP version. Setting to true will also check the presence of required PHP extensions. If set to false, Composer will not create and require a platform_check.php file as part of the autoloader bootstrap."
  42512. },
  42513. "bump-after-update": {
  42514. "type": ["string", "boolean"],
  42515. "description": "Defaults to false and can be any of true, false, \"dev\"` or \"no-dev\"`. If set to true, Composer will run the bump command after running the update command. If set to \"dev\" or \"no-dev\" then only the corresponding dependencies will be bumped."
  42516. },
  42517. "allow-missing-requirements": {
  42518. "type": ["boolean"],
  42519. "description": "Defaults to false. If set to true, Composer will allow install when lock file is not up to date with the latest changes in composer.json."
  42520. }
  42521. }
  42522. },
  42523. "extra": {
  42524. "type": ["object", "array"],
  42525. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  42526. "additionalProperties": true
  42527. },
  42528. "scripts": {
  42529. "type": ["object"],
  42530. "description": "Script listeners that will be executed before/after some events.",
  42531. "properties": {
  42532. "pre-install-cmd": {
  42533. "type": ["array", "string"],
  42534. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  42535. },
  42536. "post-install-cmd": {
  42537. "type": ["array", "string"],
  42538. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  42539. },
  42540. "pre-update-cmd": {
  42541. "type": ["array", "string"],
  42542. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  42543. },
  42544. "post-update-cmd": {
  42545. "type": ["array", "string"],
  42546. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  42547. },
  42548. "pre-status-cmd": {
  42549. "type": ["array", "string"],
  42550. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  42551. },
  42552. "post-status-cmd": {
  42553. "type": ["array", "string"],
  42554. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  42555. },
  42556. "pre-package-install": {
  42557. "type": ["array", "string"],
  42558. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  42559. },
  42560. "post-package-install": {
  42561. "type": ["array", "string"],
  42562. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  42563. },
  42564. "pre-package-update": {
  42565. "type": ["array", "string"],
  42566. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  42567. },
  42568. "post-package-update": {
  42569. "type": ["array", "string"],
  42570. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  42571. },
  42572. "pre-package-uninstall": {
  42573. "type": ["array", "string"],
  42574. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  42575. },
  42576. "post-package-uninstall": {
  42577. "type": ["array", "string"],
  42578. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  42579. },
  42580. "pre-autoload-dump": {
  42581. "type": ["array", "string"],
  42582. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  42583. },
  42584. "post-autoload-dump": {
  42585. "type": ["array", "string"],
  42586. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  42587. },
  42588. "post-root-package-install": {
  42589. "type": ["array", "string"],
  42590. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  42591. },
  42592. "post-create-project-cmd": {
  42593. "type": ["array", "string"],
  42594. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  42595. }
  42596. }
  42597. },
  42598. "scripts-descriptions": {
  42599. "type": ["object"],
  42600. "description": "Descriptions for custom commands, shown in console help.",
  42601. "additionalProperties": {
  42602. "type": "string"
  42603. }
  42604. },
  42605. "scripts-aliases": {
  42606. "type": ["object"],
  42607. "description": "Aliases for custom commands.",
  42608. "additionalProperties": {
  42609. "type": "array"
  42610. }
  42611. }
  42612. },
  42613. "definitions": {
  42614. "authors": {
  42615. "type": "array",
  42616. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  42617. "items": {
  42618. "type": "object",
  42619. "additionalProperties": false,
  42620. "required": [ "name"],
  42621. "properties": {
  42622. "name": {
  42623. "type": "string",
  42624. "description": "Full name of the author."
  42625. },
  42626. "email": {
  42627. "type": "string",
  42628. "description": "Email address of the author.",
  42629. "format": "email"
  42630. },
  42631. "homepage": {
  42632. "type": "string",
  42633. "description": "Homepage URL for the author.",
  42634. "format": "uri"
  42635. },
  42636. "role": {
  42637. "type": "string",
  42638. "description": "Author's role in the project."
  42639. }
  42640. }
  42641. }
  42642. },
  42643. "autoload": {
  42644. "type": "object",
  42645. "description": "Description of how the package can be autoloaded.",
  42646. "properties": {
  42647. "psr-0": {
  42648. "type": "object",
  42649. "description": "This is an object of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  42650. "additionalProperties": {
  42651. "type": ["string", "array"],
  42652. "items": {
  42653. "type": "string"
  42654. }
  42655. }
  42656. },
  42657. "psr-4": {
  42658. "type": "object",
  42659. "description": "This is an object of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  42660. "additionalProperties": {
  42661. "type": ["string", "array"],
  42662. "items": {
  42663. "type": "string"
  42664. }
  42665. }
  42666. },
  42667. "classmap": {
  42668. "type": "array",
  42669. "description": "This is an array of paths that contain classes to be included in the class-map generation process."
  42670. },
  42671. "files": {
  42672. "type": "array",
  42673. "description": "This is an array of files that are always required on every request."
  42674. },
  42675. "exclude-from-classmap": {
  42676. "type": "array",
  42677. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  42678. }
  42679. }
  42680. },
  42681. "repository": {
  42682. "type": "object",
  42683. "anyOf": [
  42684. { "$ref": "#/definitions/composer-repository" },
  42685. { "$ref": "#/definitions/vcs-repository" },
  42686. { "$ref": "#/definitions/path-repository" },
  42687. { "$ref": "#/definitions/artifact-repository" },
  42688. { "$ref": "#/definitions/pear-repository" },
  42689. { "$ref": "#/definitions/package-repository" }
  42690. ]
  42691. },
  42692. "composer-repository": {
  42693. "type": "object",
  42694. "required": ["type", "url"],
  42695. "properties": {
  42696. "type": { "type": "string", "enum": ["composer"] },
  42697. "url": { "type": "string" },
  42698. "canonical": { "type": "boolean" },
  42699. "only": {
  42700. "type": "array",
  42701. "items": {
  42702. "type": "string"
  42703. }
  42704. },
  42705. "exclude": {
  42706. "type": "array",
  42707. "items": {
  42708. "type": "string"
  42709. }
  42710. },
  42711. "options": {
  42712. "type": "object",
  42713. "additionalProperties": true
  42714. },
  42715. "allow_ssl_downgrade": { "type": "boolean" },
  42716. "force-lazy-providers": { "type": "boolean" }
  42717. }
  42718. },
  42719. "vcs-repository": {
  42720. "type": "object",
  42721. "required": ["type", "url"],
  42722. "properties": {
  42723. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "bitbucket", "git-bitbucket", "hg", "fossil", "perforce", "svn"] },
  42724. "url": { "type": "string" },
  42725. "canonical": { "type": "boolean" },
  42726. "only": {
  42727. "type": "array",
  42728. "items": {
  42729. "type": "string"
  42730. }
  42731. },
  42732. "exclude": {
  42733. "type": "array",
  42734. "items": {
  42735. "type": "string"
  42736. }
  42737. },
  42738. "no-api": { "type": "boolean" },
  42739. "secure-http": { "type": "boolean" },
  42740. "svn-cache-credentials": { "type": "boolean" },
  42741. "trunk-path": { "type": ["string", "boolean"] },
  42742. "branches-path": { "type": ["string", "boolean"] },
  42743. "tags-path": { "type": ["string", "boolean"] },
  42744. "package-path": { "type": "string" },
  42745. "depot": { "type": "string" },
  42746. "branch": { "type": "string" },
  42747. "unique_perforce_client_name": { "type": "string" },
  42748. "p4user": { "type": "string" },
  42749. "p4password": { "type": "string" }
  42750. }
  42751. },
  42752. "path-repository": {
  42753. "type": "object",
  42754. "required": ["type", "url"],
  42755. "properties": {
  42756. "type": { "type": "string", "enum": ["path"] },
  42757. "url": { "type": "string" },
  42758. "canonical": { "type": "boolean" },
  42759. "only": {
  42760. "type": "array",
  42761. "items": {
  42762. "type": "string"
  42763. }
  42764. },
  42765. "exclude": {
  42766. "type": "array",
  42767. "items": {
  42768. "type": "string"
  42769. }
  42770. },
  42771. "options": {
  42772. "type": "object",
  42773. "properties": {
  42774. "symlink": { "type": ["boolean", "null"] }
  42775. },
  42776. "additionalProperties": true
  42777. }
  42778. }
  42779. },
  42780. "artifact-repository": {
  42781. "type": "object",
  42782. "required": ["type", "url"],
  42783. "properties": {
  42784. "type": { "type": "string", "enum": ["artifact"] },
  42785. "url": { "type": "string" },
  42786. "canonical": { "type": "boolean" },
  42787. "only": {
  42788. "type": "array",
  42789. "items": {
  42790. "type": "string"
  42791. }
  42792. },
  42793. "exclude": {
  42794. "type": "array",
  42795. "items": {
  42796. "type": "string"
  42797. }
  42798. }
  42799. }
  42800. },
  42801. "pear-repository": {
  42802. "type": "object",
  42803. "required": ["type", "url"],
  42804. "properties": {
  42805. "type": { "type": "string", "enum": ["pear"] },
  42806. "url": { "type": "string" },
  42807. "canonical": { "type": "boolean" },
  42808. "only": {
  42809. "type": "array",
  42810. "items": {
  42811. "type": "string"
  42812. }
  42813. },
  42814. "exclude": {
  42815. "type": "array",
  42816. "items": {
  42817. "type": "string"
  42818. }
  42819. },
  42820. "vendor-alias": { "type": "string" }
  42821. }
  42822. },
  42823. "package-repository": {
  42824. "type": "object",
  42825. "required": ["type", "package"],
  42826. "properties": {
  42827. "type": { "type": "string", "enum": ["package"] },
  42828. "canonical": { "type": "boolean" },
  42829. "only": {
  42830. "type": "array",
  42831. "items": {
  42832. "type": "string"
  42833. }
  42834. },
  42835. "exclude": {
  42836. "type": "array",
  42837. "items": {
  42838. "type": "string"
  42839. }
  42840. },
  42841. "package": {
  42842. "oneOf": [
  42843. { "$ref": "#/definitions/inline-package" },
  42844. {
  42845. "type": "array",
  42846. "items": { "$ref": "#/definitions/inline-package" }
  42847. }
  42848. ]
  42849. }
  42850. }
  42851. },
  42852. "inline-package": {
  42853. "type": "object",
  42854. "required": ["name", "version"],
  42855. "properties": {
  42856. "name": {
  42857. "type": "string",
  42858. "description": "Package name, including 'vendor-name/' prefix."
  42859. },
  42860. "type": {
  42861. "type": "string"
  42862. },
  42863. "target-dir": {
  42864. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  42865. "type": "string"
  42866. },
  42867. "description": {
  42868. "type": "string"
  42869. },
  42870. "keywords": {
  42871. "type": "array",
  42872. "items": {
  42873. "type": "string"
  42874. }
  42875. },
  42876. "homepage": {
  42877. "type": "string",
  42878. "format": "uri"
  42879. },
  42880. "version": {
  42881. "type": "string"
  42882. },
  42883. "time": {
  42884. "type": "string"
  42885. },
  42886. "license": {
  42887. "type": [
  42888. "string",
  42889. "array"
  42890. ]
  42891. },
  42892. "authors": {
  42893. "$ref": "#/definitions/authors"
  42894. },
  42895. "require": {
  42896. "type": "object",
  42897. "additionalProperties": {
  42898. "type": "string"
  42899. }
  42900. },
  42901. "replace": {
  42902. "type": "object",
  42903. "additionalProperties": {
  42904. "type": "string"
  42905. }
  42906. },
  42907. "conflict": {
  42908. "type": "object",
  42909. "additionalProperties": {
  42910. "type": "string"
  42911. }
  42912. },
  42913. "provide": {
  42914. "type": "object",
  42915. "additionalProperties": {
  42916. "type": "string"
  42917. }
  42918. },
  42919. "require-dev": {
  42920. "type": "object",
  42921. "additionalProperties": {
  42922. "type": "string"
  42923. }
  42924. },
  42925. "suggest": {
  42926. "type": "object",
  42927. "additionalProperties": {
  42928. "type": "string"
  42929. }
  42930. },
  42931. "extra": {
  42932. "type": ["object", "array"],
  42933. "additionalProperties": true
  42934. },
  42935. "autoload": {
  42936. "$ref": "#/definitions/autoload"
  42937. },
  42938. "archive": {
  42939. "type": ["object"],
  42940. "properties": {
  42941. "exclude": {
  42942. "type": "array"
  42943. }
  42944. }
  42945. },
  42946. "bin": {
  42947. "type": ["string", "array"],
  42948. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  42949. "items": {
  42950. "type": "string"
  42951. }
  42952. },
  42953. "include-path": {
  42954. "type": ["array"],
  42955. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  42956. "items": {
  42957. "type": "string"
  42958. }
  42959. },
  42960. "source": {
  42961. "$ref": "#/definitions/source"
  42962. },
  42963. "dist": {
  42964. "$ref": "#/definitions/dist"
  42965. }
  42966. },
  42967. "additionalProperties": true
  42968. },
  42969. "source": {
  42970. "type": "object",
  42971. "required": ["type", "url", "reference"],
  42972. "properties": {
  42973. "type": {
  42974. "type": "string"
  42975. },
  42976. "url": {
  42977. "type": "string"
  42978. },
  42979. "reference": {
  42980. "type": "string"
  42981. },
  42982. "mirrors": {
  42983. "type": "array"
  42984. }
  42985. }
  42986. },
  42987. "dist": {
  42988. "type": "object",
  42989. "required": ["type", "url"],
  42990. "properties": {
  42991. "type": {
  42992. "type": "string"
  42993. },
  42994. "url": {
  42995. "type": "string"
  42996. },
  42997. "reference": {
  42998. "type": "string"
  42999. },
  43000. "shasum": {
  43001. "type": "string"
  43002. },
  43003. "mirrors": {
  43004. "type": "array"
  43005. }
  43006. }
  43007. }
  43008. }
  43009. }
  43010. <?php
  43011. if (PHP_VERSION_ID < 50600) {
  43012. if (!headers_sent()) {
  43013. header('HTTP/1.1 500 Internal Server Error');
  43014. }
  43015. $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  43016. if (!ini_get('display_errors')) {
  43017. if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
  43018. fwrite(STDERR, $err);
  43019. } elseif (!headers_sent()) {
  43020. echo $err;
  43021. }
  43022. }
  43023. trigger_error(
  43024. $err,
  43025. E_USER_ERROR
  43026. );
  43027. }
  43028. require_once __DIR__ . '/composer/autoload_real.php';
  43029. return ComposerAutoloaderInitComposerPhar1731845584::getLoader();
  43030. <?php
  43031. namespace Composer\Autoload;
  43032. class ClassLoader
  43033. {
  43034. private static $includeFile;
  43035. private $vendorDir;
  43036. private $prefixLengthsPsr4 = array();
  43037. private $prefixDirsPsr4 = array();
  43038. private $fallbackDirsPsr4 = array();
  43039. private $prefixesPsr0 = array();
  43040. private $fallbackDirsPsr0 = array();
  43041. private $useIncludePath = false;
  43042. private $classMap = array();
  43043. private $classMapAuthoritative = false;
  43044. private $missingClasses = array();
  43045. private $apcuPrefix;
  43046. private static $registeredLoaders = array();
  43047. public function __construct($vendorDir = null)
  43048. {
  43049. $this->vendorDir = $vendorDir;
  43050. self::initializeIncludeClosure();
  43051. }
  43052. public function getPrefixes()
  43053. {
  43054. if (!empty($this->prefixesPsr0)) {
  43055. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  43056. }
  43057. return array();
  43058. }
  43059. public function getPrefixesPsr4()
  43060. {
  43061. return $this->prefixDirsPsr4;
  43062. }
  43063. public function getFallbackDirs()
  43064. {
  43065. return $this->fallbackDirsPsr0;
  43066. }
  43067. public function getFallbackDirsPsr4()
  43068. {
  43069. return $this->fallbackDirsPsr4;
  43070. }
  43071. public function getClassMap()
  43072. {
  43073. return $this->classMap;
  43074. }
  43075. public function addClassMap(array $classMap)
  43076. {
  43077. if ($this->classMap) {
  43078. $this->classMap = array_merge($this->classMap, $classMap);
  43079. } else {
  43080. $this->classMap = $classMap;
  43081. }
  43082. }
  43083. public function add($prefix, $paths, $prepend = false)
  43084. {
  43085. $paths = (array) $paths;
  43086. if (!$prefix) {
  43087. if ($prepend) {
  43088. $this->fallbackDirsPsr0 = array_merge(
  43089. $paths,
  43090. $this->fallbackDirsPsr0
  43091. );
  43092. } else {
  43093. $this->fallbackDirsPsr0 = array_merge(
  43094. $this->fallbackDirsPsr0,
  43095. $paths
  43096. );
  43097. }
  43098. return;
  43099. }
  43100. $first = $prefix[0];
  43101. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  43102. $this->prefixesPsr0[$first][$prefix] = $paths;
  43103. return;
  43104. }
  43105. if ($prepend) {
  43106. $this->prefixesPsr0[$first][$prefix] = array_merge(
  43107. $paths,
  43108. $this->prefixesPsr0[$first][$prefix]
  43109. );
  43110. } else {
  43111. $this->prefixesPsr0[$first][$prefix] = array_merge(
  43112. $this->prefixesPsr0[$first][$prefix],
  43113. $paths
  43114. );
  43115. }
  43116. }
  43117. public function addPsr4($prefix, $paths, $prepend = false)
  43118. {
  43119. $paths = (array) $paths;
  43120. if (!$prefix) {
  43121. if ($prepend) {
  43122. $this->fallbackDirsPsr4 = array_merge(
  43123. $paths,
  43124. $this->fallbackDirsPsr4
  43125. );
  43126. } else {
  43127. $this->fallbackDirsPsr4 = array_merge(
  43128. $this->fallbackDirsPsr4,
  43129. $paths
  43130. );
  43131. }
  43132. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  43133. $length = strlen($prefix);
  43134. if ('\\' !== $prefix[$length - 1]) {
  43135. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  43136. }
  43137. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  43138. $this->prefixDirsPsr4[$prefix] = $paths;
  43139. } elseif ($prepend) {
  43140. $this->prefixDirsPsr4[$prefix] = array_merge(
  43141. $paths,
  43142. $this->prefixDirsPsr4[$prefix]
  43143. );
  43144. } else {
  43145. $this->prefixDirsPsr4[$prefix] = array_merge(
  43146. $this->prefixDirsPsr4[$prefix],
  43147. $paths
  43148. );
  43149. }
  43150. }
  43151. public function set($prefix, $paths)
  43152. {
  43153. if (!$prefix) {
  43154. $this->fallbackDirsPsr0 = (array) $paths;
  43155. } else {
  43156. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  43157. }
  43158. }
  43159. public function setPsr4($prefix, $paths)
  43160. {
  43161. if (!$prefix) {
  43162. $this->fallbackDirsPsr4 = (array) $paths;
  43163. } else {
  43164. $length = strlen($prefix);
  43165. if ('\\' !== $prefix[$length - 1]) {
  43166. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  43167. }
  43168. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  43169. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  43170. }
  43171. }
  43172. public function setUseIncludePath($useIncludePath)
  43173. {
  43174. $this->useIncludePath = $useIncludePath;
  43175. }
  43176. public function getUseIncludePath()
  43177. {
  43178. return $this->useIncludePath;
  43179. }
  43180. public function setClassMapAuthoritative($classMapAuthoritative)
  43181. {
  43182. $this->classMapAuthoritative = $classMapAuthoritative;
  43183. }
  43184. public function isClassMapAuthoritative()
  43185. {
  43186. return $this->classMapAuthoritative;
  43187. }
  43188. public function setApcuPrefix($apcuPrefix)
  43189. {
  43190. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  43191. }
  43192. public function getApcuPrefix()
  43193. {
  43194. return $this->apcuPrefix;
  43195. }
  43196. public function register($prepend = false)
  43197. {
  43198. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  43199. if (null === $this->vendorDir) {
  43200. return;
  43201. }
  43202. if ($prepend) {
  43203. self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
  43204. } else {
  43205. unset(self::$registeredLoaders[$this->vendorDir]);
  43206. self::$registeredLoaders[$this->vendorDir] = $this;
  43207. }
  43208. }
  43209. public function unregister()
  43210. {
  43211. spl_autoload_unregister(array($this, 'loadClass'));
  43212. if (null !== $this->vendorDir) {
  43213. unset(self::$registeredLoaders[$this->vendorDir]);
  43214. }
  43215. }
  43216. public function loadClass($class)
  43217. {
  43218. if ($file = $this->findFile($class)) {
  43219. $includeFile = self::$includeFile;
  43220. $includeFile($file);
  43221. return true;
  43222. }
  43223. return null;
  43224. }
  43225. public function findFile($class)
  43226. {
  43227. if (isset($this->classMap[$class])) {
  43228. return $this->classMap[$class];
  43229. }
  43230. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  43231. return false;
  43232. }
  43233. if (null !== $this->apcuPrefix) {
  43234. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  43235. if ($hit) {
  43236. return $file;
  43237. }
  43238. }
  43239. $file = $this->findFileWithExtension($class, '.php');
  43240. if (false === $file && defined('HHVM_VERSION')) {
  43241. $file = $this->findFileWithExtension($class, '.hh');
  43242. }
  43243. if (null !== $this->apcuPrefix) {
  43244. apcu_add($this->apcuPrefix.$class, $file);
  43245. }
  43246. if (false === $file) {
  43247. $this->missingClasses[$class] = true;
  43248. }
  43249. return $file;
  43250. }
  43251. public static function getRegisteredLoaders()
  43252. {
  43253. return self::$registeredLoaders;
  43254. }
  43255. private function findFileWithExtension($class, $ext)
  43256. {
  43257. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  43258. $first = $class[0];
  43259. if (isset($this->prefixLengthsPsr4[$first])) {
  43260. $subPath = $class;
  43261. while (false !== $lastPos = strrpos($subPath, '\\')) {
  43262. $subPath = substr($subPath, 0, $lastPos);
  43263. $search = $subPath . '\\';
  43264. if (isset($this->prefixDirsPsr4[$search])) {
  43265. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  43266. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  43267. if (file_exists($file = $dir . $pathEnd)) {
  43268. return $file;
  43269. }
  43270. }
  43271. }
  43272. }
  43273. }
  43274. foreach ($this->fallbackDirsPsr4 as $dir) {
  43275. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  43276. return $file;
  43277. }
  43278. }
  43279. if (false !== $pos = strrpos($class, '\\')) {
  43280. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  43281. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  43282. } else {
  43283. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  43284. }
  43285. if (isset($this->prefixesPsr0[$first])) {
  43286. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  43287. if (0 === strpos($class, $prefix)) {
  43288. foreach ($dirs as $dir) {
  43289. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  43290. return $file;
  43291. }
  43292. }
  43293. }
  43294. }
  43295. }
  43296. foreach ($this->fallbackDirsPsr0 as $dir) {
  43297. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  43298. return $file;
  43299. }
  43300. }
  43301. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  43302. return $file;
  43303. }
  43304. return false;
  43305. }
  43306. private static function initializeIncludeClosure()
  43307. {
  43308. if (self::$includeFile !== null) {
  43309. return;
  43310. }
  43311. self::$includeFile = \Closure::bind(static function($file) {
  43312. include $file;
  43313. }, null, null);
  43314. }
  43315. }
  43316. <?php
  43317. namespace Composer;
  43318. use Composer\Autoload\ClassLoader;
  43319. use Composer\Semver\VersionParser;
  43320. class InstalledVersions
  43321. {
  43322. private static $installed;
  43323. private static $canGetVendors;
  43324. private static $installedByVendor = array();
  43325. public static function getInstalledPackages()
  43326. {
  43327. $packages = array();
  43328. foreach (self::getInstalled() as $installed) {
  43329. $packages[] = array_keys($installed['versions']);
  43330. }
  43331. if (1 === \count($packages)) {
  43332. return $packages[0];
  43333. }
  43334. return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
  43335. }
  43336. public static function getInstalledPackagesByType($type)
  43337. {
  43338. $packagesByType = array();
  43339. foreach (self::getInstalled() as $installed) {
  43340. foreach ($installed['versions'] as $name => $package) {
  43341. if (isset($package['type']) && $package['type'] === $type) {
  43342. $packagesByType[] = $name;
  43343. }
  43344. }
  43345. }
  43346. return $packagesByType;
  43347. }
  43348. public static function isInstalled($packageName, $includeDevRequirements = true)
  43349. {
  43350. foreach (self::getInstalled() as $installed) {
  43351. if (isset($installed['versions'][$packageName])) {
  43352. return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
  43353. }
  43354. }
  43355. return false;
  43356. }
  43357. public static function satisfies(VersionParser $parser, $packageName, $constraint)
  43358. {
  43359. $constraint = $parser->parseConstraints((string) $constraint);
  43360. $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
  43361. return $provided->matches($constraint);
  43362. }
  43363. public static function getVersionRanges($packageName)
  43364. {
  43365. foreach (self::getInstalled() as $installed) {
  43366. if (!isset($installed['versions'][$packageName])) {
  43367. continue;
  43368. }
  43369. $ranges = array();
  43370. if (isset($installed['versions'][$packageName]['pretty_version'])) {
  43371. $ranges[] = $installed['versions'][$packageName]['pretty_version'];
  43372. }
  43373. if (array_key_exists('aliases', $installed['versions'][$packageName])) {
  43374. $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
  43375. }
  43376. if (array_key_exists('replaced', $installed['versions'][$packageName])) {
  43377. $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
  43378. }
  43379. if (array_key_exists('provided', $installed['versions'][$packageName])) {
  43380. $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
  43381. }
  43382. return implode(' || ', $ranges);
  43383. }
  43384. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  43385. }
  43386. public static function getVersion($packageName)
  43387. {
  43388. foreach (self::getInstalled() as $installed) {
  43389. if (!isset($installed['versions'][$packageName])) {
  43390. continue;
  43391. }
  43392. if (!isset($installed['versions'][$packageName]['version'])) {
  43393. return null;
  43394. }
  43395. return $installed['versions'][$packageName]['version'];
  43396. }
  43397. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  43398. }
  43399. public static function getPrettyVersion($packageName)
  43400. {
  43401. foreach (self::getInstalled() as $installed) {
  43402. if (!isset($installed['versions'][$packageName])) {
  43403. continue;
  43404. }
  43405. if (!isset($installed['versions'][$packageName]['pretty_version'])) {
  43406. return null;
  43407. }
  43408. return $installed['versions'][$packageName]['pretty_version'];
  43409. }
  43410. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  43411. }
  43412. public static function getReference($packageName)
  43413. {
  43414. foreach (self::getInstalled() as $installed) {
  43415. if (!isset($installed['versions'][$packageName])) {
  43416. continue;
  43417. }
  43418. if (!isset($installed['versions'][$packageName]['reference'])) {
  43419. return null;
  43420. }
  43421. return $installed['versions'][$packageName]['reference'];
  43422. }
  43423. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  43424. }
  43425. public static function getInstallPath($packageName)
  43426. {
  43427. foreach (self::getInstalled() as $installed) {
  43428. if (!isset($installed['versions'][$packageName])) {
  43429. continue;
  43430. }
  43431. return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
  43432. }
  43433. throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
  43434. }
  43435. public static function getRootPackage()
  43436. {
  43437. $installed = self::getInstalled();
  43438. return $installed[0]['root'];
  43439. }
  43440. public static function getRawData()
  43441. {
  43442. @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
  43443. if (null === self::$installed) {
  43444. if (substr(__DIR__, -8, 1) !== 'C') {
  43445. self::$installed = include __DIR__ . '/installed.php';
  43446. } else {
  43447. self::$installed = array();
  43448. }
  43449. }
  43450. return self::$installed;
  43451. }
  43452. public static function getAllRawData()
  43453. {
  43454. return self::getInstalled();
  43455. }
  43456. public static function reload($data)
  43457. {
  43458. self::$installed = $data;
  43459. self::$installedByVendor = array();
  43460. }
  43461. private static function getInstalled()
  43462. {
  43463. if (null === self::$canGetVendors) {
  43464. self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
  43465. }
  43466. $installed = array();
  43467. if (self::$canGetVendors) {
  43468. foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
  43469. if (isset(self::$installedByVendor[$vendorDir])) {
  43470. $installed[] = self::$installedByVendor[$vendorDir];
  43471. } elseif (is_file($vendorDir.'/composer/installed.php')) {
  43472. $required = require $vendorDir.'/composer/installed.php';
  43473. $installed[] = self::$installedByVendor[$vendorDir] = $required;
  43474. if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
  43475. self::$installed = $installed[count($installed) - 1];
  43476. }
  43477. }
  43478. }
  43479. }
  43480. if (null === self::$installed) {
  43481. if (substr(__DIR__, -8, 1) !== 'C') {
  43482. $required = require __DIR__ . '/installed.php';
  43483. self::$installed = $required;
  43484. } else {
  43485. self::$installed = array();
  43486. }
  43487. }
  43488. if (self::$installed !== array()) {
  43489. $installed[] = self::$installed;
  43490. }
  43491. return $installed;
  43492. }
  43493. }
  43494. <?php
  43495. $vendorDir = dirname(__DIR__);
  43496. $baseDir = dirname($vendorDir);
  43497. return array(
  43498. 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
  43499. 'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',
  43500. 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
  43501. 'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
  43502. 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
  43503. 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
  43504. 'ReturnTypeWillChange' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php',
  43505. 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
  43506. 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
  43507. 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
  43508. );
  43509. <?php
  43510. $vendorDir = dirname(__DIR__);
  43511. $baseDir = dirname($vendorDir);
  43512. return array(
  43513. 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
  43514. '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
  43515. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  43516. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  43517. '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
  43518. 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
  43519. '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
  43520. 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
  43521. 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
  43522. '23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
  43523. );
  43524. <?php
  43525. $vendorDir = dirname(__DIR__);
  43526. $baseDir = dirname($vendorDir);
  43527. return array(
  43528. );
  43529. <?php
  43530. $vendorDir = dirname(__DIR__);
  43531. $baseDir = dirname($vendorDir);
  43532. return array(
  43533. 'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'),
  43534. 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
  43535. 'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
  43536. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  43537. 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
  43538. 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
  43539. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  43540. 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
  43541. 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
  43542. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  43543. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  43544. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  43545. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  43546. 'Seld\\Signal\\' => array($vendorDir . '/seld/signal-handler/src'),
  43547. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  43548. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  43549. 'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
  43550. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  43551. 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
  43552. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  43553. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  43554. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  43555. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  43556. 'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
  43557. 'Composer\\MetadataMinifier\\' => array($vendorDir . '/composer/metadata-minifier/src'),
  43558. 'Composer\\ClassMapGenerator\\' => array($vendorDir . '/composer/class-map-generator/src'),
  43559. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  43560. 'Composer\\' => array($baseDir . '/src/Composer'),
  43561. );
  43562. <?php
  43563. class ComposerAutoloaderInitComposerPhar1731845584
  43564. {
  43565. private static $loader;
  43566. public static function loadClassLoader($class)
  43567. {
  43568. if ('Composer\Autoload\ClassLoader' === $class) {
  43569. require __DIR__ . '/ClassLoader.php';
  43570. }
  43571. }
  43572. public static function getLoader()
  43573. {
  43574. if (null !== self::$loader) {
  43575. return self::$loader;
  43576. }
  43577. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1731845584', 'loadClassLoader'), true, true);
  43578. self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
  43579. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1731845584', 'loadClassLoader'));
  43580. require __DIR__ . '/autoload_static.php';
  43581. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1731845584::getInitializer($loader));
  43582. $loader->register(true);
  43583. $filesToLoad = \Composer\Autoload\ComposerStaticInitComposerPhar1731845584::$files;
  43584. $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
  43585. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  43586. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  43587. require $file;
  43588. }
  43589. }, null, null);
  43590. foreach ($filesToLoad as $fileIdentifier => $file) {
  43591. $requireFile($fileIdentifier, $file);
  43592. }
  43593. return $loader;
  43594. }
  43595. }
  43596. <?php
  43597. namespace Composer\Autoload;
  43598. class ComposerStaticInitComposerPhar1731845584
  43599. {
  43600. public static $files = array (
  43601. 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
  43602. '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
  43603. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  43604. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  43605. '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
  43606. 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
  43607. '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
  43608. 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
  43609. 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
  43610. '23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php',
  43611. );
  43612. public static $prefixLengthsPsr4 = array (
  43613. 'S' =>
  43614. array (
  43615. 'Symfony\\Polyfill\\Php81\\' => 23,
  43616. 'Symfony\\Polyfill\\Php80\\' => 23,
  43617. 'Symfony\\Polyfill\\Php73\\' => 23,
  43618. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  43619. 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
  43620. 'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31,
  43621. 'Symfony\\Polyfill\\Ctype\\' => 23,
  43622. 'Symfony\\Contracts\\Service\\' => 26,
  43623. 'Symfony\\Component\\String\\' => 25,
  43624. 'Symfony\\Component\\Process\\' => 26,
  43625. 'Symfony\\Component\\Finder\\' => 25,
  43626. 'Symfony\\Component\\Filesystem\\' => 29,
  43627. 'Symfony\\Component\\Console\\' => 26,
  43628. 'Seld\\Signal\\' => 12,
  43629. 'Seld\\PharUtils\\' => 15,
  43630. 'Seld\\JsonLint\\' => 14,
  43631. ),
  43632. 'R' =>
  43633. array (
  43634. 'React\\Promise\\' => 14,
  43635. ),
  43636. 'P' =>
  43637. array (
  43638. 'Psr\\Log\\' => 8,
  43639. 'Psr\\Container\\' => 14,
  43640. ),
  43641. 'J' =>
  43642. array (
  43643. 'JsonSchema\\' => 11,
  43644. ),
  43645. 'C' =>
  43646. array (
  43647. 'Composer\\XdebugHandler\\' => 23,
  43648. 'Composer\\Spdx\\' => 14,
  43649. 'Composer\\Semver\\' => 16,
  43650. 'Composer\\Pcre\\' => 14,
  43651. 'Composer\\MetadataMinifier\\' => 26,
  43652. 'Composer\\ClassMapGenerator\\' => 27,
  43653. 'Composer\\CaBundle\\' => 18,
  43654. 'Composer\\' => 9,
  43655. ),
  43656. );
  43657. public static $prefixDirsPsr4 = array (
  43658. 'Symfony\\Polyfill\\Php81\\' =>
  43659. array (
  43660. 0 => __DIR__ . '/..' . '/symfony/polyfill-php81',
  43661. ),
  43662. 'Symfony\\Polyfill\\Php80\\' =>
  43663. array (
  43664. 0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
  43665. ),
  43666. 'Symfony\\Polyfill\\Php73\\' =>
  43667. array (
  43668. 0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
  43669. ),
  43670. 'Symfony\\Polyfill\\Mbstring\\' =>
  43671. array (
  43672. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  43673. ),
  43674. 'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
  43675. array (
  43676. 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
  43677. ),
  43678. 'Symfony\\Polyfill\\Intl\\Grapheme\\' =>
  43679. array (
  43680. 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme',
  43681. ),
  43682. 'Symfony\\Polyfill\\Ctype\\' =>
  43683. array (
  43684. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  43685. ),
  43686. 'Symfony\\Contracts\\Service\\' =>
  43687. array (
  43688. 0 => __DIR__ . '/..' . '/symfony/service-contracts',
  43689. ),
  43690. 'Symfony\\Component\\String\\' =>
  43691. array (
  43692. 0 => __DIR__ . '/..' . '/symfony/string',
  43693. ),
  43694. 'Symfony\\Component\\Process\\' =>
  43695. array (
  43696. 0 => __DIR__ . '/..' . '/symfony/process',
  43697. ),
  43698. 'Symfony\\Component\\Finder\\' =>
  43699. array (
  43700. 0 => __DIR__ . '/..' . '/symfony/finder',
  43701. ),
  43702. 'Symfony\\Component\\Filesystem\\' =>
  43703. array (
  43704. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  43705. ),
  43706. 'Symfony\\Component\\Console\\' =>
  43707. array (
  43708. 0 => __DIR__ . '/..' . '/symfony/console',
  43709. ),
  43710. 'Seld\\Signal\\' =>
  43711. array (
  43712. 0 => __DIR__ . '/..' . '/seld/signal-handler/src',
  43713. ),
  43714. 'Seld\\PharUtils\\' =>
  43715. array (
  43716. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  43717. ),
  43718. 'Seld\\JsonLint\\' =>
  43719. array (
  43720. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  43721. ),
  43722. 'React\\Promise\\' =>
  43723. array (
  43724. 0 => __DIR__ . '/..' . '/react/promise/src',
  43725. ),
  43726. 'Psr\\Log\\' =>
  43727. array (
  43728. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  43729. ),
  43730. 'Psr\\Container\\' =>
  43731. array (
  43732. 0 => __DIR__ . '/..' . '/psr/container/src',
  43733. ),
  43734. 'JsonSchema\\' =>
  43735. array (
  43736. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  43737. ),
  43738. 'Composer\\XdebugHandler\\' =>
  43739. array (
  43740. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  43741. ),
  43742. 'Composer\\Spdx\\' =>
  43743. array (
  43744. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  43745. ),
  43746. 'Composer\\Semver\\' =>
  43747. array (
  43748. 0 => __DIR__ . '/..' . '/composer/semver/src',
  43749. ),
  43750. 'Composer\\Pcre\\' =>
  43751. array (
  43752. 0 => __DIR__ . '/..' . '/composer/pcre/src',
  43753. ),
  43754. 'Composer\\MetadataMinifier\\' =>
  43755. array (
  43756. 0 => __DIR__ . '/..' . '/composer/metadata-minifier/src',
  43757. ),
  43758. 'Composer\\ClassMapGenerator\\' =>
  43759. array (
  43760. 0 => __DIR__ . '/..' . '/composer/class-map-generator/src',
  43761. ),
  43762. 'Composer\\CaBundle\\' =>
  43763. array (
  43764. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  43765. ),
  43766. 'Composer\\' =>
  43767. array (
  43768. 0 => __DIR__ . '/../..' . '/src/Composer',
  43769. ),
  43770. );
  43771. public static $classMap = array (
  43772. 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
  43773. 'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',
  43774. 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
  43775. 'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
  43776. 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
  43777. 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
  43778. 'ReturnTypeWillChange' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/ReturnTypeWillChange.php',
  43779. 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
  43780. 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
  43781. 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
  43782. );
  43783. public static function getInitializer(ClassLoader $loader)
  43784. {
  43785. return \Closure::bind(function () use ($loader) {
  43786. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1731845584::$prefixLengthsPsr4;
  43787. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1731845584::$prefixDirsPsr4;
  43788. $loader->classMap = ComposerStaticInitComposerPhar1731845584::$classMap;
  43789. }, null, ClassLoader::class);
  43790. }
  43791. }
  43792. Copyright (C) 2016 Composer
  43793. Permission is hereby granted, free of charge, to any person obtaining a copy of
  43794. this software and associated documentation files (the "Software"), to deal in
  43795. the Software without restriction, including without limitation the rights to
  43796. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  43797. of the Software, and to permit persons to whom the Software is furnished to do
  43798. so, subject to the following conditions:
  43799. The above copyright notice and this permission notice shall be included in all
  43800. copies or substantial portions of the Software.
  43801. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43802. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43803. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43804. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43805. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43806. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  43807. SOFTWARE.
  43808. ##
  43809. ## Bundle of CA Root Certificates
  43810. ##
  43811. ## Certificate data from Mozilla as of: Tue Sep 24 03:12:04 2024 GMT
  43812. ##
  43813. ## Find updated versions here: https://curl.se/docs/caextract.html
  43814. ##
  43815. ## This is a bundle of X.509 certificates of public Certificate Authorities
  43816. ## (CA). These were automatically extracted from Mozilla's root certificates
  43817. ## file (certdata.txt). This file can be found in the mozilla source tree:
  43818. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  43819. ##
  43820. ## It contains the certificates in PEM format and therefore
  43821. ## can be directly used with curl / libcurl / php_curl, or with
  43822. ## an Apache+mod_ssl webserver for SSL client authentication.
  43823. ## Just configure this file as the SSLCACertificateFile.
  43824. ##
  43825. ## Conversion done with mk-ca-bundle.pl version 1.29.
  43826. ## SHA256: 36105b01631f9fc03b1eca779b44a30a1a5890b9bf8dc07ccb001a07301e01cf
  43827. ##
  43828. GlobalSign Root CA
  43829. ==================
  43830. -----BEGIN CERTIFICATE-----
  43831. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  43832. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  43833. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  43834. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  43835. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  43836. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  43837. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  43838. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  43839. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  43840. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  43841. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  43842. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  43843. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  43844. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  43845. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  43846. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  43847. -----END CERTIFICATE-----
  43848. Entrust.net Premium 2048 Secure Server CA
  43849. =========================================
  43850. -----BEGIN CERTIFICATE-----
  43851. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  43852. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  43853. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  43854. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  43855. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  43856. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  43857. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  43858. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  43859. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  43860. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  43861. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  43862. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  43863. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  43864. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  43865. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  43866. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  43867. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  43868. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  43869. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  43870. -----END CERTIFICATE-----
  43871. Baltimore CyberTrust Root
  43872. =========================
  43873. -----BEGIN CERTIFICATE-----
  43874. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  43875. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  43876. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  43877. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  43878. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  43879. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  43880. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  43881. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  43882. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  43883. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  43884. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  43885. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  43886. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  43887. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  43888. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  43889. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  43890. -----END CERTIFICATE-----
  43891. Entrust Root Certification Authority
  43892. ====================================
  43893. -----BEGIN CERTIFICATE-----
  43894. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  43895. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  43896. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  43897. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  43898. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  43899. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  43900. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  43901. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  43902. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  43903. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  43904. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  43905. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  43906. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  43907. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  43908. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  43909. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  43910. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  43911. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  43912. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  43913. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  43914. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  43915. -----END CERTIFICATE-----
  43916. Comodo AAA Services root
  43917. ========================
  43918. -----BEGIN CERTIFICATE-----
  43919. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  43920. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  43921. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  43922. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  43923. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  43924. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  43925. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  43926. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  43927. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  43928. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  43929. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  43930. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  43931. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  43932. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  43933. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  43934. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  43935. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  43936. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  43937. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  43938. -----END CERTIFICATE-----
  43939. QuoVadis Root CA 2
  43940. ==================
  43941. -----BEGIN CERTIFICATE-----
  43942. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  43943. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  43944. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  43945. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  43946. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  43947. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  43948. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  43949. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  43950. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  43951. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  43952. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  43953. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  43954. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  43955. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  43956. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  43957. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  43958. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  43959. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  43960. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  43961. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  43962. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  43963. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  43964. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  43965. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  43966. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  43967. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  43968. -----END CERTIFICATE-----
  43969. QuoVadis Root CA 3
  43970. ==================
  43971. -----BEGIN CERTIFICATE-----
  43972. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  43973. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  43974. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  43975. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  43976. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  43977. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  43978. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  43979. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  43980. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  43981. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  43982. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  43983. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  43984. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  43985. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  43986. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  43987. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  43988. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  43989. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  43990. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  43991. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  43992. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  43993. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  43994. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  43995. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  43996. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  43997. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  43998. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  43999. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  44000. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  44001. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  44002. -----END CERTIFICATE-----
  44003. XRamp Global CA Root
  44004. ====================
  44005. -----BEGIN CERTIFICATE-----
  44006. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  44007. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  44008. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  44009. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  44010. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  44011. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  44012. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  44013. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  44014. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  44015. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  44016. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  44017. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  44018. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  44019. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  44020. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  44021. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  44022. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  44023. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  44024. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  44025. -----END CERTIFICATE-----
  44026. Go Daddy Class 2 CA
  44027. ===================
  44028. -----BEGIN CERTIFICATE-----
  44029. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  44030. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  44031. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  44032. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  44033. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  44034. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  44035. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  44036. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  44037. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  44038. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  44039. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  44040. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  44041. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  44042. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  44043. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  44044. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  44045. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  44046. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  44047. vZ8=
  44048. -----END CERTIFICATE-----
  44049. Starfield Class 2 CA
  44050. ====================
  44051. -----BEGIN CERTIFICATE-----
  44052. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  44053. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  44054. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  44055. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  44056. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  44057. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  44058. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  44059. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  44060. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  44061. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  44062. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  44063. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  44064. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  44065. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  44066. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  44067. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  44068. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  44069. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  44070. QBFGmh95DmK/D5fs4C8fF5Q=
  44071. -----END CERTIFICATE-----
  44072. DigiCert Assured ID Root CA
  44073. ===========================
  44074. -----BEGIN CERTIFICATE-----
  44075. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  44076. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  44077. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  44078. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  44079. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  44080. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  44081. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  44082. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  44083. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  44084. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  44085. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  44086. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  44087. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  44088. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  44089. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  44090. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  44091. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  44092. -----END CERTIFICATE-----
  44093. DigiCert Global Root CA
  44094. =======================
  44095. -----BEGIN CERTIFICATE-----
  44096. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  44097. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  44098. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  44099. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  44100. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  44101. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  44102. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  44103. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  44104. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  44105. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  44106. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  44107. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  44108. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  44109. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  44110. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  44111. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  44112. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  44113. -----END CERTIFICATE-----
  44114. DigiCert High Assurance EV Root CA
  44115. ==================================
  44116. -----BEGIN CERTIFICATE-----
  44117. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  44118. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  44119. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  44120. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  44121. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  44122. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  44123. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  44124. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  44125. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  44126. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  44127. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  44128. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  44129. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  44130. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  44131. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  44132. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  44133. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  44134. -----END CERTIFICATE-----
  44135. SwissSign Gold CA - G2
  44136. ======================
  44137. -----BEGIN CERTIFICATE-----
  44138. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  44139. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  44140. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  44141. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  44142. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  44143. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  44144. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  44145. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  44146. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  44147. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  44148. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  44149. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  44150. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  44151. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  44152. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  44153. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  44154. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  44155. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  44156. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  44157. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  44158. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  44159. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  44160. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  44161. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  44162. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  44163. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  44164. -----END CERTIFICATE-----
  44165. SwissSign Silver CA - G2
  44166. ========================
  44167. -----BEGIN CERTIFICATE-----
  44168. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  44169. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  44170. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  44171. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  44172. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  44173. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  44174. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  44175. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  44176. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  44177. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  44178. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  44179. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  44180. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  44181. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  44182. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  44183. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  44184. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  44185. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  44186. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  44187. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  44188. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  44189. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  44190. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  44191. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  44192. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  44193. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  44194. -----END CERTIFICATE-----
  44195. SecureTrust CA
  44196. ==============
  44197. -----BEGIN CERTIFICATE-----
  44198. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  44199. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  44200. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  44201. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  44202. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  44203. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  44204. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  44205. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  44206. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  44207. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  44208. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  44209. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  44210. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  44211. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  44212. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  44213. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  44214. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  44215. -----END CERTIFICATE-----
  44216. Secure Global CA
  44217. ================
  44218. -----BEGIN CERTIFICATE-----
  44219. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  44220. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  44221. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  44222. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  44223. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  44224. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  44225. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  44226. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  44227. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  44228. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  44229. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  44230. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  44231. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  44232. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  44233. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  44234. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  44235. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  44236. -----END CERTIFICATE-----
  44237. COMODO Certification Authority
  44238. ==============================
  44239. -----BEGIN CERTIFICATE-----
  44240. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  44241. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  44242. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  44243. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  44244. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  44245. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  44246. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  44247. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  44248. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  44249. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  44250. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  44251. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  44252. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  44253. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  44254. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  44255. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  44256. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  44257. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  44258. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  44259. -----END CERTIFICATE-----
  44260. COMODO ECC Certification Authority
  44261. ==================================
  44262. -----BEGIN CERTIFICATE-----
  44263. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  44264. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  44265. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  44266. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  44267. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  44268. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  44269. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  44270. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  44271. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  44272. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  44273. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  44274. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  44275. -----END CERTIFICATE-----
  44276. Certigna
  44277. ========
  44278. -----BEGIN CERTIFICATE-----
  44279. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  44280. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  44281. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  44282. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  44283. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  44284. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  44285. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  44286. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  44287. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  44288. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  44289. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  44290. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  44291. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  44292. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  44293. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  44294. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  44295. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  44296. -----END CERTIFICATE-----
  44297. ePKI Root Certification Authority
  44298. =================================
  44299. -----BEGIN CERTIFICATE-----
  44300. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  44301. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  44302. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  44303. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  44304. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  44305. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  44306. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  44307. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  44308. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  44309. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  44310. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  44311. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  44312. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  44313. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  44314. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  44315. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  44316. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  44317. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  44318. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  44319. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  44320. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  44321. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  44322. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  44323. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  44324. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  44325. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  44326. -----END CERTIFICATE-----
  44327. certSIGN ROOT CA
  44328. ================
  44329. -----BEGIN CERTIFICATE-----
  44330. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  44331. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  44332. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  44333. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  44334. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  44335. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  44336. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  44337. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  44338. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  44339. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  44340. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  44341. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  44342. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  44343. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  44344. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  44345. -----END CERTIFICATE-----
  44346. NetLock Arany (Class Gold) Főtanúsítvány
  44347. ========================================
  44348. -----BEGIN CERTIFICATE-----
  44349. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  44350. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  44351. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  44352. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  44353. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  44354. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  44355. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  44356. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  44357. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  44358. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  44359. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  44360. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  44361. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  44362. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  44363. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  44364. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  44365. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  44366. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  44367. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  44368. -----END CERTIFICATE-----
  44369. SecureSign RootCA11
  44370. ===================
  44371. -----BEGIN CERTIFICATE-----
  44372. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  44373. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  44374. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  44375. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  44376. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  44377. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  44378. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  44379. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  44380. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  44381. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  44382. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  44383. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  44384. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  44385. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  44386. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  44387. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  44388. -----END CERTIFICATE-----
  44389. Microsec e-Szigno Root CA 2009
  44390. ==============================
  44391. -----BEGIN CERTIFICATE-----
  44392. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  44393. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  44394. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  44395. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  44396. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  44397. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  44398. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  44399. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  44400. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  44401. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  44402. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  44403. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  44404. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  44405. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  44406. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  44407. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  44408. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  44409. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  44410. LXpUq3DDfSJlgnCW
  44411. -----END CERTIFICATE-----
  44412. GlobalSign Root CA - R3
  44413. =======================
  44414. -----BEGIN CERTIFICATE-----
  44415. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  44416. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  44417. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  44418. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  44419. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  44420. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  44421. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  44422. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  44423. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  44424. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  44425. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  44426. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  44427. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  44428. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  44429. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  44430. kpeDMdmztcpHWD9f
  44431. -----END CERTIFICATE-----
  44432. Izenpe.com
  44433. ==========
  44434. -----BEGIN CERTIFICATE-----
  44435. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  44436. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  44437. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  44438. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  44439. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  44440. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  44441. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  44442. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  44443. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  44444. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  44445. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  44446. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  44447. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  44448. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  44449. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  44450. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  44451. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  44452. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  44453. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  44454. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  44455. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  44456. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  44457. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  44458. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  44459. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  44460. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  44461. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  44462. -----END CERTIFICATE-----
  44463. Go Daddy Root Certificate Authority - G2
  44464. ========================================
  44465. -----BEGIN CERTIFICATE-----
  44466. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  44467. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  44468. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  44469. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  44470. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  44471. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  44472. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  44473. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  44474. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  44475. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  44476. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  44477. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  44478. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  44479. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  44480. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  44481. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  44482. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  44483. -----END CERTIFICATE-----
  44484. Starfield Root Certificate Authority - G2
  44485. =========================================
  44486. -----BEGIN CERTIFICATE-----
  44487. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  44488. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  44489. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  44490. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  44491. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  44492. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  44493. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  44494. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  44495. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  44496. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  44497. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  44498. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  44499. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  44500. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  44501. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  44502. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  44503. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  44504. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  44505. -----END CERTIFICATE-----
  44506. Starfield Services Root Certificate Authority - G2
  44507. ==================================================
  44508. -----BEGIN CERTIFICATE-----
  44509. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  44510. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  44511. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  44512. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  44513. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  44514. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  44515. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  44516. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  44517. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  44518. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  44519. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  44520. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  44521. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  44522. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  44523. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  44524. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  44525. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  44526. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  44527. -----END CERTIFICATE-----
  44528. AffirmTrust Commercial
  44529. ======================
  44530. -----BEGIN CERTIFICATE-----
  44531. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  44532. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  44533. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  44534. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  44535. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  44536. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  44537. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  44538. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  44539. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  44540. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  44541. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  44542. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  44543. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  44544. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  44545. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  44546. -----END CERTIFICATE-----
  44547. AffirmTrust Networking
  44548. ======================
  44549. -----BEGIN CERTIFICATE-----
  44550. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  44551. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  44552. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  44553. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  44554. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  44555. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  44556. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  44557. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  44558. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  44559. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  44560. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  44561. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  44562. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  44563. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  44564. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  44565. -----END CERTIFICATE-----
  44566. AffirmTrust Premium
  44567. ===================
  44568. -----BEGIN CERTIFICATE-----
  44569. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  44570. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  44571. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  44572. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  44573. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  44574. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  44575. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  44576. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  44577. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  44578. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  44579. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  44580. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  44581. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  44582. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  44583. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  44584. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  44585. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  44586. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  44587. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  44588. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  44589. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  44590. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  44591. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  44592. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  44593. -----END CERTIFICATE-----
  44594. AffirmTrust Premium ECC
  44595. =======================
  44596. -----BEGIN CERTIFICATE-----
  44597. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  44598. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  44599. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  44600. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  44601. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  44602. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  44603. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  44604. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  44605. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  44606. eQ==
  44607. -----END CERTIFICATE-----
  44608. Certum Trusted Network CA
  44609. =========================
  44610. -----BEGIN CERTIFICATE-----
  44611. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  44612. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  44613. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  44614. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  44615. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  44616. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  44617. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  44618. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  44619. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  44620. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  44621. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  44622. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  44623. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  44624. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  44625. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  44626. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  44627. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  44628. -----END CERTIFICATE-----
  44629. TWCA Root Certification Authority
  44630. =================================
  44631. -----BEGIN CERTIFICATE-----
  44632. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  44633. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  44634. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  44635. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  44636. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  44637. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  44638. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  44639. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  44640. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  44641. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  44642. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  44643. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  44644. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  44645. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  44646. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  44647. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  44648. -----END CERTIFICATE-----
  44649. Security Communication RootCA2
  44650. ==============================
  44651. -----BEGIN CERTIFICATE-----
  44652. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  44653. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  44654. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  44655. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  44656. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  44657. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  44658. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  44659. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  44660. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  44661. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  44662. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  44663. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  44664. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  44665. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  44666. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  44667. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  44668. -----END CERTIFICATE-----
  44669. Actalis Authentication Root CA
  44670. ==============================
  44671. -----BEGIN CERTIFICATE-----
  44672. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  44673. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  44674. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  44675. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  44676. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  44677. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  44678. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  44679. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  44680. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  44681. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  44682. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  44683. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  44684. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  44685. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  44686. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  44687. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  44688. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  44689. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  44690. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  44691. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  44692. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  44693. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  44694. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  44695. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  44696. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  44697. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  44698. -----END CERTIFICATE-----
  44699. Buypass Class 2 Root CA
  44700. =======================
  44701. -----BEGIN CERTIFICATE-----
  44702. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  44703. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  44704. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  44705. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  44706. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  44707. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  44708. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  44709. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  44710. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  44711. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  44712. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  44713. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  44714. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  44715. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  44716. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  44717. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  44718. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  44719. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  44720. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  44721. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  44722. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  44723. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  44724. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  44725. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  44726. rJgWVqA=
  44727. -----END CERTIFICATE-----
  44728. Buypass Class 3 Root CA
  44729. =======================
  44730. -----BEGIN CERTIFICATE-----
  44731. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  44732. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  44733. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  44734. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  44735. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  44736. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  44737. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  44738. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  44739. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  44740. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  44741. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  44742. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  44743. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  44744. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  44745. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  44746. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  44747. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  44748. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  44749. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  44750. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  44751. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  44752. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  44753. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  44754. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  44755. Cp/HuZc=
  44756. -----END CERTIFICATE-----
  44757. T-TeleSec GlobalRoot Class 3
  44758. ============================
  44759. -----BEGIN CERTIFICATE-----
  44760. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  44761. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  44762. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  44763. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  44764. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  44765. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  44766. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  44767. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  44768. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  44769. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  44770. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  44771. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  44772. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  44773. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  44774. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  44775. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  44776. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  44777. -----END CERTIFICATE-----
  44778. D-TRUST Root Class 3 CA 2 2009
  44779. ==============================
  44780. -----BEGIN CERTIFICATE-----
  44781. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  44782. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  44783. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  44784. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  44785. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  44786. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  44787. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  44788. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  44789. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  44790. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  44791. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  44792. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  44793. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  44794. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  44795. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  44796. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  44797. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  44798. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  44799. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  44800. -----END CERTIFICATE-----
  44801. D-TRUST Root Class 3 CA 2 EV 2009
  44802. =================================
  44803. -----BEGIN CERTIFICATE-----
  44804. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  44805. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  44806. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  44807. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  44808. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  44809. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  44810. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  44811. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  44812. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  44813. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  44814. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  44815. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  44816. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  44817. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  44818. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  44819. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  44820. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  44821. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  44822. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  44823. w9y4AyHqnxbxLFS1
  44824. -----END CERTIFICATE-----
  44825. CA Disig Root R2
  44826. ================
  44827. -----BEGIN CERTIFICATE-----
  44828. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  44829. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  44830. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  44831. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  44832. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  44833. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  44834. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  44835. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  44836. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  44837. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  44838. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  44839. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  44840. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  44841. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  44842. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  44843. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  44844. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  44845. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  44846. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  44847. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  44848. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  44849. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  44850. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  44851. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  44852. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  44853. -----END CERTIFICATE-----
  44854. ACCVRAIZ1
  44855. =========
  44856. -----BEGIN CERTIFICATE-----
  44857. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  44858. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  44859. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  44860. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  44861. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  44862. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  44863. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  44864. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  44865. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  44866. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  44867. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  44868. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  44869. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  44870. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  44871. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  44872. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  44873. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  44874. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  44875. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  44876. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  44877. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  44878. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  44879. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  44880. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  44881. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  44882. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  44883. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  44884. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  44885. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  44886. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  44887. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  44888. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  44889. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  44890. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  44891. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  44892. EfbRD0tVNEYqi4Y7
  44893. -----END CERTIFICATE-----
  44894. TWCA Global Root CA
  44895. ===================
  44896. -----BEGIN CERTIFICATE-----
  44897. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  44898. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  44899. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  44900. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  44901. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  44902. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  44903. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  44904. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  44905. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  44906. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  44907. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  44908. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  44909. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  44910. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  44911. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  44912. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  44913. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  44914. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  44915. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  44916. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  44917. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  44918. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  44919. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  44920. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  44921. -----END CERTIFICATE-----
  44922. TeliaSonera Root CA v1
  44923. ======================
  44924. -----BEGIN CERTIFICATE-----
  44925. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  44926. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  44927. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  44928. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  44929. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  44930. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  44931. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  44932. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  44933. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  44934. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  44935. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  44936. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  44937. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  44938. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  44939. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  44940. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  44941. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  44942. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  44943. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  44944. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  44945. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  44946. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  44947. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  44948. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  44949. -----END CERTIFICATE-----
  44950. T-TeleSec GlobalRoot Class 2
  44951. ============================
  44952. -----BEGIN CERTIFICATE-----
  44953. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  44954. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  44955. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  44956. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  44957. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  44958. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  44959. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  44960. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  44961. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  44962. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  44963. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  44964. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  44965. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  44966. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  44967. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  44968. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  44969. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  44970. -----END CERTIFICATE-----
  44971. Atos TrustedRoot 2011
  44972. =====================
  44973. -----BEGIN CERTIFICATE-----
  44974. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  44975. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  44976. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  44977. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  44978. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  44979. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  44980. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  44981. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  44982. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  44983. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  44984. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  44985. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  44986. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  44987. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  44988. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  44989. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  44990. -----END CERTIFICATE-----
  44991. QuoVadis Root CA 1 G3
  44992. =====================
  44993. -----BEGIN CERTIFICATE-----
  44994. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  44995. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  44996. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  44997. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  44998. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  44999. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  45000. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  45001. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  45002. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  45003. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  45004. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  45005. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  45006. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  45007. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  45008. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  45009. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  45010. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  45011. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  45012. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  45013. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  45014. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  45015. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  45016. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  45017. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  45018. hMJKzRwuJIczYOXD
  45019. -----END CERTIFICATE-----
  45020. QuoVadis Root CA 2 G3
  45021. =====================
  45022. -----BEGIN CERTIFICATE-----
  45023. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  45024. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  45025. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  45026. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  45027. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  45028. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  45029. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  45030. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  45031. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  45032. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  45033. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  45034. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  45035. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  45036. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  45037. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  45038. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  45039. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  45040. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  45041. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  45042. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  45043. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  45044. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  45045. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  45046. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  45047. O3jtZsSOeWmD3n+M
  45048. -----END CERTIFICATE-----
  45049. QuoVadis Root CA 3 G3
  45050. =====================
  45051. -----BEGIN CERTIFICATE-----
  45052. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  45053. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  45054. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  45055. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  45056. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  45057. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  45058. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  45059. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  45060. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  45061. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  45062. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  45063. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  45064. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  45065. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  45066. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  45067. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  45068. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  45069. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  45070. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  45071. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  45072. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  45073. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  45074. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  45075. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  45076. PpxxVJkES/1Y+Zj0
  45077. -----END CERTIFICATE-----
  45078. DigiCert Assured ID Root G2
  45079. ===========================
  45080. -----BEGIN CERTIFICATE-----
  45081. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  45082. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  45083. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  45084. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  45085. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  45086. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  45087. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  45088. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  45089. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  45090. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  45091. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  45092. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  45093. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  45094. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  45095. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  45096. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  45097. IhNzbM8m9Yop5w==
  45098. -----END CERTIFICATE-----
  45099. DigiCert Assured ID Root G3
  45100. ===========================
  45101. -----BEGIN CERTIFICATE-----
  45102. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  45103. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  45104. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  45105. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  45106. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  45107. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  45108. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  45109. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  45110. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  45111. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  45112. 1vUhZscv6pZjamVFkpUBtA==
  45113. -----END CERTIFICATE-----
  45114. DigiCert Global Root G2
  45115. =======================
  45116. -----BEGIN CERTIFICATE-----
  45117. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  45118. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  45119. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  45120. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  45121. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  45122. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  45123. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  45124. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  45125. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  45126. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  45127. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  45128. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  45129. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  45130. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  45131. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  45132. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  45133. MrY=
  45134. -----END CERTIFICATE-----
  45135. DigiCert Global Root G3
  45136. =======================
  45137. -----BEGIN CERTIFICATE-----
  45138. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  45139. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  45140. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  45141. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  45142. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  45143. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  45144. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  45145. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  45146. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  45147. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  45148. VOKa5Vt8sycX
  45149. -----END CERTIFICATE-----
  45150. DigiCert Trusted Root G4
  45151. ========================
  45152. -----BEGIN CERTIFICATE-----
  45153. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  45154. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  45155. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  45156. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  45157. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  45158. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  45159. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  45160. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  45161. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  45162. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  45163. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  45164. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  45165. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  45166. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  45167. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  45168. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  45169. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  45170. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  45171. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  45172. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  45173. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  45174. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  45175. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  45176. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  45177. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  45178. 82Z+
  45179. -----END CERTIFICATE-----
  45180. COMODO RSA Certification Authority
  45181. ==================================
  45182. -----BEGIN CERTIFICATE-----
  45183. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  45184. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  45185. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  45186. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  45187. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  45188. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  45189. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  45190. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  45191. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  45192. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  45193. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  45194. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  45195. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  45196. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  45197. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  45198. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  45199. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  45200. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  45201. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  45202. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  45203. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  45204. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  45205. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  45206. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  45207. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  45208. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  45209. LaZRfyHBNVOFBkpdn627G190
  45210. -----END CERTIFICATE-----
  45211. USERTrust RSA Certification Authority
  45212. =====================================
  45213. -----BEGIN CERTIFICATE-----
  45214. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  45215. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  45216. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  45217. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  45218. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  45219. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  45220. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  45221. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  45222. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  45223. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  45224. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  45225. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  45226. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  45227. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  45228. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  45229. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  45230. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  45231. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  45232. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  45233. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  45234. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  45235. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  45236. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  45237. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  45238. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  45239. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  45240. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  45241. -----END CERTIFICATE-----
  45242. USERTrust ECC Certification Authority
  45243. =====================================
  45244. -----BEGIN CERTIFICATE-----
  45245. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  45246. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  45247. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  45248. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  45249. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  45250. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  45251. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  45252. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  45253. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  45254. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  45255. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  45256. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  45257. -----END CERTIFICATE-----
  45258. GlobalSign ECC Root CA - R5
  45259. ===========================
  45260. -----BEGIN CERTIFICATE-----
  45261. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  45262. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  45263. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  45264. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  45265. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  45266. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  45267. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  45268. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  45269. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  45270. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  45271. -----END CERTIFICATE-----
  45272. IdenTrust Commercial Root CA 1
  45273. ==============================
  45274. -----BEGIN CERTIFICATE-----
  45275. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  45276. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  45277. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  45278. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  45279. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  45280. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  45281. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  45282. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  45283. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  45284. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  45285. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  45286. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  45287. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  45288. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  45289. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  45290. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  45291. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  45292. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  45293. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  45294. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  45295. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  45296. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  45297. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  45298. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  45299. cGzM7vRX+Bi6hG6H
  45300. -----END CERTIFICATE-----
  45301. IdenTrust Public Sector Root CA 1
  45302. =================================
  45303. -----BEGIN CERTIFICATE-----
  45304. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  45305. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  45306. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  45307. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  45308. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  45309. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  45310. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  45311. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  45312. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  45313. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  45314. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  45315. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  45316. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  45317. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  45318. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  45319. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  45320. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  45321. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  45322. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  45323. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  45324. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  45325. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  45326. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  45327. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  45328. 3Wl9af0AVqW3rLatt8o+Ae+c
  45329. -----END CERTIFICATE-----
  45330. Entrust Root Certification Authority - G2
  45331. =========================================
  45332. -----BEGIN CERTIFICATE-----
  45333. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  45334. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  45335. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  45336. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  45337. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  45338. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  45339. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  45340. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  45341. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  45342. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  45343. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  45344. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  45345. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  45346. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  45347. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  45348. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  45349. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  45350. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  45351. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  45352. e4pIb4tF9g==
  45353. -----END CERTIFICATE-----
  45354. Entrust Root Certification Authority - EC1
  45355. ==========================================
  45356. -----BEGIN CERTIFICATE-----
  45357. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  45358. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  45359. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  45360. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  45361. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  45362. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  45363. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  45364. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  45365. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  45366. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  45367. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  45368. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  45369. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  45370. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  45371. -----END CERTIFICATE-----
  45372. CFCA EV ROOT
  45373. ============
  45374. -----BEGIN CERTIFICATE-----
  45375. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  45376. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  45377. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  45378. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  45379. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  45380. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  45381. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  45382. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  45383. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  45384. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  45385. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  45386. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  45387. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  45388. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  45389. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  45390. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  45391. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  45392. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  45393. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  45394. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  45395. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  45396. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  45397. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  45398. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  45399. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  45400. -----END CERTIFICATE-----
  45401. OISTE WISeKey Global Root GB CA
  45402. ===============================
  45403. -----BEGIN CERTIFICATE-----
  45404. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  45405. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  45406. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  45407. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  45408. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  45409. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  45410. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  45411. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  45412. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  45413. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  45414. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  45415. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  45416. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  45417. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  45418. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  45419. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  45420. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  45421. -----END CERTIFICATE-----
  45422. SZAFIR ROOT CA2
  45423. ===============
  45424. -----BEGIN CERTIFICATE-----
  45425. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  45426. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  45427. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  45428. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  45429. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  45430. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  45431. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  45432. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  45433. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  45434. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  45435. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  45436. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  45437. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  45438. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  45439. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  45440. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  45441. -----END CERTIFICATE-----
  45442. Certum Trusted Network CA 2
  45443. ===========================
  45444. -----BEGIN CERTIFICATE-----
  45445. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  45446. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  45447. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  45448. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  45449. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  45450. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  45451. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  45452. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  45453. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  45454. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  45455. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  45456. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  45457. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  45458. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  45459. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  45460. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  45461. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  45462. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  45463. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  45464. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  45465. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  45466. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  45467. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  45468. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  45469. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  45470. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  45471. zAYspsbiDrW5viSP
  45472. -----END CERTIFICATE-----
  45473. Hellenic Academic and Research Institutions RootCA 2015
  45474. =======================================================
  45475. -----BEGIN CERTIFICATE-----
  45476. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  45477. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  45478. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  45479. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  45480. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  45481. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  45482. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  45483. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  45484. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  45485. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  45486. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  45487. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  45488. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  45489. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  45490. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  45491. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  45492. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  45493. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  45494. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  45495. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  45496. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  45497. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  45498. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  45499. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  45500. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  45501. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  45502. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  45503. p/UsQu0yrbYhnr68
  45504. -----END CERTIFICATE-----
  45505. Hellenic Academic and Research Institutions ECC RootCA 2015
  45506. ===========================================================
  45507. -----BEGIN CERTIFICATE-----
  45508. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  45509. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  45510. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  45511. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  45512. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  45513. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  45514. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  45515. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  45516. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  45517. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  45518. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  45519. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  45520. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  45521. -----END CERTIFICATE-----
  45522. ISRG Root X1
  45523. ============
  45524. -----BEGIN CERTIFICATE-----
  45525. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  45526. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  45527. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  45528. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  45529. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  45530. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  45531. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  45532. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  45533. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  45534. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  45535. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  45536. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  45537. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  45538. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  45539. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  45540. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  45541. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  45542. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  45543. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  45544. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  45545. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  45546. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  45547. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  45548. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  45549. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  45550. -----END CERTIFICATE-----
  45551. AC RAIZ FNMT-RCM
  45552. ================
  45553. -----BEGIN CERTIFICATE-----
  45554. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  45555. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  45556. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  45557. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  45558. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  45559. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  45560. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  45561. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  45562. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  45563. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  45564. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  45565. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  45566. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  45567. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  45568. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  45569. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  45570. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  45571. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  45572. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  45573. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  45574. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  45575. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  45576. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  45577. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  45578. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  45579. -----END CERTIFICATE-----
  45580. Amazon Root CA 1
  45581. ================
  45582. -----BEGIN CERTIFICATE-----
  45583. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  45584. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  45585. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  45586. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  45587. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  45588. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  45589. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  45590. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  45591. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  45592. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  45593. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  45594. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  45595. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  45596. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  45597. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  45598. -----END CERTIFICATE-----
  45599. Amazon Root CA 2
  45600. ================
  45601. -----BEGIN CERTIFICATE-----
  45602. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  45603. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  45604. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  45605. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  45606. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  45607. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  45608. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  45609. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  45610. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  45611. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  45612. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  45613. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  45614. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  45615. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  45616. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  45617. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  45618. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  45619. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  45620. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  45621. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  45622. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  45623. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  45624. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  45625. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  45626. -----END CERTIFICATE-----
  45627. Amazon Root CA 3
  45628. ================
  45629. -----BEGIN CERTIFICATE-----
  45630. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  45631. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  45632. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  45633. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  45634. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  45635. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  45636. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  45637. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  45638. -----END CERTIFICATE-----
  45639. Amazon Root CA 4
  45640. ================
  45641. -----BEGIN CERTIFICATE-----
  45642. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  45643. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  45644. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  45645. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  45646. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  45647. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  45648. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  45649. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  45650. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  45651. -----END CERTIFICATE-----
  45652. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  45653. =============================================
  45654. -----BEGIN CERTIFICATE-----
  45655. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  45656. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  45657. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  45658. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  45659. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  45660. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  45661. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  45662. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  45663. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  45664. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  45665. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  45666. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  45667. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  45668. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  45669. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  45670. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  45671. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  45672. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  45673. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  45674. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  45675. -----END CERTIFICATE-----
  45676. GDCA TrustAUTH R5 ROOT
  45677. ======================
  45678. -----BEGIN CERTIFICATE-----
  45679. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  45680. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  45681. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  45682. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  45683. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  45684. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  45685. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  45686. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  45687. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  45688. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  45689. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  45690. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  45691. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  45692. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  45693. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  45694. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  45695. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  45696. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  45697. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  45698. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  45699. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  45700. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  45701. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  45702. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  45703. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  45704. -----END CERTIFICATE-----
  45705. SSL.com Root Certification Authority RSA
  45706. ========================================
  45707. -----BEGIN CERTIFICATE-----
  45708. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  45709. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  45710. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  45711. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  45712. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  45713. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  45714. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  45715. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  45716. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  45717. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  45718. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  45719. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  45720. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  45721. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  45722. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  45723. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  45724. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  45725. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  45726. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  45727. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  45728. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  45729. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  45730. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  45731. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  45732. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  45733. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  45734. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  45735. -----END CERTIFICATE-----
  45736. SSL.com Root Certification Authority ECC
  45737. ========================================
  45738. -----BEGIN CERTIFICATE-----
  45739. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  45740. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  45741. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  45742. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  45743. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  45744. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  45745. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  45746. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  45747. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  45748. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  45749. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  45750. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  45751. -----END CERTIFICATE-----
  45752. SSL.com EV Root Certification Authority RSA R2
  45753. ==============================================
  45754. -----BEGIN CERTIFICATE-----
  45755. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  45756. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  45757. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  45758. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  45759. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  45760. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  45761. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  45762. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  45763. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  45764. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  45765. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  45766. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  45767. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  45768. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  45769. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  45770. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  45771. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  45772. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  45773. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  45774. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  45775. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  45776. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  45777. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  45778. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  45779. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  45780. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  45781. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  45782. -----END CERTIFICATE-----
  45783. SSL.com EV Root Certification Authority ECC
  45784. ===========================================
  45785. -----BEGIN CERTIFICATE-----
  45786. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  45787. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  45788. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  45789. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  45790. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  45791. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  45792. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  45793. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  45794. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  45795. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  45796. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  45797. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  45798. -----END CERTIFICATE-----
  45799. GlobalSign Root CA - R6
  45800. =======================
  45801. -----BEGIN CERTIFICATE-----
  45802. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  45803. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  45804. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  45805. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  45806. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  45807. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  45808. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  45809. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  45810. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  45811. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  45812. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  45813. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  45814. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  45815. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  45816. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  45817. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  45818. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  45819. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  45820. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  45821. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  45822. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  45823. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  45824. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  45825. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  45826. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  45827. -----END CERTIFICATE-----
  45828. OISTE WISeKey Global Root GC CA
  45829. ===============================
  45830. -----BEGIN CERTIFICATE-----
  45831. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  45832. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  45833. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  45834. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  45835. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  45836. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  45837. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  45838. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  45839. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  45840. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  45841. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  45842. -----END CERTIFICATE-----
  45843. UCA Global G2 Root
  45844. ==================
  45845. -----BEGIN CERTIFICATE-----
  45846. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  45847. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  45848. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  45849. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  45850. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  45851. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  45852. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  45853. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  45854. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  45855. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  45856. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  45857. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  45858. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  45859. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  45860. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  45861. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  45862. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  45863. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  45864. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  45865. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  45866. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  45867. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  45868. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  45869. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  45870. -----END CERTIFICATE-----
  45871. UCA Extended Validation Root
  45872. ============================
  45873. -----BEGIN CERTIFICATE-----
  45874. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  45875. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  45876. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  45877. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  45878. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  45879. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  45880. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  45881. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  45882. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  45883. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  45884. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  45885. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  45886. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  45887. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  45888. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  45889. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  45890. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  45891. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  45892. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  45893. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  45894. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  45895. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  45896. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  45897. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  45898. dhh2n1ax
  45899. -----END CERTIFICATE-----
  45900. Certigna Root CA
  45901. ================
  45902. -----BEGIN CERTIFICATE-----
  45903. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  45904. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  45905. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  45906. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  45907. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  45908. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  45909. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  45910. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  45911. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  45912. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  45913. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  45914. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  45915. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  45916. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  45917. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  45918. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  45919. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  45920. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  45921. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  45922. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  45923. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  45924. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  45925. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  45926. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  45927. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  45928. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  45929. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  45930. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  45931. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  45932. -----END CERTIFICATE-----
  45933. emSign Root CA - G1
  45934. ===================
  45935. -----BEGIN CERTIFICATE-----
  45936. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  45937. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  45938. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  45939. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  45940. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  45941. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  45942. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  45943. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  45944. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  45945. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  45946. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  45947. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  45948. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  45949. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  45950. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  45951. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  45952. iN66zB+Afko=
  45953. -----END CERTIFICATE-----
  45954. emSign ECC Root CA - G3
  45955. =======================
  45956. -----BEGIN CERTIFICATE-----
  45957. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  45958. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  45959. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  45960. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  45961. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  45962. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  45963. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  45964. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  45965. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  45966. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  45967. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  45968. -----END CERTIFICATE-----
  45969. emSign Root CA - C1
  45970. ===================
  45971. -----BEGIN CERTIFICATE-----
  45972. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  45973. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  45974. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  45975. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  45976. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  45977. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  45978. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  45979. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  45980. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  45981. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  45982. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  45983. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  45984. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  45985. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  45986. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  45987. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  45988. -----END CERTIFICATE-----
  45989. emSign ECC Root CA - C3
  45990. =======================
  45991. -----BEGIN CERTIFICATE-----
  45992. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  45993. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  45994. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  45995. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  45996. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  45997. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  45998. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  45999. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  46000. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  46001. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  46002. -----END CERTIFICATE-----
  46003. Hongkong Post Root CA 3
  46004. =======================
  46005. -----BEGIN CERTIFICATE-----
  46006. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  46007. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  46008. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  46009. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  46010. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  46011. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  46012. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  46013. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  46014. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  46015. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  46016. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  46017. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  46018. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  46019. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  46020. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  46021. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  46022. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  46023. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  46024. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  46025. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  46026. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  46027. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  46028. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  46029. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  46030. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  46031. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  46032. dBb9HxEGmpv0
  46033. -----END CERTIFICATE-----
  46034. Entrust Root Certification Authority - G4
  46035. =========================================
  46036. -----BEGIN CERTIFICATE-----
  46037. MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
  46038. BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
  46039. bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
  46040. dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
  46041. dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
  46042. AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
  46043. L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
  46044. cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
  46045. cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
  46046. umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
  46047. 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
  46048. 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
  46049. e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
  46050. ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
  46051. xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
  46052. 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
  46053. dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
  46054. Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
  46055. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
  46056. MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
  46057. jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
  46058. 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
  46059. YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
  46060. jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
  46061. m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
  46062. RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
  46063. JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
  46064. +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
  46065. kcpG2om3PVODLAgfi49T3f+sHw==
  46066. -----END CERTIFICATE-----
  46067. Microsoft ECC Root Certificate Authority 2017
  46068. =============================================
  46069. -----BEGIN CERTIFICATE-----
  46070. MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  46071. UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUND
  46072. IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4
  46073. MjMxNjA0WjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw
  46074. NAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQ
  46075. BgcqhkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZRogPZnZH6
  46076. thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYbhGBKia/teQ87zvH2RPUB
  46077. eMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTIy5lycFIM
  46078. +Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlf
  46079. Xu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaR
  46080. eNtUjGUBiudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M=
  46081. -----END CERTIFICATE-----
  46082. Microsoft RSA Root Certificate Authority 2017
  46083. =============================================
  46084. -----BEGIN CERTIFICATE-----
  46085. MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYDVQQG
  46086. EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQg
  46087. UlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIw
  46088. NzE4MjMwMDIzWjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u
  46089. MTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcw
  46090. ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZNt9GkMml
  46091. 7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0ZdDMbRnMlfl7rEqUrQ7e
  46092. S0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw7
  46093. 1VdyvD/IybLeS2v4I2wDwAW9lcfNcztmgGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+
  46094. dkC0zVJhUXAoP8XFWvLJjEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49F
  46095. yGcohJUcaDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaGYaRS
  46096. MLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6W6IYZVcSn2i51BVr
  46097. lMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4KUGsTuqwPN1q3ErWQgR5WrlcihtnJ
  46098. 0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJ
  46099. ClTUFLkqqNfs+avNJVgyeY+QW5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYw
  46100. DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC
  46101. NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZCLgLNFgVZJ8og
  46102. 6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OCgMNPOsduET/m4xaRhPtthH80
  46103. dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk
  46104. +ONVFT24bcMKpBLBaYVu32TxU5nhSnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex
  46105. /2kskZGT4d9Mozd2TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDy
  46106. AmH3pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGRxpl/j8nW
  46107. ZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiAppGWSZI1b7rCoucL5mxAyE
  46108. 7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKT
  46109. c0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D
  46110. 5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E
  46111. -----END CERTIFICATE-----
  46112. e-Szigno Root CA 2017
  46113. =====================
  46114. -----BEGIN CERTIFICATE-----
  46115. MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhVMREw
  46116. DwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUt
  46117. MjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZa
  46118. Fw00MjA4MjIxMjA3MDZaMHExCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UE
  46119. CgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3pp
  46120. Z25vIFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtvxie+RJCx
  46121. s1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+HWyx7xf58etqjYzBhMA8G
  46122. A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSHERUI0arBeAyxr87GyZDv
  46123. vzAEwDAfBgNVHSMEGDAWgBSHERUI0arBeAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEA
  46124. tVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxO
  46125. svxyqltZ+efcMQ==
  46126. -----END CERTIFICATE-----
  46127. certSIGN Root CA G2
  46128. ===================
  46129. -----BEGIN CERTIFICATE-----
  46130. MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJPMRQw
  46131. EgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAeFw0xNzAy
  46132. MDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJBgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lH
  46133. TiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  46134. ADCCAgoCggIBAMDFdRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05
  46135. N0IwvlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZuIt4Imfk
  46136. abBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhpn+Sc8CnTXPnGFiWeI8Mg
  46137. wT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKscpc/I1mbySKEwQdPzH/iV8oScLumZfNp
  46138. dWO9lfsbl83kqK/20U6o2YpxJM02PbyWxPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91Qqh
  46139. ngLjYl/rNUssuHLoPj1PrCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732
  46140. jcZZroiFDsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fxDTvf
  46141. 95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgyLcsUDFDYg2WD7rlc
  46142. z8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERL
  46143. iohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
  46144. DgQWBBSCIS1mxteg4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOB
  46145. ywaK8SJJ6ejqkX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC
  46146. b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB
  46147. /AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5
  46148. 8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5
  46149. BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklW
  46150. atKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tU
  46151. Sxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZkPuXaTH4M
  46152. NMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE1LlSVHJ7liXMvGnjSG4N
  46153. 0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3NghVdJIgc=
  46154. -----END CERTIFICATE-----
  46155. Trustwave Global Certification Authority
  46156. ========================================
  46157. -----BEGIN CERTIFICATE-----
  46158. MIIF2jCCA8KgAwIBAgIMBfcOhtpJ80Y1LrqyMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJV
  46159. UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
  46160. ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
  46161. IEF1dGhvcml0eTAeFw0xNzA4MjMxOTM0MTJaFw00MjA4MjMxOTM0MTJaMIGIMQswCQYDVQQGEwJV
  46162. UzERMA8GA1UECAwISWxsaW5vaXMxEDAOBgNVBAcMB0NoaWNhZ28xITAfBgNVBAoMGFRydXN0d2F2
  46163. ZSBIb2xkaW5ncywgSW5jLjExMC8GA1UEAwwoVHJ1c3R3YXZlIEdsb2JhbCBDZXJ0aWZpY2F0aW9u
  46164. IEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALldUShLPDeS0YLOvR29
  46165. zd24q88KPuFd5dyqCblXAj7mY2Hf8g+CY66j96xz0XznswuvCAAJWX/NKSqIk4cXGIDtiLK0thAf
  46166. LdZfVaITXdHG6wZWiYj+rDKd/VzDBcdu7oaJuogDnXIhhpCujwOl3J+IKMujkkkP7NAP4m1ET4Bq
  46167. stTnoApTAbqOl5F2brz81Ws25kCI1nsvXwXoLG0R8+eyvpJETNKXpP7ScoFDB5zpET71ixpZfR9o
  46168. WN0EACyW80OzfpgZdNmcc9kYvkHHNHnZ9GLCQ7mzJ7Aiy/k9UscwR7PJPrhq4ufogXBeQotPJqX+
  46169. OsIgbrv4Fo7NDKm0G2x2EOFYeUY+VM6AqFcJNykbmROPDMjWLBz7BegIlT1lRtzuzWniTY+HKE40
  46170. Cz7PFNm73bZQmq131BnW2hqIyE4bJ3XYsgjxroMwuREOzYfwhI0Vcnyh78zyiGG69Gm7DIwLdVcE
  46171. uE4qFC49DxweMqZiNu5m4iK4BUBjECLzMx10coos9TkpoNPnG4CELcU9402x/RpvumUHO1jsQkUm
  46172. +9jaJXLE9gCxInm943xZYkqcBW89zubWR2OZxiRvchLIrH+QtAuRcOi35hYQcRfO3gZPSEF9NUqj
  46173. ifLJS3tBEW1ntwiYTOURGa5CgNz7kAXU+FDKvuStx8KU1xad5hePrzb7AgMBAAGjQjBAMA8GA1Ud
  46174. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFJngGWcNYtt2s9o9uFvo/ULSMQ6HMA4GA1UdDwEB/wQEAwIB
  46175. BjANBgkqhkiG9w0BAQsFAAOCAgEAmHNw4rDT7TnsTGDZqRKGFx6W0OhUKDtkLSGm+J1WE2pIPU/H
  46176. PinbbViDVD2HfSMF1OQc3Og4ZYbFdada2zUFvXfeuyk3QAUHw5RSn8pk3fEbK9xGChACMf1KaA0H
  46177. ZJDmHvUqoai7PF35owgLEQzxPy0QlG/+4jSHg9bP5Rs1bdID4bANqKCqRieCNqcVtgimQlRXtpla
  46178. 4gt5kNdXElE1GYhBaCXUNxeEFfsBctyV3lImIJgm4nb1J2/6ADtKYdkNy1GTKv0WBpanI5ojSP5R
  46179. vbbEsLFUzt5sQa0WZ37b/TjNuThOssFgy50X31ieemKyJo90lZvkWx3SD92YHJtZuSPTMaCm/zjd
  46180. zyBP6VhWOmfD0faZmZ26NraAL4hHT4a/RDqA5Dccprrql5gR0IRiR2Qequ5AvzSxnI9O4fKSTx+O
  46181. 856X3vOmeWqJcU9LJxdI/uz0UA9PSX3MReO9ekDFQdxhVicGaeVyQYHTtgGJoC86cnn+OjC/QezH
  46182. Yj6RS8fZMXZC+fc8Y+wmjHMMfRod6qh8h6jCJ3zhM0EPz8/8AKAigJ5Kp28AsEFFtyLKaEjFQqKu
  46183. 3R3y4G5OBVixwJAWKqQ9EEC+j2Jjg6mcgn0tAumDMHzLJ8n9HmYAsC7TIS+OMxZsmO0QqAfWzJPP
  46184. 29FpHOTKyeC2nOnOcXHebD8WpHk=
  46185. -----END CERTIFICATE-----
  46186. Trustwave Global ECC P256 Certification Authority
  46187. =================================================
  46188. -----BEGIN CERTIFICATE-----
  46189. MIICYDCCAgegAwIBAgIMDWpfCD8oXD5Rld9dMAoGCCqGSM49BAMCMIGRMQswCQYDVQQGEwJVUzER
  46190. MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
  46191. b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1NiBDZXJ0aWZp
  46192. Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM1MTBaFw00MjA4MjMxOTM1MTBaMIGRMQswCQYD
  46193. VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
  46194. dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDI1
  46195. NiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH77bOYj
  46196. 43MyCMpg5lOcunSNGLB4kFKA3TjASh3RqMyTpJcGOMoNFWLGjgEqZZ2q3zSRLoHB5DOSMcT9CTqm
  46197. P62jQzBBMA8GA1UdEwEB/wQFMAMBAf8wDwYDVR0PAQH/BAUDAwcGADAdBgNVHQ4EFgQUo0EGrJBt
  46198. 0UrrdaVKEJmzsaGLSvcwCgYIKoZIzj0EAwIDRwAwRAIgB+ZU2g6gWrKuEZ+Hxbb/ad4lvvigtwjz
  46199. RM4q3wghDDcCIC0mA6AFvWvR9lz4ZcyGbbOcNEhjhAnFjXca4syc4XR7
  46200. -----END CERTIFICATE-----
  46201. Trustwave Global ECC P384 Certification Authority
  46202. =================================================
  46203. -----BEGIN CERTIFICATE-----
  46204. MIICnTCCAiSgAwIBAgIMCL2Fl2yZJ6SAaEc7MAoGCCqGSM49BAMDMIGRMQswCQYDVQQGEwJVUzER
  46205. MA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRydXN0d2F2ZSBI
  46206. b2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4NCBDZXJ0aWZp
  46207. Y2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MjMxOTM2NDNaFw00MjA4MjMxOTM2NDNaMIGRMQswCQYD
  46208. VQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNVBAcTB0NoaWNhZ28xITAfBgNVBAoTGFRy
  46209. dXN0d2F2ZSBIb2xkaW5ncywgSW5jLjE6MDgGA1UEAxMxVHJ1c3R3YXZlIEdsb2JhbCBFQ0MgUDM4
  46210. NCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTB2MBAGByqGSM49AgEGBSuBBAAiA2IABGvaDXU1CDFH
  46211. Ba5FmVXxERMuSvgQMSOjfoPTfygIOiYaOs+Xgh+AtycJj9GOMMQKmw6sWASr9zZ9lCOkmwqKi6vr
  46212. /TklZvFe/oyujUF5nQlgziip04pt89ZF1PKYhDhloKNDMEEwDwYDVR0TAQH/BAUwAwEB/zAPBgNV
  46213. HQ8BAf8EBQMDBwYAMB0GA1UdDgQWBBRVqYSJ0sEyvRjLbKYHTsjnnb6CkDAKBggqhkjOPQQDAwNn
  46214. ADBkAjA3AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsCMGcl
  46215. CrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVuSw==
  46216. -----END CERTIFICATE-----
  46217. NAVER Global Root Certification Authority
  46218. =========================================
  46219. -----BEGIN CERTIFICATE-----
  46220. MIIFojCCA4qgAwIBAgIUAZQwHqIL3fXFMyqxQ0Rx+NZQTQ0wDQYJKoZIhvcNAQEMBQAwaTELMAkG
  46221. A1UEBhMCS1IxJjAkBgNVBAoMHU5BVkVSIEJVU0lORVNTIFBMQVRGT1JNIENvcnAuMTIwMAYDVQQD
  46222. DClOQVZFUiBHbG9iYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0xNzA4MTgwODU4
  46223. NDJaFw0zNzA4MTgyMzU5NTlaMGkxCzAJBgNVBAYTAktSMSYwJAYDVQQKDB1OQVZFUiBCVVNJTkVT
  46224. UyBQTEFURk9STSBDb3JwLjEyMDAGA1UEAwwpTkFWRVIgR2xvYmFsIFJvb3QgQ2VydGlmaWNhdGlv
  46225. biBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC21PGTXLVAiQqrDZBb
  46226. UGOukJR0F0Vy1ntlWilLp1agS7gvQnXp2XskWjFlqxcX0TM62RHcQDaH38dq6SZeWYp34+hInDEW
  46227. +j6RscrJo+KfziFTowI2MMtSAuXaMl3Dxeb57hHHi8lEHoSTGEq0n+USZGnQJoViAbbJAh2+g1G7
  46228. XNr4rRVqmfeSVPc0W+m/6imBEtRTkZazkVrd/pBzKPswRrXKCAfHcXLJZtM0l/aM9BhK4dA9WkW2
  46229. aacp+yPOiNgSnABIqKYPszuSjXEOdMWLyEz59JuOuDxp7W87UC9Y7cSw0BwbagzivESq2M0UXZR4
  46230. Yb8ObtoqvC8MC3GmsxY/nOb5zJ9TNeIDoKAYv7vxvvTWjIcNQvcGufFt7QSUqP620wbGQGHfnZ3z
  46231. VHbOUzoBppJB7ASjjw2i1QnK1sua8e9DXcCrpUHPXFNwcMmIpi3Ua2FzUCaGYQ5fG8Ir4ozVu53B
  46232. A0K6lNpfqbDKzE0K70dpAy8i+/Eozr9dUGWokG2zdLAIx6yo0es+nPxdGoMuK8u180SdOqcXYZai
  46233. cdNwlhVNt0xz7hlcxVs+Qf6sdWA7G2POAN3aCJBitOUt7kinaxeZVL6HSuOpXgRM6xBtVNbv8ejy
  46234. YhbLgGvtPe31HzClrkvJE+2KAQHJuFFYwGY6sWZLxNUxAmLpdIQM201GLQIDAQABo0IwQDAdBgNV
  46235. HQ4EFgQU0p+I36HNLL3s9TsBAZMzJ7LrYEswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMB
  46236. Af8wDQYJKoZIhvcNAQEMBQADggIBADLKgLOdPVQG3dLSLvCkASELZ0jKbY7gyKoNqo0hV4/GPnrK
  46237. 21HUUrPUloSlWGB/5QuOH/XcChWB5Tu2tyIvCZwTFrFsDDUIbatjcu3cvuzHV+YwIHHW1xDBE1UB
  46238. jCpD5EHxzzp6U5LOogMFDTjfArsQLtk70pt6wKGm+LUx5vR1yblTmXVHIloUFcd4G7ad6Qz4G3bx
  46239. hYTeodoS76TiEJd6eN4MUZeoIUCLhr0N8F5OSza7OyAfikJW4Qsav3vQIkMsRIz75Sq0bBwcupTg
  46240. E34h5prCy8VCZLQelHsIJchxzIdFV4XTnyliIoNRlwAYl3dqmJLJfGBs32x9SuRwTMKeuB330DTH
  46241. D8z7p/8Dvq1wkNoL3chtl1+afwkyQf3NosxabUzyqkn+Zvjp2DXrDige7kgvOtB5CTh8piKCk5XQ
  46242. A76+AqAF3SAi428diDRgxuYKuQl1C/AH6GmWNcf7I4GOODm4RStDeKLRLBT/DShycpWbXgnbiUSY
  46243. qqFJu3FS8r/2/yehNq+4tneI3TqkbZs0kNwUXTC/t+sX5Ie3cdCh13cV1ELX8vMxmV2b3RZtP+oG
  46244. I/hGoiLtk/bdmuYqh7GYVPEi92tF4+KOdh2ajcQGjTa3FPOdVGm3jjzVpG2Tgbet9r1ke8LJaDmg
  46245. kpzNNIaRkPpkUZ3+/uul9XXeifdy
  46246. -----END CERTIFICATE-----
  46247. AC RAIZ FNMT-RCM SERVIDORES SEGUROS
  46248. ===================================
  46249. -----BEGIN CERTIFICATE-----
  46250. MIICbjCCAfOgAwIBAgIQYvYybOXE42hcG2LdnC6dlTAKBggqhkjOPQQDAzB4MQswCQYDVQQGEwJF
  46251. UzERMA8GA1UECgwIRk5NVC1SQ00xDjAMBgNVBAsMBUNlcmVzMRgwFgYDVQRhDA9WQVRFUy1RMjgy
  46252. NjAwNEoxLDAqBgNVBAMMI0FDIFJBSVogRk5NVC1SQ00gU0VSVklET1JFUyBTRUdVUk9TMB4XDTE4
  46253. MTIyMDA5MzczM1oXDTQzMTIyMDA5MzczM1oweDELMAkGA1UEBhMCRVMxETAPBgNVBAoMCEZOTVQt
  46254. UkNNMQ4wDAYDVQQLDAVDZXJlczEYMBYGA1UEYQwPVkFURVMtUTI4MjYwMDRKMSwwKgYDVQQDDCNB
  46255. QyBSQUlaIEZOTVQtUkNNIFNFUlZJRE9SRVMgU0VHVVJPUzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  46256. BPa6V1PIyqvfNkpSIeSX0oNnnvBlUdBeh8dHsVnyV0ebAAKTRBdp20LHsbI6GA60XYyzZl2hNPk2
  46257. LEnb80b8s0RpRBNm/dfF/a82Tc4DTQdxz69qBdKiQ1oKUm8BA06Oi6NCMEAwDwYDVR0TAQH/BAUw
  46258. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFAG5L++/EYZg8k/QQW6rcx/n0m5JMAoGCCqG
  46259. SM49BAMDA2kAMGYCMQCuSuMrQMN0EfKVrRYj3k4MGuZdpSRea0R7/DjiT8ucRRcRTBQnJlU5dUoD
  46260. zBOQn5ICMQD6SmxgiHPz7riYYqnOK8LZiqZwMR2vsJRM60/G49HzYqc8/5MuB1xJAWdpEgJyv+c=
  46261. -----END CERTIFICATE-----
  46262. GlobalSign Root R46
  46263. ===================
  46264. -----BEGIN CERTIFICATE-----
  46265. MIIFWjCCA0KgAwIBAgISEdK7udcjGJ5AXwqdLdDfJWfRMA0GCSqGSIb3DQEBDAUAMEYxCzAJBgNV
  46266. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJv
  46267. b3QgUjQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAX
  46268. BgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBSNDYwggIi
  46269. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCsrHQy6LNl5brtQyYdpokNRbopiLKkHWPd08Es
  46270. CVeJOaFV6Wc0dwxu5FUdUiXSE2te4R2pt32JMl8Nnp8semNgQB+msLZ4j5lUlghYruQGvGIFAha/
  46271. r6gjA7aUD7xubMLL1aa7DOn2wQL7Id5m3RerdELv8HQvJfTqa1VbkNud316HCkD7rRlr+/fKYIje
  46272. 2sGP1q7Vf9Q8g+7XFkyDRTNrJ9CG0Bwta/OrffGFqfUo0q3v84RLHIf8E6M6cqJaESvWJ3En7YEt
  46273. bWaBkoe0G1h6zD8K+kZPTXhc+CtI4wSEy132tGqzZfxCnlEmIyDLPRT5ge1lFgBPGmSXZgjPjHvj
  46274. K8Cd+RTyG/FWaha/LIWFzXg4mutCagI0GIMXTpRW+LaCtfOW3T3zvn8gdz57GSNrLNRyc0NXfeD4
  46275. 12lPFzYE+cCQYDdF3uYM2HSNrpyibXRdQr4G9dlkbgIQrImwTDsHTUB+JMWKmIJ5jqSngiCNI/on
  46276. ccnfxkF0oE32kRbcRoxfKWMxWXEM2G/CtjJ9++ZdU6Z+Ffy7dXxd7Pj2Fxzsx2sZy/N78CsHpdls
  46277. eVR2bJ0cpm4O6XkMqCNqo98bMDGfsVR7/mrLZqrcZdCinkqaByFrgY/bxFn63iLABJzjqls2k+g9
  46278. vXqhnQt2sQvHnf3PmKgGwvgqo6GDoLclcqUC4wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYD
  46279. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA1yrc4GHqMywptWU4jaWSf8FmSwwDQYJKoZIhvcNAQEM
  46280. BQADggIBAHx47PYCLLtbfpIrXTncvtgdokIzTfnvpCo7RGkerNlFo048p9gkUbJUHJNOxO97k4Vg
  46281. JuoJSOD1u8fpaNK7ajFxzHmuEajwmf3lH7wvqMxX63bEIaZHU1VNaL8FpO7XJqti2kM3S+LGteWy
  46282. gxk6x9PbTZ4IevPuzz5i+6zoYMzRx6Fcg0XERczzF2sUyQQCPtIkpnnpHs6i58FZFZ8d4kuaPp92
  46283. CC1r2LpXFNqD6v6MVenQTqnMdzGxRBF6XLE+0xRFFRhiJBPSy03OXIPBNvIQtQ6IbbjhVp+J3pZm
  46284. OUdkLG5NrmJ7v2B0GbhWrJKsFjLtrWhV/pi60zTe9Mlhww6G9kuEYO4Ne7UyWHmRVSyBQ7N0H3qq
  46285. JZ4d16GLuc1CLgSkZoNNiTW2bKg2SnkheCLQQrzRQDGQob4Ez8pn7fXwgNNgyYMqIgXQBztSvwye
  46286. qiv5u+YfjyW6hY0XHgL+XVAEV8/+LbzvXMAaq7afJMbfc2hIkCwU9D9SGuTSyxTDYWnP4vkYxboz
  46287. nxSjBF25cfe1lNj2M8FawTSLfJvdkzrnE6JwYZ+vj+vYxXX4M2bUdGc6N3ec592kD3ZDZopD8p/7
  46288. DEJ4Y9HiD2971KE9dJeFt0g5QdYg/NA6s/rob8SKunE3vouXsXgxT7PntgMTzlSdriVZzH81Xwj3
  46289. QEUxeCp6
  46290. -----END CERTIFICATE-----
  46291. GlobalSign Root E46
  46292. ===================
  46293. -----BEGIN CERTIFICATE-----
  46294. MIICCzCCAZGgAwIBAgISEdK7ujNu1LzmJGjFDYQdmOhDMAoGCCqGSM49BAMDMEYxCzAJBgNVBAYT
  46295. AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRwwGgYDVQQDExNHbG9iYWxTaWduIFJvb3Qg
  46296. RTQ2MB4XDTE5MDMyMDAwMDAwMFoXDTQ2MDMyMDAwMDAwMFowRjELMAkGA1UEBhMCQkUxGTAXBgNV
  46297. BAoTEEdsb2JhbFNpZ24gbnYtc2ExHDAaBgNVBAMTE0dsb2JhbFNpZ24gUm9vdCBFNDYwdjAQBgcq
  46298. hkjOPQIBBgUrgQQAIgNiAAScDrHPt+ieUnd1NPqlRqetMhkytAepJ8qUuwzSChDH2omwlwxwEwkB
  46299. jtjqR+q+soArzfwoDdusvKSGN+1wCAB16pMLey5SnCNoIwZD7JIvU4Tb+0cUB+hflGddyXqBPCCj
  46300. QjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQxCpCPtsad0kRL
  46301. gLWi5h+xEk8blTAKBggqhkjOPQQDAwNoADBlAjEA31SQ7Zvvi5QCkxeCmb6zniz2C5GMn0oUsfZk
  46302. vLtoURMMA/cVi4RguYv/Uo7njLwcAjA8+RHUjE7AwWHCFUyqqx0LMV87HOIAl0Qx5v5zli/altP+
  46303. CAezNIm8BZ/3Hobui3A=
  46304. -----END CERTIFICATE-----
  46305. ANF Secure Server Root CA
  46306. =========================
  46307. -----BEGIN CERTIFICATE-----
  46308. MIIF7zCCA9egAwIBAgIIDdPjvGz5a7EwDQYJKoZIhvcNAQELBQAwgYQxEjAQBgNVBAUTCUc2MzI4
  46309. NzUxMDELMAkGA1UEBhMCRVMxJzAlBgNVBAoTHkFORiBBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lv
  46310. bjEUMBIGA1UECxMLQU5GIENBIFJhaXoxIjAgBgNVBAMTGUFORiBTZWN1cmUgU2VydmVyIFJvb3Qg
  46311. Q0EwHhcNMTkwOTA0MTAwMDM4WhcNMzkwODMwMTAwMDM4WjCBhDESMBAGA1UEBRMJRzYzMjg3NTEw
  46312. MQswCQYDVQQGEwJFUzEnMCUGA1UEChMeQU5GIEF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uMRQw
  46313. EgYDVQQLEwtBTkYgQ0EgUmFpejEiMCAGA1UEAxMZQU5GIFNlY3VyZSBTZXJ2ZXIgUm9vdCBDQTCC
  46314. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANvrayvmZFSVgpCjcqQZAZ2cC4Ffc0m6p6zz
  46315. BE57lgvsEeBbphzOG9INgxwruJ4dfkUyYA8H6XdYfp9qyGFOtibBTI3/TO80sh9l2Ll49a2pcbnv
  46316. T1gdpd50IJeh7WhM3pIXS7yr/2WanvtH2Vdy8wmhrnZEE26cLUQ5vPnHO6RYPUG9tMJJo8gN0pcv
  46317. B2VSAKduyK9o7PQUlrZXH1bDOZ8rbeTzPvY1ZNoMHKGESy9LS+IsJJ1tk0DrtSOOMspvRdOoiXse
  46318. zx76W0OLzc2oD2rKDF65nkeP8Nm2CgtYZRczuSPkdxl9y0oukntPLxB3sY0vaJxizOBQ+OyRp1RM
  46319. VwnVdmPF6GUe7m1qzwmd+nxPrWAI/VaZDxUse6mAq4xhj0oHdkLePfTdsiQzW7i1o0TJrH93PB0j
  46320. 7IKppuLIBkwC/qxcmZkLLxCKpvR/1Yd0DVlJRfbwcVw5Kda/SiOL9V8BY9KHcyi1Swr1+KuCLH5z
  46321. JTIdC2MKF4EA/7Z2Xue0sUDKIbvVgFHlSFJnLNJhiQcND85Cd8BEc5xEUKDbEAotlRyBr+Qc5RQe
  46322. 8TZBAQIvfXOn3kLMTOmJDVb3n5HUA8ZsyY/b2BzgQJhdZpmYgG4t/wHFzstGH6wCxkPmrqKEPMVO
  46323. Hj1tyRRM4y5Bu8o5vzY8KhmqQYdOpc5LMnndkEl/AgMBAAGjYzBhMB8GA1UdIwQYMBaAFJxf0Gxj
  46324. o1+TypOYCK2Mh6UsXME3MB0GA1UdDgQWBBScX9BsY6Nfk8qTmAitjIelLFzBNzAOBgNVHQ8BAf8E
  46325. BAMCAYYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEATh65isagmD9uw2nAalxJ
  46326. UqzLK114OMHVVISfk/CHGT0sZonrDUL8zPB1hT+L9IBdeeUXZ701guLyPI59WzbLWoAAKfLOKyzx
  46327. j6ptBZNscsdW699QIyjlRRA96Gejrw5VD5AJYu9LWaL2U/HANeQvwSS9eS9OICI7/RogsKQOLHDt
  46328. dD+4E5UGUcjohybKpFtqFiGS3XNgnhAY3jyB6ugYw3yJ8otQPr0R4hUDqDZ9MwFsSBXXiJCZBMXM
  46329. 5gf0vPSQ7RPi6ovDj6MzD8EpTBNO2hVWcXNyglD2mjN8orGoGjR0ZVzO0eurU+AagNjqOknkJjCb
  46330. 5RyKqKkVMoaZkgoQI1YS4PbOTOK7vtuNknMBZi9iPrJyJ0U27U1W45eZ/zo1PqVUSlJZS2Db7v54
  46331. EX9K3BR5YLZrZAPbFYPhor72I5dQ8AkzNqdxliXzuUJ92zg/LFis6ELhDtjTO0wugumDLmsx2d1H
  46332. hk9tl5EuT+IocTUW0fJz/iUrB0ckYyfI+PbZa/wSMVYIwFNCr5zQM378BvAxRAMU8Vjq8moNqRGy
  46333. g77FGr8H6lnco4g175x2MjxNBiLOFeXdntiP2t7SxDnlF4HPOEfrf4htWRvfn0IUrn7PqLBmZdo3
  46334. r5+qPeoott7VMVgWglvquxl1AnMaykgaIZOQCo6ThKd9OyMYkomgjaw=
  46335. -----END CERTIFICATE-----
  46336. Certum EC-384 CA
  46337. ================
  46338. -----BEGIN CERTIFICATE-----
  46339. MIICZTCCAeugAwIBAgIQeI8nXIESUiClBNAt3bpz9DAKBggqhkjOPQQDAzB0MQswCQYDVQQGEwJQ
  46340. TDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
  46341. dGlmaWNhdGlvbiBBdXRob3JpdHkxGTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwHhcNMTgwMzI2
  46342. MDcyNDU0WhcNNDMwMzI2MDcyNDU0WjB0MQswCQYDVQQGEwJQTDEhMB8GA1UEChMYQXNzZWNvIERh
  46343. dGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx
  46344. GTAXBgNVBAMTEENlcnR1bSBFQy0zODQgQ0EwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATEKI6rGFtq
  46345. vm5kN2PkzeyrOvfMobgOgknXhimfoZTy42B4mIF4Bk3y7JoOV2CDn7TmFy8as10CW4kjPMIRBSqn
  46346. iBMY81CE1700LCeJVf/OTOffph8oxPBUw7l8t1Ot68KjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  46347. VR0OBBYEFI0GZnQkdjrzife81r1HfS+8EF9LMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNo
  46348. ADBlAjADVS2m5hjEfO/JUG7BJw+ch69u1RsIGL2SKcHvlJF40jocVYli5RsJHrpka/F2tNQCMQC0
  46349. QoSZ/6vnnvuRlydd3LBbMHHOXjgaatkl5+r3YZJW+OraNsKHZZYuciUvf9/DE8k=
  46350. -----END CERTIFICATE-----
  46351. Certum Trusted Root CA
  46352. ======================
  46353. -----BEGIN CERTIFICATE-----
  46354. MIIFwDCCA6igAwIBAgIQHr9ZULjJgDdMBvfrVU+17TANBgkqhkiG9w0BAQ0FADB6MQswCQYDVQQG
  46355. EwJQTDEhMB8GA1UEChMYQXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0g
  46356. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0Ew
  46357. HhcNMTgwMzE2MTIxMDEzWhcNNDMwMzE2MTIxMDEzWjB6MQswCQYDVQQGEwJQTDEhMB8GA1UEChMY
  46358. QXNzZWNvIERhdGEgU3lzdGVtcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlvbiBB
  46359. dXRob3JpdHkxHzAdBgNVBAMTFkNlcnR1bSBUcnVzdGVkIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEB
  46360. AQUAA4ICDwAwggIKAoICAQDRLY67tzbqbTeRn06TpwXkKQMlzhyC93yZn0EGze2jusDbCSzBfN8p
  46361. fktlL5On1AFrAygYo9idBcEq2EXxkd7fO9CAAozPOA/qp1x4EaTByIVcJdPTsuclzxFUl6s1wB52
  46362. HO8AU5853BSlLCIls3Jy/I2z5T4IHhQqNwuIPMqw9MjCoa68wb4pZ1Xi/K1ZXP69VyywkI3C7Te2
  46363. fJmItdUDmj0VDT06qKhF8JVOJVkdzZhpu9PMMsmN74H+rX2Ju7pgE8pllWeg8xn2A1bUatMn4qGt
  46364. g/BKEiJ3HAVz4hlxQsDsdUaakFjgao4rpUYwBI4Zshfjvqm6f1bxJAPXsiEodg42MEx51UGamqi4
  46365. NboMOvJEGyCI98Ul1z3G4z5D3Yf+xOr1Uz5MZf87Sst4WmsXXw3Hw09Omiqi7VdNIuJGmj8PkTQk
  46366. fVXjjJU30xrwCSss0smNtA0Aq2cpKNgB9RkEth2+dv5yXMSFytKAQd8FqKPVhJBPC/PgP5sZ0jeJ
  46367. P/J7UhyM9uH3PAeXjA6iWYEMspA90+NZRu0PqafegGtaqge2Gcu8V/OXIXoMsSt0Puvap2ctTMSY
  46368. njYJdmZm/Bo/6khUHL4wvYBQv3y1zgD2DGHZ5yQD4OMBgQ692IU0iL2yNqh7XAjlRICMb/gv1SHK
  46369. HRzQ+8S1h9E6Tsd2tTVItQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSM+xx1
  46370. vALTn04uSNn5YFSqxLNP+jAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIBAEii1QAL
  46371. LtA/vBzVtVRJHlpr9OTy4EA34MwUe7nJ+jW1dReTagVphZzNTxl4WxmB82M+w85bj/UvXgF2Ez8s
  46372. ALnNllI5SW0ETsXpD4YN4fqzX4IS8TrOZgYkNCvozMrnadyHncI013nR03e4qllY/p0m+jiGPp2K
  46373. h2RX5Rc64vmNueMzeMGQ2Ljdt4NR5MTMI9UGfOZR0800McD2RrsLrfw9EAUqO0qRJe6M1ISHgCq8
  46374. CYyqOhNf6DR5UMEQGfnTKB7U0VEwKbOukGfWHwpjscWpxkIxYxeU72nLL/qMFH3EQxiJ2fAyQOaA
  46375. 4kZf5ePBAFmo+eggvIksDkc0C+pXwlM2/KfUrzHN/gLldfq5Jwn58/U7yn2fqSLLiMmq0Uc9Nneo
  46376. WWRrJ8/vJ8HjJLWG965+Mk2weWjROeiQWMODvA8s1pfrzgzhIMfatz7DP78v3DSk+yshzWePS/Tj
  46377. 6tQ/50+6uaWTRRxmHyH6ZF5v4HaUMst19W7l9o/HuKTMqJZ9ZPskWkoDbGs4xugDQ5r3V7mzKWmT
  46378. OPQD8rv7gmsHINFSH5pkAnuYZttcTVoP0ISVoDwUQwbKytu4QTbaakRnh6+v40URFWkIsr4WOZck
  46379. bxJF0WddCajJFdr60qZfE2Efv4WstK2tBZQIgx51F9NxO5NQI1mg7TyRVJ12AMXDuDjb
  46380. -----END CERTIFICATE-----
  46381. TunTrust Root CA
  46382. ================
  46383. -----BEGIN CERTIFICATE-----
  46384. MIIFszCCA5ugAwIBAgIUEwLV4kBMkkaGFmddtLu7sms+/BMwDQYJKoZIhvcNAQELBQAwYTELMAkG
  46385. A1UEBhMCVE4xNzA1BgNVBAoMLkFnZW5jZSBOYXRpb25hbGUgZGUgQ2VydGlmaWNhdGlvbiBFbGVj
  46386. dHJvbmlxdWUxGTAXBgNVBAMMEFR1blRydXN0IFJvb3QgQ0EwHhcNMTkwNDI2MDg1NzU2WhcNNDQw
  46387. NDI2MDg1NzU2WjBhMQswCQYDVQQGEwJUTjE3MDUGA1UECgwuQWdlbmNlIE5hdGlvbmFsZSBkZSBD
  46388. ZXJ0aWZpY2F0aW9uIEVsZWN0cm9uaXF1ZTEZMBcGA1UEAwwQVHVuVHJ1c3QgUm9vdCBDQTCCAiIw
  46389. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMPN0/y9BFPdDCA61YguBUtB9YOCfvdZn56eY+hz
  46390. 2vYGqU8ftPkLHzmMmiDQfgbU7DTZhrx1W4eI8NLZ1KMKsmwb60ksPqxd2JQDoOw05TDENX37Jk0b
  46391. bjBU2PWARZw5rZzJJQRNmpA+TkBuimvNKWfGzC3gdOgFVwpIUPp6Q9p+7FuaDmJ2/uqdHYVy7BG7
  46392. NegfJ7/Boce7SBbdVtfMTqDhuazb1YMZGoXRlJfXyqNlC/M4+QKu3fZnz8k/9YosRxqZbwUN/dAd
  46393. gjH8KcwAWJeRTIAAHDOFli/LQcKLEITDCSSJH7UP2dl3RxiSlGBcx5kDPP73lad9UKGAwqmDrViW
  46394. VSHbhlnUr8a83YFuB9tgYv7sEG7aaAH0gxupPqJbI9dkxt/con3YS7qC0lH4Zr8GRuR5KiY2eY8f
  46395. Tpkdso8MDhz/yV3A/ZAQprE38806JG60hZC/gLkMjNWb1sjxVj8agIl6qeIbMlEsPvLfe/ZdeikZ
  46396. juXIvTZxi11Mwh0/rViizz1wTaZQmCXcI/m4WEEIcb9PuISgjwBUFfyRbVinljvrS5YnzWuioYas
  46397. DXxU5mZMZl+QviGaAkYt5IPCgLnPSz7ofzwB7I9ezX/SKEIBlYrilz0QIX32nRzFNKHsLA4KUiwS
  46398. VXAkPcvCFDVDXSdOvsC9qnyW5/yeYa1E0wCXAgMBAAGjYzBhMB0GA1UdDgQWBBQGmpsfU33x9aTI
  46399. 04Y+oXNZtPdEITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFAaamx9TffH1pMjThj6hc1m0
  46400. 90QhMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAqgVutt0Vyb+zxiD2BkewhpMl
  46401. 0425yAA/l/VSJ4hxyXT968pk21vvHl26v9Hr7lxpuhbI87mP0zYuQEkHDVneixCwSQXi/5E/S7fd
  46402. Ao74gShczNxtr18UnH1YeA32gAm56Q6XKRm4t+v4FstVEuTGfbvE7Pi1HE4+Z7/FXxttbUcoqgRY
  46403. YdZ2vyJ/0Adqp2RT8JeNnYA/u8EH22Wv5psymsNUk8QcCMNE+3tjEUPRahphanltkE8pjkcFwRJp
  46404. adbGNjHh/PqAulxPxOu3Mqz4dWEX1xAZufHSCe96Qp1bWgvUxpVOKs7/B9dPfhgGiPEZtdmYu65x
  46405. xBzndFlY7wyJz4sfdZMaBBSSSFCp61cpABbjNhzI+L/wM9VBD8TMPN3pM0MBkRArHtG5Xc0yGYuP
  46406. jCB31yLEQtyEFpslbei0VXF/sHyz03FJuc9SpAQ/3D2gu68zngowYI7bnV2UqL1g52KAdoGDDIzM
  46407. MEZJ4gzSqK/rYXHv5yJiqfdcZGyfFoxnNidF9Ql7v/YQCvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9z
  46408. ZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZHu/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3r
  46409. AZ3r2OvEhJn7wAzMMujjd9qDRIueVSjAi1jTkD5OGwDxFa2DK5o=
  46410. -----END CERTIFICATE-----
  46411. HARICA TLS RSA Root CA 2021
  46412. ===========================
  46413. -----BEGIN CERTIFICATE-----
  46414. MIIFpDCCA4ygAwIBAgIQOcqTHO9D88aOk8f0ZIk4fjANBgkqhkiG9w0BAQsFADBsMQswCQYDVQQG
  46415. EwJHUjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  46416. cyBDQTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBSU0EgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTEwNTUz
  46417. OFoXDTQ1MDIxMzEwNTUzN1owbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRl
  46418. bWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgUlNB
  46419. IFJvb3QgQ0EgMjAyMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIvC569lmwVnlskN
  46420. JLnQDmT8zuIkGCyEf3dRywQRNrhe7Wlxp57kJQmXZ8FHws+RFjZiPTgE4VGC/6zStGndLuwRo0Xu
  46421. a2s7TL+MjaQenRG56Tj5eg4MmOIjHdFOY9TnuEFE+2uva9of08WRiFukiZLRgeaMOVig1mlDqa2Y
  46422. Ulhu2wr7a89o+uOkXjpFc5gH6l8Cct4MpbOfrqkdtx2z/IpZ525yZa31MJQjB/OCFks1mJxTuy/K
  46423. 5FrZx40d/JiZ+yykgmvwKh+OC19xXFyuQnspiYHLA6OZyoieC0AJQTPb5lh6/a6ZcMBaD9YThnEv
  46424. dmn8kN3bLW7R8pv1GmuebxWMevBLKKAiOIAkbDakO/IwkfN4E8/BPzWr8R0RI7VDIp4BkrcYAuUR
  46425. 0YLbFQDMYTfBKnya4dC6s1BG7oKsnTH4+yPiAwBIcKMJJnkVU2DzOFytOOqBAGMUuTNe3QvboEUH
  46426. GjMJ+E20pwKmafTCWQWIZYVWrkvL4N48fS0ayOn7H6NhStYqE613TBoYm5EPWNgGVMWX+Ko/IIqm
  46427. haZ39qb8HOLubpQzKoNQhArlT4b4UEV4AIHrW2jjJo3Me1xR9BQsQL4aYB16cmEdH2MtiKrOokWQ
  46428. CPxrvrNQKlr9qEgYRtaQQJKQCoReaDH46+0N0x3GfZkYVVYnZS6NRcUk7M7jAgMBAAGjQjBAMA8G
  46429. A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFApII6ZgpJIKM+qTW8VX6iVNvRLuMA4GA1UdDwEB/wQE
  46430. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAPpBIqm5iFSVmewzVjIuJndftTgfvnNAUX15QvWiWkKQU
  46431. EapobQk1OUAJ2vQJLDSle1mESSmXdMgHHkdt8s4cUCbjnj1AUz/3f5Z2EMVGpdAgS1D0NTsY9FVq
  46432. QRtHBmg8uwkIYtlfVUKqrFOFrJVWNlar5AWMxajaH6NpvVMPxP/cyuN+8kyIhkdGGvMA9YCRotxD
  46433. QpSbIPDRzbLrLFPCU3hKTwSUQZqPJzLB5UkZv/HywouoCjkxKLR9YjYsTewfM7Z+d21+UPCfDtcR
  46434. j88YxeMn/ibvBZ3PzzfF0HvaO7AWhAw6k9a+F9sPPg4ZeAnHqQJyIkv3N3a6dcSFA1pj1bF1BcK5
  46435. vZStjBWZp5N99sXzqnTPBIWUmAD04vnKJGW/4GKvyMX6ssmeVkjaef2WdhW+o45WxLM0/L5H9MG0
  46436. qPzVMIho7suuyWPEdr6sOBjhXlzPrjoiUevRi7PzKzMHVIf6tLITe7pTBGIBnfHAT+7hOtSLIBD6
  46437. Alfm78ELt5BGnBkpjNxvoEppaZS3JGWg/6w/zgH7IS79aPib8qXPMThcFarmlwDB31qlpzmq6YR/
  46438. PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YWxw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnn
  46439. kf3/W9b3raYvAwtt41dU63ZTGI0RmLo=
  46440. -----END CERTIFICATE-----
  46441. HARICA TLS ECC Root CA 2021
  46442. ===========================
  46443. -----BEGIN CERTIFICATE-----
  46444. MIICVDCCAdugAwIBAgIQZ3SdjXfYO2rbIvT/WeK/zjAKBggqhkjOPQQDAzBsMQswCQYDVQQGEwJH
  46445. UjE3MDUGA1UECgwuSGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBD
  46446. QTEkMCIGA1UEAwwbSEFSSUNBIFRMUyBFQ0MgUm9vdCBDQSAyMDIxMB4XDTIxMDIxOTExMDExMFoX
  46447. DTQ1MDIxMzExMDEwOVowbDELMAkGA1UEBhMCR1IxNzA1BgNVBAoMLkhlbGxlbmljIEFjYWRlbWlj
  46448. IGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ0ExJDAiBgNVBAMMG0hBUklDQSBUTFMgRUNDIFJv
  46449. b3QgQ0EgMjAyMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABDgI/rGgltJ6rK9JOtDA4MM7KKrxcm1l
  46450. AEeIhPyaJmuqS7psBAqIXhfyVYf8MLA04jRYVxqEU+kw2anylnTDUR9YSTHMmE5gEYd103KUkE+b
  46451. ECUqqHgtvpBBWJAVcqeht6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUyRtTgRL+BNUW
  46452. 0aq8mm+3oJUZbsowDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2cAMGQCMBHervjcToiwqfAi
  46453. rcJRQO9gcS3ujwLEXQNwSaSS6sUUiHCm0w2wqsosQJz76YJumgIwK0eaB8bRwoF8yguWGEEbo/Qw
  46454. CZ61IygNnxS2PFOiTAZpffpskcYqSUXm7LcT4Tps
  46455. -----END CERTIFICATE-----
  46456. Autoridad de Certificacion Firmaprofesional CIF A62634068
  46457. =========================================================
  46458. -----BEGIN CERTIFICATE-----
  46459. MIIGFDCCA/ygAwIBAgIIG3Dp0v+ubHEwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCRVMxQjBA
  46460. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  46461. MjYzNDA2ODAeFw0xNDA5MjMxNTIyMDdaFw0zNjA1MDUxNTIyMDdaMFExCzAJBgNVBAYTAkVTMUIw
  46462. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  46463. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  46464. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  46465. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  46466. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  46467. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  46468. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  46469. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  46470. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  46471. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  46472. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMB0GA1Ud
  46473. DgQWBBRlzeurNR4APn7VdMActHNHDhpkLzASBgNVHRMBAf8ECDAGAQH/AgEBMIGmBgNVHSAEgZ4w
  46474. gZswgZgGBFUdIAAwgY8wLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuZmlybWFwcm9mZXNpb25hbC5j
  46475. b20vY3BzMFwGCCsGAQUFBwICMFAeTgBQAGEAcwBlAG8AIABkAGUAIABsAGEAIABCAG8AbgBhAG4A
  46476. bwB2AGEAIAA0ADcAIABCAGEAcgBjAGUAbABvAG4AYQAgADAAOAAwADEANzAOBgNVHQ8BAf8EBAMC
  46477. AQYwDQYJKoZIhvcNAQELBQADggIBAHSHKAIrdx9miWTtj3QuRhy7qPj4Cx2Dtjqn6EWKB7fgPiDL
  46478. 4QjbEwj4KKE1soCzC1HA01aajTNFSa9J8OA9B3pFE1r/yJfY0xgsfZb43aJlQ3CTkBW6kN/oGbDb
  46479. LIpgD7dvlAceHabJhfa9NPhAeGIQcDq+fUs5gakQ1JZBu/hfHAsdCPKxsIl68veg4MSPi3i1O1il
  46480. I45PVf42O+AMt8oqMEEgtIDNrvx2ZnOorm7hfNoD6JQg5iKj0B+QXSBTFCZX2lSX3xZEEAEeiGaP
  46481. cjiT3SC3NL7X8e5jjkd5KAb881lFJWAiMxujX6i6KtoaPc1A6ozuBRWV1aUsIC+nmCjuRfzxuIgA
  46482. LI9C2lHVnOUTaHFFQ4ueCyE8S1wF3BqfmI7avSKecs2tCsvMo2ebKHTEm9caPARYpoKdrcd7b/+A
  46483. lun4jWq9GJAd/0kakFI3ky88Al2CdgtR5xbHV/g4+afNmyJU72OwFW1TZQNKXkqgsqeOSQBZONXH
  46484. 9IBk9W6VULgRfhVwOEqwf9DEMnDAGf/JOC0ULGb0QkTmVXYbgBVX/8Cnp6o5qtjTcNAuuuuUavpf
  46485. NIbnYrX9ivAwhZTJryQCL2/W3Wf+47BVTwSYT6RBVuKT0Gro1vP7ZeDOdcQxWQzugsgMYDNKGbqE
  46486. ZycPvEJdvSRUDewdcAZfpLz6IHxV
  46487. -----END CERTIFICATE-----
  46488. vTrus ECC Root CA
  46489. =================
  46490. -----BEGIN CERTIFICATE-----
  46491. MIICDzCCAZWgAwIBAgIUbmq8WapTvpg5Z6LSa6Q75m0c1towCgYIKoZIzj0EAwMwRzELMAkGA1UE
  46492. BhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBS
  46493. b290IENBMB4XDTE4MDczMTA3MjY0NFoXDTQzMDczMTA3MjY0NFowRzELMAkGA1UEBhMCQ04xHDAa
  46494. BgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xGjAYBgNVBAMTEXZUcnVzIEVDQyBSb290IENBMHYw
  46495. EAYHKoZIzj0CAQYFK4EEACIDYgAEZVBKrox5lkqqHAjDo6LN/llWQXf9JpRCux3NCNtzslt188+c
  46496. ToL0v/hhJoVs1oVbcnDS/dtitN9Ti72xRFhiQgnH+n9bEOf+QP3A2MMrMudwpremIFUde4BdS49n
  46497. TPEQo0IwQDAdBgNVHQ4EFgQUmDnNvtiyjPeyq+GtJK97fKHbH88wDwYDVR0TAQH/BAUwAwEB/zAO
  46498. BgNVHQ8BAf8EBAMCAQYwCgYIKoZIzj0EAwMDaAAwZQIwV53dVvHH4+m4SVBrm2nDb+zDfSXkV5UT
  46499. QJtS0zvzQBm8JsctBp61ezaf9SXUY2sAAjEA6dPGnlaaKsyh2j/IZivTWJwghfqrkYpwcBE4YGQL
  46500. YgmRWAD5Tfs0aNoJrSEGGJTO
  46501. -----END CERTIFICATE-----
  46502. vTrus Root CA
  46503. =============
  46504. -----BEGIN CERTIFICATE-----
  46505. MIIFVjCCAz6gAwIBAgIUQ+NxE9izWRRdt86M/TX9b7wFjUUwDQYJKoZIhvcNAQELBQAwQzELMAkG
  46506. A1UEBhMCQ04xHDAaBgNVBAoTE2lUcnVzQ2hpbmEgQ28uLEx0ZC4xFjAUBgNVBAMTDXZUcnVzIFJv
  46507. b3QgQ0EwHhcNMTgwNzMxMDcyNDA1WhcNNDMwNzMxMDcyNDA1WjBDMQswCQYDVQQGEwJDTjEcMBoG
  46508. A1UEChMTaVRydXNDaGluYSBDby4sTHRkLjEWMBQGA1UEAxMNdlRydXMgUm9vdCBDQTCCAiIwDQYJ
  46509. KoZIhvcNAQEBBQADggIPADCCAgoCggIBAL1VfGHTuB0EYgWgrmy3cLRB6ksDXhA/kFocizuwZots
  46510. SKYcIrrVQJLuM7IjWcmOvFjai57QGfIvWcaMY1q6n6MLsLOaXLoRuBLpDLvPbmyAhykUAyyNJJrI
  46511. ZIO1aqwTLDPxn9wsYTwaP3BVm60AUn/PBLn+NvqcwBauYv6WTEN+VRS+GrPSbcKvdmaVayqwlHeF
  46512. XgQPYh1jdfdr58tbmnDsPmcF8P4HCIDPKNsFxhQnL4Z98Cfe/+Z+M0jnCx5Y0ScrUw5XSmXX+6KA
  46513. YPxMvDVTAWqXcoKv8R1w6Jz1717CbMdHflqUhSZNO7rrTOiwCcJlwp2dCZtOtZcFrPUGoPc2BX70
  46514. kLJrxLT5ZOrpGgrIDajtJ8nU57O5q4IikCc9Kuh8kO+8T/3iCiSn3mUkpF3qwHYw03dQ+A0Em5Q2
  46515. AXPKBlim0zvc+gRGE1WKyURHuFE5Gi7oNOJ5y1lKCn+8pu8fA2dqWSslYpPZUxlmPCdiKYZNpGvu
  46516. /9ROutW04o5IWgAZCfEF2c6Rsffr6TlP9m8EQ5pV9T4FFL2/s1m02I4zhKOQUqqzApVg+QxMaPnu
  46517. 1RcN+HFXtSXkKe5lXa/R7jwXC1pDxaWG6iSe4gUH3DRCEpHWOXSuTEGC2/KmSNGzm/MzqvOmwMVO
  46518. 9fSddmPmAsYiS8GVP1BkLFTltvA8Kc9XAgMBAAGjQjBAMB0GA1UdDgQWBBRUYnBj8XWEQ1iO0RYg
  46519. scasGrz2iTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOC
  46520. AgEAKbqSSaet8PFww+SX8J+pJdVrnjT+5hpk9jprUrIQeBqfTNqK2uwcN1LgQkv7bHbKJAs5EhWd
  46521. nxEt/Hlk3ODg9d3gV8mlsnZwUKT+twpw1aA08XXXTUm6EdGz2OyC/+sOxL9kLX1jbhd47F18iMjr
  46522. jld22VkE+rxSH0Ws8HqA7Oxvdq6R2xCOBNyS36D25q5J08FsEhvMKar5CKXiNxTKsbhm7xqC5PD4
  46523. 8acWabfbqWE8n/Uxy+QARsIvdLGx14HuqCaVvIivTDUHKgLKeBRtRytAVunLKmChZwOgzoy8sHJn
  46524. xDHO2zTlJQNgJXtxmOTAGytfdELSS8VZCAeHvsXDf+eW2eHcKJfWjwXj9ZtOyh1QRwVTsMo554Wg
  46525. icEFOwE30z9J4nfrI8iIZjs9OXYhRvHsXyO466JmdXTBQPfYaJqT4i2pLr0cox7IdMakLXogqzu4
  46526. sEb9b91fUlV1YvCXoHzXOP0l382gmxDPi7g4Xl7FtKYCNqEeXxzP4padKar9mK5S4fNBUvupLnKW
  46527. nyfjqnN9+BojZns7q2WwMgFLFT49ok8MKzWixtlnEjUwzXYuFrOZnk1PTi07NEPhmg4NpGaXutIc
  46528. SkwsKouLgU9xGqndXHt7CMUADTdA43x7VF8vhV929vensBxXVsFy6K2ir40zSbofitzmdHxghm+H
  46529. l3s=
  46530. -----END CERTIFICATE-----
  46531. ISRG Root X2
  46532. ============
  46533. -----BEGIN CERTIFICATE-----
  46534. MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQswCQYDVQQGEwJV
  46535. UzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElT
  46536. UkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVT
  46537. MSkwJwYDVQQKEyBJbnRlcm5ldCBTZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNS
  46538. RyBSb290IFgyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0H
  46539. ttwW+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9ItgKbppb
  46540. d9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
  46541. HQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZIzj0EAwMDaAAwZQIwe3lORlCEwkSHRhtF
  46542. cP9Ymd70/aTSVaYgLXTWNLxBo1BfASdWtL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5
  46543. U6VR5CmD1/iQMVtCnwr1/q4AaOeMSQ+2b1tbFfLn
  46544. -----END CERTIFICATE-----
  46545. HiPKI Root CA - G1
  46546. ==================
  46547. -----BEGIN CERTIFICATE-----
  46548. MIIFajCCA1KgAwIBAgIQLd2szmKXlKFD6LDNdmpeYDANBgkqhkiG9w0BAQsFADBPMQswCQYDVQQG
  46549. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xGzAZBgNVBAMMEkhpUEtJ
  46550. IFJvb3QgQ0EgLSBHMTAeFw0xOTAyMjIwOTQ2MDRaFw0zNzEyMzExNTU5NTlaME8xCzAJBgNVBAYT
  46551. AlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEbMBkGA1UEAwwSSGlQS0kg
  46552. Um9vdCBDQSAtIEcxMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9B5/UnMyDHPkvRN0
  46553. o9QwqNCuS9i233VHZvR85zkEHmpwINJaR3JnVfSl6J3VHiGh8Ge6zCFovkRTv4354twvVcg3Px+k
  46554. wJyz5HdcoEb+d/oaoDjq7Zpy3iu9lFc6uux55199QmQ5eiY29yTw1S+6lZgRZq2XNdZ1AYDgr/SE
  46555. YYwNHl98h5ZeQa/rh+r4XfEuiAU+TCK72h8q3VJGZDnzQs7ZngyzsHeXZJzA9KMuH5UHsBffMNsA
  46556. GJZMoYFL3QRtU6M9/Aes1MU3guvklQgZKILSQjqj2FPseYlgSGDIcpJQ3AOPgz+yQlda22rpEZfd
  46557. hSi8MEyr48KxRURHH+CKFgeW0iEPU8DtqX7UTuybCeyvQqww1r/REEXgphaypcXTT3OUM3ECoWqj
  46558. 1jOXTyFjHluP2cFeRXF3D4FdXyGarYPM+l7WjSNfGz1BryB1ZlpK9p/7qxj3ccC2HTHsOyDry+K4
  46559. 9a6SsvfhhEvyovKTmiKe0xRvNlS9H15ZFblzqMF8b3ti6RZsR1pl8w4Rm0bZ/W3c1pzAtH2lsN0/
  46560. Vm+h+fbkEkj9Bn8SV7apI09bA8PgcSojt/ewsTu8mL3WmKgMa/aOEmem8rJY5AIJEzypuxC00jBF
  46561. 8ez3ABHfZfjcK0NVvxaXxA/VLGGEqnKG/uY6fsI/fe78LxQ+5oXdUG+3Se0CAwEAAaNCMEAwDwYD
  46562. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ncX+l6o/vY9cdVouslGDDjYr7AwDgYDVR0PAQH/BAQD
  46563. AgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBQUfB13HAE4/+qddRxosuej6ip0691x1TPOhwEmSKsxBHi
  46564. 7zNKpiMdDg1H2DfHb680f0+BazVP6XKlMeJ45/dOlBhbQH3PayFUhuaVevvGyuqcSE5XCV0vrPSl
  46565. tJczWNWseanMX/mF+lLFjfiRFOs6DRfQUsJ748JzjkZ4Bjgs6FzaZsT0pPBWGTMpWmWSBUdGSquE
  46566. wx4noR8RkpkndZMPvDY7l1ePJlsMu5wP1G4wB9TcXzZoZjmDlicmisjEOf6aIW/Vcobpf2Lll07Q
  46567. JNBAsNB1CI69aO4I1258EHBGG3zgiLKecoaZAeO/n0kZtCW+VmWuF2PlHt/o/0elv+EmBYTksMCv
  46568. 5wiZqAxeJoBF1PhoL5aPruJKHJwWDBNvOIf2u8g0X5IDUXlwpt/L9ZlNec1OvFefQ05rLisY+Gpz
  46569. jLrFNe85akEez3GoorKGB1s6yeHvP2UEgEcyRHCVTjFnanRbEEV16rCf0OY1/k6fi8wrkkVbbiVg
  46570. hUbN0aqwdmaTd5a+g744tiROJgvM7XpWGuDpWsZkrUx6AEhEL7lAuxM+vhV4nYWBSipX3tUZQ9rb
  46571. yltHhoMLP7YNdnhzeSJesYAfz77RP1YQmCuVh6EfnWQUYDksswBVLuT1sw5XxJFBAJw/6KXf6vb/
  46572. yPCtbVKoF6ubYfwSUTXkJf2vqmqGOQ==
  46573. -----END CERTIFICATE-----
  46574. GlobalSign ECC Root CA - R4
  46575. ===========================
  46576. -----BEGIN CERTIFICATE-----
  46577. MIIB3DCCAYOgAwIBAgINAgPlfvU/k/2lCSGypjAKBggqhkjOPQQDAjBQMSQwIgYDVQQLExtHbG9i
  46578. YWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  46579. b2JhbFNpZ24wHhcNMTIxMTEzMDAwMDAwWhcNMzgwMTE5MDMxNDA3WjBQMSQwIgYDVQQLExtHbG9i
  46580. YWxTaWduIEVDQyBSb290IENBIC0gUjQxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  46581. b2JhbFNpZ24wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS4xnnTj2wlDp8uORkcA6SumuU5BwkW
  46582. ymOxuYb4ilfBV85C+nOh92VC/x7BALJucw7/xyHlGKSq2XE/qNS5zowdo0IwQDAOBgNVHQ8BAf8E
  46583. BAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVLB7rUW44kB/+wpu+74zyTyjhNUwCgYI
  46584. KoZIzj0EAwIDRwAwRAIgIk90crlgr/HmnKAWBVBfw147bmF0774BxL4YSFlhgjICICadVGNA3jdg
  46585. UM/I2O2dgq43mLyjj0xMqTQrbO/7lZsm
  46586. -----END CERTIFICATE-----
  46587. GTS Root R1
  46588. ===========
  46589. -----BEGIN CERTIFICATE-----
  46590. MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQGEwJV
  46591. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  46592. UjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  46593. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0G
  46594. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaM
  46595. f/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7raKb0
  46596. xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnWr4+w
  46597. B7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqMLnXW
  46598. nOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk
  46599. 9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zq
  46600. kUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92wO1A
  46601. K/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om3xPX
  46602. V2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNuJLDW
  46603. cfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0T
  46604. AQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQAD
  46605. ggIBAJ+qQibbC5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe
  46606. QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuyh6f88/qBVRRi
  46607. ClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM47HLwEXWdyzRSjeZ2axfG34ar
  46608. J45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8JZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYci
  46609. NuaCp+0KueIHoI17eko8cdLiA6EfMgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5me
  46610. LMFrUKTX5hgUvYU/Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJF
  46611. fbdT6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ0E6yove+
  46612. 7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm2tIMPNuzjsmhDYAPexZ3
  46613. FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bbbP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3
  46614. gm3c
  46615. -----END CERTIFICATE-----
  46616. GTS Root R2
  46617. ===========
  46618. -----BEGIN CERTIFICATE-----
  46619. MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQGEwJV
  46620. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  46621. UjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  46622. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0G
  46623. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3Lv
  46624. CvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo7JUl
  46625. e3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWIm8Wb
  46626. a96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5GmdFrS
  46627. +LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7M
  46628. kogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJG
  46629. r61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RWIr9q
  46630. S34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73VululycslaVNV
  46631. J1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy5okL
  46632. dWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0T
  46633. AQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQAD
  46634. ggIBAB/Kzt3HvqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8
  46635. 0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyCB19m3H0Q/gxh
  46636. swWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2uNmSRXbBoGOqKYcl3qJfEycel
  46637. /FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMgyALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVn
  46638. jWQye+mew4K6Ki3pHrTgSAai/GevHyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y5
  46639. 9PYjJbigapordwj6xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M
  46640. 7YNRTOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924SgJPFI/2R8
  46641. 0L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV7LXTWtiBmelDGDfrs7vR
  46642. WGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjW
  46643. HYbL
  46644. -----END CERTIFICATE-----
  46645. GTS Root R3
  46646. ===========
  46647. -----BEGIN CERTIFICATE-----
  46648. MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJVUzEi
  46649. MCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMw
  46650. HhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZ
  46651. R29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjO
  46652. PQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout
  46653. 736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24CejQjBA
  46654. MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP0/Eq
  46655. Er24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azT
  46656. L818+FsuVbu/3ZL3pAzcMeGiAjEA/JdmZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV
  46657. 11RZt+cRLInUue4X
  46658. -----END CERTIFICATE-----
  46659. GTS Root R4
  46660. ===========
  46661. -----BEGIN CERTIFICATE-----
  46662. MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJVUzEi
  46663. MCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQw
  46664. HhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZ
  46665. R29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjO
  46666. PQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzu
  46667. hXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqjQjBA
  46668. MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV2Py1
  46669. PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/C
  46670. r8deVl5c1RxYIigL9zC2L7F8AjEA8GE8p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh
  46671. 4rsUecrNIdSUtUlD
  46672. -----END CERTIFICATE-----
  46673. Telia Root CA v2
  46674. ================
  46675. -----BEGIN CERTIFICATE-----
  46676. MIIFdDCCA1ygAwIBAgIPAWdfJ9b+euPkrL4JWwWeMA0GCSqGSIb3DQEBCwUAMEQxCzAJBgNVBAYT
  46677. AkZJMRowGAYDVQQKDBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2
  46678. MjAeFw0xODExMjkxMTU1NTRaFw00MzExMjkxMTU1NTRaMEQxCzAJBgNVBAYTAkZJMRowGAYDVQQK
  46679. DBFUZWxpYSBGaW5sYW5kIE95ajEZMBcGA1UEAwwQVGVsaWEgUm9vdCBDQSB2MjCCAiIwDQYJKoZI
  46680. hvcNAQEBBQADggIPADCCAgoCggIBALLQPwe84nvQa5n44ndp586dpAO8gm2h/oFlH0wnrI4AuhZ7
  46681. 6zBqAMCzdGh+sq/H1WKzej9Qyow2RCRj0jbpDIX2Q3bVTKFgcmfiKDOlyzG4OiIjNLh9vVYiQJ3q
  46682. 9HsDrWj8soFPmNB06o3lfc1jw6P23pLCWBnglrvFxKk9pXSW/q/5iaq9lRdU2HhE8Qx3FZLgmEKn
  46683. pNaqIJLNwaCzlrI6hEKNfdWV5Nbb6WLEWLN5xYzTNTODn3WhUidhOPFZPY5Q4L15POdslv5e2QJl
  46684. tI5c0BE0312/UqeBAMN/mUWZFdUXyApT7GPzmX3MaRKGwhfwAZ6/hLzRUssbkmbOpFPlob/E2wnW
  46685. 5olWK8jjfN7j/4nlNW4o6GwLI1GpJQXrSPjdscr6bAhR77cYbETKJuFzxokGgeWKrLDiKca5JLNr
  46686. RBH0pUPCTEPlcDaMtjNXepUugqD0XBCzYYP2AgWGLnwtbNwDRm41k9V6lS/eINhbfpSQBGq6WT0E
  46687. BXWdN6IOLj3rwaRSg/7Qa9RmjtzG6RJOHSpXqhC8fF6CfaamyfItufUXJ63RDolUK5X6wK0dmBR4
  46688. M0KGCqlztft0DbcbMBnEWg4cJ7faGND/isgFuvGqHKI3t+ZIpEYslOqodmJHixBTB0hXbOKSTbau
  46689. BcvcwUpej6w9GU7C7WB1K9vBykLVAgMBAAGjYzBhMB8GA1UdIwQYMBaAFHKs5DN5qkWH9v2sHZ7W
  46690. xy+G2CQ5MB0GA1UdDgQWBBRyrOQzeapFh/b9rB2e1scvhtgkOTAOBgNVHQ8BAf8EBAMCAQYwDwYD
  46691. VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAoDtZpwmUPjaE0n4vOaWWl/oRrfxn83EJ
  46692. 8rKJhGdEr7nv7ZbsnGTbMjBvZ5qsfl+yqwE2foH65IRe0qw24GtixX1LDoJt0nZi0f6X+J8wfBj5
  46693. tFJ3gh1229MdqfDBmgC9bXXYfef6xzijnHDoRnkDry5023X4blMMA8iZGok1GTzTyVR8qPAs5m4H
  46694. eW9q4ebqkYJpCh3DflminmtGFZhb069GHWLIzoBSSRE/yQQSwxN8PzuKlts8oB4KtItUsiRnDe+C
  46695. y748fdHif64W1lZYudogsYMVoe+KTTJvQS8TUoKU1xrBeKJR3Stwbbca+few4GeXVtt8YVMJAygC
  46696. QMez2P2ccGrGKMOF6eLtGpOg3kuYooQ+BXcBlj37tCAPnHICehIv1aO6UXivKitEZU61/Qrowc15
  46697. h2Er3oBXRb9n8ZuRXqWk7FlIEA04x7D6w0RtBPV4UBySllva9bguulvP5fBqnUsvWHMtTy3EHD70
  46698. sz+rFQ47GUGKpMFXEmZxTPpT41frYpUJnlTd0cI8Vzy9OK2YZLe4A5pTVmBds9hCG1xLEooc6+t9
  46699. xnppxyd/pPiL8uSUZodL6ZQHCRJ5irLrdATczvREWeAWysUsWNc8e89ihmpQfTU2Zqf7N+cox9jQ
  46700. raVplI/owd8k+BsHMYeB2F326CjYSlKArBPuUBQemMc=
  46701. -----END CERTIFICATE-----
  46702. D-TRUST BR Root CA 1 2020
  46703. =========================
  46704. -----BEGIN CERTIFICATE-----
  46705. MIIC2zCCAmCgAwIBAgIQfMmPK4TX3+oPyWWa00tNljAKBggqhkjOPQQDAzBIMQswCQYDVQQGEwJE
  46706. RTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRSVVNUIEJSIFJvb3QgQ0EgMSAy
  46707. MDIwMB4XDTIwMDIxMTA5NDUwMFoXDTM1MDIxMTA5NDQ1OVowSDELMAkGA1UEBhMCREUxFTATBgNV
  46708. BAoTDEQtVHJ1c3QgR21iSDEiMCAGA1UEAxMZRC1UUlVTVCBCUiBSb290IENBIDEgMjAyMDB2MBAG
  46709. ByqGSM49AgEGBSuBBAAiA2IABMbLxyjR+4T1mu9CFCDhQ2tuda38KwOE1HaTJddZO0Flax7mNCq7
  46710. dPYSzuht56vkPE4/RAiLzRZxy7+SmfSk1zxQVFKQhYN4lGdnoxwJGT11NIXe7WB9xwy0QVK5buXu
  46711. QqOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFHOREKv/VbNafAkl1bK6CKBrqx9t
  46712. MA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6gPKA6hjhodHRwOi8vY3JsLmQtdHJ1c3Qu
  46713. bmV0L2NybC9kLXRydXN0X2JyX3Jvb3RfY2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVj
  46714. dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwQlIlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxP
  46715. PUQtVHJ1c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjOPQQD
  46716. AwNpADBmAjEAlJAtE/rhY/hhY+ithXhUkZy4kzg+GkHaQBZTQgjKL47xPoFWwKrY7RjEsK70Pvom
  46717. AjEA8yjixtsrmfu3Ubgko6SUeho/5jbiA1czijDLgsfWFBHVdWNbFJWcHwHP2NVypw87
  46718. -----END CERTIFICATE-----
  46719. D-TRUST EV Root CA 1 2020
  46720. =========================
  46721. -----BEGIN CERTIFICATE-----
  46722. MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQswCQYDVQQGEwJE
  46723. RTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRSVVNUIEVWIFJvb3QgQ0EgMSAy
  46724. MDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNV
  46725. BAoTDEQtVHJ1c3QgR21iSDEiMCAGA1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAG
  46726. ByqGSM49AgEGBSuBBAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8
  46727. ZRCC/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rDwpdhQntJ
  46728. raOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3OqQo5FD4pPfsazK2/umL
  46729. MA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6gPKA6hjhodHRwOi8vY3JsLmQtdHJ1c3Qu
  46730. bmV0L2NybC9kLXRydXN0X2V2X3Jvb3RfY2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVj
  46731. dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxP
  46732. PUQtVHJ1c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjOPQQD
  46733. AwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CAy/m0sRtW9XLS/BnR
  46734. AjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJbgfM0agPnIjhQW+0ZT0MW
  46735. -----END CERTIFICATE-----
  46736. DigiCert TLS ECC P384 Root G5
  46737. =============================
  46738. -----BEGIN CERTIFICATE-----
  46739. MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQswCQYDVQQGEwJV
  46740. UzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURpZ2lDZXJ0IFRMUyBFQ0MgUDM4
  46741. NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMx
  46742. FzAVBgNVBAoTDkRpZ2lDZXJ0LCBJbmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQg
  46743. Um9vdCBHNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1Tzvd
  46744. lHJS7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp0zVozptj
  46745. n4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICISB4CIfBFqMA4GA1UdDwEB
  46746. /wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gAMGUCMQCJao1H5+z8blUD2Wds
  46747. Jk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQLgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIx
  46748. AJSdYsiJvRmEFOml+wG4DXZDjC5Ty3zfDBeWUA==
  46749. -----END CERTIFICATE-----
  46750. DigiCert TLS RSA4096 Root G5
  46751. ============================
  46752. -----BEGIN CERTIFICATE-----
  46753. MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBNMQswCQYDVQQG
  46754. EwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0
  46755. MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcNNDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJV
  46756. UzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2
  46757. IFJvb3QgRzUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS8
  46758. 7IE+ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG02C+JFvuU
  46759. AT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgpwgscONyfMXdcvyej/Ces
  46760. tyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZMpG2T6T867jp8nVid9E6P/DsjyG244gXa
  46761. zOvswzH016cpVIDPRFtMbzCe88zdH5RDnU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnV
  46762. DdXifBBiqmvwPXbzP6PosMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9q
  46763. TXeXAaDxZre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cdLvvy
  46764. z6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvXKyY//SovcfXWJL5/
  46765. MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNeXoVPzthwiHvOAbWWl9fNff2C+MIk
  46766. wcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPLtgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4E
  46767. FgQUUTMc7TZArxfTJc1paPKvTiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8w
  46768. DQYJKoZIhvcNAQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw
  46769. GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7HPNtQOa27PShN
  46770. lnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLFO4uJ+DQtpBflF+aZfTCIITfN
  46771. MBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQREtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/
  46772. u4cnYiWB39yhL/btp/96j1EuMPikAdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9G
  46773. OUrYU9DzLjtxpdRv/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh
  46774. 47a+p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilwMUc/dNAU
  46775. FvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WFqUITVuwhd4GTWgzqltlJ
  46776. yqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCKovfepEWFJqgejF0pW8hL2JpqA15w8oVP
  46777. bEtoL8pU9ozaMv7Da4M/OMZ+
  46778. -----END CERTIFICATE-----
  46779. Certainly Root R1
  46780. =================
  46781. -----BEGIN CERTIFICATE-----
  46782. MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAwPTELMAkGA1UE
  46783. BhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2VydGFpbmx5IFJvb3QgUjEwHhcN
  46784. MjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2Vy
  46785. dGFpbmx5MRowGAYDVQQDExFDZXJ0YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  46786. ADCCAgoCggIBANA21B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O
  46787. 5MQTvqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbedaFySpvXl
  46788. 8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b01C7jcvk2xusVtyWMOvwl
  46789. DbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGI
  46790. XsXwClTNSaa/ApzSRKft43jvRl5tcdF5cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkN
  46791. KPl6I7ENPT2a/Z2B7yyQwHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQ
  46792. AjeZjOVJ6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA2Cnb
  46793. rlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyHWyf5QBGenDPBt+U1
  46794. VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMReiFPCyEQtkA6qyI6BJyLm4SGcprS
  46795. p6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud
  46796. DgQWBBTgqj8ljZ9EXME66C6ud0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAsz
  46797. HQNTVfSVcOQrPbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d
  46798. 8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi1wrykXprOQ4v
  46799. MMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrdrRT90+7iIgXr0PK3aBLXWopB
  46800. GsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9ditaY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+
  46801. gjwN/KUD+nsa2UUeYNrEjvn8K8l7lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgH
  46802. JBu6haEaBQmAupVjyTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7
  46803. fpYnKx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLyyCwzk5Iw
  46804. x06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5nwXARPbv0+Em34yaXOp/S
  46805. X3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6OV+KmalBWQewLK8=
  46806. -----END CERTIFICATE-----
  46807. Certainly Root E1
  46808. =================
  46809. -----BEGIN CERTIFICATE-----
  46810. MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQswCQYDVQQGEwJV
  46811. UzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlubHkgUm9vdCBFMTAeFw0yMTA0
  46812. MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJBgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlu
  46813. bHkxGjAYBgNVBAMTEUNlcnRhaW5seSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4
  46814. fxzf7flHh4axpMCK+IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9
  46815. YBk2QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8EBAMCAQYw
  46816. DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4hevIIgcwCgYIKoZIzj0E
  46817. AwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozmut6Dacpps6kFtZaSF4fC0urQe87YQVt8
  46818. rgIwRt7qy12a7DLCZRawTDBcMPPaTnOGBtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
  46819. -----END CERTIFICATE-----
  46820. Security Communication RootCA3
  46821. ==============================
  46822. -----BEGIN CERTIFICATE-----
  46823. MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBDAUAMF0xCzAJBgNVBAYTAkpQMSUw
  46824. IwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMScwJQYDVQQDEx5TZWN1cml0eSBD
  46825. b21tdW5pY2F0aW9uIFJvb3RDQTMwHhcNMTYwNjE2MDYxNzE2WhcNMzgwMTE4MDYxNzE2WjBdMQsw
  46826. CQYDVQQGEwJKUDElMCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UE
  46827. AxMeU2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EzMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  46828. MIICCgKCAgEA48lySfcw3gl8qUCBWNO0Ot26YQ+TUG5pPDXC7ltzkBtnTCHsXzW7OT4rCmDvu20r
  46829. hvtxosis5FaU+cmvsXLUIKx00rgVrVH+hXShuRD+BYD5UpOzQD11EKzAlrenfna84xtSGc4RHwsE
  46830. NPXY9Wk8d/Nk9A2qhd7gCVAEF5aEt8iKvE1y/By7z/MGTfmfZPd+pmaGNXHIEYBMwXFAWB6+oHP2
  46831. /D5Q4eAvJj1+XCO1eXDe+uDRpdYMQXF79+qMHIjH7Iv10S9VlkZ8WjtYO/u62C21Jdp6Ts9EriGm
  46832. npjKIG58u4iFW/vAEGK78vknR+/RiTlDxN/e4UG/VHMgly1s2vPUB6PmudhvrvyMGS7TZ2crldtY
  46833. XLVqAvO4g160a75BflcJdURQVc1aEWEhCmHCqYj9E7wtiS/NYeCVvsq1e+F7NGcLH7YMx3weGVPK
  46834. p7FKFSBWFHA9K4IsD50VHUeAR/94mQ4xr28+j+2GaR57GIgUssL8gjMunEst+3A7caoreyYn8xrC
  46835. 3PsXuKHqy6C0rtOUfnrQq8PsOC0RLoi/1D+tEjtCrI8Cbn3M0V9hvqG8OmpI6iZVIhZdXw3/JzOf
  46836. GAN0iltSIEdrRU0id4xVJ/CvHozJgyJUt5rQT9nO/NkuHJYosQLTA70lUhw0Zk8jq/R3gpYd0Vcw
  46837. CBEF/VfR2ccCAwEAAaNCMEAwHQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB
  46838. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS
  46839. YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PAFNr0Y/Dq9HHu
  46840. Tofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd9XbXv8S2gVj/yP9kaWJ5rW4O
  46841. H3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQIUYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASx
  46842. YfQAW0q3nHE3GYV5v4GwxxMOdnE+OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZ
  46843. XSEIx2C/pHF7uNkegr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml
  46844. +LLfiAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUVnuiZIesn
  46845. KwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD2NCcnWXL0CsnMQMeNuE9
  46846. dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI//1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm
  46847. 6Vwdp6POXiUyK+OVrCoHzrQoeIY8LaadTdJ0MN1kURXbg4NR16/9M51NZg==
  46848. -----END CERTIFICATE-----
  46849. Security Communication ECC RootCA1
  46850. ==================================
  46851. -----BEGIN CERTIFICATE-----
  46852. MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYTAkpQMSUwIwYD
  46853. VQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYDVQQDEyJTZWN1cml0eSBDb21t
  46854. dW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYxNjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTEL
  46855. MAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNV
  46856. BAMTIlNlY3VyaXR5IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQA
  46857. IgNiAASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+CnnfdldB9sELLo
  46858. 5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpKULGjQjBAMB0GA1UdDgQW
  46859. BBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAK
  46860. BggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3L
  46861. snNdo4gIxwwCMQDAqy0Obe0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70e
  46862. N9k=
  46863. -----END CERTIFICATE-----
  46864. BJCA Global Root CA1
  46865. ====================
  46866. -----BEGIN CERTIFICATE-----
  46867. MIIFdDCCA1ygAwIBAgIQVW9l47TZkGobCdFsPsBsIDANBgkqhkiG9w0BAQsFADBUMQswCQYDVQQG
  46868. EwJDTjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJVFkxHTAbBgNVBAMMFEJK
  46869. Q0EgR2xvYmFsIFJvb3QgQ0ExMB4XDTE5MTIxOTAzMTYxN1oXDTQ0MTIxMjAzMTYxN1owVDELMAkG
  46870. A1UEBhMCQ04xJjAkBgNVBAoMHUJFSUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQD
  46871. DBRCSkNBIEdsb2JhbCBSb290IENBMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAPFm
  46872. CL3ZxRVhy4QEQaVpN3cdwbB7+sN3SJATcmTRuHyQNZ0YeYjjlwE8R4HyDqKYDZ4/N+AZspDyRhyS
  46873. sTphzvq3Rp4Dhtczbu33RYx2N95ulpH3134rhxfVizXuhJFyV9xgw8O558dnJCNPYwpj9mZ9S1Wn
  46874. P3hkSWkSl+BMDdMJoDIwOvqfwPKcxRIqLhy1BDPapDgRat7GGPZHOiJBhyL8xIkoVNiMpTAK+BcW
  46875. yqw3/XmnkRd4OJmtWO2y3syJfQOcs4ll5+M7sSKGjwZteAf9kRJ/sGsciQ35uMt0WwfCyPQ10WRj
  46876. eulumijWML3mG90Vr4TqnMfK9Q7q8l0ph49pczm+LiRvRSGsxdRpJQaDrXpIhRMsDQa4bHlW/KNn
  46877. MoH1V6XKV0Jp6VwkYe/iMBhORJhVb3rCk9gZtt58R4oRTklH2yiUAguUSiz5EtBP6DF+bHq/pj+b
  46878. OT0CFqMYs2esWz8sgytnOYFcuX6U1WTdno9uruh8W7TXakdI136z1C2OVnZOz2nxbkRs1CTqjSSh
  46879. GL+9V/6pmTW12xB3uD1IutbB5/EjPtffhZ0nPNRAvQoMvfXnjSXWgXSHRtQpdaJCbPdzied9v3pK
  46880. H9MiyRVVz99vfFXQpIsHETdfg6YmV6YBW37+WGgHqel62bno/1Afq8K0wM7o6v0PvY1NuLxxAgMB
  46881. AAGjQjBAMB0GA1UdDgQWBBTF7+3M2I0hxkjk49cULqcWk+WYATAPBgNVHRMBAf8EBTADAQH/MA4G
  46882. A1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAUoKsITQfI/Ki2Pm4rzc2IInRNwPWaZ+4
  46883. YRC6ojGYWUfo0Q0lHhVBDOAqVdVXUsv45Mdpox1NcQJeXyFFYEhcCY5JEMEE3KliawLwQ8hOnThJ
  46884. dMkycFRtwUf8jrQ2ntScvd0g1lPJGKm1Vrl2i5VnZu69mP6u775u+2D2/VnGKhs/I0qUJDAnyIm8
  46885. 60Qkmss9vk/Ves6OF8tiwdneHg56/0OGNFK8YT88X7vZdrRTvJez/opMEi4r89fO4aL/3Xtw+zuh
  46886. TaRjAv04l5U/BXCga99igUOLtFkNSoxUnMW7gZ/NfaXvCyUeOiDbHPwfmGcCCtRzRBPbUYQaVQNW
  46887. 4AB+dAb/OMRyHdOoP2gxXdMJxy6MW2Pg6Nwe0uxhHvLe5e/2mXZgLR6UcnHGCyoyx5JO1UbXHfmp
  46888. GQrI+pXObSOYqgs4rZpWDW+N8TEAiMEXnM0ZNjX+VVOg4DwzX5Ze4jLp3zO7Bkqp2IRzznfSxqxx
  46889. 4VyjHQy7Ct9f4qNx2No3WqB4K/TUfet27fJhcKVlmtOJNBir+3I+17Q9eVzYH6Eze9mCUAyTF6ps
  46890. 3MKCuwJXNq+YJyo5UOGwifUll35HaBC07HPKs5fRJNz2YqAo07WjuGS3iGJCz51TzZm+ZGiPTx4S
  46891. SPfSKcOYKMryMguTjClPPGAyzQWWYezyr/6zcCwupvI=
  46892. -----END CERTIFICATE-----
  46893. BJCA Global Root CA2
  46894. ====================
  46895. -----BEGIN CERTIFICATE-----
  46896. MIICJTCCAaugAwIBAgIQLBcIfWQqwP6FGFkGz7RK6zAKBggqhkjOPQQDAzBUMQswCQYDVQQGEwJD
  46897. TjEmMCQGA1UECgwdQkVJSklORyBDRVJUSUZJQ0FURSBBVVRIT1JJVFkxHTAbBgNVBAMMFEJKQ0Eg
  46898. R2xvYmFsIFJvb3QgQ0EyMB4XDTE5MTIxOTAzMTgyMVoXDTQ0MTIxMjAzMTgyMVowVDELMAkGA1UE
  46899. BhMCQ04xJjAkBgNVBAoMHUJFSUpJTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZMR0wGwYDVQQDDBRC
  46900. SkNBIEdsb2JhbCBSb290IENBMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJ3LgJGNU2e1uVCxA/jl
  46901. SR9BIgmwUVJY1is0j8USRhTFiy8shP8sbqjV8QnjAyEUxEM9fMEsxEtqSs3ph+B99iK++kpRuDCK
  46902. /eHeGBIK9ke35xe/J4rUQUyWPGCWwf0VHKNCMEAwHQYDVR0OBBYEFNJKsVF/BvDRgh9Obl+rg/xI
  46903. 1LCRMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gAMGUCMBq8
  46904. W9f+qdJUDkpd0m2xQNz0Q9XSSpkZElaA94M04TVOSG0ED1cxMDAtsaqdAzjbBgIxAMvMh1PLet8g
  46905. UXOQwKhbYdDFUDn9hf7B43j4ptZLvZuHjw/l1lOWqzzIQNph91Oj9w==
  46906. -----END CERTIFICATE-----
  46907. Sectigo Public Server Authentication Root E46
  46908. =============================================
  46909. -----BEGIN CERTIFICATE-----
  46910. MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQswCQYDVQQGEwJH
  46911. QjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBTZXJ2
  46912. ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5
  46913. WjBfMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0
  46914. aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUr
  46915. gQQAIgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccCWvkEN/U0
  46916. NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+6xnOQ6OjQjBAMB0GA1Ud
  46917. DgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  46918. /zAKBggqhkjOPQQDAwNnADBkAjAn7qRaqCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RH
  46919. lAFWovgzJQxC36oCMB3q4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21U
  46920. SAGKcw==
  46921. -----END CERTIFICATE-----
  46922. Sectigo Public Server Authentication Root R46
  46923. =============================================
  46924. -----BEGIN CERTIFICATE-----
  46925. MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBfMQswCQYDVQQG
  46926. EwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT
  46927. ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwHhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1
  46928. OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T
  46929. ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3
  46930. DQEBAQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDaef0rty2k
  46931. 1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnzSDBh+oF8HqcIStw+Kxwf
  46932. GExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xfiOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMP
  46933. FF1bFOdLvt30yNoDN9HWOaEhUTCDsG3XME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vu
  46934. ZDCQOc2TZYEhMbUjUDM3IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5Qaz
  46935. Yw6A3OASVYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgESJ/A
  46936. wSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu+Zd4KKTIRJLpfSYF
  46937. plhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt8uaZFURww3y8nDnAtOFr94MlI1fZ
  46938. EoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+LHaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW
  46939. 6aWWrL3DkJiy4Pmi1KZHQ3xtzwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWI
  46940. IUkwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c
  46941. mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQYKlJfp/imTYp
  46942. E0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52gDY9hAaLMyZlbcp+nv4fjFg4
  46943. exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZAFv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M
  46944. 0ejf5lG5Nkc/kLnHvALcWxxPDkjBJYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI
  46945. 84HxZmduTILA7rpXDhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9m
  46946. pFuiTdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5dHn5Hrwd
  46947. Vw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65LvKRRFHQV80MNNVIIb/b
  46948. E/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmm
  46949. J1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAYQqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL
  46950. -----END CERTIFICATE-----
  46951. SSL.com TLS RSA Root CA 2022
  46952. ============================
  46953. -----BEGIN CERTIFICATE-----
  46954. MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQG
  46955. EwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxTU0wuY29tIFRMUyBSU0Eg
  46956. Um9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloXDTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMC
  46957. VVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgUlNBIFJv
  46958. b3QgQ0EgMjAyMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANCkCXJPQIgSYT41I57u
  46959. 9nTPL3tYPc48DRAokC+X94xI2KDYJbFMsBFMF3NQ0CJKY7uB0ylu1bUJPiYYf7ISf5OYt6/wNr/y
  46960. 7hienDtSxUcZXXTzZGbVXcdotL8bHAajvI9AI7YexoS9UcQbOcGV0insS657Lb85/bRi3pZ7Qcac
  46961. oOAGcvvwB5cJOYF0r/c0WRFXCsJbwST0MXMwgsadugL3PnxEX4MN8/HdIGkWCVDi1FW24IBydm5M
  46962. R7d1VVm0U3TZlMZBrViKMWYPHqIbKUBOL9975hYsLfy/7PO0+r4Y9ptJ1O4Fbtk085zx7AGL0SDG
  46963. D6C1vBdOSHtRwvzpXGk3R2azaPgVKPC506QVzFpPulJwoxJF3ca6TvvC0PeoUidtbnm1jPx7jMEW
  46964. TO6Af77wdr5BUxIzrlo4QqvXDz5BjXYHMtWrifZOZ9mxQnUjbvPNQrL8VfVThxc7wDNY8VLS+YCk
  46965. 8OjwO4s4zKTGkH8PnP2L0aPP2oOnaclQNtVcBdIKQXTbYxE3waWglksejBYSd66UNHsef8JmAOSq
  46966. g+qKkK3ONkRN0VHpvB/zagX9wHQfJRlAUW7qglFA35u5CCoGAtUjHBPW6dvbxrB6y3snm/vg1UYk
  46967. 7RBLY0ulBY+6uB0rpvqR4pJSvezrZ5dtmi2fgTIFZzL7SAg/2SW4BCUvAgMBAAGjYzBhMA8GA1Ud
  46968. EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU+y437uOEeicuzRk1sTN8/9REQrkwHQYDVR0OBBYEFPsu
  46969. N+7jhHonLs0ZNbEzfP/UREK5MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAjYlt
  46970. hEUY8U+zoO9opMAdrDC8Z2awms22qyIZZtM7QbUQnRC6cm4pJCAcAZli05bg4vsMQtfhWsSWTVTN
  46971. j8pDU/0quOr4ZcoBwq1gaAafORpR2eCNJvkLTqVTJXojpBzOCBvfR4iyrT7gJ4eLSYwfqUdYe5by
  46972. iB0YrrPRpgqU+tvT5TgKa3kSM/tKWTcWQA673vWJDPFs0/dRa1419dvAJuoSc06pkZCmF8NsLzjU
  46973. o3KUQyxi4U5cMj29TH0ZR6LDSeeWP4+a0zvkEdiLA9z2tmBVGKaBUfPhqBVq6+AL8BQx1rmMRTqo
  46974. ENjwuSfr98t67wVylrXEj5ZzxOhWc5y8aVFjvO9nHEMaX3cZHxj4HCUp+UmZKbaSPaKDN7Egkaib
  46975. MOlqbLQjk2UEqxHzDh1TJElTHaE/nUiSEeJ9DU/1172iWD54nR4fK/4huxoTtrEoZP2wAgDHbICi
  46976. vRZQIA9ygV/MlP+7mea6kMvq+cYMwq7FGc4zoWtcu358NFcXrfA/rs3qr5nsLFR+jM4uElZI7xc7
  46977. P0peYNLcdDa8pUNjyw9bowJWCZ4kLOGGgYz+qxcs+sjiMho6/4UIyYOf8kpIEFR3N+2ivEC+5BB0
  46978. 9+Rbu7nzifmPQdjH5FCQNYA+HLhNkNPU98OwoX6EyneSMSy4kLGCenROmxMmtNVQZlR4rmA=
  46979. -----END CERTIFICATE-----
  46980. SSL.com TLS ECC Root CA 2022
  46981. ============================
  46982. -----BEGIN CERTIFICATE-----
  46983. MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQswCQYDVQQGEwJV
  46984. UzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxTU0wuY29tIFRMUyBFQ0MgUm9v
  46985. dCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMx
  46986. GDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3Qg
  46987. Q0EgMjAyMjB2MBAGByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWy
  46988. JGYmacCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFNSeR7T5v1
  46989. 5wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSJjy+j6CugFFR7
  46990. 81a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NWuCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGG
  46991. MAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w
  46992. 7deedWo1dlJF4AIxAMeNb0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5
  46993. Zn6g6g==
  46994. -----END CERTIFICATE-----
  46995. Atos TrustedRoot Root CA ECC TLS 2021
  46996. =====================================
  46997. -----BEGIN CERTIFICATE-----
  46998. MIICFTCCAZugAwIBAgIQPZg7pmY9kGP3fiZXOATvADAKBggqhkjOPQQDAzBMMS4wLAYDVQQDDCVB
  46999. dG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgRUNDIFRMUyAyMDIxMQ0wCwYDVQQKDARBdG9zMQswCQYD
  47000. VQQGEwJERTAeFw0yMTA0MjIwOTI2MjNaFw00MTA0MTcwOTI2MjJaMEwxLjAsBgNVBAMMJUF0b3Mg
  47001. VHJ1c3RlZFJvb3QgUm9vdCBDQSBFQ0MgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNVBAYT
  47002. AkRFMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEloZYKDcKZ9Cg3iQZGeHkBQcfl+3oZIK59sRxUM6K
  47003. DP/XtXa7oWyTbIOiaG6l2b4siJVBzV3dscqDY4PMwL502eCdpO5KTlbgmClBk1IQ1SQ4AjJn8ZQS
  47004. b+/Xxd4u/RmAo0IwQDAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR2KCXWfeBmmnoJsmo7jjPX
  47005. NtNPojAOBgNVHQ8BAf8EBAMCAYYwCgYIKoZIzj0EAwMDaAAwZQIwW5kp85wxtolrbNa9d+F851F+
  47006. uDrNozZffPc8dz7kUK2o59JZDCaOMDtuCCrCp1rIAjEAmeMM56PDr9NJLkaCI2ZdyQAUEv049OGY
  47007. a3cpetskz2VAv9LcjBHo9H1/IISpQuQo
  47008. -----END CERTIFICATE-----
  47009. Atos TrustedRoot Root CA RSA TLS 2021
  47010. =====================================
  47011. -----BEGIN CERTIFICATE-----
  47012. MIIFZDCCA0ygAwIBAgIQU9XP5hmTC/srBRLYwiqipDANBgkqhkiG9w0BAQwFADBMMS4wLAYDVQQD
  47013. DCVBdG9zIFRydXN0ZWRSb290IFJvb3QgQ0EgUlNBIFRMUyAyMDIxMQ0wCwYDVQQKDARBdG9zMQsw
  47014. CQYDVQQGEwJERTAeFw0yMTA0MjIwOTIxMTBaFw00MTA0MTcwOTIxMDlaMEwxLjAsBgNVBAMMJUF0
  47015. b3MgVHJ1c3RlZFJvb3QgUm9vdCBDQSBSU0EgVExTIDIwMjExDTALBgNVBAoMBEF0b3MxCzAJBgNV
  47016. BAYTAkRFMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtoAOxHm9BYx9sKOdTSJNy/BB
  47017. l01Z4NH+VoyX8te9j2y3I49f1cTYQcvyAh5x5en2XssIKl4w8i1mx4QbZFc4nXUtVsYvYe+W/CBG
  47018. vevUez8/fEc4BKkbqlLfEzfTFRVOvV98r61jx3ncCHvVoOX3W3WsgFWZkmGbzSoXfduP9LVq6hdK
  47019. ZChmFSlsAvFr1bqjM9xaZ6cF4r9lthawEO3NUDPJcFDsGY6wx/J0W2tExn2WuZgIWWbeKQGb9Cpt
  47020. 0xU6kGpn8bRrZtkh68rZYnxGEFzedUlnnkL5/nWpo63/dgpnQOPF943HhZpZnmKaau1Fh5hnstVK
  47021. PNe0OwANwI8f4UDErmwh3El+fsqyjW22v5MvoVw+j8rtgI5Y4dtXz4U2OLJxpAmMkokIiEjxQGMY
  47022. sluMWuPD0xeqqxmjLBvk1cbiZnrXghmmOxYsL3GHX0WelXOTwkKBIROW1527k2gV+p2kHYzygeBY
  47023. Br3JtuP2iV2J+axEoctr+hbxx1A9JNr3w+SH1VbxT5Aw+kUJWdo0zuATHAR8ANSbhqRAvNncTFd+
  47024. rrcztl524WWLZt+NyteYr842mIycg5kDcPOvdO3GDjbnvezBc6eUWsuSZIKmAMFwoW4sKeFYV+xa
  47025. fJlrJaSQOoD0IJ2azsct+bJLKZWD6TWNp0lIpw9MGZHQ9b8Q4HECAwEAAaNCMEAwDwYDVR0TAQH/
  47026. BAUwAwEB/zAdBgNVHQ4EFgQUdEmZ0f+0emhFdcN+tNzMzjkz2ggwDgYDVR0PAQH/BAQDAgGGMA0G
  47027. CSqGSIb3DQEBDAUAA4ICAQAjQ1MkYlxt/T7Cz1UAbMVWiLkO3TriJQ2VSpfKgInuKs1l+NsW4AmS
  47028. 4BjHeJi78+xCUvuppILXTdiK/ORO/auQxDh1MoSf/7OwKwIzNsAQkG8dnK/haZPso0UvFJ/1TCpl
  47029. Q3IM98P4lYsU84UgYt1UU90s3BiVaU+DR3BAM1h3Egyi61IxHkzJqM7F78PRreBrAwA0JrRUITWX
  47030. AdxfG/F851X6LWh3e9NpzNMOa7pNdkTWwhWaJuywxfW70Xp0wmzNxbVe9kzmWy2B27O3Opee7c9G
  47031. slA9hGCZcbUztVdF5kJHdWoOsAgMrr3e97sPWD2PAzHoPYJQyi9eDF20l74gNAf0xBLh7tew2Vkt
  47032. afcxBPTy+av5EzH4AXcOPUIjJsyacmdRIXrMPIWo6iFqO9taPKU0nprALN+AnCng33eU0aKAQv9q
  47033. TFsR0PXNor6uzFFcw9VUewyu1rkGd4Di7wcaaMxZUa1+XGdrudviB0JbuAEFWDlN5LuYo7Ey7Nmj
  47034. 1m+UI/87tyll5gfp77YZ6ufCOB0yiJA8EytuzO+rdwY0d4RPcuSBhPm5dDTedk+SKlOxJTnbPP/l
  47035. PqYO5Wue/9vsL3SD3460s6neFE3/MaNFcyT6lSnMEpcEoji2jbDwN/zIIX8/syQbPYtuzE2wFg2W
  47036. HYMfRsCbvUOZ58SWLs5fyQ==
  47037. -----END CERTIFICATE-----
  47038. TrustAsia Global Root CA G3
  47039. ===========================
  47040. -----BEGIN CERTIFICATE-----
  47041. MIIFpTCCA42gAwIBAgIUZPYOZXdhaqs7tOqFhLuxibhxkw8wDQYJKoZIhvcNAQEMBQAwWjELMAkG
  47042. A1UEBhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIEluYy4xJDAiBgNVBAMM
  47043. G1RydXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHMzAeFw0yMTA1MjAwMjEwMTlaFw00NjA1MTkwMjEw
  47044. MTlaMFoxCzAJBgNVBAYTAkNOMSUwIwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMu
  47045. MSQwIgYDVQQDDBtUcnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzMwggIiMA0GCSqGSIb3DQEBAQUA
  47046. A4ICDwAwggIKAoICAQDAMYJhkuSUGwoqZdC+BqmHO1ES6nBBruL7dOoKjbmzTNyPtxNST1QY4Sxz
  47047. lZHFZjtqz6xjbYdT8PfxObegQ2OwxANdV6nnRM7EoYNl9lA+sX4WuDqKAtCWHwDNBSHvBm3dIZwZ
  47048. Q0WhxeiAysKtQGIXBsaqvPPW5vxQfmZCHzyLpnl5hkA1nyDvP+uLRx+PjsXUjrYsyUQE49RDdT/V
  47049. P68czH5GX6zfZBCK70bwkPAPLfSIC7Epqq+FqklYqL9joDiR5rPmd2jE+SoZhLsO4fWvieylL1Ag
  47050. dB4SQXMeJNnKziyhWTXAyB1GJ2Faj/lN03J5Zh6fFZAhLf3ti1ZwA0pJPn9pMRJpxx5cynoTi+jm
  47051. 9WAPzJMshH/x/Gr8m0ed262IPfN2dTPXS6TIi/n1Q1hPy8gDVI+lhXgEGvNz8teHHUGf59gXzhqc
  47052. D0r83ERoVGjiQTz+LISGNzzNPy+i2+f3VANfWdP3kXjHi3dqFuVJhZBFcnAvkV34PmVACxmZySYg
  47053. WmjBNb9Pp1Hx2BErW+Canig7CjoKH8GB5S7wprlppYiU5msTf9FkPz2ccEblooV7WIQn3MSAPmea
  47054. mseaMQ4w7OYXQJXZRe0Blqq/DPNL0WP3E1jAuPP6Z92bfW1K/zJMtSU7/xxnD4UiWQWRkUF3gdCF
  47055. TIcQcf+eQxuulXUtgQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEDk5PIj
  47056. 7zjKsK5Xf/IhMBY027ySMB0GA1UdDgQWBBRA5OTyI+84yrCuV3/yITAWNNu8kjAOBgNVHQ8BAf8E
  47057. BAMCAQYwDQYJKoZIhvcNAQEMBQADggIBACY7UeFNOPMyGLS0XuFlXsSUT9SnYaP4wM8zAQLpw6o1
  47058. D/GUE3d3NZ4tVlFEbuHGLige/9rsR82XRBf34EzC4Xx8MnpmyFq2XFNFV1pF1AWZLy4jVe5jaN/T
  47059. G3inEpQGAHUNcoTpLrxaatXeL1nHo+zSh2bbt1S1JKv0Q3jbSwTEb93mPmY+KfJLaHEih6D4sTNj
  47060. duMNhXJEIlU/HHzp/LgV6FL6qj6jITk1dImmasI5+njPtqzn59ZW/yOSLlALqbUHM/Q4X6RJpstl
  47061. cHboCoWASzY9M/eVVHUl2qzEc4Jl6VL1XP04lQJqaTDFHApXB64ipCz5xUG3uOyfT0gA+QEEVcys
  47062. +TIxxHWVBqB/0Y0n3bOppHKH/lmLmnp0Ft0WpWIp6zqW3IunaFnT63eROfjXy9mPX1onAX1daBli
  47063. 2MjN9LdyR75bl87yraKZk62Uy5P2EgmVtqvXO9A/EcswFi55gORngS1d7XB4tmBZrOFdRWOPyN9y
  47064. aFvqHbgB8X7754qz41SgOAngPN5C8sLtLpvzHzW2NtjjgKGLzZlkD8Kqq7HK9W+eQ42EVJmzbsAS
  47065. ZthwEPEGNTNDqJwuuhQxzhB/HIbjj9LV+Hfsm6vxL2PZQl/gZ4FkkfGXL/xuJvYz+NO1+MRiqzFR
  47066. JQJ6+N1rZdVtTTDIZbpoFGWsJwt0ivKH
  47067. -----END CERTIFICATE-----
  47068. TrustAsia Global Root CA G4
  47069. ===========================
  47070. -----BEGIN CERTIFICATE-----
  47071. MIICVTCCAdygAwIBAgIUTyNkuI6XY57GU4HBdk7LKnQV1tcwCgYIKoZIzj0EAwMwWjELMAkGA1UE
  47072. BhMCQ04xJTAjBgNVBAoMHFRydXN0QXNpYSBUZWNobm9sb2dpZXMsIEluYy4xJDAiBgNVBAMMG1Ry
  47073. dXN0QXNpYSBHbG9iYWwgUm9vdCBDQSBHNDAeFw0yMTA1MjAwMjEwMjJaFw00NjA1MTkwMjEwMjJa
  47074. MFoxCzAJBgNVBAYTAkNOMSUwIwYDVQQKDBxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMSQw
  47075. IgYDVQQDDBtUcnVzdEFzaWEgR2xvYmFsIFJvb3QgQ0EgRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
  47076. AATxs8045CVD5d4ZCbuBeaIVXxVjAd7Cq92zphtnS4CDr5nLrBfbK5bKfFJV4hrhPVbwLxYI+hW8
  47077. m7tH5j/uqOFMjPXTNvk4XatwmkcN4oFBButJ+bAp3TPsUKV/eSm4IJijYzBhMA8GA1UdEwEB/wQF
  47078. MAMBAf8wHwYDVR0jBBgwFoAUpbtKl86zK3+kMd6Xg1mDpm9xy94wHQYDVR0OBBYEFKW7SpfOsyt/
  47079. pDHel4NZg6ZvccveMA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjBe8usGzEkxn0AA
  47080. bbd+NvBNEU/zy4k6LHiRUKNbwMp1JvK/kF0LgoxgKJ/GcJpo5PECMFxYDlZ2z1jD1xCMuo6u47xk
  47081. dUfFVZDj/bpV6wfEU6s3qe4hsiFbYI89MvHVI5TWWA==
  47082. -----END CERTIFICATE-----
  47083. CommScope Public Trust ECC Root-01
  47084. ==================================
  47085. -----BEGIN CERTIFICATE-----
  47086. MIICHTCCAaOgAwIBAgIUQ3CCd89NXTTxyq4yLzf39H91oJ4wCgYIKoZIzj0EAwMwTjELMAkGA1UE
  47087. BhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBUcnVz
  47088. dCBFQ0MgUm9vdC0wMTAeFw0yMTA0MjgxNzM1NDNaFw00NjA0MjgxNzM1NDJaME4xCzAJBgNVBAYT
  47089. AlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3Qg
  47090. RUNDIFJvb3QtMDEwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARLNumuV16ocNfQj3Rid8NeeqrltqLx
  47091. eP0CflfdkXmcbLlSiFS8LwS+uM32ENEp7LXQoMPwiXAZu1FlxUOcw5tjnSCDPgYLpkJEhRGnSjot
  47092. 6dZoL0hOUysHP029uax3OVejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  47093. A1UdDgQWBBSOB2LAUN3GGQYARnQE9/OufXVNMDAKBggqhkjOPQQDAwNoADBlAjEAnDPfQeMjqEI2
  47094. Jpc1XHvr20v4qotzVRVcrHgpD7oh2MSg2NED3W3ROT3Ek2DS43KyAjB8xX6I01D1HiXo+k515liW
  47095. pDVfG2XqYZpwI7UNo5uSUm9poIyNStDuiw7LR47QjRE=
  47096. -----END CERTIFICATE-----
  47097. CommScope Public Trust ECC Root-02
  47098. ==================================
  47099. -----BEGIN CERTIFICATE-----
  47100. MIICHDCCAaOgAwIBAgIUKP2ZYEFHpgE6yhR7H+/5aAiDXX0wCgYIKoZIzj0EAwMwTjELMAkGA1UE
  47101. BhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBUcnVz
  47102. dCBFQ0MgUm9vdC0wMjAeFw0yMTA0MjgxNzQ0NTRaFw00NjA0MjgxNzQ0NTNaME4xCzAJBgNVBAYT
  47103. AlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1c3Qg
  47104. RUNDIFJvb3QtMDIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAR4MIHoYx7l63FRD/cHB8o5mXxO1Q/M
  47105. MDALj2aTPs+9xYa9+bG3tD60B8jzljHz7aRP+KNOjSkVWLjVb3/ubCK1sK9IRQq9qEmUv4RDsNuE
  47106. SgMjGWdqb8FuvAY5N9GIIvejQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  47107. A1UdDgQWBBTmGHX/72DehKT1RsfeSlXjMjZ59TAKBggqhkjOPQQDAwNnADBkAjAmc0l6tqvmSfR9
  47108. Uj/UQQSugEODZXW5hYA4O9Zv5JOGq4/nich/m35rChJVYaoR4HkCMHfoMXGsPHED1oQmHhS48zs7
  47109. 3u1Z/GtMMH9ZzkXpc2AVmkzw5l4lIhVtwodZ0LKOag==
  47110. -----END CERTIFICATE-----
  47111. CommScope Public Trust RSA Root-01
  47112. ==================================
  47113. -----BEGIN CERTIFICATE-----
  47114. MIIFbDCCA1SgAwIBAgIUPgNJgXUWdDGOTKvVxZAplsU5EN0wDQYJKoZIhvcNAQELBQAwTjELMAkG
  47115. A1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBU
  47116. cnVzdCBSU0EgUm9vdC0wMTAeFw0yMTA0MjgxNjQ1NTRaFw00NjA0MjgxNjQ1NTNaME4xCzAJBgNV
  47117. BAYTAlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1
  47118. c3QgUlNBIFJvb3QtMDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwSGWjDR1C45Ft
  47119. nYSkYZYSwu3D2iM0GXb26v1VWvZVAVMP8syMl0+5UMuzAURWlv2bKOx7dAvnQmtVzslhsuitQDy6
  47120. uUEKBU8bJoWPQ7VAtYXR1HHcg0Hz9kXHgKKEUJdGzqAMxGBWBB0HW0alDrJLpA6lfO741GIDuZNq
  47121. ihS4cPgugkY4Iw50x2tBt9Apo52AsH53k2NC+zSDO3OjWiE260f6GBfZumbCk6SP/F2krfxQapWs
  47122. vCQz0b2If4b19bJzKo98rwjyGpg/qYFlP8GMicWWMJoKz/TUyDTtnS+8jTiGU+6Xn6myY5QXjQ/c
  47123. Zip8UlF1y5mO6D1cv547KI2DAg+pn3LiLCuz3GaXAEDQpFSOm117RTYm1nJD68/A6g3czhLmfTif
  47124. BSeolz7pUcZsBSjBAg/pGG3svZwG1KdJ9FQFa2ww8esD1eo9anbCyxooSU1/ZOD6K9pzg4H/kQO9
  47125. lLvkuI6cMmPNn7togbGEW682v3fuHX/3SZtS7NJ3Wn2RnU3COS3kuoL4b/JOHg9O5j9ZpSPcPYeo
  47126. KFgo0fEbNttPxP/hjFtyjMcmAyejOQoBqsCyMWCDIqFPEgkBEa801M/XrmLTBQe0MXXgDW1XT2mH
  47127. +VepuhX2yFJtocucH+X8eKg1mp9BFM6ltM6UCBwJrVbl2rZJmkrqYxhTnCwuwwIDAQABo0IwQDAP
  47128. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUN12mmnQywsL5x6YVEFm4
  47129. 5P3luG0wDQYJKoZIhvcNAQELBQADggIBAK+nz97/4L1CjU3lIpbfaOp9TSp90K09FlxD533Ahuh6
  47130. NWPxzIHIxgvoLlI1pKZJkGNRrDSsBTtXAOnTYtPZKdVUvhwQkZyybf5Z/Xn36lbQnmhUQo8mUuJM
  47131. 3y+Xpi/SB5io82BdS5pYV4jvguX6r2yBS5KPQJqTRlnLX3gWsWc+QgvfKNmwrZggvkN80V4aCRck
  47132. jXtdlemrwWCrWxhkgPut4AZ9HcpZuPN4KWfGVh2vtrV0KnahP/t1MJ+UXjulYPPLXAziDslg+Mkf
  47133. Foom3ecnf+slpoq9uC02EJqxWE2aaE9gVOX2RhOOiKy8IUISrcZKiX2bwdgt6ZYD9KJ0DLwAHb/W
  47134. NyVntHKLr4W96ioDj8z7PEQkguIBpQtZtjSNMgsSDesnwv1B10A8ckYpwIzqug/xBpMu95yo9GA+
  47135. o/E4Xo4TwbM6l4c/ksp4qRyv0LAbJh6+cOx69TOY6lz/KwsETkPdY34Op054A5U+1C0wlREQKC6/
  47136. oAI+/15Z0wUOlV9TRe9rh9VIzRamloPh37MG88EU26fsHItdkJANclHnYfkUyq+Dj7+vsQpZXdxc
  47137. 1+SWrVtgHdqul7I52Qb1dgAT+GhMIbA1xNxVssnBQVocicCMb3SgazNNtQEo/a2tiRc7ppqEvOuM
  47138. 6sRxJKi6KfkIsidWNTJf6jn7MZrVGczw
  47139. -----END CERTIFICATE-----
  47140. CommScope Public Trust RSA Root-02
  47141. ==================================
  47142. -----BEGIN CERTIFICATE-----
  47143. MIIFbDCCA1SgAwIBAgIUVBa/O345lXGN0aoApYYNK496BU4wDQYJKoZIhvcNAQELBQAwTjELMAkG
  47144. A1UEBhMCVVMxEjAQBgNVBAoMCUNvbW1TY29wZTErMCkGA1UEAwwiQ29tbVNjb3BlIFB1YmxpYyBU
  47145. cnVzdCBSU0EgUm9vdC0wMjAeFw0yMTA0MjgxNzE2NDNaFw00NjA0MjgxNzE2NDJaME4xCzAJBgNV
  47146. BAYTAlVTMRIwEAYDVQQKDAlDb21tU2NvcGUxKzApBgNVBAMMIkNvbW1TY29wZSBQdWJsaWMgVHJ1
  47147. c3QgUlNBIFJvb3QtMDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDh+g77aAASyE3V
  47148. rCLENQE7xVTlWXZjpX/rwcRqmL0yjReA61260WI9JSMZNRTpf4mnG2I81lDnNJUDMrG0kyI9p+Kx
  47149. 7eZ7Ti6Hmw0zdQreqjXnfuU2mKKuJZ6VszKWpCtYHu8//mI0SFHRtI1CrWDaSWqVcN3SAOLMV2MC
  47150. e5bdSZdbkk6V0/nLKR8YSvgBKtJjCW4k6YnS5cciTNxzhkcAqg2Ijq6FfUrpuzNPDlJwnZXjfG2W
  47151. Wy09X6GDRl224yW4fKcZgBzqZUPckXk2LHR88mcGyYnJ27/aaL8j7dxrrSiDeS/sOKUNNwFnJ5rp
  47152. M9kzXzehxfCrPfp4sOcsn/Y+n2Dg70jpkEUeBVF4GiwSLFworA2iI540jwXmojPOEXcT1A6kHkIf
  47153. hs1w/tkuFT0du7jyU1fbzMZ0KZwYszZ1OC4PVKH4kh+Jlk+71O6d6Ts2QrUKOyrUZHk2EOH5kQMr
  47154. eyBUzQ0ZGshBMjTRsJnhkB4BQDa1t/qp5Xd1pCKBXbCL5CcSD1SIxtuFdOa3wNemKfrb3vOTlycE
  47155. VS8KbzfFPROvCgCpLIscgSjX74Yxqa7ybrjKaixUR9gqiC6vwQcQeKwRoi9C8DfF8rhW3Q5iLc4t
  47156. Vn5V8qdE9isy9COoR+jUKgF4z2rDN6ieZdIs5fq6M8EGRPbmz6UNp2YINIos8wIDAQABo0IwQDAP
  47157. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUR9DnsSL/nSz12Vdgs7Gx
  47158. cJXvYXowDQYJKoZIhvcNAQELBQADggIBAIZpsU0v6Z9PIpNojuQhmaPORVMbc0RTAIFhzTHjCLqB
  47159. KCh6krm2qMhDnscTJk3C2OVVnJJdUNjCK9v+5qiXz1I6JMNlZFxHMaNlNRPDk7n3+VGXu6TwYofF
  47160. 1gbTl4MgqX67tiHCpQ2EAOHyJxCDut0DgdXdaMNmEMjRdrSzbymeAPnCKfWxkxlSaRosTKCL4BWa
  47161. MS/TiJVZbuXEs1DIFAhKm4sTg7GkcrI7djNB3NyqpgdvHSQSn8h2vS/ZjvQs7rfSOBAkNlEv41xd
  47162. gSGn2rtO/+YHqP65DSdsu3BaVXoT6fEqSWnHX4dXTEN5bTpl6TBcQe7rd6VzEojov32u5cSoHw2O
  47163. HG1QAk8mGEPej1WFsQs3BWDJVTkSBKEqz3EWnzZRSb9wO55nnPt7eck5HHisd5FUmrh1CoFSl+Nm
  47164. YWvtPjgelmFV4ZFUjO2MJB+ByRCac5krFk5yAD9UG/iNuovnFNa2RU9g7Jauwy8CTl2dlklyALKr
  47165. dVwPaFsdZcJfMw8eD/A7hvWwTruc9+olBdytoptLFwG+Qt81IR2tq670v64fG9PiO/yzcnMcmyiQ
  47166. iRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17Org3bhzjlP1v9mxnhMUF6cKojawHhRUzN
  47167. lM47ni3niAIi9G7oyOzWPPO5std3eqx7
  47168. -----END CERTIFICATE-----
  47169. Telekom Security TLS ECC Root 2020
  47170. ==================================
  47171. -----BEGIN CERTIFICATE-----
  47172. MIICQjCCAcmgAwIBAgIQNjqWjMlcsljN0AFdxeVXADAKBggqhkjOPQQDAzBjMQswCQYDVQQGEwJE
  47173. RTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0eSBHbWJIMSswKQYDVQQDDCJUZWxl
  47174. a29tIFNlY3VyaXR5IFRMUyBFQ0MgUm9vdCAyMDIwMB4XDTIwMDgyNTA3NDgyMFoXDTQ1MDgyNTIz
  47175. NTk1OVowYzELMAkGA1UEBhMCREUxJzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJpdHkg
  47176. R21iSDErMCkGA1UEAwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgRUNDIFJvb3QgMjAyMDB2MBAGByqG
  47177. SM49AgEGBSuBBAAiA2IABM6//leov9Wq9xCazbzREaK9Z0LMkOsVGJDZos0MKiXrPk/OtdKPD/M1
  47178. 2kOLAoC+b1EkHQ9rK8qfwm9QMuU3ILYg/4gND21Ju9sGpIeQkpT0CdDPf8iAC8GXs7s1J8nCG6NC
  47179. MEAwHQYDVR0OBBYEFONyzG6VmUex5rNhTNHLq+O6zd6fMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  47180. AQH/BAQDAgEGMAoGCCqGSM49BAMDA2cAMGQCMHVSi7ekEE+uShCLsoRbQuHmKjYC2qBuGT8lv9pZ
  47181. Mo7k+5Dck2TOrbRBR2Diz6fLHgIwN0GMZt9Ba9aDAEH9L1r3ULRn0SyocddDypwnJJGDSA3PzfdU
  47182. ga/sf+Rn27iQ7t0l
  47183. -----END CERTIFICATE-----
  47184. Telekom Security TLS RSA Root 2023
  47185. ==================================
  47186. -----BEGIN CERTIFICATE-----
  47187. MIIFszCCA5ugAwIBAgIQIZxULej27HF3+k7ow3BXlzANBgkqhkiG9w0BAQwFADBjMQswCQYDVQQG
  47188. EwJERTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0eSBHbWJIMSswKQYDVQQDDCJU
  47189. ZWxla29tIFNlY3VyaXR5IFRMUyBSU0EgUm9vdCAyMDIzMB4XDTIzMDMyODEyMTY0NVoXDTQ4MDMy
  47190. NzIzNTk1OVowYzELMAkGA1UEBhMCREUxJzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJp
  47191. dHkgR21iSDErMCkGA1UEAwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgUlNBIFJvb3QgMjAyMzCCAiIw
  47192. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAO01oYGA88tKaVvC+1GDrib94W7zgRJ9cUD/h3VC
  47193. KSHtgVIs3xLBGYSJwb3FKNXVS2xE1kzbB5ZKVXrKNoIENqil/Cf2SfHVcp6R+SPWcHu79ZvB7JPP
  47194. GeplfohwoHP89v+1VmLhc2o0mD6CuKyVU/QBoCcHcqMAU6DksquDOFczJZSfvkgdmOGjup5czQRx
  47195. UX11eKvzWarE4GC+j4NSuHUaQTXtvPM6Y+mpFEXX5lLRbtLevOP1Czvm4MS9Q2QTps70mDdsipWo
  47196. l8hHD/BeEIvnHRz+sTugBTNoBUGCwQMrAcjnj02r6LX2zWtEtefdi+zqJbQAIldNsLGyMcEWzv/9
  47197. FIS3R/qy8XDe24tsNlikfLMR0cN3f1+2JeANxdKz+bi4d9s3cXFH42AYTyS2dTd4uaNir73Jco4v
  47198. zLuu2+QVUhkHM/tqty1LkCiCc/4YizWN26cEar7qwU02OxY2kTLvtkCJkUPg8qKrBC7m8kwOFjQg
  47199. rIfBLX7JZkcXFBGk8/ehJImr2BrIoVyxo/eMbcgByU/J7MT8rFEz0ciD0cmfHdRHNCk+y7AO+oML
  47200. KFjlKdw/fKifybYKu6boRhYPluV75Gp6SG12mAWl3G0eQh5C2hrgUve1g8Aae3g1LDj1H/1Joy7S
  47201. WWO/gLCMk3PLNaaZlSJhZQNg+y+TS/qanIA7AgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAdBgNV
  47202. HQ4EFgQUtqeXgj10hZv3PJ+TmpV5dVKMbUcwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS2
  47203. p5eCPXSFm/c8n5OalXl1UoxtRzANBgkqhkiG9w0BAQwFAAOCAgEAqMxhpr51nhVQpGv7qHBFfLp+
  47204. sVr8WyP6Cnf4mHGCDG3gXkaqk/QeoMPhk9tLrbKmXauw1GLLXrtm9S3ul0A8Yute1hTWjOKWi0Fp
  47205. kzXmuZlrYrShF2Y0pmtjxrlO8iLpWA1WQdH6DErwM807u20hOq6OcrXDSvvpfeWxm4bu4uB9tPcy
  47206. /SKE8YXJN3nptT+/XOR0so8RYgDdGGah2XsjX/GO1WfoVNpbOms2b/mBsTNHM3dA+VKq3dSDz4V4
  47207. mZqTuXNnQkYRIer+CqkbGmVps4+uFrb2S1ayLfmlyOw7YqPta9BO1UAJpB+Y1zqlklkg5LB9zVtz
  47208. aL1txKITDmcZuI1CfmwMmm6gJC3VRRvcxAIU/oVbZZfKTpBQCHpCNfnqwmbU+AGuHrS+w6jv/naa
  47209. oqYfRvaE7fzbzsQCzndILIyy7MMAo+wsVRjBfhnu4S/yrYObnqsZ38aKL4x35bcF7DvB7L6Gs4a8
  47210. wPfc5+pbrrLMtTWGS9DiP7bY+A4A7l3j941Y/8+LN+ljX273CXE2whJdV/LItM3z7gLfEdxquVeE
  47211. HVlNjM7IDiPCtyaaEBRx/pOyiriA8A4QntOoUAw3gi/q4Iqd4Sw5/7W0cwDk90imc6y/st53BIe0
  47212. o82bNSQ3+pCTE4FCxpgmdTdmQRCsu/WU48IxK63nI1bMNSWSs1A=
  47213. -----END CERTIFICATE-----
  47214. FIRMAPROFESIONAL CA ROOT-A WEB
  47215. ==============================
  47216. -----BEGIN CERTIFICATE-----
  47217. MIICejCCAgCgAwIBAgIQMZch7a+JQn81QYehZ1ZMbTAKBggqhkjOPQQDAzBuMQswCQYDVQQGEwJF
  47218. UzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25hbCBTQTEYMBYGA1UEYQwPVkFURVMtQTYyNjM0MDY4
  47219. MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFMIENBIFJPT1QtQSBXRUIwHhcNMjIwNDA2MDkwMTM2
  47220. WhcNNDcwMzMxMDkwMTM2WjBuMQswCQYDVQQGEwJFUzEcMBoGA1UECgwTRmlybWFwcm9mZXNpb25h
  47221. bCBTQTEYMBYGA1UEYQwPVkFURVMtQTYyNjM0MDY4MScwJQYDVQQDDB5GSVJNQVBST0ZFU0lPTkFM
  47222. IENBIFJPT1QtQSBXRUIwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARHU+osEaR3xyrq89Zfe9MEkVz6
  47223. iMYiuYMQYneEMy3pA4jU4DP37XcsSmDq5G+tbbT4TIqk5B/K6k84Si6CcyvHZpsKjECcfIr28jlg
  47224. st7L7Ljkb+qbXbdTkBgyVcUgt5SjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUk+FD
  47225. Y1w8ndYn81LsF7Kpryz3dvgwHQYDVR0OBBYEFJPhQ2NcPJ3WJ/NS7Beyqa8s93b4MA4GA1UdDwEB
  47226. /wQEAwIBBjAKBggqhkjOPQQDAwNoADBlAjAdfKR7w4l1M+E7qUW/Runpod3JIha3RxEL2Jq68cgL
  47227. cFBTApFwhVmpHqTm6iMxoAACMQD94vizrxa5HnPEluPBMBnYfubDl94cT7iJLzPrSA8Z94dGXSaQ
  47228. pYXFuXqUPoeovQA=
  47229. -----END CERTIFICATE-----
  47230. TWCA CYBER Root CA
  47231. ==================
  47232. -----BEGIN CERTIFICATE-----
  47233. MIIFjTCCA3WgAwIBAgIQQAE0jMIAAAAAAAAAATzyxjANBgkqhkiG9w0BAQwFADBQMQswCQYDVQQG
  47234. EwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJUV0NB
  47235. IENZQkVSIFJvb3QgQ0EwHhcNMjIxMTIyMDY1NDI5WhcNNDcxMTIyMTU1OTU5WjBQMQswCQYDVQQG
  47236. EwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJUV0NB
  47237. IENZQkVSIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDG+Moe2Qkgfh1s
  47238. Ts6P40czRJzHyWmqOlt47nDSkvgEs1JSHWdyKKHfi12VCv7qze33Kc7wb3+szT3vsxxFavcokPFh
  47239. V8UMxKNQXd7UtcsZyoC5dc4pztKFIuwCY8xEMCDa6pFbVuYdHNWdZsc/34bKS1PE2Y2yHer43CdT
  47240. o0fhYcx9tbD47nORxc5zb87uEB8aBs/pJ2DFTxnk684iJkXXYJndzk834H/nY62wuFm40AZoNWDT
  47241. Nq5xQwTxaWV4fPMf88oon1oglWa0zbfuj3ikRRjpJi+NmykosaS3Om251Bw4ckVYsV7r8Cibt4LK
  47242. /c/WMw+f+5eesRycnupfXtuq3VTpMCEobY5583WSjCb+3MX2w7DfRFlDo7YDKPYIMKoNM+HvnKkH
  47243. IuNZW0CP2oi3aQiotyMuRAlZN1vH4xfyIutuOVLF3lSnmMlLIJXcRolftBL5hSmO68gnFSDAS9TM
  47244. fAxsNAwmmyYxpjyn9tnQS6Jk/zuZQXLB4HCX8SS7K8R0IrGsayIyJNN4KsDAoS/xUgXJP+92ZuJF
  47245. 2A09rZXIx4kmyA+upwMu+8Ff+iDhcK2wZSA3M2Cw1a/XDBzCkHDXShi8fgGwsOsVHkQGzaRP6AzR
  47246. wyAQ4VRlnrZR0Bp2a0JaWHY06rc3Ga4udfmW5cFZ95RXKSWNOkyrTZpB0F8mAwIDAQABo2MwYTAO
  47247. BgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSdhWEUfMFib5do5E83
  47248. QOGt4A1WNzAdBgNVHQ4EFgQUnYVhFHzBYm+XaORPN0DhreANVjcwDQYJKoZIhvcNAQEMBQADggIB
  47249. AGSPesRiDrWIzLjHhg6hShbNcAu3p4ULs3a2D6f/CIsLJc+o1IN1KriWiLb73y0ttGlTITVX1olN
  47250. c79pj3CjYcya2x6a4CD4bLubIp1dhDGaLIrdaqHXKGnK/nZVekZn68xDiBaiA9a5F/gZbG0jAn/x
  47251. X9AKKSM70aoK7akXJlQKTcKlTfjF/biBzysseKNnTKkHmvPfXvt89YnNdJdhEGoHK4Fa0o635yDR
  47252. IG4kqIQnoVesqlVYL9zZyvpoBJ7tRCT5dEA7IzOrg1oYJkK2bVS1FmAwbLGg+LhBoF1JSdJlBTrq
  47253. /p1hvIbZv97Tujqxf36SNI7JAG7cmL3c7IAFrQI932XtCwP39xaEBDG6k5TY8hL4iuO/Qq+n1M0R
  47254. FxbIQh0UqEL20kCGoE8jypZFVmAGzbdVAaYBlGX+bgUJurSkquLvWL69J1bY73NxW0Qz8ppy6rBe
  47255. Pm6pUlvscG21h483XjyMnM7k8M4MZ0HMzvaAq07MTFb1wWFZk7Q+ptq4NxKfKjLji7gh7MMrZQzv
  47256. It6IKTtM1/r+t+FHvpw+PoP7UV31aPcuIYXcv/Fa4nzXxeSDwWrruoBa3lwtcHb4yOWHh8qgnaHl
  47257. IhInD0Q9HWzq1MKLL295q39QpsQZp6F6t5b5wR9iWqJDB0BeJsas7a5wFsWqynKKTbDPAYsDP27X
  47258. -----END CERTIFICATE-----
  47259. SecureSign Root CA12
  47260. ====================
  47261. -----BEGIN CERTIFICATE-----
  47262. MIIDcjCCAlqgAwIBAgIUZvnHwa/swlG07VOX5uaCwysckBYwDQYJKoZIhvcNAQELBQAwUTELMAkG
  47263. A1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28uLCBMdGQuMR0wGwYDVQQDExRT
  47264. ZWN1cmVTaWduIFJvb3QgQ0ExMjAeFw0yMDA0MDgwNTM2NDZaFw00MDA0MDgwNTM2NDZaMFExCzAJ
  47265. BgNVBAYTAkpQMSMwIQYDVQQKExpDeWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMU
  47266. U2VjdXJlU2lnbiBSb290IENBMTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6OcE3
  47267. emhFKxS06+QT61d1I02PJC0W6K6OyX2kVzsqdiUzg2zqMoqUm048luT9Ub+ZyZN+v/mtp7JIKwcc
  47268. J/VMvHASd6SFVLX9kHrko+RRWAPNEHl57muTH2SOa2SroxPjcf59q5zdJ1M3s6oYwlkm7Fsf0uZl
  47269. fO+TvdhYXAvA42VvPMfKWeP+bl+sg779XSVOKik71gurFzJ4pOE+lEa+Ym6b3kaosRbnhW70CEBF
  47270. EaCeVESE99g2zvVQR9wsMJvuwPWW0v4JhscGWa5Pro4RmHvzC1KqYiaqId+OJTN5lxZJjfU+1Uef
  47271. NzFJM3IFTQy2VYzxV4+Kh9GtxRESOaCtAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  47272. AQH/BAQDAgEGMB0GA1UdDgQWBBRXNPN0zwRL1SXm8UC2LEzZLemgrTANBgkqhkiG9w0BAQsFAAOC
  47273. AQEAPrvbFxbS8hQBICw4g0utvsqFepq2m2um4fylOqyttCg6r9cBg0krY6LdmmQOmFxv3Y67ilQi
  47274. LUoT865AQ9tPkbeGGuwAtEGBpE/6aouIs3YIcipJQMPTw4WJmBClnW8Zt7vPemVV2zfrPIpyMpce
  47275. mik+rY3moxtt9XUa5rBouVui7mlHJzWhhpmA8zNL4WukJsPvdFlseqJkth5Ew1DgDzk9qTPxpfPS
  47276. vWKErI4cqc1avTc7bgoitPQV55FYxTpE05Uo2cBl6XLK0A+9H7MV2anjpEcJnuDLN/v9vZfVvhga
  47277. aaI5gdka9at/yOPiZwud9AzqVN/Ssq+xIvEg37xEHA==
  47278. -----END CERTIFICATE-----
  47279. SecureSign Root CA14
  47280. ====================
  47281. -----BEGIN CERTIFICATE-----
  47282. MIIFcjCCA1qgAwIBAgIUZNtaDCBO6Ncpd8hQJ6JaJ90t8sswDQYJKoZIhvcNAQEMBQAwUTELMAkG
  47283. A1UEBhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28uLCBMdGQuMR0wGwYDVQQDExRT
  47284. ZWN1cmVTaWduIFJvb3QgQ0ExNDAeFw0yMDA0MDgwNzA2MTlaFw00NTA0MDgwNzA2MTlaMFExCzAJ
  47285. BgNVBAYTAkpQMSMwIQYDVQQKExpDeWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMU
  47286. U2VjdXJlU2lnbiBSb290IENBMTQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDF0nqh
  47287. 1oq/FjHQmNE6lPxauG4iwWL3pwon71D2LrGeaBLwbCRjOfHw3xDG3rdSINVSW0KZnvOgvlIfX8xn
  47288. bacuUKLBl422+JX1sLrcneC+y9/3OPJH9aaakpUqYllQC6KxNedlsmGy6pJxaeQp8E+BgQQ8sqVb
  47289. 1MWoWWd7VRxJq3qdwudzTe/NCcLEVxLbAQ4jeQkHO6Lo/IrPj8BGJJw4J+CDnRugv3gVEOuGTgpa
  47290. /d/aLIJ+7sr2KeH6caH3iGicnPCNvg9JkdjqOvn90Ghx2+m1K06Ckm9mH+Dw3EzsytHqunQG+bOE
  47291. kJTRX45zGRBdAuVwpcAQ0BB8b8VYSbSwbprafZX1zNoCr7gsfXmPvkPx+SgojQlD+Ajda8iLLCSx
  47292. jVIHvXiby8posqTdDEx5YMaZ0ZPxMBoH064iwurO8YQJzOAUbn8/ftKChazcqRZOhaBgy/ac18iz
  47293. ju3Gm5h1DVXoX+WViwKkrkMpKBGk5hIwAUt1ax5mnXkvpXYvHUC0bcl9eQjs0Wq2XSqypWa9a4X0
  47294. dFbD9ed1Uigspf9mR6XU/v6eVL9lfgHWMI+lNpyiUBzuOIABSMbHdPTGrMNASRZhdCyvjG817XsY
  47295. AFs2PJxQDcqSMxDxJklt33UkN4Ii1+iW/RVLApY+B3KVfqs9TC7XyvDf4Fg/LS8EmjijAQIDAQAB
  47296. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUBpOjCl4oaTeq
  47297. YR3r6/wtbyPk86AwDQYJKoZIhvcNAQEMBQADggIBAJaAcgkGfpzMkwQWu6A6jZJOtxEaCnFxEM0E
  47298. rX+lRVAQZk5KQaID2RFPeje5S+LGjzJmdSX7684/AykmjbgWHfYfM25I5uj4V7Ibed87hwriZLoA
  47299. ymzvftAj63iP/2SbNDefNWWipAA9EiOWWF3KY4fGoweITedpdopTzfFP7ELyk+OZpDc8h7hi2/Ds
  47300. Hzc/N19DzFGdtfCXwreFamgLRB7lUe6TzktuhsHSDCRZNhqfLJGP4xjblJUK7ZGqDpncllPjYYPG
  47301. FrojutzdfhrGe0K22VoF3Jpf1d+42kd92jjbrDnVHmtsKheMYc2xbXIBw8MgAGJoFjHVdqqGuw6q
  47302. nsb58Nn4DSEC5MUoFlkRudlpcyqSeLiSV5sI8jrlL5WwWLdrIBRtFO8KvH7YVdiI2i/6GaX7i+B/
  47303. OfVyK4XELKzvGUWSTLNhB9xNH27SgRNcmvMSZ4PPmz+Ln52kuaiWA3rF7iDeM9ovnhp6dB7h7sxa
  47304. OgTdsxoEqBRjrLdHEoOabPXm6RUVkRqEGQ6UROcSjiVbgGcZ3GOTEAtlLor6CZpO2oYofaphNdgO
  47305. pygau1LgePhsumywbrmHXumZNTfxPWQrqaA0k89jL9WB365jJ6UeTo3cKXhZ+PmhIIynJkBugnLN
  47306. eLLIjzwec+fBH7/PzqUqm9tEZDKgu39cJRNItX+S
  47307. -----END CERTIFICATE-----
  47308. SecureSign Root CA15
  47309. ====================
  47310. -----BEGIN CERTIFICATE-----
  47311. MIICIzCCAamgAwIBAgIUFhXHw9hJp75pDIqI7fBw+d23PocwCgYIKoZIzj0EAwMwUTELMAkGA1UE
  47312. BhMCSlAxIzAhBgNVBAoTGkN5YmVydHJ1c3QgSmFwYW4gQ28uLCBMdGQuMR0wGwYDVQQDExRTZWN1
  47313. cmVTaWduIFJvb3QgQ0ExNTAeFw0yMDA0MDgwODMyNTZaFw00NTA0MDgwODMyNTZaMFExCzAJBgNV
  47314. BAYTAkpQMSMwIQYDVQQKExpDeWJlcnRydXN0IEphcGFuIENvLiwgTHRkLjEdMBsGA1UEAxMUU2Vj
  47315. dXJlU2lnbiBSb290IENBMTUwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQLUHSNZDKZmbPSYAi4Io5G
  47316. dCx4wCtELW1fHcmuS1Iggz24FG1Th2CeX2yF2wYUleDHKP+dX+Sq8bOLbe1PL0vJSpSRZHX+AezB
  47317. 2Ot6lHhWGENfa4HL9rzatAy2KZMIaY+jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD
  47318. AgEGMB0GA1UdDgQWBBTrQciu/NWeUUj1vYv0hyCTQSvT9DAKBggqhkjOPQQDAwNoADBlAjEA2S6J
  47319. fl5OpBEHvVnCB96rMjhTKkZEBhd6zlHp4P9mLQlO4E/0BdGF9jVg3PVys0Z9AjBEmEYagoUeYWmJ
  47320. SwdLZrWeqrqgHkHZAXQ6bkU6iYAZezKYVWOr62Nuk22rGwlgMU4=
  47321. -----END CERTIFICATE-----
  47322. <?php
  47323. namespace Composer\CaBundle;
  47324. use Psr\Log\LoggerInterface;
  47325. use Symfony\Component\Process\PhpProcess;
  47326. class CaBundle
  47327. {
  47328. private static $caPath;
  47329. private static $caFileValidity = array();
  47330. public static function getSystemCaRootBundlePath(?LoggerInterface $logger = null)
  47331. {
  47332. if (self::$caPath !== null) {
  47333. return self::$caPath;
  47334. }
  47335. $caBundlePaths = array();
  47336. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
  47337. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
  47338. $caBundlePaths[] = ini_get('openssl.cafile');
  47339. $caBundlePaths[] = ini_get('openssl.capath');
  47340. $otherLocations = array(
  47341. '/etc/pki/tls/certs/ca-bundle.crt',
  47342. '/etc/ssl/certs/ca-certificates.crt',
  47343. '/etc/ssl/ca-bundle.pem',
  47344. '/usr/ssl/certs/ca-bundle.crt',
  47345. '/opt/local/share/curl/curl-ca-bundle.crt',
  47346. '/usr/local/share/curl/curl-ca-bundle.crt',
  47347. '/usr/share/ssl/certs/ca-bundle.crt',
  47348. '/etc/ssl/cert.pem',
  47349. '/usr/local/etc/openssl/cert.pem',
  47350. '/usr/local/etc/openssl@1.1/cert.pem',
  47351. '/opt/homebrew/etc/openssl@3/cert.pem',
  47352. '/opt/homebrew/etc/openssl@1.1/cert.pem',
  47353. '/etc/pki/tls/certs',
  47354. '/etc/ssl/certs',
  47355. );
  47356. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  47357. foreach ($caBundlePaths as $caBundle) {
  47358. if ($caBundle && self::caFileUsable($caBundle, $logger)) {
  47359. return self::$caPath = $caBundle;
  47360. }
  47361. if ($caBundle && self::caDirUsable($caBundle, $logger)) {
  47362. return self::$caPath = $caBundle;
  47363. }
  47364. }
  47365. return self::$caPath = static::getBundledCaBundlePath();
  47366. }
  47367. public static function getBundledCaBundlePath()
  47368. {
  47369. $caBundleFile = __DIR__.'/../res/cacert.pem';
  47370. if (0 === strpos($caBundleFile, 'phar://')) {
  47371. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-');
  47372. if (false === $tempCaBundleFile) {
  47373. throw new \RuntimeException('Could not create a temporary file to store the bundled CA file');
  47374. }
  47375. file_put_contents(
  47376. $tempCaBundleFile,
  47377. file_get_contents($caBundleFile)
  47378. );
  47379. register_shutdown_function(function() use ($tempCaBundleFile) {
  47380. @unlink($tempCaBundleFile);
  47381. });
  47382. $caBundleFile = $tempCaBundleFile;
  47383. }
  47384. return $caBundleFile;
  47385. }
  47386. public static function validateCaFile($filename, ?LoggerInterface $logger = null)
  47387. {
  47388. static $warned = false;
  47389. if (isset(self::$caFileValidity[$filename])) {
  47390. return self::$caFileValidity[$filename];
  47391. }
  47392. $contents = file_get_contents($filename);
  47393. if (is_string($contents) && strlen($contents) > 0) {
  47394. $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
  47395. if (null === $contents) {
  47396. $isValid = false;
  47397. } else {
  47398. $isValid = (bool) openssl_x509_parse($contents);
  47399. }
  47400. } else {
  47401. $isValid = false;
  47402. }
  47403. if ($logger) {
  47404. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  47405. }
  47406. return self::$caFileValidity[$filename] = $isValid;
  47407. }
  47408. public static function isOpensslParseSafe()
  47409. {
  47410. return true;
  47411. }
  47412. public static function reset()
  47413. {
  47414. self::$caFileValidity = array();
  47415. self::$caPath = null;
  47416. }
  47417. private static function getEnvVariable($name)
  47418. {
  47419. if (isset($_SERVER[$name])) {
  47420. return (string) $_SERVER[$name];
  47421. }
  47422. if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
  47423. return (string) $value;
  47424. }
  47425. return false;
  47426. }
  47427. private static function caFileUsable($certFile, ?LoggerInterface $logger = null)
  47428. {
  47429. return $certFile
  47430. && self::isFile($certFile, $logger)
  47431. && self::isReadable($certFile, $logger)
  47432. && self::validateCaFile($certFile, $logger);
  47433. }
  47434. private static function caDirUsable($certDir, ?LoggerInterface $logger = null)
  47435. {
  47436. return $certDir
  47437. && self::isDir($certDir, $logger)
  47438. && self::isReadable($certDir, $logger)
  47439. && self::glob($certDir . '/*', $logger);
  47440. }
  47441. private static function isFile($certFile, ?LoggerInterface $logger = null)
  47442. {
  47443. $isFile = @is_file($certFile);
  47444. if (!$isFile && $logger) {
  47445. $logger->debug(sprintf('Checked CA file %s does not exist or it is not a file.', $certFile));
  47446. }
  47447. return $isFile;
  47448. }
  47449. private static function isDir($certDir, ?LoggerInterface $logger = null)
  47450. {
  47451. $isDir = @is_dir($certDir);
  47452. if (!$isDir && $logger) {
  47453. $logger->debug(sprintf('Checked directory %s does not exist or it is not a directory.', $certDir));
  47454. }
  47455. return $isDir;
  47456. }
  47457. private static function isReadable($certFileOrDir, ?LoggerInterface $logger = null)
  47458. {
  47459. $isReadable = @is_readable($certFileOrDir);
  47460. if (!$isReadable && $logger) {
  47461. $logger->debug(sprintf('Checked file or directory %s is not readable.', $certFileOrDir));
  47462. }
  47463. return $isReadable;
  47464. }
  47465. private static function glob($pattern, ?LoggerInterface $logger = null)
  47466. {
  47467. $certs = glob($pattern);
  47468. if ($certs === false) {
  47469. if ($logger) {
  47470. $logger->debug(sprintf("An error occurred while trying to find certificates for pattern: %s", $pattern));
  47471. }
  47472. return false;
  47473. }
  47474. if (count($certs) === 0) {
  47475. if ($logger) {
  47476. $logger->debug(sprintf("No CA files found for pattern: %s", $pattern));
  47477. }
  47478. return false;
  47479. }
  47480. return true;
  47481. }
  47482. }
  47483. Copyright (C) 2022 Composer
  47484. Permission is hereby granted, free of charge, to any person obtaining a copy of
  47485. this software and associated documentation files (the "Software"), to deal in
  47486. the Software without restriction, including without limitation the rights to
  47487. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  47488. of the Software, and to permit persons to whom the Software is furnished to do
  47489. so, subject to the following conditions:
  47490. The above copyright notice and this permission notice shall be included in all
  47491. copies or substantial portions of the Software.
  47492. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47493. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47494. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47495. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47496. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47497. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47498. SOFTWARE.
  47499. <?php declare(strict_types=1);
  47500. namespace Composer\ClassMapGenerator;
  47501. use Composer\Pcre\Preg;
  47502. class ClassMap implements \Countable
  47503. {
  47504. public $map = [];
  47505. private $ambiguousClasses = [];
  47506. private $psrViolations = [];
  47507. public function getMap(): array
  47508. {
  47509. return $this->map;
  47510. }
  47511. public function getPsrViolations(): array
  47512. {
  47513. if (\count($this->psrViolations) === 0) {
  47514. return [];
  47515. }
  47516. return array_map(static function (array $violation): string {
  47517. return $violation['warning'];
  47518. }, array_merge(...array_values($this->psrViolations)));
  47519. }
  47520. public function getAmbiguousClasses($duplicatesFilter = '{/(test|fixture|example|stub)s?/}i'): array
  47521. {
  47522. if (false === $duplicatesFilter) {
  47523. return $this->ambiguousClasses;
  47524. }
  47525. if (true === $duplicatesFilter) {
  47526. throw new \InvalidArgumentException('$duplicatesFilter should be false or a string with a valid regex, got true.');
  47527. }
  47528. $ambiguousClasses = [];
  47529. foreach ($this->ambiguousClasses as $class => $paths) {
  47530. $paths = array_filter($paths, function ($path) use ($duplicatesFilter) {
  47531. return !Preg::isMatch($duplicatesFilter, strtr($path, '\\', '/'));
  47532. });
  47533. if (\count($paths) > 0) {
  47534. $ambiguousClasses[$class] = array_values($paths);
  47535. }
  47536. }
  47537. return $ambiguousClasses;
  47538. }
  47539. public function sort(): void
  47540. {
  47541. ksort($this->map);
  47542. }
  47543. public function addClass(string $className, string $path): void
  47544. {
  47545. unset($this->psrViolations[strtr($path, '\\', '/')]);
  47546. $this->map[$className] = $path;
  47547. }
  47548. public function getClassPath(string $className): string
  47549. {
  47550. if (!isset($this->map[$className])) {
  47551. throw new \OutOfBoundsException('Class '.$className.' is not present in the map');
  47552. }
  47553. return $this->map[$className];
  47554. }
  47555. public function hasClass(string $className): bool
  47556. {
  47557. return isset($this->map[$className]);
  47558. }
  47559. public function addPsrViolation(string $warning, string $className, string $path): void
  47560. {
  47561. $path = rtrim(strtr($path, '\\', '/'), '/');
  47562. $this->psrViolations[$path][] = ['warning' => $warning, 'className' => $className];
  47563. }
  47564. public function clearPsrViolationsByPath(string $pathPrefix): void
  47565. {
  47566. $pathPrefix = rtrim(strtr($pathPrefix, '\\', '/'), '/');
  47567. foreach ($this->psrViolations as $path => $violations) {
  47568. if ($path === $pathPrefix || 0 === \strpos($path, $pathPrefix.'/')) {
  47569. unset($this->psrViolations[$path]);
  47570. }
  47571. }
  47572. }
  47573. public function addAmbiguousClass(string $className, string $path): void
  47574. {
  47575. $this->ambiguousClasses[$className][] = $path;
  47576. }
  47577. public function count(): int
  47578. {
  47579. return \count($this->map);
  47580. }
  47581. }
  47582. <?php declare(strict_types=1);
  47583. namespace Composer\ClassMapGenerator;
  47584. use Composer\Pcre\Preg;
  47585. use Symfony\Component\Finder\Finder;
  47586. use Composer\IO\IOInterface;
  47587. class ClassMapGenerator
  47588. {
  47589. private $extensions;
  47590. private $scannedFiles = null;
  47591. private $classMap;
  47592. public function __construct(array $extensions = ['php', 'inc'])
  47593. {
  47594. $this->extensions = $extensions;
  47595. $this->classMap = new ClassMap;
  47596. }
  47597. public function avoidDuplicateScans(?FileList $scannedFiles = null): self
  47598. {
  47599. $this->scannedFiles = $scannedFiles ?? new FileList;
  47600. return $this;
  47601. }
  47602. public static function createMap($path): array
  47603. {
  47604. $generator = new self();
  47605. $generator->scanPaths($path);
  47606. return $generator->getClassMap()->getMap();
  47607. }
  47608. public function getClassMap(): ClassMap
  47609. {
  47610. return $this->classMap;
  47611. }
  47612. public function scanPaths($path, ?string $excluded = null, string $autoloadType = 'classmap', ?string $namespace = null, array $excludedDirs = []): void
  47613. {
  47614. if (!in_array($autoloadType, ['psr-0', 'psr-4', 'classmap'], true)) {
  47615. throw new \InvalidArgumentException('$autoloadType must be one of: "psr-0", "psr-4" or "classmap"');
  47616. }
  47617. if ('classmap' !== $autoloadType) {
  47618. if (!is_string($path)) {
  47619. throw new \InvalidArgumentException('$path must be a string when specifying a psr-0 or psr-4 autoload type');
  47620. }
  47621. if (!is_string($namespace)) {
  47622. throw new \InvalidArgumentException('$namespace must be given (even if it is an empty string if you do not want to filter) when specifying a psr-0 or psr-4 autoload type');
  47623. }
  47624. $basePath = $path;
  47625. }
  47626. if (is_string($path)) {
  47627. if (is_file($path)) {
  47628. $path = [new \SplFileInfo($path)];
  47629. } elseif (is_dir($path) || strpos($path, '*') !== false) {
  47630. $path = Finder::create()
  47631. ->files()
  47632. ->followLinks()
  47633. ->name('/\.(?:'.implode('|', array_map('preg_quote', $this->extensions)).')$/')
  47634. ->in($path)
  47635. ->exclude($excludedDirs);
  47636. } else {
  47637. throw new \RuntimeException(
  47638. 'Could not scan for classes inside "'.$path.'" which does not appear to be a file nor a folder'
  47639. );
  47640. }
  47641. }
  47642. $cwd = realpath(self::getCwd());
  47643. foreach ($path as $file) {
  47644. $filePath = $file->getPathname();
  47645. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), $this->extensions, true)) {
  47646. continue;
  47647. }
  47648. if (!self::isAbsolutePath($filePath)) {
  47649. $filePath = $cwd . '/' . $filePath;
  47650. $filePath = self::normalizePath($filePath);
  47651. } else {
  47652. $filePath = Preg::replace('{[\\\\/]{2,}}', '/', $filePath);
  47653. }
  47654. if ('' === $filePath) {
  47655. throw new \LogicException('Got an empty $filePath for '.$file->getPathname());
  47656. }
  47657. $realPath = realpath($filePath);
  47658. if (false === $realPath) {
  47659. throw new \RuntimeException('realpath of '.$filePath.' failed to resolve, got false');
  47660. }
  47661. if ($this->scannedFiles !== null && $this->scannedFiles->contains($realPath)) {
  47662. continue;
  47663. }
  47664. if (null !== $excluded && Preg::isMatch($excluded, strtr($realPath, '\\', '/'))) {
  47665. continue;
  47666. }
  47667. if (null !== $excluded && Preg::isMatch($excluded, strtr($filePath, '\\', '/'))) {
  47668. continue;
  47669. }
  47670. $classes = PhpFileParser::findClasses($filePath);
  47671. if ('classmap' !== $autoloadType && isset($namespace)) {
  47672. $classes = $this->filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath);
  47673. if (\count($classes) > 0 && $this->scannedFiles !== null) {
  47674. $this->scannedFiles->add($realPath);
  47675. }
  47676. } elseif ($this->scannedFiles !== null) {
  47677. $this->scannedFiles->add($realPath);
  47678. }
  47679. foreach ($classes as $class) {
  47680. if (!$this->classMap->hasClass($class)) {
  47681. $this->classMap->addClass($class, $filePath);
  47682. } elseif ($filePath !== $this->classMap->getClassPath($class)) {
  47683. $this->classMap->addAmbiguousClass($class, $filePath);
  47684. }
  47685. }
  47686. }
  47687. }
  47688. private function filterByNamespace(array $classes, string $filePath, string $baseNamespace, string $namespaceType, string $basePath): array
  47689. {
  47690. $validClasses = [];
  47691. $rejectedClasses = [];
  47692. $realSubPath = substr($filePath, strlen($basePath) + 1);
  47693. $dotPosition = strrpos($realSubPath, '.');
  47694. $realSubPath = substr($realSubPath, 0, $dotPosition === false ? PHP_INT_MAX : $dotPosition);
  47695. foreach ($classes as $class) {
  47696. if ('psr-0' === $namespaceType) {
  47697. $namespaceLength = strrpos($class, '\\');
  47698. if (false !== $namespaceLength) {
  47699. $namespace = substr($class, 0, $namespaceLength + 1);
  47700. $className = substr($class, $namespaceLength + 1);
  47701. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  47702. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  47703. } else {
  47704. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  47705. }
  47706. } elseif ('psr-4' === $namespaceType) {
  47707. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  47708. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  47709. } else {
  47710. throw new \InvalidArgumentException('$namespaceType must be "psr-0" or "psr-4"');
  47711. }
  47712. if ($subPath === $realSubPath) {
  47713. $validClasses[] = $class;
  47714. } else {
  47715. $rejectedClasses[] = $class;
  47716. }
  47717. }
  47718. if (\count($validClasses) === 0) {
  47719. $cwd = realpath(self::getCwd());
  47720. if ($cwd === false) {
  47721. $cwd = self::getCwd();
  47722. }
  47723. $cwd = self::normalizePath($cwd);
  47724. $shortPath = Preg::replace('{^'.preg_quote($cwd).'}', '.', self::normalizePath($filePath), 1);
  47725. $shortBasePath = Preg::replace('{^'.preg_quote($cwd).'}', '.', self::normalizePath($basePath), 1);
  47726. foreach ($rejectedClasses as $class) {
  47727. $this->classMap->addPsrViolation("Class $class located in $shortPath does not comply with $namespaceType autoloading standard (rule: $baseNamespace => $shortBasePath). Skipping.", $class, $filePath);
  47728. }
  47729. return [];
  47730. }
  47731. return $validClasses;
  47732. }
  47733. private static function isAbsolutePath(string $path)
  47734. {
  47735. return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
  47736. }
  47737. private static function normalizePath(string $path)
  47738. {
  47739. $parts = [];
  47740. $path = strtr($path, '\\', '/');
  47741. $prefix = '';
  47742. $absolute = '';
  47743. if (strpos($path, '//') === 0 && \strlen($path) > 2) {
  47744. $absolute = '//';
  47745. $path = substr($path, 2);
  47746. }
  47747. if (Preg::isMatchStrictGroups('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  47748. $prefix = $match[1];
  47749. $path = substr($path, \strlen($prefix));
  47750. }
  47751. if (strpos($path, '/') === 0) {
  47752. $absolute = '/';
  47753. $path = substr($path, 1);
  47754. }
  47755. $up = false;
  47756. foreach (explode('/', $path) as $chunk) {
  47757. if ('..' === $chunk && (\strlen($absolute) > 0 || $up)) {
  47758. array_pop($parts);
  47759. $up = !(\count($parts) === 0 || '..' === end($parts));
  47760. } elseif ('.' !== $chunk && '' !== $chunk) {
  47761. $parts[] = $chunk;
  47762. $up = '..' !== $chunk;
  47763. }
  47764. }
  47765. $prefix = Preg::replaceCallback('{(?:^|://)[a-z]:$}i', function (array $m) { return strtoupper((string) $m[0]); }, $prefix);
  47766. return $prefix.$absolute.implode('/', $parts);
  47767. }
  47768. private static function getCwd(): string
  47769. {
  47770. $cwd = getcwd();
  47771. if (false === $cwd) {
  47772. throw new \RuntimeException('Could not determine the current working directory');
  47773. }
  47774. return $cwd;
  47775. }
  47776. }
  47777. <?php declare(strict_types=1);
  47778. namespace Composer\ClassMapGenerator;
  47779. class FileList
  47780. {
  47781. public $files = [];
  47782. public function add(string $path): void
  47783. {
  47784. $this->files[$path] = true;
  47785. }
  47786. public function contains(string $path): bool
  47787. {
  47788. return isset($this->files[$path]);
  47789. }
  47790. }
  47791. <?php declare(strict_types=1);
  47792. namespace Composer\ClassMapGenerator;
  47793. use Composer\Pcre\Preg;
  47794. class PhpFileCleaner
  47795. {
  47796. private static $typeConfig;
  47797. private static $restPattern;
  47798. private $contents;
  47799. private $len;
  47800. private $maxMatches;
  47801. private $index = 0;
  47802. public static function setTypeConfig(array $types): void
  47803. {
  47804. foreach ($types as $type) {
  47805. self::$typeConfig[$type[0]] = array(
  47806. 'name' => $type,
  47807. 'length' => \strlen($type),
  47808. 'pattern' => '{.\b(?<![\$:>])'.$type.'\s++[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+}Ais',
  47809. );
  47810. }
  47811. self::$restPattern = '{[^?"\'</'.implode('', array_keys(self::$typeConfig)).']+}A';
  47812. }
  47813. public function __construct(string $contents, int $maxMatches)
  47814. {
  47815. $this->contents = $contents;
  47816. $this->len = \strlen($this->contents);
  47817. $this->maxMatches = $maxMatches;
  47818. }
  47819. public function clean(): string
  47820. {
  47821. $clean = '';
  47822. while ($this->index < $this->len) {
  47823. $this->skipToPhp();
  47824. $clean .= '<?';
  47825. while ($this->index < $this->len) {
  47826. $char = $this->contents[$this->index];
  47827. if ($char === '?' && $this->peek('>')) {
  47828. $clean .= '?>';
  47829. $this->index += 2;
  47830. continue 2;
  47831. }
  47832. if ($char === '"') {
  47833. $this->skipString('"');
  47834. $clean .= 'null';
  47835. continue;
  47836. }
  47837. if ($char === "'") {
  47838. $this->skipString("'");
  47839. $clean .= 'null';
  47840. continue;
  47841. }
  47842. if ($char === "<" && $this->peek('<') && $this->match('{<<<[ \t]*+([\'"]?)([a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*+)\\1(?:\r\n|\n|\r)}A', $match)) {
  47843. $this->index += \strlen($match[0]);
  47844. $this->skipHeredoc($match[2]);
  47845. $clean .= 'null';
  47846. continue;
  47847. }
  47848. if ($char === '/') {
  47849. if ($this->peek('/')) {
  47850. $this->skipToNewline();
  47851. continue;
  47852. }
  47853. if ($this->peek('*')) {
  47854. $this->skipComment();
  47855. continue;
  47856. }
  47857. }
  47858. if ($this->maxMatches === 1 && isset(self::$typeConfig[$char])) {
  47859. $type = self::$typeConfig[$char];
  47860. if (
  47861. \substr($this->contents, $this->index, $type['length']) === $type['name']
  47862. && Preg::isMatch($type['pattern'], $this->contents, $match, 0, $this->index - 1)
  47863. ) {
  47864. $clean .= $match[0];
  47865. return $clean;
  47866. }
  47867. }
  47868. $this->index += 1;
  47869. if ($this->match(self::$restPattern, $match)) {
  47870. $clean .= $char . $match[0];
  47871. $this->index += \strlen($match[0]);
  47872. } else {
  47873. $clean .= $char;
  47874. }
  47875. }
  47876. }
  47877. return $clean;
  47878. }
  47879. private function skipToPhp(): void
  47880. {
  47881. while ($this->index < $this->len) {
  47882. if ($this->contents[$this->index] === '<' && $this->peek('?')) {
  47883. $this->index += 2;
  47884. break;
  47885. }
  47886. $this->index += 1;
  47887. }
  47888. }
  47889. private function skipString(string $delimiter): void
  47890. {
  47891. $this->index += 1;
  47892. while ($this->index < $this->len) {
  47893. if ($this->contents[$this->index] === '\\' && ($this->peek('\\') || $this->peek($delimiter))) {
  47894. $this->index += 2;
  47895. continue;
  47896. }
  47897. if ($this->contents[$this->index] === $delimiter) {
  47898. $this->index += 1;
  47899. break;
  47900. }
  47901. $this->index += 1;
  47902. }
  47903. }
  47904. private function skipComment(): void
  47905. {
  47906. $this->index += 2;
  47907. while ($this->index < $this->len) {
  47908. if ($this->contents[$this->index] === '*' && $this->peek('/')) {
  47909. $this->index += 2;
  47910. break;
  47911. }
  47912. $this->index += 1;
  47913. }
  47914. }
  47915. private function skipToNewline(): void
  47916. {
  47917. while ($this->index < $this->len) {
  47918. if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") {
  47919. return;
  47920. }
  47921. $this->index += 1;
  47922. }
  47923. }
  47924. private function skipHeredoc(string $delimiter): void
  47925. {
  47926. $firstDelimiterChar = $delimiter[0];
  47927. $delimiterLength = \strlen($delimiter);
  47928. $delimiterPattern = '{'.preg_quote($delimiter).'(?![a-zA-Z0-9_\x80-\xff])}A';
  47929. while ($this->index < $this->len) {
  47930. switch ($this->contents[$this->index]) {
  47931. case "\t":
  47932. case " ":
  47933. $this->index += 1;
  47934. continue 2;
  47935. case $firstDelimiterChar:
  47936. if (
  47937. \substr($this->contents, $this->index, $delimiterLength) === $delimiter
  47938. && $this->match($delimiterPattern)
  47939. ) {
  47940. $this->index += $delimiterLength;
  47941. return;
  47942. }
  47943. break;
  47944. }
  47945. while ($this->index < $this->len) {
  47946. $this->skipToNewline();
  47947. while ($this->index < $this->len && ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n")) {
  47948. $this->index += 1;
  47949. }
  47950. break;
  47951. }
  47952. }
  47953. }
  47954. private function peek(string $char): bool
  47955. {
  47956. return $this->index + 1 < $this->len && $this->contents[$this->index + 1] === $char;
  47957. }
  47958. private function match(string $regex, ?array &$match = null): bool
  47959. {
  47960. return Preg::isMatchStrictGroups($regex, $this->contents, $match, 0, $this->index);
  47961. }
  47962. }
  47963. <?php declare(strict_types=1);
  47964. namespace Composer\ClassMapGenerator;
  47965. use Composer\Pcre\Preg;
  47966. class PhpFileParser
  47967. {
  47968. public static function findClasses(string $path): array
  47969. {
  47970. $extraTypes = self::getExtraTypes();
  47971. $contents = @php_strip_whitespace($path);
  47972. if ('' === $contents) {
  47973. if (!file_exists($path)) {
  47974. $message = 'File at "%s" does not exist, check your classmap definitions';
  47975. } elseif (!self::isReadable($path)) {
  47976. $message = 'File at "%s" is not readable, check its permissions';
  47977. } elseif ('' === trim((string) file_get_contents($path))) {
  47978. return array();
  47979. } else {
  47980. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  47981. }
  47982. $error = error_get_last();
  47983. if (isset($error['message'])) {
  47984. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  47985. }
  47986. throw new \RuntimeException(sprintf($message, $path));
  47987. }
  47988. Preg::matchAllStrictGroups('{\b(?:class|interface|trait'.$extraTypes.')\s}i', $contents, $matches);
  47989. if (0 === \count($matches)) {
  47990. return array();
  47991. }
  47992. $p = new PhpFileCleaner($contents, count($matches[0]));
  47993. $contents = $p->clean();
  47994. unset($p);
  47995. Preg::matchAll('{
  47996. (?:
  47997. \b(?<![\\\\$:>])(?P<type>class|interface|trait'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  47998. | \b(?<![\\\\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  47999. )
  48000. }ix', $contents, $matches);
  48001. $classes = array();
  48002. $namespace = '';
  48003. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  48004. if (isset($matches['ns'][$i]) && $matches['ns'][$i] !== '') {
  48005. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', (string) $matches['nsname'][$i]) . '\\';
  48006. } else {
  48007. $name = $matches['name'][$i];
  48008. assert(is_string($name));
  48009. if ($name === 'extends' || $name === 'implements') {
  48010. continue;
  48011. }
  48012. if ($name[0] === ':') {
  48013. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  48014. } elseif (strtolower((string) $matches['type'][$i]) === 'enum') {
  48015. $colonPos = strrpos($name, ':');
  48016. if (false !== $colonPos) {
  48017. $name = substr($name, 0, $colonPos);
  48018. }
  48019. }
  48020. $classes[] = ltrim($namespace . $name, '\\');
  48021. }
  48022. }
  48023. return $classes;
  48024. }
  48025. private static function getExtraTypes(): string
  48026. {
  48027. static $extraTypes = null;
  48028. if (null === $extraTypes) {
  48029. $extraTypes = '';
  48030. if (PHP_VERSION_ID >= 80100 || (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>='))) {
  48031. $extraTypes .= '|enum';
  48032. }
  48033. $extraTypesArray = array_filter(explode('|', $extraTypes), function (string $type) {
  48034. return $type !== '';
  48035. });
  48036. PhpFileCleaner::setTypeConfig(array_merge(['class', 'interface', 'trait'], $extraTypesArray));
  48037. }
  48038. return $extraTypes;
  48039. }
  48040. private static function isReadable(string $path)
  48041. {
  48042. if (is_readable($path)) {
  48043. return true;
  48044. }
  48045. if (is_file($path)) {
  48046. return false !== @file_get_contents($path, false, null, 0, 1);
  48047. }
  48048. return false;
  48049. }
  48050. }
  48051. {
  48052. "packages": [
  48053. {
  48054. "name": "composer/ca-bundle",
  48055. "version": "1.5.3",
  48056. "version_normalized": "1.5.3.0",
  48057. "source": {
  48058. "type": "git",
  48059. "url": "https://github.com/composer/ca-bundle.git",
  48060. "reference": "3b1fc3f0be055baa7c6258b1467849c3e8204eb2"
  48061. },
  48062. "dist": {
  48063. "type": "zip",
  48064. "url": "https://api.github.com/repos/composer/ca-bundle/zipball/3b1fc3f0be055baa7c6258b1467849c3e8204eb2",
  48065. "reference": "3b1fc3f0be055baa7c6258b1467849c3e8204eb2",
  48066. "shasum": ""
  48067. },
  48068. "require": {
  48069. "ext-openssl": "*",
  48070. "ext-pcre": "*",
  48071. "php": "^7.2 || ^8.0"
  48072. },
  48073. "require-dev": {
  48074. "phpstan/phpstan": "^1.10",
  48075. "phpunit/phpunit": "^8 || ^9",
  48076. "psr/log": "^1.0 || ^2.0 || ^3.0",
  48077. "symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0"
  48078. },
  48079. "time": "2024-11-04T10:15:26+00:00",
  48080. "type": "library",
  48081. "extra": {
  48082. "branch-alias": {
  48083. "dev-main": "1.x-dev"
  48084. }
  48085. },
  48086. "installation-source": "dist",
  48087. "autoload": {
  48088. "psr-4": {
  48089. "Composer\\CaBundle\\": "src"
  48090. }
  48091. },
  48092. "notification-url": "https://packagist.org/downloads/",
  48093. "license": [
  48094. "MIT"
  48095. ],
  48096. "authors": [
  48097. {
  48098. "name": "Jordi Boggiano",
  48099. "email": "j.boggiano@seld.be",
  48100. "homepage": "http://seld.be"
  48101. }
  48102. ],
  48103. "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
  48104. "keywords": [
  48105. "cabundle",
  48106. "cacert",
  48107. "certificate",
  48108. "ssl",
  48109. "tls"
  48110. ],
  48111. "support": {
  48112. "irc": "irc://irc.freenode.org/composer",
  48113. "issues": "https://github.com/composer/ca-bundle/issues",
  48114. "source": "https://github.com/composer/ca-bundle/tree/1.5.3"
  48115. },
  48116. "funding": [
  48117. {
  48118. "url": "https://packagist.com",
  48119. "type": "custom"
  48120. },
  48121. {
  48122. "url": "https://github.com/composer",
  48123. "type": "github"
  48124. },
  48125. {
  48126. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  48127. "type": "tidelift"
  48128. }
  48129. ],
  48130. "install-path": "./ca-bundle"
  48131. },
  48132. {
  48133. "name": "composer/class-map-generator",
  48134. "version": "1.4.0",
  48135. "version_normalized": "1.4.0.0",
  48136. "source": {
  48137. "type": "git",
  48138. "url": "https://github.com/composer/class-map-generator.git",
  48139. "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783"
  48140. },
  48141. "dist": {
  48142. "type": "zip",
  48143. "url": "https://api.github.com/repos/composer/class-map-generator/zipball/98bbf6780e56e0fd2404fe4b82eb665a0f93b783",
  48144. "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783",
  48145. "shasum": ""
  48146. },
  48147. "require": {
  48148. "composer/pcre": "^2.1 || ^3.1",
  48149. "php": "^7.2 || ^8.0",
  48150. "symfony/finder": "^4.4 || ^5.3 || ^6 || ^7"
  48151. },
  48152. "require-dev": {
  48153. "phpstan/phpstan": "^1.6",
  48154. "phpstan/phpstan-deprecation-rules": "^1",
  48155. "phpstan/phpstan-phpunit": "^1",
  48156. "phpstan/phpstan-strict-rules": "^1.1",
  48157. "phpunit/phpunit": "^8",
  48158. "symfony/filesystem": "^5.4 || ^6"
  48159. },
  48160. "time": "2024-10-03T18:14:00+00:00",
  48161. "type": "library",
  48162. "extra": {
  48163. "branch-alias": {
  48164. "dev-main": "1.x-dev"
  48165. }
  48166. },
  48167. "installation-source": "dist",
  48168. "autoload": {
  48169. "psr-4": {
  48170. "Composer\\ClassMapGenerator\\": "src"
  48171. }
  48172. },
  48173. "notification-url": "https://packagist.org/downloads/",
  48174. "license": [
  48175. "MIT"
  48176. ],
  48177. "authors": [
  48178. {
  48179. "name": "Jordi Boggiano",
  48180. "email": "j.boggiano@seld.be",
  48181. "homepage": "https://seld.be"
  48182. }
  48183. ],
  48184. "description": "Utilities to scan PHP code and generate class maps.",
  48185. "keywords": [
  48186. "classmap"
  48187. ],
  48188. "support": {
  48189. "issues": "https://github.com/composer/class-map-generator/issues",
  48190. "source": "https://github.com/composer/class-map-generator/tree/1.4.0"
  48191. },
  48192. "funding": [
  48193. {
  48194. "url": "https://packagist.com",
  48195. "type": "custom"
  48196. },
  48197. {
  48198. "url": "https://github.com/composer",
  48199. "type": "github"
  48200. },
  48201. {
  48202. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  48203. "type": "tidelift"
  48204. }
  48205. ],
  48206. "install-path": "./class-map-generator"
  48207. },
  48208. {
  48209. "name": "composer/metadata-minifier",
  48210. "version": "1.0.0",
  48211. "version_normalized": "1.0.0.0",
  48212. "source": {
  48213. "type": "git",
  48214. "url": "https://github.com/composer/metadata-minifier.git",
  48215. "reference": "c549d23829536f0d0e984aaabbf02af91f443207"
  48216. },
  48217. "dist": {
  48218. "type": "zip",
  48219. "url": "https://api.github.com/repos/composer/metadata-minifier/zipball/c549d23829536f0d0e984aaabbf02af91f443207",
  48220. "reference": "c549d23829536f0d0e984aaabbf02af91f443207",
  48221. "shasum": ""
  48222. },
  48223. "require": {
  48224. "php": "^5.3.2 || ^7.0 || ^8.0"
  48225. },
  48226. "require-dev": {
  48227. "composer/composer": "^2",
  48228. "phpstan/phpstan": "^0.12.55",
  48229. "symfony/phpunit-bridge": "^4.2 || ^5"
  48230. },
  48231. "time": "2021-04-07T13:37:33+00:00",
  48232. "type": "library",
  48233. "extra": {
  48234. "branch-alias": {
  48235. "dev-main": "1.x-dev"
  48236. }
  48237. },
  48238. "installation-source": "dist",
  48239. "autoload": {
  48240. "psr-4": {
  48241. "Composer\\MetadataMinifier\\": "src"
  48242. }
  48243. },
  48244. "notification-url": "https://packagist.org/downloads/",
  48245. "license": [
  48246. "MIT"
  48247. ],
  48248. "authors": [
  48249. {
  48250. "name": "Jordi Boggiano",
  48251. "email": "j.boggiano@seld.be",
  48252. "homepage": "http://seld.be"
  48253. }
  48254. ],
  48255. "description": "Small utility library that handles metadata minification and expansion.",
  48256. "keywords": [
  48257. "composer",
  48258. "compression"
  48259. ],
  48260. "support": {
  48261. "issues": "https://github.com/composer/metadata-minifier/issues",
  48262. "source": "https://github.com/composer/metadata-minifier/tree/1.0.0"
  48263. },
  48264. "funding": [
  48265. {
  48266. "url": "https://packagist.com",
  48267. "type": "custom"
  48268. },
  48269. {
  48270. "url": "https://github.com/composer",
  48271. "type": "github"
  48272. },
  48273. {
  48274. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  48275. "type": "tidelift"
  48276. }
  48277. ],
  48278. "install-path": "./metadata-minifier"
  48279. },
  48280. {
  48281. "name": "composer/pcre",
  48282. "version": "2.3.2",
  48283. "version_normalized": "2.3.2.0",
  48284. "source": {
  48285. "type": "git",
  48286. "url": "https://github.com/composer/pcre.git",
  48287. "reference": "ebb81df8f52b40172d14062ae96a06939d80a069"
  48288. },
  48289. "dist": {
  48290. "type": "zip",
  48291. "url": "https://api.github.com/repos/composer/pcre/zipball/ebb81df8f52b40172d14062ae96a06939d80a069",
  48292. "reference": "ebb81df8f52b40172d14062ae96a06939d80a069",
  48293. "shasum": ""
  48294. },
  48295. "require": {
  48296. "php": "^7.2 || ^8.0"
  48297. },
  48298. "conflict": {
  48299. "phpstan/phpstan": "<1.11.10"
  48300. },
  48301. "require-dev": {
  48302. "phpstan/phpstan": "^1.12 || ^2",
  48303. "phpstan/phpstan-strict-rules": "^1 || ^2",
  48304. "phpunit/phpunit": "^8 || ^9"
  48305. },
  48306. "time": "2024-11-12T16:24:47+00:00",
  48307. "type": "library",
  48308. "extra": {
  48309. "branch-alias": {
  48310. "dev-main": "2.x-dev"
  48311. },
  48312. "phpstan": {
  48313. "includes": [
  48314. "extension.neon"
  48315. ]
  48316. }
  48317. },
  48318. "installation-source": "dist",
  48319. "autoload": {
  48320. "psr-4": {
  48321. "Composer\\Pcre\\": "src"
  48322. }
  48323. },
  48324. "notification-url": "https://packagist.org/downloads/",
  48325. "license": [
  48326. "MIT"
  48327. ],
  48328. "authors": [
  48329. {
  48330. "name": "Jordi Boggiano",
  48331. "email": "j.boggiano@seld.be",
  48332. "homepage": "http://seld.be"
  48333. }
  48334. ],
  48335. "description": "PCRE wrapping library that offers type-safe preg_* replacements.",
  48336. "keywords": [
  48337. "PCRE",
  48338. "preg",
  48339. "regex",
  48340. "regular expression"
  48341. ],
  48342. "support": {
  48343. "issues": "https://github.com/composer/pcre/issues",
  48344. "source": "https://github.com/composer/pcre/tree/2.3.2"
  48345. },
  48346. "funding": [
  48347. {
  48348. "url": "https://packagist.com",
  48349. "type": "custom"
  48350. },
  48351. {
  48352. "url": "https://github.com/composer",
  48353. "type": "github"
  48354. },
  48355. {
  48356. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  48357. "type": "tidelift"
  48358. }
  48359. ],
  48360. "install-path": "./pcre"
  48361. },
  48362. {
  48363. "name": "composer/semver",
  48364. "version": "3.4.3",
  48365. "version_normalized": "3.4.3.0",
  48366. "source": {
  48367. "type": "git",
  48368. "url": "https://github.com/composer/semver.git",
  48369. "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12"
  48370. },
  48371. "dist": {
  48372. "type": "zip",
  48373. "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12",
  48374. "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12",
  48375. "shasum": ""
  48376. },
  48377. "require": {
  48378. "php": "^5.3.2 || ^7.0 || ^8.0"
  48379. },
  48380. "require-dev": {
  48381. "phpstan/phpstan": "^1.11",
  48382. "symfony/phpunit-bridge": "^3 || ^7"
  48383. },
  48384. "time": "2024-09-19T14:15:21+00:00",
  48385. "type": "library",
  48386. "extra": {
  48387. "branch-alias": {
  48388. "dev-main": "3.x-dev"
  48389. }
  48390. },
  48391. "installation-source": "dist",
  48392. "autoload": {
  48393. "psr-4": {
  48394. "Composer\\Semver\\": "src"
  48395. }
  48396. },
  48397. "notification-url": "https://packagist.org/downloads/",
  48398. "license": [
  48399. "MIT"
  48400. ],
  48401. "authors": [
  48402. {
  48403. "name": "Nils Adermann",
  48404. "email": "naderman@naderman.de",
  48405. "homepage": "http://www.naderman.de"
  48406. },
  48407. {
  48408. "name": "Jordi Boggiano",
  48409. "email": "j.boggiano@seld.be",
  48410. "homepage": "http://seld.be"
  48411. },
  48412. {
  48413. "name": "Rob Bast",
  48414. "email": "rob.bast@gmail.com",
  48415. "homepage": "http://robbast.nl"
  48416. }
  48417. ],
  48418. "description": "Semver library that offers utilities, version constraint parsing and validation.",
  48419. "keywords": [
  48420. "semantic",
  48421. "semver",
  48422. "validation",
  48423. "versioning"
  48424. ],
  48425. "support": {
  48426. "irc": "ircs://irc.libera.chat:6697/composer",
  48427. "issues": "https://github.com/composer/semver/issues",
  48428. "source": "https://github.com/composer/semver/tree/3.4.3"
  48429. },
  48430. "funding": [
  48431. {
  48432. "url": "https://packagist.com",
  48433. "type": "custom"
  48434. },
  48435. {
  48436. "url": "https://github.com/composer",
  48437. "type": "github"
  48438. },
  48439. {
  48440. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  48441. "type": "tidelift"
  48442. }
  48443. ],
  48444. "install-path": "./semver"
  48445. },
  48446. {
  48447. "name": "composer/spdx-licenses",
  48448. "version": "1.5.8",
  48449. "version_normalized": "1.5.8.0",
  48450. "source": {
  48451. "type": "git",
  48452. "url": "https://github.com/composer/spdx-licenses.git",
  48453. "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a"
  48454. },
  48455. "dist": {
  48456. "type": "zip",
  48457. "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a",
  48458. "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a",
  48459. "shasum": ""
  48460. },
  48461. "require": {
  48462. "php": "^5.3.2 || ^7.0 || ^8.0"
  48463. },
  48464. "require-dev": {
  48465. "phpstan/phpstan": "^0.12.55",
  48466. "symfony/phpunit-bridge": "^4.2 || ^5"
  48467. },
  48468. "time": "2023-11-20T07:44:33+00:00",
  48469. "type": "library",
  48470. "extra": {
  48471. "branch-alias": {
  48472. "dev-main": "1.x-dev"
  48473. }
  48474. },
  48475. "installation-source": "dist",
  48476. "autoload": {
  48477. "psr-4": {
  48478. "Composer\\Spdx\\": "src"
  48479. }
  48480. },
  48481. "notification-url": "https://packagist.org/downloads/",
  48482. "license": [
  48483. "MIT"
  48484. ],
  48485. "authors": [
  48486. {
  48487. "name": "Nils Adermann",
  48488. "email": "naderman@naderman.de",
  48489. "homepage": "http://www.naderman.de"
  48490. },
  48491. {
  48492. "name": "Jordi Boggiano",
  48493. "email": "j.boggiano@seld.be",
  48494. "homepage": "http://seld.be"
  48495. },
  48496. {
  48497. "name": "Rob Bast",
  48498. "email": "rob.bast@gmail.com",
  48499. "homepage": "http://robbast.nl"
  48500. }
  48501. ],
  48502. "description": "SPDX licenses list and validation library.",
  48503. "keywords": [
  48504. "license",
  48505. "spdx",
  48506. "validator"
  48507. ],
  48508. "support": {
  48509. "irc": "ircs://irc.libera.chat:6697/composer",
  48510. "issues": "https://github.com/composer/spdx-licenses/issues",
  48511. "source": "https://github.com/composer/spdx-licenses/tree/1.5.8"
  48512. },
  48513. "funding": [
  48514. {
  48515. "url": "https://packagist.com",
  48516. "type": "custom"
  48517. },
  48518. {
  48519. "url": "https://github.com/composer",
  48520. "type": "github"
  48521. },
  48522. {
  48523. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  48524. "type": "tidelift"
  48525. }
  48526. ],
  48527. "install-path": "./spdx-licenses"
  48528. },
  48529. {
  48530. "name": "composer/xdebug-handler",
  48531. "version": "3.0.5",
  48532. "version_normalized": "3.0.5.0",
  48533. "source": {
  48534. "type": "git",
  48535. "url": "https://github.com/composer/xdebug-handler.git",
  48536. "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef"
  48537. },
  48538. "dist": {
  48539. "type": "zip",
  48540. "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef",
  48541. "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef",
  48542. "shasum": ""
  48543. },
  48544. "require": {
  48545. "composer/pcre": "^1 || ^2 || ^3",
  48546. "php": "^7.2.5 || ^8.0",
  48547. "psr/log": "^1 || ^2 || ^3"
  48548. },
  48549. "require-dev": {
  48550. "phpstan/phpstan": "^1.0",
  48551. "phpstan/phpstan-strict-rules": "^1.1",
  48552. "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5"
  48553. },
  48554. "time": "2024-05-06T16:37:16+00:00",
  48555. "type": "library",
  48556. "installation-source": "dist",
  48557. "autoload": {
  48558. "psr-4": {
  48559. "Composer\\XdebugHandler\\": "src"
  48560. }
  48561. },
  48562. "notification-url": "https://packagist.org/downloads/",
  48563. "license": [
  48564. "MIT"
  48565. ],
  48566. "authors": [
  48567. {
  48568. "name": "John Stevenson",
  48569. "email": "john-stevenson@blueyonder.co.uk"
  48570. }
  48571. ],
  48572. "description": "Restarts a process without Xdebug.",
  48573. "keywords": [
  48574. "Xdebug",
  48575. "performance"
  48576. ],
  48577. "support": {
  48578. "irc": "ircs://irc.libera.chat:6697/composer",
  48579. "issues": "https://github.com/composer/xdebug-handler/issues",
  48580. "source": "https://github.com/composer/xdebug-handler/tree/3.0.5"
  48581. },
  48582. "funding": [
  48583. {
  48584. "url": "https://packagist.com",
  48585. "type": "custom"
  48586. },
  48587. {
  48588. "url": "https://github.com/composer",
  48589. "type": "github"
  48590. },
  48591. {
  48592. "url": "https://tidelift.com/funding/github/packagist/composer/composer",
  48593. "type": "tidelift"
  48594. }
  48595. ],
  48596. "install-path": "./xdebug-handler"
  48597. },
  48598. {
  48599. "name": "justinrainbow/json-schema",
  48600. "version": "5.3.0",
  48601. "version_normalized": "5.3.0.0",
  48602. "source": {
  48603. "type": "git",
  48604. "url": "https://github.com/jsonrainbow/json-schema.git",
  48605. "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8"
  48606. },
  48607. "dist": {
  48608. "type": "zip",
  48609. "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8",
  48610. "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8",
  48611. "shasum": ""
  48612. },
  48613. "require": {
  48614. "php": ">=7.1"
  48615. },
  48616. "require-dev": {
  48617. "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1",
  48618. "json-schema/json-schema-test-suite": "1.2.0",
  48619. "phpunit/phpunit": "^4.8.35"
  48620. },
  48621. "time": "2024-07-06T21:00:26+00:00",
  48622. "bin": [
  48623. "bin/validate-json"
  48624. ],
  48625. "type": "library",
  48626. "installation-source": "dist",
  48627. "autoload": {
  48628. "psr-4": {
  48629. "JsonSchema\\": "src/JsonSchema/"
  48630. }
  48631. },
  48632. "notification-url": "https://packagist.org/downloads/",
  48633. "license": [
  48634. "MIT"
  48635. ],
  48636. "authors": [
  48637. {
  48638. "name": "Bruno Prieto Reis",
  48639. "email": "bruno.p.reis@gmail.com"
  48640. },
  48641. {
  48642. "name": "Justin Rainbow",
  48643. "email": "justin.rainbow@gmail.com"
  48644. },
  48645. {
  48646. "name": "Igor Wiedler",
  48647. "email": "igor@wiedler.ch"
  48648. },
  48649. {
  48650. "name": "Robert Schönthal",
  48651. "email": "seroscho@googlemail.com"
  48652. }
  48653. ],
  48654. "description": "A library to validate a json schema.",
  48655. "homepage": "https://github.com/justinrainbow/json-schema",
  48656. "keywords": [
  48657. "json",
  48658. "schema"
  48659. ],
  48660. "support": {
  48661. "issues": "https://github.com/jsonrainbow/json-schema/issues",
  48662. "source": "https://github.com/jsonrainbow/json-schema/tree/5.3.0"
  48663. },
  48664. "install-path": "../justinrainbow/json-schema"
  48665. },
  48666. {
  48667. "name": "psr/container",
  48668. "version": "1.1.1",
  48669. "version_normalized": "1.1.1.0",
  48670. "source": {
  48671. "type": "git",
  48672. "url": "https://github.com/php-fig/container.git",
  48673. "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
  48674. },
  48675. "dist": {
  48676. "type": "zip",
  48677. "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
  48678. "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
  48679. "shasum": ""
  48680. },
  48681. "require": {
  48682. "php": ">=7.2.0"
  48683. },
  48684. "time": "2021-03-05T17:36:06+00:00",
  48685. "type": "library",
  48686. "installation-source": "dist",
  48687. "autoload": {
  48688. "psr-4": {
  48689. "Psr\\Container\\": "src/"
  48690. }
  48691. },
  48692. "notification-url": "https://packagist.org/downloads/",
  48693. "license": [
  48694. "MIT"
  48695. ],
  48696. "authors": [
  48697. {
  48698. "name": "PHP-FIG",
  48699. "homepage": "https://www.php-fig.org/"
  48700. }
  48701. ],
  48702. "description": "Common Container Interface (PHP FIG PSR-11)",
  48703. "homepage": "https://github.com/php-fig/container",
  48704. "keywords": [
  48705. "PSR-11",
  48706. "container",
  48707. "container-interface",
  48708. "container-interop",
  48709. "psr"
  48710. ],
  48711. "support": {
  48712. "issues": "https://github.com/php-fig/container/issues",
  48713. "source": "https://github.com/php-fig/container/tree/1.1.1"
  48714. },
  48715. "install-path": "../psr/container"
  48716. },
  48717. {
  48718. "name": "psr/log",
  48719. "version": "1.1.4",
  48720. "version_normalized": "1.1.4.0",
  48721. "source": {
  48722. "type": "git",
  48723. "url": "https://github.com/php-fig/log.git",
  48724. "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
  48725. },
  48726. "dist": {
  48727. "type": "zip",
  48728. "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
  48729. "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
  48730. "shasum": ""
  48731. },
  48732. "require": {
  48733. "php": ">=5.3.0"
  48734. },
  48735. "time": "2021-05-03T11:20:27+00:00",
  48736. "type": "library",
  48737. "extra": {
  48738. "branch-alias": {
  48739. "dev-master": "1.1.x-dev"
  48740. }
  48741. },
  48742. "installation-source": "dist",
  48743. "autoload": {
  48744. "psr-4": {
  48745. "Psr\\Log\\": "Psr/Log/"
  48746. }
  48747. },
  48748. "notification-url": "https://packagist.org/downloads/",
  48749. "license": [
  48750. "MIT"
  48751. ],
  48752. "authors": [
  48753. {
  48754. "name": "PHP-FIG",
  48755. "homepage": "https://www.php-fig.org/"
  48756. }
  48757. ],
  48758. "description": "Common interface for logging libraries",
  48759. "homepage": "https://github.com/php-fig/log",
  48760. "keywords": [
  48761. "log",
  48762. "psr",
  48763. "psr-3"
  48764. ],
  48765. "support": {
  48766. "source": "https://github.com/php-fig/log/tree/1.1.4"
  48767. },
  48768. "install-path": "../psr/log"
  48769. },
  48770. {
  48771. "name": "react/promise",
  48772. "version": "v3.2.0",
  48773. "version_normalized": "3.2.0.0",
  48774. "source": {
  48775. "type": "git",
  48776. "url": "https://github.com/reactphp/promise.git",
  48777. "reference": "8a164643313c71354582dc850b42b33fa12a4b63"
  48778. },
  48779. "dist": {
  48780. "type": "zip",
  48781. "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63",
  48782. "reference": "8a164643313c71354582dc850b42b33fa12a4b63",
  48783. "shasum": ""
  48784. },
  48785. "require": {
  48786. "php": ">=7.1.0"
  48787. },
  48788. "require-dev": {
  48789. "phpstan/phpstan": "1.10.39 || 1.4.10",
  48790. "phpunit/phpunit": "^9.6 || ^7.5"
  48791. },
  48792. "time": "2024-05-24T10:39:05+00:00",
  48793. "type": "library",
  48794. "installation-source": "dist",
  48795. "autoload": {
  48796. "files": [
  48797. "src/functions_include.php"
  48798. ],
  48799. "psr-4": {
  48800. "React\\Promise\\": "src/"
  48801. }
  48802. },
  48803. "notification-url": "https://packagist.org/downloads/",
  48804. "license": [
  48805. "MIT"
  48806. ],
  48807. "authors": [
  48808. {
  48809. "name": "Jan Sorgalla",
  48810. "email": "jsorgalla@gmail.com",
  48811. "homepage": "https://sorgalla.com/"
  48812. },
  48813. {
  48814. "name": "Christian Lück",
  48815. "email": "christian@clue.engineering",
  48816. "homepage": "https://clue.engineering/"
  48817. },
  48818. {
  48819. "name": "Cees-Jan Kiewiet",
  48820. "email": "reactphp@ceesjankiewiet.nl",
  48821. "homepage": "https://wyrihaximus.net/"
  48822. },
  48823. {
  48824. "name": "Chris Boden",
  48825. "email": "cboden@gmail.com",
  48826. "homepage": "https://cboden.dev/"
  48827. }
  48828. ],
  48829. "description": "A lightweight implementation of CommonJS Promises/A for PHP",
  48830. "keywords": [
  48831. "promise",
  48832. "promises"
  48833. ],
  48834. "support": {
  48835. "issues": "https://github.com/reactphp/promise/issues",
  48836. "source": "https://github.com/reactphp/promise/tree/v3.2.0"
  48837. },
  48838. "funding": [
  48839. {
  48840. "url": "https://opencollective.com/reactphp",
  48841. "type": "open_collective"
  48842. }
  48843. ],
  48844. "install-path": "../react/promise"
  48845. },
  48846. {
  48847. "name": "seld/jsonlint",
  48848. "version": "1.11.0",
  48849. "version_normalized": "1.11.0.0",
  48850. "source": {
  48851. "type": "git",
  48852. "url": "https://github.com/Seldaek/jsonlint.git",
  48853. "reference": "1748aaf847fc731cfad7725aec413ee46f0cc3a2"
  48854. },
  48855. "dist": {
  48856. "type": "zip",
  48857. "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/1748aaf847fc731cfad7725aec413ee46f0cc3a2",
  48858. "reference": "1748aaf847fc731cfad7725aec413ee46f0cc3a2",
  48859. "shasum": ""
  48860. },
  48861. "require": {
  48862. "php": "^5.3 || ^7.0 || ^8.0"
  48863. },
  48864. "require-dev": {
  48865. "phpstan/phpstan": "^1.11",
  48866. "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13"
  48867. },
  48868. "time": "2024-07-11T14:55:45+00:00",
  48869. "bin": [
  48870. "bin/jsonlint"
  48871. ],
  48872. "type": "library",
  48873. "installation-source": "dist",
  48874. "autoload": {
  48875. "psr-4": {
  48876. "Seld\\JsonLint\\": "src/Seld/JsonLint/"
  48877. }
  48878. },
  48879. "notification-url": "https://packagist.org/downloads/",
  48880. "license": [
  48881. "MIT"
  48882. ],
  48883. "authors": [
  48884. {
  48885. "name": "Jordi Boggiano",
  48886. "email": "j.boggiano@seld.be",
  48887. "homepage": "https://seld.be"
  48888. }
  48889. ],
  48890. "description": "JSON Linter",
  48891. "keywords": [
  48892. "json",
  48893. "linter",
  48894. "parser",
  48895. "validator"
  48896. ],
  48897. "support": {
  48898. "issues": "https://github.com/Seldaek/jsonlint/issues",
  48899. "source": "https://github.com/Seldaek/jsonlint/tree/1.11.0"
  48900. },
  48901. "funding": [
  48902. {
  48903. "url": "https://github.com/Seldaek",
  48904. "type": "github"
  48905. },
  48906. {
  48907. "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint",
  48908. "type": "tidelift"
  48909. }
  48910. ],
  48911. "install-path": "../seld/jsonlint"
  48912. },
  48913. {
  48914. "name": "seld/phar-utils",
  48915. "version": "1.2.1",
  48916. "version_normalized": "1.2.1.0",
  48917. "source": {
  48918. "type": "git",
  48919. "url": "https://github.com/Seldaek/phar-utils.git",
  48920. "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c"
  48921. },
  48922. "dist": {
  48923. "type": "zip",
  48924. "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/ea2f4014f163c1be4c601b9b7bd6af81ba8d701c",
  48925. "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c",
  48926. "shasum": ""
  48927. },
  48928. "require": {
  48929. "php": ">=5.3"
  48930. },
  48931. "time": "2022-08-31T10:31:18+00:00",
  48932. "type": "library",
  48933. "extra": {
  48934. "branch-alias": {
  48935. "dev-master": "1.x-dev"
  48936. }
  48937. },
  48938. "installation-source": "dist",
  48939. "autoload": {
  48940. "psr-4": {
  48941. "Seld\\PharUtils\\": "src/"
  48942. }
  48943. },
  48944. "notification-url": "https://packagist.org/downloads/",
  48945. "license": [
  48946. "MIT"
  48947. ],
  48948. "authors": [
  48949. {
  48950. "name": "Jordi Boggiano",
  48951. "email": "j.boggiano@seld.be"
  48952. }
  48953. ],
  48954. "description": "PHAR file format utilities, for when PHP phars you up",
  48955. "keywords": [
  48956. "phar"
  48957. ],
  48958. "support": {
  48959. "issues": "https://github.com/Seldaek/phar-utils/issues",
  48960. "source": "https://github.com/Seldaek/phar-utils/tree/1.2.1"
  48961. },
  48962. "install-path": "../seld/phar-utils"
  48963. },
  48964. {
  48965. "name": "seld/signal-handler",
  48966. "version": "2.0.2",
  48967. "version_normalized": "2.0.2.0",
  48968. "source": {
  48969. "type": "git",
  48970. "url": "https://github.com/Seldaek/signal-handler.git",
  48971. "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98"
  48972. },
  48973. "dist": {
  48974. "type": "zip",
  48975. "url": "https://api.github.com/repos/Seldaek/signal-handler/zipball/04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98",
  48976. "reference": "04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98",
  48977. "shasum": ""
  48978. },
  48979. "require": {
  48980. "php": ">=7.2.0"
  48981. },
  48982. "require-dev": {
  48983. "phpstan/phpstan": "^1",
  48984. "phpstan/phpstan-deprecation-rules": "^1.0",
  48985. "phpstan/phpstan-phpunit": "^1",
  48986. "phpstan/phpstan-strict-rules": "^1.3",
  48987. "phpunit/phpunit": "^7.5.20 || ^8.5.23",
  48988. "psr/log": "^1 || ^2 || ^3"
  48989. },
  48990. "time": "2023-09-03T09:24:00+00:00",
  48991. "type": "library",
  48992. "extra": {
  48993. "branch-alias": {
  48994. "dev-main": "2.x-dev"
  48995. }
  48996. },
  48997. "installation-source": "dist",
  48998. "autoload": {
  48999. "psr-4": {
  49000. "Seld\\Signal\\": "src/"
  49001. }
  49002. },
  49003. "notification-url": "https://packagist.org/downloads/",
  49004. "license": [
  49005. "MIT"
  49006. ],
  49007. "authors": [
  49008. {
  49009. "name": "Jordi Boggiano",
  49010. "email": "j.boggiano@seld.be",
  49011. "homepage": "http://seld.be"
  49012. }
  49013. ],
  49014. "description": "Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development",
  49015. "keywords": [
  49016. "posix",
  49017. "sigint",
  49018. "signal",
  49019. "sigterm",
  49020. "unix"
  49021. ],
  49022. "support": {
  49023. "issues": "https://github.com/Seldaek/signal-handler/issues",
  49024. "source": "https://github.com/Seldaek/signal-handler/tree/2.0.2"
  49025. },
  49026. "install-path": "../seld/signal-handler"
  49027. },
  49028. {
  49029. "name": "symfony/console",
  49030. "version": "v5.4.47",
  49031. "version_normalized": "5.4.47.0",
  49032. "source": {
  49033. "type": "git",
  49034. "url": "https://github.com/symfony/console.git",
  49035. "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed"
  49036. },
  49037. "dist": {
  49038. "type": "zip",
  49039. "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed",
  49040. "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed",
  49041. "shasum": ""
  49042. },
  49043. "require": {
  49044. "php": ">=7.2.5",
  49045. "symfony/deprecation-contracts": "^2.1|^3",
  49046. "symfony/polyfill-mbstring": "~1.0",
  49047. "symfony/polyfill-php73": "^1.9",
  49048. "symfony/polyfill-php80": "^1.16",
  49049. "symfony/service-contracts": "^1.1|^2|^3",
  49050. "symfony/string": "^5.1|^6.0"
  49051. },
  49052. "conflict": {
  49053. "psr/log": ">=3",
  49054. "symfony/dependency-injection": "<4.4",
  49055. "symfony/dotenv": "<5.1",
  49056. "symfony/event-dispatcher": "<4.4",
  49057. "symfony/lock": "<4.4",
  49058. "symfony/process": "<4.4"
  49059. },
  49060. "provide": {
  49061. "psr/log-implementation": "1.0|2.0"
  49062. },
  49063. "require-dev": {
  49064. "psr/log": "^1|^2",
  49065. "symfony/config": "^4.4|^5.0|^6.0",
  49066. "symfony/dependency-injection": "^4.4|^5.0|^6.0",
  49067. "symfony/event-dispatcher": "^4.4|^5.0|^6.0",
  49068. "symfony/lock": "^4.4|^5.0|^6.0",
  49069. "symfony/process": "^4.4|^5.0|^6.0",
  49070. "symfony/var-dumper": "^4.4|^5.0|^6.0"
  49071. },
  49072. "suggest": {
  49073. "psr/log": "For using the console logger",
  49074. "symfony/event-dispatcher": "",
  49075. "symfony/lock": "",
  49076. "symfony/process": ""
  49077. },
  49078. "time": "2024-11-06T11:30:55+00:00",
  49079. "type": "library",
  49080. "installation-source": "dist",
  49081. "autoload": {
  49082. "psr-4": {
  49083. "Symfony\\Component\\Console\\": ""
  49084. },
  49085. "exclude-from-classmap": [
  49086. "/Tests/"
  49087. ]
  49088. },
  49089. "notification-url": "https://packagist.org/downloads/",
  49090. "license": [
  49091. "MIT"
  49092. ],
  49093. "authors": [
  49094. {
  49095. "name": "Fabien Potencier",
  49096. "email": "fabien@symfony.com"
  49097. },
  49098. {
  49099. "name": "Symfony Community",
  49100. "homepage": "https://symfony.com/contributors"
  49101. }
  49102. ],
  49103. "description": "Eases the creation of beautiful and testable command line interfaces",
  49104. "homepage": "https://symfony.com",
  49105. "keywords": [
  49106. "cli",
  49107. "command-line",
  49108. "console",
  49109. "terminal"
  49110. ],
  49111. "support": {
  49112. "source": "https://github.com/symfony/console/tree/v5.4.47"
  49113. },
  49114. "funding": [
  49115. {
  49116. "url": "https://symfony.com/sponsor",
  49117. "type": "custom"
  49118. },
  49119. {
  49120. "url": "https://github.com/fabpot",
  49121. "type": "github"
  49122. },
  49123. {
  49124. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49125. "type": "tidelift"
  49126. }
  49127. ],
  49128. "install-path": "../symfony/console"
  49129. },
  49130. {
  49131. "name": "symfony/deprecation-contracts",
  49132. "version": "v2.5.3",
  49133. "version_normalized": "2.5.3.0",
  49134. "source": {
  49135. "type": "git",
  49136. "url": "https://github.com/symfony/deprecation-contracts.git",
  49137. "reference": "80d075412b557d41002320b96a096ca65aa2c98d"
  49138. },
  49139. "dist": {
  49140. "type": "zip",
  49141. "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d",
  49142. "reference": "80d075412b557d41002320b96a096ca65aa2c98d",
  49143. "shasum": ""
  49144. },
  49145. "require": {
  49146. "php": ">=7.1"
  49147. },
  49148. "time": "2023-01-24T14:02:46+00:00",
  49149. "type": "library",
  49150. "extra": {
  49151. "branch-alias": {
  49152. "dev-main": "2.5-dev"
  49153. },
  49154. "thanks": {
  49155. "name": "symfony/contracts",
  49156. "url": "https://github.com/symfony/contracts"
  49157. }
  49158. },
  49159. "installation-source": "dist",
  49160. "autoload": {
  49161. "files": [
  49162. "function.php"
  49163. ]
  49164. },
  49165. "notification-url": "https://packagist.org/downloads/",
  49166. "license": [
  49167. "MIT"
  49168. ],
  49169. "authors": [
  49170. {
  49171. "name": "Nicolas Grekas",
  49172. "email": "p@tchwork.com"
  49173. },
  49174. {
  49175. "name": "Symfony Community",
  49176. "homepage": "https://symfony.com/contributors"
  49177. }
  49178. ],
  49179. "description": "A generic function and convention to trigger deprecation notices",
  49180. "homepage": "https://symfony.com",
  49181. "support": {
  49182. "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3"
  49183. },
  49184. "funding": [
  49185. {
  49186. "url": "https://symfony.com/sponsor",
  49187. "type": "custom"
  49188. },
  49189. {
  49190. "url": "https://github.com/fabpot",
  49191. "type": "github"
  49192. },
  49193. {
  49194. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49195. "type": "tidelift"
  49196. }
  49197. ],
  49198. "install-path": "../symfony/deprecation-contracts"
  49199. },
  49200. {
  49201. "name": "symfony/filesystem",
  49202. "version": "v5.4.45",
  49203. "version_normalized": "5.4.45.0",
  49204. "source": {
  49205. "type": "git",
  49206. "url": "https://github.com/symfony/filesystem.git",
  49207. "reference": "57c8294ed37d4a055b77057827c67f9558c95c54"
  49208. },
  49209. "dist": {
  49210. "type": "zip",
  49211. "url": "https://api.github.com/repos/symfony/filesystem/zipball/57c8294ed37d4a055b77057827c67f9558c95c54",
  49212. "reference": "57c8294ed37d4a055b77057827c67f9558c95c54",
  49213. "shasum": ""
  49214. },
  49215. "require": {
  49216. "php": ">=7.2.5",
  49217. "symfony/polyfill-ctype": "~1.8",
  49218. "symfony/polyfill-mbstring": "~1.8",
  49219. "symfony/polyfill-php80": "^1.16"
  49220. },
  49221. "require-dev": {
  49222. "symfony/process": "^5.4|^6.4"
  49223. },
  49224. "time": "2024-10-22T13:05:35+00:00",
  49225. "type": "library",
  49226. "installation-source": "dist",
  49227. "autoload": {
  49228. "psr-4": {
  49229. "Symfony\\Component\\Filesystem\\": ""
  49230. },
  49231. "exclude-from-classmap": [
  49232. "/Tests/"
  49233. ]
  49234. },
  49235. "notification-url": "https://packagist.org/downloads/",
  49236. "license": [
  49237. "MIT"
  49238. ],
  49239. "authors": [
  49240. {
  49241. "name": "Fabien Potencier",
  49242. "email": "fabien@symfony.com"
  49243. },
  49244. {
  49245. "name": "Symfony Community",
  49246. "homepage": "https://symfony.com/contributors"
  49247. }
  49248. ],
  49249. "description": "Provides basic utilities for the filesystem",
  49250. "homepage": "https://symfony.com",
  49251. "support": {
  49252. "source": "https://github.com/symfony/filesystem/tree/v5.4.45"
  49253. },
  49254. "funding": [
  49255. {
  49256. "url": "https://symfony.com/sponsor",
  49257. "type": "custom"
  49258. },
  49259. {
  49260. "url": "https://github.com/fabpot",
  49261. "type": "github"
  49262. },
  49263. {
  49264. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49265. "type": "tidelift"
  49266. }
  49267. ],
  49268. "install-path": "../symfony/filesystem"
  49269. },
  49270. {
  49271. "name": "symfony/finder",
  49272. "version": "v5.4.45",
  49273. "version_normalized": "5.4.45.0",
  49274. "source": {
  49275. "type": "git",
  49276. "url": "https://github.com/symfony/finder.git",
  49277. "reference": "63741784cd7b9967975eec610b256eed3ede022b"
  49278. },
  49279. "dist": {
  49280. "type": "zip",
  49281. "url": "https://api.github.com/repos/symfony/finder/zipball/63741784cd7b9967975eec610b256eed3ede022b",
  49282. "reference": "63741784cd7b9967975eec610b256eed3ede022b",
  49283. "shasum": ""
  49284. },
  49285. "require": {
  49286. "php": ">=7.2.5",
  49287. "symfony/deprecation-contracts": "^2.1|^3",
  49288. "symfony/polyfill-php80": "^1.16"
  49289. },
  49290. "time": "2024-09-28T13:32:08+00:00",
  49291. "type": "library",
  49292. "installation-source": "dist",
  49293. "autoload": {
  49294. "psr-4": {
  49295. "Symfony\\Component\\Finder\\": ""
  49296. },
  49297. "exclude-from-classmap": [
  49298. "/Tests/"
  49299. ]
  49300. },
  49301. "notification-url": "https://packagist.org/downloads/",
  49302. "license": [
  49303. "MIT"
  49304. ],
  49305. "authors": [
  49306. {
  49307. "name": "Fabien Potencier",
  49308. "email": "fabien@symfony.com"
  49309. },
  49310. {
  49311. "name": "Symfony Community",
  49312. "homepage": "https://symfony.com/contributors"
  49313. }
  49314. ],
  49315. "description": "Finds files and directories via an intuitive fluent interface",
  49316. "homepage": "https://symfony.com",
  49317. "support": {
  49318. "source": "https://github.com/symfony/finder/tree/v5.4.45"
  49319. },
  49320. "funding": [
  49321. {
  49322. "url": "https://symfony.com/sponsor",
  49323. "type": "custom"
  49324. },
  49325. {
  49326. "url": "https://github.com/fabpot",
  49327. "type": "github"
  49328. },
  49329. {
  49330. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49331. "type": "tidelift"
  49332. }
  49333. ],
  49334. "install-path": "../symfony/finder"
  49335. },
  49336. {
  49337. "name": "symfony/polyfill-ctype",
  49338. "version": "v1.31.0",
  49339. "version_normalized": "1.31.0.0",
  49340. "source": {
  49341. "type": "git",
  49342. "url": "https://github.com/symfony/polyfill-ctype.git",
  49343. "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
  49344. },
  49345. "dist": {
  49346. "type": "zip",
  49347. "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
  49348. "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
  49349. "shasum": ""
  49350. },
  49351. "require": {
  49352. "php": ">=7.2"
  49353. },
  49354. "provide": {
  49355. "ext-ctype": "*"
  49356. },
  49357. "suggest": {
  49358. "ext-ctype": "For best performance"
  49359. },
  49360. "time": "2024-09-09T11:45:10+00:00",
  49361. "type": "library",
  49362. "extra": {
  49363. "thanks": {
  49364. "name": "symfony/polyfill",
  49365. "url": "https://github.com/symfony/polyfill"
  49366. }
  49367. },
  49368. "installation-source": "dist",
  49369. "autoload": {
  49370. "files": [
  49371. "bootstrap.php"
  49372. ],
  49373. "psr-4": {
  49374. "Symfony\\Polyfill\\Ctype\\": ""
  49375. }
  49376. },
  49377. "notification-url": "https://packagist.org/downloads/",
  49378. "license": [
  49379. "MIT"
  49380. ],
  49381. "authors": [
  49382. {
  49383. "name": "Gert de Pagter",
  49384. "email": "BackEndTea@gmail.com"
  49385. },
  49386. {
  49387. "name": "Symfony Community",
  49388. "homepage": "https://symfony.com/contributors"
  49389. }
  49390. ],
  49391. "description": "Symfony polyfill for ctype functions",
  49392. "homepage": "https://symfony.com",
  49393. "keywords": [
  49394. "compatibility",
  49395. "ctype",
  49396. "polyfill",
  49397. "portable"
  49398. ],
  49399. "support": {
  49400. "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
  49401. },
  49402. "funding": [
  49403. {
  49404. "url": "https://symfony.com/sponsor",
  49405. "type": "custom"
  49406. },
  49407. {
  49408. "url": "https://github.com/fabpot",
  49409. "type": "github"
  49410. },
  49411. {
  49412. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49413. "type": "tidelift"
  49414. }
  49415. ],
  49416. "install-path": "../symfony/polyfill-ctype"
  49417. },
  49418. {
  49419. "name": "symfony/polyfill-intl-grapheme",
  49420. "version": "v1.31.0",
  49421. "version_normalized": "1.31.0.0",
  49422. "source": {
  49423. "type": "git",
  49424. "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
  49425. "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe"
  49426. },
  49427. "dist": {
  49428. "type": "zip",
  49429. "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe",
  49430. "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe",
  49431. "shasum": ""
  49432. },
  49433. "require": {
  49434. "php": ">=7.2"
  49435. },
  49436. "suggest": {
  49437. "ext-intl": "For best performance"
  49438. },
  49439. "time": "2024-09-09T11:45:10+00:00",
  49440. "type": "library",
  49441. "extra": {
  49442. "thanks": {
  49443. "name": "symfony/polyfill",
  49444. "url": "https://github.com/symfony/polyfill"
  49445. }
  49446. },
  49447. "installation-source": "dist",
  49448. "autoload": {
  49449. "files": [
  49450. "bootstrap.php"
  49451. ],
  49452. "psr-4": {
  49453. "Symfony\\Polyfill\\Intl\\Grapheme\\": ""
  49454. }
  49455. },
  49456. "notification-url": "https://packagist.org/downloads/",
  49457. "license": [
  49458. "MIT"
  49459. ],
  49460. "authors": [
  49461. {
  49462. "name": "Nicolas Grekas",
  49463. "email": "p@tchwork.com"
  49464. },
  49465. {
  49466. "name": "Symfony Community",
  49467. "homepage": "https://symfony.com/contributors"
  49468. }
  49469. ],
  49470. "description": "Symfony polyfill for intl's grapheme_* functions",
  49471. "homepage": "https://symfony.com",
  49472. "keywords": [
  49473. "compatibility",
  49474. "grapheme",
  49475. "intl",
  49476. "polyfill",
  49477. "portable",
  49478. "shim"
  49479. ],
  49480. "support": {
  49481. "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0"
  49482. },
  49483. "funding": [
  49484. {
  49485. "url": "https://symfony.com/sponsor",
  49486. "type": "custom"
  49487. },
  49488. {
  49489. "url": "https://github.com/fabpot",
  49490. "type": "github"
  49491. },
  49492. {
  49493. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49494. "type": "tidelift"
  49495. }
  49496. ],
  49497. "install-path": "../symfony/polyfill-intl-grapheme"
  49498. },
  49499. {
  49500. "name": "symfony/polyfill-intl-normalizer",
  49501. "version": "v1.31.0",
  49502. "version_normalized": "1.31.0.0",
  49503. "source": {
  49504. "type": "git",
  49505. "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
  49506. "reference": "3833d7255cc303546435cb650316bff708a1c75c"
  49507. },
  49508. "dist": {
  49509. "type": "zip",
  49510. "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
  49511. "reference": "3833d7255cc303546435cb650316bff708a1c75c",
  49512. "shasum": ""
  49513. },
  49514. "require": {
  49515. "php": ">=7.2"
  49516. },
  49517. "suggest": {
  49518. "ext-intl": "For best performance"
  49519. },
  49520. "time": "2024-09-09T11:45:10+00:00",
  49521. "type": "library",
  49522. "extra": {
  49523. "thanks": {
  49524. "name": "symfony/polyfill",
  49525. "url": "https://github.com/symfony/polyfill"
  49526. }
  49527. },
  49528. "installation-source": "dist",
  49529. "autoload": {
  49530. "files": [
  49531. "bootstrap.php"
  49532. ],
  49533. "psr-4": {
  49534. "Symfony\\Polyfill\\Intl\\Normalizer\\": ""
  49535. },
  49536. "classmap": [
  49537. "Resources/stubs"
  49538. ]
  49539. },
  49540. "notification-url": "https://packagist.org/downloads/",
  49541. "license": [
  49542. "MIT"
  49543. ],
  49544. "authors": [
  49545. {
  49546. "name": "Nicolas Grekas",
  49547. "email": "p@tchwork.com"
  49548. },
  49549. {
  49550. "name": "Symfony Community",
  49551. "homepage": "https://symfony.com/contributors"
  49552. }
  49553. ],
  49554. "description": "Symfony polyfill for intl's Normalizer class and related functions",
  49555. "homepage": "https://symfony.com",
  49556. "keywords": [
  49557. "compatibility",
  49558. "intl",
  49559. "normalizer",
  49560. "polyfill",
  49561. "portable",
  49562. "shim"
  49563. ],
  49564. "support": {
  49565. "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0"
  49566. },
  49567. "funding": [
  49568. {
  49569. "url": "https://symfony.com/sponsor",
  49570. "type": "custom"
  49571. },
  49572. {
  49573. "url": "https://github.com/fabpot",
  49574. "type": "github"
  49575. },
  49576. {
  49577. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49578. "type": "tidelift"
  49579. }
  49580. ],
  49581. "install-path": "../symfony/polyfill-intl-normalizer"
  49582. },
  49583. {
  49584. "name": "symfony/polyfill-mbstring",
  49585. "version": "v1.31.0",
  49586. "version_normalized": "1.31.0.0",
  49587. "source": {
  49588. "type": "git",
  49589. "url": "https://github.com/symfony/polyfill-mbstring.git",
  49590. "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
  49591. },
  49592. "dist": {
  49593. "type": "zip",
  49594. "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
  49595. "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
  49596. "shasum": ""
  49597. },
  49598. "require": {
  49599. "php": ">=7.2"
  49600. },
  49601. "provide": {
  49602. "ext-mbstring": "*"
  49603. },
  49604. "suggest": {
  49605. "ext-mbstring": "For best performance"
  49606. },
  49607. "time": "2024-09-09T11:45:10+00:00",
  49608. "type": "library",
  49609. "extra": {
  49610. "thanks": {
  49611. "name": "symfony/polyfill",
  49612. "url": "https://github.com/symfony/polyfill"
  49613. }
  49614. },
  49615. "installation-source": "dist",
  49616. "autoload": {
  49617. "files": [
  49618. "bootstrap.php"
  49619. ],
  49620. "psr-4": {
  49621. "Symfony\\Polyfill\\Mbstring\\": ""
  49622. }
  49623. },
  49624. "notification-url": "https://packagist.org/downloads/",
  49625. "license": [
  49626. "MIT"
  49627. ],
  49628. "authors": [
  49629. {
  49630. "name": "Nicolas Grekas",
  49631. "email": "p@tchwork.com"
  49632. },
  49633. {
  49634. "name": "Symfony Community",
  49635. "homepage": "https://symfony.com/contributors"
  49636. }
  49637. ],
  49638. "description": "Symfony polyfill for the Mbstring extension",
  49639. "homepage": "https://symfony.com",
  49640. "keywords": [
  49641. "compatibility",
  49642. "mbstring",
  49643. "polyfill",
  49644. "portable",
  49645. "shim"
  49646. ],
  49647. "support": {
  49648. "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
  49649. },
  49650. "funding": [
  49651. {
  49652. "url": "https://symfony.com/sponsor",
  49653. "type": "custom"
  49654. },
  49655. {
  49656. "url": "https://github.com/fabpot",
  49657. "type": "github"
  49658. },
  49659. {
  49660. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49661. "type": "tidelift"
  49662. }
  49663. ],
  49664. "install-path": "../symfony/polyfill-mbstring"
  49665. },
  49666. {
  49667. "name": "symfony/polyfill-php73",
  49668. "version": "v1.31.0",
  49669. "version_normalized": "1.31.0.0",
  49670. "source": {
  49671. "type": "git",
  49672. "url": "https://github.com/symfony/polyfill-php73.git",
  49673. "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb"
  49674. },
  49675. "dist": {
  49676. "type": "zip",
  49677. "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
  49678. "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
  49679. "shasum": ""
  49680. },
  49681. "require": {
  49682. "php": ">=7.2"
  49683. },
  49684. "time": "2024-09-09T11:45:10+00:00",
  49685. "type": "library",
  49686. "extra": {
  49687. "thanks": {
  49688. "name": "symfony/polyfill",
  49689. "url": "https://github.com/symfony/polyfill"
  49690. }
  49691. },
  49692. "installation-source": "dist",
  49693. "autoload": {
  49694. "files": [
  49695. "bootstrap.php"
  49696. ],
  49697. "psr-4": {
  49698. "Symfony\\Polyfill\\Php73\\": ""
  49699. },
  49700. "classmap": [
  49701. "Resources/stubs"
  49702. ]
  49703. },
  49704. "notification-url": "https://packagist.org/downloads/",
  49705. "license": [
  49706. "MIT"
  49707. ],
  49708. "authors": [
  49709. {
  49710. "name": "Nicolas Grekas",
  49711. "email": "p@tchwork.com"
  49712. },
  49713. {
  49714. "name": "Symfony Community",
  49715. "homepage": "https://symfony.com/contributors"
  49716. }
  49717. ],
  49718. "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
  49719. "homepage": "https://symfony.com",
  49720. "keywords": [
  49721. "compatibility",
  49722. "polyfill",
  49723. "portable",
  49724. "shim"
  49725. ],
  49726. "support": {
  49727. "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0"
  49728. },
  49729. "funding": [
  49730. {
  49731. "url": "https://symfony.com/sponsor",
  49732. "type": "custom"
  49733. },
  49734. {
  49735. "url": "https://github.com/fabpot",
  49736. "type": "github"
  49737. },
  49738. {
  49739. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49740. "type": "tidelift"
  49741. }
  49742. ],
  49743. "install-path": "../symfony/polyfill-php73"
  49744. },
  49745. {
  49746. "name": "symfony/polyfill-php80",
  49747. "version": "v1.31.0",
  49748. "version_normalized": "1.31.0.0",
  49749. "source": {
  49750. "type": "git",
  49751. "url": "https://github.com/symfony/polyfill-php80.git",
  49752. "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
  49753. },
  49754. "dist": {
  49755. "type": "zip",
  49756. "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
  49757. "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
  49758. "shasum": ""
  49759. },
  49760. "require": {
  49761. "php": ">=7.2"
  49762. },
  49763. "time": "2024-09-09T11:45:10+00:00",
  49764. "type": "library",
  49765. "extra": {
  49766. "thanks": {
  49767. "name": "symfony/polyfill",
  49768. "url": "https://github.com/symfony/polyfill"
  49769. }
  49770. },
  49771. "installation-source": "dist",
  49772. "autoload": {
  49773. "files": [
  49774. "bootstrap.php"
  49775. ],
  49776. "psr-4": {
  49777. "Symfony\\Polyfill\\Php80\\": ""
  49778. },
  49779. "classmap": [
  49780. "Resources/stubs"
  49781. ]
  49782. },
  49783. "notification-url": "https://packagist.org/downloads/",
  49784. "license": [
  49785. "MIT"
  49786. ],
  49787. "authors": [
  49788. {
  49789. "name": "Ion Bazan",
  49790. "email": "ion.bazan@gmail.com"
  49791. },
  49792. {
  49793. "name": "Nicolas Grekas",
  49794. "email": "p@tchwork.com"
  49795. },
  49796. {
  49797. "name": "Symfony Community",
  49798. "homepage": "https://symfony.com/contributors"
  49799. }
  49800. ],
  49801. "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
  49802. "homepage": "https://symfony.com",
  49803. "keywords": [
  49804. "compatibility",
  49805. "polyfill",
  49806. "portable",
  49807. "shim"
  49808. ],
  49809. "support": {
  49810. "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
  49811. },
  49812. "funding": [
  49813. {
  49814. "url": "https://symfony.com/sponsor",
  49815. "type": "custom"
  49816. },
  49817. {
  49818. "url": "https://github.com/fabpot",
  49819. "type": "github"
  49820. },
  49821. {
  49822. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49823. "type": "tidelift"
  49824. }
  49825. ],
  49826. "install-path": "../symfony/polyfill-php80"
  49827. },
  49828. {
  49829. "name": "symfony/polyfill-php81",
  49830. "version": "v1.31.0",
  49831. "version_normalized": "1.31.0.0",
  49832. "source": {
  49833. "type": "git",
  49834. "url": "https://github.com/symfony/polyfill-php81.git",
  49835. "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
  49836. },
  49837. "dist": {
  49838. "type": "zip",
  49839. "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
  49840. "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
  49841. "shasum": ""
  49842. },
  49843. "require": {
  49844. "php": ">=7.2"
  49845. },
  49846. "time": "2024-09-09T11:45:10+00:00",
  49847. "type": "library",
  49848. "extra": {
  49849. "thanks": {
  49850. "name": "symfony/polyfill",
  49851. "url": "https://github.com/symfony/polyfill"
  49852. }
  49853. },
  49854. "installation-source": "dist",
  49855. "autoload": {
  49856. "files": [
  49857. "bootstrap.php"
  49858. ],
  49859. "psr-4": {
  49860. "Symfony\\Polyfill\\Php81\\": ""
  49861. },
  49862. "classmap": [
  49863. "Resources/stubs"
  49864. ]
  49865. },
  49866. "notification-url": "https://packagist.org/downloads/",
  49867. "license": [
  49868. "MIT"
  49869. ],
  49870. "authors": [
  49871. {
  49872. "name": "Nicolas Grekas",
  49873. "email": "p@tchwork.com"
  49874. },
  49875. {
  49876. "name": "Symfony Community",
  49877. "homepage": "https://symfony.com/contributors"
  49878. }
  49879. ],
  49880. "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions",
  49881. "homepage": "https://symfony.com",
  49882. "keywords": [
  49883. "compatibility",
  49884. "polyfill",
  49885. "portable",
  49886. "shim"
  49887. ],
  49888. "support": {
  49889. "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0"
  49890. },
  49891. "funding": [
  49892. {
  49893. "url": "https://symfony.com/sponsor",
  49894. "type": "custom"
  49895. },
  49896. {
  49897. "url": "https://github.com/fabpot",
  49898. "type": "github"
  49899. },
  49900. {
  49901. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49902. "type": "tidelift"
  49903. }
  49904. ],
  49905. "install-path": "../symfony/polyfill-php81"
  49906. },
  49907. {
  49908. "name": "symfony/process",
  49909. "version": "v5.4.47",
  49910. "version_normalized": "5.4.47.0",
  49911. "source": {
  49912. "type": "git",
  49913. "url": "https://github.com/symfony/process.git",
  49914. "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d"
  49915. },
  49916. "dist": {
  49917. "type": "zip",
  49918. "url": "https://api.github.com/repos/symfony/process/zipball/5d1662fb32ebc94f17ddb8d635454a776066733d",
  49919. "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d",
  49920. "shasum": ""
  49921. },
  49922. "require": {
  49923. "php": ">=7.2.5",
  49924. "symfony/polyfill-php80": "^1.16"
  49925. },
  49926. "time": "2024-11-06T11:36:42+00:00",
  49927. "type": "library",
  49928. "installation-source": "dist",
  49929. "autoload": {
  49930. "psr-4": {
  49931. "Symfony\\Component\\Process\\": ""
  49932. },
  49933. "exclude-from-classmap": [
  49934. "/Tests/"
  49935. ]
  49936. },
  49937. "notification-url": "https://packagist.org/downloads/",
  49938. "license": [
  49939. "MIT"
  49940. ],
  49941. "authors": [
  49942. {
  49943. "name": "Fabien Potencier",
  49944. "email": "fabien@symfony.com"
  49945. },
  49946. {
  49947. "name": "Symfony Community",
  49948. "homepage": "https://symfony.com/contributors"
  49949. }
  49950. ],
  49951. "description": "Executes commands in sub-processes",
  49952. "homepage": "https://symfony.com",
  49953. "support": {
  49954. "source": "https://github.com/symfony/process/tree/v5.4.47"
  49955. },
  49956. "funding": [
  49957. {
  49958. "url": "https://symfony.com/sponsor",
  49959. "type": "custom"
  49960. },
  49961. {
  49962. "url": "https://github.com/fabpot",
  49963. "type": "github"
  49964. },
  49965. {
  49966. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  49967. "type": "tidelift"
  49968. }
  49969. ],
  49970. "install-path": "../symfony/process"
  49971. },
  49972. {
  49973. "name": "symfony/service-contracts",
  49974. "version": "v2.5.3",
  49975. "version_normalized": "2.5.3.0",
  49976. "source": {
  49977. "type": "git",
  49978. "url": "https://github.com/symfony/service-contracts.git",
  49979. "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3"
  49980. },
  49981. "dist": {
  49982. "type": "zip",
  49983. "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3",
  49984. "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3",
  49985. "shasum": ""
  49986. },
  49987. "require": {
  49988. "php": ">=7.2.5",
  49989. "psr/container": "^1.1",
  49990. "symfony/deprecation-contracts": "^2.1|^3"
  49991. },
  49992. "conflict": {
  49993. "ext-psr": "<1.1|>=2"
  49994. },
  49995. "suggest": {
  49996. "symfony/service-implementation": ""
  49997. },
  49998. "time": "2023-04-21T15:04:16+00:00",
  49999. "type": "library",
  50000. "extra": {
  50001. "branch-alias": {
  50002. "dev-main": "2.5-dev"
  50003. },
  50004. "thanks": {
  50005. "name": "symfony/contracts",
  50006. "url": "https://github.com/symfony/contracts"
  50007. }
  50008. },
  50009. "installation-source": "dist",
  50010. "autoload": {
  50011. "psr-4": {
  50012. "Symfony\\Contracts\\Service\\": ""
  50013. }
  50014. },
  50015. "notification-url": "https://packagist.org/downloads/",
  50016. "license": [
  50017. "MIT"
  50018. ],
  50019. "authors": [
  50020. {
  50021. "name": "Nicolas Grekas",
  50022. "email": "p@tchwork.com"
  50023. },
  50024. {
  50025. "name": "Symfony Community",
  50026. "homepage": "https://symfony.com/contributors"
  50027. }
  50028. ],
  50029. "description": "Generic abstractions related to writing services",
  50030. "homepage": "https://symfony.com",
  50031. "keywords": [
  50032. "abstractions",
  50033. "contracts",
  50034. "decoupling",
  50035. "interfaces",
  50036. "interoperability",
  50037. "standards"
  50038. ],
  50039. "support": {
  50040. "source": "https://github.com/symfony/service-contracts/tree/v2.5.3"
  50041. },
  50042. "funding": [
  50043. {
  50044. "url": "https://symfony.com/sponsor",
  50045. "type": "custom"
  50046. },
  50047. {
  50048. "url": "https://github.com/fabpot",
  50049. "type": "github"
  50050. },
  50051. {
  50052. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  50053. "type": "tidelift"
  50054. }
  50055. ],
  50056. "install-path": "../symfony/service-contracts"
  50057. },
  50058. {
  50059. "name": "symfony/string",
  50060. "version": "v5.4.47",
  50061. "version_normalized": "5.4.47.0",
  50062. "source": {
  50063. "type": "git",
  50064. "url": "https://github.com/symfony/string.git",
  50065. "reference": "136ca7d72f72b599f2631aca474a4f8e26719799"
  50066. },
  50067. "dist": {
  50068. "type": "zip",
  50069. "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799",
  50070. "reference": "136ca7d72f72b599f2631aca474a4f8e26719799",
  50071. "shasum": ""
  50072. },
  50073. "require": {
  50074. "php": ">=7.2.5",
  50075. "symfony/polyfill-ctype": "~1.8",
  50076. "symfony/polyfill-intl-grapheme": "~1.0",
  50077. "symfony/polyfill-intl-normalizer": "~1.0",
  50078. "symfony/polyfill-mbstring": "~1.0",
  50079. "symfony/polyfill-php80": "~1.15"
  50080. },
  50081. "conflict": {
  50082. "symfony/translation-contracts": ">=3.0"
  50083. },
  50084. "require-dev": {
  50085. "symfony/error-handler": "^4.4|^5.0|^6.0",
  50086. "symfony/http-client": "^4.4|^5.0|^6.0",
  50087. "symfony/translation-contracts": "^1.1|^2",
  50088. "symfony/var-exporter": "^4.4|^5.0|^6.0"
  50089. },
  50090. "time": "2024-11-10T20:33:58+00:00",
  50091. "type": "library",
  50092. "installation-source": "dist",
  50093. "autoload": {
  50094. "files": [
  50095. "Resources/functions.php"
  50096. ],
  50097. "psr-4": {
  50098. "Symfony\\Component\\String\\": ""
  50099. },
  50100. "exclude-from-classmap": [
  50101. "/Tests/"
  50102. ]
  50103. },
  50104. "notification-url": "https://packagist.org/downloads/",
  50105. "license": [
  50106. "MIT"
  50107. ],
  50108. "authors": [
  50109. {
  50110. "name": "Nicolas Grekas",
  50111. "email": "p@tchwork.com"
  50112. },
  50113. {
  50114. "name": "Symfony Community",
  50115. "homepage": "https://symfony.com/contributors"
  50116. }
  50117. ],
  50118. "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way",
  50119. "homepage": "https://symfony.com",
  50120. "keywords": [
  50121. "grapheme",
  50122. "i18n",
  50123. "string",
  50124. "unicode",
  50125. "utf-8",
  50126. "utf8"
  50127. ],
  50128. "support": {
  50129. "source": "https://github.com/symfony/string/tree/v5.4.47"
  50130. },
  50131. "funding": [
  50132. {
  50133. "url": "https://symfony.com/sponsor",
  50134. "type": "custom"
  50135. },
  50136. {
  50137. "url": "https://github.com/fabpot",
  50138. "type": "github"
  50139. },
  50140. {
  50141. "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
  50142. "type": "tidelift"
  50143. }
  50144. ],
  50145. "install-path": "../symfony/string"
  50146. }
  50147. ],
  50148. "dev": false,
  50149. "dev-package-names": []
  50150. }
  50151. <?php return array(
  50152. 'root' => array(
  50153. 'name' => 'composer/composer',
  50154. 'pretty_version' => '2.8.3',
  50155. 'version' => '2.8.3.0',
  50156. 'reference' => '2a7c71266b2545a3bed9f4860734081963f6e688',
  50157. 'type' => 'library',
  50158. 'install_path' => __DIR__ . '/../../',
  50159. 'aliases' => array(),
  50160. 'dev' => false,
  50161. ),
  50162. 'versions' => array(
  50163. 'composer/ca-bundle' => array(
  50164. 'pretty_version' => '1.5.3',
  50165. 'version' => '1.5.3.0',
  50166. 'reference' => '3b1fc3f0be055baa7c6258b1467849c3e8204eb2',
  50167. 'type' => 'library',
  50168. 'install_path' => __DIR__ . '/./ca-bundle',
  50169. 'aliases' => array(),
  50170. 'dev_requirement' => false,
  50171. ),
  50172. 'composer/class-map-generator' => array(
  50173. 'pretty_version' => '1.4.0',
  50174. 'version' => '1.4.0.0',
  50175. 'reference' => '98bbf6780e56e0fd2404fe4b82eb665a0f93b783',
  50176. 'type' => 'library',
  50177. 'install_path' => __DIR__ . '/./class-map-generator',
  50178. 'aliases' => array(),
  50179. 'dev_requirement' => false,
  50180. ),
  50181. 'composer/composer' => array(
  50182. 'pretty_version' => '2.8.3',
  50183. 'version' => '2.8.3.0',
  50184. 'reference' => '2a7c71266b2545a3bed9f4860734081963f6e688',
  50185. 'type' => 'library',
  50186. 'install_path' => __DIR__ . '/../../',
  50187. 'aliases' => array(),
  50188. 'dev_requirement' => false,
  50189. ),
  50190. 'composer/metadata-minifier' => array(
  50191. 'pretty_version' => '1.0.0',
  50192. 'version' => '1.0.0.0',
  50193. 'reference' => 'c549d23829536f0d0e984aaabbf02af91f443207',
  50194. 'type' => 'library',
  50195. 'install_path' => __DIR__ . '/./metadata-minifier',
  50196. 'aliases' => array(),
  50197. 'dev_requirement' => false,
  50198. ),
  50199. 'composer/pcre' => array(
  50200. 'pretty_version' => '2.3.2',
  50201. 'version' => '2.3.2.0',
  50202. 'reference' => 'ebb81df8f52b40172d14062ae96a06939d80a069',
  50203. 'type' => 'library',
  50204. 'install_path' => __DIR__ . '/./pcre',
  50205. 'aliases' => array(),
  50206. 'dev_requirement' => false,
  50207. ),
  50208. 'composer/semver' => array(
  50209. 'pretty_version' => '3.4.3',
  50210. 'version' => '3.4.3.0',
  50211. 'reference' => '4313d26ada5e0c4edfbd1dc481a92ff7bff91f12',
  50212. 'type' => 'library',
  50213. 'install_path' => __DIR__ . '/./semver',
  50214. 'aliases' => array(),
  50215. 'dev_requirement' => false,
  50216. ),
  50217. 'composer/spdx-licenses' => array(
  50218. 'pretty_version' => '1.5.8',
  50219. 'version' => '1.5.8.0',
  50220. 'reference' => '560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a',
  50221. 'type' => 'library',
  50222. 'install_path' => __DIR__ . '/./spdx-licenses',
  50223. 'aliases' => array(),
  50224. 'dev_requirement' => false,
  50225. ),
  50226. 'composer/xdebug-handler' => array(
  50227. 'pretty_version' => '3.0.5',
  50228. 'version' => '3.0.5.0',
  50229. 'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef',
  50230. 'type' => 'library',
  50231. 'install_path' => __DIR__ . '/./xdebug-handler',
  50232. 'aliases' => array(),
  50233. 'dev_requirement' => false,
  50234. ),
  50235. 'justinrainbow/json-schema' => array(
  50236. 'pretty_version' => '5.3.0',
  50237. 'version' => '5.3.0.0',
  50238. 'reference' => 'feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8',
  50239. 'type' => 'library',
  50240. 'install_path' => __DIR__ . '/../justinrainbow/json-schema',
  50241. 'aliases' => array(),
  50242. 'dev_requirement' => false,
  50243. ),
  50244. 'psr/container' => array(
  50245. 'pretty_version' => '1.1.1',
  50246. 'version' => '1.1.1.0',
  50247. 'reference' => '8622567409010282b7aeebe4bb841fe98b58dcaf',
  50248. 'type' => 'library',
  50249. 'install_path' => __DIR__ . '/../psr/container',
  50250. 'aliases' => array(),
  50251. 'dev_requirement' => false,
  50252. ),
  50253. 'psr/log' => array(
  50254. 'pretty_version' => '1.1.4',
  50255. 'version' => '1.1.4.0',
  50256. 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
  50257. 'type' => 'library',
  50258. 'install_path' => __DIR__ . '/../psr/log',
  50259. 'aliases' => array(),
  50260. 'dev_requirement' => false,
  50261. ),
  50262. 'psr/log-implementation' => array(
  50263. 'dev_requirement' => false,
  50264. 'provided' => array(
  50265. 0 => '1.0|2.0',
  50266. ),
  50267. ),
  50268. 'react/promise' => array(
  50269. 'pretty_version' => 'v3.2.0',
  50270. 'version' => '3.2.0.0',
  50271. 'reference' => '8a164643313c71354582dc850b42b33fa12a4b63',
  50272. 'type' => 'library',
  50273. 'install_path' => __DIR__ . '/../react/promise',
  50274. 'aliases' => array(),
  50275. 'dev_requirement' => false,
  50276. ),
  50277. 'seld/jsonlint' => array(
  50278. 'pretty_version' => '1.11.0',
  50279. 'version' => '1.11.0.0',
  50280. 'reference' => '1748aaf847fc731cfad7725aec413ee46f0cc3a2',
  50281. 'type' => 'library',
  50282. 'install_path' => __DIR__ . '/../seld/jsonlint',
  50283. 'aliases' => array(),
  50284. 'dev_requirement' => false,
  50285. ),
  50286. 'seld/phar-utils' => array(
  50287. 'pretty_version' => '1.2.1',
  50288. 'version' => '1.2.1.0',
  50289. 'reference' => 'ea2f4014f163c1be4c601b9b7bd6af81ba8d701c',
  50290. 'type' => 'library',
  50291. 'install_path' => __DIR__ . '/../seld/phar-utils',
  50292. 'aliases' => array(),
  50293. 'dev_requirement' => false,
  50294. ),
  50295. 'seld/signal-handler' => array(
  50296. 'pretty_version' => '2.0.2',
  50297. 'version' => '2.0.2.0',
  50298. 'reference' => '04a6112e883ad76c0ada8e4a9f7520bbfdb6bb98',
  50299. 'type' => 'library',
  50300. 'install_path' => __DIR__ . '/../seld/signal-handler',
  50301. 'aliases' => array(),
  50302. 'dev_requirement' => false,
  50303. ),
  50304. 'symfony/console' => array(
  50305. 'pretty_version' => 'v5.4.47',
  50306. 'version' => '5.4.47.0',
  50307. 'reference' => 'c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed',
  50308. 'type' => 'library',
  50309. 'install_path' => __DIR__ . '/../symfony/console',
  50310. 'aliases' => array(),
  50311. 'dev_requirement' => false,
  50312. ),
  50313. 'symfony/deprecation-contracts' => array(
  50314. 'pretty_version' => 'v2.5.3',
  50315. 'version' => '2.5.3.0',
  50316. 'reference' => '80d075412b557d41002320b96a096ca65aa2c98d',
  50317. 'type' => 'library',
  50318. 'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
  50319. 'aliases' => array(),
  50320. 'dev_requirement' => false,
  50321. ),
  50322. 'symfony/filesystem' => array(
  50323. 'pretty_version' => 'v5.4.45',
  50324. 'version' => '5.4.45.0',
  50325. 'reference' => '57c8294ed37d4a055b77057827c67f9558c95c54',
  50326. 'type' => 'library',
  50327. 'install_path' => __DIR__ . '/../symfony/filesystem',
  50328. 'aliases' => array(),
  50329. 'dev_requirement' => false,
  50330. ),
  50331. 'symfony/finder' => array(
  50332. 'pretty_version' => 'v5.4.45',
  50333. 'version' => '5.4.45.0',
  50334. 'reference' => '63741784cd7b9967975eec610b256eed3ede022b',
  50335. 'type' => 'library',
  50336. 'install_path' => __DIR__ . '/../symfony/finder',
  50337. 'aliases' => array(),
  50338. 'dev_requirement' => false,
  50339. ),
  50340. 'symfony/polyfill-ctype' => array(
  50341. 'pretty_version' => 'v1.31.0',
  50342. 'version' => '1.31.0.0',
  50343. 'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
  50344. 'type' => 'library',
  50345. 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
  50346. 'aliases' => array(),
  50347. 'dev_requirement' => false,
  50348. ),
  50349. 'symfony/polyfill-intl-grapheme' => array(
  50350. 'pretty_version' => 'v1.31.0',
  50351. 'version' => '1.31.0.0',
  50352. 'reference' => 'b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe',
  50353. 'type' => 'library',
  50354. 'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
  50355. 'aliases' => array(),
  50356. 'dev_requirement' => false,
  50357. ),
  50358. 'symfony/polyfill-intl-normalizer' => array(
  50359. 'pretty_version' => 'v1.31.0',
  50360. 'version' => '1.31.0.0',
  50361. 'reference' => '3833d7255cc303546435cb650316bff708a1c75c',
  50362. 'type' => 'library',
  50363. 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
  50364. 'aliases' => array(),
  50365. 'dev_requirement' => false,
  50366. ),
  50367. 'symfony/polyfill-mbstring' => array(
  50368. 'pretty_version' => 'v1.31.0',
  50369. 'version' => '1.31.0.0',
  50370. 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341',
  50371. 'type' => 'library',
  50372. 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
  50373. 'aliases' => array(),
  50374. 'dev_requirement' => false,
  50375. ),
  50376. 'symfony/polyfill-php73' => array(
  50377. 'pretty_version' => 'v1.31.0',
  50378. 'version' => '1.31.0.0',
  50379. 'reference' => '0f68c03565dcaaf25a890667542e8bd75fe7e5bb',
  50380. 'type' => 'library',
  50381. 'install_path' => __DIR__ . '/../symfony/polyfill-php73',
  50382. 'aliases' => array(),
  50383. 'dev_requirement' => false,
  50384. ),
  50385. 'symfony/polyfill-php80' => array(
  50386. 'pretty_version' => 'v1.31.0',
  50387. 'version' => '1.31.0.0',
  50388. 'reference' => '60328e362d4c2c802a54fcbf04f9d3fb892b4cf8',
  50389. 'type' => 'library',
  50390. 'install_path' => __DIR__ . '/../symfony/polyfill-php80',
  50391. 'aliases' => array(),
  50392. 'dev_requirement' => false,
  50393. ),
  50394. 'symfony/polyfill-php81' => array(
  50395. 'pretty_version' => 'v1.31.0',
  50396. 'version' => '1.31.0.0',
  50397. 'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c',
  50398. 'type' => 'library',
  50399. 'install_path' => __DIR__ . '/../symfony/polyfill-php81',
  50400. 'aliases' => array(),
  50401. 'dev_requirement' => false,
  50402. ),
  50403. 'symfony/process' => array(
  50404. 'pretty_version' => 'v5.4.47',
  50405. 'version' => '5.4.47.0',
  50406. 'reference' => '5d1662fb32ebc94f17ddb8d635454a776066733d',
  50407. 'type' => 'library',
  50408. 'install_path' => __DIR__ . '/../symfony/process',
  50409. 'aliases' => array(),
  50410. 'dev_requirement' => false,
  50411. ),
  50412. 'symfony/service-contracts' => array(
  50413. 'pretty_version' => 'v2.5.3',
  50414. 'version' => '2.5.3.0',
  50415. 'reference' => 'a2329596ddc8fd568900e3fc76cba42489ecc7f3',
  50416. 'type' => 'library',
  50417. 'install_path' => __DIR__ . '/../symfony/service-contracts',
  50418. 'aliases' => array(),
  50419. 'dev_requirement' => false,
  50420. ),
  50421. 'symfony/string' => array(
  50422. 'pretty_version' => 'v5.4.47',
  50423. 'version' => '5.4.47.0',
  50424. 'reference' => '136ca7d72f72b599f2631aca474a4f8e26719799',
  50425. 'type' => 'library',
  50426. 'install_path' => __DIR__ . '/../symfony/string',
  50427. 'aliases' => array(),
  50428. 'dev_requirement' => false,
  50429. ),
  50430. ),
  50431. );
  50432. Copyright (C) 2021 Composer
  50433. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50434. this software and associated documentation files (the "Software"), to deal in
  50435. the Software without restriction, including without limitation the rights to
  50436. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50437. of the Software, and to permit persons to whom the Software is furnished to do
  50438. so, subject to the following conditions:
  50439. The above copyright notice and this permission notice shall be included in all
  50440. copies or substantial portions of the Software.
  50441. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50442. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50443. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50444. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50445. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50446. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50447. SOFTWARE.
  50448. <?php
  50449. namespace Composer\MetadataMinifier;
  50450. class MetadataMinifier
  50451. {
  50452. public static function expand(array $versions)
  50453. {
  50454. $expanded = array();
  50455. $expandedVersion = null;
  50456. foreach ($versions as $versionData) {
  50457. if (!$expandedVersion) {
  50458. $expandedVersion = $versionData;
  50459. $expanded[] = $expandedVersion;
  50460. continue;
  50461. }
  50462. foreach ($versionData as $key => $val) {
  50463. if ($val === '__unset') {
  50464. unset($expandedVersion[$key]);
  50465. } else {
  50466. $expandedVersion[$key] = $val;
  50467. }
  50468. }
  50469. $expanded[] = $expandedVersion;
  50470. }
  50471. return $expanded;
  50472. }
  50473. public static function minify(array $versions)
  50474. {
  50475. $minifiedVersions = array();
  50476. $lastKnownVersionData = null;
  50477. foreach ($versions as $version) {
  50478. if (!$lastKnownVersionData) {
  50479. $lastKnownVersionData = $version;
  50480. $minifiedVersions[] = $version;
  50481. continue;
  50482. }
  50483. $minifiedVersion = array();
  50484. foreach ($version as $key => $val) {
  50485. if (!isset($lastKnownVersionData[$key]) || $lastKnownVersionData[$key] !== $val) {
  50486. $minifiedVersion[$key] = $val;
  50487. $lastKnownVersionData[$key] = $val;
  50488. }
  50489. }
  50490. foreach ($lastKnownVersionData as $key => $val) {
  50491. if (!isset($version[$key])) {
  50492. $minifiedVersion[$key] = "__unset";
  50493. unset($lastKnownVersionData[$key]);
  50494. }
  50495. }
  50496. $minifiedVersions[] = $minifiedVersion;
  50497. }
  50498. return $minifiedVersions;
  50499. }
  50500. }
  50501. Copyright (C) 2021 Composer
  50502. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50503. this software and associated documentation files (the "Software"), to deal in
  50504. the Software without restriction, including without limitation the rights to
  50505. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50506. of the Software, and to permit persons to whom the Software is furnished to do
  50507. so, subject to the following conditions:
  50508. The above copyright notice and this permission notice shall be included in all
  50509. copies or substantial portions of the Software.
  50510. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50511. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50512. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50513. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50514. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50515. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50516. SOFTWARE.
  50517. <?php
  50518. namespace Composer\Pcre;
  50519. final class MatchAllResult
  50520. {
  50521. public $matches;
  50522. public $count;
  50523. public $matched;
  50524. public function __construct(int $count, array $matches)
  50525. {
  50526. $this->matches = $matches;
  50527. $this->matched = (bool) $count;
  50528. $this->count = $count;
  50529. }
  50530. }
  50531. <?php
  50532. namespace Composer\Pcre;
  50533. final class MatchAllStrictGroupsResult
  50534. {
  50535. public $matches;
  50536. public $count;
  50537. public $matched;
  50538. public function __construct(int $count, array $matches)
  50539. {
  50540. $this->matches = $matches;
  50541. $this->matched = (bool) $count;
  50542. $this->count = $count;
  50543. }
  50544. }
  50545. <?php
  50546. namespace Composer\Pcre;
  50547. final class MatchAllWithOffsetsResult
  50548. {
  50549. public $matches;
  50550. public $count;
  50551. public $matched;
  50552. public function __construct(int $count, array $matches)
  50553. {
  50554. $this->matches = $matches;
  50555. $this->matched = (bool) $count;
  50556. $this->count = $count;
  50557. }
  50558. }
  50559. <?php
  50560. namespace Composer\Pcre;
  50561. final class MatchResult
  50562. {
  50563. public $matches;
  50564. public $matched;
  50565. public function __construct(int $count, array $matches)
  50566. {
  50567. $this->matches = $matches;
  50568. $this->matched = (bool) $count;
  50569. }
  50570. }
  50571. <?php
  50572. namespace Composer\Pcre;
  50573. final class MatchStrictGroupsResult
  50574. {
  50575. public $matches;
  50576. public $matched;
  50577. public function __construct(int $count, array $matches)
  50578. {
  50579. $this->matches = $matches;
  50580. $this->matched = (bool) $count;
  50581. }
  50582. }
  50583. <?php
  50584. namespace Composer\Pcre;
  50585. final class MatchWithOffsetsResult
  50586. {
  50587. public $matches;
  50588. public $matched;
  50589. public function __construct(int $count, array $matches)
  50590. {
  50591. $this->matches = $matches;
  50592. $this->matched = (bool) $count;
  50593. }
  50594. }
  50595. <?php declare(strict_types = 1);
  50596. namespace Composer\Pcre\PHPStan;
  50597. use Composer\Pcre\Preg;
  50598. use Composer\Pcre\Regex;
  50599. use Composer\Pcre\PcreException;
  50600. use Nette\Utils\RegexpException;
  50601. use Nette\Utils\Strings;
  50602. use PhpParser\Node;
  50603. use PhpParser\Node\Expr\StaticCall;
  50604. use PhpParser\Node\Name\FullyQualified;
  50605. use PHPStan\Analyser\Scope;
  50606. use PHPStan\Rules\Rule;
  50607. use PHPStan\Rules\RuleErrorBuilder;
  50608. use function in_array;
  50609. use function sprintf;
  50610. class InvalidRegexPatternRule implements Rule
  50611. {
  50612. public function getNodeType(): string
  50613. {
  50614. return StaticCall::class;
  50615. }
  50616. public function processNode(Node $node, Scope $scope): array
  50617. {
  50618. $patterns = $this->extractPatterns($node, $scope);
  50619. $errors = [];
  50620. foreach ($patterns as $pattern) {
  50621. $errorMessage = $this->validatePattern($pattern);
  50622. if ($errorMessage === null) {
  50623. continue;
  50624. }
  50625. $errors[] = RuleErrorBuilder::message(sprintf('Regex pattern is invalid: %s', $errorMessage))->identifier('regexp.pattern')->build();
  50626. }
  50627. return $errors;
  50628. }
  50629. private function extractPatterns(StaticCall $node, Scope $scope): array
  50630. {
  50631. if (!$node->class instanceof FullyQualified) {
  50632. return [];
  50633. }
  50634. $isRegex = $node->class->toString() === Regex::class;
  50635. $isPreg = $node->class->toString() === Preg::class;
  50636. if (!$isRegex && !$isPreg) {
  50637. return [];
  50638. }
  50639. if (!$node->name instanceof Node\Identifier || !Preg::isMatch('{^(match|isMatch|grep|replace|split)}', $node->name->name)) {
  50640. return [];
  50641. }
  50642. $functionName = $node->name->name;
  50643. if (!isset($node->getArgs()[0])) {
  50644. return [];
  50645. }
  50646. $patternNode = $node->getArgs()[0]->value;
  50647. $patternType = $scope->getType($patternNode);
  50648. $patternStrings = [];
  50649. foreach ($patternType->getConstantStrings() as $constantStringType) {
  50650. if ($functionName === 'replaceCallbackArray') {
  50651. continue;
  50652. }
  50653. $patternStrings[] = $constantStringType->getValue();
  50654. }
  50655. foreach ($patternType->getConstantArrays() as $constantArrayType) {
  50656. if (
  50657. in_array($functionName, [
  50658. 'replace',
  50659. 'replaceCallback',
  50660. ], true)
  50661. ) {
  50662. foreach ($constantArrayType->getValueTypes() as $arrayKeyType) {
  50663. foreach ($arrayKeyType->getConstantStrings() as $constantString) {
  50664. $patternStrings[] = $constantString->getValue();
  50665. }
  50666. }
  50667. }
  50668. if ($functionName !== 'replaceCallbackArray') {
  50669. continue;
  50670. }
  50671. foreach ($constantArrayType->getKeyTypes() as $arrayKeyType) {
  50672. foreach ($arrayKeyType->getConstantStrings() as $constantString) {
  50673. $patternStrings[] = $constantString->getValue();
  50674. }
  50675. }
  50676. }
  50677. return $patternStrings;
  50678. }
  50679. private function validatePattern(string $pattern): ?string
  50680. {
  50681. try {
  50682. $msg = null;
  50683. $prev = set_error_handler(function (int $severity, string $message, string $file) use (&$msg): bool {
  50684. $msg = preg_replace("#^preg_match(_all)?\\(.*?\\): #", '', $message);
  50685. return true;
  50686. });
  50687. if ($pattern === '') {
  50688. return 'Empty string is not a valid regular expression';
  50689. }
  50690. Preg::match($pattern, '');
  50691. if ($msg !== null) {
  50692. return $msg;
  50693. }
  50694. } catch (PcreException $e) {
  50695. if ($e->getCode() === PREG_INTERNAL_ERROR && $msg !== null) {
  50696. return $msg;
  50697. }
  50698. return preg_replace('{.*? failed executing ".*": }', '', $e->getMessage());
  50699. } finally {
  50700. restore_error_handler();
  50701. }
  50702. return null;
  50703. }
  50704. }
  50705. <?php declare(strict_types=1);
  50706. namespace Composer\Pcre\PHPStan;
  50707. use PHPStan\Analyser\Scope;
  50708. use PHPStan\Type\ArrayType;
  50709. use PHPStan\Type\Constant\ConstantArrayType;
  50710. use PHPStan\Type\Constant\ConstantIntegerType;
  50711. use PHPStan\Type\IntersectionType;
  50712. use PHPStan\Type\TypeCombinator;
  50713. use PHPStan\Type\Type;
  50714. use PhpParser\Node\Arg;
  50715. use PHPStan\Type\Php\RegexArrayShapeMatcher;
  50716. use PHPStan\Type\TypeTraverser;
  50717. use PHPStan\Type\UnionType;
  50718. final class PregMatchFlags
  50719. {
  50720. static public function getType(?Arg $flagsArg, Scope $scope): ?Type
  50721. {
  50722. if ($flagsArg === null) {
  50723. return new ConstantIntegerType(PREG_UNMATCHED_AS_NULL | RegexArrayShapeMatcher::PREG_UNMATCHED_AS_NULL_ON_72_73);
  50724. }
  50725. $flagsType = $scope->getType($flagsArg->value);
  50726. $constantScalars = $flagsType->getConstantScalarValues();
  50727. if ($constantScalars === []) {
  50728. return null;
  50729. }
  50730. $internalFlagsTypes = [];
  50731. foreach ($flagsType->getConstantScalarValues() as $constantScalarValue) {
  50732. if (!is_int($constantScalarValue)) {
  50733. return null;
  50734. }
  50735. $internalFlagsTypes[] = new ConstantIntegerType($constantScalarValue | PREG_UNMATCHED_AS_NULL | RegexArrayShapeMatcher::PREG_UNMATCHED_AS_NULL_ON_72_73);
  50736. }
  50737. return TypeCombinator::union(...$internalFlagsTypes);
  50738. }
  50739. static public function removeNullFromMatches(Type $matchesType): Type
  50740. {
  50741. return TypeTraverser::map($matchesType, static function (Type $type, callable $traverse): Type {
  50742. if ($type instanceof UnionType || $type instanceof IntersectionType) {
  50743. return $traverse($type);
  50744. }
  50745. if ($type instanceof ConstantArrayType) {
  50746. return new ConstantArrayType(
  50747. $type->getKeyTypes(),
  50748. array_map(static function (Type $valueType) use ($traverse): Type {
  50749. return $traverse($valueType);
  50750. }, $type->getValueTypes()),
  50751. $type->getNextAutoIndexes(),
  50752. [],
  50753. $type->isList()
  50754. );
  50755. }
  50756. if ($type instanceof ArrayType) {
  50757. return new ArrayType($type->getKeyType(), $traverse($type->getItemType()));
  50758. }
  50759. return TypeCombinator::removeNull($type);
  50760. });
  50761. }
  50762. }
  50763. <?php declare(strict_types=1);
  50764. namespace Composer\Pcre\PHPStan;
  50765. use Composer\Pcre\Preg;
  50766. use PhpParser\Node\Expr\StaticCall;
  50767. use PHPStan\Analyser\Scope;
  50768. use PHPStan\Reflection\MethodReflection;
  50769. use PHPStan\Reflection\ParameterReflection;
  50770. use PHPStan\TrinaryLogic;
  50771. use PHPStan\Type\Php\RegexArrayShapeMatcher;
  50772. use PHPStan\Type\StaticMethodParameterOutTypeExtension;
  50773. use PHPStan\Type\Type;
  50774. final class PregMatchParameterOutTypeExtension implements StaticMethodParameterOutTypeExtension
  50775. {
  50776. private $regexShapeMatcher;
  50777. public function __construct(
  50778. RegexArrayShapeMatcher $regexShapeMatcher
  50779. )
  50780. {
  50781. $this->regexShapeMatcher = $regexShapeMatcher;
  50782. }
  50783. public function isStaticMethodSupported(MethodReflection $methodReflection, ParameterReflection $parameter): bool
  50784. {
  50785. return
  50786. $methodReflection->getDeclaringClass()->getName() === Preg::class
  50787. && in_array($methodReflection->getName(), [
  50788. 'match', 'isMatch', 'matchStrictGroups', 'isMatchStrictGroups',
  50789. 'matchAll', 'isMatchAll', 'matchAllStrictGroups', 'isMatchAllStrictGroups'
  50790. ], true)
  50791. && $parameter->getName() === 'matches';
  50792. }
  50793. public function getParameterOutTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, ParameterReflection $parameter, Scope $scope): ?Type
  50794. {
  50795. $args = $methodCall->getArgs();
  50796. $patternArg = $args[0] ?? null;
  50797. $matchesArg = $args[2] ?? null;
  50798. $flagsArg = $args[3] ?? null;
  50799. if (
  50800. $patternArg === null || $matchesArg === null
  50801. ) {
  50802. return null;
  50803. }
  50804. $flagsType = PregMatchFlags::getType($flagsArg, $scope);
  50805. if ($flagsType === null) {
  50806. return null;
  50807. }
  50808. if (stripos($methodReflection->getName(), 'matchAll') !== false) {
  50809. return $this->regexShapeMatcher->matchAllExpr($patternArg->value, $flagsType, TrinaryLogic::createMaybe(), $scope);
  50810. }
  50811. return $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createMaybe(), $scope);
  50812. }
  50813. }
  50814. <?php declare(strict_types=1);
  50815. namespace Composer\Pcre\PHPStan;
  50816. use Composer\Pcre\Preg;
  50817. use PhpParser\Node\Expr\StaticCall;
  50818. use PHPStan\Analyser\Scope;
  50819. use PHPStan\Analyser\SpecifiedTypes;
  50820. use PHPStan\Analyser\TypeSpecifier;
  50821. use PHPStan\Analyser\TypeSpecifierAwareExtension;
  50822. use PHPStan\Analyser\TypeSpecifierContext;
  50823. use PHPStan\Reflection\MethodReflection;
  50824. use PHPStan\TrinaryLogic;
  50825. use PHPStan\Type\Constant\ConstantArrayType;
  50826. use PHPStan\Type\Php\RegexArrayShapeMatcher;
  50827. use PHPStan\Type\StaticMethodTypeSpecifyingExtension;
  50828. use PHPStan\Type\TypeCombinator;
  50829. use PHPStan\Type\Type;
  50830. final class PregMatchTypeSpecifyingExtension implements StaticMethodTypeSpecifyingExtension, TypeSpecifierAwareExtension
  50831. {
  50832. private $typeSpecifier;
  50833. private $regexShapeMatcher;
  50834. public function __construct(RegexArrayShapeMatcher $regexShapeMatcher)
  50835. {
  50836. $this->regexShapeMatcher = $regexShapeMatcher;
  50837. }
  50838. public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
  50839. {
  50840. $this->typeSpecifier = $typeSpecifier;
  50841. }
  50842. public function getClass(): string
  50843. {
  50844. return Preg::class;
  50845. }
  50846. public function isStaticMethodSupported(MethodReflection $methodReflection, StaticCall $node, TypeSpecifierContext $context): bool
  50847. {
  50848. return in_array($methodReflection->getName(), [
  50849. 'match', 'isMatch', 'matchStrictGroups', 'isMatchStrictGroups',
  50850. 'matchAll', 'isMatchAll', 'matchAllStrictGroups', 'isMatchAllStrictGroups'
  50851. ], true)
  50852. && !$context->null();
  50853. }
  50854. public function specifyTypes(MethodReflection $methodReflection, StaticCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
  50855. {
  50856. $args = $node->getArgs();
  50857. $patternArg = $args[0] ?? null;
  50858. $matchesArg = $args[2] ?? null;
  50859. $flagsArg = $args[3] ?? null;
  50860. if (
  50861. $patternArg === null || $matchesArg === null
  50862. ) {
  50863. return new SpecifiedTypes();
  50864. }
  50865. $flagsType = PregMatchFlags::getType($flagsArg, $scope);
  50866. if ($flagsType === null) {
  50867. return new SpecifiedTypes();
  50868. }
  50869. if (stripos($methodReflection->getName(), 'matchAll') !== false) {
  50870. $matchedType = $this->regexShapeMatcher->matchAllExpr($patternArg->value, $flagsType, TrinaryLogic::createFromBoolean($context->true()), $scope);
  50871. } else {
  50872. $matchedType = $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createFromBoolean($context->true()), $scope);
  50873. }
  50874. if ($matchedType === null) {
  50875. return new SpecifiedTypes();
  50876. }
  50877. if (
  50878. in_array($methodReflection->getName(), ['matchStrictGroups', 'isMatchStrictGroups', 'matchAllStrictGroups', 'isMatchAllStrictGroups'], true)
  50879. ) {
  50880. $matchedType = PregMatchFlags::removeNullFromMatches($matchedType);
  50881. }
  50882. $overwrite = false;
  50883. if ($context->false()) {
  50884. $overwrite = true;
  50885. $context = $context->negate();
  50886. }
  50887. if (method_exists('PHPStan\Analyser\SpecifiedTypes', 'setRootExpr')) {
  50888. $typeSpecifier = $this->typeSpecifier->create(
  50889. $matchesArg->value,
  50890. $matchedType,
  50891. $context,
  50892. $scope
  50893. )->setRootExpr($node);
  50894. return $overwrite ? $typeSpecifier->setAlwaysOverwriteTypes() : $typeSpecifier;
  50895. }
  50896. return $this->typeSpecifier->create(
  50897. $matchesArg->value,
  50898. $matchedType,
  50899. $context,
  50900. $overwrite,
  50901. $scope,
  50902. $node
  50903. );
  50904. }
  50905. }
  50906. <?php declare(strict_types=1);
  50907. namespace Composer\Pcre\PHPStan;
  50908. use Composer\Pcre\Preg;
  50909. use Composer\Pcre\Regex;
  50910. use PhpParser\Node\Expr\StaticCall;
  50911. use PHPStan\Analyser\Scope;
  50912. use PHPStan\Reflection\MethodReflection;
  50913. use PHPStan\Reflection\Native\NativeParameterReflection;
  50914. use PHPStan\Reflection\ParameterReflection;
  50915. use PHPStan\TrinaryLogic;
  50916. use PHPStan\Type\ClosureType;
  50917. use PHPStan\Type\Php\RegexArrayShapeMatcher;
  50918. use PHPStan\Type\StaticMethodParameterClosureTypeExtension;
  50919. use PHPStan\Type\StringType;
  50920. use PHPStan\Type\Type;
  50921. final class PregReplaceCallbackClosureTypeExtension implements StaticMethodParameterClosureTypeExtension
  50922. {
  50923. private $regexShapeMatcher;
  50924. public function __construct(RegexArrayShapeMatcher $regexShapeMatcher)
  50925. {
  50926. $this->regexShapeMatcher = $regexShapeMatcher;
  50927. }
  50928. public function isStaticMethodSupported(MethodReflection $methodReflection, ParameterReflection $parameter): bool
  50929. {
  50930. return in_array($methodReflection->getDeclaringClass()->getName(), [Preg::class, Regex::class], true)
  50931. && in_array($methodReflection->getName(), ['replaceCallback'], true)
  50932. && $parameter->getName() === 'replacement';
  50933. }
  50934. public function getTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, ParameterReflection $parameter, Scope $scope): ?Type
  50935. {
  50936. $args = $methodCall->getArgs();
  50937. $patternArg = $args[0] ?? null;
  50938. $flagsArg = $args[5] ?? null;
  50939. if (
  50940. $patternArg === null
  50941. ) {
  50942. return null;
  50943. }
  50944. $flagsType = null;
  50945. if ($flagsArg !== null) {
  50946. $flagsType = $scope->getType($flagsArg->value);
  50947. }
  50948. $matchesType = $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createYes(), $scope);
  50949. if ($matchesType === null) {
  50950. return null;
  50951. }
  50952. return new ClosureType(
  50953. [
  50954. new NativeParameterReflection($parameter->getName(), $parameter->isOptional(), $matchesType, $parameter->passedByReference(), $parameter->isVariadic(), $parameter->getDefaultValue()),
  50955. ],
  50956. new StringType()
  50957. );
  50958. }
  50959. }
  50960. <?php declare(strict_types=1);
  50961. namespace Composer\Pcre\PHPStan;
  50962. use Composer\Pcre\Preg;
  50963. use Composer\Pcre\Regex;
  50964. use PhpParser\Node;
  50965. use PhpParser\Node\Expr\StaticCall;
  50966. use PhpParser\Node\Name\FullyQualified;
  50967. use PHPStan\Analyser\Scope;
  50968. use PHPStan\Analyser\SpecifiedTypes;
  50969. use PHPStan\Rules\Rule;
  50970. use PHPStan\Rules\RuleErrorBuilder;
  50971. use PHPStan\TrinaryLogic;
  50972. use PHPStan\Type\ObjectType;
  50973. use PHPStan\Type\Type;
  50974. use PHPStan\Type\TypeCombinator;
  50975. use PHPStan\Type\Php\RegexArrayShapeMatcher;
  50976. use function sprintf;
  50977. final class UnsafeStrictGroupsCallRule implements Rule
  50978. {
  50979. private $regexShapeMatcher;
  50980. public function __construct(RegexArrayShapeMatcher $regexShapeMatcher)
  50981. {
  50982. $this->regexShapeMatcher = $regexShapeMatcher;
  50983. }
  50984. public function getNodeType(): string
  50985. {
  50986. return StaticCall::class;
  50987. }
  50988. public function processNode(Node $node, Scope $scope): array
  50989. {
  50990. if (!$node->class instanceof FullyQualified) {
  50991. return [];
  50992. }
  50993. $isRegex = $node->class->toString() === Regex::class;
  50994. $isPreg = $node->class->toString() === Preg::class;
  50995. if (!$isRegex && !$isPreg) {
  50996. return [];
  50997. }
  50998. if (!$node->name instanceof Node\Identifier || !in_array($node->name->name, ['matchStrictGroups', 'isMatchStrictGroups', 'matchAllStrictGroups', 'isMatchAllStrictGroups'], true)) {
  50999. return [];
  51000. }
  51001. $args = $node->getArgs();
  51002. if (!isset($args[0])) {
  51003. return [];
  51004. }
  51005. $patternArg = $args[0] ?? null;
  51006. if ($isPreg) {
  51007. if (!isset($args[2])) {
  51008. return [];
  51009. }
  51010. $flagsArg = $args[3] ?? null;
  51011. } else {
  51012. $flagsArg = $args[2] ?? null;
  51013. }
  51014. if ($patternArg === null) {
  51015. return [];
  51016. }
  51017. $flagsType = PregMatchFlags::getType($flagsArg, $scope);
  51018. if ($flagsType === null) {
  51019. return [];
  51020. }
  51021. $matchedType = $this->regexShapeMatcher->matchExpr($patternArg->value, $flagsType, TrinaryLogic::createYes(), $scope);
  51022. if ($matchedType === null) {
  51023. return [
  51024. RuleErrorBuilder::message(sprintf('The %s call is potentially unsafe as $matches\' type could not be inferred.', $node->name->name))
  51025. ->identifier('composerPcre.maybeUnsafeStrictGroups')
  51026. ->build(),
  51027. ];
  51028. }
  51029. if (count($matchedType->getConstantArrays()) === 1) {
  51030. $matchedType = $matchedType->getConstantArrays()[0];
  51031. $nullableGroups = [];
  51032. foreach ($matchedType->getValueTypes() as $index => $type) {
  51033. if (TypeCombinator::containsNull($type)) {
  51034. $nullableGroups[] = $matchedType->getKeyTypes()[$index]->getValue();
  51035. }
  51036. }
  51037. if (\count($nullableGroups) > 0) {
  51038. return [
  51039. RuleErrorBuilder::message(sprintf(
  51040. 'The %s call is unsafe as match group%s "%s" %s optional and may be null.',
  51041. $node->name->name,
  51042. \count($nullableGroups) > 1 ? 's' : '',
  51043. implode('", "', $nullableGroups),
  51044. \count($nullableGroups) > 1 ? 'are' : 'is'
  51045. ))->identifier('composerPcre.unsafeStrictGroups')->build(),
  51046. ];
  51047. }
  51048. }
  51049. return [];
  51050. }
  51051. }
  51052. <?php
  51053. namespace Composer\Pcre;
  51054. class PcreException extends \RuntimeException
  51055. {
  51056. public static function fromFunction($function, $pattern)
  51057. {
  51058. $code = preg_last_error();
  51059. if (is_array($pattern)) {
  51060. $pattern = implode(', ', $pattern);
  51061. }
  51062. return new PcreException($function.'(): failed executing "'.$pattern.'": '.self::pcreLastErrorMessage($code), $code);
  51063. }
  51064. private static function pcreLastErrorMessage($code)
  51065. {
  51066. if (function_exists('preg_last_error_msg')) {
  51067. return preg_last_error_msg();
  51068. }
  51069. if (PHP_VERSION_ID < 70201 && $code === 0) {
  51070. return 'UNDEFINED_ERROR';
  51071. }
  51072. $constants = get_defined_constants(true);
  51073. if (!isset($constants['pcre']) || !is_array($constants['pcre'])) {
  51074. return 'UNDEFINED_ERROR';
  51075. }
  51076. foreach ($constants['pcre'] as $const => $val) {
  51077. if ($val === $code && substr($const, -6) === '_ERROR') {
  51078. return $const;
  51079. }
  51080. }
  51081. return 'UNDEFINED_ERROR';
  51082. }
  51083. }
  51084. <?php
  51085. namespace Composer\Pcre;
  51086. class Preg
  51087. {
  51088. public const ARRAY_MSG = '$subject as an array is not supported. You can use \'foreach\' instead.';
  51089. public const INVALID_TYPE_MSG = '$subject must be a string, %s given.';
  51090. public static function match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  51091. {
  51092. self::checkOffsetCapture($flags, 'matchWithOffsets');
  51093. $result = self::pregMatch($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
  51094. if ($result === false) {
  51095. throw PcreException::fromFunction('preg_match', $pattern);
  51096. }
  51097. return $result;
  51098. }
  51099. public static function matchStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  51100. {
  51101. $result = self::match($pattern, $subject, $matchesInternal, $flags, $offset);
  51102. $matches = self::enforceNonNullMatches($pattern, $matchesInternal, 'match');
  51103. return $result;
  51104. }
  51105. public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
  51106. {
  51107. $result = self::pregMatch($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
  51108. if ($result === false) {
  51109. throw PcreException::fromFunction('preg_match', $pattern);
  51110. }
  51111. return $result;
  51112. }
  51113. public static function matchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  51114. {
  51115. self::checkOffsetCapture($flags, 'matchAllWithOffsets');
  51116. self::checkSetOrder($flags);
  51117. $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
  51118. if (!is_int($result)) {
  51119. throw PcreException::fromFunction('preg_match_all', $pattern);
  51120. }
  51121. return $result;
  51122. }
  51123. public static function matchAllStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
  51124. {
  51125. $result = self::matchAll($pattern, $subject, $matchesInternal, $flags, $offset);
  51126. $matches = self::enforceNonNullMatchAll($pattern, $matchesInternal, 'matchAll');
  51127. return $result;
  51128. }
  51129. public static function matchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
  51130. {
  51131. self::checkSetOrder($flags);
  51132. $result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
  51133. if (!is_int($result)) {
  51134. throw PcreException::fromFunction('preg_match_all', $pattern);
  51135. }
  51136. return $result;
  51137. }
  51138. public static function replace($pattern, $replacement, $subject, int $limit = -1, ?int &$count = null): string
  51139. {
  51140. if (!is_scalar($subject)) {
  51141. if (is_array($subject)) {
  51142. throw new \InvalidArgumentException(static::ARRAY_MSG);
  51143. }
  51144. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  51145. }
  51146. $result = preg_replace($pattern, $replacement, $subject, $limit, $count);
  51147. if ($result === null) {
  51148. throw PcreException::fromFunction('preg_replace', $pattern);
  51149. }
  51150. return $result;
  51151. }
  51152. public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, ?int &$count = null, int $flags = 0): string
  51153. {
  51154. if (!is_scalar($subject)) {
  51155. if (is_array($subject)) {
  51156. throw new \InvalidArgumentException(static::ARRAY_MSG);
  51157. }
  51158. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  51159. }
  51160. if (PHP_VERSION_ID >= 70400) {
  51161. $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count, $flags);
  51162. } else {
  51163. $result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count);
  51164. }
  51165. if ($result === null) {
  51166. throw PcreException::fromFunction('preg_replace_callback', $pattern);
  51167. }
  51168. return $result;
  51169. }
  51170. public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, ?int &$count = null, int $flags = 0): string
  51171. {
  51172. if (!is_scalar($subject)) {
  51173. if (is_array($subject)) {
  51174. throw new \InvalidArgumentException(static::ARRAY_MSG);
  51175. }
  51176. throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
  51177. }
  51178. if (PHP_VERSION_ID >= 70400) {
  51179. $result = preg_replace_callback_array($pattern, $subject, $limit, $count, $flags);
  51180. } else {
  51181. $result = preg_replace_callback_array($pattern, $subject, $limit, $count);
  51182. }
  51183. if ($result === null) {
  51184. $pattern = array_keys($pattern);
  51185. throw PcreException::fromFunction('preg_replace_callback_array', $pattern);
  51186. }
  51187. return $result;
  51188. }
  51189. public static function split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
  51190. {
  51191. if (($flags & PREG_SPLIT_OFFSET_CAPTURE) !== 0) {
  51192. throw new \InvalidArgumentException('PREG_SPLIT_OFFSET_CAPTURE is not supported as it changes the type of $matches, use splitWithOffsets() instead');
  51193. }
  51194. $result = preg_split($pattern, $subject, $limit, $flags);
  51195. if ($result === false) {
  51196. throw PcreException::fromFunction('preg_split', $pattern);
  51197. }
  51198. return $result;
  51199. }
  51200. public static function splitWithOffsets(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
  51201. {
  51202. $result = preg_split($pattern, $subject, $limit, $flags | PREG_SPLIT_OFFSET_CAPTURE);
  51203. if ($result === false) {
  51204. throw PcreException::fromFunction('preg_split', $pattern);
  51205. }
  51206. return $result;
  51207. }
  51208. public static function grep(string $pattern, array $array, int $flags = 0): array
  51209. {
  51210. $result = preg_grep($pattern, $array, $flags);
  51211. if ($result === false) {
  51212. throw PcreException::fromFunction('preg_grep', $pattern);
  51213. }
  51214. return $result;
  51215. }
  51216. public static function isMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  51217. {
  51218. return (bool) static::match($pattern, $subject, $matches, $flags, $offset);
  51219. }
  51220. public static function isMatchStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  51221. {
  51222. return (bool) self::matchStrictGroups($pattern, $subject, $matches, $flags, $offset);
  51223. }
  51224. public static function isMatchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  51225. {
  51226. return (bool) static::matchAll($pattern, $subject, $matches, $flags, $offset);
  51227. }
  51228. public static function isMatchAllStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
  51229. {
  51230. return (bool) self::matchAllStrictGroups($pattern, $subject, $matches, $flags, $offset);
  51231. }
  51232. public static function isMatchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
  51233. {
  51234. return (bool) static::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
  51235. }
  51236. public static function isMatchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
  51237. {
  51238. return (bool) static::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
  51239. }
  51240. private static function checkOffsetCapture(int $flags, string $useFunctionName): void
  51241. {
  51242. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  51243. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use ' . $useFunctionName . '() instead');
  51244. }
  51245. }
  51246. private static function checkSetOrder(int $flags): void
  51247. {
  51248. if (($flags & PREG_SET_ORDER) !== 0) {
  51249. throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the type of $matches');
  51250. }
  51251. }
  51252. private static function enforceNonNullMatches(string $pattern, array $matches, string $variantMethod)
  51253. {
  51254. foreach ($matches as $group => $match) {
  51255. if (null === $match) {
  51256. throw new UnexpectedNullMatchException('Pattern "'.$pattern.'" had an unexpected unmatched group "'.$group.'", make sure the pattern always matches or use '.$variantMethod.'() instead.');
  51257. }
  51258. }
  51259. return $matches;
  51260. }
  51261. private static function enforceNonNullMatchAll(string $pattern, array $matches, string $variantMethod)
  51262. {
  51263. foreach ($matches as $group => $groupMatches) {
  51264. foreach ($groupMatches as $match) {
  51265. if (null === $match) {
  51266. throw new UnexpectedNullMatchException('Pattern "'.$pattern.'" had an unexpected unmatched group "'.$group.'", make sure the pattern always matches or use '.$variantMethod.'() instead.');
  51267. }
  51268. }
  51269. }
  51270. return $matches;
  51271. }
  51272. private static function pregMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0)
  51273. {
  51274. if (PHP_VERSION_ID >= 70400) {
  51275. return preg_match($pattern, $subject, $matches, $flags, $offset);
  51276. }
  51277. $result = preg_match_all($pattern, $subject, $matchesInternal, $flags, $offset);
  51278. if (!is_int($result)) {
  51279. throw PcreException::fromFunction('preg_match', $pattern);
  51280. }
  51281. if ($result === 0) {
  51282. $matches = [];
  51283. } else {
  51284. $matches = array_map(function (array $m) {
  51285. $first = reset($m);
  51286. assert($first !== false);
  51287. return $first;
  51288. }, $matchesInternal);
  51289. $result = min($result, 1);
  51290. }
  51291. return $result;
  51292. }
  51293. }
  51294. <?php
  51295. namespace Composer\Pcre;
  51296. class Regex
  51297. {
  51298. public static function isMatch(string $pattern, string $subject, int $offset = 0): bool
  51299. {
  51300. return (bool) Preg::match($pattern, $subject, $matches, 0, $offset);
  51301. }
  51302. public static function match(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchResult
  51303. {
  51304. self::checkOffsetCapture($flags, 'matchWithOffsets');
  51305. $count = Preg::match($pattern, $subject, $matches, $flags, $offset);
  51306. return new MatchResult($count, $matches);
  51307. }
  51308. public static function matchStrictGroups(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchStrictGroupsResult
  51309. {
  51310. $count = Preg::matchStrictGroups($pattern, $subject, $matches, $flags, $offset);
  51311. return new MatchStrictGroupsResult($count, $matches);
  51312. }
  51313. public static function matchWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchWithOffsetsResult
  51314. {
  51315. $count = Preg::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
  51316. return new MatchWithOffsetsResult($count, $matches);
  51317. }
  51318. public static function matchAll(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllResult
  51319. {
  51320. self::checkOffsetCapture($flags, 'matchAllWithOffsets');
  51321. self::checkSetOrder($flags);
  51322. $count = Preg::matchAll($pattern, $subject, $matches, $flags, $offset);
  51323. return new MatchAllResult($count, $matches);
  51324. }
  51325. public static function matchAllStrictGroups(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllStrictGroupsResult
  51326. {
  51327. self::checkOffsetCapture($flags, 'matchAllWithOffsets');
  51328. self::checkSetOrder($flags);
  51329. $count = Preg::matchAllStrictGroups($pattern, $subject, $matches, $flags, $offset);
  51330. return new MatchAllStrictGroupsResult($count, $matches);
  51331. }
  51332. public static function matchAllWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllWithOffsetsResult
  51333. {
  51334. self::checkSetOrder($flags);
  51335. $count = Preg::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
  51336. return new MatchAllWithOffsetsResult($count, $matches);
  51337. }
  51338. public static function replace($pattern, $replacement, $subject, int $limit = -1): ReplaceResult
  51339. {
  51340. $result = Preg::replace($pattern, $replacement, $subject, $limit, $count);
  51341. return new ReplaceResult($count, $result);
  51342. }
  51343. public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0): ReplaceResult
  51344. {
  51345. $result = Preg::replaceCallback($pattern, $replacement, $subject, $limit, $count, $flags);
  51346. return new ReplaceResult($count, $result);
  51347. }
  51348. public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int $flags = 0): ReplaceResult
  51349. {
  51350. $result = Preg::replaceCallbackArray($pattern, $subject, $limit, $count, $flags);
  51351. return new ReplaceResult($count, $result);
  51352. }
  51353. private static function checkOffsetCapture(int $flags, string $useFunctionName): void
  51354. {
  51355. if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
  51356. throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use '.$useFunctionName.'() instead');
  51357. }
  51358. }
  51359. private static function checkSetOrder(int $flags): void
  51360. {
  51361. if (($flags & PREG_SET_ORDER) !== 0) {
  51362. throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the return type');
  51363. }
  51364. }
  51365. }
  51366. <?php
  51367. namespace Composer\Pcre;
  51368. final class ReplaceResult
  51369. {
  51370. public $result;
  51371. public $count;
  51372. public $matched;
  51373. public function __construct(int $count, string $result)
  51374. {
  51375. $this->count = $count;
  51376. $this->matched = (bool) $count;
  51377. $this->result = $result;
  51378. }
  51379. }
  51380. <?php
  51381. namespace Composer\Pcre;
  51382. class UnexpectedNullMatchException extends PcreException
  51383. {
  51384. public static function fromFunction($function, $pattern)
  51385. {
  51386. throw new \LogicException('fromFunction should not be called on '.self::class.', use '.PcreException::class);
  51387. }
  51388. }
  51389. Copyright (C) 2015 Composer
  51390. Permission is hereby granted, free of charge, to any person obtaining a copy of
  51391. this software and associated documentation files (the "Software"), to deal in
  51392. the Software without restriction, including without limitation the rights to
  51393. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  51394. of the Software, and to permit persons to whom the Software is furnished to do
  51395. so, subject to the following conditions:
  51396. The above copyright notice and this permission notice shall be included in all
  51397. copies or substantial portions of the Software.
  51398. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51399. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51400. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51401. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51402. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51403. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51404. SOFTWARE.
  51405. <?php
  51406. namespace Composer\Semver;
  51407. use Composer\Semver\Constraint\Constraint;
  51408. class Comparator
  51409. {
  51410. public static function greaterThan($version1, $version2)
  51411. {
  51412. return self::compare($version1, '>', $version2);
  51413. }
  51414. public static function greaterThanOrEqualTo($version1, $version2)
  51415. {
  51416. return self::compare($version1, '>=', $version2);
  51417. }
  51418. public static function lessThan($version1, $version2)
  51419. {
  51420. return self::compare($version1, '<', $version2);
  51421. }
  51422. public static function lessThanOrEqualTo($version1, $version2)
  51423. {
  51424. return self::compare($version1, '<=', $version2);
  51425. }
  51426. public static function equalTo($version1, $version2)
  51427. {
  51428. return self::compare($version1, '==', $version2);
  51429. }
  51430. public static function notEqualTo($version1, $version2)
  51431. {
  51432. return self::compare($version1, '!=', $version2);
  51433. }
  51434. public static function compare($version1, $operator, $version2)
  51435. {
  51436. $constraint = new Constraint($operator, $version2);
  51437. return $constraint->matchSpecific(new Constraint('==', $version1), true);
  51438. }
  51439. }
  51440. <?php
  51441. namespace Composer\Semver;
  51442. use Composer\Semver\Constraint\Constraint;
  51443. use Composer\Semver\Constraint\ConstraintInterface;
  51444. class CompilingMatcher
  51445. {
  51446. private static $compiledCheckerCache = array();
  51447. private static $resultCache = array();
  51448. private static $enabled;
  51449. private static $transOpInt = array(
  51450. Constraint::OP_EQ => Constraint::STR_OP_EQ,
  51451. Constraint::OP_LT => Constraint::STR_OP_LT,
  51452. Constraint::OP_LE => Constraint::STR_OP_LE,
  51453. Constraint::OP_GT => Constraint::STR_OP_GT,
  51454. Constraint::OP_GE => Constraint::STR_OP_GE,
  51455. Constraint::OP_NE => Constraint::STR_OP_NE,
  51456. );
  51457. public static function clear()
  51458. {
  51459. self::$resultCache = array();
  51460. self::$compiledCheckerCache = array();
  51461. }
  51462. public static function match(ConstraintInterface $constraint, $operator, $version)
  51463. {
  51464. $resultCacheKey = $operator.$constraint.';'.$version;
  51465. if (isset(self::$resultCache[$resultCacheKey])) {
  51466. return self::$resultCache[$resultCacheKey];
  51467. }
  51468. if (self::$enabled === null) {
  51469. self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true);
  51470. }
  51471. if (!self::$enabled) {
  51472. return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version));
  51473. }
  51474. $cacheKey = $operator.$constraint;
  51475. if (!isset(self::$compiledCheckerCache[$cacheKey])) {
  51476. $code = $constraint->compile($operator);
  51477. self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return '.$code.';};');
  51478. } else {
  51479. $function = self::$compiledCheckerCache[$cacheKey];
  51480. }
  51481. return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0);
  51482. }
  51483. }
  51484. <?php
  51485. namespace Composer\Semver\Constraint;
  51486. class Bound
  51487. {
  51488. private $version;
  51489. private $isInclusive;
  51490. public function __construct($version, $isInclusive)
  51491. {
  51492. $this->version = $version;
  51493. $this->isInclusive = $isInclusive;
  51494. }
  51495. public function getVersion()
  51496. {
  51497. return $this->version;
  51498. }
  51499. public function isInclusive()
  51500. {
  51501. return $this->isInclusive;
  51502. }
  51503. public function isZero()
  51504. {
  51505. return $this->getVersion() === '0.0.0.0-dev' && $this->isInclusive();
  51506. }
  51507. public function isPositiveInfinity()
  51508. {
  51509. return $this->getVersion() === PHP_INT_MAX.'.0.0.0' && !$this->isInclusive();
  51510. }
  51511. public function compareTo(Bound $other, $operator)
  51512. {
  51513. if (!\in_array($operator, array('<', '>'), true)) {
  51514. throw new \InvalidArgumentException('Does not support any other operator other than > or <.');
  51515. }
  51516. if ($this == $other) {
  51517. return false;
  51518. }
  51519. $compareResult = version_compare($this->getVersion(), $other->getVersion());
  51520. if (0 !== $compareResult) {
  51521. return (('>' === $operator) ? 1 : -1) === $compareResult;
  51522. }
  51523. return '>' === $operator ? $other->isInclusive() : !$other->isInclusive();
  51524. }
  51525. public function __toString()
  51526. {
  51527. return sprintf(
  51528. '%s [%s]',
  51529. $this->getVersion(),
  51530. $this->isInclusive() ? 'inclusive' : 'exclusive'
  51531. );
  51532. }
  51533. public static function zero()
  51534. {
  51535. return new Bound('0.0.0.0-dev', true);
  51536. }
  51537. public static function positiveInfinity()
  51538. {
  51539. return new Bound(PHP_INT_MAX.'.0.0.0', false);
  51540. }
  51541. }
  51542. <?php
  51543. namespace Composer\Semver\Constraint;
  51544. class Constraint implements ConstraintInterface
  51545. {
  51546. const OP_EQ = 0;
  51547. const OP_LT = 1;
  51548. const OP_LE = 2;
  51549. const OP_GT = 3;
  51550. const OP_GE = 4;
  51551. const OP_NE = 5;
  51552. const STR_OP_EQ = '==';
  51553. const STR_OP_EQ_ALT = '=';
  51554. const STR_OP_LT = '<';
  51555. const STR_OP_LE = '<=';
  51556. const STR_OP_GT = '>';
  51557. const STR_OP_GE = '>=';
  51558. const STR_OP_NE = '!=';
  51559. const STR_OP_NE_ALT = '<>';
  51560. private static $transOpStr = array(
  51561. '=' => self::OP_EQ,
  51562. '==' => self::OP_EQ,
  51563. '<' => self::OP_LT,
  51564. '<=' => self::OP_LE,
  51565. '>' => self::OP_GT,
  51566. '>=' => self::OP_GE,
  51567. '<>' => self::OP_NE,
  51568. '!=' => self::OP_NE,
  51569. );
  51570. private static $transOpInt = array(
  51571. self::OP_EQ => '==',
  51572. self::OP_LT => '<',
  51573. self::OP_LE => '<=',
  51574. self::OP_GT => '>',
  51575. self::OP_GE => '>=',
  51576. self::OP_NE => '!=',
  51577. );
  51578. protected $operator;
  51579. protected $version;
  51580. protected $prettyString;
  51581. protected $lowerBound;
  51582. protected $upperBound;
  51583. public function __construct($operator, $version)
  51584. {
  51585. if (!isset(self::$transOpStr[$operator])) {
  51586. throw new \InvalidArgumentException(sprintf(
  51587. 'Invalid operator "%s" given, expected one of: %s',
  51588. $operator,
  51589. implode(', ', self::getSupportedOperators())
  51590. ));
  51591. }
  51592. $this->operator = self::$transOpStr[$operator];
  51593. $this->version = $version;
  51594. }
  51595. public function getVersion()
  51596. {
  51597. return $this->version;
  51598. }
  51599. public function getOperator()
  51600. {
  51601. return self::$transOpInt[$this->operator];
  51602. }
  51603. public function matches(ConstraintInterface $provider)
  51604. {
  51605. if ($provider instanceof self) {
  51606. return $this->matchSpecific($provider);
  51607. }
  51608. return $provider->matches($this);
  51609. }
  51610. public function setPrettyString($prettyString)
  51611. {
  51612. $this->prettyString = $prettyString;
  51613. }
  51614. public function getPrettyString()
  51615. {
  51616. if ($this->prettyString) {
  51617. return $this->prettyString;
  51618. }
  51619. return $this->__toString();
  51620. }
  51621. public static function getSupportedOperators()
  51622. {
  51623. return array_keys(self::$transOpStr);
  51624. }
  51625. public static function getOperatorConstant($operator)
  51626. {
  51627. return self::$transOpStr[$operator];
  51628. }
  51629. public function versionCompare($a, $b, $operator, $compareBranches = false)
  51630. {
  51631. if (!isset(self::$transOpStr[$operator])) {
  51632. throw new \InvalidArgumentException(sprintf(
  51633. 'Invalid operator "%s" given, expected one of: %s',
  51634. $operator,
  51635. implode(', ', self::getSupportedOperators())
  51636. ));
  51637. }
  51638. $aIsBranch = strpos($a, 'dev-') === 0;
  51639. $bIsBranch = strpos($b, 'dev-') === 0;
  51640. if ($operator === '!=' && ($aIsBranch || $bIsBranch)) {
  51641. return $a !== $b;
  51642. }
  51643. if ($aIsBranch && $bIsBranch) {
  51644. return $operator === '==' && $a === $b;
  51645. }
  51646. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  51647. return false;
  51648. }
  51649. return \version_compare($a, $b, $operator);
  51650. }
  51651. public function compile($otherOperator)
  51652. {
  51653. if (strpos($this->version, 'dev-') === 0) {
  51654. if (self::OP_EQ === $this->operator) {
  51655. if (self::OP_EQ === $otherOperator) {
  51656. return sprintf('$b && $v === %s', \var_export($this->version, true));
  51657. }
  51658. if (self::OP_NE === $otherOperator) {
  51659. return sprintf('!$b || $v !== %s', \var_export($this->version, true));
  51660. }
  51661. return 'false';
  51662. }
  51663. if (self::OP_NE === $this->operator) {
  51664. if (self::OP_EQ === $otherOperator) {
  51665. return sprintf('!$b || $v !== %s', \var_export($this->version, true));
  51666. }
  51667. if (self::OP_NE === $otherOperator) {
  51668. return 'true';
  51669. }
  51670. return '!$b';
  51671. }
  51672. return 'false';
  51673. }
  51674. if (self::OP_EQ === $this->operator) {
  51675. if (self::OP_EQ === $otherOperator) {
  51676. return sprintf('\version_compare($v, %s, \'==\')', \var_export($this->version, true));
  51677. }
  51678. if (self::OP_NE === $otherOperator) {
  51679. return sprintf('$b || \version_compare($v, %s, \'!=\')', \var_export($this->version, true));
  51680. }
  51681. return sprintf('!$b && \version_compare(%s, $v, \'%s\')', \var_export($this->version, true), self::$transOpInt[$otherOperator]);
  51682. }
  51683. if (self::OP_NE === $this->operator) {
  51684. if (self::OP_EQ === $otherOperator) {
  51685. return sprintf('$b || (!$b && \version_compare($v, %s, \'!=\'))', \var_export($this->version, true));
  51686. }
  51687. if (self::OP_NE === $otherOperator) {
  51688. return 'true';
  51689. }
  51690. return '!$b';
  51691. }
  51692. if (self::OP_LT === $this->operator || self::OP_LE === $this->operator) {
  51693. if (self::OP_LT === $otherOperator || self::OP_LE === $otherOperator) {
  51694. return '!$b';
  51695. }
  51696. } else {
  51697. if (self::OP_GT === $otherOperator || self::OP_GE === $otherOperator) {
  51698. return '!$b';
  51699. }
  51700. }
  51701. if (self::OP_NE === $otherOperator) {
  51702. return 'true';
  51703. }
  51704. $codeComparison = sprintf('\version_compare($v, %s, \'%s\')', \var_export($this->version, true), self::$transOpInt[$this->operator]);
  51705. if ($this->operator === self::OP_LE) {
  51706. if ($otherOperator === self::OP_GT) {
  51707. return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
  51708. }
  51709. } elseif ($this->operator === self::OP_GE) {
  51710. if ($otherOperator === self::OP_LT) {
  51711. return sprintf('!$b && \version_compare($v, %s, \'!=\') && ', \var_export($this->version, true)) . $codeComparison;
  51712. }
  51713. }
  51714. return sprintf('!$b && %s', $codeComparison);
  51715. }
  51716. public function matchSpecific(Constraint $provider, $compareBranches = false)
  51717. {
  51718. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  51719. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  51720. $isEqualOp = self::OP_EQ === $this->operator;
  51721. $isNonEqualOp = self::OP_NE === $this->operator;
  51722. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  51723. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  51724. if ($isNonEqualOp || $isProviderNonEqualOp) {
  51725. if ($isNonEqualOp && !$isProviderNonEqualOp && !$isProviderEqualOp && strpos($provider->version, 'dev-') === 0) {
  51726. return false;
  51727. }
  51728. if ($isProviderNonEqualOp && !$isNonEqualOp && !$isEqualOp && strpos($this->version, 'dev-') === 0) {
  51729. return false;
  51730. }
  51731. if (!$isEqualOp && !$isProviderEqualOp) {
  51732. return true;
  51733. }
  51734. return $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  51735. }
  51736. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  51737. return !(strpos($this->version, 'dev-') === 0 || strpos($provider->version, 'dev-') === 0);
  51738. }
  51739. $version1 = $isEqualOp ? $this->version : $provider->version;
  51740. $version2 = $isEqualOp ? $provider->version : $this->version;
  51741. $operator = $isEqualOp ? $provider->operator : $this->operator;
  51742. if ($this->versionCompare($version1, $version2, self::$transOpInt[$operator], $compareBranches)) {
  51743. return !(self::$transOpInt[$provider->operator] === $providerNoEqualOp
  51744. && self::$transOpInt[$this->operator] !== $noEqualOp
  51745. && \version_compare($provider->version, $this->version, '=='));
  51746. }
  51747. return false;
  51748. }
  51749. public function __toString()
  51750. {
  51751. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  51752. }
  51753. public function getLowerBound()
  51754. {
  51755. $this->extractBounds();
  51756. return $this->lowerBound;
  51757. }
  51758. public function getUpperBound()
  51759. {
  51760. $this->extractBounds();
  51761. return $this->upperBound;
  51762. }
  51763. private function extractBounds()
  51764. {
  51765. if (null !== $this->lowerBound) {
  51766. return;
  51767. }
  51768. if (strpos($this->version, 'dev-') === 0) {
  51769. $this->lowerBound = Bound::zero();
  51770. $this->upperBound = Bound::positiveInfinity();
  51771. return;
  51772. }
  51773. switch ($this->operator) {
  51774. case self::OP_EQ:
  51775. $this->lowerBound = new Bound($this->version, true);
  51776. $this->upperBound = new Bound($this->version, true);
  51777. break;
  51778. case self::OP_LT:
  51779. $this->lowerBound = Bound::zero();
  51780. $this->upperBound = new Bound($this->version, false);
  51781. break;
  51782. case self::OP_LE:
  51783. $this->lowerBound = Bound::zero();
  51784. $this->upperBound = new Bound($this->version, true);
  51785. break;
  51786. case self::OP_GT:
  51787. $this->lowerBound = new Bound($this->version, false);
  51788. $this->upperBound = Bound::positiveInfinity();
  51789. break;
  51790. case self::OP_GE:
  51791. $this->lowerBound = new Bound($this->version, true);
  51792. $this->upperBound = Bound::positiveInfinity();
  51793. break;
  51794. case self::OP_NE:
  51795. $this->lowerBound = Bound::zero();
  51796. $this->upperBound = Bound::positiveInfinity();
  51797. break;
  51798. }
  51799. }
  51800. }
  51801. <?php
  51802. namespace Composer\Semver\Constraint;
  51803. interface ConstraintInterface
  51804. {
  51805. public function matches(ConstraintInterface $provider);
  51806. public function compile($otherOperator);
  51807. public function getUpperBound();
  51808. public function getLowerBound();
  51809. public function getPrettyString();
  51810. public function setPrettyString($prettyString);
  51811. public function __toString();
  51812. }
  51813. <?php
  51814. namespace Composer\Semver\Constraint;
  51815. class MatchAllConstraint implements ConstraintInterface
  51816. {
  51817. protected $prettyString;
  51818. public function matches(ConstraintInterface $provider)
  51819. {
  51820. return true;
  51821. }
  51822. public function compile($otherOperator)
  51823. {
  51824. return 'true';
  51825. }
  51826. public function setPrettyString($prettyString)
  51827. {
  51828. $this->prettyString = $prettyString;
  51829. }
  51830. public function getPrettyString()
  51831. {
  51832. if ($this->prettyString) {
  51833. return $this->prettyString;
  51834. }
  51835. return (string) $this;
  51836. }
  51837. public function __toString()
  51838. {
  51839. return '*';
  51840. }
  51841. public function getUpperBound()
  51842. {
  51843. return Bound::positiveInfinity();
  51844. }
  51845. public function getLowerBound()
  51846. {
  51847. return Bound::zero();
  51848. }
  51849. }
  51850. <?php
  51851. namespace Composer\Semver\Constraint;
  51852. class MatchNoneConstraint implements ConstraintInterface
  51853. {
  51854. protected $prettyString;
  51855. public function matches(ConstraintInterface $provider)
  51856. {
  51857. return false;
  51858. }
  51859. public function compile($otherOperator)
  51860. {
  51861. return 'false';
  51862. }
  51863. public function setPrettyString($prettyString)
  51864. {
  51865. $this->prettyString = $prettyString;
  51866. }
  51867. public function getPrettyString()
  51868. {
  51869. if ($this->prettyString) {
  51870. return $this->prettyString;
  51871. }
  51872. return (string) $this;
  51873. }
  51874. public function __toString()
  51875. {
  51876. return '[]';
  51877. }
  51878. public function getUpperBound()
  51879. {
  51880. return new Bound('0.0.0.0-dev', false);
  51881. }
  51882. public function getLowerBound()
  51883. {
  51884. return new Bound('0.0.0.0-dev', false);
  51885. }
  51886. }
  51887. <?php
  51888. namespace Composer\Semver\Constraint;
  51889. class MultiConstraint implements ConstraintInterface
  51890. {
  51891. protected $constraints;
  51892. protected $prettyString;
  51893. protected $string;
  51894. protected $conjunctive;
  51895. protected $lowerBound;
  51896. protected $upperBound;
  51897. public function __construct(array $constraints, $conjunctive = true)
  51898. {
  51899. if (\count($constraints) < 2) {
  51900. throw new \InvalidArgumentException(
  51901. 'Must provide at least two constraints for a MultiConstraint. Use '.
  51902. 'the regular Constraint class for one constraint only or MatchAllConstraint for none. You may use '.
  51903. 'MultiConstraint::create() which optimizes and handles those cases automatically.'
  51904. );
  51905. }
  51906. $this->constraints = $constraints;
  51907. $this->conjunctive = $conjunctive;
  51908. }
  51909. public function getConstraints()
  51910. {
  51911. return $this->constraints;
  51912. }
  51913. public function isConjunctive()
  51914. {
  51915. return $this->conjunctive;
  51916. }
  51917. public function isDisjunctive()
  51918. {
  51919. return !$this->conjunctive;
  51920. }
  51921. public function compile($otherOperator)
  51922. {
  51923. $parts = array();
  51924. foreach ($this->constraints as $constraint) {
  51925. $code = $constraint->compile($otherOperator);
  51926. if ($code === 'true') {
  51927. if (!$this->conjunctive) {
  51928. return 'true';
  51929. }
  51930. } elseif ($code === 'false') {
  51931. if ($this->conjunctive) {
  51932. return 'false';
  51933. }
  51934. } else {
  51935. $parts[] = '('.$code.')';
  51936. }
  51937. }
  51938. if (!$parts) {
  51939. return $this->conjunctive ? 'true' : 'false';
  51940. }
  51941. return $this->conjunctive ? implode('&&', $parts) : implode('||', $parts);
  51942. }
  51943. public function matches(ConstraintInterface $provider)
  51944. {
  51945. if (false === $this->conjunctive) {
  51946. foreach ($this->constraints as $constraint) {
  51947. if ($provider->matches($constraint)) {
  51948. return true;
  51949. }
  51950. }
  51951. return false;
  51952. }
  51953. if ($provider instanceof MultiConstraint && $provider->isDisjunctive()) {
  51954. return $provider->matches($this);
  51955. }
  51956. foreach ($this->constraints as $constraint) {
  51957. if (!$provider->matches($constraint)) {
  51958. return false;
  51959. }
  51960. }
  51961. return true;
  51962. }
  51963. public function setPrettyString($prettyString)
  51964. {
  51965. $this->prettyString = $prettyString;
  51966. }
  51967. public function getPrettyString()
  51968. {
  51969. if ($this->prettyString) {
  51970. return $this->prettyString;
  51971. }
  51972. return (string) $this;
  51973. }
  51974. public function __toString()
  51975. {
  51976. if ($this->string !== null) {
  51977. return $this->string;
  51978. }
  51979. $constraints = array();
  51980. foreach ($this->constraints as $constraint) {
  51981. $constraints[] = (string) $constraint;
  51982. }
  51983. return $this->string = '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  51984. }
  51985. public function getLowerBound()
  51986. {
  51987. $this->extractBounds();
  51988. if (null === $this->lowerBound) {
  51989. throw new \LogicException('extractBounds should have populated the lowerBound property');
  51990. }
  51991. return $this->lowerBound;
  51992. }
  51993. public function getUpperBound()
  51994. {
  51995. $this->extractBounds();
  51996. if (null === $this->upperBound) {
  51997. throw new \LogicException('extractBounds should have populated the upperBound property');
  51998. }
  51999. return $this->upperBound;
  52000. }
  52001. public static function create(array $constraints, $conjunctive = true)
  52002. {
  52003. if (0 === \count($constraints)) {
  52004. return new MatchAllConstraint();
  52005. }
  52006. if (1 === \count($constraints)) {
  52007. return $constraints[0];
  52008. }
  52009. $optimized = self::optimizeConstraints($constraints, $conjunctive);
  52010. if ($optimized !== null) {
  52011. list($constraints, $conjunctive) = $optimized;
  52012. if (\count($constraints) === 1) {
  52013. return $constraints[0];
  52014. }
  52015. }
  52016. return new self($constraints, $conjunctive);
  52017. }
  52018. private static function optimizeConstraints(array $constraints, $conjunctive)
  52019. {
  52020. if (!$conjunctive) {
  52021. $left = $constraints[0];
  52022. $mergedConstraints = array();
  52023. $optimized = false;
  52024. for ($i = 1, $l = \count($constraints); $i < $l; $i++) {
  52025. $right = $constraints[$i];
  52026. if (
  52027. $left instanceof self
  52028. && $left->conjunctive
  52029. && $right instanceof self
  52030. && $right->conjunctive
  52031. && \count($left->constraints) === 2
  52032. && \count($right->constraints) === 2
  52033. && ($left0 = (string) $left->constraints[0])
  52034. && $left0[0] === '>' && $left0[1] === '='
  52035. && ($left1 = (string) $left->constraints[1])
  52036. && $left1[0] === '<'
  52037. && ($right0 = (string) $right->constraints[0])
  52038. && $right0[0] === '>' && $right0[1] === '='
  52039. && ($right1 = (string) $right->constraints[1])
  52040. && $right1[0] === '<'
  52041. && substr($left1, 2) === substr($right0, 3)
  52042. ) {
  52043. $optimized = true;
  52044. $left = new MultiConstraint(
  52045. array(
  52046. $left->constraints[0],
  52047. $right->constraints[1],
  52048. ),
  52049. true);
  52050. } else {
  52051. $mergedConstraints[] = $left;
  52052. $left = $right;
  52053. }
  52054. }
  52055. if ($optimized) {
  52056. $mergedConstraints[] = $left;
  52057. return array($mergedConstraints, false);
  52058. }
  52059. }
  52060. return null;
  52061. }
  52062. private function extractBounds()
  52063. {
  52064. if (null !== $this->lowerBound) {
  52065. return;
  52066. }
  52067. foreach ($this->constraints as $constraint) {
  52068. if (null === $this->lowerBound || null === $this->upperBound) {
  52069. $this->lowerBound = $constraint->getLowerBound();
  52070. $this->upperBound = $constraint->getUpperBound();
  52071. continue;
  52072. }
  52073. if ($constraint->getLowerBound()->compareTo($this->lowerBound, $this->isConjunctive() ? '>' : '<')) {
  52074. $this->lowerBound = $constraint->getLowerBound();
  52075. }
  52076. if ($constraint->getUpperBound()->compareTo($this->upperBound, $this->isConjunctive() ? '<' : '>')) {
  52077. $this->upperBound = $constraint->getUpperBound();
  52078. }
  52079. }
  52080. }
  52081. }
  52082. <?php
  52083. namespace Composer\Semver;
  52084. use Composer\Semver\Constraint\Constraint;
  52085. class Interval
  52086. {
  52087. private $start;
  52088. private $end;
  52089. public function __construct(Constraint $start, Constraint $end)
  52090. {
  52091. $this->start = $start;
  52092. $this->end = $end;
  52093. }
  52094. public function getStart()
  52095. {
  52096. return $this->start;
  52097. }
  52098. public function getEnd()
  52099. {
  52100. return $this->end;
  52101. }
  52102. public static function fromZero()
  52103. {
  52104. static $zero;
  52105. if (null === $zero) {
  52106. $zero = new Constraint('>=', '0.0.0.0-dev');
  52107. }
  52108. return $zero;
  52109. }
  52110. public static function untilPositiveInfinity()
  52111. {
  52112. static $positiveInfinity;
  52113. if (null === $positiveInfinity) {
  52114. $positiveInfinity = new Constraint('<', PHP_INT_MAX.'.0.0.0');
  52115. }
  52116. return $positiveInfinity;
  52117. }
  52118. public static function any()
  52119. {
  52120. return new self(self::fromZero(), self::untilPositiveInfinity());
  52121. }
  52122. public static function anyDev()
  52123. {
  52124. return array('names' => array(), 'exclude' => true);
  52125. }
  52126. public static function noDev()
  52127. {
  52128. return array('names' => array(), 'exclude' => false);
  52129. }
  52130. }
  52131. <?php
  52132. namespace Composer\Semver;
  52133. use Composer\Semver\Constraint\Constraint;
  52134. use Composer\Semver\Constraint\ConstraintInterface;
  52135. use Composer\Semver\Constraint\MatchAllConstraint;
  52136. use Composer\Semver\Constraint\MatchNoneConstraint;
  52137. use Composer\Semver\Constraint\MultiConstraint;
  52138. class Intervals
  52139. {
  52140. private static $intervalsCache = array();
  52141. private static $opSortOrder = array(
  52142. '>=' => -3,
  52143. '<' => -2,
  52144. '>' => 2,
  52145. '<=' => 3,
  52146. );
  52147. public static function clear()
  52148. {
  52149. self::$intervalsCache = array();
  52150. }
  52151. public static function isSubsetOf(ConstraintInterface $candidate, ConstraintInterface $constraint)
  52152. {
  52153. if ($constraint instanceof MatchAllConstraint) {
  52154. return true;
  52155. }
  52156. if ($candidate instanceof MatchNoneConstraint || $constraint instanceof MatchNoneConstraint) {
  52157. return false;
  52158. }
  52159. $intersectionIntervals = self::get(new MultiConstraint(array($candidate, $constraint), true));
  52160. $candidateIntervals = self::get($candidate);
  52161. if (\count($intersectionIntervals['numeric']) !== \count($candidateIntervals['numeric'])) {
  52162. return false;
  52163. }
  52164. foreach ($intersectionIntervals['numeric'] as $index => $interval) {
  52165. if (!isset($candidateIntervals['numeric'][$index])) {
  52166. return false;
  52167. }
  52168. if ((string) $candidateIntervals['numeric'][$index]->getStart() !== (string) $interval->getStart()) {
  52169. return false;
  52170. }
  52171. if ((string) $candidateIntervals['numeric'][$index]->getEnd() !== (string) $interval->getEnd()) {
  52172. return false;
  52173. }
  52174. }
  52175. if ($intersectionIntervals['branches']['exclude'] !== $candidateIntervals['branches']['exclude']) {
  52176. return false;
  52177. }
  52178. if (\count($intersectionIntervals['branches']['names']) !== \count($candidateIntervals['branches']['names'])) {
  52179. return false;
  52180. }
  52181. foreach ($intersectionIntervals['branches']['names'] as $index => $name) {
  52182. if ($name !== $candidateIntervals['branches']['names'][$index]) {
  52183. return false;
  52184. }
  52185. }
  52186. return true;
  52187. }
  52188. public static function haveIntersections(ConstraintInterface $a, ConstraintInterface $b)
  52189. {
  52190. if ($a instanceof MatchAllConstraint || $b instanceof MatchAllConstraint) {
  52191. return true;
  52192. }
  52193. if ($a instanceof MatchNoneConstraint || $b instanceof MatchNoneConstraint) {
  52194. return false;
  52195. }
  52196. $intersectionIntervals = self::generateIntervals(new MultiConstraint(array($a, $b), true), true);
  52197. return \count($intersectionIntervals['numeric']) > 0 || $intersectionIntervals['branches']['exclude'] || \count($intersectionIntervals['branches']['names']) > 0;
  52198. }
  52199. public static function compactConstraint(ConstraintInterface $constraint)
  52200. {
  52201. if (!$constraint instanceof MultiConstraint) {
  52202. return $constraint;
  52203. }
  52204. $intervals = self::generateIntervals($constraint);
  52205. $constraints = array();
  52206. $hasNumericMatchAll = false;
  52207. if (\count($intervals['numeric']) === 1 && (string) $intervals['numeric'][0]->getStart() === (string) Interval::fromZero() && (string) $intervals['numeric'][0]->getEnd() === (string) Interval::untilPositiveInfinity()) {
  52208. $constraints[] = $intervals['numeric'][0]->getStart();
  52209. $hasNumericMatchAll = true;
  52210. } else {
  52211. $unEqualConstraints = array();
  52212. for ($i = 0, $count = \count($intervals['numeric']); $i < $count; $i++) {
  52213. $interval = $intervals['numeric'][$i];
  52214. if ($interval->getEnd()->getOperator() === '<' && $i+1 < $count) {
  52215. $nextInterval = $intervals['numeric'][$i+1];
  52216. if ($interval->getEnd()->getVersion() === $nextInterval->getStart()->getVersion() && $nextInterval->getStart()->getOperator() === '>') {
  52217. if (\count($unEqualConstraints) === 0 && (string) $interval->getStart() !== (string) Interval::fromZero()) {
  52218. $unEqualConstraints[] = $interval->getStart();
  52219. }
  52220. $unEqualConstraints[] = new Constraint('!=', $interval->getEnd()->getVersion());
  52221. continue;
  52222. }
  52223. }
  52224. if (\count($unEqualConstraints) > 0) {
  52225. if ((string) $interval->getEnd() !== (string) Interval::untilPositiveInfinity()) {
  52226. $unEqualConstraints[] = $interval->getEnd();
  52227. }
  52228. if (\count($unEqualConstraints) > 1) {
  52229. $constraints[] = new MultiConstraint($unEqualConstraints, true);
  52230. } else {
  52231. $constraints[] = $unEqualConstraints[0];
  52232. }
  52233. $unEqualConstraints = array();
  52234. continue;
  52235. }
  52236. if ($interval->getStart()->getVersion() === $interval->getEnd()->getVersion() && $interval->getStart()->getOperator() === '>=' && $interval->getEnd()->getOperator() === '<=') {
  52237. $constraints[] = new Constraint('==', $interval->getStart()->getVersion());
  52238. continue;
  52239. }
  52240. if ((string) $interval->getStart() === (string) Interval::fromZero()) {
  52241. $constraints[] = $interval->getEnd();
  52242. } elseif ((string) $interval->getEnd() === (string) Interval::untilPositiveInfinity()) {
  52243. $constraints[] = $interval->getStart();
  52244. } else {
  52245. $constraints[] = new MultiConstraint(array($interval->getStart(), $interval->getEnd()), true);
  52246. }
  52247. }
  52248. }
  52249. $devConstraints = array();
  52250. if (0 === \count($intervals['branches']['names'])) {
  52251. if ($intervals['branches']['exclude']) {
  52252. if ($hasNumericMatchAll) {
  52253. return new MatchAllConstraint;
  52254. }
  52255. }
  52256. } else {
  52257. foreach ($intervals['branches']['names'] as $branchName) {
  52258. if ($intervals['branches']['exclude']) {
  52259. $devConstraints[] = new Constraint('!=', $branchName);
  52260. } else {
  52261. $devConstraints[] = new Constraint('==', $branchName);
  52262. }
  52263. }
  52264. if ($intervals['branches']['exclude']) {
  52265. if (\count($constraints) > 1) {
  52266. return new MultiConstraint(array_merge(
  52267. array(new MultiConstraint($constraints, false)),
  52268. $devConstraints
  52269. ), true);
  52270. }
  52271. if (\count($constraints) === 1 && (string)$constraints[0] === (string)Interval::fromZero()) {
  52272. if (\count($devConstraints) > 1) {
  52273. return new MultiConstraint($devConstraints, true);
  52274. }
  52275. return $devConstraints[0];
  52276. }
  52277. return new MultiConstraint(array_merge($constraints, $devConstraints), true);
  52278. }
  52279. $constraints = array_merge($constraints, $devConstraints);
  52280. }
  52281. if (\count($constraints) > 1) {
  52282. return new MultiConstraint($constraints, false);
  52283. }
  52284. if (\count($constraints) === 1) {
  52285. return $constraints[0];
  52286. }
  52287. return new MatchNoneConstraint;
  52288. }
  52289. public static function get(ConstraintInterface $constraint)
  52290. {
  52291. $key = (string) $constraint;
  52292. if (!isset(self::$intervalsCache[$key])) {
  52293. self::$intervalsCache[$key] = self::generateIntervals($constraint);
  52294. }
  52295. return self::$intervalsCache[$key];
  52296. }
  52297. private static function generateIntervals(ConstraintInterface $constraint, $stopOnFirstValidInterval = false)
  52298. {
  52299. if ($constraint instanceof MatchAllConstraint) {
  52300. return array('numeric' => array(new Interval(Interval::fromZero(), Interval::untilPositiveInfinity())), 'branches' => Interval::anyDev());
  52301. }
  52302. if ($constraint instanceof MatchNoneConstraint) {
  52303. return array('numeric' => array(), 'branches' => array('names' => array(), 'exclude' => false));
  52304. }
  52305. if ($constraint instanceof Constraint) {
  52306. return self::generateSingleConstraintIntervals($constraint);
  52307. }
  52308. if (!$constraint instanceof MultiConstraint) {
  52309. throw new \UnexpectedValueException('The constraint passed in should be an MatchAllConstraint, Constraint or MultiConstraint instance, got '.\get_class($constraint).'.');
  52310. }
  52311. $constraints = $constraint->getConstraints();
  52312. $numericGroups = array();
  52313. $constraintBranches = array();
  52314. foreach ($constraints as $c) {
  52315. $res = self::get($c);
  52316. $numericGroups[] = $res['numeric'];
  52317. $constraintBranches[] = $res['branches'];
  52318. }
  52319. if ($constraint->isDisjunctive()) {
  52320. $branches = Interval::noDev();
  52321. foreach ($constraintBranches as $b) {
  52322. if ($b['exclude']) {
  52323. if ($branches['exclude']) {
  52324. $branches['names'] = array_intersect($branches['names'], $b['names']);
  52325. } else {
  52326. $branches['exclude'] = true;
  52327. $branches['names'] = array_diff($b['names'], $branches['names']);
  52328. }
  52329. } else {
  52330. if ($branches['exclude']) {
  52331. $branches['names'] = array_diff($branches['names'], $b['names']);
  52332. } else {
  52333. $branches['names'] = array_merge($branches['names'], $b['names']);
  52334. }
  52335. }
  52336. }
  52337. } else {
  52338. $branches = Interval::anyDev();
  52339. foreach ($constraintBranches as $b) {
  52340. if ($b['exclude']) {
  52341. if ($branches['exclude']) {
  52342. $branches['names'] = array_merge($branches['names'], $b['names']);
  52343. } else {
  52344. $branches['names'] = array_diff($branches['names'], $b['names']);
  52345. }
  52346. } else {
  52347. if ($branches['exclude']) {
  52348. $branches['names'] = array_diff($b['names'], $branches['names']);
  52349. $branches['exclude'] = false;
  52350. } else {
  52351. $branches['names'] = array_intersect($branches['names'], $b['names']);
  52352. }
  52353. }
  52354. }
  52355. }
  52356. $branches['names'] = array_unique($branches['names']);
  52357. if (\count($numericGroups) === 1) {
  52358. return array('numeric' => $numericGroups[0], 'branches' => $branches);
  52359. }
  52360. $borders = array();
  52361. foreach ($numericGroups as $group) {
  52362. foreach ($group as $interval) {
  52363. $borders[] = array('version' => $interval->getStart()->getVersion(), 'operator' => $interval->getStart()->getOperator(), 'side' => 'start');
  52364. $borders[] = array('version' => $interval->getEnd()->getVersion(), 'operator' => $interval->getEnd()->getOperator(), 'side' => 'end');
  52365. }
  52366. }
  52367. $opSortOrder = self::$opSortOrder;
  52368. usort($borders, function ($a, $b) use ($opSortOrder) {
  52369. $order = version_compare($a['version'], $b['version']);
  52370. if ($order === 0) {
  52371. return $opSortOrder[$a['operator']] - $opSortOrder[$b['operator']];
  52372. }
  52373. return $order;
  52374. });
  52375. $activeIntervals = 0;
  52376. $intervals = array();
  52377. $index = 0;
  52378. $activationThreshold = $constraint->isConjunctive() ? \count($numericGroups) : 1;
  52379. $start = null;
  52380. foreach ($borders as $border) {
  52381. if ($border['side'] === 'start') {
  52382. $activeIntervals++;
  52383. } else {
  52384. $activeIntervals--;
  52385. }
  52386. if (!$start && $activeIntervals >= $activationThreshold) {
  52387. $start = new Constraint($border['operator'], $border['version']);
  52388. } elseif ($start && $activeIntervals < $activationThreshold) {
  52389. if (
  52390. version_compare($start->getVersion(), $border['version'], '=')
  52391. && (
  52392. ($start->getOperator() === '>' && $border['operator'] === '<=')
  52393. || ($start->getOperator() === '>=' && $border['operator'] === '<')
  52394. )
  52395. ) {
  52396. unset($intervals[$index]);
  52397. } else {
  52398. $intervals[$index] = new Interval($start, new Constraint($border['operator'], $border['version']));
  52399. $index++;
  52400. if ($stopOnFirstValidInterval) {
  52401. break;
  52402. }
  52403. }
  52404. $start = null;
  52405. }
  52406. }
  52407. return array('numeric' => $intervals, 'branches' => $branches);
  52408. }
  52409. private static function generateSingleConstraintIntervals(Constraint $constraint)
  52410. {
  52411. $op = $constraint->getOperator();
  52412. if (strpos($constraint->getVersion(), 'dev-') === 0) {
  52413. $intervals = array();
  52414. $branches = array('names' => array(), 'exclude' => false);
  52415. if ($op === '!=') {
  52416. $intervals[] = new Interval(Interval::fromZero(), Interval::untilPositiveInfinity());
  52417. $branches = array('names' => array($constraint->getVersion()), 'exclude' => true);
  52418. } elseif ($op === '==') {
  52419. $branches['names'][] = $constraint->getVersion();
  52420. }
  52421. return array(
  52422. 'numeric' => $intervals,
  52423. 'branches' => $branches,
  52424. );
  52425. }
  52426. if ($op[0] === '>') {
  52427. return array('numeric' => array(new Interval($constraint, Interval::untilPositiveInfinity())), 'branches' => Interval::noDev());
  52428. }
  52429. if ($op[0] === '<') {
  52430. return array('numeric' => array(new Interval(Interval::fromZero(), $constraint)), 'branches' => Interval::noDev());
  52431. }
  52432. if ($op === '!=') {
  52433. return array('numeric' => array(
  52434. new Interval(Interval::fromZero(), new Constraint('<', $constraint->getVersion())),
  52435. new Interval(new Constraint('>', $constraint->getVersion()), Interval::untilPositiveInfinity()),
  52436. ), 'branches' => Interval::anyDev());
  52437. }
  52438. return array('numeric' => array(
  52439. new Interval(new Constraint('>=', $constraint->getVersion()), new Constraint('<=', $constraint->getVersion())),
  52440. ), 'branches' => Interval::noDev());
  52441. }
  52442. }
  52443. <?php
  52444. namespace Composer\Semver;
  52445. use Composer\Semver\Constraint\Constraint;
  52446. class Semver
  52447. {
  52448. const SORT_ASC = 1;
  52449. const SORT_DESC = -1;
  52450. private static $versionParser;
  52451. public static function satisfies($version, $constraints)
  52452. {
  52453. if (null === self::$versionParser) {
  52454. self::$versionParser = new VersionParser();
  52455. }
  52456. $versionParser = self::$versionParser;
  52457. $provider = new Constraint('==', $versionParser->normalize($version));
  52458. $parsedConstraints = $versionParser->parseConstraints($constraints);
  52459. return $parsedConstraints->matches($provider);
  52460. }
  52461. public static function satisfiedBy(array $versions, $constraints)
  52462. {
  52463. $versions = array_filter($versions, function ($version) use ($constraints) {
  52464. return Semver::satisfies($version, $constraints);
  52465. });
  52466. return array_values($versions);
  52467. }
  52468. public static function sort(array $versions)
  52469. {
  52470. return self::usort($versions, self::SORT_ASC);
  52471. }
  52472. public static function rsort(array $versions)
  52473. {
  52474. return self::usort($versions, self::SORT_DESC);
  52475. }
  52476. private static function usort(array $versions, $direction)
  52477. {
  52478. if (null === self::$versionParser) {
  52479. self::$versionParser = new VersionParser();
  52480. }
  52481. $versionParser = self::$versionParser;
  52482. $normalized = array();
  52483. foreach ($versions as $key => $version) {
  52484. $normalizedVersion = $versionParser->normalize($version);
  52485. $normalizedVersion = $versionParser->normalizeDefaultBranch($normalizedVersion);
  52486. $normalized[] = array($normalizedVersion, $key);
  52487. }
  52488. usort($normalized, function (array $left, array $right) use ($direction) {
  52489. if ($left[0] === $right[0]) {
  52490. return 0;
  52491. }
  52492. if (Comparator::lessThan($left[0], $right[0])) {
  52493. return -$direction;
  52494. }
  52495. return $direction;
  52496. });
  52497. $sorted = array();
  52498. foreach ($normalized as $item) {
  52499. $sorted[] = $versions[$item[1]];
  52500. }
  52501. return $sorted;
  52502. }
  52503. }
  52504. <?php
  52505. namespace Composer\Semver;
  52506. use Composer\Semver\Constraint\ConstraintInterface;
  52507. use Composer\Semver\Constraint\MatchAllConstraint;
  52508. use Composer\Semver\Constraint\MultiConstraint;
  52509. use Composer\Semver\Constraint\Constraint;
  52510. class VersionParser
  52511. {
  52512. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  52513. private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev';
  52514. public static function parseStability($version)
  52515. {
  52516. $version = (string) preg_replace('{#.+$}', '', (string) $version);
  52517. if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
  52518. return 'dev';
  52519. }
  52520. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  52521. if (!empty($match[3])) {
  52522. return 'dev';
  52523. }
  52524. if (!empty($match[1])) {
  52525. if ('beta' === $match[1] || 'b' === $match[1]) {
  52526. return 'beta';
  52527. }
  52528. if ('alpha' === $match[1] || 'a' === $match[1]) {
  52529. return 'alpha';
  52530. }
  52531. if ('rc' === $match[1]) {
  52532. return 'RC';
  52533. }
  52534. }
  52535. return 'stable';
  52536. }
  52537. public static function normalizeStability($stability)
  52538. {
  52539. $stability = strtolower((string) $stability);
  52540. if (!in_array($stability, array('stable', 'rc', 'beta', 'alpha', 'dev'), true)) {
  52541. throw new \InvalidArgumentException('Invalid stability string "'.$stability.'", expected one of stable, RC, beta, alpha or dev');
  52542. }
  52543. return $stability === 'rc' ? 'RC' : $stability;
  52544. }
  52545. public function normalize($version, $fullVersion = null)
  52546. {
  52547. $version = trim((string) $version);
  52548. $origVersion = $version;
  52549. if (null === $fullVersion) {
  52550. $fullVersion = $version;
  52551. }
  52552. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  52553. $version = $match[1];
  52554. }
  52555. if (preg_match('{@(?:' . self::$stabilitiesRegex . ')$}i', $version, $match)) {
  52556. $version = substr($version, 0, strlen($version) - strlen($match[0]));
  52557. }
  52558. if (\in_array($version, array('master', 'trunk', 'default'), true)) {
  52559. $version = 'dev-' . $version;
  52560. }
  52561. if (stripos($version, 'dev-') === 0) {
  52562. return 'dev-' . substr($version, 4);
  52563. }
  52564. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  52565. $version = $match[1];
  52566. }
  52567. if (preg_match('{^v?(\d{1,5}+)(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  52568. $version = $matches[1]
  52569. . (!empty($matches[2]) ? $matches[2] : '.0')
  52570. . (!empty($matches[3]) ? $matches[3] : '.0')
  52571. . (!empty($matches[4]) ? $matches[4] : '.0');
  52572. $index = 5;
  52573. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3}){0,2})' . self::$modifierRegex . '$}i', $version, $matches)) {
  52574. $version = (string) preg_replace('{\D}', '.', $matches[1]);
  52575. $index = 2;
  52576. }
  52577. if (isset($index)) {
  52578. if (!empty($matches[$index])) {
  52579. if ('stable' === $matches[$index]) {
  52580. return $version;
  52581. }
  52582. $version .= '-' . $this->expandStability($matches[$index]) . (isset($matches[$index + 1]) && '' !== $matches[$index + 1] ? ltrim($matches[$index + 1], '.-') : '');
  52583. }
  52584. if (!empty($matches[$index + 2])) {
  52585. $version .= '-dev';
  52586. }
  52587. return $version;
  52588. }
  52589. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  52590. try {
  52591. $normalized = $this->normalizeBranch($match[1]);
  52592. if (strpos($normalized, 'dev-') === false) {
  52593. return $normalized;
  52594. }
  52595. } catch (\Exception $e) {
  52596. }
  52597. }
  52598. $extraMessage = '';
  52599. if (preg_match('{ +as +' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))?$}', $fullVersion)) {
  52600. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  52601. } elseif (preg_match('{^' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))? +as +}', $fullVersion)) {
  52602. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  52603. }
  52604. throw new \UnexpectedValueException('Invalid version string "' . $origVersion . '"' . $extraMessage);
  52605. }
  52606. public function parseNumericAliasPrefix($branch)
  52607. {
  52608. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', (string) $branch, $matches)) {
  52609. return $matches['version'] . '.';
  52610. }
  52611. return false;
  52612. }
  52613. public function normalizeBranch($name)
  52614. {
  52615. $name = trim((string) $name);
  52616. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  52617. $version = '';
  52618. for ($i = 1; $i < 5; ++$i) {
  52619. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  52620. }
  52621. return str_replace('x', '9999999', $version) . '-dev';
  52622. }
  52623. return 'dev-' . $name;
  52624. }
  52625. public function normalizeDefaultBranch($name)
  52626. {
  52627. if ($name === 'dev-master' || $name === 'dev-default' || $name === 'dev-trunk') {
  52628. return '9999999-dev';
  52629. }
  52630. return (string) $name;
  52631. }
  52632. public function parseConstraints($constraints)
  52633. {
  52634. $prettyConstraint = (string) $constraints;
  52635. $orConstraints = preg_split('{\s*\|\|?\s*}', trim((string) $constraints));
  52636. if (false === $orConstraints) {
  52637. throw new \RuntimeException('Failed to preg_split string: '.$constraints);
  52638. }
  52639. $orGroups = array();
  52640. foreach ($orConstraints as $orConstraint) {
  52641. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  52642. if (false === $andConstraints) {
  52643. throw new \RuntimeException('Failed to preg_split string: '.$orConstraint);
  52644. }
  52645. if (\count($andConstraints) > 1) {
  52646. $constraintObjects = array();
  52647. foreach ($andConstraints as $andConstraint) {
  52648. foreach ($this->parseConstraint($andConstraint) as $parsedAndConstraint) {
  52649. $constraintObjects[] = $parsedAndConstraint;
  52650. }
  52651. }
  52652. } else {
  52653. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  52654. }
  52655. if (1 === \count($constraintObjects)) {
  52656. $constraint = $constraintObjects[0];
  52657. } else {
  52658. $constraint = new MultiConstraint($constraintObjects);
  52659. }
  52660. $orGroups[] = $constraint;
  52661. }
  52662. $parsedConstraint = MultiConstraint::create($orGroups, false);
  52663. $parsedConstraint->setPrettyString($prettyConstraint);
  52664. return $parsedConstraint;
  52665. }
  52666. private function parseConstraint($constraint)
  52667. {
  52668. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $constraint, $match)) {
  52669. $constraint = $match[1];
  52670. }
  52671. if (preg_match('{^([^,\s]*?)@(' . self::$stabilitiesRegex . ')$}i', $constraint, $match)) {
  52672. $constraint = '' !== $match[1] ? $match[1] : '*';
  52673. if ($match[2] !== 'stable') {
  52674. $stabilityModifier = $match[2];
  52675. }
  52676. }
  52677. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraint, $match)) {
  52678. $constraint = $match[1];
  52679. }
  52680. if (preg_match('{^(v)?[xX*](\.[xX*])*$}i', $constraint, $match)) {
  52681. if (!empty($match[1]) || !empty($match[2])) {
  52682. return array(new Constraint('>=', '0.0.0.0-dev'));
  52683. }
  52684. return array(new MatchAllConstraint());
  52685. }
  52686. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?(?:' . self::$modifierRegex . '|\.([xX*][.-]?dev))(?:\+[^\s]+)?';
  52687. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  52688. if (strpos($constraint, '~>') === 0) {
  52689. throw new \UnexpectedValueException(
  52690. 'Could not parse version constraint ' . $constraint . ': ' .
  52691. 'Invalid operator "~>", you probably meant to use the "~" operator'
  52692. );
  52693. }
  52694. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  52695. $position = 4;
  52696. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  52697. $position = 3;
  52698. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  52699. $position = 2;
  52700. } else {
  52701. $position = 1;
  52702. }
  52703. if (!empty($matches[8])) {
  52704. $position++;
  52705. }
  52706. $stabilitySuffix = '';
  52707. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  52708. $stabilitySuffix .= '-dev';
  52709. }
  52710. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  52711. $lowerBound = new Constraint('>=', $lowVersion);
  52712. $highPosition = max(1, $position - 1);
  52713. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  52714. $upperBound = new Constraint('<', $highVersion);
  52715. return array(
  52716. $lowerBound,
  52717. $upperBound,
  52718. );
  52719. }
  52720. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  52721. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  52722. $position = 1;
  52723. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  52724. $position = 2;
  52725. } else {
  52726. $position = 3;
  52727. }
  52728. $stabilitySuffix = '';
  52729. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  52730. $stabilitySuffix .= '-dev';
  52731. }
  52732. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  52733. $lowerBound = new Constraint('>=', $lowVersion);
  52734. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  52735. $upperBound = new Constraint('<', $highVersion);
  52736. return array(
  52737. $lowerBound,
  52738. $upperBound,
  52739. );
  52740. }
  52741. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  52742. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  52743. $position = 3;
  52744. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  52745. $position = 2;
  52746. } else {
  52747. $position = 1;
  52748. }
  52749. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  52750. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  52751. if ($lowVersion === '0.0.0.0-dev') {
  52752. return array(new Constraint('<', $highVersion));
  52753. }
  52754. return array(
  52755. new Constraint('>=', $lowVersion),
  52756. new Constraint('<', $highVersion),
  52757. );
  52758. }
  52759. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  52760. $lowStabilitySuffix = '';
  52761. if (empty($matches[6]) && empty($matches[8]) && empty($matches[9])) {
  52762. $lowStabilitySuffix = '-dev';
  52763. }
  52764. $lowVersion = $this->normalize($matches['from']);
  52765. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  52766. $empty = function ($x) {
  52767. return ($x === 0 || $x === '0') ? false : empty($x);
  52768. };
  52769. if ((!$empty($matches[12]) && !$empty($matches[13])) || !empty($matches[15]) || !empty($matches[17]) || !empty($matches[18])) {
  52770. $highVersion = $this->normalize($matches['to']);
  52771. $upperBound = new Constraint('<=', $highVersion);
  52772. } else {
  52773. $highMatch = array('', $matches[11], $matches[12], $matches[13], $matches[14]);
  52774. $this->normalize($matches['to']);
  52775. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[12]) ? 1 : 2, 1) . '-dev';
  52776. $upperBound = new Constraint('<', $highVersion);
  52777. }
  52778. return array(
  52779. $lowerBound,
  52780. $upperBound,
  52781. );
  52782. }
  52783. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  52784. try {
  52785. try {
  52786. $version = $this->normalize($matches[2]);
  52787. } catch (\UnexpectedValueException $e) {
  52788. if (substr($matches[2], -4) === '-dev' && preg_match('{^[0-9a-zA-Z-./]+$}', $matches[2])) {
  52789. $version = $this->normalize('dev-'.substr($matches[2], 0, -4));
  52790. } else {
  52791. throw $e;
  52792. }
  52793. }
  52794. $op = $matches[1] ?: '=';
  52795. if ($op !== '==' && $op !== '=' && !empty($stabilityModifier) && self::parseStability($version) === 'stable') {
  52796. $version .= '-' . $stabilityModifier;
  52797. } elseif ('<' === $op || '>=' === $op) {
  52798. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  52799. if (strpos($matches[2], 'dev-') !== 0) {
  52800. $version .= '-dev';
  52801. }
  52802. }
  52803. }
  52804. return array(new Constraint($matches[1] ?: '=', $version));
  52805. } catch (\Exception $e) {
  52806. }
  52807. }
  52808. $message = 'Could not parse version constraint ' . $constraint;
  52809. if (isset($e)) {
  52810. $message .= ': ' . $e->getMessage();
  52811. }
  52812. throw new \UnexpectedValueException($message);
  52813. }
  52814. private function manipulateVersionString(array $matches, $position, $increment = 0, $pad = '0')
  52815. {
  52816. for ($i = 4; $i > 0; --$i) {
  52817. if ($i > $position) {
  52818. $matches[$i] = $pad;
  52819. } elseif ($i === $position && $increment) {
  52820. $matches[$i] += $increment;
  52821. if ($matches[$i] < 0) {
  52822. $matches[$i] = $pad;
  52823. --$position;
  52824. if ($i === 1) {
  52825. return null;
  52826. }
  52827. }
  52828. }
  52829. }
  52830. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  52831. }
  52832. private function expandStability($stability)
  52833. {
  52834. $stability = strtolower($stability);
  52835. switch ($stability) {
  52836. case 'a':
  52837. return 'alpha';
  52838. case 'b':
  52839. return 'beta';
  52840. case 'p':
  52841. case 'pl':
  52842. return 'patch';
  52843. case 'rc':
  52844. return 'RC';
  52845. default:
  52846. return $stability;
  52847. }
  52848. }
  52849. }
  52850. Copyright (C) 2015 Composer
  52851. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52852. this software and associated documentation files (the "Software"), to deal in
  52853. the Software without restriction, including without limitation the rights to
  52854. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52855. of the Software, and to permit persons to whom the Software is furnished to do
  52856. so, subject to the following conditions:
  52857. The above copyright notice and this permission notice shall be included in all
  52858. copies or substantial portions of the Software.
  52859. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52860. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52861. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52862. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52863. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52864. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52865. SOFTWARE.
  52866. {
  52867. "389-exception": [
  52868. "389 Directory Server Exception"
  52869. ],
  52870. "Asterisk-exception": [
  52871. "Asterisk exception"
  52872. ],
  52873. "Autoconf-exception-2.0": [
  52874. "Autoconf exception 2.0"
  52875. ],
  52876. "Autoconf-exception-3.0": [
  52877. "Autoconf exception 3.0"
  52878. ],
  52879. "Autoconf-exception-generic": [
  52880. "Autoconf generic exception"
  52881. ],
  52882. "Autoconf-exception-generic-3.0": [
  52883. "Autoconf generic exception for GPL-3.0"
  52884. ],
  52885. "Autoconf-exception-macro": [
  52886. "Autoconf macro exception"
  52887. ],
  52888. "Bison-exception-2.2": [
  52889. "Bison exception 2.2"
  52890. ],
  52891. "Bootloader-exception": [
  52892. "Bootloader Distribution Exception"
  52893. ],
  52894. "Classpath-exception-2.0": [
  52895. "Classpath exception 2.0"
  52896. ],
  52897. "CLISP-exception-2.0": [
  52898. "CLISP exception 2.0"
  52899. ],
  52900. "cryptsetup-OpenSSL-exception": [
  52901. "cryptsetup OpenSSL exception"
  52902. ],
  52903. "DigiRule-FOSS-exception": [
  52904. "DigiRule FOSS License Exception"
  52905. ],
  52906. "eCos-exception-2.0": [
  52907. "eCos exception 2.0"
  52908. ],
  52909. "Fawkes-Runtime-exception": [
  52910. "Fawkes Runtime Exception"
  52911. ],
  52912. "FLTK-exception": [
  52913. "FLTK exception"
  52914. ],
  52915. "Font-exception-2.0": [
  52916. "Font exception 2.0"
  52917. ],
  52918. "freertos-exception-2.0": [
  52919. "FreeRTOS Exception 2.0"
  52920. ],
  52921. "GCC-exception-2.0": [
  52922. "GCC Runtime Library exception 2.0"
  52923. ],
  52924. "GCC-exception-2.0-note": [
  52925. "GCC Runtime Library exception 2.0 - note variant"
  52926. ],
  52927. "GCC-exception-3.1": [
  52928. "GCC Runtime Library exception 3.1"
  52929. ],
  52930. "GNAT-exception": [
  52931. "GNAT exception"
  52932. ],
  52933. "GNU-compiler-exception": [
  52934. "GNU Compiler Exception"
  52935. ],
  52936. "gnu-javamail-exception": [
  52937. "GNU JavaMail exception"
  52938. ],
  52939. "GPL-3.0-interface-exception": [
  52940. "GPL-3.0 Interface Exception"
  52941. ],
  52942. "GPL-3.0-linking-exception": [
  52943. "GPL-3.0 Linking Exception"
  52944. ],
  52945. "GPL-3.0-linking-source-exception": [
  52946. "GPL-3.0 Linking Exception (with Corresponding Source)"
  52947. ],
  52948. "GPL-CC-1.0": [
  52949. "GPL Cooperation Commitment 1.0"
  52950. ],
  52951. "GStreamer-exception-2005": [
  52952. "GStreamer Exception (2005)"
  52953. ],
  52954. "GStreamer-exception-2008": [
  52955. "GStreamer Exception (2008)"
  52956. ],
  52957. "i2p-gpl-java-exception": [
  52958. "i2p GPL+Java Exception"
  52959. ],
  52960. "KiCad-libraries-exception": [
  52961. "KiCad Libraries Exception"
  52962. ],
  52963. "LGPL-3.0-linking-exception": [
  52964. "LGPL-3.0 Linking Exception"
  52965. ],
  52966. "libpri-OpenH323-exception": [
  52967. "libpri OpenH323 exception"
  52968. ],
  52969. "Libtool-exception": [
  52970. "Libtool Exception"
  52971. ],
  52972. "Linux-syscall-note": [
  52973. "Linux Syscall Note"
  52974. ],
  52975. "LLGPL": [
  52976. "LLGPL Preamble"
  52977. ],
  52978. "LLVM-exception": [
  52979. "LLVM Exception"
  52980. ],
  52981. "LZMA-exception": [
  52982. "LZMA exception"
  52983. ],
  52984. "mif-exception": [
  52985. "Macros and Inline Functions Exception"
  52986. ],
  52987. "Nokia-Qt-exception-1.1": [
  52988. "Nokia Qt LGPL exception 1.1"
  52989. ],
  52990. "OCaml-LGPL-linking-exception": [
  52991. "OCaml LGPL Linking Exception"
  52992. ],
  52993. "OCCT-exception-1.0": [
  52994. "Open CASCADE Exception 1.0"
  52995. ],
  52996. "OpenJDK-assembly-exception-1.0": [
  52997. "OpenJDK Assembly exception 1.0"
  52998. ],
  52999. "openvpn-openssl-exception": [
  53000. "OpenVPN OpenSSL Exception"
  53001. ],
  53002. "PS-or-PDF-font-exception-20170817": [
  53003. "PS/PDF font exception (2017-08-17)"
  53004. ],
  53005. "QPL-1.0-INRIA-2004-exception": [
  53006. "INRIA QPL 1.0 2004 variant exception"
  53007. ],
  53008. "Qt-GPL-exception-1.0": [
  53009. "Qt GPL exception 1.0"
  53010. ],
  53011. "Qt-LGPL-exception-1.1": [
  53012. "Qt LGPL exception 1.1"
  53013. ],
  53014. "Qwt-exception-1.0": [
  53015. "Qwt exception 1.0"
  53016. ],
  53017. "SANE-exception": [
  53018. "SANE Exception"
  53019. ],
  53020. "SHL-2.0": [
  53021. "Solderpad Hardware License v2.0"
  53022. ],
  53023. "SHL-2.1": [
  53024. "Solderpad Hardware License v2.1"
  53025. ],
  53026. "stunnel-exception": [
  53027. "stunnel Exception"
  53028. ],
  53029. "SWI-exception": [
  53030. "SWI exception"
  53031. ],
  53032. "Swift-exception": [
  53033. "Swift Exception"
  53034. ],
  53035. "Texinfo-exception": [
  53036. "Texinfo exception"
  53037. ],
  53038. "u-boot-exception-2.0": [
  53039. "U-Boot exception 2.0"
  53040. ],
  53041. "UBDL-exception": [
  53042. "Unmodified Binary Distribution exception"
  53043. ],
  53044. "Universal-FOSS-exception-1.0": [
  53045. "Universal FOSS Exception, Version 1.0"
  53046. ],
  53047. "vsftpd-openssl-exception": [
  53048. "vsftpd OpenSSL exception"
  53049. ],
  53050. "WxWindows-exception-3.1": [
  53051. "WxWindows Library Exception 3.1"
  53052. ],
  53053. "x11vnc-openssl-exception": [
  53054. "x11vnc OpenSSL Exception"
  53055. ]
  53056. }{
  53057. "0BSD": [
  53058. "BSD Zero Clause License",
  53059. true,
  53060. false
  53061. ],
  53062. "AAL": [
  53063. "Attribution Assurance License",
  53064. true,
  53065. false
  53066. ],
  53067. "Abstyles": [
  53068. "Abstyles License",
  53069. false,
  53070. false
  53071. ],
  53072. "AdaCore-doc": [
  53073. "AdaCore Doc License",
  53074. false,
  53075. false
  53076. ],
  53077. "Adobe-2006": [
  53078. "Adobe Systems Incorporated Source Code License Agreement",
  53079. false,
  53080. false
  53081. ],
  53082. "Adobe-Display-PostScript": [
  53083. "Adobe Display PostScript License",
  53084. false,
  53085. false
  53086. ],
  53087. "Adobe-Glyph": [
  53088. "Adobe Glyph List License",
  53089. false,
  53090. false
  53091. ],
  53092. "Adobe-Utopia": [
  53093. "Adobe Utopia Font License",
  53094. false,
  53095. false
  53096. ],
  53097. "ADSL": [
  53098. "Amazon Digital Services License",
  53099. false,
  53100. false
  53101. ],
  53102. "AFL-1.1": [
  53103. "Academic Free License v1.1",
  53104. true,
  53105. false
  53106. ],
  53107. "AFL-1.2": [
  53108. "Academic Free License v1.2",
  53109. true,
  53110. false
  53111. ],
  53112. "AFL-2.0": [
  53113. "Academic Free License v2.0",
  53114. true,
  53115. false
  53116. ],
  53117. "AFL-2.1": [
  53118. "Academic Free License v2.1",
  53119. true,
  53120. false
  53121. ],
  53122. "AFL-3.0": [
  53123. "Academic Free License v3.0",
  53124. true,
  53125. false
  53126. ],
  53127. "Afmparse": [
  53128. "Afmparse License",
  53129. false,
  53130. false
  53131. ],
  53132. "AGPL-1.0": [
  53133. "Affero General Public License v1.0",
  53134. false,
  53135. true
  53136. ],
  53137. "AGPL-1.0-only": [
  53138. "Affero General Public License v1.0 only",
  53139. false,
  53140. false
  53141. ],
  53142. "AGPL-1.0-or-later": [
  53143. "Affero General Public License v1.0 or later",
  53144. false,
  53145. false
  53146. ],
  53147. "AGPL-3.0": [
  53148. "GNU Affero General Public License v3.0",
  53149. true,
  53150. true
  53151. ],
  53152. "AGPL-3.0-only": [
  53153. "GNU Affero General Public License v3.0 only",
  53154. true,
  53155. false
  53156. ],
  53157. "AGPL-3.0-or-later": [
  53158. "GNU Affero General Public License v3.0 or later",
  53159. true,
  53160. false
  53161. ],
  53162. "Aladdin": [
  53163. "Aladdin Free Public License",
  53164. false,
  53165. false
  53166. ],
  53167. "AMDPLPA": [
  53168. "AMD's plpa_map.c License",
  53169. false,
  53170. false
  53171. ],
  53172. "AML": [
  53173. "Apple MIT License",
  53174. false,
  53175. false
  53176. ],
  53177. "AML-glslang": [
  53178. "AML glslang variant License",
  53179. false,
  53180. false
  53181. ],
  53182. "AMPAS": [
  53183. "Academy of Motion Picture Arts and Sciences BSD",
  53184. false,
  53185. false
  53186. ],
  53187. "ANTLR-PD": [
  53188. "ANTLR Software Rights Notice",
  53189. false,
  53190. false
  53191. ],
  53192. "ANTLR-PD-fallback": [
  53193. "ANTLR Software Rights Notice with license fallback",
  53194. false,
  53195. false
  53196. ],
  53197. "Apache-1.0": [
  53198. "Apache License 1.0",
  53199. false,
  53200. false
  53201. ],
  53202. "Apache-1.1": [
  53203. "Apache License 1.1",
  53204. true,
  53205. false
  53206. ],
  53207. "Apache-2.0": [
  53208. "Apache License 2.0",
  53209. true,
  53210. false
  53211. ],
  53212. "APAFML": [
  53213. "Adobe Postscript AFM License",
  53214. false,
  53215. false
  53216. ],
  53217. "APL-1.0": [
  53218. "Adaptive Public License 1.0",
  53219. true,
  53220. false
  53221. ],
  53222. "App-s2p": [
  53223. "App::s2p License",
  53224. false,
  53225. false
  53226. ],
  53227. "APSL-1.0": [
  53228. "Apple Public Source License 1.0",
  53229. true,
  53230. false
  53231. ],
  53232. "APSL-1.1": [
  53233. "Apple Public Source License 1.1",
  53234. true,
  53235. false
  53236. ],
  53237. "APSL-1.2": [
  53238. "Apple Public Source License 1.2",
  53239. true,
  53240. false
  53241. ],
  53242. "APSL-2.0": [
  53243. "Apple Public Source License 2.0",
  53244. true,
  53245. false
  53246. ],
  53247. "Arphic-1999": [
  53248. "Arphic Public License",
  53249. false,
  53250. false
  53251. ],
  53252. "Artistic-1.0": [
  53253. "Artistic License 1.0",
  53254. true,
  53255. false
  53256. ],
  53257. "Artistic-1.0-cl8": [
  53258. "Artistic License 1.0 w/clause 8",
  53259. true,
  53260. false
  53261. ],
  53262. "Artistic-1.0-Perl": [
  53263. "Artistic License 1.0 (Perl)",
  53264. true,
  53265. false
  53266. ],
  53267. "Artistic-2.0": [
  53268. "Artistic License 2.0",
  53269. true,
  53270. false
  53271. ],
  53272. "ASWF-Digital-Assets-1.0": [
  53273. "ASWF Digital Assets License version 1.0",
  53274. false,
  53275. false
  53276. ],
  53277. "ASWF-Digital-Assets-1.1": [
  53278. "ASWF Digital Assets License 1.1",
  53279. false,
  53280. false
  53281. ],
  53282. "Baekmuk": [
  53283. "Baekmuk License",
  53284. false,
  53285. false
  53286. ],
  53287. "Bahyph": [
  53288. "Bahyph License",
  53289. false,
  53290. false
  53291. ],
  53292. "Barr": [
  53293. "Barr License",
  53294. false,
  53295. false
  53296. ],
  53297. "Beerware": [
  53298. "Beerware License",
  53299. false,
  53300. false
  53301. ],
  53302. "Bitstream-Charter": [
  53303. "Bitstream Charter Font License",
  53304. false,
  53305. false
  53306. ],
  53307. "Bitstream-Vera": [
  53308. "Bitstream Vera Font License",
  53309. false,
  53310. false
  53311. ],
  53312. "BitTorrent-1.0": [
  53313. "BitTorrent Open Source License v1.0",
  53314. false,
  53315. false
  53316. ],
  53317. "BitTorrent-1.1": [
  53318. "BitTorrent Open Source License v1.1",
  53319. false,
  53320. false
  53321. ],
  53322. "blessing": [
  53323. "SQLite Blessing",
  53324. false,
  53325. false
  53326. ],
  53327. "BlueOak-1.0.0": [
  53328. "Blue Oak Model License 1.0.0",
  53329. false,
  53330. false
  53331. ],
  53332. "Boehm-GC": [
  53333. "Boehm-Demers-Weiser GC License",
  53334. false,
  53335. false
  53336. ],
  53337. "Borceux": [
  53338. "Borceux license",
  53339. false,
  53340. false
  53341. ],
  53342. "Brian-Gladman-3-Clause": [
  53343. "Brian Gladman 3-Clause License",
  53344. false,
  53345. false
  53346. ],
  53347. "BSD-1-Clause": [
  53348. "BSD 1-Clause License",
  53349. true,
  53350. false
  53351. ],
  53352. "BSD-2-Clause": [
  53353. "BSD 2-Clause \"Simplified\" License",
  53354. true,
  53355. false
  53356. ],
  53357. "BSD-2-Clause-FreeBSD": [
  53358. "BSD 2-Clause FreeBSD License",
  53359. false,
  53360. true
  53361. ],
  53362. "BSD-2-Clause-NetBSD": [
  53363. "BSD 2-Clause NetBSD License",
  53364. false,
  53365. true
  53366. ],
  53367. "BSD-2-Clause-Patent": [
  53368. "BSD-2-Clause Plus Patent License",
  53369. true,
  53370. false
  53371. ],
  53372. "BSD-2-Clause-Views": [
  53373. "BSD 2-Clause with views sentence",
  53374. false,
  53375. false
  53376. ],
  53377. "BSD-3-Clause": [
  53378. "BSD 3-Clause \"New\" or \"Revised\" License",
  53379. true,
  53380. false
  53381. ],
  53382. "BSD-3-Clause-Attribution": [
  53383. "BSD with attribution",
  53384. false,
  53385. false
  53386. ],
  53387. "BSD-3-Clause-Clear": [
  53388. "BSD 3-Clause Clear License",
  53389. false,
  53390. false
  53391. ],
  53392. "BSD-3-Clause-flex": [
  53393. "BSD 3-Clause Flex variant",
  53394. false,
  53395. false
  53396. ],
  53397. "BSD-3-Clause-HP": [
  53398. "Hewlett-Packard BSD variant license",
  53399. false,
  53400. false
  53401. ],
  53402. "BSD-3-Clause-LBNL": [
  53403. "Lawrence Berkeley National Labs BSD variant license",
  53404. true,
  53405. false
  53406. ],
  53407. "BSD-3-Clause-Modification": [
  53408. "BSD 3-Clause Modification",
  53409. false,
  53410. false
  53411. ],
  53412. "BSD-3-Clause-No-Military-License": [
  53413. "BSD 3-Clause No Military License",
  53414. false,
  53415. false
  53416. ],
  53417. "BSD-3-Clause-No-Nuclear-License": [
  53418. "BSD 3-Clause No Nuclear License",
  53419. false,
  53420. false
  53421. ],
  53422. "BSD-3-Clause-No-Nuclear-License-2014": [
  53423. "BSD 3-Clause No Nuclear License 2014",
  53424. false,
  53425. false
  53426. ],
  53427. "BSD-3-Clause-No-Nuclear-Warranty": [
  53428. "BSD 3-Clause No Nuclear Warranty",
  53429. false,
  53430. false
  53431. ],
  53432. "BSD-3-Clause-Open-MPI": [
  53433. "BSD 3-Clause Open MPI variant",
  53434. false,
  53435. false
  53436. ],
  53437. "BSD-3-Clause-Sun": [
  53438. "BSD 3-Clause Sun Microsystems",
  53439. false,
  53440. false
  53441. ],
  53442. "BSD-4-Clause": [
  53443. "BSD 4-Clause \"Original\" or \"Old\" License",
  53444. false,
  53445. false
  53446. ],
  53447. "BSD-4-Clause-Shortened": [
  53448. "BSD 4 Clause Shortened",
  53449. false,
  53450. false
  53451. ],
  53452. "BSD-4-Clause-UC": [
  53453. "BSD-4-Clause (University of California-Specific)",
  53454. false,
  53455. false
  53456. ],
  53457. "BSD-4.3RENO": [
  53458. "BSD 4.3 RENO License",
  53459. false,
  53460. false
  53461. ],
  53462. "BSD-4.3TAHOE": [
  53463. "BSD 4.3 TAHOE License",
  53464. false,
  53465. false
  53466. ],
  53467. "BSD-Advertising-Acknowledgement": [
  53468. "BSD Advertising Acknowledgement License",
  53469. false,
  53470. false
  53471. ],
  53472. "BSD-Attribution-HPND-disclaimer": [
  53473. "BSD with Attribution and HPND disclaimer",
  53474. false,
  53475. false
  53476. ],
  53477. "BSD-Inferno-Nettverk": [
  53478. "BSD-Inferno-Nettverk",
  53479. false,
  53480. false
  53481. ],
  53482. "BSD-Protection": [
  53483. "BSD Protection License",
  53484. false,
  53485. false
  53486. ],
  53487. "BSD-Source-Code": [
  53488. "BSD Source Code Attribution",
  53489. false,
  53490. false
  53491. ],
  53492. "BSD-Systemics": [
  53493. "Systemics BSD variant license",
  53494. false,
  53495. false
  53496. ],
  53497. "BSL-1.0": [
  53498. "Boost Software License 1.0",
  53499. true,
  53500. false
  53501. ],
  53502. "BUSL-1.1": [
  53503. "Business Source License 1.1",
  53504. false,
  53505. false
  53506. ],
  53507. "bzip2-1.0.5": [
  53508. "bzip2 and libbzip2 License v1.0.5",
  53509. false,
  53510. true
  53511. ],
  53512. "bzip2-1.0.6": [
  53513. "bzip2 and libbzip2 License v1.0.6",
  53514. false,
  53515. false
  53516. ],
  53517. "C-UDA-1.0": [
  53518. "Computational Use of Data Agreement v1.0",
  53519. false,
  53520. false
  53521. ],
  53522. "CAL-1.0": [
  53523. "Cryptographic Autonomy License 1.0",
  53524. true,
  53525. false
  53526. ],
  53527. "CAL-1.0-Combined-Work-Exception": [
  53528. "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
  53529. true,
  53530. false
  53531. ],
  53532. "Caldera": [
  53533. "Caldera License",
  53534. false,
  53535. false
  53536. ],
  53537. "CATOSL-1.1": [
  53538. "Computer Associates Trusted Open Source License 1.1",
  53539. true,
  53540. false
  53541. ],
  53542. "CC-BY-1.0": [
  53543. "Creative Commons Attribution 1.0 Generic",
  53544. false,
  53545. false
  53546. ],
  53547. "CC-BY-2.0": [
  53548. "Creative Commons Attribution 2.0 Generic",
  53549. false,
  53550. false
  53551. ],
  53552. "CC-BY-2.5": [
  53553. "Creative Commons Attribution 2.5 Generic",
  53554. false,
  53555. false
  53556. ],
  53557. "CC-BY-2.5-AU": [
  53558. "Creative Commons Attribution 2.5 Australia",
  53559. false,
  53560. false
  53561. ],
  53562. "CC-BY-3.0": [
  53563. "Creative Commons Attribution 3.0 Unported",
  53564. false,
  53565. false
  53566. ],
  53567. "CC-BY-3.0-AT": [
  53568. "Creative Commons Attribution 3.0 Austria",
  53569. false,
  53570. false
  53571. ],
  53572. "CC-BY-3.0-DE": [
  53573. "Creative Commons Attribution 3.0 Germany",
  53574. false,
  53575. false
  53576. ],
  53577. "CC-BY-3.0-IGO": [
  53578. "Creative Commons Attribution 3.0 IGO",
  53579. false,
  53580. false
  53581. ],
  53582. "CC-BY-3.0-NL": [
  53583. "Creative Commons Attribution 3.0 Netherlands",
  53584. false,
  53585. false
  53586. ],
  53587. "CC-BY-3.0-US": [
  53588. "Creative Commons Attribution 3.0 United States",
  53589. false,
  53590. false
  53591. ],
  53592. "CC-BY-4.0": [
  53593. "Creative Commons Attribution 4.0 International",
  53594. false,
  53595. false
  53596. ],
  53597. "CC-BY-NC-1.0": [
  53598. "Creative Commons Attribution Non Commercial 1.0 Generic",
  53599. false,
  53600. false
  53601. ],
  53602. "CC-BY-NC-2.0": [
  53603. "Creative Commons Attribution Non Commercial 2.0 Generic",
  53604. false,
  53605. false
  53606. ],
  53607. "CC-BY-NC-2.5": [
  53608. "Creative Commons Attribution Non Commercial 2.5 Generic",
  53609. false,
  53610. false
  53611. ],
  53612. "CC-BY-NC-3.0": [
  53613. "Creative Commons Attribution Non Commercial 3.0 Unported",
  53614. false,
  53615. false
  53616. ],
  53617. "CC-BY-NC-3.0-DE": [
  53618. "Creative Commons Attribution Non Commercial 3.0 Germany",
  53619. false,
  53620. false
  53621. ],
  53622. "CC-BY-NC-4.0": [
  53623. "Creative Commons Attribution Non Commercial 4.0 International",
  53624. false,
  53625. false
  53626. ],
  53627. "CC-BY-NC-ND-1.0": [
  53628. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  53629. false,
  53630. false
  53631. ],
  53632. "CC-BY-NC-ND-2.0": [
  53633. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  53634. false,
  53635. false
  53636. ],
  53637. "CC-BY-NC-ND-2.5": [
  53638. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  53639. false,
  53640. false
  53641. ],
  53642. "CC-BY-NC-ND-3.0": [
  53643. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  53644. false,
  53645. false
  53646. ],
  53647. "CC-BY-NC-ND-3.0-DE": [
  53648. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany",
  53649. false,
  53650. false
  53651. ],
  53652. "CC-BY-NC-ND-3.0-IGO": [
  53653. "Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO",
  53654. false,
  53655. false
  53656. ],
  53657. "CC-BY-NC-ND-4.0": [
  53658. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  53659. false,
  53660. false
  53661. ],
  53662. "CC-BY-NC-SA-1.0": [
  53663. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  53664. false,
  53665. false
  53666. ],
  53667. "CC-BY-NC-SA-2.0": [
  53668. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  53669. false,
  53670. false
  53671. ],
  53672. "CC-BY-NC-SA-2.0-DE": [
  53673. "Creative Commons Attribution Non Commercial Share Alike 2.0 Germany",
  53674. false,
  53675. false
  53676. ],
  53677. "CC-BY-NC-SA-2.0-FR": [
  53678. "Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France",
  53679. false,
  53680. false
  53681. ],
  53682. "CC-BY-NC-SA-2.0-UK": [
  53683. "Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales",
  53684. false,
  53685. false
  53686. ],
  53687. "CC-BY-NC-SA-2.5": [
  53688. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  53689. false,
  53690. false
  53691. ],
  53692. "CC-BY-NC-SA-3.0": [
  53693. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  53694. false,
  53695. false
  53696. ],
  53697. "CC-BY-NC-SA-3.0-DE": [
  53698. "Creative Commons Attribution Non Commercial Share Alike 3.0 Germany",
  53699. false,
  53700. false
  53701. ],
  53702. "CC-BY-NC-SA-3.0-IGO": [
  53703. "Creative Commons Attribution Non Commercial Share Alike 3.0 IGO",
  53704. false,
  53705. false
  53706. ],
  53707. "CC-BY-NC-SA-4.0": [
  53708. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  53709. false,
  53710. false
  53711. ],
  53712. "CC-BY-ND-1.0": [
  53713. "Creative Commons Attribution No Derivatives 1.0 Generic",
  53714. false,
  53715. false
  53716. ],
  53717. "CC-BY-ND-2.0": [
  53718. "Creative Commons Attribution No Derivatives 2.0 Generic",
  53719. false,
  53720. false
  53721. ],
  53722. "CC-BY-ND-2.5": [
  53723. "Creative Commons Attribution No Derivatives 2.5 Generic",
  53724. false,
  53725. false
  53726. ],
  53727. "CC-BY-ND-3.0": [
  53728. "Creative Commons Attribution No Derivatives 3.0 Unported",
  53729. false,
  53730. false
  53731. ],
  53732. "CC-BY-ND-3.0-DE": [
  53733. "Creative Commons Attribution No Derivatives 3.0 Germany",
  53734. false,
  53735. false
  53736. ],
  53737. "CC-BY-ND-4.0": [
  53738. "Creative Commons Attribution No Derivatives 4.0 International",
  53739. false,
  53740. false
  53741. ],
  53742. "CC-BY-SA-1.0": [
  53743. "Creative Commons Attribution Share Alike 1.0 Generic",
  53744. false,
  53745. false
  53746. ],
  53747. "CC-BY-SA-2.0": [
  53748. "Creative Commons Attribution Share Alike 2.0 Generic",
  53749. false,
  53750. false
  53751. ],
  53752. "CC-BY-SA-2.0-UK": [
  53753. "Creative Commons Attribution Share Alike 2.0 England and Wales",
  53754. false,
  53755. false
  53756. ],
  53757. "CC-BY-SA-2.1-JP": [
  53758. "Creative Commons Attribution Share Alike 2.1 Japan",
  53759. false,
  53760. false
  53761. ],
  53762. "CC-BY-SA-2.5": [
  53763. "Creative Commons Attribution Share Alike 2.5 Generic",
  53764. false,
  53765. false
  53766. ],
  53767. "CC-BY-SA-3.0": [
  53768. "Creative Commons Attribution Share Alike 3.0 Unported",
  53769. false,
  53770. false
  53771. ],
  53772. "CC-BY-SA-3.0-AT": [
  53773. "Creative Commons Attribution Share Alike 3.0 Austria",
  53774. false,
  53775. false
  53776. ],
  53777. "CC-BY-SA-3.0-DE": [
  53778. "Creative Commons Attribution Share Alike 3.0 Germany",
  53779. false,
  53780. false
  53781. ],
  53782. "CC-BY-SA-3.0-IGO": [
  53783. "Creative Commons Attribution-ShareAlike 3.0 IGO",
  53784. false,
  53785. false
  53786. ],
  53787. "CC-BY-SA-4.0": [
  53788. "Creative Commons Attribution Share Alike 4.0 International",
  53789. false,
  53790. false
  53791. ],
  53792. "CC-PDDC": [
  53793. "Creative Commons Public Domain Dedication and Certification",
  53794. false,
  53795. false
  53796. ],
  53797. "CC0-1.0": [
  53798. "Creative Commons Zero v1.0 Universal",
  53799. false,
  53800. false
  53801. ],
  53802. "CDDL-1.0": [
  53803. "Common Development and Distribution License 1.0",
  53804. true,
  53805. false
  53806. ],
  53807. "CDDL-1.1": [
  53808. "Common Development and Distribution License 1.1",
  53809. false,
  53810. false
  53811. ],
  53812. "CDL-1.0": [
  53813. "Common Documentation License 1.0",
  53814. false,
  53815. false
  53816. ],
  53817. "CDLA-Permissive-1.0": [
  53818. "Community Data License Agreement Permissive 1.0",
  53819. false,
  53820. false
  53821. ],
  53822. "CDLA-Permissive-2.0": [
  53823. "Community Data License Agreement Permissive 2.0",
  53824. false,
  53825. false
  53826. ],
  53827. "CDLA-Sharing-1.0": [
  53828. "Community Data License Agreement Sharing 1.0",
  53829. false,
  53830. false
  53831. ],
  53832. "CECILL-1.0": [
  53833. "CeCILL Free Software License Agreement v1.0",
  53834. false,
  53835. false
  53836. ],
  53837. "CECILL-1.1": [
  53838. "CeCILL Free Software License Agreement v1.1",
  53839. false,
  53840. false
  53841. ],
  53842. "CECILL-2.0": [
  53843. "CeCILL Free Software License Agreement v2.0",
  53844. false,
  53845. false
  53846. ],
  53847. "CECILL-2.1": [
  53848. "CeCILL Free Software License Agreement v2.1",
  53849. true,
  53850. false
  53851. ],
  53852. "CECILL-B": [
  53853. "CeCILL-B Free Software License Agreement",
  53854. false,
  53855. false
  53856. ],
  53857. "CECILL-C": [
  53858. "CeCILL-C Free Software License Agreement",
  53859. false,
  53860. false
  53861. ],
  53862. "CERN-OHL-1.1": [
  53863. "CERN Open Hardware Licence v1.1",
  53864. false,
  53865. false
  53866. ],
  53867. "CERN-OHL-1.2": [
  53868. "CERN Open Hardware Licence v1.2",
  53869. false,
  53870. false
  53871. ],
  53872. "CERN-OHL-P-2.0": [
  53873. "CERN Open Hardware Licence Version 2 - Permissive",
  53874. true,
  53875. false
  53876. ],
  53877. "CERN-OHL-S-2.0": [
  53878. "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
  53879. true,
  53880. false
  53881. ],
  53882. "CERN-OHL-W-2.0": [
  53883. "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
  53884. true,
  53885. false
  53886. ],
  53887. "CFITSIO": [
  53888. "CFITSIO License",
  53889. false,
  53890. false
  53891. ],
  53892. "check-cvs": [
  53893. "check-cvs License",
  53894. false,
  53895. false
  53896. ],
  53897. "checkmk": [
  53898. "Checkmk License",
  53899. false,
  53900. false
  53901. ],
  53902. "ClArtistic": [
  53903. "Clarified Artistic License",
  53904. false,
  53905. false
  53906. ],
  53907. "Clips": [
  53908. "Clips License",
  53909. false,
  53910. false
  53911. ],
  53912. "CMU-Mach": [
  53913. "CMU Mach License",
  53914. false,
  53915. false
  53916. ],
  53917. "CNRI-Jython": [
  53918. "CNRI Jython License",
  53919. false,
  53920. false
  53921. ],
  53922. "CNRI-Python": [
  53923. "CNRI Python License",
  53924. true,
  53925. false
  53926. ],
  53927. "CNRI-Python-GPL-Compatible": [
  53928. "CNRI Python Open Source GPL Compatible License Agreement",
  53929. false,
  53930. false
  53931. ],
  53932. "COIL-1.0": [
  53933. "Copyfree Open Innovation License",
  53934. false,
  53935. false
  53936. ],
  53937. "Community-Spec-1.0": [
  53938. "Community Specification License 1.0",
  53939. false,
  53940. false
  53941. ],
  53942. "Condor-1.1": [
  53943. "Condor Public License v1.1",
  53944. false,
  53945. false
  53946. ],
  53947. "copyleft-next-0.3.0": [
  53948. "copyleft-next 0.3.0",
  53949. false,
  53950. false
  53951. ],
  53952. "copyleft-next-0.3.1": [
  53953. "copyleft-next 0.3.1",
  53954. false,
  53955. false
  53956. ],
  53957. "Cornell-Lossless-JPEG": [
  53958. "Cornell Lossless JPEG License",
  53959. false,
  53960. false
  53961. ],
  53962. "CPAL-1.0": [
  53963. "Common Public Attribution License 1.0",
  53964. true,
  53965. false
  53966. ],
  53967. "CPL-1.0": [
  53968. "Common Public License 1.0",
  53969. true,
  53970. false
  53971. ],
  53972. "CPOL-1.02": [
  53973. "Code Project Open License 1.02",
  53974. false,
  53975. false
  53976. ],
  53977. "Cronyx": [
  53978. "Cronyx License",
  53979. false,
  53980. false
  53981. ],
  53982. "Crossword": [
  53983. "Crossword License",
  53984. false,
  53985. false
  53986. ],
  53987. "CrystalStacker": [
  53988. "CrystalStacker License",
  53989. false,
  53990. false
  53991. ],
  53992. "CUA-OPL-1.0": [
  53993. "CUA Office Public License v1.0",
  53994. true,
  53995. false
  53996. ],
  53997. "Cube": [
  53998. "Cube License",
  53999. false,
  54000. false
  54001. ],
  54002. "curl": [
  54003. "curl License",
  54004. false,
  54005. false
  54006. ],
  54007. "D-FSL-1.0": [
  54008. "Deutsche Freie Software Lizenz",
  54009. false,
  54010. false
  54011. ],
  54012. "DEC-3-Clause": [
  54013. "DEC 3-Clause License",
  54014. false,
  54015. false
  54016. ],
  54017. "diffmark": [
  54018. "diffmark license",
  54019. false,
  54020. false
  54021. ],
  54022. "DL-DE-BY-2.0": [
  54023. "Data licence Germany \u2013 attribution \u2013 version 2.0",
  54024. false,
  54025. false
  54026. ],
  54027. "DL-DE-ZERO-2.0": [
  54028. "Data licence Germany \u2013 zero \u2013 version 2.0",
  54029. false,
  54030. false
  54031. ],
  54032. "DOC": [
  54033. "DOC License",
  54034. false,
  54035. false
  54036. ],
  54037. "Dotseqn": [
  54038. "Dotseqn License",
  54039. false,
  54040. false
  54041. ],
  54042. "DRL-1.0": [
  54043. "Detection Rule License 1.0",
  54044. false,
  54045. false
  54046. ],
  54047. "DRL-1.1": [
  54048. "Detection Rule License 1.1",
  54049. false,
  54050. false
  54051. ],
  54052. "DSDP": [
  54053. "DSDP License",
  54054. false,
  54055. false
  54056. ],
  54057. "dtoa": [
  54058. "David M. Gay dtoa License",
  54059. false,
  54060. false
  54061. ],
  54062. "dvipdfm": [
  54063. "dvipdfm License",
  54064. false,
  54065. false
  54066. ],
  54067. "ECL-1.0": [
  54068. "Educational Community License v1.0",
  54069. true,
  54070. false
  54071. ],
  54072. "ECL-2.0": [
  54073. "Educational Community License v2.0",
  54074. true,
  54075. false
  54076. ],
  54077. "eCos-2.0": [
  54078. "eCos license version 2.0",
  54079. false,
  54080. true
  54081. ],
  54082. "EFL-1.0": [
  54083. "Eiffel Forum License v1.0",
  54084. true,
  54085. false
  54086. ],
  54087. "EFL-2.0": [
  54088. "Eiffel Forum License v2.0",
  54089. true,
  54090. false
  54091. ],
  54092. "eGenix": [
  54093. "eGenix.com Public License 1.1.0",
  54094. false,
  54095. false
  54096. ],
  54097. "Elastic-2.0": [
  54098. "Elastic License 2.0",
  54099. false,
  54100. false
  54101. ],
  54102. "Entessa": [
  54103. "Entessa Public License v1.0",
  54104. true,
  54105. false
  54106. ],
  54107. "EPICS": [
  54108. "EPICS Open License",
  54109. false,
  54110. false
  54111. ],
  54112. "EPL-1.0": [
  54113. "Eclipse Public License 1.0",
  54114. true,
  54115. false
  54116. ],
  54117. "EPL-2.0": [
  54118. "Eclipse Public License 2.0",
  54119. true,
  54120. false
  54121. ],
  54122. "ErlPL-1.1": [
  54123. "Erlang Public License v1.1",
  54124. false,
  54125. false
  54126. ],
  54127. "etalab-2.0": [
  54128. "Etalab Open License 2.0",
  54129. false,
  54130. false
  54131. ],
  54132. "EUDatagrid": [
  54133. "EU DataGrid Software License",
  54134. true,
  54135. false
  54136. ],
  54137. "EUPL-1.0": [
  54138. "European Union Public License 1.0",
  54139. false,
  54140. false
  54141. ],
  54142. "EUPL-1.1": [
  54143. "European Union Public License 1.1",
  54144. true,
  54145. false
  54146. ],
  54147. "EUPL-1.2": [
  54148. "European Union Public License 1.2",
  54149. true,
  54150. false
  54151. ],
  54152. "Eurosym": [
  54153. "Eurosym License",
  54154. false,
  54155. false
  54156. ],
  54157. "Fair": [
  54158. "Fair License",
  54159. true,
  54160. false
  54161. ],
  54162. "FBM": [
  54163. "Fuzzy Bitmap License",
  54164. false,
  54165. false
  54166. ],
  54167. "FDK-AAC": [
  54168. "Fraunhofer FDK AAC Codec Library",
  54169. false,
  54170. false
  54171. ],
  54172. "Ferguson-Twofish": [
  54173. "Ferguson Twofish License",
  54174. false,
  54175. false
  54176. ],
  54177. "Frameworx-1.0": [
  54178. "Frameworx Open License 1.0",
  54179. true,
  54180. false
  54181. ],
  54182. "FreeBSD-DOC": [
  54183. "FreeBSD Documentation License",
  54184. false,
  54185. false
  54186. ],
  54187. "FreeImage": [
  54188. "FreeImage Public License v1.0",
  54189. false,
  54190. false
  54191. ],
  54192. "FSFAP": [
  54193. "FSF All Permissive License",
  54194. false,
  54195. false
  54196. ],
  54197. "FSFUL": [
  54198. "FSF Unlimited License",
  54199. false,
  54200. false
  54201. ],
  54202. "FSFULLR": [
  54203. "FSF Unlimited License (with License Retention)",
  54204. false,
  54205. false
  54206. ],
  54207. "FSFULLRWD": [
  54208. "FSF Unlimited License (With License Retention and Warranty Disclaimer)",
  54209. false,
  54210. false
  54211. ],
  54212. "FTL": [
  54213. "Freetype Project License",
  54214. false,
  54215. false
  54216. ],
  54217. "Furuseth": [
  54218. "Furuseth License",
  54219. false,
  54220. false
  54221. ],
  54222. "fwlw": [
  54223. "fwlw License",
  54224. false,
  54225. false
  54226. ],
  54227. "GCR-docs": [
  54228. "Gnome GCR Documentation License",
  54229. false,
  54230. false
  54231. ],
  54232. "GD": [
  54233. "GD License",
  54234. false,
  54235. false
  54236. ],
  54237. "GFDL-1.1": [
  54238. "GNU Free Documentation License v1.1",
  54239. false,
  54240. true
  54241. ],
  54242. "GFDL-1.1-invariants-only": [
  54243. "GNU Free Documentation License v1.1 only - invariants",
  54244. false,
  54245. false
  54246. ],
  54247. "GFDL-1.1-invariants-or-later": [
  54248. "GNU Free Documentation License v1.1 or later - invariants",
  54249. false,
  54250. false
  54251. ],
  54252. "GFDL-1.1-no-invariants-only": [
  54253. "GNU Free Documentation License v1.1 only - no invariants",
  54254. false,
  54255. false
  54256. ],
  54257. "GFDL-1.1-no-invariants-or-later": [
  54258. "GNU Free Documentation License v1.1 or later - no invariants",
  54259. false,
  54260. false
  54261. ],
  54262. "GFDL-1.1-only": [
  54263. "GNU Free Documentation License v1.1 only",
  54264. false,
  54265. false
  54266. ],
  54267. "GFDL-1.1-or-later": [
  54268. "GNU Free Documentation License v1.1 or later",
  54269. false,
  54270. false
  54271. ],
  54272. "GFDL-1.2": [
  54273. "GNU Free Documentation License v1.2",
  54274. false,
  54275. true
  54276. ],
  54277. "GFDL-1.2-invariants-only": [
  54278. "GNU Free Documentation License v1.2 only - invariants",
  54279. false,
  54280. false
  54281. ],
  54282. "GFDL-1.2-invariants-or-later": [
  54283. "GNU Free Documentation License v1.2 or later - invariants",
  54284. false,
  54285. false
  54286. ],
  54287. "GFDL-1.2-no-invariants-only": [
  54288. "GNU Free Documentation License v1.2 only - no invariants",
  54289. false,
  54290. false
  54291. ],
  54292. "GFDL-1.2-no-invariants-or-later": [
  54293. "GNU Free Documentation License v1.2 or later - no invariants",
  54294. false,
  54295. false
  54296. ],
  54297. "GFDL-1.2-only": [
  54298. "GNU Free Documentation License v1.2 only",
  54299. false,
  54300. false
  54301. ],
  54302. "GFDL-1.2-or-later": [
  54303. "GNU Free Documentation License v1.2 or later",
  54304. false,
  54305. false
  54306. ],
  54307. "GFDL-1.3": [
  54308. "GNU Free Documentation License v1.3",
  54309. false,
  54310. true
  54311. ],
  54312. "GFDL-1.3-invariants-only": [
  54313. "GNU Free Documentation License v1.3 only - invariants",
  54314. false,
  54315. false
  54316. ],
  54317. "GFDL-1.3-invariants-or-later": [
  54318. "GNU Free Documentation License v1.3 or later - invariants",
  54319. false,
  54320. false
  54321. ],
  54322. "GFDL-1.3-no-invariants-only": [
  54323. "GNU Free Documentation License v1.3 only - no invariants",
  54324. false,
  54325. false
  54326. ],
  54327. "GFDL-1.3-no-invariants-or-later": [
  54328. "GNU Free Documentation License v1.3 or later - no invariants",
  54329. false,
  54330. false
  54331. ],
  54332. "GFDL-1.3-only": [
  54333. "GNU Free Documentation License v1.3 only",
  54334. false,
  54335. false
  54336. ],
  54337. "GFDL-1.3-or-later": [
  54338. "GNU Free Documentation License v1.3 or later",
  54339. false,
  54340. false
  54341. ],
  54342. "Giftware": [
  54343. "Giftware License",
  54344. false,
  54345. false
  54346. ],
  54347. "GL2PS": [
  54348. "GL2PS License",
  54349. false,
  54350. false
  54351. ],
  54352. "Glide": [
  54353. "3dfx Glide License",
  54354. false,
  54355. false
  54356. ],
  54357. "Glulxe": [
  54358. "Glulxe License",
  54359. false,
  54360. false
  54361. ],
  54362. "GLWTPL": [
  54363. "Good Luck With That Public License",
  54364. false,
  54365. false
  54366. ],
  54367. "gnuplot": [
  54368. "gnuplot License",
  54369. false,
  54370. false
  54371. ],
  54372. "GPL-1.0": [
  54373. "GNU General Public License v1.0 only",
  54374. false,
  54375. true
  54376. ],
  54377. "GPL-1.0+": [
  54378. "GNU General Public License v1.0 or later",
  54379. false,
  54380. true
  54381. ],
  54382. "GPL-1.0-only": [
  54383. "GNU General Public License v1.0 only",
  54384. false,
  54385. false
  54386. ],
  54387. "GPL-1.0-or-later": [
  54388. "GNU General Public License v1.0 or later",
  54389. false,
  54390. false
  54391. ],
  54392. "GPL-2.0": [
  54393. "GNU General Public License v2.0 only",
  54394. true,
  54395. true
  54396. ],
  54397. "GPL-2.0+": [
  54398. "GNU General Public License v2.0 or later",
  54399. true,
  54400. true
  54401. ],
  54402. "GPL-2.0-only": [
  54403. "GNU General Public License v2.0 only",
  54404. true,
  54405. false
  54406. ],
  54407. "GPL-2.0-or-later": [
  54408. "GNU General Public License v2.0 or later",
  54409. true,
  54410. false
  54411. ],
  54412. "GPL-2.0-with-autoconf-exception": [
  54413. "GNU General Public License v2.0 w/Autoconf exception",
  54414. false,
  54415. true
  54416. ],
  54417. "GPL-2.0-with-bison-exception": [
  54418. "GNU General Public License v2.0 w/Bison exception",
  54419. false,
  54420. true
  54421. ],
  54422. "GPL-2.0-with-classpath-exception": [
  54423. "GNU General Public License v2.0 w/Classpath exception",
  54424. false,
  54425. true
  54426. ],
  54427. "GPL-2.0-with-font-exception": [
  54428. "GNU General Public License v2.0 w/Font exception",
  54429. false,
  54430. true
  54431. ],
  54432. "GPL-2.0-with-GCC-exception": [
  54433. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  54434. false,
  54435. true
  54436. ],
  54437. "GPL-3.0": [
  54438. "GNU General Public License v3.0 only",
  54439. true,
  54440. true
  54441. ],
  54442. "GPL-3.0+": [
  54443. "GNU General Public License v3.0 or later",
  54444. true,
  54445. true
  54446. ],
  54447. "GPL-3.0-only": [
  54448. "GNU General Public License v3.0 only",
  54449. true,
  54450. false
  54451. ],
  54452. "GPL-3.0-or-later": [
  54453. "GNU General Public License v3.0 or later",
  54454. true,
  54455. false
  54456. ],
  54457. "GPL-3.0-with-autoconf-exception": [
  54458. "GNU General Public License v3.0 w/Autoconf exception",
  54459. false,
  54460. true
  54461. ],
  54462. "GPL-3.0-with-GCC-exception": [
  54463. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  54464. true,
  54465. true
  54466. ],
  54467. "Graphics-Gems": [
  54468. "Graphics Gems License",
  54469. false,
  54470. false
  54471. ],
  54472. "gSOAP-1.3b": [
  54473. "gSOAP Public License v1.3b",
  54474. false,
  54475. false
  54476. ],
  54477. "HaskellReport": [
  54478. "Haskell Language Report License",
  54479. false,
  54480. false
  54481. ],
  54482. "hdparm": [
  54483. "hdparm License",
  54484. false,
  54485. false
  54486. ],
  54487. "Hippocratic-2.1": [
  54488. "Hippocratic License 2.1",
  54489. false,
  54490. false
  54491. ],
  54492. "HP-1986": [
  54493. "Hewlett-Packard 1986 License",
  54494. false,
  54495. false
  54496. ],
  54497. "HP-1989": [
  54498. "Hewlett-Packard 1989 License",
  54499. false,
  54500. false
  54501. ],
  54502. "HPND": [
  54503. "Historical Permission Notice and Disclaimer",
  54504. true,
  54505. false
  54506. ],
  54507. "HPND-DEC": [
  54508. "Historical Permission Notice and Disclaimer - DEC variant",
  54509. false,
  54510. false
  54511. ],
  54512. "HPND-doc": [
  54513. "Historical Permission Notice and Disclaimer - documentation variant",
  54514. false,
  54515. false
  54516. ],
  54517. "HPND-doc-sell": [
  54518. "Historical Permission Notice and Disclaimer - documentation sell variant",
  54519. false,
  54520. false
  54521. ],
  54522. "HPND-export-US": [
  54523. "HPND with US Government export control warning",
  54524. false,
  54525. false
  54526. ],
  54527. "HPND-export-US-modify": [
  54528. "HPND with US Government export control warning and modification rqmt",
  54529. false,
  54530. false
  54531. ],
  54532. "HPND-Markus-Kuhn": [
  54533. "Historical Permission Notice and Disclaimer - Markus Kuhn variant",
  54534. false,
  54535. false
  54536. ],
  54537. "HPND-Pbmplus": [
  54538. "Historical Permission Notice and Disclaimer - Pbmplus variant",
  54539. false,
  54540. false
  54541. ],
  54542. "HPND-sell-MIT-disclaimer-xserver": [
  54543. "Historical Permission Notice and Disclaimer - sell xserver variant with MIT disclaimer",
  54544. false,
  54545. false
  54546. ],
  54547. "HPND-sell-regexpr": [
  54548. "Historical Permission Notice and Disclaimer - sell regexpr variant",
  54549. false,
  54550. false
  54551. ],
  54552. "HPND-sell-variant": [
  54553. "Historical Permission Notice and Disclaimer - sell variant",
  54554. false,
  54555. false
  54556. ],
  54557. "HPND-sell-variant-MIT-disclaimer": [
  54558. "HPND sell variant with MIT disclaimer",
  54559. false,
  54560. false
  54561. ],
  54562. "HPND-UC": [
  54563. "Historical Permission Notice and Disclaimer - University of California variant",
  54564. false,
  54565. false
  54566. ],
  54567. "HTMLTIDY": [
  54568. "HTML Tidy License",
  54569. false,
  54570. false
  54571. ],
  54572. "IBM-pibs": [
  54573. "IBM PowerPC Initialization and Boot Software",
  54574. false,
  54575. false
  54576. ],
  54577. "ICU": [
  54578. "ICU License",
  54579. true,
  54580. false
  54581. ],
  54582. "IEC-Code-Components-EULA": [
  54583. "IEC Code Components End-user licence agreement",
  54584. false,
  54585. false
  54586. ],
  54587. "IJG": [
  54588. "Independent JPEG Group License",
  54589. false,
  54590. false
  54591. ],
  54592. "IJG-short": [
  54593. "Independent JPEG Group License - short",
  54594. false,
  54595. false
  54596. ],
  54597. "ImageMagick": [
  54598. "ImageMagick License",
  54599. false,
  54600. false
  54601. ],
  54602. "iMatix": [
  54603. "iMatix Standard Function Library Agreement",
  54604. false,
  54605. false
  54606. ],
  54607. "Imlib2": [
  54608. "Imlib2 License",
  54609. false,
  54610. false
  54611. ],
  54612. "Info-ZIP": [
  54613. "Info-ZIP License",
  54614. false,
  54615. false
  54616. ],
  54617. "Inner-Net-2.0": [
  54618. "Inner Net License v2.0",
  54619. false,
  54620. false
  54621. ],
  54622. "Intel": [
  54623. "Intel Open Source License",
  54624. true,
  54625. false
  54626. ],
  54627. "Intel-ACPI": [
  54628. "Intel ACPI Software License Agreement",
  54629. false,
  54630. false
  54631. ],
  54632. "Interbase-1.0": [
  54633. "Interbase Public License v1.0",
  54634. false,
  54635. false
  54636. ],
  54637. "IPA": [
  54638. "IPA Font License",
  54639. true,
  54640. false
  54641. ],
  54642. "IPL-1.0": [
  54643. "IBM Public License v1.0",
  54644. true,
  54645. false
  54646. ],
  54647. "ISC": [
  54648. "ISC License",
  54649. true,
  54650. false
  54651. ],
  54652. "Jam": [
  54653. "Jam License",
  54654. true,
  54655. false
  54656. ],
  54657. "JasPer-2.0": [
  54658. "JasPer License",
  54659. false,
  54660. false
  54661. ],
  54662. "JPL-image": [
  54663. "JPL Image Use Policy",
  54664. false,
  54665. false
  54666. ],
  54667. "JPNIC": [
  54668. "Japan Network Information Center License",
  54669. false,
  54670. false
  54671. ],
  54672. "JSON": [
  54673. "JSON License",
  54674. false,
  54675. false
  54676. ],
  54677. "Kastrup": [
  54678. "Kastrup License",
  54679. false,
  54680. false
  54681. ],
  54682. "Kazlib": [
  54683. "Kazlib License",
  54684. false,
  54685. false
  54686. ],
  54687. "Knuth-CTAN": [
  54688. "Knuth CTAN License",
  54689. false,
  54690. false
  54691. ],
  54692. "LAL-1.2": [
  54693. "Licence Art Libre 1.2",
  54694. false,
  54695. false
  54696. ],
  54697. "LAL-1.3": [
  54698. "Licence Art Libre 1.3",
  54699. false,
  54700. false
  54701. ],
  54702. "Latex2e": [
  54703. "Latex2e License",
  54704. false,
  54705. false
  54706. ],
  54707. "Latex2e-translated-notice": [
  54708. "Latex2e with translated notice permission",
  54709. false,
  54710. false
  54711. ],
  54712. "Leptonica": [
  54713. "Leptonica License",
  54714. false,
  54715. false
  54716. ],
  54717. "LGPL-2.0": [
  54718. "GNU Library General Public License v2 only",
  54719. true,
  54720. true
  54721. ],
  54722. "LGPL-2.0+": [
  54723. "GNU Library General Public License v2 or later",
  54724. true,
  54725. true
  54726. ],
  54727. "LGPL-2.0-only": [
  54728. "GNU Library General Public License v2 only",
  54729. true,
  54730. false
  54731. ],
  54732. "LGPL-2.0-or-later": [
  54733. "GNU Library General Public License v2 or later",
  54734. true,
  54735. false
  54736. ],
  54737. "LGPL-2.1": [
  54738. "GNU Lesser General Public License v2.1 only",
  54739. true,
  54740. true
  54741. ],
  54742. "LGPL-2.1+": [
  54743. "GNU Lesser General Public License v2.1 or later",
  54744. true,
  54745. true
  54746. ],
  54747. "LGPL-2.1-only": [
  54748. "GNU Lesser General Public License v2.1 only",
  54749. true,
  54750. false
  54751. ],
  54752. "LGPL-2.1-or-later": [
  54753. "GNU Lesser General Public License v2.1 or later",
  54754. true,
  54755. false
  54756. ],
  54757. "LGPL-3.0": [
  54758. "GNU Lesser General Public License v3.0 only",
  54759. true,
  54760. true
  54761. ],
  54762. "LGPL-3.0+": [
  54763. "GNU Lesser General Public License v3.0 or later",
  54764. true,
  54765. true
  54766. ],
  54767. "LGPL-3.0-only": [
  54768. "GNU Lesser General Public License v3.0 only",
  54769. true,
  54770. false
  54771. ],
  54772. "LGPL-3.0-or-later": [
  54773. "GNU Lesser General Public License v3.0 or later",
  54774. true,
  54775. false
  54776. ],
  54777. "LGPLLR": [
  54778. "Lesser General Public License For Linguistic Resources",
  54779. false,
  54780. false
  54781. ],
  54782. "Libpng": [
  54783. "libpng License",
  54784. false,
  54785. false
  54786. ],
  54787. "libpng-2.0": [
  54788. "PNG Reference Library version 2",
  54789. false,
  54790. false
  54791. ],
  54792. "libselinux-1.0": [
  54793. "libselinux public domain notice",
  54794. false,
  54795. false
  54796. ],
  54797. "libtiff": [
  54798. "libtiff License",
  54799. false,
  54800. false
  54801. ],
  54802. "libutil-David-Nugent": [
  54803. "libutil David Nugent License",
  54804. false,
  54805. false
  54806. ],
  54807. "LiLiQ-P-1.1": [
  54808. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  54809. true,
  54810. false
  54811. ],
  54812. "LiLiQ-R-1.1": [
  54813. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  54814. true,
  54815. false
  54816. ],
  54817. "LiLiQ-Rplus-1.1": [
  54818. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  54819. true,
  54820. false
  54821. ],
  54822. "Linux-man-pages-1-para": [
  54823. "Linux man-pages - 1 paragraph",
  54824. false,
  54825. false
  54826. ],
  54827. "Linux-man-pages-copyleft": [
  54828. "Linux man-pages Copyleft",
  54829. false,
  54830. false
  54831. ],
  54832. "Linux-man-pages-copyleft-2-para": [
  54833. "Linux man-pages Copyleft - 2 paragraphs",
  54834. false,
  54835. false
  54836. ],
  54837. "Linux-man-pages-copyleft-var": [
  54838. "Linux man-pages Copyleft Variant",
  54839. false,
  54840. false
  54841. ],
  54842. "Linux-OpenIB": [
  54843. "Linux Kernel Variant of OpenIB.org license",
  54844. false,
  54845. false
  54846. ],
  54847. "LOOP": [
  54848. "Common Lisp LOOP License",
  54849. false,
  54850. false
  54851. ],
  54852. "LPL-1.0": [
  54853. "Lucent Public License Version 1.0",
  54854. true,
  54855. false
  54856. ],
  54857. "LPL-1.02": [
  54858. "Lucent Public License v1.02",
  54859. true,
  54860. false
  54861. ],
  54862. "LPPL-1.0": [
  54863. "LaTeX Project Public License v1.0",
  54864. false,
  54865. false
  54866. ],
  54867. "LPPL-1.1": [
  54868. "LaTeX Project Public License v1.1",
  54869. false,
  54870. false
  54871. ],
  54872. "LPPL-1.2": [
  54873. "LaTeX Project Public License v1.2",
  54874. false,
  54875. false
  54876. ],
  54877. "LPPL-1.3a": [
  54878. "LaTeX Project Public License v1.3a",
  54879. false,
  54880. false
  54881. ],
  54882. "LPPL-1.3c": [
  54883. "LaTeX Project Public License v1.3c",
  54884. true,
  54885. false
  54886. ],
  54887. "lsof": [
  54888. "lsof License",
  54889. false,
  54890. false
  54891. ],
  54892. "Lucida-Bitmap-Fonts": [
  54893. "Lucida Bitmap Fonts License",
  54894. false,
  54895. false
  54896. ],
  54897. "LZMA-SDK-9.11-to-9.20": [
  54898. "LZMA SDK License (versions 9.11 to 9.20)",
  54899. false,
  54900. false
  54901. ],
  54902. "LZMA-SDK-9.22": [
  54903. "LZMA SDK License (versions 9.22 and beyond)",
  54904. false,
  54905. false
  54906. ],
  54907. "magaz": [
  54908. "magaz License",
  54909. false,
  54910. false
  54911. ],
  54912. "MakeIndex": [
  54913. "MakeIndex License",
  54914. false,
  54915. false
  54916. ],
  54917. "Martin-Birgmeier": [
  54918. "Martin Birgmeier License",
  54919. false,
  54920. false
  54921. ],
  54922. "McPhee-slideshow": [
  54923. "McPhee Slideshow License",
  54924. false,
  54925. false
  54926. ],
  54927. "metamail": [
  54928. "metamail License",
  54929. false,
  54930. false
  54931. ],
  54932. "Minpack": [
  54933. "Minpack License",
  54934. false,
  54935. false
  54936. ],
  54937. "MirOS": [
  54938. "The MirOS Licence",
  54939. true,
  54940. false
  54941. ],
  54942. "MIT": [
  54943. "MIT License",
  54944. true,
  54945. false
  54946. ],
  54947. "MIT-0": [
  54948. "MIT No Attribution",
  54949. true,
  54950. false
  54951. ],
  54952. "MIT-advertising": [
  54953. "Enlightenment License (e16)",
  54954. false,
  54955. false
  54956. ],
  54957. "MIT-CMU": [
  54958. "CMU License",
  54959. false,
  54960. false
  54961. ],
  54962. "MIT-enna": [
  54963. "enna License",
  54964. false,
  54965. false
  54966. ],
  54967. "MIT-feh": [
  54968. "feh License",
  54969. false,
  54970. false
  54971. ],
  54972. "MIT-Festival": [
  54973. "MIT Festival Variant",
  54974. false,
  54975. false
  54976. ],
  54977. "MIT-Modern-Variant": [
  54978. "MIT License Modern Variant",
  54979. true,
  54980. false
  54981. ],
  54982. "MIT-open-group": [
  54983. "MIT Open Group variant",
  54984. false,
  54985. false
  54986. ],
  54987. "MIT-testregex": [
  54988. "MIT testregex Variant",
  54989. false,
  54990. false
  54991. ],
  54992. "MIT-Wu": [
  54993. "MIT Tom Wu Variant",
  54994. false,
  54995. false
  54996. ],
  54997. "MITNFA": [
  54998. "MIT +no-false-attribs license",
  54999. false,
  55000. false
  55001. ],
  55002. "MMIXware": [
  55003. "MMIXware License",
  55004. false,
  55005. false
  55006. ],
  55007. "Motosoto": [
  55008. "Motosoto License",
  55009. true,
  55010. false
  55011. ],
  55012. "MPEG-SSG": [
  55013. "MPEG Software Simulation",
  55014. false,
  55015. false
  55016. ],
  55017. "mpi-permissive": [
  55018. "mpi Permissive License",
  55019. false,
  55020. false
  55021. ],
  55022. "mpich2": [
  55023. "mpich2 License",
  55024. false,
  55025. false
  55026. ],
  55027. "MPL-1.0": [
  55028. "Mozilla Public License 1.0",
  55029. true,
  55030. false
  55031. ],
  55032. "MPL-1.1": [
  55033. "Mozilla Public License 1.1",
  55034. true,
  55035. false
  55036. ],
  55037. "MPL-2.0": [
  55038. "Mozilla Public License 2.0",
  55039. true,
  55040. false
  55041. ],
  55042. "MPL-2.0-no-copyleft-exception": [
  55043. "Mozilla Public License 2.0 (no copyleft exception)",
  55044. true,
  55045. false
  55046. ],
  55047. "mplus": [
  55048. "mplus Font License",
  55049. false,
  55050. false
  55051. ],
  55052. "MS-LPL": [
  55053. "Microsoft Limited Public License",
  55054. false,
  55055. false
  55056. ],
  55057. "MS-PL": [
  55058. "Microsoft Public License",
  55059. true,
  55060. false
  55061. ],
  55062. "MS-RL": [
  55063. "Microsoft Reciprocal License",
  55064. true,
  55065. false
  55066. ],
  55067. "MTLL": [
  55068. "Matrix Template Library License",
  55069. false,
  55070. false
  55071. ],
  55072. "MulanPSL-1.0": [
  55073. "Mulan Permissive Software License, Version 1",
  55074. false,
  55075. false
  55076. ],
  55077. "MulanPSL-2.0": [
  55078. "Mulan Permissive Software License, Version 2",
  55079. true,
  55080. false
  55081. ],
  55082. "Multics": [
  55083. "Multics License",
  55084. true,
  55085. false
  55086. ],
  55087. "Mup": [
  55088. "Mup License",
  55089. false,
  55090. false
  55091. ],
  55092. "NAIST-2003": [
  55093. "Nara Institute of Science and Technology License (2003)",
  55094. false,
  55095. false
  55096. ],
  55097. "NASA-1.3": [
  55098. "NASA Open Source Agreement 1.3",
  55099. true,
  55100. false
  55101. ],
  55102. "Naumen": [
  55103. "Naumen Public License",
  55104. true,
  55105. false
  55106. ],
  55107. "NBPL-1.0": [
  55108. "Net Boolean Public License v1",
  55109. false,
  55110. false
  55111. ],
  55112. "NCGL-UK-2.0": [
  55113. "Non-Commercial Government Licence",
  55114. false,
  55115. false
  55116. ],
  55117. "NCSA": [
  55118. "University of Illinois/NCSA Open Source License",
  55119. true,
  55120. false
  55121. ],
  55122. "Net-SNMP": [
  55123. "Net-SNMP License",
  55124. false,
  55125. false
  55126. ],
  55127. "NetCDF": [
  55128. "NetCDF license",
  55129. false,
  55130. false
  55131. ],
  55132. "Newsletr": [
  55133. "Newsletr License",
  55134. false,
  55135. false
  55136. ],
  55137. "NGPL": [
  55138. "Nethack General Public License",
  55139. true,
  55140. false
  55141. ],
  55142. "NICTA-1.0": [
  55143. "NICTA Public Software License, Version 1.0",
  55144. false,
  55145. false
  55146. ],
  55147. "NIST-PD": [
  55148. "NIST Public Domain Notice",
  55149. false,
  55150. false
  55151. ],
  55152. "NIST-PD-fallback": [
  55153. "NIST Public Domain Notice with license fallback",
  55154. false,
  55155. false
  55156. ],
  55157. "NIST-Software": [
  55158. "NIST Software License",
  55159. false,
  55160. false
  55161. ],
  55162. "NLOD-1.0": [
  55163. "Norwegian Licence for Open Government Data (NLOD) 1.0",
  55164. false,
  55165. false
  55166. ],
  55167. "NLOD-2.0": [
  55168. "Norwegian Licence for Open Government Data (NLOD) 2.0",
  55169. false,
  55170. false
  55171. ],
  55172. "NLPL": [
  55173. "No Limit Public License",
  55174. false,
  55175. false
  55176. ],
  55177. "Nokia": [
  55178. "Nokia Open Source License",
  55179. true,
  55180. false
  55181. ],
  55182. "NOSL": [
  55183. "Netizen Open Source License",
  55184. false,
  55185. false
  55186. ],
  55187. "Noweb": [
  55188. "Noweb License",
  55189. false,
  55190. false
  55191. ],
  55192. "NPL-1.0": [
  55193. "Netscape Public License v1.0",
  55194. false,
  55195. false
  55196. ],
  55197. "NPL-1.1": [
  55198. "Netscape Public License v1.1",
  55199. false,
  55200. false
  55201. ],
  55202. "NPOSL-3.0": [
  55203. "Non-Profit Open Software License 3.0",
  55204. true,
  55205. false
  55206. ],
  55207. "NRL": [
  55208. "NRL License",
  55209. false,
  55210. false
  55211. ],
  55212. "NTP": [
  55213. "NTP License",
  55214. true,
  55215. false
  55216. ],
  55217. "NTP-0": [
  55218. "NTP No Attribution",
  55219. false,
  55220. false
  55221. ],
  55222. "Nunit": [
  55223. "Nunit License",
  55224. false,
  55225. true
  55226. ],
  55227. "O-UDA-1.0": [
  55228. "Open Use of Data Agreement v1.0",
  55229. false,
  55230. false
  55231. ],
  55232. "OCCT-PL": [
  55233. "Open CASCADE Technology Public License",
  55234. false,
  55235. false
  55236. ],
  55237. "OCLC-2.0": [
  55238. "OCLC Research Public License 2.0",
  55239. true,
  55240. false
  55241. ],
  55242. "ODbL-1.0": [
  55243. "Open Data Commons Open Database License v1.0",
  55244. false,
  55245. false
  55246. ],
  55247. "ODC-By-1.0": [
  55248. "Open Data Commons Attribution License v1.0",
  55249. false,
  55250. false
  55251. ],
  55252. "OFFIS": [
  55253. "OFFIS License",
  55254. false,
  55255. false
  55256. ],
  55257. "OFL-1.0": [
  55258. "SIL Open Font License 1.0",
  55259. false,
  55260. false
  55261. ],
  55262. "OFL-1.0-no-RFN": [
  55263. "SIL Open Font License 1.0 with no Reserved Font Name",
  55264. false,
  55265. false
  55266. ],
  55267. "OFL-1.0-RFN": [
  55268. "SIL Open Font License 1.0 with Reserved Font Name",
  55269. false,
  55270. false
  55271. ],
  55272. "OFL-1.1": [
  55273. "SIL Open Font License 1.1",
  55274. true,
  55275. false
  55276. ],
  55277. "OFL-1.1-no-RFN": [
  55278. "SIL Open Font License 1.1 with no Reserved Font Name",
  55279. true,
  55280. false
  55281. ],
  55282. "OFL-1.1-RFN": [
  55283. "SIL Open Font License 1.1 with Reserved Font Name",
  55284. true,
  55285. false
  55286. ],
  55287. "OGC-1.0": [
  55288. "OGC Software License, Version 1.0",
  55289. false,
  55290. false
  55291. ],
  55292. "OGDL-Taiwan-1.0": [
  55293. "Taiwan Open Government Data License, version 1.0",
  55294. false,
  55295. false
  55296. ],
  55297. "OGL-Canada-2.0": [
  55298. "Open Government Licence - Canada",
  55299. false,
  55300. false
  55301. ],
  55302. "OGL-UK-1.0": [
  55303. "Open Government Licence v1.0",
  55304. false,
  55305. false
  55306. ],
  55307. "OGL-UK-2.0": [
  55308. "Open Government Licence v2.0",
  55309. false,
  55310. false
  55311. ],
  55312. "OGL-UK-3.0": [
  55313. "Open Government Licence v3.0",
  55314. false,
  55315. false
  55316. ],
  55317. "OGTSL": [
  55318. "Open Group Test Suite License",
  55319. true,
  55320. false
  55321. ],
  55322. "OLDAP-1.1": [
  55323. "Open LDAP Public License v1.1",
  55324. false,
  55325. false
  55326. ],
  55327. "OLDAP-1.2": [
  55328. "Open LDAP Public License v1.2",
  55329. false,
  55330. false
  55331. ],
  55332. "OLDAP-1.3": [
  55333. "Open LDAP Public License v1.3",
  55334. false,
  55335. false
  55336. ],
  55337. "OLDAP-1.4": [
  55338. "Open LDAP Public License v1.4",
  55339. false,
  55340. false
  55341. ],
  55342. "OLDAP-2.0": [
  55343. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  55344. false,
  55345. false
  55346. ],
  55347. "OLDAP-2.0.1": [
  55348. "Open LDAP Public License v2.0.1",
  55349. false,
  55350. false
  55351. ],
  55352. "OLDAP-2.1": [
  55353. "Open LDAP Public License v2.1",
  55354. false,
  55355. false
  55356. ],
  55357. "OLDAP-2.2": [
  55358. "Open LDAP Public License v2.2",
  55359. false,
  55360. false
  55361. ],
  55362. "OLDAP-2.2.1": [
  55363. "Open LDAP Public License v2.2.1",
  55364. false,
  55365. false
  55366. ],
  55367. "OLDAP-2.2.2": [
  55368. "Open LDAP Public License 2.2.2",
  55369. false,
  55370. false
  55371. ],
  55372. "OLDAP-2.3": [
  55373. "Open LDAP Public License v2.3",
  55374. false,
  55375. false
  55376. ],
  55377. "OLDAP-2.4": [
  55378. "Open LDAP Public License v2.4",
  55379. false,
  55380. false
  55381. ],
  55382. "OLDAP-2.5": [
  55383. "Open LDAP Public License v2.5",
  55384. false,
  55385. false
  55386. ],
  55387. "OLDAP-2.6": [
  55388. "Open LDAP Public License v2.6",
  55389. false,
  55390. false
  55391. ],
  55392. "OLDAP-2.7": [
  55393. "Open LDAP Public License v2.7",
  55394. false,
  55395. false
  55396. ],
  55397. "OLDAP-2.8": [
  55398. "Open LDAP Public License v2.8",
  55399. true,
  55400. false
  55401. ],
  55402. "OLFL-1.3": [
  55403. "Open Logistics Foundation License Version 1.3",
  55404. true,
  55405. false
  55406. ],
  55407. "OML": [
  55408. "Open Market License",
  55409. false,
  55410. false
  55411. ],
  55412. "OpenPBS-2.3": [
  55413. "OpenPBS v2.3 Software License",
  55414. false,
  55415. false
  55416. ],
  55417. "OpenSSL": [
  55418. "OpenSSL License",
  55419. false,
  55420. false
  55421. ],
  55422. "OPL-1.0": [
  55423. "Open Public License v1.0",
  55424. false,
  55425. false
  55426. ],
  55427. "OPL-UK-3.0": [
  55428. "United Kingdom Open Parliament Licence v3.0",
  55429. false,
  55430. false
  55431. ],
  55432. "OPUBL-1.0": [
  55433. "Open Publication License v1.0",
  55434. false,
  55435. false
  55436. ],
  55437. "OSET-PL-2.1": [
  55438. "OSET Public License version 2.1",
  55439. true,
  55440. false
  55441. ],
  55442. "OSL-1.0": [
  55443. "Open Software License 1.0",
  55444. true,
  55445. false
  55446. ],
  55447. "OSL-1.1": [
  55448. "Open Software License 1.1",
  55449. false,
  55450. false
  55451. ],
  55452. "OSL-2.0": [
  55453. "Open Software License 2.0",
  55454. true,
  55455. false
  55456. ],
  55457. "OSL-2.1": [
  55458. "Open Software License 2.1",
  55459. true,
  55460. false
  55461. ],
  55462. "OSL-3.0": [
  55463. "Open Software License 3.0",
  55464. true,
  55465. false
  55466. ],
  55467. "PADL": [
  55468. "PADL License",
  55469. false,
  55470. false
  55471. ],
  55472. "Parity-6.0.0": [
  55473. "The Parity Public License 6.0.0",
  55474. false,
  55475. false
  55476. ],
  55477. "Parity-7.0.0": [
  55478. "The Parity Public License 7.0.0",
  55479. false,
  55480. false
  55481. ],
  55482. "PDDL-1.0": [
  55483. "Open Data Commons Public Domain Dedication & License 1.0",
  55484. false,
  55485. false
  55486. ],
  55487. "PHP-3.0": [
  55488. "PHP License v3.0",
  55489. true,
  55490. false
  55491. ],
  55492. "PHP-3.01": [
  55493. "PHP License v3.01",
  55494. true,
  55495. false
  55496. ],
  55497. "Pixar": [
  55498. "Pixar License",
  55499. false,
  55500. false
  55501. ],
  55502. "Plexus": [
  55503. "Plexus Classworlds License",
  55504. false,
  55505. false
  55506. ],
  55507. "pnmstitch": [
  55508. "pnmstitch License",
  55509. false,
  55510. false
  55511. ],
  55512. "PolyForm-Noncommercial-1.0.0": [
  55513. "PolyForm Noncommercial License 1.0.0",
  55514. false,
  55515. false
  55516. ],
  55517. "PolyForm-Small-Business-1.0.0": [
  55518. "PolyForm Small Business License 1.0.0",
  55519. false,
  55520. false
  55521. ],
  55522. "PostgreSQL": [
  55523. "PostgreSQL License",
  55524. true,
  55525. false
  55526. ],
  55527. "PSF-2.0": [
  55528. "Python Software Foundation License 2.0",
  55529. false,
  55530. false
  55531. ],
  55532. "psfrag": [
  55533. "psfrag License",
  55534. false,
  55535. false
  55536. ],
  55537. "psutils": [
  55538. "psutils License",
  55539. false,
  55540. false
  55541. ],
  55542. "Python-2.0": [
  55543. "Python License 2.0",
  55544. true,
  55545. false
  55546. ],
  55547. "Python-2.0.1": [
  55548. "Python License 2.0.1",
  55549. false,
  55550. false
  55551. ],
  55552. "python-ldap": [
  55553. "Python ldap License",
  55554. false,
  55555. false
  55556. ],
  55557. "Qhull": [
  55558. "Qhull License",
  55559. false,
  55560. false
  55561. ],
  55562. "QPL-1.0": [
  55563. "Q Public License 1.0",
  55564. true,
  55565. false
  55566. ],
  55567. "QPL-1.0-INRIA-2004": [
  55568. "Q Public License 1.0 - INRIA 2004 variant",
  55569. false,
  55570. false
  55571. ],
  55572. "Rdisc": [
  55573. "Rdisc License",
  55574. false,
  55575. false
  55576. ],
  55577. "RHeCos-1.1": [
  55578. "Red Hat eCos Public License v1.1",
  55579. false,
  55580. false
  55581. ],
  55582. "RPL-1.1": [
  55583. "Reciprocal Public License 1.1",
  55584. true,
  55585. false
  55586. ],
  55587. "RPL-1.5": [
  55588. "Reciprocal Public License 1.5",
  55589. true,
  55590. false
  55591. ],
  55592. "RPSL-1.0": [
  55593. "RealNetworks Public Source License v1.0",
  55594. true,
  55595. false
  55596. ],
  55597. "RSA-MD": [
  55598. "RSA Message-Digest License",
  55599. false,
  55600. false
  55601. ],
  55602. "RSCPL": [
  55603. "Ricoh Source Code Public License",
  55604. true,
  55605. false
  55606. ],
  55607. "Ruby": [
  55608. "Ruby License",
  55609. false,
  55610. false
  55611. ],
  55612. "SAX-PD": [
  55613. "Sax Public Domain Notice",
  55614. false,
  55615. false
  55616. ],
  55617. "Saxpath": [
  55618. "Saxpath License",
  55619. false,
  55620. false
  55621. ],
  55622. "SCEA": [
  55623. "SCEA Shared Source License",
  55624. false,
  55625. false
  55626. ],
  55627. "SchemeReport": [
  55628. "Scheme Language Report License",
  55629. false,
  55630. false
  55631. ],
  55632. "Sendmail": [
  55633. "Sendmail License",
  55634. false,
  55635. false
  55636. ],
  55637. "Sendmail-8.23": [
  55638. "Sendmail License 8.23",
  55639. false,
  55640. false
  55641. ],
  55642. "SGI-B-1.0": [
  55643. "SGI Free Software License B v1.0",
  55644. false,
  55645. false
  55646. ],
  55647. "SGI-B-1.1": [
  55648. "SGI Free Software License B v1.1",
  55649. false,
  55650. false
  55651. ],
  55652. "SGI-B-2.0": [
  55653. "SGI Free Software License B v2.0",
  55654. false,
  55655. false
  55656. ],
  55657. "SGI-OpenGL": [
  55658. "SGI OpenGL License",
  55659. false,
  55660. false
  55661. ],
  55662. "SGP4": [
  55663. "SGP4 Permission Notice",
  55664. false,
  55665. false
  55666. ],
  55667. "SHL-0.5": [
  55668. "Solderpad Hardware License v0.5",
  55669. false,
  55670. false
  55671. ],
  55672. "SHL-0.51": [
  55673. "Solderpad Hardware License, Version 0.51",
  55674. false,
  55675. false
  55676. ],
  55677. "SimPL-2.0": [
  55678. "Simple Public License 2.0",
  55679. true,
  55680. false
  55681. ],
  55682. "SISSL": [
  55683. "Sun Industry Standards Source License v1.1",
  55684. true,
  55685. false
  55686. ],
  55687. "SISSL-1.2": [
  55688. "Sun Industry Standards Source License v1.2",
  55689. false,
  55690. false
  55691. ],
  55692. "SL": [
  55693. "SL License",
  55694. false,
  55695. false
  55696. ],
  55697. "Sleepycat": [
  55698. "Sleepycat License",
  55699. true,
  55700. false
  55701. ],
  55702. "SMLNJ": [
  55703. "Standard ML of New Jersey License",
  55704. false,
  55705. false
  55706. ],
  55707. "SMPPL": [
  55708. "Secure Messaging Protocol Public License",
  55709. false,
  55710. false
  55711. ],
  55712. "SNIA": [
  55713. "SNIA Public License 1.1",
  55714. false,
  55715. false
  55716. ],
  55717. "snprintf": [
  55718. "snprintf License",
  55719. false,
  55720. false
  55721. ],
  55722. "Soundex": [
  55723. "Soundex License",
  55724. false,
  55725. false
  55726. ],
  55727. "Spencer-86": [
  55728. "Spencer License 86",
  55729. false,
  55730. false
  55731. ],
  55732. "Spencer-94": [
  55733. "Spencer License 94",
  55734. false,
  55735. false
  55736. ],
  55737. "Spencer-99": [
  55738. "Spencer License 99",
  55739. false,
  55740. false
  55741. ],
  55742. "SPL-1.0": [
  55743. "Sun Public License v1.0",
  55744. true,
  55745. false
  55746. ],
  55747. "ssh-keyscan": [
  55748. "ssh-keyscan License",
  55749. false,
  55750. false
  55751. ],
  55752. "SSH-OpenSSH": [
  55753. "SSH OpenSSH license",
  55754. false,
  55755. false
  55756. ],
  55757. "SSH-short": [
  55758. "SSH short notice",
  55759. false,
  55760. false
  55761. ],
  55762. "SSPL-1.0": [
  55763. "Server Side Public License, v 1",
  55764. false,
  55765. false
  55766. ],
  55767. "StandardML-NJ": [
  55768. "Standard ML of New Jersey License",
  55769. false,
  55770. true
  55771. ],
  55772. "SugarCRM-1.1.3": [
  55773. "SugarCRM Public License v1.1.3",
  55774. false,
  55775. false
  55776. ],
  55777. "SunPro": [
  55778. "SunPro License",
  55779. false,
  55780. false
  55781. ],
  55782. "SWL": [
  55783. "Scheme Widget Library (SWL) Software License Agreement",
  55784. false,
  55785. false
  55786. ],
  55787. "swrule": [
  55788. "swrule License",
  55789. false,
  55790. false
  55791. ],
  55792. "Symlinks": [
  55793. "Symlinks License",
  55794. false,
  55795. false
  55796. ],
  55797. "TAPR-OHL-1.0": [
  55798. "TAPR Open Hardware License v1.0",
  55799. false,
  55800. false
  55801. ],
  55802. "TCL": [
  55803. "TCL/TK License",
  55804. false,
  55805. false
  55806. ],
  55807. "TCP-wrappers": [
  55808. "TCP Wrappers License",
  55809. false,
  55810. false
  55811. ],
  55812. "TermReadKey": [
  55813. "TermReadKey License",
  55814. false,
  55815. false
  55816. ],
  55817. "TMate": [
  55818. "TMate Open Source License",
  55819. false,
  55820. false
  55821. ],
  55822. "TORQUE-1.1": [
  55823. "TORQUE v2.5+ Software License v1.1",
  55824. false,
  55825. false
  55826. ],
  55827. "TOSL": [
  55828. "Trusster Open Source License",
  55829. false,
  55830. false
  55831. ],
  55832. "TPDL": [
  55833. "Time::ParseDate License",
  55834. false,
  55835. false
  55836. ],
  55837. "TPL-1.0": [
  55838. "THOR Public License 1.0",
  55839. false,
  55840. false
  55841. ],
  55842. "TTWL": [
  55843. "Text-Tabs+Wrap License",
  55844. false,
  55845. false
  55846. ],
  55847. "TTYP0": [
  55848. "TTYP0 License",
  55849. false,
  55850. false
  55851. ],
  55852. "TU-Berlin-1.0": [
  55853. "Technische Universitaet Berlin License 1.0",
  55854. false,
  55855. false
  55856. ],
  55857. "TU-Berlin-2.0": [
  55858. "Technische Universitaet Berlin License 2.0",
  55859. false,
  55860. false
  55861. ],
  55862. "UCAR": [
  55863. "UCAR License",
  55864. false,
  55865. false
  55866. ],
  55867. "UCL-1.0": [
  55868. "Upstream Compatibility License v1.0",
  55869. true,
  55870. false
  55871. ],
  55872. "ulem": [
  55873. "ulem License",
  55874. false,
  55875. false
  55876. ],
  55877. "Unicode-DFS-2015": [
  55878. "Unicode License Agreement - Data Files and Software (2015)",
  55879. false,
  55880. false
  55881. ],
  55882. "Unicode-DFS-2016": [
  55883. "Unicode License Agreement - Data Files and Software (2016)",
  55884. true,
  55885. false
  55886. ],
  55887. "Unicode-TOU": [
  55888. "Unicode Terms of Use",
  55889. false,
  55890. false
  55891. ],
  55892. "UnixCrypt": [
  55893. "UnixCrypt License",
  55894. false,
  55895. false
  55896. ],
  55897. "Unlicense": [
  55898. "The Unlicense",
  55899. true,
  55900. false
  55901. ],
  55902. "UPL-1.0": [
  55903. "Universal Permissive License v1.0",
  55904. true,
  55905. false
  55906. ],
  55907. "URT-RLE": [
  55908. "Utah Raster Toolkit Run Length Encoded License",
  55909. false,
  55910. false
  55911. ],
  55912. "Vim": [
  55913. "Vim License",
  55914. false,
  55915. false
  55916. ],
  55917. "VOSTROM": [
  55918. "VOSTROM Public License for Open Source",
  55919. false,
  55920. false
  55921. ],
  55922. "VSL-1.0": [
  55923. "Vovida Software License v1.0",
  55924. true,
  55925. false
  55926. ],
  55927. "W3C": [
  55928. "W3C Software Notice and License (2002-12-31)",
  55929. true,
  55930. false
  55931. ],
  55932. "W3C-19980720": [
  55933. "W3C Software Notice and License (1998-07-20)",
  55934. false,
  55935. false
  55936. ],
  55937. "W3C-20150513": [
  55938. "W3C Software Notice and Document License (2015-05-13)",
  55939. false,
  55940. false
  55941. ],
  55942. "w3m": [
  55943. "w3m License",
  55944. false,
  55945. false
  55946. ],
  55947. "Watcom-1.0": [
  55948. "Sybase Open Watcom Public License 1.0",
  55949. true,
  55950. false
  55951. ],
  55952. "Widget-Workshop": [
  55953. "Widget Workshop License",
  55954. false,
  55955. false
  55956. ],
  55957. "Wsuipa": [
  55958. "Wsuipa License",
  55959. false,
  55960. false
  55961. ],
  55962. "WTFPL": [
  55963. "Do What The F*ck You Want To Public License",
  55964. false,
  55965. false
  55966. ],
  55967. "wxWindows": [
  55968. "wxWindows Library License",
  55969. true,
  55970. true
  55971. ],
  55972. "X11": [
  55973. "X11 License",
  55974. false,
  55975. false
  55976. ],
  55977. "X11-distribute-modifications-variant": [
  55978. "X11 License Distribution Modification Variant",
  55979. false,
  55980. false
  55981. ],
  55982. "Xdebug-1.03": [
  55983. "Xdebug License v 1.03",
  55984. false,
  55985. false
  55986. ],
  55987. "Xerox": [
  55988. "Xerox License",
  55989. false,
  55990. false
  55991. ],
  55992. "Xfig": [
  55993. "Xfig License",
  55994. false,
  55995. false
  55996. ],
  55997. "XFree86-1.1": [
  55998. "XFree86 License 1.1",
  55999. false,
  56000. false
  56001. ],
  56002. "xinetd": [
  56003. "xinetd License",
  56004. false,
  56005. false
  56006. ],
  56007. "xlock": [
  56008. "xlock License",
  56009. false,
  56010. false
  56011. ],
  56012. "Xnet": [
  56013. "X.Net License",
  56014. true,
  56015. false
  56016. ],
  56017. "xpp": [
  56018. "XPP License",
  56019. false,
  56020. false
  56021. ],
  56022. "XSkat": [
  56023. "XSkat License",
  56024. false,
  56025. false
  56026. ],
  56027. "YPL-1.0": [
  56028. "Yahoo! Public License v1.0",
  56029. false,
  56030. false
  56031. ],
  56032. "YPL-1.1": [
  56033. "Yahoo! Public License v1.1",
  56034. false,
  56035. false
  56036. ],
  56037. "Zed": [
  56038. "Zed License",
  56039. false,
  56040. false
  56041. ],
  56042. "Zeeff": [
  56043. "Zeeff License",
  56044. false,
  56045. false
  56046. ],
  56047. "Zend-2.0": [
  56048. "Zend License v2.0",
  56049. false,
  56050. false
  56051. ],
  56052. "Zimbra-1.3": [
  56053. "Zimbra Public License v1.3",
  56054. false,
  56055. false
  56056. ],
  56057. "Zimbra-1.4": [
  56058. "Zimbra Public License v1.4",
  56059. false,
  56060. false
  56061. ],
  56062. "Zlib": [
  56063. "zlib License",
  56064. true,
  56065. false
  56066. ],
  56067. "zlib-acknowledgement": [
  56068. "zlib/libpng License with Acknowledgement",
  56069. false,
  56070. false
  56071. ],
  56072. "ZPL-1.1": [
  56073. "Zope Public License 1.1",
  56074. false,
  56075. false
  56076. ],
  56077. "ZPL-2.0": [
  56078. "Zope Public License 2.0",
  56079. true,
  56080. false
  56081. ],
  56082. "ZPL-2.1": [
  56083. "Zope Public License 2.1",
  56084. true,
  56085. false
  56086. ]
  56087. }<?php
  56088. namespace Composer\Spdx;
  56089. class SpdxLicenses
  56090. {
  56091. const LICENSES_FILE = 'spdx-licenses.json';
  56092. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  56093. private $licenses;
  56094. private $licensesExpression;
  56095. private $exceptions;
  56096. private $exceptionsExpression;
  56097. public function __construct()
  56098. {
  56099. $this->loadLicenses();
  56100. $this->loadExceptions();
  56101. }
  56102. public function getLicenseByIdentifier($identifier)
  56103. {
  56104. $key = strtolower($identifier);
  56105. if (!isset($this->licenses[$key])) {
  56106. return null;
  56107. }
  56108. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  56109. return array(
  56110. $name,
  56111. $isOsiApproved,
  56112. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  56113. $isDeprecatedLicenseId,
  56114. );
  56115. }
  56116. public function getLicenses()
  56117. {
  56118. return $this->licenses;
  56119. }
  56120. public function getExceptionByIdentifier($identifier)
  56121. {
  56122. $key = strtolower($identifier);
  56123. if (!isset($this->exceptions[$key])) {
  56124. return null;
  56125. }
  56126. list($identifier, $name) = $this->exceptions[$key];
  56127. return array(
  56128. $name,
  56129. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  56130. );
  56131. }
  56132. public function getIdentifierByName($name)
  56133. {
  56134. foreach ($this->licenses as $licenseData) {
  56135. if ($licenseData[1] === $name) {
  56136. return $licenseData[0];
  56137. }
  56138. }
  56139. foreach ($this->exceptions as $licenseData) {
  56140. if ($licenseData[1] === $name) {
  56141. return $licenseData[0];
  56142. }
  56143. }
  56144. return null;
  56145. }
  56146. public function isOsiApprovedByIdentifier($identifier)
  56147. {
  56148. return $this->licenses[strtolower($identifier)][2];
  56149. }
  56150. public function isDeprecatedByIdentifier($identifier)
  56151. {
  56152. return $this->licenses[strtolower($identifier)][3];
  56153. }
  56154. public function validate($license)
  56155. {
  56156. if (is_array($license)) {
  56157. $count = count($license);
  56158. if ($count !== count(array_filter($license, 'is_string'))) {
  56159. throw new \InvalidArgumentException('Array of strings expected.');
  56160. }
  56161. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  56162. }
  56163. if (!is_string($license)) {
  56164. throw new \InvalidArgumentException(sprintf(
  56165. 'Array or String expected, %s given.',
  56166. gettype($license)
  56167. ));
  56168. }
  56169. return $this->isValidLicenseString($license);
  56170. }
  56171. public static function getResourcesDir()
  56172. {
  56173. return dirname(__DIR__) . '/res';
  56174. }
  56175. private function loadLicenses()
  56176. {
  56177. if (null !== $this->licenses) {
  56178. return;
  56179. }
  56180. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  56181. if (false === $json) {
  56182. throw new \RuntimeException('Missing license file in ' . self::getResourcesDir() . '/' . self::LICENSES_FILE);
  56183. }
  56184. $this->licenses = array();
  56185. foreach (json_decode($json, true) as $identifier => $license) {
  56186. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  56187. }
  56188. }
  56189. private function loadExceptions()
  56190. {
  56191. if (null !== $this->exceptions) {
  56192. return;
  56193. }
  56194. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  56195. if (false === $json) {
  56196. throw new \RuntimeException('Missing exceptions file in ' . self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  56197. }
  56198. $this->exceptions = array();
  56199. foreach (json_decode($json, true) as $identifier => $exception) {
  56200. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  56201. }
  56202. }
  56203. private function getLicensesExpression()
  56204. {
  56205. if (null === $this->licensesExpression) {
  56206. $licenses = array_map('preg_quote', array_keys($this->licenses));
  56207. rsort($licenses);
  56208. $licenses = implode('|', $licenses);
  56209. $this->licensesExpression = $licenses;
  56210. }
  56211. return $this->licensesExpression;
  56212. }
  56213. private function getExceptionsExpression()
  56214. {
  56215. if (null === $this->exceptionsExpression) {
  56216. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  56217. rsort($exceptions);
  56218. $exceptions = implode('|', $exceptions);
  56219. $this->exceptionsExpression = $exceptions;
  56220. }
  56221. return $this->exceptionsExpression;
  56222. }
  56223. private function isValidLicenseString($license)
  56224. {
  56225. if (isset($this->licenses[strtolower($license)])) {
  56226. return true;
  56227. }
  56228. $licenses = $this->getLicensesExpression();
  56229. $exceptions = $this->getExceptionsExpression();
  56230. $regex = <<<REGEX
  56231. {
  56232. (?(DEFINE)
  56233. # idstring: 1*( ALPHA / DIGIT / - / . )
  56234. (?<idstring>[\pL\pN.-]{1,})
  56235. # license-id: taken from list
  56236. (?<licenseid>{$licenses})
  56237. # license-exception-id: taken from list
  56238. (?<licenseexceptionid>{$exceptions})
  56239. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  56240. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  56241. # simple-expresssion: license-id / license-id+ / license-ref
  56242. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  56243. # compound-expression: 1*(
  56244. # simple-expression /
  56245. # simple-expression WITH license-exception-id /
  56246. # compound-expression AND compound-expression /
  56247. # compound-expression OR compound-expression
  56248. # ) / ( compound-expression ) )
  56249. (?<compound_head>
  56250. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  56251. | \( \s* (?&compound_expression) \s* \)
  56252. )
  56253. (?<compound_expression>
  56254. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  56255. )
  56256. # license-expression: 1*1(simple-expression / compound-expression)
  56257. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  56258. ) # end of define
  56259. ^(NONE | NOASSERTION | (?&license_expression))$
  56260. }xi
  56261. REGEX;
  56262. $match = preg_match($regex, $license);
  56263. if (0 === $match) {
  56264. return false;
  56265. }
  56266. if (false === $match) {
  56267. throw new \RuntimeException('Regex failed to compile/run.');
  56268. }
  56269. return true;
  56270. }
  56271. }
  56272. MIT License
  56273. Copyright (c) 2017 Composer
  56274. Permission is hereby granted, free of charge, to any person obtaining a copy
  56275. of this software and associated documentation files (the "Software"), to deal
  56276. in the Software without restriction, including without limitation the rights
  56277. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  56278. copies of the Software, and to permit persons to whom the Software is
  56279. furnished to do so, subject to the following conditions:
  56280. The above copyright notice and this permission notice shall be included in all
  56281. copies or substantial portions of the Software.
  56282. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  56283. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  56284. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  56285. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  56286. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  56287. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  56288. SOFTWARE.
  56289. <?php
  56290. declare(strict_types=1);
  56291. namespace Composer\XdebugHandler;
  56292. class PhpConfig
  56293. {
  56294. public function useOriginal(): array
  56295. {
  56296. $this->getDataAndReset();
  56297. return [];
  56298. }
  56299. public function useStandard(): array
  56300. {
  56301. $data = $this->getDataAndReset();
  56302. if ($data !== null) {
  56303. return ['-n', '-c', $data['tmpIni']];
  56304. }
  56305. return [];
  56306. }
  56307. public function usePersistent(): array
  56308. {
  56309. $data = $this->getDataAndReset();
  56310. if ($data !== null) {
  56311. $this->updateEnv('PHPRC', $data['tmpIni']);
  56312. $this->updateEnv('PHP_INI_SCAN_DIR', '');
  56313. }
  56314. return [];
  56315. }
  56316. private function getDataAndReset(): ?array
  56317. {
  56318. $data = XdebugHandler::getRestartSettings();
  56319. if ($data !== null) {
  56320. $this->updateEnv('PHPRC', $data['phprc']);
  56321. $this->updateEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  56322. }
  56323. return $data;
  56324. }
  56325. private function updateEnv(string $name, $value): void
  56326. {
  56327. Process::setEnv($name, false !== $value ? $value : null);
  56328. }
  56329. }
  56330. <?php
  56331. declare(strict_types=1);
  56332. namespace Composer\XdebugHandler;
  56333. use Composer\Pcre\Preg;
  56334. class Process
  56335. {
  56336. public static function escape(string $arg, bool $meta = true, bool $module = false): string
  56337. {
  56338. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  56339. return "'".str_replace("'", "'\\''", $arg)."'";
  56340. }
  56341. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  56342. $arg = Preg::replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  56343. $dquotes = (bool) $dquotes;
  56344. if ($meta) {
  56345. $meta = $dquotes || Preg::isMatch('/%[^%]+%/', $arg);
  56346. if (!$meta) {
  56347. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  56348. } elseif ($module && !$dquotes && $quote) {
  56349. $meta = false;
  56350. }
  56351. }
  56352. if ($quote) {
  56353. $arg = '"'.(Preg::replace('/(\\\\*)$/', '$1$1', $arg)).'"';
  56354. }
  56355. if ($meta) {
  56356. $arg = Preg::replace('/(["^&|<>()%])/', '^$1', $arg);
  56357. }
  56358. return $arg;
  56359. }
  56360. public static function escapeShellCommand(array $args): string
  56361. {
  56362. $command = '';
  56363. $module = array_shift($args);
  56364. if ($module !== null) {
  56365. $command = self::escape($module, true, true);
  56366. foreach ($args as $arg) {
  56367. $command .= ' '.self::escape($arg);
  56368. }
  56369. }
  56370. return $command;
  56371. }
  56372. public static function setEnv(string $name, ?string $value = null): bool
  56373. {
  56374. $unset = null === $value;
  56375. if (!putenv($unset ? $name : $name.'='.$value)) {
  56376. return false;
  56377. }
  56378. if ($unset) {
  56379. unset($_SERVER[$name]);
  56380. } else {
  56381. $_SERVER[$name] = $value;
  56382. }
  56383. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  56384. if ($unset) {
  56385. unset($_ENV[$name]);
  56386. } else {
  56387. $_ENV[$name] = $value;
  56388. }
  56389. }
  56390. return true;
  56391. }
  56392. }
  56393. <?php
  56394. declare(strict_types=1);
  56395. namespace Composer\XdebugHandler;
  56396. use Psr\Log\LoggerInterface;
  56397. use Psr\Log\LogLevel;
  56398. class Status
  56399. {
  56400. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  56401. const CHECK = 'Check';
  56402. const ERROR = 'Error';
  56403. const INFO = 'Info';
  56404. const NORESTART = 'NoRestart';
  56405. const RESTART = 'Restart';
  56406. const RESTARTING = 'Restarting';
  56407. const RESTARTED = 'Restarted';
  56408. private $debug;
  56409. private $envAllowXdebug;
  56410. private $loaded;
  56411. private $logger;
  56412. private $modeOff;
  56413. private $time;
  56414. public function __construct(string $envAllowXdebug, bool $debug)
  56415. {
  56416. $start = getenv(self::ENV_RESTART);
  56417. Process::setEnv(self::ENV_RESTART);
  56418. $this->time = is_numeric($start) ? round((microtime(true) - $start) * 1000) : 0;
  56419. $this->envAllowXdebug = $envAllowXdebug;
  56420. $this->debug = $debug && defined('STDERR');
  56421. $this->modeOff = false;
  56422. }
  56423. public function setLogger(LoggerInterface $logger): void
  56424. {
  56425. $this->logger = $logger;
  56426. }
  56427. public function report(string $op, ?string $data): void
  56428. {
  56429. if ($this->logger !== null || $this->debug) {
  56430. $param = (string) $data;
  56431. switch($op) {
  56432. case self::CHECK:
  56433. $this->reportCheck($param);
  56434. break;
  56435. case self::ERROR:
  56436. $this->reportError($param);
  56437. break;
  56438. case self::INFO:
  56439. $this->reportInfo($param);
  56440. break;
  56441. case self::NORESTART:
  56442. $this->reportNoRestart();
  56443. break;
  56444. case self::RESTART:
  56445. $this->reportRestart();
  56446. break;
  56447. case self::RESTARTED:
  56448. $this->reportRestarted();
  56449. break;
  56450. case self::RESTARTING:
  56451. $this->reportRestarting($param);
  56452. break;
  56453. default:
  56454. throw new \InvalidArgumentException('Unknown op handler: '.$op);
  56455. }
  56456. }
  56457. }
  56458. private function output(string $text, ?string $level = null): void
  56459. {
  56460. if ($this->logger !== null) {
  56461. $this->logger->log($level !== null ? $level: LogLevel::DEBUG, $text);
  56462. }
  56463. if ($this->debug) {
  56464. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  56465. }
  56466. }
  56467. private function reportCheck(string $loaded): void
  56468. {
  56469. list($version, $mode) = explode('|', $loaded);
  56470. if ($version !== '') {
  56471. $this->loaded = '('.$version.')'.($mode !== '' ? ' xdebug.mode='.$mode : '');
  56472. }
  56473. $this->modeOff = $mode === 'off';
  56474. $this->output('Checking '.$this->envAllowXdebug);
  56475. }
  56476. private function reportError(string $error): void
  56477. {
  56478. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  56479. }
  56480. private function reportInfo(string $info): void
  56481. {
  56482. $this->output($info);
  56483. }
  56484. private function reportNoRestart(): void
  56485. {
  56486. $this->output($this->getLoadedMessage());
  56487. if ($this->loaded !== null) {
  56488. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  56489. if (!((bool) getenv($this->envAllowXdebug))) {
  56490. $text .= ' Allowed by '.($this->modeOff ? 'xdebug.mode' : 'application');
  56491. }
  56492. $this->output($text);
  56493. }
  56494. }
  56495. private function reportRestart(): void
  56496. {
  56497. $this->output($this->getLoadedMessage());
  56498. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  56499. }
  56500. private function reportRestarted(): void
  56501. {
  56502. $loaded = $this->getLoadedMessage();
  56503. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  56504. $level = $this->loaded !== null ? LogLevel::WARNING : null;
  56505. $this->output($text, $level);
  56506. }
  56507. private function reportRestarting(string $command): void
  56508. {
  56509. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  56510. $this->output($text);
  56511. $text = 'Running: '.$command;
  56512. $this->output($text);
  56513. }
  56514. private function getEnvAllow(): string
  56515. {
  56516. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  56517. }
  56518. private function getLoadedMessage(): string
  56519. {
  56520. $loaded = $this->loaded !== null ? sprintf('loaded %s', $this->loaded) : 'not loaded';
  56521. return 'The Xdebug extension is '.$loaded;
  56522. }
  56523. }
  56524. <?php
  56525. declare(strict_types=1);
  56526. namespace Composer\XdebugHandler;
  56527. use Composer\Pcre\Preg;
  56528. use Psr\Log\LoggerInterface;
  56529. class XdebugHandler
  56530. {
  56531. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  56532. const SUFFIX_INIS = '_ORIGINAL_INIS';
  56533. const RESTART_ID = 'internal';
  56534. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  56535. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  56536. protected $tmpIni;
  56537. private static $inRestart;
  56538. private static $name;
  56539. private static $skipped;
  56540. private static $xdebugActive;
  56541. private static $xdebugMode;
  56542. private static $xdebugVersion;
  56543. private $cli;
  56544. private $debug;
  56545. private $envAllowXdebug;
  56546. private $envOriginalInis;
  56547. private $persistent;
  56548. private $script;
  56549. private $statusWriter;
  56550. public function __construct(string $envPrefix)
  56551. {
  56552. if ($envPrefix === '') {
  56553. throw new \RuntimeException('Invalid constructor parameter');
  56554. }
  56555. self::$name = strtoupper($envPrefix);
  56556. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  56557. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  56558. self::setXdebugDetails();
  56559. self::$inRestart = false;
  56560. if ($this->cli = PHP_SAPI === 'cli') {
  56561. $this->debug = (string) getenv(self::DEBUG);
  56562. }
  56563. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  56564. }
  56565. public function setLogger(LoggerInterface $logger): self
  56566. {
  56567. $this->statusWriter->setLogger($logger);
  56568. return $this;
  56569. }
  56570. public function setMainScript(string $script): self
  56571. {
  56572. $this->script = $script;
  56573. return $this;
  56574. }
  56575. public function setPersistent(): self
  56576. {
  56577. $this->persistent = true;
  56578. return $this;
  56579. }
  56580. public function check(): void
  56581. {
  56582. $this->notify(Status::CHECK, self::$xdebugVersion.'|'.self::$xdebugMode);
  56583. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  56584. if (!((bool) $envArgs[0]) && $this->requiresRestart(self::$xdebugActive)) {
  56585. $this->notify(Status::RESTART);
  56586. $command = $this->prepareRestart();
  56587. if ($command !== null) {
  56588. $this->restart($command);
  56589. }
  56590. return;
  56591. }
  56592. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  56593. $this->notify(Status::RESTARTED);
  56594. Process::setEnv($this->envAllowXdebug);
  56595. self::$inRestart = true;
  56596. if (self::$xdebugVersion === null) {
  56597. self::$skipped = $envArgs[1];
  56598. }
  56599. $this->tryEnableSignals();
  56600. $this->setEnvRestartSettings($envArgs);
  56601. return;
  56602. }
  56603. $this->notify(Status::NORESTART);
  56604. $settings = self::getRestartSettings();
  56605. if ($settings !== null) {
  56606. $this->syncSettings($settings);
  56607. }
  56608. }
  56609. public static function getAllIniFiles(): array
  56610. {
  56611. if (self::$name !== null) {
  56612. $env = getenv(self::$name.self::SUFFIX_INIS);
  56613. if (false !== $env) {
  56614. return explode(PATH_SEPARATOR, $env);
  56615. }
  56616. }
  56617. $paths = [(string) php_ini_loaded_file()];
  56618. $scanned = php_ini_scanned_files();
  56619. if ($scanned !== false) {
  56620. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  56621. }
  56622. return $paths;
  56623. }
  56624. public static function getRestartSettings(): ?array
  56625. {
  56626. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  56627. if (count($envArgs) !== 6
  56628. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  56629. return null;
  56630. }
  56631. return [
  56632. 'tmpIni' => $envArgs[0],
  56633. 'scannedInis' => (bool) $envArgs[1],
  56634. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  56635. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  56636. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  56637. 'skipped' => $envArgs[5],
  56638. ];
  56639. }
  56640. public static function getSkippedVersion(): string
  56641. {
  56642. return (string) self::$skipped;
  56643. }
  56644. public static function isXdebugActive(): bool
  56645. {
  56646. self::setXdebugDetails();
  56647. return self::$xdebugActive;
  56648. }
  56649. protected function requiresRestart(bool $default): bool
  56650. {
  56651. return $default;
  56652. }
  56653. protected function restart(array $command): void
  56654. {
  56655. $this->doRestart($command);
  56656. }
  56657. private function doRestart(array $command): void
  56658. {
  56659. if (PHP_VERSION_ID >= 70400) {
  56660. $cmd = $command;
  56661. $displayCmd = sprintf('[%s]', implode(', ', $cmd));
  56662. } else {
  56663. $cmd = Process::escapeShellCommand($command);
  56664. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  56665. $cmd = '"'.$cmd.'"';
  56666. }
  56667. $displayCmd = $cmd;
  56668. }
  56669. $this->tryEnableSignals();
  56670. $this->notify(Status::RESTARTING, $displayCmd);
  56671. $process = proc_open($cmd, [], $pipes);
  56672. if (is_resource($process)) {
  56673. $exitCode = proc_close($process);
  56674. }
  56675. if (!isset($exitCode)) {
  56676. $this->notify(Status::ERROR, 'Unable to restart process');
  56677. $exitCode = -1;
  56678. } else {
  56679. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  56680. }
  56681. if ($this->debug === '2') {
  56682. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  56683. } else {
  56684. @unlink((string) $this->tmpIni);
  56685. }
  56686. exit($exitCode);
  56687. }
  56688. private function prepareRestart(): ?array
  56689. {
  56690. if (!$this->cli) {
  56691. $this->notify(Status::ERROR, 'Unsupported SAPI: '.PHP_SAPI);
  56692. return null;
  56693. }
  56694. if (($argv = $this->checkServerArgv()) === null) {
  56695. $this->notify(Status::ERROR, '$_SERVER[argv] is not as expected');
  56696. return null;
  56697. }
  56698. if (!$this->checkConfiguration($info)) {
  56699. $this->notify(Status::ERROR, $info);
  56700. return null;
  56701. }
  56702. $mainScript = (string) $this->script;
  56703. if (!$this->checkMainScript($mainScript, $argv)) {
  56704. $this->notify(Status::ERROR, 'Unable to access main script: '.$mainScript);
  56705. return null;
  56706. }
  56707. $tmpDir = sys_get_temp_dir();
  56708. $iniError = 'Unable to create temp ini file at: '.$tmpDir;
  56709. if (($tmpfile = @tempnam($tmpDir, '')) === false) {
  56710. $this->notify(Status::ERROR, $iniError);
  56711. return null;
  56712. }
  56713. $error = null;
  56714. $iniFiles = self::getAllIniFiles();
  56715. $scannedInis = count($iniFiles) > 1;
  56716. if (!$this->writeTmpIni($tmpfile, $iniFiles, $error)) {
  56717. $this->notify(Status::ERROR, $error ?? $iniError);
  56718. @unlink($tmpfile);
  56719. return null;
  56720. }
  56721. if (!$this->setEnvironment($scannedInis, $iniFiles, $tmpfile)) {
  56722. $this->notify(Status::ERROR, 'Unable to set environment variables');
  56723. @unlink($tmpfile);
  56724. return null;
  56725. }
  56726. $this->tmpIni = $tmpfile;
  56727. return $this->getCommand($argv, $tmpfile, $mainScript);
  56728. }
  56729. private function writeTmpIni(string $tmpFile, array $iniFiles, ?string &$error): bool
  56730. {
  56731. if ($iniFiles[0] === '') {
  56732. array_shift($iniFiles);
  56733. }
  56734. $content = '';
  56735. $sectionRegex = '/^\s*\[(?:PATH|HOST)\s*=/mi';
  56736. $xdebugRegex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  56737. foreach ($iniFiles as $file) {
  56738. if (($data = @file_get_contents($file)) === false) {
  56739. $error = 'Unable to read ini: '.$file;
  56740. return false;
  56741. }
  56742. if (Preg::isMatchWithOffsets($sectionRegex, $data, $matches)) {
  56743. $data = substr($data, 0, $matches[0][1]);
  56744. }
  56745. $content .= Preg::replace($xdebugRegex, ';$1', $data).PHP_EOL;
  56746. }
  56747. $config = parse_ini_string($content);
  56748. $loaded = ini_get_all(null, false);
  56749. if (false === $config || false === $loaded) {
  56750. $error = 'Unable to parse ini data';
  56751. return false;
  56752. }
  56753. $content .= $this->mergeLoadedConfig($loaded, $config);
  56754. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  56755. return (bool) @file_put_contents($tmpFile, $content);
  56756. }
  56757. private function getCommand(array $argv, string $tmpIni, string $mainScript): array
  56758. {
  56759. $php = [PHP_BINARY];
  56760. $args = array_slice($argv, 1);
  56761. if (!$this->persistent) {
  56762. array_push($php, '-n', '-c', $tmpIni);
  56763. }
  56764. return array_merge($php, [$mainScript], $args);
  56765. }
  56766. private function setEnvironment(bool $scannedInis, array $iniFiles, string $tmpIni): bool
  56767. {
  56768. $scanDir = getenv('PHP_INI_SCAN_DIR');
  56769. $phprc = getenv('PHPRC');
  56770. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  56771. return false;
  56772. }
  56773. if ($this->persistent) {
  56774. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$tmpIni)) {
  56775. return false;
  56776. }
  56777. }
  56778. $envArgs = [
  56779. self::RESTART_ID,
  56780. self::$xdebugVersion,
  56781. (int) $scannedInis,
  56782. false === $scanDir ? '*' : $scanDir,
  56783. false === $phprc ? '*' : $phprc,
  56784. ];
  56785. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  56786. }
  56787. private function notify(string $op, ?string $data = null): void
  56788. {
  56789. $this->statusWriter->report($op, $data);
  56790. }
  56791. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig): string
  56792. {
  56793. $content = '';
  56794. foreach ($loadedConfig as $name => $value) {
  56795. if (!is_string($value)
  56796. || strpos($name, 'xdebug') === 0
  56797. || $name === 'apc.mmap_file_mask') {
  56798. continue;
  56799. }
  56800. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  56801. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  56802. }
  56803. }
  56804. return $content;
  56805. }
  56806. private function checkMainScript(string &$mainScript, array $argv): bool
  56807. {
  56808. if ($mainScript !== '') {
  56809. return file_exists($mainScript) || '--' === $mainScript;
  56810. }
  56811. if (file_exists($mainScript = $argv[0])) {
  56812. return true;
  56813. }
  56814. $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  56815. $main = end($trace);
  56816. if ($main !== false && isset($main['file'])) {
  56817. return file_exists($mainScript = $main['file']);
  56818. }
  56819. return false;
  56820. }
  56821. private function setEnvRestartSettings(array $envArgs): void
  56822. {
  56823. $settings = [
  56824. php_ini_loaded_file(),
  56825. $envArgs[2],
  56826. $envArgs[3],
  56827. $envArgs[4],
  56828. getenv($this->envOriginalInis),
  56829. self::$skipped,
  56830. ];
  56831. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  56832. }
  56833. private function syncSettings(array $settings): void
  56834. {
  56835. if (false === getenv($this->envOriginalInis)) {
  56836. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  56837. }
  56838. self::$skipped = $settings['skipped'];
  56839. $this->notify(Status::INFO, 'Process called with existing restart settings');
  56840. }
  56841. private function checkConfiguration(?string &$info): bool
  56842. {
  56843. if (!function_exists('proc_open')) {
  56844. $info = 'proc_open function is disabled';
  56845. return false;
  56846. }
  56847. if (!file_exists(PHP_BINARY)) {
  56848. $info = 'PHP_BINARY is not available';
  56849. return false;
  56850. }
  56851. if (extension_loaded('uopz') && !((bool) ini_get('uopz.disable'))) {
  56852. if (function_exists('uopz_allow_exit')) {
  56853. @uopz_allow_exit(true);
  56854. } else {
  56855. $info = 'uopz extension is not compatible';
  56856. return false;
  56857. }
  56858. }
  56859. if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 70400) {
  56860. $workingDir = getcwd();
  56861. if ($workingDir === false) {
  56862. $info = 'unable to determine working directory';
  56863. return false;
  56864. }
  56865. if (0 === strpos($workingDir, '\\\\')) {
  56866. $info = 'cmd.exe does not support UNC paths: '.$workingDir;
  56867. return false;
  56868. }
  56869. }
  56870. return true;
  56871. }
  56872. private function tryEnableSignals(): void
  56873. {
  56874. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  56875. pcntl_async_signals(true);
  56876. $message = 'Async signals enabled';
  56877. if (!self::$inRestart) {
  56878. pcntl_signal(SIGINT, SIG_IGN);
  56879. } elseif (is_int(pcntl_signal_get_handler(SIGINT))) {
  56880. pcntl_signal(SIGINT, SIG_DFL);
  56881. }
  56882. }
  56883. if (!self::$inRestart && function_exists('sapi_windows_set_ctrl_handler')) {
  56884. sapi_windows_set_ctrl_handler(function ($evt) {});
  56885. }
  56886. }
  56887. private function checkServerArgv(): ?array
  56888. {
  56889. $result = [];
  56890. if (isset($_SERVER['argv']) && is_array($_SERVER['argv'])) {
  56891. foreach ($_SERVER['argv'] as $value) {
  56892. if (!is_string($value)) {
  56893. return null;
  56894. }
  56895. $result[] = $value;
  56896. }
  56897. }
  56898. return count($result) > 0 ? $result : null;
  56899. }
  56900. private static function setXdebugDetails(): void
  56901. {
  56902. if (self::$xdebugActive !== null) {
  56903. return;
  56904. }
  56905. self::$xdebugActive = false;
  56906. if (!extension_loaded('xdebug')) {
  56907. return;
  56908. }
  56909. $version = phpversion('xdebug');
  56910. self::$xdebugVersion = $version !== false ? $version : 'unknown';
  56911. if (version_compare(self::$xdebugVersion, '3.1', '>=')) {
  56912. $modes = xdebug_info('mode');
  56913. self::$xdebugMode = count($modes) === 0 ? 'off' : implode(',', $modes);
  56914. self::$xdebugActive = self::$xdebugMode !== 'off';
  56915. return;
  56916. }
  56917. $iniMode = ini_get('xdebug.mode');
  56918. if ($iniMode === false) {
  56919. self::$xdebugActive = true;
  56920. return;
  56921. }
  56922. $envMode = (string) getenv('XDEBUG_MODE');
  56923. if ($envMode !== '') {
  56924. self::$xdebugMode = $envMode;
  56925. } else {
  56926. self::$xdebugMode = $iniMode !== '' ? $iniMode : 'off';
  56927. }
  56928. if (Preg::isMatch('/^,+$/', str_replace(' ', '', self::$xdebugMode))) {
  56929. self::$xdebugMode = 'off';
  56930. }
  56931. self::$xdebugActive = self::$xdebugMode !== 'off';
  56932. }
  56933. }
  56934. MIT License
  56935. Copyright (c) 2016
  56936. Permission is hereby granted, free of charge, to any person obtaining a copy
  56937. of this software and associated documentation files (the "Software"), to deal
  56938. in the Software without restriction, including without limitation the rights
  56939. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  56940. copies of the Software, and to permit persons to whom the Software is
  56941. furnished to do so, subject to the following conditions:
  56942. The above copyright notice and this permission notice shall be included in all
  56943. copies or substantial portions of the Software.
  56944. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  56945. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  56946. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  56947. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  56948. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  56949. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  56950. SOFTWARE.
  56951. <?php
  56952. namespace JsonSchema\Constraints;
  56953. use JsonSchema\Entity\JsonPointer;
  56954. use JsonSchema\Exception\InvalidArgumentException;
  56955. use JsonSchema\Exception\ValidationException;
  56956. use JsonSchema\Validator;
  56957. class BaseConstraint
  56958. {
  56959. protected $errors = array();
  56960. protected $errorMask = Validator::ERROR_NONE;
  56961. protected $factory;
  56962. public function __construct(?Factory $factory = null)
  56963. {
  56964. $this->factory = $factory ?: new Factory();
  56965. }
  56966. public function addError(?JsonPointer $path, $message, $constraint = '', ?array $more = null)
  56967. {
  56968. $error = array(
  56969. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  56970. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  56971. 'message' => $message,
  56972. 'constraint' => $constraint,
  56973. 'context' => $this->factory->getErrorContext(),
  56974. );
  56975. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  56976. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  56977. }
  56978. if (is_array($more) && count($more) > 0) {
  56979. $error += $more;
  56980. }
  56981. $this->errors[] = $error;
  56982. $this->errorMask |= $error['context'];
  56983. }
  56984. public function addErrors(array $errors)
  56985. {
  56986. if ($errors) {
  56987. $this->errors = array_merge($this->errors, $errors);
  56988. $errorMask = &$this->errorMask;
  56989. array_walk($errors, function ($error) use (&$errorMask) {
  56990. if (isset($error['context'])) {
  56991. $errorMask |= $error['context'];
  56992. }
  56993. });
  56994. }
  56995. }
  56996. public function getErrors($errorContext = Validator::ERROR_ALL)
  56997. {
  56998. if ($errorContext === Validator::ERROR_ALL) {
  56999. return $this->errors;
  57000. }
  57001. return array_filter($this->errors, function ($error) use ($errorContext) {
  57002. if ($errorContext & $error['context']) {
  57003. return true;
  57004. }
  57005. });
  57006. }
  57007. public function numErrors($errorContext = Validator::ERROR_ALL)
  57008. {
  57009. if ($errorContext === Validator::ERROR_ALL) {
  57010. return count($this->errors);
  57011. }
  57012. return count($this->getErrors($errorContext));
  57013. }
  57014. public function isValid()
  57015. {
  57016. return !$this->getErrors();
  57017. }
  57018. public function reset()
  57019. {
  57020. $this->errors = array();
  57021. $this->errorMask = Validator::ERROR_NONE;
  57022. }
  57023. public function getErrorMask()
  57024. {
  57025. return $this->errorMask;
  57026. }
  57027. public static function arrayToObjectRecursive($array)
  57028. {
  57029. $json = json_encode($array);
  57030. if (json_last_error() !== \JSON_ERROR_NONE) {
  57031. $message = 'Unable to encode schema array as JSON';
  57032. if (function_exists('json_last_error_msg')) {
  57033. $message .= ': ' . json_last_error_msg();
  57034. }
  57035. throw new InvalidArgumentException($message);
  57036. }
  57037. return (object) json_decode($json);
  57038. }
  57039. }
  57040. <?php
  57041. namespace JsonSchema\Constraints;
  57042. use JsonSchema\Entity\JsonPointer;
  57043. class CollectionConstraint extends Constraint
  57044. {
  57045. public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
  57046. {
  57047. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  57048. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  57049. }
  57050. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  57051. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  57052. }
  57053. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  57054. $unique = $value;
  57055. if (is_array($value) && count($value)) {
  57056. $unique = array_map(function ($e) {
  57057. return var_export($e, true);
  57058. }, $value);
  57059. }
  57060. if (count(array_unique($unique)) != count($value)) {
  57061. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  57062. }
  57063. }
  57064. if (isset($schema->items)) {
  57065. $this->validateItems($value, $schema, $path, $i);
  57066. }
  57067. }
  57068. protected function validateItems(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
  57069. {
  57070. if (is_object($schema->items)) {
  57071. foreach ($value as $k => &$v) {
  57072. $initErrors = $this->getErrors();
  57073. $this->checkUndefined($v, $schema->items, $path, $k);
  57074. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  57075. $secondErrors = $this->getErrors();
  57076. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  57077. }
  57078. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  57079. $this->errors = $secondErrors;
  57080. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  57081. $this->errors = $initErrors;
  57082. }
  57083. }
  57084. unset($v);
  57085. } else {
  57086. foreach ($value as $k => &$v) {
  57087. if (array_key_exists($k, $schema->items)) {
  57088. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  57089. } else {
  57090. if (property_exists($schema, 'additionalItems')) {
  57091. if ($schema->additionalItems !== false) {
  57092. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  57093. } else {
  57094. $this->addError(
  57095. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  57096. }
  57097. } else {
  57098. $this->checkUndefined($v, new \stdClass(), $path, $k);
  57099. }
  57100. }
  57101. }
  57102. unset($v);
  57103. if (count($value) > 0) {
  57104. for ($k = count($value); $k < count($schema->items); $k++) {
  57105. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  57106. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  57107. }
  57108. }
  57109. }
  57110. }
  57111. }
  57112. <?php
  57113. namespace JsonSchema\Constraints;
  57114. use JsonSchema\Entity\JsonPointer;
  57115. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  57116. {
  57117. protected $inlineSchemaProperty = '$schema';
  57118. const CHECK_MODE_NONE = 0x00000000;
  57119. const CHECK_MODE_NORMAL = 0x00000001;
  57120. const CHECK_MODE_TYPE_CAST = 0x00000002;
  57121. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  57122. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  57123. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  57124. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  57125. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  57126. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  57127. protected function incrementPath(?JsonPointer $path, $i)
  57128. {
  57129. $path = $path ?: new JsonPointer('');
  57130. if ($i === null || $i === '') {
  57131. return $path;
  57132. }
  57133. $path = $path->withPropertyPaths(
  57134. array_merge(
  57135. $path->getPropertyPaths(),
  57136. array($i)
  57137. )
  57138. );
  57139. return $path;
  57140. }
  57141. protected function checkArray(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
  57142. {
  57143. $validator = $this->factory->createInstanceFor('collection');
  57144. $validator->check($value, $schema, $path, $i);
  57145. $this->addErrors($validator->getErrors());
  57146. }
  57147. protected function checkObject(&$value, $schema = null, ?JsonPointer $path = null, $properties = null,
  57148. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  57149. {
  57150. $validator = $this->factory->createInstanceFor('object');
  57151. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  57152. $this->addErrors($validator->getErrors());
  57153. }
  57154. protected function checkType(&$value, $schema = null, ?JsonPointer $path = null, $i = null)
  57155. {
  57156. $validator = $this->factory->createInstanceFor('type');
  57157. $validator->check($value, $schema, $path, $i);
  57158. $this->addErrors($validator->getErrors());
  57159. }
  57160. protected function checkUndefined(&$value, $schema = null, ?JsonPointer $path = null, $i = null, $fromDefault = false)
  57161. {
  57162. $validator = $this->factory->createInstanceFor('undefined');
  57163. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  57164. $this->addErrors($validator->getErrors());
  57165. }
  57166. protected function checkString($value, $schema = null, ?JsonPointer $path = null, $i = null)
  57167. {
  57168. $validator = $this->factory->createInstanceFor('string');
  57169. $validator->check($value, $schema, $path, $i);
  57170. $this->addErrors($validator->getErrors());
  57171. }
  57172. protected function checkNumber($value, $schema = null, ?JsonPointer $path = null, $i = null)
  57173. {
  57174. $validator = $this->factory->createInstanceFor('number');
  57175. $validator->check($value, $schema, $path, $i);
  57176. $this->addErrors($validator->getErrors());
  57177. }
  57178. protected function checkEnum($value, $schema = null, ?JsonPointer $path = null, $i = null)
  57179. {
  57180. $validator = $this->factory->createInstanceFor('enum');
  57181. $validator->check($value, $schema, $path, $i);
  57182. $this->addErrors($validator->getErrors());
  57183. }
  57184. protected function checkFormat($value, $schema = null, ?JsonPointer $path = null, $i = null)
  57185. {
  57186. $validator = $this->factory->createInstanceFor('format');
  57187. $validator->check($value, $schema, $path, $i);
  57188. $this->addErrors($validator->getErrors());
  57189. }
  57190. protected function getTypeCheck()
  57191. {
  57192. return $this->factory->getTypeCheck();
  57193. }
  57194. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  57195. {
  57196. $result = array_map(
  57197. function ($path) {
  57198. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  57199. },
  57200. $pointer->getPropertyPaths()
  57201. );
  57202. return trim(implode('', $result), '.');
  57203. }
  57204. }
  57205. <?php
  57206. namespace JsonSchema\Constraints;
  57207. use JsonSchema\Entity\JsonPointer;
  57208. interface ConstraintInterface
  57209. {
  57210. public function getErrors();
  57211. public function addErrors(array $errors);
  57212. public function addError(?JsonPointer $path, $message, $constraint='', ?array $more = null);
  57213. public function isValid();
  57214. public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null);
  57215. }
  57216. <?php
  57217. namespace JsonSchema\Constraints;
  57218. use JsonSchema\Entity\JsonPointer;
  57219. class EnumConstraint extends Constraint
  57220. {
  57221. public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
  57222. {
  57223. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  57224. return;
  57225. }
  57226. $type = gettype($element);
  57227. foreach ($schema->enum as $enum) {
  57228. $enumType = gettype($enum);
  57229. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  57230. if ((object) $element == $enum) {
  57231. return;
  57232. }
  57233. }
  57234. if ($type === gettype($enum)) {
  57235. if ($type == 'object') {
  57236. if ($element == $enum) {
  57237. return;
  57238. }
  57239. } elseif ($element === $enum) {
  57240. return;
  57241. }
  57242. }
  57243. }
  57244. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  57245. }
  57246. }
  57247. <?php
  57248. namespace JsonSchema\Constraints;
  57249. use JsonSchema\Exception\InvalidArgumentException;
  57250. use JsonSchema\SchemaStorage;
  57251. use JsonSchema\SchemaStorageInterface;
  57252. use JsonSchema\Uri\UriRetriever;
  57253. use JsonSchema\UriRetrieverInterface;
  57254. use JsonSchema\Validator;
  57255. class Factory
  57256. {
  57257. protected $schemaStorage;
  57258. protected $uriRetriever;
  57259. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  57260. private $typeCheck = array();
  57261. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  57262. protected $constraintMap = array(
  57263. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  57264. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  57265. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  57266. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  57267. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  57268. 'string' => 'JsonSchema\Constraints\StringConstraint',
  57269. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  57270. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  57271. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  57272. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  57273. 'validator' => 'JsonSchema\Validator'
  57274. );
  57275. private $instanceCache = array();
  57276. public function __construct(
  57277. ?SchemaStorageInterface $schemaStorage = null,
  57278. ?UriRetrieverInterface $uriRetriever = null,
  57279. $checkMode = Constraint::CHECK_MODE_NORMAL
  57280. ) {
  57281. $this->setConfig($checkMode);
  57282. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  57283. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  57284. }
  57285. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  57286. {
  57287. $this->checkMode = $checkMode;
  57288. }
  57289. public function addConfig($options)
  57290. {
  57291. $this->checkMode |= $options;
  57292. }
  57293. public function removeConfig($options)
  57294. {
  57295. $this->checkMode &= ~$options;
  57296. }
  57297. public function getConfig($options = null)
  57298. {
  57299. if ($options === null) {
  57300. return $this->checkMode;
  57301. }
  57302. return $this->checkMode & $options;
  57303. }
  57304. public function getUriRetriever()
  57305. {
  57306. return $this->uriRetriever;
  57307. }
  57308. public function getSchemaStorage()
  57309. {
  57310. return $this->schemaStorage;
  57311. }
  57312. public function getTypeCheck()
  57313. {
  57314. if (!isset($this->typeCheck[$this->checkMode])) {
  57315. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  57316. ? new TypeCheck\LooseTypeCheck()
  57317. : new TypeCheck\StrictTypeCheck();
  57318. }
  57319. return $this->typeCheck[$this->checkMode];
  57320. }
  57321. public function setConstraintClass($name, $class)
  57322. {
  57323. if (!class_exists($class)) {
  57324. throw new InvalidArgumentException('Unknown constraint ' . $name);
  57325. }
  57326. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  57327. throw new InvalidArgumentException('Invalid class ' . $name);
  57328. }
  57329. $this->constraintMap[$name] = $class;
  57330. return $this;
  57331. }
  57332. public function createInstanceFor($constraintName)
  57333. {
  57334. if (!isset($this->constraintMap[$constraintName])) {
  57335. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  57336. }
  57337. if (!isset($this->instanceCache[$constraintName])) {
  57338. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  57339. }
  57340. return clone $this->instanceCache[$constraintName];
  57341. }
  57342. public function getErrorContext()
  57343. {
  57344. return $this->errorContext;
  57345. }
  57346. public function setErrorContext($errorContext)
  57347. {
  57348. $this->errorContext = $errorContext;
  57349. }
  57350. }
  57351. <?php
  57352. namespace JsonSchema\Constraints;
  57353. use JsonSchema\Entity\JsonPointer;
  57354. use JsonSchema\Rfc3339;
  57355. class FormatConstraint extends Constraint
  57356. {
  57357. public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
  57358. {
  57359. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  57360. return;
  57361. }
  57362. switch ($schema->format) {
  57363. case 'date':
  57364. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  57365. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  57366. }
  57367. break;
  57368. case 'time':
  57369. if (!$this->validateDateTime($element, 'H:i:s')) {
  57370. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  57371. }
  57372. break;
  57373. case 'date-time':
  57374. if (null === Rfc3339::createFromString($element)) {
  57375. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  57376. }
  57377. break;
  57378. case 'utc-millisec':
  57379. if (!$this->validateDateTime($element, 'U')) {
  57380. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  57381. }
  57382. break;
  57383. case 'regex':
  57384. if (!$this->validateRegex($element)) {
  57385. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  57386. }
  57387. break;
  57388. case 'color':
  57389. if (!$this->validateColor($element)) {
  57390. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  57391. }
  57392. break;
  57393. case 'style':
  57394. if (!$this->validateStyle($element)) {
  57395. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  57396. }
  57397. break;
  57398. case 'phone':
  57399. if (!$this->validatePhone($element)) {
  57400. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  57401. }
  57402. break;
  57403. case 'uri':
  57404. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  57405. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  57406. }
  57407. break;
  57408. case 'uriref':
  57409. case 'uri-reference':
  57410. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  57411. if (substr($element, 0, 2) === '//') {
  57412. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  57413. } elseif (substr($element, 0, 1) === '/') {
  57414. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  57415. } elseif (strlen($element)) {
  57416. $pathParts = explode('/', $element, 2);
  57417. if (strpos($pathParts[0], ':') !== false) {
  57418. $validURL = null;
  57419. } else {
  57420. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  57421. }
  57422. } else {
  57423. $validURL = null;
  57424. }
  57425. if ($validURL === null) {
  57426. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  57427. }
  57428. }
  57429. break;
  57430. case 'email':
  57431. $filterFlags = FILTER_NULL_ON_FAILURE;
  57432. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  57433. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  57434. }
  57435. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  57436. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  57437. }
  57438. break;
  57439. case 'ip-address':
  57440. case 'ipv4':
  57441. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  57442. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  57443. }
  57444. break;
  57445. case 'ipv6':
  57446. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  57447. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  57448. }
  57449. break;
  57450. case 'host-name':
  57451. case 'hostname':
  57452. if (!$this->validateHostname($element)) {
  57453. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  57454. }
  57455. break;
  57456. default:
  57457. break;
  57458. }
  57459. }
  57460. protected function validateDateTime($datetime, $format)
  57461. {
  57462. $dt = \DateTime::createFromFormat($format, $datetime);
  57463. if (!$dt) {
  57464. return false;
  57465. }
  57466. if ($datetime === $dt->format($format)) {
  57467. return true;
  57468. }
  57469. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  57470. return true;
  57471. }
  57472. return false;
  57473. }
  57474. protected function validateRegex($regex)
  57475. {
  57476. return false !== @preg_match('/' . $regex . '/u', '');
  57477. }
  57478. protected function validateColor($color)
  57479. {
  57480. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  57481. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  57482. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  57483. return true;
  57484. }
  57485. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  57486. }
  57487. protected function validateStyle($style)
  57488. {
  57489. $properties = explode(';', rtrim($style, ';'));
  57490. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  57491. return empty($invalidEntries);
  57492. }
  57493. protected function validatePhone($phone)
  57494. {
  57495. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  57496. }
  57497. protected function validateHostname($host)
  57498. {
  57499. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  57500. return preg_match($hostnameRegex, $host);
  57501. }
  57502. }
  57503. <?php
  57504. namespace JsonSchema\Constraints;
  57505. use JsonSchema\Entity\JsonPointer;
  57506. class NumberConstraint extends Constraint
  57507. {
  57508. public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
  57509. {
  57510. if (isset($schema->exclusiveMinimum)) {
  57511. if (isset($schema->minimum)) {
  57512. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  57513. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  57514. } elseif ($element < $schema->minimum) {
  57515. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  57516. }
  57517. } else {
  57518. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  57519. }
  57520. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  57521. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  57522. }
  57523. if (isset($schema->exclusiveMaximum)) {
  57524. if (isset($schema->maximum)) {
  57525. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  57526. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  57527. } elseif ($element > $schema->maximum) {
  57528. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  57529. }
  57530. } else {
  57531. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  57532. }
  57533. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  57534. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  57535. }
  57536. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  57537. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  57538. }
  57539. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  57540. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  57541. }
  57542. $this->checkFormat($element, $schema, $path, $i);
  57543. }
  57544. private function fmod($number1, $number2)
  57545. {
  57546. $modulus = ($number1 - round($number1 / $number2) * $number2);
  57547. $precision = 0.0000000001;
  57548. if (-$precision < $modulus && $modulus < $precision) {
  57549. return 0.0;
  57550. }
  57551. return $modulus;
  57552. }
  57553. }
  57554. <?php
  57555. namespace JsonSchema\Constraints;
  57556. use JsonSchema\Entity\JsonPointer;
  57557. class ObjectConstraint extends Constraint
  57558. {
  57559. protected $appliedDefaults = array();
  57560. public function check(&$element, $schema = null, ?JsonPointer $path = null, $properties = null,
  57561. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  57562. {
  57563. if ($element instanceof UndefinedConstraint) {
  57564. return;
  57565. }
  57566. $this->appliedDefaults = $appliedDefaults;
  57567. $matches = array();
  57568. if ($patternProperties) {
  57569. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  57570. }
  57571. if ($properties) {
  57572. $this->validateProperties($element, $properties, $path);
  57573. }
  57574. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  57575. }
  57576. public function validatePatternProperties($element, ?JsonPointer $path, $patternProperties)
  57577. {
  57578. $try = array('/', '#', '+', '~', '%');
  57579. $matches = array();
  57580. foreach ($patternProperties as $pregex => $schema) {
  57581. $delimiter = '/';
  57582. foreach ($try as $delimiter) {
  57583. if (strpos($pregex, $delimiter) === false) {
  57584. break;
  57585. }
  57586. }
  57587. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  57588. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  57589. continue;
  57590. }
  57591. foreach ($element as $i => $value) {
  57592. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  57593. $matches[] = $i;
  57594. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  57595. }
  57596. }
  57597. }
  57598. return $matches;
  57599. }
  57600. public function validateElement($element, $matches, $schema = null, ?JsonPointer $path = null,
  57601. $properties = null, $additionalProp = null)
  57602. {
  57603. $this->validateMinMaxConstraint($element, $schema, $path);
  57604. foreach ($element as $i => $value) {
  57605. $definition = $this->getProperty($properties, $i);
  57606. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  57607. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  57608. }
  57609. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  57610. if ($additionalProp === true) {
  57611. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  57612. } else {
  57613. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  57614. }
  57615. }
  57616. $require = $this->getProperty($definition, 'requires');
  57617. if ($require && !$this->getProperty($element, $require)) {
  57618. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  57619. }
  57620. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  57621. if (is_object($property)) {
  57622. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  57623. }
  57624. }
  57625. }
  57626. public function validateProperties(&$element, $properties = null, ?JsonPointer $path = null)
  57627. {
  57628. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  57629. foreach ($properties as $i => $value) {
  57630. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  57631. $definition = $this->getProperty($properties, $i);
  57632. if (is_object($definition)) {
  57633. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  57634. }
  57635. }
  57636. }
  57637. protected function &getProperty(&$element, $property, $fallback = null)
  57638. {
  57639. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  57640. return $element[$property];
  57641. } elseif (is_object($element) && property_exists($element, $property)) {
  57642. return $element->$property;
  57643. }
  57644. return $fallback;
  57645. }
  57646. protected function validateMinMaxConstraint($element, $objectDefinition, ?JsonPointer $path = null)
  57647. {
  57648. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  57649. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  57650. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  57651. }
  57652. }
  57653. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  57654. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  57655. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  57656. }
  57657. }
  57658. }
  57659. }
  57660. <?php
  57661. namespace JsonSchema\Constraints;
  57662. use JsonSchema\Entity\JsonPointer;
  57663. use JsonSchema\Exception\InvalidArgumentException;
  57664. use JsonSchema\Exception\InvalidSchemaException;
  57665. use JsonSchema\Exception\RuntimeException;
  57666. use JsonSchema\Validator;
  57667. class SchemaConstraint extends Constraint
  57668. {
  57669. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  57670. public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
  57671. {
  57672. if ($schema !== null) {
  57673. $validationSchema = $schema;
  57674. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  57675. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  57676. } else {
  57677. throw new InvalidArgumentException('no schema found to verify against');
  57678. }
  57679. if (is_array($validationSchema)) {
  57680. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  57681. }
  57682. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  57683. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  57684. throw new RuntimeException('Cannot validate the schema of a non-object');
  57685. }
  57686. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  57687. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  57688. } else {
  57689. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  57690. }
  57691. $schemaStorage = $this->factory->getSchemaStorage();
  57692. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  57693. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  57694. }
  57695. $initialErrorCount = $this->numErrors();
  57696. $initialConfig = $this->factory->getConfig();
  57697. $initialContext = $this->factory->getErrorContext();
  57698. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  57699. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  57700. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  57701. try {
  57702. $this->check($validationSchema, $schemaSpec);
  57703. } catch (\Exception $e) {
  57704. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  57705. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  57706. }
  57707. }
  57708. if ($this->numErrors() > $initialErrorCount) {
  57709. $this->addError($path, 'Schema is not valid', 'schema');
  57710. }
  57711. $this->factory->setConfig($initialConfig);
  57712. $this->factory->setErrorContext($initialContext);
  57713. }
  57714. $this->checkUndefined($element, $validationSchema, $path, $i);
  57715. }
  57716. }
  57717. <?php
  57718. namespace JsonSchema\Constraints;
  57719. use JsonSchema\Entity\JsonPointer;
  57720. class StringConstraint extends Constraint
  57721. {
  57722. public function check(&$element, $schema = null, ?JsonPointer $path = null, $i = null)
  57723. {
  57724. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  57725. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  57726. 'maxLength' => $schema->maxLength,
  57727. ));
  57728. }
  57729. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  57730. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  57731. 'minLength' => $schema->minLength,
  57732. ));
  57733. }
  57734. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  57735. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  57736. 'pattern' => $schema->pattern,
  57737. ));
  57738. }
  57739. $this->checkFormat($element, $schema, $path, $i);
  57740. }
  57741. private function strlen($string)
  57742. {
  57743. if (extension_loaded('mbstring')) {
  57744. return mb_strlen($string, mb_detect_encoding($string));
  57745. }
  57746. return strlen($string);
  57747. }
  57748. }
  57749. <?php
  57750. namespace JsonSchema\Constraints\TypeCheck;
  57751. class LooseTypeCheck implements TypeCheckInterface
  57752. {
  57753. public static function isObject($value)
  57754. {
  57755. return
  57756. is_object($value) ||
  57757. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  57758. }
  57759. public static function isArray($value)
  57760. {
  57761. return
  57762. is_array($value) &&
  57763. (count($value) == 0 || !self::isAssociativeArray($value));
  57764. }
  57765. public static function propertyGet($value, $property)
  57766. {
  57767. if (is_object($value)) {
  57768. return $value->{$property};
  57769. }
  57770. return $value[$property];
  57771. }
  57772. public static function propertySet(&$value, $property, $data)
  57773. {
  57774. if (is_object($value)) {
  57775. $value->{$property} = $data;
  57776. } else {
  57777. $value[$property] = $data;
  57778. }
  57779. }
  57780. public static function propertyExists($value, $property)
  57781. {
  57782. if (is_object($value)) {
  57783. return property_exists($value, $property);
  57784. }
  57785. return array_key_exists($property, $value);
  57786. }
  57787. public static function propertyCount($value)
  57788. {
  57789. if (is_object($value)) {
  57790. return count(get_object_vars($value));
  57791. }
  57792. return count($value);
  57793. }
  57794. private static function isAssociativeArray($arr)
  57795. {
  57796. return array_keys($arr) !== range(0, count($arr) - 1);
  57797. }
  57798. }
  57799. <?php
  57800. namespace JsonSchema\Constraints\TypeCheck;
  57801. class StrictTypeCheck implements TypeCheckInterface
  57802. {
  57803. public static function isObject($value)
  57804. {
  57805. return is_object($value);
  57806. }
  57807. public static function isArray($value)
  57808. {
  57809. return is_array($value);
  57810. }
  57811. public static function propertyGet($value, $property)
  57812. {
  57813. return $value->{$property};
  57814. }
  57815. public static function propertySet(&$value, $property, $data)
  57816. {
  57817. $value->{$property} = $data;
  57818. }
  57819. public static function propertyExists($value, $property)
  57820. {
  57821. return property_exists($value, $property);
  57822. }
  57823. public static function propertyCount($value)
  57824. {
  57825. if (!is_object($value)) {
  57826. return 0;
  57827. }
  57828. return count(get_object_vars($value));
  57829. }
  57830. }
  57831. <?php
  57832. namespace JsonSchema\Constraints\TypeCheck;
  57833. interface TypeCheckInterface
  57834. {
  57835. public static function isObject($value);
  57836. public static function isArray($value);
  57837. public static function propertyGet($value, $property);
  57838. public static function propertySet(&$value, $property, $data);
  57839. public static function propertyExists($value, $property);
  57840. public static function propertyCount($value);
  57841. }
  57842. <?php
  57843. namespace JsonSchema\Constraints;
  57844. use JsonSchema\Entity\JsonPointer;
  57845. use JsonSchema\Exception\InvalidArgumentException;
  57846. use UnexpectedValueException as StandardUnexpectedValueException;
  57847. class TypeConstraint extends Constraint
  57848. {
  57849. public static $wording = array(
  57850. 'integer' => 'an integer',
  57851. 'number' => 'a number',
  57852. 'boolean' => 'a boolean',
  57853. 'object' => 'an object',
  57854. 'array' => 'an array',
  57855. 'string' => 'a string',
  57856. 'null' => 'a null',
  57857. 'any' => null,
  57858. 0 => null,
  57859. );
  57860. public function check(&$value = null, $schema = null, ?JsonPointer $path = null, $i = null)
  57861. {
  57862. $type = isset($schema->type) ? $schema->type : null;
  57863. $isValid = false;
  57864. $wording = array();
  57865. if (is_array($type)) {
  57866. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  57867. } elseif (is_object($type)) {
  57868. $this->checkUndefined($value, $type, $path);
  57869. return;
  57870. } else {
  57871. $isValid = $this->validateType($value, $type);
  57872. }
  57873. if ($isValid === false) {
  57874. if (!is_array($type)) {
  57875. $this->validateTypeNameWording($type);
  57876. $wording[] = self::$wording[$type];
  57877. }
  57878. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  57879. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  57880. }
  57881. }
  57882. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  57883. {
  57884. foreach ($type as $tp) {
  57885. if (is_object($tp)) {
  57886. if (!$isValid) {
  57887. $validator = $this->factory->createInstanceFor('type');
  57888. $subSchema = new \stdClass();
  57889. $subSchema->type = $tp;
  57890. $validator->check($value, $subSchema, $path, null);
  57891. $error = $validator->getErrors();
  57892. $isValid = !(bool) $error;
  57893. $validTypesWording[] = self::$wording['object'];
  57894. }
  57895. } else {
  57896. $this->validateTypeNameWording($tp);
  57897. $validTypesWording[] = self::$wording[$tp];
  57898. if (!$isValid) {
  57899. $isValid = $this->validateType($value, $tp);
  57900. }
  57901. }
  57902. }
  57903. }
  57904. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  57905. {
  57906. if ($listEnd === false || !isset($elements[1])) {
  57907. return implode($delimiter, $elements);
  57908. }
  57909. $lastElement = array_slice($elements, -1);
  57910. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  57911. $implodedElements = array_merge(array($firsElements), $lastElement);
  57912. return join(" $listEnd ", $implodedElements);
  57913. }
  57914. protected function validateTypeNameWording($type)
  57915. {
  57916. if (!array_key_exists($type, self::$wording)) {
  57917. throw new StandardUnexpectedValueException(
  57918. sprintf(
  57919. 'No wording for %s available, expected wordings are: [%s]',
  57920. var_export($type, true),
  57921. implode(', ', array_filter(self::$wording)))
  57922. );
  57923. }
  57924. }
  57925. protected function validateType(&$value, $type)
  57926. {
  57927. if (!$type) {
  57928. return true;
  57929. }
  57930. if ('any' === $type) {
  57931. return true;
  57932. }
  57933. if ('object' === $type) {
  57934. return $this->getTypeCheck()->isObject($value);
  57935. }
  57936. if ('array' === $type) {
  57937. return $this->getTypeCheck()->isArray($value);
  57938. }
  57939. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  57940. if ('integer' === $type) {
  57941. if ($coerce) {
  57942. $value = $this->toInteger($value);
  57943. }
  57944. return is_int($value);
  57945. }
  57946. if ('number' === $type) {
  57947. if ($coerce) {
  57948. $value = $this->toNumber($value);
  57949. }
  57950. return is_numeric($value) && !is_string($value);
  57951. }
  57952. if ('boolean' === $type) {
  57953. if ($coerce) {
  57954. $value = $this->toBoolean($value);
  57955. }
  57956. return is_bool($value);
  57957. }
  57958. if ('string' === $type) {
  57959. return is_string($value);
  57960. }
  57961. if ('email' === $type) {
  57962. return is_string($value);
  57963. }
  57964. if ('null' === $type) {
  57965. return is_null($value);
  57966. }
  57967. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  57968. }
  57969. protected function toBoolean($value)
  57970. {
  57971. if ($value === 'true') {
  57972. return true;
  57973. }
  57974. if ($value === 'false') {
  57975. return false;
  57976. }
  57977. return $value;
  57978. }
  57979. protected function toNumber($value)
  57980. {
  57981. if (is_numeric($value)) {
  57982. return $value + 0;
  57983. }
  57984. return $value;
  57985. }
  57986. protected function toInteger($value)
  57987. {
  57988. if (is_numeric($value) && (int) $value == $value) {
  57989. return (int) $value;
  57990. }
  57991. return $value;
  57992. }
  57993. }
  57994. <?php
  57995. namespace JsonSchema\Constraints;
  57996. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  57997. use JsonSchema\Entity\JsonPointer;
  57998. use JsonSchema\Exception\ValidationException;
  57999. use JsonSchema\Uri\UriResolver;
  58000. #[\AllowDynamicProperties]
  58001. class UndefinedConstraint extends Constraint
  58002. {
  58003. protected $appliedDefaults = array();
  58004. public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = null, $fromDefault = false)
  58005. {
  58006. if (is_null($schema) || !is_object($schema)) {
  58007. return;
  58008. }
  58009. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  58010. if ($fromDefault) {
  58011. $path->setFromDefault();
  58012. }
  58013. $this->validateCommonProperties($value, $schema, $path, $i);
  58014. $this->validateOfProperties($value, $schema, $path, '');
  58015. $this->validateTypes($value, $schema, $path, $i);
  58016. }
  58017. public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
  58018. {
  58019. if ($this->getTypeCheck()->isArray($value)) {
  58020. $this->checkArray($value, $schema, $path, $i);
  58021. }
  58022. if (LooseTypeCheck::isObject($value)) {
  58023. $this->checkObject(
  58024. $value,
  58025. $schema,
  58026. $path,
  58027. isset($schema->properties) ? $schema->properties : null,
  58028. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  58029. isset($schema->patternProperties) ? $schema->patternProperties : null,
  58030. $this->appliedDefaults
  58031. );
  58032. }
  58033. if (is_string($value)) {
  58034. $this->checkString($value, $schema, $path, $i);
  58035. }
  58036. if (is_numeric($value)) {
  58037. $this->checkNumber($value, $schema, $path, $i);
  58038. }
  58039. if (isset($schema->enum)) {
  58040. $this->checkEnum($value, $schema, $path, $i);
  58041. }
  58042. }
  58043. protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
  58044. {
  58045. if (isset($schema->extends)) {
  58046. if (is_string($schema->extends)) {
  58047. $schema->extends = $this->validateUri($schema, $schema->extends);
  58048. }
  58049. if (is_array($schema->extends)) {
  58050. foreach ($schema->extends as $extends) {
  58051. $this->checkUndefined($value, $extends, $path, $i);
  58052. }
  58053. } else {
  58054. $this->checkUndefined($value, $schema->extends, $path, $i);
  58055. }
  58056. }
  58057. if (!$path->fromDefault()) {
  58058. $this->applyDefaultValues($value, $schema, $path);
  58059. }
  58060. if ($this->getTypeCheck()->isObject($value)) {
  58061. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  58062. foreach ($schema->required as $required) {
  58063. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  58064. $this->addError(
  58065. $this->incrementPath($path ?: new JsonPointer(''), $required),
  58066. 'The property ' . $required . ' is required',
  58067. 'required'
  58068. );
  58069. }
  58070. }
  58071. } elseif (isset($schema->required) && !is_array($schema->required)) {
  58072. if ($schema->required && $value instanceof self) {
  58073. $propertyPaths = $path->getPropertyPaths();
  58074. $propertyName = end($propertyPaths);
  58075. $this->addError(
  58076. $path,
  58077. 'The property ' . $propertyName . ' is required',
  58078. 'required'
  58079. );
  58080. }
  58081. } else {
  58082. if ($value instanceof self) {
  58083. return;
  58084. }
  58085. }
  58086. }
  58087. if (!($value instanceof self)) {
  58088. $this->checkType($value, $schema, $path, $i);
  58089. }
  58090. if (isset($schema->disallow)) {
  58091. $initErrors = $this->getErrors();
  58092. $typeSchema = new \stdClass();
  58093. $typeSchema->type = $schema->disallow;
  58094. $this->checkType($value, $typeSchema, $path);
  58095. if (count($this->getErrors()) == count($initErrors)) {
  58096. $this->addError($path, 'Disallowed value was matched', 'disallow');
  58097. } else {
  58098. $this->errors = $initErrors;
  58099. }
  58100. }
  58101. if (isset($schema->not)) {
  58102. $initErrors = $this->getErrors();
  58103. $this->checkUndefined($value, $schema->not, $path, $i);
  58104. if (count($this->getErrors()) == count($initErrors)) {
  58105. $this->addError($path, 'Matched a schema which it should not', 'not');
  58106. } else {
  58107. $this->errors = $initErrors;
  58108. }
  58109. }
  58110. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  58111. $this->validateDependencies($value, $schema->dependencies, $path);
  58112. }
  58113. }
  58114. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  58115. {
  58116. if (!$requiredOnly) {
  58117. return true;
  58118. }
  58119. if (
  58120. $name !== null
  58121. && isset($parentSchema->required)
  58122. && is_array($parentSchema->required)
  58123. && in_array($name, $parentSchema->required)
  58124. ) {
  58125. return true;
  58126. }
  58127. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  58128. return true;
  58129. }
  58130. return false;
  58131. }
  58132. protected function applyDefaultValues(&$value, $schema, $path)
  58133. {
  58134. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  58135. return;
  58136. }
  58137. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  58138. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  58139. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  58140. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  58141. if (
  58142. !LooseTypeCheck::propertyExists($value, $currentProperty)
  58143. && property_exists($propertyDefinition, 'default')
  58144. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  58145. ) {
  58146. if (is_object($propertyDefinition->default)) {
  58147. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  58148. } else {
  58149. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  58150. }
  58151. $this->appliedDefaults[] = $currentProperty;
  58152. }
  58153. }
  58154. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  58155. $items = array();
  58156. if (LooseTypeCheck::isArray($schema->items)) {
  58157. $items = $schema->items;
  58158. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  58159. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  58160. }
  58161. foreach ($items as $currentItem => $itemDefinition) {
  58162. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  58163. if (
  58164. !array_key_exists($currentItem, $value)
  58165. && property_exists($itemDefinition, 'default')
  58166. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  58167. if (is_object($itemDefinition->default)) {
  58168. $value[$currentItem] = clone $itemDefinition->default;
  58169. } else {
  58170. $value[$currentItem] = $itemDefinition->default;
  58171. }
  58172. }
  58173. $path->setFromDefault();
  58174. }
  58175. } elseif (
  58176. $value instanceof self
  58177. && property_exists($schema, 'default')
  58178. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  58179. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  58180. $path->setFromDefault();
  58181. }
  58182. }
  58183. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  58184. {
  58185. if ($value instanceof self) {
  58186. return;
  58187. }
  58188. if (isset($schema->allOf)) {
  58189. $isValid = true;
  58190. foreach ($schema->allOf as $allOf) {
  58191. $initErrors = $this->getErrors();
  58192. $this->checkUndefined($value, $allOf, $path, $i);
  58193. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  58194. }
  58195. if (!$isValid) {
  58196. $this->addError($path, 'Failed to match all schemas', 'allOf');
  58197. }
  58198. }
  58199. if (isset($schema->anyOf)) {
  58200. $isValid = false;
  58201. $startErrors = $this->getErrors();
  58202. $caughtException = null;
  58203. foreach ($schema->anyOf as $anyOf) {
  58204. $initErrors = $this->getErrors();
  58205. try {
  58206. $this->checkUndefined($value, $anyOf, $path, $i);
  58207. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  58208. break;
  58209. }
  58210. } catch (ValidationException $e) {
  58211. $isValid = false;
  58212. }
  58213. }
  58214. if (!$isValid) {
  58215. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  58216. } else {
  58217. $this->errors = $startErrors;
  58218. }
  58219. }
  58220. if (isset($schema->oneOf)) {
  58221. $allErrors = array();
  58222. $matchedSchemas = 0;
  58223. $startErrors = $this->getErrors();
  58224. foreach ($schema->oneOf as $oneOf) {
  58225. try {
  58226. $this->errors = array();
  58227. $this->checkUndefined($value, $oneOf, $path, $i);
  58228. if (count($this->getErrors()) == 0) {
  58229. $matchedSchemas++;
  58230. }
  58231. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  58232. } catch (ValidationException $e) {
  58233. }
  58234. }
  58235. if ($matchedSchemas !== 1) {
  58236. $this->addErrors(array_merge($allErrors, $startErrors));
  58237. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  58238. } else {
  58239. $this->errors = $startErrors;
  58240. }
  58241. }
  58242. }
  58243. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  58244. {
  58245. foreach ($dependencies as $key => $dependency) {
  58246. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  58247. if (is_string($dependency)) {
  58248. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  58249. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  58250. }
  58251. } elseif (is_array($dependency)) {
  58252. foreach ($dependency as $d) {
  58253. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  58254. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  58255. }
  58256. }
  58257. } elseif (is_object($dependency)) {
  58258. $this->checkUndefined($value, $dependency, $path, $i);
  58259. }
  58260. }
  58261. }
  58262. }
  58263. protected function validateUri($schema, $schemaUri = null)
  58264. {
  58265. $resolver = new UriResolver();
  58266. $retriever = $this->factory->getUriRetriever();
  58267. $jsonSchema = null;
  58268. if ($resolver->isValid($schemaUri)) {
  58269. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  58270. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  58271. }
  58272. return $jsonSchema;
  58273. }
  58274. }
  58275. <?php
  58276. namespace JsonSchema\Entity;
  58277. use JsonSchema\Exception\InvalidArgumentException;
  58278. class JsonPointer
  58279. {
  58280. private $filename;
  58281. private $propertyPaths = array();
  58282. private $fromDefault = false;
  58283. public function __construct($value)
  58284. {
  58285. if (!is_string($value)) {
  58286. throw new InvalidArgumentException('Ref value must be a string');
  58287. }
  58288. $splitRef = explode('#', $value, 2);
  58289. $this->filename = $splitRef[0];
  58290. if (array_key_exists(1, $splitRef)) {
  58291. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  58292. }
  58293. }
  58294. private function decodePropertyPaths($propertyPathString)
  58295. {
  58296. $paths = array();
  58297. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  58298. $path = $this->decodePath($path);
  58299. if (is_string($path) && '' !== $path) {
  58300. $paths[] = $path;
  58301. }
  58302. }
  58303. return $paths;
  58304. }
  58305. private function encodePropertyPaths()
  58306. {
  58307. return array_map(
  58308. array($this, 'encodePath'),
  58309. $this->getPropertyPaths()
  58310. );
  58311. }
  58312. private function decodePath($path)
  58313. {
  58314. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  58315. }
  58316. private function encodePath($path)
  58317. {
  58318. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  58319. }
  58320. public function getFilename()
  58321. {
  58322. return $this->filename;
  58323. }
  58324. public function getPropertyPaths()
  58325. {
  58326. return $this->propertyPaths;
  58327. }
  58328. public function withPropertyPaths(array $propertyPaths)
  58329. {
  58330. $new = clone $this;
  58331. $new->propertyPaths = $propertyPaths;
  58332. return $new;
  58333. }
  58334. public function getPropertyPathAsString()
  58335. {
  58336. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  58337. }
  58338. public function __toString()
  58339. {
  58340. return $this->getFilename() . $this->getPropertyPathAsString();
  58341. }
  58342. public function setFromDefault()
  58343. {
  58344. $this->fromDefault = true;
  58345. }
  58346. public function fromDefault()
  58347. {
  58348. return $this->fromDefault;
  58349. }
  58350. }
  58351. <?php
  58352. namespace JsonSchema\Exception;
  58353. interface ExceptionInterface
  58354. {
  58355. }
  58356. <?php
  58357. namespace JsonSchema\Exception;
  58358. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  58359. {
  58360. }
  58361. <?php
  58362. namespace JsonSchema\Exception;
  58363. class InvalidConfigException extends RuntimeException
  58364. {
  58365. }
  58366. <?php
  58367. namespace JsonSchema\Exception;
  58368. class InvalidSchemaException extends RuntimeException
  58369. {
  58370. }
  58371. <?php
  58372. namespace JsonSchema\Exception;
  58373. class InvalidSchemaMediaTypeException extends RuntimeException
  58374. {
  58375. }
  58376. <?php
  58377. namespace JsonSchema\Exception;
  58378. class InvalidSourceUriException extends InvalidArgumentException
  58379. {
  58380. }
  58381. <?php
  58382. namespace JsonSchema\Exception;
  58383. class JsonDecodingException extends RuntimeException
  58384. {
  58385. public function __construct($code = JSON_ERROR_NONE, ?\Exception $previous = null)
  58386. {
  58387. switch ($code) {
  58388. case JSON_ERROR_DEPTH:
  58389. $message = 'The maximum stack depth has been exceeded';
  58390. break;
  58391. case JSON_ERROR_STATE_MISMATCH:
  58392. $message = 'Invalid or malformed JSON';
  58393. break;
  58394. case JSON_ERROR_CTRL_CHAR:
  58395. $message = 'Control character error, possibly incorrectly encoded';
  58396. break;
  58397. case JSON_ERROR_UTF8:
  58398. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  58399. break;
  58400. case JSON_ERROR_SYNTAX:
  58401. $message = 'JSON syntax is malformed';
  58402. break;
  58403. default:
  58404. $message = 'Syntax error';
  58405. }
  58406. parent::__construct($message, $code, $previous);
  58407. }
  58408. }
  58409. <?php
  58410. namespace JsonSchema\Exception;
  58411. class ResourceNotFoundException extends RuntimeException
  58412. {
  58413. }
  58414. <?php
  58415. namespace JsonSchema\Exception;
  58416. class RuntimeException extends \RuntimeException implements ExceptionInterface
  58417. {
  58418. }
  58419. <?php
  58420. namespace JsonSchema\Exception;
  58421. class UnresolvableJsonPointerException extends InvalidArgumentException
  58422. {
  58423. }
  58424. <?php
  58425. namespace JsonSchema\Exception;
  58426. class UriResolverException extends RuntimeException
  58427. {
  58428. }
  58429. <?php
  58430. namespace JsonSchema\Exception;
  58431. class ValidationException extends RuntimeException
  58432. {
  58433. }
  58434. <?php
  58435. namespace JsonSchema\Iterator;
  58436. class ObjectIterator implements \Iterator, \Countable
  58437. {
  58438. private $object;
  58439. private $position = 0;
  58440. private $data = array();
  58441. private $initialized = false;
  58442. public function __construct($object)
  58443. {
  58444. $this->object = $object;
  58445. }
  58446. public function current()
  58447. {
  58448. $this->initialize();
  58449. return $this->data[$this->position];
  58450. }
  58451. public function next()
  58452. {
  58453. $this->initialize();
  58454. $this->position++;
  58455. }
  58456. public function key()
  58457. {
  58458. $this->initialize();
  58459. return $this->position;
  58460. }
  58461. public function valid()
  58462. {
  58463. $this->initialize();
  58464. return isset($this->data[$this->position]);
  58465. }
  58466. public function rewind()
  58467. {
  58468. $this->initialize();
  58469. $this->position = 0;
  58470. }
  58471. public function count()
  58472. {
  58473. $this->initialize();
  58474. return count($this->data);
  58475. }
  58476. private function initialize()
  58477. {
  58478. if (!$this->initialized) {
  58479. $this->data = $this->buildDataFromObject($this->object);
  58480. $this->initialized = true;
  58481. }
  58482. }
  58483. private function buildDataFromObject($object)
  58484. {
  58485. $result = array();
  58486. $stack = new \SplStack();
  58487. $stack->push($object);
  58488. while (!$stack->isEmpty()) {
  58489. $current = $stack->pop();
  58490. if (is_object($current)) {
  58491. array_push($result, $current);
  58492. }
  58493. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  58494. if (is_object($propertyValue) || is_array($propertyValue)) {
  58495. $stack->push($propertyValue);
  58496. }
  58497. }
  58498. }
  58499. return $result;
  58500. }
  58501. private function getDataFromItem($item)
  58502. {
  58503. if (!is_object($item) && !is_array($item)) {
  58504. return array();
  58505. }
  58506. return is_object($item) ? get_object_vars($item) : $item;
  58507. }
  58508. }
  58509. <?php
  58510. namespace JsonSchema;
  58511. class Rfc3339
  58512. {
  58513. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  58514. public static function createFromString($string)
  58515. {
  58516. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  58517. return null;
  58518. }
  58519. $dateAndTime = $matches[1];
  58520. $microseconds = $matches[2] ?: '.000000';
  58521. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  58522. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  58523. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  58524. return $dateTime ?: null;
  58525. }
  58526. }
  58527. <?php
  58528. namespace JsonSchema;
  58529. use JsonSchema\Constraints\BaseConstraint;
  58530. use JsonSchema\Entity\JsonPointer;
  58531. use JsonSchema\Exception\UnresolvableJsonPointerException;
  58532. use JsonSchema\Uri\UriResolver;
  58533. use JsonSchema\Uri\UriRetriever;
  58534. class SchemaStorage implements SchemaStorageInterface
  58535. {
  58536. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  58537. protected $uriRetriever;
  58538. protected $uriResolver;
  58539. protected $schemas = array();
  58540. public function __construct(
  58541. ?UriRetrieverInterface $uriRetriever = null,
  58542. ?UriResolverInterface $uriResolver = null
  58543. ) {
  58544. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  58545. $this->uriResolver = $uriResolver ?: new UriResolver();
  58546. }
  58547. public function getUriRetriever()
  58548. {
  58549. return $this->uriRetriever;
  58550. }
  58551. public function getUriResolver()
  58552. {
  58553. return $this->uriResolver;
  58554. }
  58555. public function addSchema($id, $schema = null)
  58556. {
  58557. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  58558. $schema = $this->uriRetriever->retrieve($id);
  58559. }
  58560. if (is_array($schema)) {
  58561. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  58562. }
  58563. if (is_object($schema) && property_exists($schema, 'id')) {
  58564. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  58565. $schema->properties->id->format = 'uri-reference';
  58566. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  58567. $schema->properties->id->format = 'uri-reference';
  58568. $schema->properties->{'$ref'}->format = 'uri-reference';
  58569. }
  58570. }
  58571. $this->expandRefs($schema, $id);
  58572. $this->schemas[$id] = $schema;
  58573. }
  58574. private function expandRefs(&$schema, $base = null)
  58575. {
  58576. if (!is_object($schema)) {
  58577. if (is_array($schema)) {
  58578. foreach ($schema as &$member) {
  58579. $this->expandRefs($member, $base);
  58580. }
  58581. }
  58582. return;
  58583. }
  58584. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  58585. $base = $this->uriResolver->resolve($schema->id, $base);
  58586. }
  58587. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  58588. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  58589. $schema->{'$ref'} = (string) $refPointer;
  58590. }
  58591. foreach ($schema as &$member) {
  58592. $this->expandRefs($member, $base);
  58593. }
  58594. }
  58595. public function getSchema($id)
  58596. {
  58597. if (!array_key_exists($id, $this->schemas)) {
  58598. $this->addSchema($id);
  58599. }
  58600. return $this->schemas[$id];
  58601. }
  58602. public function resolveRef($ref)
  58603. {
  58604. $jsonPointer = new JsonPointer($ref);
  58605. $fileName = $jsonPointer->getFilename();
  58606. if (!strlen($fileName)) {
  58607. throw new UnresolvableJsonPointerException(sprintf(
  58608. "Could not resolve fragment '%s': no file is defined",
  58609. $jsonPointer->getPropertyPathAsString()
  58610. ));
  58611. }
  58612. $refSchema = $this->getSchema($fileName);
  58613. foreach ($jsonPointer->getPropertyPaths() as $path) {
  58614. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  58615. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  58616. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  58617. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  58618. } else {
  58619. throw new UnresolvableJsonPointerException(sprintf(
  58620. 'File: %s is found, but could not resolve fragment: %s',
  58621. $jsonPointer->getFilename(),
  58622. $jsonPointer->getPropertyPathAsString()
  58623. ));
  58624. }
  58625. }
  58626. return $refSchema;
  58627. }
  58628. public function resolveRefSchema($refSchema)
  58629. {
  58630. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  58631. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  58632. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  58633. unset($refSchema->{'$ref'});
  58634. }
  58635. return $refSchema;
  58636. }
  58637. }
  58638. <?php
  58639. namespace JsonSchema;
  58640. interface SchemaStorageInterface
  58641. {
  58642. public function addSchema($id, $schema = null);
  58643. public function getSchema($id);
  58644. public function resolveRef($ref);
  58645. public function resolveRefSchema($refSchema);
  58646. }
  58647. <?php
  58648. namespace JsonSchema\Uri\Retrievers;
  58649. abstract class AbstractRetriever implements UriRetrieverInterface
  58650. {
  58651. protected $contentType;
  58652. public function getContentType()
  58653. {
  58654. return $this->contentType;
  58655. }
  58656. }
  58657. <?php
  58658. namespace JsonSchema\Uri\Retrievers;
  58659. use JsonSchema\Exception\RuntimeException;
  58660. use JsonSchema\Validator;
  58661. class Curl extends AbstractRetriever
  58662. {
  58663. protected $messageBody;
  58664. public function __construct()
  58665. {
  58666. if (!function_exists('curl_init')) {
  58667. throw new RuntimeException('cURL not installed');
  58668. }
  58669. }
  58670. public function retrieve($uri)
  58671. {
  58672. $ch = curl_init();
  58673. curl_setopt($ch, CURLOPT_URL, $uri);
  58674. curl_setopt($ch, CURLOPT_HEADER, true);
  58675. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  58676. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  58677. $response = curl_exec($ch);
  58678. if (false === $response) {
  58679. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  58680. }
  58681. $this->fetchMessageBody($response);
  58682. $this->fetchContentType($response);
  58683. curl_close($ch);
  58684. return $this->messageBody;
  58685. }
  58686. private function fetchMessageBody($response)
  58687. {
  58688. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  58689. $this->messageBody = $match[1];
  58690. }
  58691. protected function fetchContentType($response)
  58692. {
  58693. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  58694. $this->contentType = trim($match[1]);
  58695. return true;
  58696. }
  58697. return false;
  58698. }
  58699. }
  58700. <?php
  58701. namespace JsonSchema\Uri\Retrievers;
  58702. use JsonSchema\Exception\ResourceNotFoundException;
  58703. class FileGetContents extends AbstractRetriever
  58704. {
  58705. protected $messageBody;
  58706. public function retrieve($uri)
  58707. {
  58708. $errorMessage = null;
  58709. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  58710. $errorMessage = $errstr;
  58711. });
  58712. $response = file_get_contents($uri);
  58713. restore_error_handler();
  58714. if ($errorMessage) {
  58715. throw new ResourceNotFoundException($errorMessage);
  58716. }
  58717. if (false === $response) {
  58718. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  58719. }
  58720. if ($response == ''
  58721. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  58722. ) {
  58723. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  58724. }
  58725. $this->messageBody = $response;
  58726. if (!empty($http_response_header)) {
  58727. $this->fetchContentType($http_response_header);
  58728. } else {
  58729. $this->contentType = null;
  58730. }
  58731. return $this->messageBody;
  58732. }
  58733. private function fetchContentType(array $headers)
  58734. {
  58735. foreach ($headers as $header) {
  58736. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  58737. return true;
  58738. }
  58739. }
  58740. return false;
  58741. }
  58742. protected static function getContentTypeMatchInHeader($header)
  58743. {
  58744. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  58745. return trim($match[1]);
  58746. }
  58747. return null;
  58748. }
  58749. }
  58750. <?php
  58751. namespace JsonSchema\Uri\Retrievers;
  58752. use JsonSchema\Validator;
  58753. class PredefinedArray extends AbstractRetriever
  58754. {
  58755. private $schemas;
  58756. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  58757. {
  58758. $this->schemas = $schemas;
  58759. $this->contentType = $contentType;
  58760. }
  58761. public function retrieve($uri)
  58762. {
  58763. if (!array_key_exists($uri, $this->schemas)) {
  58764. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  58765. 'The JSON schema "%s" was not found.',
  58766. $uri
  58767. ));
  58768. }
  58769. return $this->schemas[$uri];
  58770. }
  58771. }
  58772. <?php
  58773. namespace JsonSchema\Uri\Retrievers;
  58774. interface UriRetrieverInterface
  58775. {
  58776. public function retrieve($uri);
  58777. public function getContentType();
  58778. }
  58779. <?php
  58780. namespace JsonSchema\Uri;
  58781. use JsonSchema\Exception\UriResolverException;
  58782. use JsonSchema\UriResolverInterface;
  58783. class UriResolver implements UriResolverInterface
  58784. {
  58785. public function parse($uri)
  58786. {
  58787. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  58788. $components = array();
  58789. if (5 < count($match)) {
  58790. $components = array(
  58791. 'scheme' => $match[2],
  58792. 'authority' => $match[4],
  58793. 'path' => $match[5]
  58794. );
  58795. }
  58796. if (7 < count($match)) {
  58797. $components['query'] = $match[7];
  58798. }
  58799. if (9 < count($match)) {
  58800. $components['fragment'] = $match[9];
  58801. }
  58802. return $components;
  58803. }
  58804. public function generate(array $components)
  58805. {
  58806. $uri = $components['scheme'] . '://'
  58807. . $components['authority']
  58808. . $components['path'];
  58809. if (array_key_exists('query', $components) && strlen($components['query'])) {
  58810. $uri .= '?' . $components['query'];
  58811. }
  58812. if (array_key_exists('fragment', $components)) {
  58813. $uri .= '#' . $components['fragment'];
  58814. }
  58815. return $uri;
  58816. }
  58817. public function resolve($uri, $baseUri = null)
  58818. {
  58819. if (
  58820. !is_null($baseUri) &&
  58821. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  58822. !preg_match('|^[^/]+://|u', $baseUri)
  58823. ) {
  58824. if (is_file($baseUri)) {
  58825. $baseUri = 'file://' . realpath($baseUri);
  58826. } elseif (is_dir($baseUri)) {
  58827. $baseUri = 'file://' . realpath($baseUri) . '/';
  58828. } else {
  58829. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  58830. }
  58831. }
  58832. if ($uri == '') {
  58833. return $baseUri;
  58834. }
  58835. $components = $this->parse($uri);
  58836. $path = $components['path'];
  58837. if (!empty($components['scheme'])) {
  58838. return $uri;
  58839. }
  58840. $baseComponents = $this->parse($baseUri);
  58841. $basePath = $baseComponents['path'];
  58842. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  58843. if (isset($components['fragment'])) {
  58844. $baseComponents['fragment'] = $components['fragment'];
  58845. }
  58846. return $this->generate($baseComponents);
  58847. }
  58848. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  58849. {
  58850. $relativePath = self::normalizePath($relativePath);
  58851. if ($relativePath == '') {
  58852. return $basePath;
  58853. }
  58854. if ($relativePath[0] == '/') {
  58855. return $relativePath;
  58856. }
  58857. $basePathSegments = explode('/', $basePath);
  58858. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  58859. $numLevelUp = strlen($match[0]) /3 + 1;
  58860. if ($numLevelUp >= count($basePathSegments)) {
  58861. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  58862. }
  58863. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  58864. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  58865. return implode('/', $basePathSegments) . '/' . $path;
  58866. }
  58867. private static function normalizePath($path)
  58868. {
  58869. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  58870. $path = preg_replace('|//|', '/', $path);
  58871. return $path;
  58872. }
  58873. public function isValid($uri)
  58874. {
  58875. $components = $this->parse($uri);
  58876. return !empty($components);
  58877. }
  58878. }
  58879. <?php
  58880. namespace JsonSchema\Uri;
  58881. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  58882. use JsonSchema\Exception\JsonDecodingException;
  58883. use JsonSchema\Exception\ResourceNotFoundException;
  58884. use JsonSchema\Uri\Retrievers\FileGetContents;
  58885. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  58886. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  58887. use JsonSchema\Validator;
  58888. class UriRetriever implements BaseUriRetrieverInterface
  58889. {
  58890. protected $translationMap = array(
  58891. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  58892. );
  58893. protected $allowedInvalidContentTypeEndpoints = array(
  58894. 'http://json-schema.org/',
  58895. 'https://json-schema.org/'
  58896. );
  58897. protected $uriRetriever = null;
  58898. private $schemaCache = array();
  58899. public function addInvalidContentTypeEndpoint($endpoint)
  58900. {
  58901. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  58902. }
  58903. public function confirmMediaType($uriRetriever, $uri)
  58904. {
  58905. $contentType = $uriRetriever->getContentType();
  58906. if (is_null($contentType)) {
  58907. return;
  58908. }
  58909. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  58910. return;
  58911. }
  58912. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  58913. if (strpos($uri, $endpoint) === 0) {
  58914. return true;
  58915. }
  58916. }
  58917. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  58918. }
  58919. public function getUriRetriever()
  58920. {
  58921. if (is_null($this->uriRetriever)) {
  58922. $this->setUriRetriever(new FileGetContents());
  58923. }
  58924. return $this->uriRetriever;
  58925. }
  58926. public function resolvePointer($jsonSchema, $uri)
  58927. {
  58928. $resolver = new UriResolver();
  58929. $parsed = $resolver->parse($uri);
  58930. if (empty($parsed['fragment'])) {
  58931. return $jsonSchema;
  58932. }
  58933. $path = explode('/', $parsed['fragment']);
  58934. while ($path) {
  58935. $pathElement = array_shift($path);
  58936. if (!empty($pathElement)) {
  58937. $pathElement = str_replace('~1', '/', $pathElement);
  58938. $pathElement = str_replace('~0', '~', $pathElement);
  58939. if (!empty($jsonSchema->$pathElement)) {
  58940. $jsonSchema = $jsonSchema->$pathElement;
  58941. } else {
  58942. throw new ResourceNotFoundException(
  58943. 'Fragment "' . $parsed['fragment'] . '" not found'
  58944. . ' in ' . $uri
  58945. );
  58946. }
  58947. if (!is_object($jsonSchema)) {
  58948. throw new ResourceNotFoundException(
  58949. 'Fragment part "' . $pathElement . '" is no object '
  58950. . ' in ' . $uri
  58951. );
  58952. }
  58953. }
  58954. }
  58955. return $jsonSchema;
  58956. }
  58957. public function retrieve($uri, $baseUri = null, $translate = true)
  58958. {
  58959. $resolver = new UriResolver();
  58960. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  58961. $arParts = $resolver->parse($resolvedUri);
  58962. if (isset($arParts['fragment'])) {
  58963. unset($arParts['fragment']);
  58964. $fetchUri = $resolver->generate($arParts);
  58965. }
  58966. if ($translate) {
  58967. $fetchUri = $this->translate($fetchUri);
  58968. }
  58969. $jsonSchema = $this->loadSchema($fetchUri);
  58970. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  58971. if ($jsonSchema instanceof \stdClass) {
  58972. $jsonSchema->id = $resolvedUri;
  58973. }
  58974. return $jsonSchema;
  58975. }
  58976. protected function loadSchema($fetchUri)
  58977. {
  58978. if (isset($this->schemaCache[$fetchUri])) {
  58979. return $this->schemaCache[$fetchUri];
  58980. }
  58981. $uriRetriever = $this->getUriRetriever();
  58982. $contents = $this->uriRetriever->retrieve($fetchUri);
  58983. $this->confirmMediaType($uriRetriever, $fetchUri);
  58984. $jsonSchema = json_decode($contents);
  58985. if (JSON_ERROR_NONE < $error = json_last_error()) {
  58986. throw new JsonDecodingException($error);
  58987. }
  58988. $this->schemaCache[$fetchUri] = $jsonSchema;
  58989. return $jsonSchema;
  58990. }
  58991. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  58992. {
  58993. $this->uriRetriever = $uriRetriever;
  58994. return $this;
  58995. }
  58996. public function parse($uri)
  58997. {
  58998. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  58999. $components = array();
  59000. if (5 < count($match)) {
  59001. $components = array(
  59002. 'scheme' => $match[2],
  59003. 'authority' => $match[4],
  59004. 'path' => $match[5]
  59005. );
  59006. }
  59007. if (7 < count($match)) {
  59008. $components['query'] = $match[7];
  59009. }
  59010. if (9 < count($match)) {
  59011. $components['fragment'] = $match[9];
  59012. }
  59013. return $components;
  59014. }
  59015. public function generate(array $components)
  59016. {
  59017. $uri = $components['scheme'] . '://'
  59018. . $components['authority']
  59019. . $components['path'];
  59020. if (array_key_exists('query', $components)) {
  59021. $uri .= $components['query'];
  59022. }
  59023. if (array_key_exists('fragment', $components)) {
  59024. $uri .= $components['fragment'];
  59025. }
  59026. return $uri;
  59027. }
  59028. public function resolve($uri, $baseUri = null)
  59029. {
  59030. $components = $this->parse($uri);
  59031. $path = $components['path'];
  59032. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  59033. return $uri;
  59034. }
  59035. $baseComponents = $this->parse($baseUri);
  59036. $basePath = $baseComponents['path'];
  59037. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  59038. return $this->generate($baseComponents);
  59039. }
  59040. public function isValid($uri)
  59041. {
  59042. $components = $this->parse($uri);
  59043. return !empty($components);
  59044. }
  59045. public function setTranslation($from, $to)
  59046. {
  59047. $this->translationMap[$from] = $to;
  59048. }
  59049. public function translate($uri)
  59050. {
  59051. foreach ($this->translationMap as $from => $to) {
  59052. $uri = preg_replace($from, $to, $uri);
  59053. }
  59054. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  59055. return $uri;
  59056. }
  59057. }
  59058. <?php
  59059. namespace JsonSchema;
  59060. interface UriResolverInterface
  59061. {
  59062. public function resolve($uri, $baseUri = null);
  59063. }
  59064. <?php
  59065. namespace JsonSchema;
  59066. interface UriRetrieverInterface
  59067. {
  59068. public function retrieve($uri, $baseUri = null);
  59069. }
  59070. <?php
  59071. namespace JsonSchema;
  59072. use JsonSchema\Constraints\BaseConstraint;
  59073. use JsonSchema\Constraints\Constraint;
  59074. class Validator extends BaseConstraint
  59075. {
  59076. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  59077. const ERROR_NONE = 0x00000000;
  59078. const ERROR_ALL = 0xFFFFFFFF;
  59079. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  59080. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  59081. public function validate(&$value, $schema = null, $checkMode = null)
  59082. {
  59083. if (is_array($schema)) {
  59084. $schema = self::arrayToObjectRecursive($schema);
  59085. }
  59086. $initialCheckMode = $this->factory->getConfig();
  59087. if ($checkMode !== null) {
  59088. $this->factory->setConfig($checkMode);
  59089. }
  59090. if (is_object($schema) && property_exists($schema, 'id')) {
  59091. $schemaURI = $schema->id;
  59092. } else {
  59093. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  59094. }
  59095. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  59096. $validator = $this->factory->createInstanceFor('schema');
  59097. $validator->check(
  59098. $value,
  59099. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  59100. );
  59101. $this->factory->setConfig($initialCheckMode);
  59102. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  59103. return $validator->getErrorMask();
  59104. }
  59105. public function check($value, $schema)
  59106. {
  59107. return $this->validate($value, $schema);
  59108. }
  59109. public function coerce(&$value, $schema)
  59110. {
  59111. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  59112. }
  59113. }
  59114. The MIT License (MIT)
  59115. Copyright (c) 2013-2016 container-interop
  59116. Copyright (c) 2016 PHP Framework Interoperability Group
  59117. Permission is hereby granted, free of charge, to any person obtaining a copy of
  59118. this software and associated documentation files (the "Software"), to deal in
  59119. the Software without restriction, including without limitation the rights to
  59120. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  59121. the Software, and to permit persons to whom the Software is furnished to do so,
  59122. subject to the following conditions:
  59123. The above copyright notice and this permission notice shall be included in all
  59124. copies or substantial portions of the Software.
  59125. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  59126. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  59127. FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  59128. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  59129. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  59130. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  59131. <?php
  59132. namespace Psr\Container;
  59133. interface ContainerExceptionInterface
  59134. {
  59135. }
  59136. <?php
  59137. declare(strict_types=1);
  59138. namespace Psr\Container;
  59139. interface ContainerInterface
  59140. {
  59141. public function get(string $id);
  59142. public function has(string $id);
  59143. }
  59144. <?php
  59145. namespace Psr\Container;
  59146. interface NotFoundExceptionInterface extends ContainerExceptionInterface
  59147. {
  59148. }
  59149. Copyright (c) 2012 PHP Framework Interoperability Group
  59150. Permission is hereby granted, free of charge, to any person obtaining a copy
  59151. of this software and associated documentation files (the "Software"), to deal
  59152. in the Software without restriction, including without limitation the rights
  59153. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  59154. copies of the Software, and to permit persons to whom the Software is
  59155. furnished to do so, subject to the following conditions:
  59156. The above copyright notice and this permission notice shall be included in
  59157. all copies or substantial portions of the Software.
  59158. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  59159. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  59160. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  59161. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  59162. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  59163. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  59164. THE SOFTWARE.
  59165. <?php
  59166. namespace Psr\Log;
  59167. abstract class AbstractLogger implements LoggerInterface
  59168. {
  59169. public function emergency($message, array $context = array())
  59170. {
  59171. $this->log(LogLevel::EMERGENCY, $message, $context);
  59172. }
  59173. public function alert($message, array $context = array())
  59174. {
  59175. $this->log(LogLevel::ALERT, $message, $context);
  59176. }
  59177. public function critical($message, array $context = array())
  59178. {
  59179. $this->log(LogLevel::CRITICAL, $message, $context);
  59180. }
  59181. public function error($message, array $context = array())
  59182. {
  59183. $this->log(LogLevel::ERROR, $message, $context);
  59184. }
  59185. public function warning($message, array $context = array())
  59186. {
  59187. $this->log(LogLevel::WARNING, $message, $context);
  59188. }
  59189. public function notice($message, array $context = array())
  59190. {
  59191. $this->log(LogLevel::NOTICE, $message, $context);
  59192. }
  59193. public function info($message, array $context = array())
  59194. {
  59195. $this->log(LogLevel::INFO, $message, $context);
  59196. }
  59197. public function debug($message, array $context = array())
  59198. {
  59199. $this->log(LogLevel::DEBUG, $message, $context);
  59200. }
  59201. }
  59202. <?php
  59203. namespace Psr\Log;
  59204. class InvalidArgumentException extends \InvalidArgumentException
  59205. {
  59206. }
  59207. <?php
  59208. namespace Psr\Log;
  59209. class LogLevel
  59210. {
  59211. const EMERGENCY = 'emergency';
  59212. const ALERT = 'alert';
  59213. const CRITICAL = 'critical';
  59214. const ERROR = 'error';
  59215. const WARNING = 'warning';
  59216. const NOTICE = 'notice';
  59217. const INFO = 'info';
  59218. const DEBUG = 'debug';
  59219. }
  59220. <?php
  59221. namespace Psr\Log;
  59222. interface LoggerAwareInterface
  59223. {
  59224. public function setLogger(LoggerInterface $logger);
  59225. }
  59226. <?php
  59227. namespace Psr\Log;
  59228. trait LoggerAwareTrait
  59229. {
  59230. protected $logger;
  59231. public function setLogger(LoggerInterface $logger)
  59232. {
  59233. $this->logger = $logger;
  59234. }
  59235. }
  59236. <?php
  59237. namespace Psr\Log;
  59238. interface LoggerInterface
  59239. {
  59240. public function emergency($message, array $context = array());
  59241. public function alert($message, array $context = array());
  59242. public function critical($message, array $context = array());
  59243. public function error($message, array $context = array());
  59244. public function warning($message, array $context = array());
  59245. public function notice($message, array $context = array());
  59246. public function info($message, array $context = array());
  59247. public function debug($message, array $context = array());
  59248. public function log($level, $message, array $context = array());
  59249. }
  59250. <?php
  59251. namespace Psr\Log;
  59252. trait LoggerTrait
  59253. {
  59254. public function emergency($message, array $context = array())
  59255. {
  59256. $this->log(LogLevel::EMERGENCY, $message, $context);
  59257. }
  59258. public function alert($message, array $context = array())
  59259. {
  59260. $this->log(LogLevel::ALERT, $message, $context);
  59261. }
  59262. public function critical($message, array $context = array())
  59263. {
  59264. $this->log(LogLevel::CRITICAL, $message, $context);
  59265. }
  59266. public function error($message, array $context = array())
  59267. {
  59268. $this->log(LogLevel::ERROR, $message, $context);
  59269. }
  59270. public function warning($message, array $context = array())
  59271. {
  59272. $this->log(LogLevel::WARNING, $message, $context);
  59273. }
  59274. public function notice($message, array $context = array())
  59275. {
  59276. $this->log(LogLevel::NOTICE, $message, $context);
  59277. }
  59278. public function info($message, array $context = array())
  59279. {
  59280. $this->log(LogLevel::INFO, $message, $context);
  59281. }
  59282. public function debug($message, array $context = array())
  59283. {
  59284. $this->log(LogLevel::DEBUG, $message, $context);
  59285. }
  59286. abstract public function log($level, $message, array $context = array());
  59287. }
  59288. <?php
  59289. namespace Psr\Log;
  59290. class NullLogger extends AbstractLogger
  59291. {
  59292. public function log($level, $message, array $context = array())
  59293. {
  59294. }
  59295. }
  59296. <?php
  59297. namespace Psr\Log\Test;
  59298. class DummyTest
  59299. {
  59300. public function __toString()
  59301. {
  59302. return 'DummyTest';
  59303. }
  59304. }
  59305. <?php
  59306. namespace Psr\Log\Test;
  59307. use Psr\Log\LoggerInterface;
  59308. use Psr\Log\LogLevel;
  59309. use PHPUnit\Framework\TestCase;
  59310. abstract class LoggerInterfaceTest extends TestCase
  59311. {
  59312. abstract public function getLogger();
  59313. abstract public function getLogs();
  59314. public function testImplements()
  59315. {
  59316. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  59317. }
  59318. public function testLogsAtAllLevels($level, $message)
  59319. {
  59320. $logger = $this->getLogger();
  59321. $logger->{$level}($message, array('user' => 'Bob'));
  59322. $logger->log($level, $message, array('user' => 'Bob'));
  59323. $expected = array(
  59324. $level.' message of level '.$level.' with context: Bob',
  59325. $level.' message of level '.$level.' with context: Bob',
  59326. );
  59327. $this->assertEquals($expected, $this->getLogs());
  59328. }
  59329. public function provideLevelsAndMessages()
  59330. {
  59331. return array(
  59332. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  59333. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  59334. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  59335. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  59336. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  59337. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  59338. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  59339. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  59340. );
  59341. }
  59342. public function testThrowsOnInvalidLevel()
  59343. {
  59344. $logger = $this->getLogger();
  59345. $logger->log('invalid level', 'Foo');
  59346. }
  59347. public function testContextReplacement()
  59348. {
  59349. $logger = $this->getLogger();
  59350. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  59351. $expected = array('info {Message {nothing} Bob Bar a}');
  59352. $this->assertEquals($expected, $this->getLogs());
  59353. }
  59354. public function testObjectCastToString()
  59355. {
  59356. if (method_exists($this, 'createPartialMock')) {
  59357. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  59358. } else {
  59359. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  59360. }
  59361. $dummy->expects($this->once())
  59362. ->method('__toString')
  59363. ->will($this->returnValue('DUMMY'));
  59364. $this->getLogger()->warning($dummy);
  59365. $expected = array('warning DUMMY');
  59366. $this->assertEquals($expected, $this->getLogs());
  59367. }
  59368. public function testContextCanContainAnything()
  59369. {
  59370. $closed = fopen('php://memory', 'r');
  59371. fclose($closed);
  59372. $context = array(
  59373. 'bool' => true,
  59374. 'null' => null,
  59375. 'string' => 'Foo',
  59376. 'int' => 0,
  59377. 'float' => 0.5,
  59378. 'nested' => array('with object' => new DummyTest),
  59379. 'object' => new \DateTime,
  59380. 'resource' => fopen('php://memory', 'r'),
  59381. 'closed' => $closed,
  59382. );
  59383. $this->getLogger()->warning('Crazy context data', $context);
  59384. $expected = array('warning Crazy context data');
  59385. $this->assertEquals($expected, $this->getLogs());
  59386. }
  59387. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  59388. {
  59389. $logger = $this->getLogger();
  59390. $logger->warning('Random message', array('exception' => 'oops'));
  59391. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  59392. $expected = array(
  59393. 'warning Random message',
  59394. 'critical Uncaught Exception!'
  59395. );
  59396. $this->assertEquals($expected, $this->getLogs());
  59397. }
  59398. }
  59399. <?php
  59400. namespace Psr\Log\Test;
  59401. use Psr\Log\AbstractLogger;
  59402. class TestLogger extends AbstractLogger
  59403. {
  59404. public $records = [];
  59405. public $recordsByLevel = [];
  59406. public function log($level, $message, array $context = [])
  59407. {
  59408. $record = [
  59409. 'level' => $level,
  59410. 'message' => $message,
  59411. 'context' => $context,
  59412. ];
  59413. $this->recordsByLevel[$record['level']][] = $record;
  59414. $this->records[] = $record;
  59415. }
  59416. public function hasRecords($level)
  59417. {
  59418. return isset($this->recordsByLevel[$level]);
  59419. }
  59420. public function hasRecord($record, $level)
  59421. {
  59422. if (is_string($record)) {
  59423. $record = ['message' => $record];
  59424. }
  59425. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  59426. if ($rec['message'] !== $record['message']) {
  59427. return false;
  59428. }
  59429. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  59430. return false;
  59431. }
  59432. return true;
  59433. }, $level);
  59434. }
  59435. public function hasRecordThatContains($message, $level)
  59436. {
  59437. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  59438. return strpos($rec['message'], $message) !== false;
  59439. }, $level);
  59440. }
  59441. public function hasRecordThatMatches($regex, $level)
  59442. {
  59443. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  59444. return preg_match($regex, $rec['message']) > 0;
  59445. }, $level);
  59446. }
  59447. public function hasRecordThatPasses(callable $predicate, $level)
  59448. {
  59449. if (!isset($this->recordsByLevel[$level])) {
  59450. return false;
  59451. }
  59452. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  59453. if (call_user_func($predicate, $rec, $i)) {
  59454. return true;
  59455. }
  59456. }
  59457. return false;
  59458. }
  59459. public function __call($method, $args)
  59460. {
  59461. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  59462. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  59463. $level = strtolower($matches[2]);
  59464. if (method_exists($this, $genericMethod)) {
  59465. $args[] = $level;
  59466. return call_user_func_array([$this, $genericMethod], $args);
  59467. }
  59468. }
  59469. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  59470. }
  59471. public function reset()
  59472. {
  59473. $this->records = [];
  59474. $this->recordsByLevel = [];
  59475. }
  59476. }
  59477. The MIT License (MIT)
  59478. Copyright (c) 2012 Jan Sorgalla, Christian Lück, Cees-Jan Kiewiet, Chris Boden
  59479. Permission is hereby granted, free of charge, to any person
  59480. obtaining a copy of this software and associated documentation
  59481. files (the "Software"), to deal in the Software without
  59482. restriction, including without limitation the rights to use,
  59483. copy, modify, merge, publish, distribute, sublicense, and/or sell
  59484. copies of the Software, and to permit persons to whom the
  59485. Software is furnished to do so, subject to the following
  59486. conditions:
  59487. The above copyright notice and this permission notice shall be
  59488. included in all copies or substantial portions of the Software.
  59489. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  59490. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  59491. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  59492. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  59493. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  59494. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  59495. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  59496. OTHER DEALINGS IN THE SOFTWARE.
  59497. <?php
  59498. namespace React\Promise;
  59499. final class Deferred
  59500. {
  59501. private $promise;
  59502. private $resolveCallback;
  59503. private $rejectCallback;
  59504. public function __construct(?callable $canceller = null)
  59505. {
  59506. $this->promise = new Promise(function ($resolve, $reject): void {
  59507. $this->resolveCallback = $resolve;
  59508. $this->rejectCallback = $reject;
  59509. }, $canceller);
  59510. }
  59511. public function promise(): PromiseInterface
  59512. {
  59513. return $this->promise;
  59514. }
  59515. public function resolve($value): void
  59516. {
  59517. ($this->resolveCallback)($value);
  59518. }
  59519. public function reject(\Throwable $reason): void
  59520. {
  59521. ($this->rejectCallback)($reason);
  59522. }
  59523. }
  59524. <?php
  59525. namespace React\Promise\Exception;
  59526. class CompositeException extends \Exception
  59527. {
  59528. private $throwables;
  59529. public function __construct(array $throwables, string $message = '', int $code = 0, ?\Throwable $previous = null)
  59530. {
  59531. parent::__construct($message, $code, $previous);
  59532. $this->throwables = $throwables;
  59533. }
  59534. public function getThrowables(): array
  59535. {
  59536. return $this->throwables;
  59537. }
  59538. }
  59539. <?php
  59540. namespace React\Promise\Exception;
  59541. class LengthException extends \LengthException
  59542. {
  59543. }
  59544. <?php
  59545. namespace React\Promise\Internal;
  59546. final class CancellationQueue
  59547. {
  59548. private $started = false;
  59549. private $queue = [];
  59550. public function __invoke(): void
  59551. {
  59552. if ($this->started) {
  59553. return;
  59554. }
  59555. $this->started = true;
  59556. $this->drain();
  59557. }
  59558. public function enqueue($cancellable): void
  59559. {
  59560. if (!\is_object($cancellable) || !\method_exists($cancellable, 'then') || !\method_exists($cancellable, 'cancel')) {
  59561. return;
  59562. }
  59563. $length = \array_push($this->queue, $cancellable);
  59564. if ($this->started && 1 === $length) {
  59565. $this->drain();
  59566. }
  59567. }
  59568. private function drain(): void
  59569. {
  59570. for ($i = \key($this->queue); isset($this->queue[$i]); $i++) {
  59571. $cancellable = $this->queue[$i];
  59572. assert(\method_exists($cancellable, 'cancel'));
  59573. $exception = null;
  59574. try {
  59575. $cancellable->cancel();
  59576. } catch (\Throwable $exception) {
  59577. }
  59578. unset($this->queue[$i]);
  59579. if ($exception) {
  59580. throw $exception;
  59581. }
  59582. }
  59583. $this->queue = [];
  59584. }
  59585. }
  59586. <?php
  59587. namespace React\Promise\Internal;
  59588. use React\Promise\PromiseInterface;
  59589. use function React\Promise\resolve;
  59590. final class FulfilledPromise implements PromiseInterface
  59591. {
  59592. private $value;
  59593. public function __construct($value = null)
  59594. {
  59595. if ($value instanceof PromiseInterface) {
  59596. throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.');
  59597. }
  59598. $this->value = $value;
  59599. }
  59600. public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface
  59601. {
  59602. if (null === $onFulfilled) {
  59603. return $this;
  59604. }
  59605. try {
  59606. $result = $onFulfilled($this->value);
  59607. return resolve($result);
  59608. } catch (\Throwable $exception) {
  59609. return new RejectedPromise($exception);
  59610. }
  59611. }
  59612. public function catch(callable $onRejected): PromiseInterface
  59613. {
  59614. return $this;
  59615. }
  59616. public function finally(callable $onFulfilledOrRejected): PromiseInterface
  59617. {
  59618. return $this->then(function ($value) use ($onFulfilledOrRejected): PromiseInterface {
  59619. return resolve($onFulfilledOrRejected())->then(function () use ($value) {
  59620. return $value;
  59621. });
  59622. });
  59623. }
  59624. public function cancel(): void
  59625. {
  59626. }
  59627. public function otherwise(callable $onRejected): PromiseInterface
  59628. {
  59629. return $this->catch($onRejected);
  59630. }
  59631. public function always(callable $onFulfilledOrRejected): PromiseInterface
  59632. {
  59633. return $this->finally($onFulfilledOrRejected);
  59634. }
  59635. }
  59636. <?php
  59637. namespace React\Promise\Internal;
  59638. use React\Promise\PromiseInterface;
  59639. use function React\Promise\_checkTypehint;
  59640. use function React\Promise\resolve;
  59641. use function React\Promise\set_rejection_handler;
  59642. final class RejectedPromise implements PromiseInterface
  59643. {
  59644. private $reason;
  59645. private $handled = false;
  59646. public function __construct(\Throwable $reason)
  59647. {
  59648. $this->reason = $reason;
  59649. }
  59650. public function __destruct()
  59651. {
  59652. if ($this->handled) {
  59653. return;
  59654. }
  59655. $handler = set_rejection_handler(null);
  59656. if ($handler === null) {
  59657. $message = 'Unhandled promise rejection with ' . $this->reason;
  59658. \error_log($message);
  59659. return;
  59660. }
  59661. try {
  59662. $handler($this->reason);
  59663. } catch (\Throwable $e) {
  59664. \preg_match('/^([^:\s]++)(.*+)$/sm', (string) $e, $match);
  59665. \assert(isset($match[1], $match[2]));
  59666. $message = 'Fatal error: Uncaught ' . $match[1] . ' from unhandled promise rejection handler' . $match[2];
  59667. \error_log($message);
  59668. exit(255);
  59669. }
  59670. }
  59671. public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface
  59672. {
  59673. if (null === $onRejected) {
  59674. return $this;
  59675. }
  59676. $this->handled = true;
  59677. try {
  59678. return resolve($onRejected($this->reason));
  59679. } catch (\Throwable $exception) {
  59680. return new RejectedPromise($exception);
  59681. }
  59682. }
  59683. public function catch(callable $onRejected): PromiseInterface
  59684. {
  59685. if (!_checkTypehint($onRejected, $this->reason)) {
  59686. return $this;
  59687. }
  59688. return $this->then(null, $onRejected);
  59689. }
  59690. public function finally(callable $onFulfilledOrRejected): PromiseInterface
  59691. {
  59692. return $this->then(null, function (\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface {
  59693. return resolve($onFulfilledOrRejected())->then(function () use ($reason): PromiseInterface {
  59694. return new RejectedPromise($reason);
  59695. });
  59696. });
  59697. }
  59698. public function cancel(): void
  59699. {
  59700. $this->handled = true;
  59701. }
  59702. public function otherwise(callable $onRejected): PromiseInterface
  59703. {
  59704. return $this->catch($onRejected);
  59705. }
  59706. public function always(callable $onFulfilledOrRejected): PromiseInterface
  59707. {
  59708. return $this->finally($onFulfilledOrRejected);
  59709. }
  59710. }
  59711. <?php
  59712. namespace React\Promise;
  59713. use React\Promise\Internal\RejectedPromise;
  59714. final class Promise implements PromiseInterface
  59715. {
  59716. private $canceller;
  59717. private $result;
  59718. private $handlers = [];
  59719. private $requiredCancelRequests = 0;
  59720. private $cancelled = false;
  59721. public function __construct(callable $resolver, ?callable $canceller = null)
  59722. {
  59723. $this->canceller = $canceller;
  59724. $cb = $resolver;
  59725. $resolver = $canceller = null;
  59726. $this->call($cb);
  59727. }
  59728. public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface
  59729. {
  59730. if (null !== $this->result) {
  59731. return $this->result->then($onFulfilled, $onRejected);
  59732. }
  59733. if (null === $this->canceller) {
  59734. return new static($this->resolver($onFulfilled, $onRejected));
  59735. }
  59736. $parent = $this;
  59737. ++$parent->requiredCancelRequests;
  59738. return new static(
  59739. $this->resolver($onFulfilled, $onRejected),
  59740. static function () use (&$parent): void {
  59741. assert($parent instanceof self);
  59742. --$parent->requiredCancelRequests;
  59743. if ($parent->requiredCancelRequests <= 0) {
  59744. $parent->cancel();
  59745. }
  59746. $parent = null;
  59747. }
  59748. );
  59749. }
  59750. public function catch(callable $onRejected): PromiseInterface
  59751. {
  59752. return $this->then(null, static function (\Throwable $reason) use ($onRejected) {
  59753. if (!_checkTypehint($onRejected, $reason)) {
  59754. return new RejectedPromise($reason);
  59755. }
  59756. return $onRejected($reason);
  59757. });
  59758. }
  59759. public function finally(callable $onFulfilledOrRejected): PromiseInterface
  59760. {
  59761. return $this->then(static function ($value) use ($onFulfilledOrRejected): PromiseInterface {
  59762. return resolve($onFulfilledOrRejected())->then(function () use ($value) {
  59763. return $value;
  59764. });
  59765. }, static function (\Throwable $reason) use ($onFulfilledOrRejected): PromiseInterface {
  59766. return resolve($onFulfilledOrRejected())->then(function () use ($reason): RejectedPromise {
  59767. return new RejectedPromise($reason);
  59768. });
  59769. });
  59770. }
  59771. public function cancel(): void
  59772. {
  59773. $this->cancelled = true;
  59774. $canceller = $this->canceller;
  59775. $this->canceller = null;
  59776. $parentCanceller = null;
  59777. if (null !== $this->result) {
  59778. if ($this->result instanceof RejectedPromise) {
  59779. $this->result->cancel();
  59780. }
  59781. $root = $this->unwrap($this->result);
  59782. if (!$root instanceof self || null !== $root->result) {
  59783. return;
  59784. }
  59785. $root->requiredCancelRequests--;
  59786. if ($root->requiredCancelRequests <= 0) {
  59787. $parentCanceller = [$root, 'cancel'];
  59788. }
  59789. }
  59790. if (null !== $canceller) {
  59791. $this->call($canceller);
  59792. }
  59793. if ($parentCanceller) {
  59794. $parentCanceller();
  59795. }
  59796. }
  59797. public function otherwise(callable $onRejected): PromiseInterface
  59798. {
  59799. return $this->catch($onRejected);
  59800. }
  59801. public function always(callable $onFulfilledOrRejected): PromiseInterface
  59802. {
  59803. return $this->finally($onFulfilledOrRejected);
  59804. }
  59805. private function resolver(?callable $onFulfilled = null, ?callable $onRejected = null): callable
  59806. {
  59807. return function (callable $resolve, callable $reject) use ($onFulfilled, $onRejected): void {
  59808. $this->handlers[] = static function (PromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject): void {
  59809. $promise = $promise->then($onFulfilled, $onRejected);
  59810. if ($promise instanceof self && $promise->result === null) {
  59811. $promise->handlers[] = static function (PromiseInterface $promise) use ($resolve, $reject): void {
  59812. $promise->then($resolve, $reject);
  59813. };
  59814. } else {
  59815. $promise->then($resolve, $reject);
  59816. }
  59817. };
  59818. };
  59819. }
  59820. private function reject(\Throwable $reason): void
  59821. {
  59822. if (null !== $this->result) {
  59823. return;
  59824. }
  59825. $this->settle(reject($reason));
  59826. }
  59827. private function settle(PromiseInterface $result): void
  59828. {
  59829. $result = $this->unwrap($result);
  59830. if ($result === $this) {
  59831. $result = new RejectedPromise(
  59832. new \LogicException('Cannot resolve a promise with itself.')
  59833. );
  59834. }
  59835. if ($result instanceof self) {
  59836. $result->requiredCancelRequests++;
  59837. } else {
  59838. $this->canceller = null;
  59839. }
  59840. $handlers = $this->handlers;
  59841. $this->handlers = [];
  59842. $this->result = $result;
  59843. foreach ($handlers as $handler) {
  59844. $handler($result);
  59845. }
  59846. if ($this->cancelled && $result instanceof RejectedPromise) {
  59847. $result->cancel();
  59848. }
  59849. }
  59850. private function unwrap(PromiseInterface $promise): PromiseInterface
  59851. {
  59852. while ($promise instanceof self && null !== $promise->result) {
  59853. $promise = $promise->result;
  59854. }
  59855. return $promise;
  59856. }
  59857. private function call(callable $cb): void
  59858. {
  59859. $callback = $cb;
  59860. $cb = null;
  59861. if (\is_array($callback)) {
  59862. $ref = new \ReflectionMethod($callback[0], $callback[1]);
  59863. } elseif (\is_object($callback) && !$callback instanceof \Closure) {
  59864. $ref = new \ReflectionMethod($callback, '__invoke');
  59865. } else {
  59866. assert($callback instanceof \Closure || \is_string($callback));
  59867. $ref = new \ReflectionFunction($callback);
  59868. }
  59869. $args = $ref->getNumberOfParameters();
  59870. try {
  59871. if ($args === 0) {
  59872. $callback();
  59873. } else {
  59874. $target =& $this;
  59875. $callback(
  59876. static function ($value) use (&$target): void {
  59877. if ($target !== null) {
  59878. $target->settle(resolve($value));
  59879. $target = null;
  59880. }
  59881. },
  59882. static function (\Throwable $reason) use (&$target): void {
  59883. if ($target !== null) {
  59884. $target->reject($reason);
  59885. $target = null;
  59886. }
  59887. }
  59888. );
  59889. }
  59890. } catch (\Throwable $e) {
  59891. $target = null;
  59892. $this->reject($e);
  59893. }
  59894. }
  59895. }
  59896. <?php
  59897. namespace React\Promise;
  59898. interface PromiseInterface
  59899. {
  59900. public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface;
  59901. public function catch(callable $onRejected): PromiseInterface;
  59902. public function finally(callable $onFulfilledOrRejected): PromiseInterface;
  59903. public function cancel(): void;
  59904. public function otherwise(callable $onRejected): PromiseInterface;
  59905. public function always(callable $onFulfilledOrRejected): PromiseInterface;
  59906. }
  59907. <?php
  59908. namespace React\Promise;
  59909. use React\Promise\Exception\CompositeException;
  59910. use React\Promise\Internal\FulfilledPromise;
  59911. use React\Promise\Internal\RejectedPromise;
  59912. function resolve($promiseOrValue): PromiseInterface
  59913. {
  59914. if ($promiseOrValue instanceof PromiseInterface) {
  59915. return $promiseOrValue;
  59916. }
  59917. if (\is_object($promiseOrValue) && \method_exists($promiseOrValue, 'then')) {
  59918. $canceller = null;
  59919. if (\method_exists($promiseOrValue, 'cancel')) {
  59920. $canceller = [$promiseOrValue, 'cancel'];
  59921. assert(\is_callable($canceller));
  59922. }
  59923. return new Promise(function (callable $resolve, callable $reject) use ($promiseOrValue): void {
  59924. $promiseOrValue->then($resolve, $reject);
  59925. }, $canceller);
  59926. }
  59927. return new FulfilledPromise($promiseOrValue);
  59928. }
  59929. function reject(\Throwable $reason): PromiseInterface
  59930. {
  59931. return new RejectedPromise($reason);
  59932. }
  59933. function all(iterable $promisesOrValues): PromiseInterface
  59934. {
  59935. $cancellationQueue = new Internal\CancellationQueue();
  59936. return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void {
  59937. $toResolve = 0;
  59938. $continue = true;
  59939. $values = [];
  59940. foreach ($promisesOrValues as $i => $promiseOrValue) {
  59941. $cancellationQueue->enqueue($promiseOrValue);
  59942. $values[$i] = null;
  59943. ++$toResolve;
  59944. resolve($promiseOrValue)->then(
  59945. function ($value) use ($i, &$values, &$toResolve, &$continue, $resolve): void {
  59946. $values[$i] = $value;
  59947. if (0 === --$toResolve && !$continue) {
  59948. $resolve($values);
  59949. }
  59950. },
  59951. function (\Throwable $reason) use (&$continue, $reject): void {
  59952. $continue = false;
  59953. $reject($reason);
  59954. }
  59955. );
  59956. if (!$continue && !\is_array($promisesOrValues)) {
  59957. break;
  59958. }
  59959. }
  59960. $continue = false;
  59961. if ($toResolve === 0) {
  59962. $resolve($values);
  59963. }
  59964. }, $cancellationQueue);
  59965. }
  59966. function race(iterable $promisesOrValues): PromiseInterface
  59967. {
  59968. $cancellationQueue = new Internal\CancellationQueue();
  59969. return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void {
  59970. $continue = true;
  59971. foreach ($promisesOrValues as $promiseOrValue) {
  59972. $cancellationQueue->enqueue($promiseOrValue);
  59973. resolve($promiseOrValue)->then($resolve, $reject)->finally(function () use (&$continue): void {
  59974. $continue = false;
  59975. });
  59976. if (!$continue && !\is_array($promisesOrValues)) {
  59977. break;
  59978. }
  59979. }
  59980. }, $cancellationQueue);
  59981. }
  59982. function any(iterable $promisesOrValues): PromiseInterface
  59983. {
  59984. $cancellationQueue = new Internal\CancellationQueue();
  59985. return new Promise(function (callable $resolve, callable $reject) use ($promisesOrValues, $cancellationQueue): void {
  59986. $toReject = 0;
  59987. $continue = true;
  59988. $reasons = [];
  59989. foreach ($promisesOrValues as $i => $promiseOrValue) {
  59990. $cancellationQueue->enqueue($promiseOrValue);
  59991. ++$toReject;
  59992. resolve($promiseOrValue)->then(
  59993. function ($value) use ($resolve, &$continue): void {
  59994. $continue = false;
  59995. $resolve($value);
  59996. },
  59997. function (\Throwable $reason) use ($i, &$reasons, &$toReject, $reject, &$continue): void {
  59998. $reasons[$i] = $reason;
  59999. if (0 === --$toReject && !$continue) {
  60000. $reject(new CompositeException(
  60001. $reasons,
  60002. 'All promises rejected.'
  60003. ));
  60004. }
  60005. }
  60006. );
  60007. if (!$continue && !\is_array($promisesOrValues)) {
  60008. break;
  60009. }
  60010. }
  60011. $continue = false;
  60012. if ($toReject === 0 && !$reasons) {
  60013. $reject(new Exception\LengthException(
  60014. 'Must contain at least 1 item but contains only 0 items.'
  60015. ));
  60016. } elseif ($toReject === 0) {
  60017. $reject(new CompositeException(
  60018. $reasons,
  60019. 'All promises rejected.'
  60020. ));
  60021. }
  60022. }, $cancellationQueue);
  60023. }
  60024. function set_rejection_handler(?callable $callback): ?callable
  60025. {
  60026. static $current = null;
  60027. $previous = $current;
  60028. $current = $callback;
  60029. return $previous;
  60030. }
  60031. function _checkTypehint(callable $callback, \Throwable $reason): bool
  60032. {
  60033. if (\is_array($callback)) {
  60034. $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]);
  60035. } elseif (\is_object($callback) && !$callback instanceof \Closure) {
  60036. $callbackReflection = new \ReflectionMethod($callback, '__invoke');
  60037. } else {
  60038. assert($callback instanceof \Closure || \is_string($callback));
  60039. $callbackReflection = new \ReflectionFunction($callback);
  60040. }
  60041. $parameters = $callbackReflection->getParameters();
  60042. if (!isset($parameters[0])) {
  60043. return true;
  60044. }
  60045. $expectedException = $parameters[0];
  60046. $type = $expectedException->getType();
  60047. $isTypeUnion = true;
  60048. $types = [];
  60049. switch (true) {
  60050. case $type === null:
  60051. break;
  60052. case $type instanceof \ReflectionNamedType:
  60053. $types = [$type];
  60054. break;
  60055. case $type instanceof \ReflectionIntersectionType:
  60056. $isTypeUnion = false;
  60057. case $type instanceof \ReflectionUnionType;
  60058. $types = $type->getTypes();
  60059. break;
  60060. default:
  60061. throw new \LogicException('Unexpected return value of ReflectionParameter::getType');
  60062. }
  60063. if (empty($types)) {
  60064. return true;
  60065. }
  60066. foreach ($types as $type) {
  60067. if ($type instanceof \ReflectionIntersectionType) {
  60068. foreach ($type->getTypes() as $typeToMatch) {
  60069. assert($typeToMatch instanceof \ReflectionNamedType);
  60070. $name = $typeToMatch->getName();
  60071. if (!($matches = (!$typeToMatch->isBuiltin() && $reason instanceof $name))) {
  60072. break;
  60073. }
  60074. }
  60075. assert(isset($matches));
  60076. } else {
  60077. assert($type instanceof \ReflectionNamedType);
  60078. $name = $type->getName();
  60079. $matches = !$type->isBuiltin() && $reason instanceof $name;
  60080. }
  60081. if ($matches) {
  60082. if ($isTypeUnion) {
  60083. return true;
  60084. }
  60085. } else {
  60086. if (!$isTypeUnion) {
  60087. return false;
  60088. }
  60089. }
  60090. }
  60091. return $isTypeUnion ? false : true;
  60092. }
  60093. <?php
  60094. if (!\function_exists('React\Promise\resolve')) {
  60095. require __DIR__.'/functions.php';
  60096. }
  60097. Copyright (c) 2011 Jordi Boggiano
  60098. Permission is hereby granted, free of charge, to any person obtaining a copy
  60099. of this software and associated documentation files (the "Software"), to deal
  60100. in the Software without restriction, including without limitation the rights
  60101. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  60102. copies of the Software, and to permit persons to whom the Software is furnished
  60103. to do so, subject to the following conditions:
  60104. The above copyright notice and this permission notice shall be included in all
  60105. copies or substantial portions of the Software.
  60106. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  60107. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  60108. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  60109. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  60110. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  60111. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  60112. THE SOFTWARE.
  60113. <?php
  60114. namespace Seld\JsonLint;
  60115. class DuplicateKeyException extends ParsingException
  60116. {
  60117. protected $details;
  60118. public function __construct($message, $key, array $details)
  60119. {
  60120. $details['key'] = $key;
  60121. parent::__construct($message, $details);
  60122. }
  60123. public function getKey()
  60124. {
  60125. return $this->details['key'];
  60126. }
  60127. public function getDetails()
  60128. {
  60129. return $this->details;
  60130. }
  60131. }
  60132. <?php
  60133. namespace Seld\JsonLint;
  60134. use stdClass;
  60135. class JsonParser
  60136. {
  60137. const DETECT_KEY_CONFLICTS = 1;
  60138. const ALLOW_DUPLICATE_KEYS = 2;
  60139. const PARSE_TO_ASSOC = 4;
  60140. const ALLOW_COMMENTS = 8;
  60141. const ALLOW_DUPLICATE_KEYS_TO_ARRAY = 16;
  60142. private $lexer;
  60143. private $flags;
  60144. private $stack;
  60145. private $vstack;
  60146. private $lstack;
  60147. private $symbols = array(
  60148. 'error' => 2,
  60149. 'JSONString' => 3,
  60150. 'STRING' => 4,
  60151. 'JSONNumber' => 5,
  60152. 'NUMBER' => 6,
  60153. 'JSONNullLiteral' => 7,
  60154. 'NULL' => 8,
  60155. 'JSONBooleanLiteral' => 9,
  60156. 'TRUE' => 10,
  60157. 'FALSE' => 11,
  60158. 'JSONText' => 12,
  60159. 'JSONValue' => 13,
  60160. 'EOF' => 14,
  60161. 'JSONObject' => 15,
  60162. 'JSONArray' => 16,
  60163. '{' => 17,
  60164. '}' => 18,
  60165. 'JSONMemberList' => 19,
  60166. 'JSONMember' => 20,
  60167. ':' => 21,
  60168. ',' => 22,
  60169. '[' => 23,
  60170. ']' => 24,
  60171. 'JSONElementList' => 25,
  60172. '$accept' => 0,
  60173. '$end' => 1,
  60174. );
  60175. private $terminals_ = array(
  60176. 2 => "error",
  60177. 4 => "STRING",
  60178. 6 => "NUMBER",
  60179. 8 => "NULL",
  60180. 10 => "TRUE",
  60181. 11 => "FALSE",
  60182. 14 => "EOF",
  60183. 17 => "{",
  60184. 18 => "}",
  60185. 21 => ":",
  60186. 22 => ",",
  60187. 23 => "[",
  60188. 24 => "]",
  60189. );
  60190. private $productions_ = array(
  60191. 1 => array(3, 1),
  60192. 2 => array(5, 1),
  60193. 3 => array(7, 1),
  60194. 4 => array(9, 1),
  60195. 5 => array(9, 1),
  60196. 6 => array(12, 2),
  60197. 7 => array(13, 1),
  60198. 8 => array(13, 1),
  60199. 9 => array(13, 1),
  60200. 10 => array(13, 1),
  60201. 11 => array(13, 1),
  60202. 12 => array(13, 1),
  60203. 13 => array(15, 2),
  60204. 14 => array(15, 3),
  60205. 15 => array(20, 3),
  60206. 16 => array(19, 1),
  60207. 17 => array(19, 3),
  60208. 18 => array(16, 2),
  60209. 19 => array(16, 3),
  60210. 20 => array(25, 1),
  60211. 21 => array(25, 3)
  60212. );
  60213. private $table = array(
  60214. 0 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  60215. 1 => array( 1 => array(3)),
  60216. 2 => array( 14 => array(1,16)),
  60217. 3 => array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)),
  60218. 4 => array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)),
  60219. 5 => array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)),
  60220. 6 => array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)),
  60221. 7 => array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)),
  60222. 8 => array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)),
  60223. 9 => array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)),
  60224. 10 => array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)),
  60225. 11 => array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)),
  60226. 12 => array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)),
  60227. 13 => array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)),
  60228. 14 => array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ),
  60229. 15 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ),
  60230. 16 => array( 1 => array(2,6)),
  60231. 17 => array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)),
  60232. 18 => array( 18 => array(1,24), 22 => array(1,25)),
  60233. 19 => array( 18 => array(2,16), 22 => array(2,16)),
  60234. 20 => array( 21 => array(1,26)),
  60235. 21 => array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)),
  60236. 22 => array( 22 => array(1,28), 24 => array(1,27)),
  60237. 23 => array( 22 => array(2,20), 24 => array(2,20)),
  60238. 24 => array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)),
  60239. 25 => array( 3 => 20, 4 => array(1,12), 20 => 29 ),
  60240. 26 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  60241. 27 => array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)),
  60242. 28 => array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)),
  60243. 29 => array( 18 => array(2,17), 22 => array(2,17)),
  60244. 30 => array( 18 => array(2,15), 22 => array(2,15)),
  60245. 31 => array( 22 => array(2,21), 24 => array(2,21)),
  60246. );
  60247. private $defaultActions = array(
  60248. 16 => array(2, 6)
  60249. );
  60250. public function lint($input, $flags = 0)
  60251. {
  60252. try {
  60253. $this->parse($input, $flags);
  60254. } catch (ParsingException $e) {
  60255. return $e;
  60256. }
  60257. return null;
  60258. }
  60259. public function parse($input, $flags = 0)
  60260. {
  60261. if (($flags & self::ALLOW_DUPLICATE_KEYS_TO_ARRAY) && ($flags & self::ALLOW_DUPLICATE_KEYS)) {
  60262. throw new \InvalidArgumentException('Only one of ALLOW_DUPLICATE_KEYS and ALLOW_DUPLICATE_KEYS_TO_ARRAY can be used, you passed in both.');
  60263. }
  60264. $this->failOnBOM($input);
  60265. $this->flags = $flags;
  60266. $this->stack = array(0);
  60267. $this->vstack = array(null);
  60268. $this->lstack = array();
  60269. $yytext = '';
  60270. $yylineno = 0;
  60271. $yyleng = 0;
  60272. $recovering = 0;
  60273. $this->lexer = new Lexer($flags);
  60274. $this->lexer->setInput($input);
  60275. $yyloc = $this->lexer->yylloc;
  60276. $this->lstack[] = $yyloc;
  60277. $symbol = null;
  60278. $preErrorSymbol = null;
  60279. $action = null;
  60280. $a = null;
  60281. $r = null;
  60282. $p = null;
  60283. $len = null;
  60284. $newState = null;
  60285. $expected = null;
  60286. $errStr = null;
  60287. while (true) {
  60288. $state = $this->stack[\count($this->stack)-1];
  60289. if (isset($this->defaultActions[$state])) {
  60290. $action = $this->defaultActions[$state];
  60291. } else {
  60292. if ($symbol === null) {
  60293. $symbol = $this->lexer->lex();
  60294. }
  60295. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  60296. }
  60297. if (!$action || !$action[0]) {
  60298. assert(isset($symbol));
  60299. if (!$recovering) {
  60300. $expected = array();
  60301. foreach ($this->table[$state] as $p => $ignore) {
  60302. if (isset($this->terminals_[$p]) && $p > 2) {
  60303. $expected[] = "'" . $this->terminals_[$p] . "'";
  60304. }
  60305. }
  60306. $message = null;
  60307. if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  60308. $message = "Invalid string";
  60309. if ("'" === substr($this->lexer->match, 0, 1)) {
  60310. $message .= ", it appears you used single quotes instead of double quotes";
  60311. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
  60312. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  60313. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
  60314. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  60315. }
  60316. }
  60317. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  60318. $errStr .= $this->lexer->showPosition() . "\n";
  60319. if ($message) {
  60320. $errStr .= $message;
  60321. } else {
  60322. $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
  60323. $errStr .= implode(', ', $expected);
  60324. }
  60325. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  60326. $errStr .= " - It appears you have an extra trailing comma";
  60327. }
  60328. $this->parseError($errStr, array(
  60329. 'text' => $this->lexer->match,
  60330. 'token' => isset($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  60331. 'line' => $this->lexer->yylineno,
  60332. 'loc' => $yyloc,
  60333. 'expected' => $expected,
  60334. ));
  60335. }
  60336. if ($recovering == 3) {
  60337. if ($symbol === Lexer::EOF) {
  60338. throw new ParsingException($errStr ?: 'Parsing halted.');
  60339. }
  60340. $yyleng = $this->lexer->yyleng;
  60341. $yytext = $this->lexer->yytext;
  60342. $yylineno = $this->lexer->yylineno;
  60343. $yyloc = $this->lexer->yylloc;
  60344. $symbol = $this->lexer->lex();
  60345. }
  60346. while (true) {
  60347. if (\array_key_exists(Lexer::T_ERROR, $this->table[$state])) {
  60348. break;
  60349. }
  60350. if ($state == 0) {
  60351. throw new ParsingException($errStr ?: 'Parsing halted.');
  60352. }
  60353. $this->popStack(1);
  60354. $state = $this->stack[\count($this->stack)-1];
  60355. }
  60356. $preErrorSymbol = $symbol;
  60357. $symbol = Lexer::T_ERROR;
  60358. $state = $this->stack[\count($this->stack)-1];
  60359. $action = isset($this->table[$state][Lexer::T_ERROR]) ? $this->table[$state][Lexer::T_ERROR] : false;
  60360. if ($action === false) {
  60361. throw new \LogicException('No table value found for '.$state.' => '.Lexer::T_ERROR);
  60362. }
  60363. $recovering = 3;
  60364. }
  60365. if (\is_array($action[0]) && \count($action) > 1) {
  60366. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  60367. }
  60368. switch ($action[0]) {
  60369. case 1:
  60370. assert(isset($symbol));
  60371. $this->stack[] = $symbol;
  60372. $this->vstack[] = $this->lexer->yytext;
  60373. $this->lstack[] = $this->lexer->yylloc;
  60374. $this->stack[] = $action[1];
  60375. $symbol = null;
  60376. if (!$preErrorSymbol) {
  60377. $yyleng = $this->lexer->yyleng;
  60378. $yytext = $this->lexer->yytext;
  60379. $yylineno = $this->lexer->yylineno;
  60380. $yyloc = $this->lexer->yylloc;
  60381. if ($recovering > 0) {
  60382. $recovering--;
  60383. }
  60384. } else {
  60385. $symbol = $preErrorSymbol;
  60386. $preErrorSymbol = null;
  60387. }
  60388. break;
  60389. case 2:
  60390. $len = $this->productions_[$action[1]][1];
  60391. $currentToken = $this->vstack[\count($this->vstack) - $len];
  60392. $position = array(
  60393. 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
  60394. 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
  60395. 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
  60396. 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
  60397. );
  60398. list($newToken, $actionResult) = $this->performAction($currentToken, $yytext, $yyleng, $yylineno, $action[1]);
  60399. if (!$actionResult instanceof Undefined) {
  60400. return $actionResult;
  60401. }
  60402. if ($len) {
  60403. $this->popStack($len);
  60404. }
  60405. $this->stack[] = $this->productions_[$action[1]][0];
  60406. $this->vstack[] = $newToken;
  60407. $this->lstack[] = $position;
  60408. $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
  60409. $this->stack[] = $newState;
  60410. break;
  60411. case 3:
  60412. return true;
  60413. }
  60414. }
  60415. }
  60416. protected function parseError($str, $hash = null)
  60417. {
  60418. throw new ParsingException($str, $hash ?: array());
  60419. }
  60420. private function performAction($currentToken, $yytext, $yyleng, $yylineno, $yystate)
  60421. {
  60422. $token = $currentToken;
  60423. $len = \count($this->vstack) - 1;
  60424. switch ($yystate) {
  60425. case 1:
  60426. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  60427. $token = $yytext;
  60428. break;
  60429. case 2:
  60430. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  60431. $token = \floatval($yytext);
  60432. } else {
  60433. $token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
  60434. }
  60435. break;
  60436. case 3:
  60437. $token = null;
  60438. break;
  60439. case 4:
  60440. $token = true;
  60441. break;
  60442. case 5:
  60443. $token = false;
  60444. break;
  60445. case 6:
  60446. $token = $this->vstack[$len-1];
  60447. return array($token, $token);
  60448. case 13:
  60449. if ($this->flags & self::PARSE_TO_ASSOC) {
  60450. $token = array();
  60451. } else {
  60452. $token = new stdClass;
  60453. }
  60454. break;
  60455. case 14:
  60456. $token = $this->vstack[$len-1];
  60457. break;
  60458. case 15:
  60459. $token = array($this->vstack[$len-2], $this->vstack[$len]);
  60460. break;
  60461. case 16:
  60462. assert(\is_array($this->vstack[$len]));
  60463. if (PHP_VERSION_ID < 70100) {
  60464. $property = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
  60465. } else {
  60466. $property = $this->vstack[$len][0];
  60467. }
  60468. if ($this->flags & self::PARSE_TO_ASSOC) {
  60469. $token = array();
  60470. $token[$property] = $this->vstack[$len][1];
  60471. } else {
  60472. $token = new stdClass;
  60473. $token->$property = $this->vstack[$len][1];
  60474. }
  60475. break;
  60476. case 17:
  60477. assert(\is_array($this->vstack[$len]));
  60478. if ($this->flags & self::PARSE_TO_ASSOC) {
  60479. assert(\is_array($this->vstack[$len-2]));
  60480. $token =& $this->vstack[$len-2];
  60481. $key = $this->vstack[$len][0];
  60482. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2][$key])) {
  60483. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  60484. $errStr .= $this->lexer->showPosition() . "\n";
  60485. $errStr .= "Duplicate key: ".$this->vstack[$len][0];
  60486. throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
  60487. }
  60488. if (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2][$key])) {
  60489. $duplicateCount = 1;
  60490. do {
  60491. $duplicateKey = $key . '.' . $duplicateCount++;
  60492. } while (isset($this->vstack[$len-2][$duplicateKey]));
  60493. $this->vstack[$len-2][$duplicateKey] = $this->vstack[$len][1];
  60494. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS_TO_ARRAY) && isset($this->vstack[$len-2][$key])) {
  60495. if (!isset($this->vstack[$len-2][$key]['__duplicates__']) || !is_array($this->vstack[$len-2][$key]['__duplicates__'])) {
  60496. $this->vstack[$len-2][$key] = array('__duplicates__' => array($this->vstack[$len-2][$key]));
  60497. }
  60498. $this->vstack[$len-2][$key]['__duplicates__'][] = $this->vstack[$len][1];
  60499. } else {
  60500. $this->vstack[$len-2][$key] = $this->vstack[$len][1];
  60501. }
  60502. } else {
  60503. assert($this->vstack[$len-2] instanceof stdClass);
  60504. $token = $this->vstack[$len-2];
  60505. if (PHP_VERSION_ID < 70100) {
  60506. $key = $this->vstack[$len][0] === '' ? '_empty_' : $this->vstack[$len][0];
  60507. } else {
  60508. $key = $this->vstack[$len][0];
  60509. }
  60510. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($this->vstack[$len-2]->$key)) {
  60511. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  60512. $errStr .= $this->lexer->showPosition() . "\n";
  60513. $errStr .= "Duplicate key: ".$this->vstack[$len][0];
  60514. throw new DuplicateKeyException($errStr, $this->vstack[$len][0], array('line' => $yylineno+1));
  60515. }
  60516. if (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($this->vstack[$len-2]->$key)) {
  60517. $duplicateCount = 1;
  60518. do {
  60519. $duplicateKey = $key . '.' . $duplicateCount++;
  60520. } while (isset($this->vstack[$len-2]->$duplicateKey));
  60521. $this->vstack[$len-2]->$duplicateKey = $this->vstack[$len][1];
  60522. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS_TO_ARRAY) && isset($this->vstack[$len-2]->$key)) {
  60523. if (!isset($this->vstack[$len-2]->$key->__duplicates__)) {
  60524. $this->vstack[$len-2]->$key = (object) array('__duplicates__' => array($this->vstack[$len-2]->$key));
  60525. }
  60526. $this->vstack[$len-2]->$key->__duplicates__[] = $this->vstack[$len][1];
  60527. } else {
  60528. $this->vstack[$len-2]->$key = $this->vstack[$len][1];
  60529. }
  60530. }
  60531. break;
  60532. case 18:
  60533. $token = array();
  60534. break;
  60535. case 19:
  60536. $token = $this->vstack[$len-1];
  60537. break;
  60538. case 20:
  60539. $token = array($this->vstack[$len]);
  60540. break;
  60541. case 21:
  60542. assert(\is_array($this->vstack[$len-2]));
  60543. $this->vstack[$len-2][] = $this->vstack[$len];
  60544. $token = $this->vstack[$len-2];
  60545. break;
  60546. }
  60547. return array($token, new Undefined());
  60548. }
  60549. private function stringInterpolation($match)
  60550. {
  60551. switch ($match[0]) {
  60552. case '\\\\':
  60553. return '\\';
  60554. case '\"':
  60555. return '"';
  60556. case '\b':
  60557. return \chr(8);
  60558. case '\f':
  60559. return \chr(12);
  60560. case '\n':
  60561. return "\n";
  60562. case '\r':
  60563. return "\r";
  60564. case '\t':
  60565. return "\t";
  60566. case '\/':
  60567. return "/";
  60568. default:
  60569. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  60570. }
  60571. }
  60572. private function popStack($n)
  60573. {
  60574. $this->stack = \array_slice($this->stack, 0, - (2 * $n));
  60575. $this->vstack = \array_slice($this->vstack, 0, - $n);
  60576. $this->lstack = \array_slice($this->lstack, 0, - $n);
  60577. }
  60578. private function failOnBOM($input)
  60579. {
  60580. $bom = "\xEF\xBB\xBF";
  60581. if (substr($input, 0, 3) === $bom) {
  60582. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark");
  60583. }
  60584. }
  60585. }
  60586. <?php
  60587. namespace Seld\JsonLint;
  60588. class Lexer
  60589. {
  60590. const EOF = 1;
  60591. const T_INVALID = -1;
  60592. const T_SKIP_WHITESPACE = 0;
  60593. const T_ERROR = 2;
  60594. const T_BREAK_LINE = 3;
  60595. const T_COMMENT = 30;
  60596. const T_OPEN_COMMENT = 31;
  60597. const T_CLOSE_COMMENT = 32;
  60598. private $rules = array(
  60599. 0 => '/\G\s*\n\r?/',
  60600. 1 => '/\G\s+/',
  60601. 2 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  60602. 3 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  60603. 4 => '/\G\{/',
  60604. 5 => '/\G\}/',
  60605. 6 => '/\G\[/',
  60606. 7 => '/\G\]/',
  60607. 8 => '/\G,/',
  60608. 9 => '/\G:/',
  60609. 10 => '/\Gtrue\b/',
  60610. 11 => '/\Gfalse\b/',
  60611. 12 => '/\Gnull\b/',
  60612. 13 => '/\G$/',
  60613. 14 => '/\G\/\//',
  60614. 15 => '/\G\/\*/',
  60615. 16 => '/\G\*\//',
  60616. 17 => '/\G./',
  60617. );
  60618. private $input;
  60619. private $more;
  60620. private $done;
  60621. private $offset;
  60622. private $flags;
  60623. public $match;
  60624. public $yylineno;
  60625. public $yyleng;
  60626. public $yytext;
  60627. public $yylloc;
  60628. public function __construct($flags = 0)
  60629. {
  60630. $this->flags = $flags;
  60631. }
  60632. public function lex()
  60633. {
  60634. while (true) {
  60635. $symbol = $this->next();
  60636. switch ($symbol) {
  60637. case self::T_SKIP_WHITESPACE:
  60638. case self::T_BREAK_LINE:
  60639. break;
  60640. case self::T_COMMENT:
  60641. case self::T_OPEN_COMMENT:
  60642. if (!($this->flags & JsonParser::ALLOW_COMMENTS)) {
  60643. $this->parseError('Lexical error on line ' . ($this->yylineno+1) . ". Comments are not allowed.\n" . $this->showPosition());
  60644. }
  60645. $this->skipUntil($symbol === self::T_COMMENT ? self::T_BREAK_LINE : self::T_CLOSE_COMMENT);
  60646. if ($this->done) {
  60647. return 14;
  60648. }
  60649. break;
  60650. case self::T_CLOSE_COMMENT:
  60651. $this->parseError('Lexical error on line ' . ($this->yylineno+1) . ". Unexpected token.\n" . $this->showPosition());
  60652. default:
  60653. return $symbol;
  60654. }
  60655. }
  60656. }
  60657. public function setInput($input)
  60658. {
  60659. $this->input = $input;
  60660. $this->more = false;
  60661. $this->done = false;
  60662. $this->offset = 0;
  60663. $this->yylineno = $this->yyleng = 0;
  60664. $this->yytext = $this->match = '';
  60665. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  60666. return $this;
  60667. }
  60668. public function showPosition()
  60669. {
  60670. if ($this->yylineno === 0 && $this->offset === 1 && $this->match !== '{') {
  60671. return $this->match.'...' . "\n^";
  60672. }
  60673. $pre = str_replace("\n", '', $this->getPastInput());
  60674. $c = str_repeat('-', max(0, \strlen($pre) - 1));
  60675. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  60676. }
  60677. public function getPastInput()
  60678. {
  60679. $pastLength = $this->offset - \strlen($this->match);
  60680. return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
  60681. }
  60682. public function getUpcomingInput()
  60683. {
  60684. $next = $this->match;
  60685. if (\strlen($next) < 20) {
  60686. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  60687. }
  60688. return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
  60689. }
  60690. public function getFullUpcomingInput()
  60691. {
  60692. $next = $this->match;
  60693. if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
  60694. $len = \strlen($this->input);
  60695. if ($len === $this->offset) {
  60696. $strEnd = $len;
  60697. } else {
  60698. $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
  60699. }
  60700. $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
  60701. } elseif (\strlen($next) < 20) {
  60702. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  60703. }
  60704. return $next;
  60705. }
  60706. protected function parseError($str)
  60707. {
  60708. throw new ParsingException($str);
  60709. }
  60710. private function skipUntil($token)
  60711. {
  60712. $symbol = $this->next();
  60713. while ($symbol !== $token && false === $this->done) {
  60714. $symbol = $this->next();
  60715. }
  60716. }
  60717. private function next()
  60718. {
  60719. if ($this->done) {
  60720. return self::EOF;
  60721. }
  60722. if ($this->offset === \strlen($this->input)) {
  60723. $this->done = true;
  60724. }
  60725. $token = null;
  60726. $match = null;
  60727. $col = null;
  60728. $lines = null;
  60729. if (!$this->more) {
  60730. $this->yytext = '';
  60731. $this->match = '';
  60732. }
  60733. $rulesLen = count($this->rules);
  60734. for ($i=0; $i < $rulesLen; $i++) {
  60735. if (preg_match($this->rules[$i], $this->input, $match, 0, $this->offset)) {
  60736. $lines = explode("\n", $match[0]);
  60737. array_shift($lines);
  60738. $lineCount = \count($lines);
  60739. $this->yylineno += $lineCount;
  60740. $this->yylloc = array(
  60741. 'first_line' => $this->yylloc['last_line'],
  60742. 'last_line' => $this->yylineno+1,
  60743. 'first_column' => $this->yylloc['last_column'],
  60744. 'last_column' => $lineCount > 0 ? \strlen($lines[$lineCount - 1]) : $this->yylloc['last_column'] + \strlen($match[0]),
  60745. );
  60746. $this->yytext .= $match[0];
  60747. $this->match .= $match[0];
  60748. $this->yyleng = \strlen($this->yytext);
  60749. $this->more = false;
  60750. $this->offset += \strlen($match[0]);
  60751. return $this->performAction($i);
  60752. }
  60753. }
  60754. if ($this->offset === \strlen($this->input)) {
  60755. return self::EOF;
  60756. }
  60757. $this->parseError(
  60758. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition()
  60759. );
  60760. }
  60761. private function performAction($rule)
  60762. {
  60763. switch ($rule) {
  60764. case 0:
  60765. return self::T_BREAK_LINE;
  60766. case 1:
  60767. return self::T_SKIP_WHITESPACE;
  60768. case 2:
  60769. return 6;
  60770. case 3:
  60771. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  60772. return 4;
  60773. case 4:
  60774. return 17;
  60775. case 5:
  60776. return 18;
  60777. case 6:
  60778. return 23;
  60779. case 7:
  60780. return 24;
  60781. case 8:
  60782. return 22;
  60783. case 9:
  60784. return 21;
  60785. case 10:
  60786. return 10;
  60787. case 11:
  60788. return 11;
  60789. case 12:
  60790. return 8;
  60791. case 13:
  60792. return 14;
  60793. case 14:
  60794. return self::T_COMMENT;
  60795. case 15:
  60796. return self::T_OPEN_COMMENT;
  60797. case 16:
  60798. return self::T_CLOSE_COMMENT;
  60799. case 17:
  60800. return self::T_INVALID;
  60801. default:
  60802. throw new \LogicException('Unsupported rule '.$rule);
  60803. }
  60804. }
  60805. }
  60806. <?php
  60807. namespace Seld\JsonLint;
  60808. class ParsingException extends \Exception
  60809. {
  60810. protected $details;
  60811. public function __construct($message, $details = array())
  60812. {
  60813. $this->details = $details;
  60814. parent::__construct($message);
  60815. }
  60816. public function getDetails()
  60817. {
  60818. return $this->details;
  60819. }
  60820. }
  60821. <?php
  60822. namespace Seld\JsonLint;
  60823. class Undefined
  60824. {
  60825. }
  60826. Copyright (c) 2015 Jordi Boggiano
  60827. Permission is hereby granted, free of charge, to any person obtaining a copy
  60828. of this software and associated documentation files (the "Software"), to deal
  60829. in the Software without restriction, including without limitation the rights
  60830. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  60831. copies of the Software, and to permit persons to whom the Software is furnished
  60832. to do so, subject to the following conditions:
  60833. The above copyright notice and this permission notice shall be included in all
  60834. copies or substantial portions of the Software.
  60835. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  60836. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  60837. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  60838. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  60839. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  60840. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  60841. THE SOFTWARE.
  60842. <?php
  60843. namespace Seld\PharUtils;
  60844. class Linter
  60845. {
  60846. public static function lint($path, array $excludedPaths = array())
  60847. {
  60848. $php = defined('PHP_BINARY') ? PHP_BINARY : 'php';
  60849. if ($isWindows = defined('PHP_WINDOWS_VERSION_BUILD')) {
  60850. $tmpFile = @tempnam(sys_get_temp_dir(), '');
  60851. if (!$tmpFile || !is_writable($tmpFile)) {
  60852. throw new \RuntimeException('Unable to create temp file');
  60853. }
  60854. $php = self::escapeWindowsPath($php);
  60855. $tmpFile = self::escapeWindowsPath($tmpFile);
  60856. if (PHP_VERSION_ID >= 80000) {
  60857. $format = '%s -l %s';
  60858. } else {
  60859. $format = '"%s -l %s"';
  60860. }
  60861. $command = sprintf($format, $php, $tmpFile);
  60862. } else {
  60863. $command = "'".$php."' -l";
  60864. }
  60865. $descriptorspec = array(
  60866. 0 => array('pipe', 'r'),
  60867. 1 => array('pipe', 'w'),
  60868. 2 => array('pipe', 'w')
  60869. );
  60870. $baseLen = strlen(realpath($path)) + 7 + 1;
  60871. foreach (new \RecursiveIteratorIterator(new \Phar($path)) as $file) {
  60872. if ($file->isDir()) {
  60873. continue;
  60874. }
  60875. if (substr($file, -4) === '.php') {
  60876. $filename = (string) $file;
  60877. if (in_array(substr($filename, $baseLen), $excludedPaths, true)) {
  60878. continue;
  60879. }
  60880. if ($isWindows) {
  60881. file_put_contents($tmpFile, file_get_contents($filename));
  60882. }
  60883. $process = proc_open($command, $descriptorspec, $pipes);
  60884. if (is_resource($process)) {
  60885. if (!$isWindows) {
  60886. fwrite($pipes[0], file_get_contents($filename));
  60887. }
  60888. fclose($pipes[0]);
  60889. $stdout = stream_get_contents($pipes[1]);
  60890. fclose($pipes[1]);
  60891. $stderr = stream_get_contents($pipes[2]);
  60892. fclose($pipes[2]);
  60893. $exitCode = proc_close($process);
  60894. if ($exitCode !== 0) {
  60895. if ($isWindows) {
  60896. $stderr = str_replace($tmpFile, $filename, $stderr);
  60897. }
  60898. throw new \UnexpectedValueException('Failed linting '.$file.': '.$stderr);
  60899. }
  60900. } else {
  60901. throw new \RuntimeException('Could not start linter process');
  60902. }
  60903. }
  60904. }
  60905. if ($isWindows) {
  60906. @unlink($tmpFile);
  60907. }
  60908. }
  60909. private static function escapeWindowsPath($path)
  60910. {
  60911. if (strpbrk($path, " ()") !== false) {
  60912. $path = '"'.$path.'"';
  60913. }
  60914. return $path;
  60915. }
  60916. }
  60917. <?php
  60918. namespace Seld\PharUtils;
  60919. class Timestamps
  60920. {
  60921. private $contents;
  60922. public function __construct($file)
  60923. {
  60924. $this->contents = file_get_contents($file);
  60925. }
  60926. public function updateTimestamps($timestamp = null)
  60927. {
  60928. if ($timestamp instanceof \DateTime || $timestamp instanceof \DateTimeInterface) {
  60929. $timestamp = $timestamp->getTimestamp();
  60930. } elseif (is_string($timestamp)) {
  60931. $timestamp = strtotime($timestamp);
  60932. } elseif (!is_int($timestamp)) {
  60933. $timestamp = strtotime('1984-12-24T00:00:00Z');
  60934. }
  60935. if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
  60936. throw new \RuntimeException('Could not detect the stub\'s end in the phar');
  60937. }
  60938. $pos = $match[0][1] + strlen($match[0][0]);
  60939. $stubEnd = $pos + $this->readUint($pos, 4);
  60940. $pos += 4;
  60941. $numFiles = $this->readUint($pos, 4);
  60942. $pos += 4;
  60943. $pos += 2;
  60944. $pos += 4;
  60945. $aliasLength = $this->readUint($pos, 4);
  60946. $pos += 4 + $aliasLength;
  60947. $metadataLength = $this->readUint($pos, 4);
  60948. $pos += 4 + $metadataLength;
  60949. while ($pos < $stubEnd) {
  60950. $filenameLength = $this->readUint($pos, 4);
  60951. $pos += 4 + $filenameLength;
  60952. $pos += 4;
  60953. $timeStampBytes = pack('L', $timestamp);
  60954. $this->contents[$pos + 0] = $timeStampBytes[0];
  60955. $this->contents[$pos + 1] = $timeStampBytes[1];
  60956. $this->contents[$pos + 2] = $timeStampBytes[2];
  60957. $this->contents[$pos + 3] = $timeStampBytes[3];
  60958. $pos += 4*4;
  60959. $metadataLength = $this->readUint($pos, 4);
  60960. $pos += 4 + $metadataLength;
  60961. $numFiles--;
  60962. }
  60963. if ($numFiles !== 0) {
  60964. throw new \LogicException('All files were not processed, something must have gone wrong');
  60965. }
  60966. }
  60967. public function save($path, $signatureAlgo)
  60968. {
  60969. $pos = $this->determineSignatureBegin();
  60970. $algos = array(
  60971. \Phar::MD5 => 'md5',
  60972. \Phar::SHA1 => 'sha1',
  60973. \Phar::SHA256 => 'sha256',
  60974. \Phar::SHA512 => 'sha512',
  60975. );
  60976. if (!isset($algos[$signatureAlgo])) {
  60977. throw new \UnexpectedValueException('Invalid hash algorithm given: '.$signatureAlgo.' expected one of Phar::MD5, Phar::SHA1, Phar::SHA256 or Phar::SHA512');
  60978. }
  60979. $algo = $algos[$signatureAlgo];
  60980. $signature = hash($algo, substr($this->contents, 0, $pos), true)
  60981. . pack('L', $signatureAlgo)
  60982. . 'GBMB';
  60983. $this->contents = substr($this->contents, 0, $pos) . $signature;
  60984. return file_put_contents($path, $this->contents);
  60985. }
  60986. private function readUint($pos, $bytes)
  60987. {
  60988. $res = unpack('V', substr($this->contents, $pos, $bytes));
  60989. return $res[1];
  60990. }
  60991. private function determineSignatureBegin()
  60992. {
  60993. if (!preg_match('{__HALT_COMPILER\(\);(?: +\?>)?\r?\n}', $this->contents, $match, PREG_OFFSET_CAPTURE)) {
  60994. throw new \RuntimeException('Could not detect the stub\'s end in the phar');
  60995. }
  60996. $pos = $match[0][1] + strlen($match[0][0]);
  60997. $manifestEnd = $pos + 4 + $this->readUint($pos, 4);
  60998. $pos += 4;
  60999. $numFiles = $this->readUint($pos, 4);
  61000. $pos += 4;
  61001. $pos += 2;
  61002. $pos += 4;
  61003. $aliasLength = $this->readUint($pos, 4);
  61004. $pos += 4 + $aliasLength;
  61005. $metadataLength = $this->readUint($pos, 4);
  61006. $pos += 4 + $metadataLength;
  61007. $compressedSizes = 0;
  61008. while (($numFiles > 0) && ($pos < $manifestEnd - 24)) {
  61009. $filenameLength = $this->readUint($pos, 4);
  61010. $pos += 4 + $filenameLength;
  61011. $pos += 2*4;
  61012. $compressedSizes += $this->readUint($pos, 4);
  61013. $pos += 3*4;
  61014. $metadataLength = $this->readUint($pos, 4);
  61015. $pos += 4 + $metadataLength;
  61016. $numFiles--;
  61017. }
  61018. if ($numFiles !== 0) {
  61019. throw new \LogicException('All files were not processed, something must have gone wrong');
  61020. }
  61021. return $manifestEnd + $compressedSizes;
  61022. }
  61023. }
  61024. Copyright (c) 2015 Jordi Boggiano
  61025. Permission is hereby granted, free of charge, to any person obtaining a copy
  61026. of this software and associated documentation files (the "Software"), to deal
  61027. in the Software without restriction, including without limitation the rights
  61028. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  61029. copies of the Software, and to permit persons to whom the Software is furnished
  61030. to do so, subject to the following conditions:
  61031. The above copyright notice and this permission notice shall be included in all
  61032. copies or substantial portions of the Software.
  61033. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  61034. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  61035. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  61036. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  61037. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  61038. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  61039. THE SOFTWARE.
  61040. <?php
  61041. namespace Seld\Signal;
  61042. use Psr\Log\LoggerInterface;
  61043. use Closure;
  61044. use WeakReference;
  61045. final class SignalHandler
  61046. {
  61047. public const SIGHUP = 'SIGHUP';
  61048. public const SIGINT = 'SIGINT';
  61049. public const SIGQUIT = 'SIGQUIT';
  61050. public const SIGILL = 'SIGILL';
  61051. public const SIGTRAP = 'SIGTRAP';
  61052. public const SIGABRT = 'SIGABRT';
  61053. public const SIGIOT = 'SIGIOT';
  61054. public const SIGBUS = 'SIGBUS';
  61055. public const SIGFPE = 'SIGFPE';
  61056. public const SIGKILL = 'SIGKILL';
  61057. public const SIGUSR1 = 'SIGUSR1';
  61058. public const SIGUSR2 = 'SIGUSR2';
  61059. public const SIGSEGV = 'SIGSEGV';
  61060. public const SIGPIPE = 'SIGPIPE';
  61061. public const SIGALRM = 'SIGALRM';
  61062. public const SIGTERM = 'SIGTERM';
  61063. public const SIGSTKFLT = 'SIGSTKFLT';
  61064. public const SIGCLD = 'SIGCLD';
  61065. public const SIGCHLD = 'SIGCHLD';
  61066. public const SIGCONT = 'SIGCONT';
  61067. public const SIGSTOP = 'SIGSTOP';
  61068. public const SIGTSTP = 'SIGTSTP';
  61069. public const SIGTTIN = 'SIGTTIN';
  61070. public const SIGTTOU = 'SIGTTOU';
  61071. public const SIGURG = 'SIGURG';
  61072. public const SIGXCPU = 'SIGXCPU';
  61073. public const SIGXFSZ = 'SIGXFSZ';
  61074. public const SIGVTALRM = 'SIGVTALRM';
  61075. public const SIGPROF = 'SIGPROF';
  61076. public const SIGWINCH = 'SIGWINCH';
  61077. public const SIGPOLL = 'SIGPOLL';
  61078. public const SIGIO = 'SIGIO';
  61079. public const SIGPWR = 'SIGPWR';
  61080. public const SIGSYS = 'SIGSYS';
  61081. public const SIGBABY = 'SIGBABY';
  61082. public const SIGBREAK = 'SIGBREAK';
  61083. private const ALL_SIGNALS = [
  61084. self::SIGHUP, self::SIGINT, self::SIGQUIT, self::SIGILL, self::SIGTRAP, self::SIGABRT, self::SIGIOT, self::SIGBUS,
  61085. self::SIGFPE, self::SIGKILL, self::SIGUSR1, self::SIGUSR2, self::SIGSEGV, self::SIGPIPE, self::SIGALRM, self::SIGTERM,
  61086. self::SIGSTKFLT, self::SIGCLD, self::SIGCHLD, self::SIGCONT, self::SIGSTOP, self::SIGTSTP, self::SIGTTIN, self::SIGTTOU,
  61087. self::SIGURG, self::SIGXCPU, self::SIGXFSZ, self::SIGVTALRM, self::SIGPROF, self::SIGWINCH, self::SIGPOLL, self::SIGIO,
  61088. self::SIGPWR, self::SIGSYS, self::SIGBABY, self::SIGBREAK
  61089. ];
  61090. private $triggered = null;
  61091. private $signals;
  61092. private $loggerOrCallback;
  61093. private static $handlers = [];
  61094. private static $windowsHandler = null;
  61095. private function __construct(array $signals, $loggerOrCallback)
  61096. {
  61097. if (!is_callable($loggerOrCallback) && !$loggerOrCallback instanceof LoggerInterface && $loggerOrCallback !== null) {
  61098. throw new \InvalidArgumentException('$loggerOrCallback must be a '.LoggerInterface::class.' instance, a callable, or null, '.(is_object($loggerOrCallback) ? get_class($loggerOrCallback) : gettype($loggerOrCallback)).' received.');
  61099. }
  61100. $this->signals = $signals;
  61101. $this->loggerOrCallback = $loggerOrCallback;
  61102. }
  61103. private function trigger(string $signalName): void
  61104. {
  61105. $this->triggered = $signalName;
  61106. if ($this->loggerOrCallback instanceof LoggerInterface) {
  61107. $this->loggerOrCallback->info('Received '.$signalName);
  61108. } elseif ($this->loggerOrCallback !== null) {
  61109. ($this->loggerOrCallback)($signalName, $this);
  61110. }
  61111. }
  61112. public function isTriggered(): bool
  61113. {
  61114. return $this->triggered !== null;
  61115. }
  61116. public function exitWithLastSignal(): void
  61117. {
  61118. $signal = $this->triggered ?? 'SIGINT';
  61119. $signal = defined($signal) ? constant($signal) : 2;
  61120. if (function_exists('posix_kill') && function_exists('posix_getpid')) {
  61121. pcntl_signal($signal, SIG_DFL);
  61122. posix_kill(posix_getpid(), $signal);
  61123. }
  61124. exit(128 + $signal);
  61125. }
  61126. public function reset(): void
  61127. {
  61128. $this->triggered = null;
  61129. }
  61130. public function __destruct()
  61131. {
  61132. $this->unregister();
  61133. }
  61134. public static function create(?array $signals = null, $loggerOrCallback = null): self
  61135. {
  61136. if ($signals === null) {
  61137. $signals = [self::SIGINT, self::SIGTERM];
  61138. }
  61139. $signals = array_map(function ($signal) {
  61140. if (is_int($signal)) {
  61141. return self::getSignalName($signal);
  61142. } elseif (!in_array($signal, self::ALL_SIGNALS, true)) {
  61143. throw new \InvalidArgumentException('$signals must be an array of SIG* constants or self::SIG* constants, got '.var_export($signal, true));
  61144. }
  61145. return $signal;
  61146. }, (array) $signals);
  61147. $handler = new self($signals, $loggerOrCallback);
  61148. if (PHP_VERSION_ID >= 80000) {
  61149. array_unshift(self::$handlers, WeakReference::create($handler));
  61150. } else {
  61151. array_unshift(self::$handlers, $handler);
  61152. }
  61153. if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli' && (in_array(self::SIGINT, $signals, true) || in_array(self::SIGBREAK, $signals, true))) {
  61154. if (null === self::$windowsHandler) {
  61155. self::$windowsHandler = Closure::fromCallable([self::class, 'handleWindowsSignal']);
  61156. sapi_windows_set_ctrl_handler(self::$windowsHandler);
  61157. }
  61158. }
  61159. if (function_exists('pcntl_signal') && function_exists('pcntl_async_signals')) {
  61160. pcntl_async_signals(true);
  61161. self::registerPcntlHandler($signals);
  61162. }
  61163. return $handler;
  61164. }
  61165. public function unregister(): void
  61166. {
  61167. $signals = $this->signals;
  61168. $index = false;
  61169. foreach (self::$handlers as $key => $handler) {
  61170. if (($handler instanceof WeakReference && $handler->get() === $this) || $handler === $this) {
  61171. $index = $key;
  61172. break;
  61173. }
  61174. }
  61175. if ($index === false) {
  61176. return;
  61177. }
  61178. unset(self::$handlers[$index]);
  61179. if (self::$windowsHandler !== null && (in_array(self::SIGINT, $signals, true) || in_array(self::SIGBREAK, $signals, true))) {
  61180. if (self::getHandlerFor(self::SIGINT) === null && self::getHandlerFor(self::SIGBREAK) === null) {
  61181. sapi_windows_set_ctrl_handler(self::$windowsHandler, false);
  61182. self::$windowsHandler = null;
  61183. }
  61184. }
  61185. if (function_exists('pcntl_signal')) {
  61186. foreach ($signals as $signal) {
  61187. if (!defined($signal)) {
  61188. continue;
  61189. }
  61190. if (self::getHandlerFor($signal) !== null) {
  61191. continue;
  61192. }
  61193. pcntl_signal(constant($signal), SIG_DFL);
  61194. }
  61195. }
  61196. }
  61197. public static function unregisterAll(): void
  61198. {
  61199. if (self::$windowsHandler !== null) {
  61200. sapi_windows_set_ctrl_handler(self::$windowsHandler, false);
  61201. self::$windowsHandler = null;
  61202. }
  61203. foreach (self::$handlers as $key => $handler) {
  61204. if ($handler instanceof WeakReference) {
  61205. $handler = $handler->get();
  61206. if ($handler === null) {
  61207. unset(self::$handlers[$key]);
  61208. continue;
  61209. }
  61210. }
  61211. $handler->unregister();
  61212. }
  61213. }
  61214. private static function registerPcntlHandler(array $signals): void
  61215. {
  61216. static $callable;
  61217. if ($callable === null) {
  61218. $callable = Closure::fromCallable([self::class, 'handlePcntlSignal']);
  61219. }
  61220. foreach ($signals as $signal) {
  61221. if (!defined($signal)) {
  61222. continue;
  61223. }
  61224. pcntl_signal(constant($signal), $callable);
  61225. }
  61226. }
  61227. private static function handleWindowsSignal(int $event): void
  61228. {
  61229. if (PHP_WINDOWS_EVENT_CTRL_C === $event) {
  61230. self::callHandlerFor(self::SIGINT);
  61231. } elseif (PHP_WINDOWS_EVENT_CTRL_BREAK === $event) {
  61232. self::callHandlerFor(self::SIGBREAK);
  61233. }
  61234. }
  61235. private static function handlePcntlSignal(int $signal): void
  61236. {
  61237. self::callHandlerFor(self::getSignalName($signal));
  61238. }
  61239. private static function callHandlerFor(string $signal): void
  61240. {
  61241. $handler = self::getHandlerFor($signal);
  61242. if ($handler !== null) {
  61243. $handler->trigger($signal);
  61244. }
  61245. }
  61246. private static function getHandlerFor(string $signal): ?self
  61247. {
  61248. foreach (self::$handlers as $key => $handler) {
  61249. if ($handler instanceof WeakReference) {
  61250. $handler = $handler->get();
  61251. if ($handler === null) {
  61252. unset(self::$handlers[$key]);
  61253. continue;
  61254. }
  61255. }
  61256. if (in_array($signal, $handler->signals, true)) {
  61257. return $handler;
  61258. }
  61259. }
  61260. return null;
  61261. }
  61262. private static function getSignalName(int $signo): string
  61263. {
  61264. static $signals = null;
  61265. if ($signals === null) {
  61266. $signals = [];
  61267. foreach (self::ALL_SIGNALS as $value) {
  61268. if (defined($value)) {
  61269. $signals[constant($value)] = $value;
  61270. }
  61271. }
  61272. }
  61273. if (isset($signals[$signo])) {
  61274. return $signals[$signo];
  61275. }
  61276. throw new \InvalidArgumentException('Unknown signal #'.$signo);
  61277. }
  61278. }
  61279. <?php
  61280. namespace Symfony\Component\Console;
  61281. use Symfony\Component\Console\Command\Command;
  61282. use Symfony\Component\Console\Command\CompleteCommand;
  61283. use Symfony\Component\Console\Command\DumpCompletionCommand;
  61284. use Symfony\Component\Console\Command\HelpCommand;
  61285. use Symfony\Component\Console\Command\LazyCommand;
  61286. use Symfony\Component\Console\Command\ListCommand;
  61287. use Symfony\Component\Console\Command\SignalableCommandInterface;
  61288. use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
  61289. use Symfony\Component\Console\Completion\CompletionInput;
  61290. use Symfony\Component\Console\Completion\CompletionSuggestions;
  61291. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  61292. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  61293. use Symfony\Component\Console\Event\ConsoleSignalEvent;
  61294. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  61295. use Symfony\Component\Console\Exception\CommandNotFoundException;
  61296. use Symfony\Component\Console\Exception\ExceptionInterface;
  61297. use Symfony\Component\Console\Exception\LogicException;
  61298. use Symfony\Component\Console\Exception\NamespaceNotFoundException;
  61299. use Symfony\Component\Console\Exception\RuntimeException;
  61300. use Symfony\Component\Console\Formatter\OutputFormatter;
  61301. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  61302. use Symfony\Component\Console\Helper\FormatterHelper;
  61303. use Symfony\Component\Console\Helper\Helper;
  61304. use Symfony\Component\Console\Helper\HelperSet;
  61305. use Symfony\Component\Console\Helper\ProcessHelper;
  61306. use Symfony\Component\Console\Helper\QuestionHelper;
  61307. use Symfony\Component\Console\Input\ArgvInput;
  61308. use Symfony\Component\Console\Input\ArrayInput;
  61309. use Symfony\Component\Console\Input\InputArgument;
  61310. use Symfony\Component\Console\Input\InputAwareInterface;
  61311. use Symfony\Component\Console\Input\InputDefinition;
  61312. use Symfony\Component\Console\Input\InputInterface;
  61313. use Symfony\Component\Console\Input\InputOption;
  61314. use Symfony\Component\Console\Output\ConsoleOutput;
  61315. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  61316. use Symfony\Component\Console\Output\OutputInterface;
  61317. use Symfony\Component\Console\SignalRegistry\SignalRegistry;
  61318. use Symfony\Component\Console\Style\SymfonyStyle;
  61319. use Symfony\Component\ErrorHandler\ErrorHandler;
  61320. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  61321. use Symfony\Contracts\Service\ResetInterface;
  61322. class Application implements ResetInterface
  61323. {
  61324. private $commands = [];
  61325. private $wantHelps = false;
  61326. private $runningCommand;
  61327. private $name;
  61328. private $version;
  61329. private $commandLoader;
  61330. private $catchExceptions = true;
  61331. private $autoExit = true;
  61332. private $definition;
  61333. private $helperSet;
  61334. private $dispatcher;
  61335. private $terminal;
  61336. private $defaultCommand;
  61337. private $singleCommand = false;
  61338. private $initialized;
  61339. private $signalRegistry;
  61340. private $signalsToDispatchEvent = [];
  61341. public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
  61342. {
  61343. $this->name = $name;
  61344. $this->version = $version;
  61345. $this->terminal = new Terminal();
  61346. $this->defaultCommand = 'list';
  61347. if (\defined('SIGINT') && SignalRegistry::isSupported()) {
  61348. $this->signalRegistry = new SignalRegistry();
  61349. $this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
  61350. }
  61351. }
  61352. public function setDispatcher(EventDispatcherInterface $dispatcher)
  61353. {
  61354. $this->dispatcher = $dispatcher;
  61355. }
  61356. public function setCommandLoader(CommandLoaderInterface $commandLoader)
  61357. {
  61358. $this->commandLoader = $commandLoader;
  61359. }
  61360. public function getSignalRegistry(): SignalRegistry
  61361. {
  61362. if (!$this->signalRegistry) {
  61363. throw new RuntimeException('Signals are not supported. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
  61364. }
  61365. return $this->signalRegistry;
  61366. }
  61367. public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent)
  61368. {
  61369. $this->signalsToDispatchEvent = $signalsToDispatchEvent;
  61370. }
  61371. public function run(?InputInterface $input = null, ?OutputInterface $output = null)
  61372. {
  61373. if (\function_exists('putenv')) {
  61374. @putenv('LINES='.$this->terminal->getHeight());
  61375. @putenv('COLUMNS='.$this->terminal->getWidth());
  61376. }
  61377. if (null === $input) {
  61378. $input = new ArgvInput();
  61379. }
  61380. if (null === $output) {
  61381. $output = new ConsoleOutput();
  61382. }
  61383. $renderException = function (\Throwable $e) use ($output) {
  61384. if ($output instanceof ConsoleOutputInterface) {
  61385. $this->renderThrowable($e, $output->getErrorOutput());
  61386. } else {
  61387. $this->renderThrowable($e, $output);
  61388. }
  61389. };
  61390. if ($phpHandler = set_exception_handler($renderException)) {
  61391. restore_exception_handler();
  61392. if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) {
  61393. $errorHandler = true;
  61394. } elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
  61395. $phpHandler[0]->setExceptionHandler($errorHandler);
  61396. }
  61397. }
  61398. try {
  61399. $this->configureIO($input, $output);
  61400. $exitCode = $this->doRun($input, $output);
  61401. } catch (\Exception $e) {
  61402. if (!$this->catchExceptions) {
  61403. throw $e;
  61404. }
  61405. $renderException($e);
  61406. $exitCode = $e->getCode();
  61407. if (is_numeric($exitCode)) {
  61408. $exitCode = (int) $exitCode;
  61409. if ($exitCode <= 0) {
  61410. $exitCode = 1;
  61411. }
  61412. } else {
  61413. $exitCode = 1;
  61414. }
  61415. } finally {
  61416. if (!$phpHandler) {
  61417. if (set_exception_handler($renderException) === $renderException) {
  61418. restore_exception_handler();
  61419. }
  61420. restore_exception_handler();
  61421. } elseif (!$errorHandler) {
  61422. $finalHandler = $phpHandler[0]->setExceptionHandler(null);
  61423. if ($finalHandler !== $renderException) {
  61424. $phpHandler[0]->setExceptionHandler($finalHandler);
  61425. }
  61426. }
  61427. }
  61428. if ($this->autoExit) {
  61429. if ($exitCode > 255) {
  61430. $exitCode = 255;
  61431. }
  61432. exit($exitCode);
  61433. }
  61434. return $exitCode;
  61435. }
  61436. public function doRun(InputInterface $input, OutputInterface $output)
  61437. {
  61438. if (true === $input->hasParameterOption(['--version', '-V'], true)) {
  61439. $output->writeln($this->getLongVersion());
  61440. return 0;
  61441. }
  61442. try {
  61443. $input->bind($this->getDefinition());
  61444. } catch (ExceptionInterface $e) {
  61445. }
  61446. $name = $this->getCommandName($input);
  61447. if (true === $input->hasParameterOption(['--help', '-h'], true)) {
  61448. if (!$name) {
  61449. $name = 'help';
  61450. $input = new ArrayInput(['command_name' => $this->defaultCommand]);
  61451. } else {
  61452. $this->wantHelps = true;
  61453. }
  61454. }
  61455. if (!$name) {
  61456. $name = $this->defaultCommand;
  61457. $definition = $this->getDefinition();
  61458. $definition->setArguments(array_merge(
  61459. $definition->getArguments(),
  61460. [
  61461. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  61462. ]
  61463. ));
  61464. }
  61465. try {
  61466. $this->runningCommand = null;
  61467. $command = $this->find($name);
  61468. } catch (\Throwable $e) {
  61469. if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
  61470. if (null !== $this->dispatcher) {
  61471. $event = new ConsoleErrorEvent($input, $output, $e);
  61472. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  61473. if (0 === $event->getExitCode()) {
  61474. return 0;
  61475. }
  61476. $e = $event->getError();
  61477. }
  61478. throw $e;
  61479. }
  61480. $alternative = $alternatives[0];
  61481. $style = new SymfonyStyle($input, $output);
  61482. $output->writeln('');
  61483. $formattedBlock = (new FormatterHelper())->formatBlock(sprintf('Command "%s" is not defined.', $name), 'error', true);
  61484. $output->writeln($formattedBlock);
  61485. if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
  61486. if (null !== $this->dispatcher) {
  61487. $event = new ConsoleErrorEvent($input, $output, $e);
  61488. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  61489. return $event->getExitCode();
  61490. }
  61491. return 1;
  61492. }
  61493. $command = $this->find($alternative);
  61494. }
  61495. if ($command instanceof LazyCommand) {
  61496. $command = $command->getCommand();
  61497. }
  61498. $this->runningCommand = $command;
  61499. $exitCode = $this->doRunCommand($command, $input, $output);
  61500. $this->runningCommand = null;
  61501. return $exitCode;
  61502. }
  61503. public function reset()
  61504. {
  61505. }
  61506. public function setHelperSet(HelperSet $helperSet)
  61507. {
  61508. $this->helperSet = $helperSet;
  61509. }
  61510. public function getHelperSet()
  61511. {
  61512. if (!$this->helperSet) {
  61513. $this->helperSet = $this->getDefaultHelperSet();
  61514. }
  61515. return $this->helperSet;
  61516. }
  61517. public function setDefinition(InputDefinition $definition)
  61518. {
  61519. $this->definition = $definition;
  61520. }
  61521. public function getDefinition()
  61522. {
  61523. if (!$this->definition) {
  61524. $this->definition = $this->getDefaultInputDefinition();
  61525. }
  61526. if ($this->singleCommand) {
  61527. $inputDefinition = $this->definition;
  61528. $inputDefinition->setArguments();
  61529. return $inputDefinition;
  61530. }
  61531. return $this->definition;
  61532. }
  61533. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  61534. {
  61535. if (
  61536. CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType()
  61537. && 'command' === $input->getCompletionName()
  61538. ) {
  61539. $commandNames = [];
  61540. foreach ($this->all() as $name => $command) {
  61541. if ($command->isHidden() || $command->getName() !== $name) {
  61542. continue;
  61543. }
  61544. $commandNames[] = $command->getName();
  61545. foreach ($command->getAliases() as $name) {
  61546. $commandNames[] = $name;
  61547. }
  61548. }
  61549. $suggestions->suggestValues(array_filter($commandNames));
  61550. return;
  61551. }
  61552. if (CompletionInput::TYPE_OPTION_NAME === $input->getCompletionType()) {
  61553. $suggestions->suggestOptions($this->getDefinition()->getOptions());
  61554. return;
  61555. }
  61556. }
  61557. public function getHelp()
  61558. {
  61559. return $this->getLongVersion();
  61560. }
  61561. public function areExceptionsCaught()
  61562. {
  61563. return $this->catchExceptions;
  61564. }
  61565. public function setCatchExceptions(bool $boolean)
  61566. {
  61567. $this->catchExceptions = $boolean;
  61568. }
  61569. public function isAutoExitEnabled()
  61570. {
  61571. return $this->autoExit;
  61572. }
  61573. public function setAutoExit(bool $boolean)
  61574. {
  61575. $this->autoExit = $boolean;
  61576. }
  61577. public function getName()
  61578. {
  61579. return $this->name;
  61580. }
  61581. public function setName(string $name)
  61582. {
  61583. $this->name = $name;
  61584. }
  61585. public function getVersion()
  61586. {
  61587. return $this->version;
  61588. }
  61589. public function setVersion(string $version)
  61590. {
  61591. $this->version = $version;
  61592. }
  61593. public function getLongVersion()
  61594. {
  61595. if ('UNKNOWN' !== $this->getName()) {
  61596. if ('UNKNOWN' !== $this->getVersion()) {
  61597. return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
  61598. }
  61599. return $this->getName();
  61600. }
  61601. return 'Console Tool';
  61602. }
  61603. public function register(string $name)
  61604. {
  61605. return $this->add(new Command($name));
  61606. }
  61607. public function addCommands(array $commands)
  61608. {
  61609. foreach ($commands as $command) {
  61610. $this->add($command);
  61611. }
  61612. }
  61613. public function add(Command $command)
  61614. {
  61615. $this->init();
  61616. $command->setApplication($this);
  61617. if (!$command->isEnabled()) {
  61618. $command->setApplication(null);
  61619. return null;
  61620. }
  61621. if (!$command instanceof LazyCommand) {
  61622. $command->getDefinition();
  61623. }
  61624. if (!$command->getName()) {
  61625. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command)));
  61626. }
  61627. $this->commands[$command->getName()] = $command;
  61628. foreach ($command->getAliases() as $alias) {
  61629. $this->commands[$alias] = $command;
  61630. }
  61631. return $command;
  61632. }
  61633. public function get(string $name)
  61634. {
  61635. $this->init();
  61636. if (!$this->has($name)) {
  61637. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  61638. }
  61639. if (!isset($this->commands[$name])) {
  61640. throw new CommandNotFoundException(sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $name));
  61641. }
  61642. $command = $this->commands[$name];
  61643. if ($this->wantHelps) {
  61644. $this->wantHelps = false;
  61645. $helpCommand = $this->get('help');
  61646. $helpCommand->setCommand($command);
  61647. return $helpCommand;
  61648. }
  61649. return $command;
  61650. }
  61651. public function has(string $name)
  61652. {
  61653. $this->init();
  61654. return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
  61655. }
  61656. public function getNamespaces()
  61657. {
  61658. $namespaces = [];
  61659. foreach ($this->all() as $command) {
  61660. if ($command->isHidden()) {
  61661. continue;
  61662. }
  61663. $namespaces[] = $this->extractAllNamespaces($command->getName());
  61664. foreach ($command->getAliases() as $alias) {
  61665. $namespaces[] = $this->extractAllNamespaces($alias);
  61666. }
  61667. }
  61668. return array_values(array_unique(array_filter(array_merge([], ...$namespaces))));
  61669. }
  61670. public function findNamespace(string $namespace)
  61671. {
  61672. $allNamespaces = $this->getNamespaces();
  61673. $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*';
  61674. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  61675. if (empty($namespaces)) {
  61676. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  61677. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  61678. if (1 == \count($alternatives)) {
  61679. $message .= "\n\nDid you mean this?\n ";
  61680. } else {
  61681. $message .= "\n\nDid you mean one of these?\n ";
  61682. }
  61683. $message .= implode("\n ", $alternatives);
  61684. }
  61685. throw new NamespaceNotFoundException($message, $alternatives);
  61686. }
  61687. $exact = \in_array($namespace, $namespaces, true);
  61688. if (\count($namespaces) > 1 && !$exact) {
  61689. throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  61690. }
  61691. return $exact ? $namespace : reset($namespaces);
  61692. }
  61693. public function find(string $name)
  61694. {
  61695. $this->init();
  61696. $aliases = [];
  61697. foreach ($this->commands as $command) {
  61698. foreach ($command->getAliases() as $alias) {
  61699. if (!$this->has($alias)) {
  61700. $this->commands[$alias] = $command;
  61701. }
  61702. }
  61703. }
  61704. if ($this->has($name)) {
  61705. return $this->get($name);
  61706. }
  61707. $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
  61708. $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*';
  61709. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  61710. if (empty($commands)) {
  61711. $commands = preg_grep('{^'.$expr.'}i', $allCommands);
  61712. }
  61713. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) {
  61714. if (false !== $pos = strrpos($name, ':')) {
  61715. $this->findNamespace(substr($name, 0, $pos));
  61716. }
  61717. $message = sprintf('Command "%s" is not defined.', $name);
  61718. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  61719. $alternatives = array_filter($alternatives, function ($name) {
  61720. return !$this->get($name)->isHidden();
  61721. });
  61722. if (1 == \count($alternatives)) {
  61723. $message .= "\n\nDid you mean this?\n ";
  61724. } else {
  61725. $message .= "\n\nDid you mean one of these?\n ";
  61726. }
  61727. $message .= implode("\n ", $alternatives);
  61728. }
  61729. throw new CommandNotFoundException($message, array_values($alternatives));
  61730. }
  61731. if (\count($commands) > 1) {
  61732. $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
  61733. $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
  61734. if (!$commandList[$nameOrAlias] instanceof Command) {
  61735. $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
  61736. }
  61737. $commandName = $commandList[$nameOrAlias]->getName();
  61738. $aliases[$nameOrAlias] = $commandName;
  61739. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  61740. }));
  61741. }
  61742. if (\count($commands) > 1) {
  61743. $usableWidth = $this->terminal->getWidth() - 10;
  61744. $abbrevs = array_values($commands);
  61745. $maxLen = 0;
  61746. foreach ($abbrevs as $abbrev) {
  61747. $maxLen = max(Helper::width($abbrev), $maxLen);
  61748. }
  61749. $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) {
  61750. if ($commandList[$cmd]->isHidden()) {
  61751. unset($commands[array_search($cmd, $commands)]);
  61752. return false;
  61753. }
  61754. $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription();
  61755. return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev;
  61756. }, array_values($commands));
  61757. if (\count($commands) > 1) {
  61758. $suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));
  61759. throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
  61760. }
  61761. }
  61762. $command = $this->get(reset($commands));
  61763. if ($command->isHidden()) {
  61764. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  61765. }
  61766. return $command;
  61767. }
  61768. public function all(?string $namespace = null)
  61769. {
  61770. $this->init();
  61771. if (null === $namespace) {
  61772. if (!$this->commandLoader) {
  61773. return $this->commands;
  61774. }
  61775. $commands = $this->commands;
  61776. foreach ($this->commandLoader->getNames() as $name) {
  61777. if (!isset($commands[$name]) && $this->has($name)) {
  61778. $commands[$name] = $this->get($name);
  61779. }
  61780. }
  61781. return $commands;
  61782. }
  61783. $commands = [];
  61784. foreach ($this->commands as $name => $command) {
  61785. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  61786. $commands[$name] = $command;
  61787. }
  61788. }
  61789. if ($this->commandLoader) {
  61790. foreach ($this->commandLoader->getNames() as $name) {
  61791. if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
  61792. $commands[$name] = $this->get($name);
  61793. }
  61794. }
  61795. }
  61796. return $commands;
  61797. }
  61798. public static function getAbbreviations(array $names)
  61799. {
  61800. $abbrevs = [];
  61801. foreach ($names as $name) {
  61802. for ($len = \strlen($name); $len > 0; --$len) {
  61803. $abbrev = substr($name, 0, $len);
  61804. $abbrevs[$abbrev][] = $name;
  61805. }
  61806. }
  61807. return $abbrevs;
  61808. }
  61809. public function renderThrowable(\Throwable $e, OutputInterface $output): void
  61810. {
  61811. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  61812. $this->doRenderThrowable($e, $output);
  61813. if (null !== $this->runningCommand) {
  61814. $output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
  61815. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  61816. }
  61817. }
  61818. protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
  61819. {
  61820. do {
  61821. $message = trim($e->getMessage());
  61822. if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  61823. $class = get_debug_type($e);
  61824. $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
  61825. $len = Helper::width($title);
  61826. } else {
  61827. $len = 0;
  61828. }
  61829. if (str_contains($message, "@anonymous\0")) {
  61830. $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', function ($m) {
  61831. return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
  61832. }, $message);
  61833. }
  61834. $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
  61835. $lines = [];
  61836. foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
  61837. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  61838. $lineLength = Helper::width($line) + 4;
  61839. $lines[] = [$line, $lineLength];
  61840. $len = max($lineLength, $len);
  61841. }
  61842. }
  61843. $messages = [];
  61844. if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  61845. $messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
  61846. }
  61847. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  61848. if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  61849. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::width($title))));
  61850. }
  61851. foreach ($lines as $line) {
  61852. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  61853. }
  61854. $messages[] = $emptyLine;
  61855. $messages[] = '';
  61856. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  61857. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  61858. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  61859. $trace = $e->getTrace();
  61860. array_unshift($trace, [
  61861. 'function' => '',
  61862. 'file' => $e->getFile() ?: 'n/a',
  61863. 'line' => $e->getLine() ?: 'n/a',
  61864. 'args' => [],
  61865. ]);
  61866. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  61867. $class = $trace[$i]['class'] ?? '';
  61868. $type = $trace[$i]['type'] ?? '';
  61869. $function = $trace[$i]['function'] ?? '';
  61870. $file = $trace[$i]['file'] ?? 'n/a';
  61871. $line = $trace[$i]['line'] ?? 'n/a';
  61872. $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
  61873. }
  61874. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  61875. }
  61876. } while ($e = $e->getPrevious());
  61877. }
  61878. protected function configureIO(InputInterface $input, OutputInterface $output)
  61879. {
  61880. if (true === $input->hasParameterOption(['--ansi'], true)) {
  61881. $output->setDecorated(true);
  61882. } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
  61883. $output->setDecorated(false);
  61884. }
  61885. if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
  61886. $input->setInteractive(false);
  61887. }
  61888. switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
  61889. case -1:
  61890. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  61891. break;
  61892. case 1:
  61893. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  61894. break;
  61895. case 2:
  61896. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  61897. break;
  61898. case 3:
  61899. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  61900. break;
  61901. default:
  61902. $shellVerbosity = 0;
  61903. break;
  61904. }
  61905. if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
  61906. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  61907. $shellVerbosity = -1;
  61908. } else {
  61909. if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || 3 === $input->getParameterOption('--verbose', false, true)) {
  61910. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  61911. $shellVerbosity = 3;
  61912. } elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || 2 === $input->getParameterOption('--verbose', false, true)) {
  61913. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  61914. $shellVerbosity = 2;
  61915. } elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
  61916. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  61917. $shellVerbosity = 1;
  61918. }
  61919. }
  61920. if (-1 === $shellVerbosity) {
  61921. $input->setInteractive(false);
  61922. }
  61923. if (\function_exists('putenv')) {
  61924. @putenv('SHELL_VERBOSITY='.$shellVerbosity);
  61925. }
  61926. $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
  61927. $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
  61928. }
  61929. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  61930. {
  61931. foreach ($command->getHelperSet() as $helper) {
  61932. if ($helper instanceof InputAwareInterface) {
  61933. $helper->setInput($input);
  61934. }
  61935. }
  61936. if ($this->signalsToDispatchEvent) {
  61937. $commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : [];
  61938. if ($commandSignals || null !== $this->dispatcher) {
  61939. if (!$this->signalRegistry) {
  61940. throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
  61941. }
  61942. if (Terminal::hasSttyAvailable()) {
  61943. $sttyMode = shell_exec('stty -g');
  61944. foreach ([\SIGINT, \SIGTERM] as $signal) {
  61945. $this->signalRegistry->register($signal, static function () use ($sttyMode) {
  61946. shell_exec('stty '.$sttyMode);
  61947. });
  61948. }
  61949. }
  61950. }
  61951. if (null !== $this->dispatcher) {
  61952. foreach ($this->signalsToDispatchEvent as $signal) {
  61953. $event = new ConsoleSignalEvent($command, $input, $output, $signal);
  61954. $this->signalRegistry->register($signal, function ($signal, $hasNext) use ($event) {
  61955. $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
  61956. if (!$hasNext) {
  61957. if (!\in_array($signal, [\SIGUSR1, \SIGUSR2], true)) {
  61958. exit(0);
  61959. }
  61960. }
  61961. });
  61962. }
  61963. }
  61964. foreach ($commandSignals as $signal) {
  61965. $this->signalRegistry->register($signal, [$command, 'handleSignal']);
  61966. }
  61967. }
  61968. if (null === $this->dispatcher) {
  61969. return $command->run($input, $output);
  61970. }
  61971. try {
  61972. $command->mergeApplicationDefinition();
  61973. $input->bind($command->getDefinition());
  61974. } catch (ExceptionInterface $e) {
  61975. }
  61976. $event = new ConsoleCommandEvent($command, $input, $output);
  61977. $e = null;
  61978. try {
  61979. $this->dispatcher->dispatch($event, ConsoleEvents::COMMAND);
  61980. if ($event->commandShouldRun()) {
  61981. $exitCode = $command->run($input, $output);
  61982. } else {
  61983. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  61984. }
  61985. } catch (\Throwable $e) {
  61986. $event = new ConsoleErrorEvent($input, $output, $e, $command);
  61987. $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
  61988. $e = $event->getError();
  61989. if (0 === $exitCode = $event->getExitCode()) {
  61990. $e = null;
  61991. }
  61992. }
  61993. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  61994. $this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);
  61995. if (null !== $e) {
  61996. throw $e;
  61997. }
  61998. return $event->getExitCode();
  61999. }
  62000. protected function getCommandName(InputInterface $input)
  62001. {
  62002. return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument();
  62003. }
  62004. protected function getDefaultInputDefinition()
  62005. {
  62006. return new InputDefinition([
  62007. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  62008. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the <info>'.$this->defaultCommand.'</info> command'),
  62009. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  62010. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  62011. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  62012. new InputOption('--ansi', '', InputOption::VALUE_NEGATABLE, 'Force (or disable --no-ansi) ANSI output', null),
  62013. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  62014. ]);
  62015. }
  62016. protected function getDefaultCommands()
  62017. {
  62018. return [new HelpCommand(), new ListCommand(), new CompleteCommand(), new DumpCompletionCommand()];
  62019. }
  62020. protected function getDefaultHelperSet()
  62021. {
  62022. return new HelperSet([
  62023. new FormatterHelper(),
  62024. new DebugFormatterHelper(),
  62025. new ProcessHelper(),
  62026. new QuestionHelper(),
  62027. ]);
  62028. }
  62029. private function getAbbreviationSuggestions(array $abbrevs): string
  62030. {
  62031. return ' '.implode("\n ", $abbrevs);
  62032. }
  62033. public function extractNamespace(string $name, ?int $limit = null)
  62034. {
  62035. $parts = explode(':', $name, -1);
  62036. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  62037. }
  62038. private function findAlternatives(string $name, iterable $collection): array
  62039. {
  62040. $threshold = 1e3;
  62041. $alternatives = [];
  62042. $collectionParts = [];
  62043. foreach ($collection as $item) {
  62044. $collectionParts[$item] = explode(':', $item);
  62045. }
  62046. foreach (explode(':', $name) as $i => $subname) {
  62047. foreach ($collectionParts as $collectionName => $parts) {
  62048. $exists = isset($alternatives[$collectionName]);
  62049. if (!isset($parts[$i]) && $exists) {
  62050. $alternatives[$collectionName] += $threshold;
  62051. continue;
  62052. } elseif (!isset($parts[$i])) {
  62053. continue;
  62054. }
  62055. $lev = levenshtein($subname, $parts[$i]);
  62056. if ($lev <= \strlen($subname) / 3 || '' !== $subname && str_contains($parts[$i], $subname)) {
  62057. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  62058. } elseif ($exists) {
  62059. $alternatives[$collectionName] += $threshold;
  62060. }
  62061. }
  62062. }
  62063. foreach ($collection as $item) {
  62064. $lev = levenshtein($name, $item);
  62065. if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) {
  62066. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  62067. }
  62068. }
  62069. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  62070. ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
  62071. return array_keys($alternatives);
  62072. }
  62073. public function setDefaultCommand(string $commandName, bool $isSingleCommand = false)
  62074. {
  62075. $this->defaultCommand = explode('|', ltrim($commandName, '|'))[0];
  62076. if ($isSingleCommand) {
  62077. $this->find($commandName);
  62078. $this->singleCommand = true;
  62079. }
  62080. return $this;
  62081. }
  62082. public function isSingleCommand(): bool
  62083. {
  62084. return $this->singleCommand;
  62085. }
  62086. private function splitStringByWidth(string $string, int $width): array
  62087. {
  62088. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  62089. return str_split($string, $width);
  62090. }
  62091. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  62092. $lines = [];
  62093. $line = '';
  62094. $offset = 0;
  62095. while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) {
  62096. $offset += \strlen($m[0]);
  62097. foreach (preg_split('//u', $m[0]) as $char) {
  62098. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  62099. $line .= $char;
  62100. continue;
  62101. }
  62102. $lines[] = str_pad($line, $width);
  62103. $line = $char;
  62104. }
  62105. }
  62106. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  62107. mb_convert_variables($encoding, 'utf8', $lines);
  62108. return $lines;
  62109. }
  62110. private function extractAllNamespaces(string $name): array
  62111. {
  62112. $parts = explode(':', $name, -1);
  62113. $namespaces = [];
  62114. foreach ($parts as $part) {
  62115. if (\count($namespaces)) {
  62116. $namespaces[] = end($namespaces).':'.$part;
  62117. } else {
  62118. $namespaces[] = $part;
  62119. }
  62120. }
  62121. return $namespaces;
  62122. }
  62123. private function init()
  62124. {
  62125. if ($this->initialized) {
  62126. return;
  62127. }
  62128. $this->initialized = true;
  62129. foreach ($this->getDefaultCommands() as $command) {
  62130. $this->add($command);
  62131. }
  62132. }
  62133. }
  62134. <?php
  62135. namespace Symfony\Component\Console\Attribute;
  62136. #[\Attribute(\Attribute::TARGET_CLASS)]
  62137. class AsCommand
  62138. {
  62139. public function __construct(
  62140. public string $name,
  62141. public ?string $description = null,
  62142. array $aliases = [],
  62143. bool $hidden = false,
  62144. ) {
  62145. if (!$hidden && !$aliases) {
  62146. return;
  62147. }
  62148. $name = explode('|', $name);
  62149. $name = array_merge($name, $aliases);
  62150. if ($hidden && '' !== $name[0]) {
  62151. array_unshift($name, '');
  62152. }
  62153. $this->name = implode('|', $name);
  62154. }
  62155. }
  62156. <?php
  62157. namespace Symfony\Component\Console\CI;
  62158. use Symfony\Component\Console\Output\OutputInterface;
  62159. class GithubActionReporter
  62160. {
  62161. private $output;
  62162. private const ESCAPED_DATA = [
  62163. '%' => '%25',
  62164. "\r" => '%0D',
  62165. "\n" => '%0A',
  62166. ];
  62167. private const ESCAPED_PROPERTIES = [
  62168. '%' => '%25',
  62169. "\r" => '%0D',
  62170. "\n" => '%0A',
  62171. ':' => '%3A',
  62172. ',' => '%2C',
  62173. ];
  62174. public function __construct(OutputInterface $output)
  62175. {
  62176. $this->output = $output;
  62177. }
  62178. public static function isGithubActionEnvironment(): bool
  62179. {
  62180. return false !== getenv('GITHUB_ACTIONS');
  62181. }
  62182. public function error(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  62183. {
  62184. $this->log('error', $message, $file, $line, $col);
  62185. }
  62186. public function warning(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  62187. {
  62188. $this->log('warning', $message, $file, $line, $col);
  62189. }
  62190. public function debug(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  62191. {
  62192. $this->log('debug', $message, $file, $line, $col);
  62193. }
  62194. private function log(string $type, string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
  62195. {
  62196. $message = strtr($message, self::ESCAPED_DATA);
  62197. if (!$file) {
  62198. $this->output->writeln(sprintf('::%s::%s', $type, $message));
  62199. return;
  62200. }
  62201. $this->output->writeln(sprintf('::%s file=%s,line=%s,col=%s::%s', $type, strtr($file, self::ESCAPED_PROPERTIES), strtr($line ?? 1, self::ESCAPED_PROPERTIES), strtr($col ?? 0, self::ESCAPED_PROPERTIES), $message));
  62202. }
  62203. }
  62204. <?php
  62205. namespace Symfony\Component\Console;
  62206. use Symfony\Component\Console\Exception\InvalidArgumentException;
  62207. final class Color
  62208. {
  62209. private const COLORS = [
  62210. 'black' => 0,
  62211. 'red' => 1,
  62212. 'green' => 2,
  62213. 'yellow' => 3,
  62214. 'blue' => 4,
  62215. 'magenta' => 5,
  62216. 'cyan' => 6,
  62217. 'white' => 7,
  62218. 'default' => 9,
  62219. ];
  62220. private const BRIGHT_COLORS = [
  62221. 'gray' => 0,
  62222. 'bright-red' => 1,
  62223. 'bright-green' => 2,
  62224. 'bright-yellow' => 3,
  62225. 'bright-blue' => 4,
  62226. 'bright-magenta' => 5,
  62227. 'bright-cyan' => 6,
  62228. 'bright-white' => 7,
  62229. ];
  62230. private const AVAILABLE_OPTIONS = [
  62231. 'bold' => ['set' => 1, 'unset' => 22],
  62232. 'underscore' => ['set' => 4, 'unset' => 24],
  62233. 'blink' => ['set' => 5, 'unset' => 25],
  62234. 'reverse' => ['set' => 7, 'unset' => 27],
  62235. 'conceal' => ['set' => 8, 'unset' => 28],
  62236. ];
  62237. private $foreground;
  62238. private $background;
  62239. private $options = [];
  62240. public function __construct(string $foreground = '', string $background = '', array $options = [])
  62241. {
  62242. $this->foreground = $this->parseColor($foreground);
  62243. $this->background = $this->parseColor($background, true);
  62244. foreach ($options as $option) {
  62245. if (!isset(self::AVAILABLE_OPTIONS[$option])) {
  62246. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(self::AVAILABLE_OPTIONS))));
  62247. }
  62248. $this->options[$option] = self::AVAILABLE_OPTIONS[$option];
  62249. }
  62250. }
  62251. public function apply(string $text): string
  62252. {
  62253. return $this->set().$text.$this->unset();
  62254. }
  62255. public function set(): string
  62256. {
  62257. $setCodes = [];
  62258. if ('' !== $this->foreground) {
  62259. $setCodes[] = $this->foreground;
  62260. }
  62261. if ('' !== $this->background) {
  62262. $setCodes[] = $this->background;
  62263. }
  62264. foreach ($this->options as $option) {
  62265. $setCodes[] = $option['set'];
  62266. }
  62267. if (0 === \count($setCodes)) {
  62268. return '';
  62269. }
  62270. return sprintf("\033[%sm", implode(';', $setCodes));
  62271. }
  62272. public function unset(): string
  62273. {
  62274. $unsetCodes = [];
  62275. if ('' !== $this->foreground) {
  62276. $unsetCodes[] = 39;
  62277. }
  62278. if ('' !== $this->background) {
  62279. $unsetCodes[] = 49;
  62280. }
  62281. foreach ($this->options as $option) {
  62282. $unsetCodes[] = $option['unset'];
  62283. }
  62284. if (0 === \count($unsetCodes)) {
  62285. return '';
  62286. }
  62287. return sprintf("\033[%sm", implode(';', $unsetCodes));
  62288. }
  62289. private function parseColor(string $color, bool $background = false): string
  62290. {
  62291. if ('' === $color) {
  62292. return '';
  62293. }
  62294. if ('#' === $color[0]) {
  62295. $color = substr($color, 1);
  62296. if (3 === \strlen($color)) {
  62297. $color = $color[0].$color[0].$color[1].$color[1].$color[2].$color[2];
  62298. }
  62299. if (6 !== \strlen($color)) {
  62300. throw new InvalidArgumentException(sprintf('Invalid "%s" color.', $color));
  62301. }
  62302. return ($background ? '4' : '3').$this->convertHexColorToAnsi(hexdec($color));
  62303. }
  62304. if (isset(self::COLORS[$color])) {
  62305. return ($background ? '4' : '3').self::COLORS[$color];
  62306. }
  62307. if (isset(self::BRIGHT_COLORS[$color])) {
  62308. return ($background ? '10' : '9').self::BRIGHT_COLORS[$color];
  62309. }
  62310. throw new InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));
  62311. }
  62312. private function convertHexColorToAnsi(int $color): string
  62313. {
  62314. $r = ($color >> 16) & 255;
  62315. $g = ($color >> 8) & 255;
  62316. $b = $color & 255;
  62317. if ('truecolor' !== getenv('COLORTERM')) {
  62318. return (string) $this->degradeHexColorToAnsi($r, $g, $b);
  62319. }
  62320. return sprintf('8;2;%d;%d;%d', $r, $g, $b);
  62321. }
  62322. private function degradeHexColorToAnsi(int $r, int $g, int $b): int
  62323. {
  62324. if (0 === round($this->getSaturation($r, $g, $b) / 50)) {
  62325. return 0;
  62326. }
  62327. return (round($b / 255) << 2) | (round($g / 255) << 1) | round($r / 255);
  62328. }
  62329. private function getSaturation(int $r, int $g, int $b): int
  62330. {
  62331. $r = $r / 255;
  62332. $g = $g / 255;
  62333. $b = $b / 255;
  62334. $v = max($r, $g, $b);
  62335. if (0 === $diff = $v - min($r, $g, $b)) {
  62336. return 0;
  62337. }
  62338. return (int) $diff * 100 / $v;
  62339. }
  62340. }
  62341. <?php
  62342. namespace Symfony\Component\Console\Command;
  62343. use Symfony\Component\Console\Application;
  62344. use Symfony\Component\Console\Attribute\AsCommand;
  62345. use Symfony\Component\Console\Completion\CompletionInput;
  62346. use Symfony\Component\Console\Completion\CompletionSuggestions;
  62347. use Symfony\Component\Console\Exception\ExceptionInterface;
  62348. use Symfony\Component\Console\Exception\InvalidArgumentException;
  62349. use Symfony\Component\Console\Exception\LogicException;
  62350. use Symfony\Component\Console\Helper\HelperSet;
  62351. use Symfony\Component\Console\Input\InputArgument;
  62352. use Symfony\Component\Console\Input\InputDefinition;
  62353. use Symfony\Component\Console\Input\InputInterface;
  62354. use Symfony\Component\Console\Input\InputOption;
  62355. use Symfony\Component\Console\Output\OutputInterface;
  62356. class Command
  62357. {
  62358. public const SUCCESS = 0;
  62359. public const FAILURE = 1;
  62360. public const INVALID = 2;
  62361. protected static $defaultName;
  62362. protected static $defaultDescription;
  62363. private $application;
  62364. private $name;
  62365. private $processTitle;
  62366. private $aliases = [];
  62367. private $definition;
  62368. private $hidden = false;
  62369. private $help = '';
  62370. private $description = '';
  62371. private $fullDefinition;
  62372. private $ignoreValidationErrors = false;
  62373. private $code;
  62374. private $synopsis = [];
  62375. private $usages = [];
  62376. private $helperSet;
  62377. public static function getDefaultName()
  62378. {
  62379. $class = static::class;
  62380. if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
  62381. return $attribute[0]->newInstance()->name;
  62382. }
  62383. $r = new \ReflectionProperty($class, 'defaultName');
  62384. return $class === $r->class ? static::$defaultName : null;
  62385. }
  62386. public static function getDefaultDescription(): ?string
  62387. {
  62388. $class = static::class;
  62389. if (\PHP_VERSION_ID >= 80000 && $attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
  62390. return $attribute[0]->newInstance()->description;
  62391. }
  62392. $r = new \ReflectionProperty($class, 'defaultDescription');
  62393. return $class === $r->class ? static::$defaultDescription : null;
  62394. }
  62395. public function __construct(?string $name = null)
  62396. {
  62397. $this->definition = new InputDefinition();
  62398. if (null === $name && null !== $name = static::getDefaultName()) {
  62399. $aliases = explode('|', $name);
  62400. if ('' === $name = array_shift($aliases)) {
  62401. $this->setHidden(true);
  62402. $name = array_shift($aliases);
  62403. }
  62404. $this->setAliases($aliases);
  62405. }
  62406. if (null !== $name) {
  62407. $this->setName($name);
  62408. }
  62409. if ('' === $this->description) {
  62410. $this->setDescription(static::getDefaultDescription() ?? '');
  62411. }
  62412. $this->configure();
  62413. }
  62414. public function ignoreValidationErrors()
  62415. {
  62416. $this->ignoreValidationErrors = true;
  62417. }
  62418. public function setApplication(?Application $application = null)
  62419. {
  62420. $this->application = $application;
  62421. if ($application) {
  62422. $this->setHelperSet($application->getHelperSet());
  62423. } else {
  62424. $this->helperSet = null;
  62425. }
  62426. $this->fullDefinition = null;
  62427. }
  62428. public function setHelperSet(HelperSet $helperSet)
  62429. {
  62430. $this->helperSet = $helperSet;
  62431. }
  62432. public function getHelperSet()
  62433. {
  62434. return $this->helperSet;
  62435. }
  62436. public function getApplication()
  62437. {
  62438. return $this->application;
  62439. }
  62440. public function isEnabled()
  62441. {
  62442. return true;
  62443. }
  62444. protected function configure()
  62445. {
  62446. }
  62447. protected function execute(InputInterface $input, OutputInterface $output)
  62448. {
  62449. throw new LogicException('You must override the execute() method in the concrete command class.');
  62450. }
  62451. protected function interact(InputInterface $input, OutputInterface $output)
  62452. {
  62453. }
  62454. protected function initialize(InputInterface $input, OutputInterface $output)
  62455. {
  62456. }
  62457. public function run(InputInterface $input, OutputInterface $output)
  62458. {
  62459. $this->mergeApplicationDefinition();
  62460. try {
  62461. $input->bind($this->getDefinition());
  62462. } catch (ExceptionInterface $e) {
  62463. if (!$this->ignoreValidationErrors) {
  62464. throw $e;
  62465. }
  62466. }
  62467. $this->initialize($input, $output);
  62468. if (null !== $this->processTitle) {
  62469. if (\function_exists('cli_set_process_title')) {
  62470. if (!@cli_set_process_title($this->processTitle)) {
  62471. if ('Darwin' === \PHP_OS) {
  62472. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  62473. } else {
  62474. cli_set_process_title($this->processTitle);
  62475. }
  62476. }
  62477. } elseif (\function_exists('setproctitle')) {
  62478. setproctitle($this->processTitle);
  62479. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  62480. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  62481. }
  62482. }
  62483. if ($input->isInteractive()) {
  62484. $this->interact($input, $output);
  62485. }
  62486. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  62487. $input->setArgument('command', $this->getName());
  62488. }
  62489. $input->validate();
  62490. if ($this->code) {
  62491. $statusCode = ($this->code)($input, $output);
  62492. } else {
  62493. $statusCode = $this->execute($input, $output);
  62494. if (!\is_int($statusCode)) {
  62495. throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
  62496. }
  62497. }
  62498. return is_numeric($statusCode) ? (int) $statusCode : 0;
  62499. }
  62500. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  62501. {
  62502. }
  62503. public function setCode(callable $code)
  62504. {
  62505. if ($code instanceof \Closure) {
  62506. $r = new \ReflectionFunction($code);
  62507. if (null === $r->getClosureThis()) {
  62508. set_error_handler(static function () {});
  62509. try {
  62510. if ($c = \Closure::bind($code, $this)) {
  62511. $code = $c;
  62512. }
  62513. } finally {
  62514. restore_error_handler();
  62515. }
  62516. }
  62517. }
  62518. $this->code = $code;
  62519. return $this;
  62520. }
  62521. public function mergeApplicationDefinition(bool $mergeArgs = true)
  62522. {
  62523. if (null === $this->application) {
  62524. return;
  62525. }
  62526. $this->fullDefinition = new InputDefinition();
  62527. $this->fullDefinition->setOptions($this->definition->getOptions());
  62528. $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions());
  62529. if ($mergeArgs) {
  62530. $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments());
  62531. $this->fullDefinition->addArguments($this->definition->getArguments());
  62532. } else {
  62533. $this->fullDefinition->setArguments($this->definition->getArguments());
  62534. }
  62535. }
  62536. public function setDefinition($definition)
  62537. {
  62538. if ($definition instanceof InputDefinition) {
  62539. $this->definition = $definition;
  62540. } else {
  62541. $this->definition->setDefinition($definition);
  62542. }
  62543. $this->fullDefinition = null;
  62544. return $this;
  62545. }
  62546. public function getDefinition()
  62547. {
  62548. return $this->fullDefinition ?? $this->getNativeDefinition();
  62549. }
  62550. public function getNativeDefinition()
  62551. {
  62552. if (null === $this->definition) {
  62553. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
  62554. }
  62555. return $this->definition;
  62556. }
  62557. public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null)
  62558. {
  62559. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  62560. if (null !== $this->fullDefinition) {
  62561. $this->fullDefinition->addArgument(new InputArgument($name, $mode, $description, $default));
  62562. }
  62563. return $this;
  62564. }
  62565. public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null)
  62566. {
  62567. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  62568. if (null !== $this->fullDefinition) {
  62569. $this->fullDefinition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  62570. }
  62571. return $this;
  62572. }
  62573. public function setName(string $name)
  62574. {
  62575. $this->validateName($name);
  62576. $this->name = $name;
  62577. return $this;
  62578. }
  62579. public function setProcessTitle(string $title)
  62580. {
  62581. $this->processTitle = $title;
  62582. return $this;
  62583. }
  62584. public function getName()
  62585. {
  62586. return $this->name;
  62587. }
  62588. public function setHidden(bool $hidden )
  62589. {
  62590. $this->hidden = $hidden;
  62591. return $this;
  62592. }
  62593. public function isHidden()
  62594. {
  62595. return $this->hidden;
  62596. }
  62597. public function setDescription(string $description)
  62598. {
  62599. $this->description = $description;
  62600. return $this;
  62601. }
  62602. public function getDescription()
  62603. {
  62604. return $this->description;
  62605. }
  62606. public function setHelp(string $help)
  62607. {
  62608. $this->help = $help;
  62609. return $this;
  62610. }
  62611. public function getHelp()
  62612. {
  62613. return $this->help;
  62614. }
  62615. public function getProcessedHelp()
  62616. {
  62617. $name = $this->name;
  62618. $isSingleCommand = $this->application && $this->application->isSingleCommand();
  62619. $placeholders = [
  62620. '%command.name%',
  62621. '%command.full_name%',
  62622. ];
  62623. $replacements = [
  62624. $name,
  62625. $isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
  62626. ];
  62627. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  62628. }
  62629. public function setAliases(iterable $aliases)
  62630. {
  62631. $list = [];
  62632. foreach ($aliases as $alias) {
  62633. $this->validateName($alias);
  62634. $list[] = $alias;
  62635. }
  62636. $this->aliases = \is_array($aliases) ? $aliases : $list;
  62637. return $this;
  62638. }
  62639. public function getAliases()
  62640. {
  62641. return $this->aliases;
  62642. }
  62643. public function getSynopsis(bool $short = false)
  62644. {
  62645. $key = $short ? 'short' : 'long';
  62646. if (!isset($this->synopsis[$key])) {
  62647. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  62648. }
  62649. return $this->synopsis[$key];
  62650. }
  62651. public function addUsage(string $usage)
  62652. {
  62653. if (!str_starts_with($usage, $this->name)) {
  62654. $usage = sprintf('%s %s', $this->name, $usage);
  62655. }
  62656. $this->usages[] = $usage;
  62657. return $this;
  62658. }
  62659. public function getUsages()
  62660. {
  62661. return $this->usages;
  62662. }
  62663. public function getHelper(string $name)
  62664. {
  62665. if (null === $this->helperSet) {
  62666. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  62667. }
  62668. return $this->helperSet->get($name);
  62669. }
  62670. private function validateName(string $name)
  62671. {
  62672. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  62673. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  62674. }
  62675. }
  62676. }
  62677. <?php
  62678. namespace Symfony\Component\Console\Command;
  62679. use Symfony\Component\Console\Completion\CompletionInput;
  62680. use Symfony\Component\Console\Completion\CompletionSuggestions;
  62681. use Symfony\Component\Console\Completion\Output\BashCompletionOutput;
  62682. use Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
  62683. use Symfony\Component\Console\Exception\CommandNotFoundException;
  62684. use Symfony\Component\Console\Exception\ExceptionInterface;
  62685. use Symfony\Component\Console\Input\InputInterface;
  62686. use Symfony\Component\Console\Input\InputOption;
  62687. use Symfony\Component\Console\Output\OutputInterface;
  62688. final class CompleteCommand extends Command
  62689. {
  62690. protected static $defaultName = '|_complete';
  62691. protected static $defaultDescription = 'Internal command to provide shell completion suggestions';
  62692. private $completionOutputs;
  62693. private $isDebug = false;
  62694. public function __construct(array $completionOutputs = [])
  62695. {
  62696. $this->completionOutputs = $completionOutputs + ['bash' => BashCompletionOutput::class];
  62697. parent::__construct();
  62698. }
  62699. protected function configure(): void
  62700. {
  62701. $this
  62702. ->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("'.implode('", "', array_keys($this->completionOutputs)).'")')
  62703. ->addOption('input', 'i', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An array of input tokens (e.g. COMP_WORDS or argv)')
  62704. ->addOption('current', 'c', InputOption::VALUE_REQUIRED, 'The index of the "input" array that the cursor is in (e.g. COMP_CWORD)')
  62705. ->addOption('symfony', 'S', InputOption::VALUE_REQUIRED, 'The version of the completion script')
  62706. ;
  62707. }
  62708. protected function initialize(InputInterface $input, OutputInterface $output)
  62709. {
  62710. $this->isDebug = filter_var(getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOLEAN);
  62711. }
  62712. protected function execute(InputInterface $input, OutputInterface $output): int
  62713. {
  62714. try {
  62715. $shell = $input->getOption('shell');
  62716. if (!$shell) {
  62717. throw new \RuntimeException('The "--shell" option must be set.');
  62718. }
  62719. if (!$completionOutput = $this->completionOutputs[$shell] ?? false) {
  62720. throw new \RuntimeException(sprintf('Shell completion is not supported for your shell: "%s" (supported: "%s").', $shell, implode('", "', array_keys($this->completionOutputs))));
  62721. }
  62722. $completionInput = $this->createCompletionInput($input);
  62723. $suggestions = new CompletionSuggestions();
  62724. $this->log([
  62725. '',
  62726. '<comment>'.date('Y-m-d H:i:s').'</>',
  62727. '<info>Input:</> <comment>("|" indicates the cursor position)</>',
  62728. ' '.(string) $completionInput,
  62729. '<info>Command:</>',
  62730. ' '.(string) implode(' ', $_SERVER['argv']),
  62731. '<info>Messages:</>',
  62732. ]);
  62733. $command = $this->findCommand($completionInput, $output);
  62734. if (null === $command) {
  62735. $this->log(' No command found, completing using the Application class.');
  62736. $this->getApplication()->complete($completionInput, $suggestions);
  62737. } elseif (
  62738. $completionInput->mustSuggestArgumentValuesFor('command')
  62739. && $command->getName() !== $completionInput->getCompletionValue()
  62740. && !\in_array($completionInput->getCompletionValue(), $command->getAliases(), true)
  62741. ) {
  62742. $this->log(' No command found, completing using the Application class.');
  62743. $suggestions->suggestValues(array_filter(array_merge([$command->getName()], $command->getAliases())));
  62744. } else {
  62745. $command->mergeApplicationDefinition();
  62746. $completionInput->bind($command->getDefinition());
  62747. if (CompletionInput::TYPE_OPTION_NAME === $completionInput->getCompletionType()) {
  62748. $this->log(' Completing option names for the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> command.');
  62749. $suggestions->suggestOptions($command->getDefinition()->getOptions());
  62750. } else {
  62751. $this->log([
  62752. ' Completing using the <comment>'.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).'</> class.',
  62753. ' Completing <comment>'.$completionInput->getCompletionType().'</> for <comment>'.$completionInput->getCompletionName().'</>',
  62754. ]);
  62755. if (null !== $compval = $completionInput->getCompletionValue()) {
  62756. $this->log(' Current value: <comment>'.$compval.'</>');
  62757. }
  62758. $command->complete($completionInput, $suggestions);
  62759. }
  62760. }
  62761. $completionOutput = new $completionOutput();
  62762. $this->log('<info>Suggestions:</>');
  62763. if ($options = $suggestions->getOptionSuggestions()) {
  62764. $this->log(' --'.implode(' --', array_map(function ($o) { return $o->getName(); }, $options)));
  62765. } elseif ($values = $suggestions->getValueSuggestions()) {
  62766. $this->log(' '.implode(' ', $values));
  62767. } else {
  62768. $this->log(' <comment>No suggestions were provided</>');
  62769. }
  62770. $completionOutput->write($suggestions, $output);
  62771. } catch (\Throwable $e) {
  62772. $this->log([
  62773. '<error>Error!</error>',
  62774. (string) $e,
  62775. ]);
  62776. if ($output->isDebug()) {
  62777. throw $e;
  62778. }
  62779. return 2;
  62780. }
  62781. return 0;
  62782. }
  62783. private function createCompletionInput(InputInterface $input): CompletionInput
  62784. {
  62785. $currentIndex = $input->getOption('current');
  62786. if (!$currentIndex || !ctype_digit($currentIndex)) {
  62787. throw new \RuntimeException('The "--current" option must be set and it must be an integer.');
  62788. }
  62789. $completionInput = CompletionInput::fromTokens($input->getOption('input'), (int) $currentIndex);
  62790. try {
  62791. $completionInput->bind($this->getApplication()->getDefinition());
  62792. } catch (ExceptionInterface $e) {
  62793. }
  62794. return $completionInput;
  62795. }
  62796. private function findCommand(CompletionInput $completionInput, OutputInterface $output): ?Command
  62797. {
  62798. try {
  62799. $inputName = $completionInput->getFirstArgument();
  62800. if (null === $inputName) {
  62801. return null;
  62802. }
  62803. return $this->getApplication()->find($inputName);
  62804. } catch (CommandNotFoundException $e) {
  62805. }
  62806. return null;
  62807. }
  62808. private function log($messages): void
  62809. {
  62810. if (!$this->isDebug) {
  62811. return;
  62812. }
  62813. $commandName = basename($_SERVER['argv'][0]);
  62814. file_put_contents(sys_get_temp_dir().'/sf_'.$commandName.'.log', implode(\PHP_EOL, (array) $messages).\PHP_EOL, \FILE_APPEND);
  62815. }
  62816. }
  62817. <?php
  62818. namespace Symfony\Component\Console\Command;
  62819. use Symfony\Component\Console\Completion\CompletionInput;
  62820. use Symfony\Component\Console\Completion\CompletionSuggestions;
  62821. use Symfony\Component\Console\Input\InputArgument;
  62822. use Symfony\Component\Console\Input\InputInterface;
  62823. use Symfony\Component\Console\Input\InputOption;
  62824. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  62825. use Symfony\Component\Console\Output\OutputInterface;
  62826. use Symfony\Component\Process\Process;
  62827. final class DumpCompletionCommand extends Command
  62828. {
  62829. protected static $defaultName = 'completion';
  62830. protected static $defaultDescription = 'Dump the shell completion script';
  62831. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  62832. {
  62833. if ($input->mustSuggestArgumentValuesFor('shell')) {
  62834. $suggestions->suggestValues($this->getSupportedShells());
  62835. }
  62836. }
  62837. protected function configure()
  62838. {
  62839. $fullCommand = $_SERVER['PHP_SELF'];
  62840. $commandName = basename($fullCommand);
  62841. $fullCommand = @realpath($fullCommand) ?: $fullCommand;
  62842. $this
  62843. ->setHelp(<<<EOH
  62844. The <info>%command.name%</> command dumps the shell completion script required
  62845. to use shell autocompletion (currently only bash completion is supported).
  62846. <comment>Static installation
  62847. -------------------</>
  62848. Dump the script to a global completion file and restart your shell:
  62849. <info>%command.full_name% bash | sudo tee /etc/bash_completion.d/{$commandName}</>
  62850. Or dump the script to a local file and source it:
  62851. <info>%command.full_name% bash > completion.sh</>
  62852. <comment># source the file whenever you use the project</>
  62853. <info>source completion.sh</>
  62854. <comment># or add this line at the end of your "~/.bashrc" file:</>
  62855. <info>source /path/to/completion.sh</>
  62856. <comment>Dynamic installation
  62857. --------------------</>
  62858. Add this to the end of your shell configuration file (e.g. <info>"~/.bashrc"</>):
  62859. <info>eval "$({$fullCommand} completion bash)"</>
  62860. EOH
  62861. )
  62862. ->addArgument('shell', InputArgument::OPTIONAL, 'The shell type (e.g. "bash"), the value of the "$SHELL" env var will be used if this is not given')
  62863. ->addOption('debug', null, InputOption::VALUE_NONE, 'Tail the completion debug log')
  62864. ;
  62865. }
  62866. protected function execute(InputInterface $input, OutputInterface $output): int
  62867. {
  62868. $commandName = basename($_SERVER['argv'][0]);
  62869. if ($input->getOption('debug')) {
  62870. $this->tailDebugLog($commandName, $output);
  62871. return 0;
  62872. }
  62873. $shell = $input->getArgument('shell') ?? self::guessShell();
  62874. $completionFile = __DIR__.'/../Resources/completion.'.$shell;
  62875. if (!file_exists($completionFile)) {
  62876. $supportedShells = $this->getSupportedShells();
  62877. if ($output instanceof ConsoleOutputInterface) {
  62878. $output = $output->getErrorOutput();
  62879. }
  62880. if ($shell) {
  62881. $output->writeln(sprintf('<error>Detected shell "%s", which is not supported by Symfony shell completion (supported shells: "%s").</>', $shell, implode('", "', $supportedShells)));
  62882. } else {
  62883. $output->writeln(sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
  62884. }
  62885. return 2;
  62886. }
  62887. $output->write(str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, $this->getApplication()->getVersion()], file_get_contents($completionFile)));
  62888. return 0;
  62889. }
  62890. private static function guessShell(): string
  62891. {
  62892. return basename($_SERVER['SHELL'] ?? '');
  62893. }
  62894. private function tailDebugLog(string $commandName, OutputInterface $output): void
  62895. {
  62896. $debugFile = sys_get_temp_dir().'/sf_'.$commandName.'.log';
  62897. if (!file_exists($debugFile)) {
  62898. touch($debugFile);
  62899. }
  62900. $process = new Process(['tail', '-f', $debugFile], null, null, null, 0);
  62901. $process->run(function (string $type, string $line) use ($output): void {
  62902. $output->write($line);
  62903. });
  62904. }
  62905. private function getSupportedShells(): array
  62906. {
  62907. $shells = [];
  62908. foreach (new \DirectoryIterator(__DIR__.'/../Resources/') as $file) {
  62909. if (str_starts_with($file->getBasename(), 'completion.') && $file->isFile()) {
  62910. $shells[] = $file->getExtension();
  62911. }
  62912. }
  62913. return $shells;
  62914. }
  62915. }
  62916. <?php
  62917. namespace Symfony\Component\Console\Command;
  62918. use Symfony\Component\Console\Completion\CompletionInput;
  62919. use Symfony\Component\Console\Completion\CompletionSuggestions;
  62920. use Symfony\Component\Console\Descriptor\ApplicationDescription;
  62921. use Symfony\Component\Console\Helper\DescriptorHelper;
  62922. use Symfony\Component\Console\Input\InputArgument;
  62923. use Symfony\Component\Console\Input\InputInterface;
  62924. use Symfony\Component\Console\Input\InputOption;
  62925. use Symfony\Component\Console\Output\OutputInterface;
  62926. class HelpCommand extends Command
  62927. {
  62928. private $command;
  62929. protected function configure()
  62930. {
  62931. $this->ignoreValidationErrors();
  62932. $this
  62933. ->setName('help')
  62934. ->setDefinition([
  62935. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  62936. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  62937. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  62938. ])
  62939. ->setDescription('Display help for a command')
  62940. ->setHelp(<<<'EOF'
  62941. The <info>%command.name%</info> command displays help for a given command:
  62942. <info>%command.full_name% list</info>
  62943. You can also output the help in other formats by using the <comment>--format</comment> option:
  62944. <info>%command.full_name% --format=xml list</info>
  62945. To display the list of available commands, please use the <info>list</info> command.
  62946. EOF
  62947. )
  62948. ;
  62949. }
  62950. public function setCommand(Command $command)
  62951. {
  62952. $this->command = $command;
  62953. }
  62954. protected function execute(InputInterface $input, OutputInterface $output)
  62955. {
  62956. if (null === $this->command) {
  62957. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  62958. }
  62959. $helper = new DescriptorHelper();
  62960. $helper->describe($output, $this->command, [
  62961. 'format' => $input->getOption('format'),
  62962. 'raw_text' => $input->getOption('raw'),
  62963. ]);
  62964. $this->command = null;
  62965. return 0;
  62966. }
  62967. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  62968. {
  62969. if ($input->mustSuggestArgumentValuesFor('command_name')) {
  62970. $descriptor = new ApplicationDescription($this->getApplication());
  62971. $suggestions->suggestValues(array_keys($descriptor->getCommands()));
  62972. return;
  62973. }
  62974. if ($input->mustSuggestOptionValuesFor('format')) {
  62975. $helper = new DescriptorHelper();
  62976. $suggestions->suggestValues($helper->getFormats());
  62977. }
  62978. }
  62979. }
  62980. <?php
  62981. namespace Symfony\Component\Console\Command;
  62982. use Symfony\Component\Console\Application;
  62983. use Symfony\Component\Console\Completion\CompletionInput;
  62984. use Symfony\Component\Console\Completion\CompletionSuggestions;
  62985. use Symfony\Component\Console\Helper\HelperSet;
  62986. use Symfony\Component\Console\Input\InputDefinition;
  62987. use Symfony\Component\Console\Input\InputInterface;
  62988. use Symfony\Component\Console\Output\OutputInterface;
  62989. final class LazyCommand extends Command
  62990. {
  62991. private $command;
  62992. private $isEnabled;
  62993. public function __construct(string $name, array $aliases, string $description, bool $isHidden, \Closure $commandFactory, ?bool $isEnabled = true)
  62994. {
  62995. $this->setName($name)
  62996. ->setAliases($aliases)
  62997. ->setHidden($isHidden)
  62998. ->setDescription($description);
  62999. $this->command = $commandFactory;
  63000. $this->isEnabled = $isEnabled;
  63001. }
  63002. public function ignoreValidationErrors(): void
  63003. {
  63004. $this->getCommand()->ignoreValidationErrors();
  63005. }
  63006. public function setApplication(?Application $application = null): void
  63007. {
  63008. if ($this->command instanceof parent) {
  63009. $this->command->setApplication($application);
  63010. }
  63011. parent::setApplication($application);
  63012. }
  63013. public function setHelperSet(HelperSet $helperSet): void
  63014. {
  63015. if ($this->command instanceof parent) {
  63016. $this->command->setHelperSet($helperSet);
  63017. }
  63018. parent::setHelperSet($helperSet);
  63019. }
  63020. public function isEnabled(): bool
  63021. {
  63022. return $this->isEnabled ?? $this->getCommand()->isEnabled();
  63023. }
  63024. public function run(InputInterface $input, OutputInterface $output): int
  63025. {
  63026. return $this->getCommand()->run($input, $output);
  63027. }
  63028. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  63029. {
  63030. $this->getCommand()->complete($input, $suggestions);
  63031. }
  63032. public function setCode(callable $code): self
  63033. {
  63034. $this->getCommand()->setCode($code);
  63035. return $this;
  63036. }
  63037. public function mergeApplicationDefinition(bool $mergeArgs = true): void
  63038. {
  63039. $this->getCommand()->mergeApplicationDefinition($mergeArgs);
  63040. }
  63041. public function setDefinition($definition): self
  63042. {
  63043. $this->getCommand()->setDefinition($definition);
  63044. return $this;
  63045. }
  63046. public function getDefinition(): InputDefinition
  63047. {
  63048. return $this->getCommand()->getDefinition();
  63049. }
  63050. public function getNativeDefinition(): InputDefinition
  63051. {
  63052. return $this->getCommand()->getNativeDefinition();
  63053. }
  63054. public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null): self
  63055. {
  63056. $this->getCommand()->addArgument($name, $mode, $description, $default);
  63057. return $this;
  63058. }
  63059. public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): self
  63060. {
  63061. $this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
  63062. return $this;
  63063. }
  63064. public function setProcessTitle(string $title): self
  63065. {
  63066. $this->getCommand()->setProcessTitle($title);
  63067. return $this;
  63068. }
  63069. public function setHelp(string $help): self
  63070. {
  63071. $this->getCommand()->setHelp($help);
  63072. return $this;
  63073. }
  63074. public function getHelp(): string
  63075. {
  63076. return $this->getCommand()->getHelp();
  63077. }
  63078. public function getProcessedHelp(): string
  63079. {
  63080. return $this->getCommand()->getProcessedHelp();
  63081. }
  63082. public function getSynopsis(bool $short = false): string
  63083. {
  63084. return $this->getCommand()->getSynopsis($short);
  63085. }
  63086. public function addUsage(string $usage): self
  63087. {
  63088. $this->getCommand()->addUsage($usage);
  63089. return $this;
  63090. }
  63091. public function getUsages(): array
  63092. {
  63093. return $this->getCommand()->getUsages();
  63094. }
  63095. public function getHelper(string $name)
  63096. {
  63097. return $this->getCommand()->getHelper($name);
  63098. }
  63099. public function getCommand(): parent
  63100. {
  63101. if (!$this->command instanceof \Closure) {
  63102. return $this->command;
  63103. }
  63104. $command = $this->command = ($this->command)();
  63105. $command->setApplication($this->getApplication());
  63106. if (null !== $this->getHelperSet()) {
  63107. $command->setHelperSet($this->getHelperSet());
  63108. }
  63109. $command->setName($this->getName())
  63110. ->setAliases($this->getAliases())
  63111. ->setHidden($this->isHidden())
  63112. ->setDescription($this->getDescription());
  63113. $command->getDefinition();
  63114. return $command;
  63115. }
  63116. }
  63117. <?php
  63118. namespace Symfony\Component\Console\Command;
  63119. use Symfony\Component\Console\Completion\CompletionInput;
  63120. use Symfony\Component\Console\Completion\CompletionSuggestions;
  63121. use Symfony\Component\Console\Descriptor\ApplicationDescription;
  63122. use Symfony\Component\Console\Helper\DescriptorHelper;
  63123. use Symfony\Component\Console\Input\InputArgument;
  63124. use Symfony\Component\Console\Input\InputInterface;
  63125. use Symfony\Component\Console\Input\InputOption;
  63126. use Symfony\Component\Console\Output\OutputInterface;
  63127. class ListCommand extends Command
  63128. {
  63129. protected function configure()
  63130. {
  63131. $this
  63132. ->setName('list')
  63133. ->setDefinition([
  63134. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  63135. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  63136. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  63137. new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'),
  63138. ])
  63139. ->setDescription('List commands')
  63140. ->setHelp(<<<'EOF'
  63141. The <info>%command.name%</info> command lists all commands:
  63142. <info>%command.full_name%</info>
  63143. You can also display the commands for a specific namespace:
  63144. <info>%command.full_name% test</info>
  63145. You can also output the information in other formats by using the <comment>--format</comment> option:
  63146. <info>%command.full_name% --format=xml</info>
  63147. It's also possible to get raw list of commands (useful for embedding command runner):
  63148. <info>%command.full_name% --raw</info>
  63149. EOF
  63150. )
  63151. ;
  63152. }
  63153. protected function execute(InputInterface $input, OutputInterface $output)
  63154. {
  63155. $helper = new DescriptorHelper();
  63156. $helper->describe($output, $this->getApplication(), [
  63157. 'format' => $input->getOption('format'),
  63158. 'raw_text' => $input->getOption('raw'),
  63159. 'namespace' => $input->getArgument('namespace'),
  63160. 'short' => $input->getOption('short'),
  63161. ]);
  63162. return 0;
  63163. }
  63164. public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
  63165. {
  63166. if ($input->mustSuggestArgumentValuesFor('namespace')) {
  63167. $descriptor = new ApplicationDescription($this->getApplication());
  63168. $suggestions->suggestValues(array_keys($descriptor->getNamespaces()));
  63169. return;
  63170. }
  63171. if ($input->mustSuggestOptionValuesFor('format')) {
  63172. $helper = new DescriptorHelper();
  63173. $suggestions->suggestValues($helper->getFormats());
  63174. }
  63175. }
  63176. }
  63177. <?php
  63178. namespace Symfony\Component\Console\Command;
  63179. use Symfony\Component\Console\Exception\LogicException;
  63180. use Symfony\Component\Lock\LockFactory;
  63181. use Symfony\Component\Lock\LockInterface;
  63182. use Symfony\Component\Lock\Store\FlockStore;
  63183. use Symfony\Component\Lock\Store\SemaphoreStore;
  63184. trait LockableTrait
  63185. {
  63186. private $lock;
  63187. private function lock(?string $name = null, bool $blocking = false): bool
  63188. {
  63189. if (!class_exists(SemaphoreStore::class)) {
  63190. throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
  63191. }
  63192. if (null !== $this->lock) {
  63193. throw new LogicException('A lock is already in place.');
  63194. }
  63195. if (SemaphoreStore::isSupported()) {
  63196. $store = new SemaphoreStore();
  63197. } else {
  63198. $store = new FlockStore();
  63199. }
  63200. $this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
  63201. if (!$this->lock->acquire($blocking)) {
  63202. $this->lock = null;
  63203. return false;
  63204. }
  63205. return true;
  63206. }
  63207. private function release()
  63208. {
  63209. if ($this->lock) {
  63210. $this->lock->release();
  63211. $this->lock = null;
  63212. }
  63213. }
  63214. }
  63215. <?php
  63216. namespace Symfony\Component\Console\Command;
  63217. interface SignalableCommandInterface
  63218. {
  63219. public function getSubscribedSignals(): array;
  63220. public function handleSignal(int $signal): void;
  63221. }
  63222. <?php
  63223. namespace Symfony\Component\Console\CommandLoader;
  63224. use Symfony\Component\Console\Command\Command;
  63225. use Symfony\Component\Console\Exception\CommandNotFoundException;
  63226. interface CommandLoaderInterface
  63227. {
  63228. public function get(string $name);
  63229. public function has(string $name);
  63230. public function getNames();
  63231. }
  63232. <?php
  63233. namespace Symfony\Component\Console\CommandLoader;
  63234. use Psr\Container\ContainerInterface;
  63235. use Symfony\Component\Console\Exception\CommandNotFoundException;
  63236. class ContainerCommandLoader implements CommandLoaderInterface
  63237. {
  63238. private $container;
  63239. private $commandMap;
  63240. public function __construct(ContainerInterface $container, array $commandMap)
  63241. {
  63242. $this->container = $container;
  63243. $this->commandMap = $commandMap;
  63244. }
  63245. public function get(string $name)
  63246. {
  63247. if (!$this->has($name)) {
  63248. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  63249. }
  63250. return $this->container->get($this->commandMap[$name]);
  63251. }
  63252. public function has(string $name)
  63253. {
  63254. return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]);
  63255. }
  63256. public function getNames()
  63257. {
  63258. return array_keys($this->commandMap);
  63259. }
  63260. }
  63261. <?php
  63262. namespace Symfony\Component\Console\CommandLoader;
  63263. use Symfony\Component\Console\Exception\CommandNotFoundException;
  63264. class FactoryCommandLoader implements CommandLoaderInterface
  63265. {
  63266. private $factories;
  63267. public function __construct(array $factories)
  63268. {
  63269. $this->factories = $factories;
  63270. }
  63271. public function has(string $name)
  63272. {
  63273. return isset($this->factories[$name]);
  63274. }
  63275. public function get(string $name)
  63276. {
  63277. if (!isset($this->factories[$name])) {
  63278. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  63279. }
  63280. $factory = $this->factories[$name];
  63281. return $factory();
  63282. }
  63283. public function getNames()
  63284. {
  63285. return array_keys($this->factories);
  63286. }
  63287. }
  63288. <?php
  63289. namespace Symfony\Component\Console\Completion;
  63290. use Symfony\Component\Console\Exception\RuntimeException;
  63291. use Symfony\Component\Console\Input\ArgvInput;
  63292. use Symfony\Component\Console\Input\InputDefinition;
  63293. use Symfony\Component\Console\Input\InputOption;
  63294. final class CompletionInput extends ArgvInput
  63295. {
  63296. public const TYPE_ARGUMENT_VALUE = 'argument_value';
  63297. public const TYPE_OPTION_VALUE = 'option_value';
  63298. public const TYPE_OPTION_NAME = 'option_name';
  63299. public const TYPE_NONE = 'none';
  63300. private $tokens;
  63301. private $currentIndex;
  63302. private $completionType;
  63303. private $completionName = null;
  63304. private $completionValue = '';
  63305. public static function fromString(string $inputStr, int $currentIndex): self
  63306. {
  63307. preg_match_all('/(?<=^|\s)([\'"]?)(.+?)(?<!\\\\)\1(?=$|\s)/', $inputStr, $tokens);
  63308. return self::fromTokens($tokens[0], $currentIndex);
  63309. }
  63310. public static function fromTokens(array $tokens, int $currentIndex): self
  63311. {
  63312. $input = new self($tokens);
  63313. $input->tokens = $tokens;
  63314. $input->currentIndex = $currentIndex;
  63315. return $input;
  63316. }
  63317. public function bind(InputDefinition $definition): void
  63318. {
  63319. parent::bind($definition);
  63320. $relevantToken = $this->getRelevantToken();
  63321. if ('-' === $relevantToken[0]) {
  63322. [$optionToken, $optionValue] = explode('=', $relevantToken, 2) + ['', ''];
  63323. $option = $this->getOptionFromToken($optionToken);
  63324. if (null === $option && !$this->isCursorFree()) {
  63325. $this->completionType = self::TYPE_OPTION_NAME;
  63326. $this->completionValue = $relevantToken;
  63327. return;
  63328. }
  63329. if (null !== $option && $option->acceptValue()) {
  63330. $this->completionType = self::TYPE_OPTION_VALUE;
  63331. $this->completionName = $option->getName();
  63332. $this->completionValue = $optionValue ?: (!str_starts_with($optionToken, '--') ? substr($optionToken, 2) : '');
  63333. return;
  63334. }
  63335. }
  63336. $previousToken = $this->tokens[$this->currentIndex - 1];
  63337. if ('-' === $previousToken[0] && '' !== trim($previousToken, '-')) {
  63338. $previousOption = $this->getOptionFromToken($previousToken);
  63339. if (null !== $previousOption && $previousOption->acceptValue()) {
  63340. $this->completionType = self::TYPE_OPTION_VALUE;
  63341. $this->completionName = $previousOption->getName();
  63342. $this->completionValue = $relevantToken;
  63343. return;
  63344. }
  63345. }
  63346. $this->completionType = self::TYPE_ARGUMENT_VALUE;
  63347. foreach ($this->definition->getArguments() as $argumentName => $argument) {
  63348. if (!isset($this->arguments[$argumentName])) {
  63349. break;
  63350. }
  63351. $argumentValue = $this->arguments[$argumentName];
  63352. $this->completionName = $argumentName;
  63353. if (\is_array($argumentValue)) {
  63354. $this->completionValue = $argumentValue ? $argumentValue[array_key_last($argumentValue)] : null;
  63355. } else {
  63356. $this->completionValue = $argumentValue;
  63357. }
  63358. }
  63359. if ($this->currentIndex >= \count($this->tokens)) {
  63360. if (!isset($this->arguments[$argumentName]) || $this->definition->getArgument($argumentName)->isArray()) {
  63361. $this->completionName = $argumentName;
  63362. $this->completionValue = '';
  63363. } else {
  63364. $this->completionType = self::TYPE_NONE;
  63365. $this->completionName = null;
  63366. $this->completionValue = '';
  63367. }
  63368. }
  63369. }
  63370. public function getCompletionType(): string
  63371. {
  63372. return $this->completionType;
  63373. }
  63374. public function getCompletionName(): ?string
  63375. {
  63376. return $this->completionName;
  63377. }
  63378. public function getCompletionValue(): string
  63379. {
  63380. return $this->completionValue;
  63381. }
  63382. public function mustSuggestOptionValuesFor(string $optionName): bool
  63383. {
  63384. return self::TYPE_OPTION_VALUE === $this->getCompletionType() && $optionName === $this->getCompletionName();
  63385. }
  63386. public function mustSuggestArgumentValuesFor(string $argumentName): bool
  63387. {
  63388. return self::TYPE_ARGUMENT_VALUE === $this->getCompletionType() && $argumentName === $this->getCompletionName();
  63389. }
  63390. protected function parseToken(string $token, bool $parseOptions): bool
  63391. {
  63392. try {
  63393. return parent::parseToken($token, $parseOptions);
  63394. } catch (RuntimeException $e) {
  63395. }
  63396. return $parseOptions;
  63397. }
  63398. private function getOptionFromToken(string $optionToken): ?InputOption
  63399. {
  63400. $optionName = ltrim($optionToken, '-');
  63401. if (!$optionName) {
  63402. return null;
  63403. }
  63404. if ('-' === ($optionToken[1] ?? ' ')) {
  63405. return $this->definition->hasOption($optionName) ? $this->definition->getOption($optionName) : null;
  63406. }
  63407. return $this->definition->hasShortcut($optionName[0]) ? $this->definition->getOptionForShortcut($optionName[0]) : null;
  63408. }
  63409. private function getRelevantToken(): string
  63410. {
  63411. return $this->tokens[$this->isCursorFree() ? $this->currentIndex - 1 : $this->currentIndex];
  63412. }
  63413. private function isCursorFree(): bool
  63414. {
  63415. $nrOfTokens = \count($this->tokens);
  63416. if ($this->currentIndex > $nrOfTokens) {
  63417. throw new \LogicException('Current index is invalid, it must be the number of input tokens or one more.');
  63418. }
  63419. return $this->currentIndex >= $nrOfTokens;
  63420. }
  63421. public function __toString()
  63422. {
  63423. $str = '';
  63424. foreach ($this->tokens as $i => $token) {
  63425. $str .= $token;
  63426. if ($this->currentIndex === $i) {
  63427. $str .= '|';
  63428. }
  63429. $str .= ' ';
  63430. }
  63431. if ($this->currentIndex > $i) {
  63432. $str .= '|';
  63433. }
  63434. return rtrim($str);
  63435. }
  63436. }
  63437. <?php
  63438. namespace Symfony\Component\Console\Completion;
  63439. use Symfony\Component\Console\Input\InputOption;
  63440. final class CompletionSuggestions
  63441. {
  63442. private $valueSuggestions = [];
  63443. private $optionSuggestions = [];
  63444. public function suggestValue($value): self
  63445. {
  63446. $this->valueSuggestions[] = !$value instanceof Suggestion ? new Suggestion($value) : $value;
  63447. return $this;
  63448. }
  63449. public function suggestValues(array $values): self
  63450. {
  63451. foreach ($values as $value) {
  63452. $this->suggestValue($value);
  63453. }
  63454. return $this;
  63455. }
  63456. public function suggestOption(InputOption $option): self
  63457. {
  63458. $this->optionSuggestions[] = $option;
  63459. return $this;
  63460. }
  63461. public function suggestOptions(array $options): self
  63462. {
  63463. foreach ($options as $option) {
  63464. $this->suggestOption($option);
  63465. }
  63466. return $this;
  63467. }
  63468. public function getOptionSuggestions(): array
  63469. {
  63470. return $this->optionSuggestions;
  63471. }
  63472. public function getValueSuggestions(): array
  63473. {
  63474. return $this->valueSuggestions;
  63475. }
  63476. }
  63477. <?php
  63478. namespace Symfony\Component\Console\Completion\Output;
  63479. use Symfony\Component\Console\Completion\CompletionSuggestions;
  63480. use Symfony\Component\Console\Output\OutputInterface;
  63481. class BashCompletionOutput implements CompletionOutputInterface
  63482. {
  63483. public function write(CompletionSuggestions $suggestions, OutputInterface $output): void
  63484. {
  63485. $values = $suggestions->getValueSuggestions();
  63486. foreach ($suggestions->getOptionSuggestions() as $option) {
  63487. $values[] = '--'.$option->getName();
  63488. if ($option->isNegatable()) {
  63489. $values[] = '--no-'.$option->getName();
  63490. }
  63491. }
  63492. $output->writeln(implode("\n", $values));
  63493. }
  63494. }
  63495. <?php
  63496. namespace Symfony\Component\Console\Completion\Output;
  63497. use Symfony\Component\Console\Completion\CompletionSuggestions;
  63498. use Symfony\Component\Console\Output\OutputInterface;
  63499. interface CompletionOutputInterface
  63500. {
  63501. public function write(CompletionSuggestions $suggestions, OutputInterface $output): void;
  63502. }
  63503. <?php
  63504. namespace Symfony\Component\Console\Completion;
  63505. class Suggestion
  63506. {
  63507. private $value;
  63508. public function __construct(string $value)
  63509. {
  63510. $this->value = $value;
  63511. }
  63512. public function getValue(): string
  63513. {
  63514. return $this->value;
  63515. }
  63516. public function __toString(): string
  63517. {
  63518. return $this->getValue();
  63519. }
  63520. }
  63521. <?php
  63522. namespace Symfony\Component\Console;
  63523. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  63524. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  63525. use Symfony\Component\Console\Event\ConsoleSignalEvent;
  63526. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  63527. final class ConsoleEvents
  63528. {
  63529. public const COMMAND = 'console.command';
  63530. public const SIGNAL = 'console.signal';
  63531. public const TERMINATE = 'console.terminate';
  63532. public const ERROR = 'console.error';
  63533. public const ALIASES = [
  63534. ConsoleCommandEvent::class => self::COMMAND,
  63535. ConsoleErrorEvent::class => self::ERROR,
  63536. ConsoleSignalEvent::class => self::SIGNAL,
  63537. ConsoleTerminateEvent::class => self::TERMINATE,
  63538. ];
  63539. }
  63540. <?php
  63541. namespace Symfony\Component\Console;
  63542. use Symfony\Component\Console\Output\OutputInterface;
  63543. final class Cursor
  63544. {
  63545. private $output;
  63546. private $input;
  63547. public function __construct(OutputInterface $output, $input = null)
  63548. {
  63549. $this->output = $output;
  63550. $this->input = $input ?? (\defined('STDIN') ? \STDIN : fopen('php://input', 'r+'));
  63551. }
  63552. public function moveUp(int $lines = 1): self
  63553. {
  63554. $this->output->write(sprintf("\x1b[%dA", $lines));
  63555. return $this;
  63556. }
  63557. public function moveDown(int $lines = 1): self
  63558. {
  63559. $this->output->write(sprintf("\x1b[%dB", $lines));
  63560. return $this;
  63561. }
  63562. public function moveRight(int $columns = 1): self
  63563. {
  63564. $this->output->write(sprintf("\x1b[%dC", $columns));
  63565. return $this;
  63566. }
  63567. public function moveLeft(int $columns = 1): self
  63568. {
  63569. $this->output->write(sprintf("\x1b[%dD", $columns));
  63570. return $this;
  63571. }
  63572. public function moveToColumn(int $column): self
  63573. {
  63574. $this->output->write(sprintf("\x1b[%dG", $column));
  63575. return $this;
  63576. }
  63577. public function moveToPosition(int $column, int $row): self
  63578. {
  63579. $this->output->write(sprintf("\x1b[%d;%dH", $row + 1, $column));
  63580. return $this;
  63581. }
  63582. public function savePosition(): self
  63583. {
  63584. $this->output->write("\x1b7");
  63585. return $this;
  63586. }
  63587. public function restorePosition(): self
  63588. {
  63589. $this->output->write("\x1b8");
  63590. return $this;
  63591. }
  63592. public function hide(): self
  63593. {
  63594. $this->output->write("\x1b[?25l");
  63595. return $this;
  63596. }
  63597. public function show(): self
  63598. {
  63599. $this->output->write("\x1b[?25h\x1b[?0c");
  63600. return $this;
  63601. }
  63602. public function clearLine(): self
  63603. {
  63604. $this->output->write("\x1b[2K");
  63605. return $this;
  63606. }
  63607. public function clearLineAfter(): self
  63608. {
  63609. $this->output->write("\x1b[K");
  63610. return $this;
  63611. }
  63612. public function clearOutput(): self
  63613. {
  63614. $this->output->write("\x1b[0J");
  63615. return $this;
  63616. }
  63617. public function clearScreen(): self
  63618. {
  63619. $this->output->write("\x1b[2J");
  63620. return $this;
  63621. }
  63622. public function getCurrentPosition(): array
  63623. {
  63624. static $isTtySupported;
  63625. if (null === $isTtySupported && \function_exists('proc_open')) {
  63626. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
  63627. }
  63628. if (!$isTtySupported) {
  63629. return [1, 1];
  63630. }
  63631. $sttyMode = shell_exec('stty -g');
  63632. shell_exec('stty -icanon -echo');
  63633. @fwrite($this->input, "\033[6n");
  63634. $code = trim(fread($this->input, 1024));
  63635. shell_exec(sprintf('stty %s', $sttyMode));
  63636. sscanf($code, "\033[%d;%dR", $row, $col);
  63637. return [$col, $row];
  63638. }
  63639. }
  63640. <?php
  63641. namespace Symfony\Component\Console\DependencyInjection;
  63642. use Symfony\Component\Console\Command\Command;
  63643. use Symfony\Component\Console\Command\LazyCommand;
  63644. use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
  63645. use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
  63646. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  63647. use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
  63648. use Symfony\Component\DependencyInjection\ContainerBuilder;
  63649. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  63650. use Symfony\Component\DependencyInjection\Reference;
  63651. use Symfony\Component\DependencyInjection\TypedReference;
  63652. class AddConsoleCommandPass implements CompilerPassInterface
  63653. {
  63654. private $commandLoaderServiceId;
  63655. private $commandTag;
  63656. private $noPreloadTag;
  63657. private $privateTagName;
  63658. public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command', string $noPreloadTag = 'container.no_preload', string $privateTagName = 'container.private')
  63659. {
  63660. if (0 < \func_num_args()) {
  63661. trigger_deprecation('symfony/console', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
  63662. }
  63663. $this->commandLoaderServiceId = $commandLoaderServiceId;
  63664. $this->commandTag = $commandTag;
  63665. $this->noPreloadTag = $noPreloadTag;
  63666. $this->privateTagName = $privateTagName;
  63667. }
  63668. public function process(ContainerBuilder $container)
  63669. {
  63670. $commandServices = $container->findTaggedServiceIds($this->commandTag, true);
  63671. $lazyCommandMap = [];
  63672. $lazyCommandRefs = [];
  63673. $serviceIds = [];
  63674. foreach ($commandServices as $id => $tags) {
  63675. $definition = $container->getDefinition($id);
  63676. $definition->addTag($this->noPreloadTag);
  63677. $class = $container->getParameterBag()->resolveValue($definition->getClass());
  63678. if (isset($tags[0]['command'])) {
  63679. $aliases = $tags[0]['command'];
  63680. } else {
  63681. if (!$r = $container->getReflectionClass($class)) {
  63682. throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
  63683. }
  63684. if (!$r->isSubclassOf(Command::class)) {
  63685. throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
  63686. }
  63687. $aliases = str_replace('%', '%%', $class::getDefaultName() ?? '');
  63688. }
  63689. $aliases = explode('|', $aliases ?? '');
  63690. $commandName = array_shift($aliases);
  63691. if ($isHidden = '' === $commandName) {
  63692. $commandName = array_shift($aliases);
  63693. }
  63694. if (null === $commandName) {
  63695. if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag($this->privateTagName)) {
  63696. $commandId = 'console.command.public_alias.'.$id;
  63697. $container->setAlias($commandId, $id)->setPublic(true);
  63698. $id = $commandId;
  63699. }
  63700. $serviceIds[] = $id;
  63701. continue;
  63702. }
  63703. $description = $tags[0]['description'] ?? null;
  63704. unset($tags[0]);
  63705. $lazyCommandMap[$commandName] = $id;
  63706. $lazyCommandRefs[$id] = new TypedReference($id, $class);
  63707. foreach ($aliases as $alias) {
  63708. $lazyCommandMap[$alias] = $id;
  63709. }
  63710. foreach ($tags as $tag) {
  63711. if (isset($tag['command'])) {
  63712. $aliases[] = $tag['command'];
  63713. $lazyCommandMap[$tag['command']] = $id;
  63714. }
  63715. $description = $description ?? $tag['description'] ?? null;
  63716. }
  63717. $definition->addMethodCall('setName', [$commandName]);
  63718. if ($aliases) {
  63719. $definition->addMethodCall('setAliases', [$aliases]);
  63720. }
  63721. if ($isHidden) {
  63722. $definition->addMethodCall('setHidden', [true]);
  63723. }
  63724. if (!$description) {
  63725. if (!$r = $container->getReflectionClass($class)) {
  63726. throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
  63727. }
  63728. if (!$r->isSubclassOf(Command::class)) {
  63729. throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
  63730. }
  63731. $description = str_replace('%', '%%', $class::getDefaultDescription() ?? '');
  63732. }
  63733. if ($description) {
  63734. $definition->addMethodCall('setDescription', [$description]);
  63735. $container->register('.'.$id.'.lazy', LazyCommand::class)
  63736. ->setArguments([$commandName, $aliases, $description, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]);
  63737. $lazyCommandRefs[$id] = new Reference('.'.$id.'.lazy');
  63738. }
  63739. }
  63740. $container
  63741. ->register($this->commandLoaderServiceId, ContainerCommandLoader::class)
  63742. ->setPublic(true)
  63743. ->addTag($this->noPreloadTag)
  63744. ->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);
  63745. $container->setParameter('console.command.ids', $serviceIds);
  63746. }
  63747. }
  63748. <?php
  63749. namespace Symfony\Component\Console\Descriptor;
  63750. use Symfony\Component\Console\Application;
  63751. use Symfony\Component\Console\Command\Command;
  63752. use Symfony\Component\Console\Exception\CommandNotFoundException;
  63753. class ApplicationDescription
  63754. {
  63755. public const GLOBAL_NAMESPACE = '_global';
  63756. private $application;
  63757. private $namespace;
  63758. private $showHidden;
  63759. private $namespaces;
  63760. private $commands;
  63761. private $aliases;
  63762. public function __construct(Application $application, ?string $namespace = null, bool $showHidden = false)
  63763. {
  63764. $this->application = $application;
  63765. $this->namespace = $namespace;
  63766. $this->showHidden = $showHidden;
  63767. }
  63768. public function getNamespaces(): array
  63769. {
  63770. if (null === $this->namespaces) {
  63771. $this->inspectApplication();
  63772. }
  63773. return $this->namespaces;
  63774. }
  63775. public function getCommands(): array
  63776. {
  63777. if (null === $this->commands) {
  63778. $this->inspectApplication();
  63779. }
  63780. return $this->commands;
  63781. }
  63782. public function getCommand(string $name): Command
  63783. {
  63784. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  63785. throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
  63786. }
  63787. return $this->commands[$name] ?? $this->aliases[$name];
  63788. }
  63789. private function inspectApplication()
  63790. {
  63791. $this->commands = [];
  63792. $this->namespaces = [];
  63793. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  63794. foreach ($this->sortCommands($all) as $namespace => $commands) {
  63795. $names = [];
  63796. foreach ($commands as $name => $command) {
  63797. if (!$command->getName() || (!$this->showHidden && $command->isHidden())) {
  63798. continue;
  63799. }
  63800. if ($command->getName() === $name) {
  63801. $this->commands[$name] = $command;
  63802. } else {
  63803. $this->aliases[$name] = $command;
  63804. }
  63805. $names[] = $name;
  63806. }
  63807. $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
  63808. }
  63809. }
  63810. private function sortCommands(array $commands): array
  63811. {
  63812. $namespacedCommands = [];
  63813. $globalCommands = [];
  63814. $sortedCommands = [];
  63815. foreach ($commands as $name => $command) {
  63816. $key = $this->application->extractNamespace($name, 1);
  63817. if (\in_array($key, ['', self::GLOBAL_NAMESPACE], true)) {
  63818. $globalCommands[$name] = $command;
  63819. } else {
  63820. $namespacedCommands[$key][$name] = $command;
  63821. }
  63822. }
  63823. if ($globalCommands) {
  63824. ksort($globalCommands);
  63825. $sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
  63826. }
  63827. if ($namespacedCommands) {
  63828. ksort($namespacedCommands, \SORT_STRING);
  63829. foreach ($namespacedCommands as $key => $commandsSet) {
  63830. ksort($commandsSet);
  63831. $sortedCommands[$key] = $commandsSet;
  63832. }
  63833. }
  63834. return $sortedCommands;
  63835. }
  63836. }
  63837. <?php
  63838. namespace Symfony\Component\Console\Descriptor;
  63839. use Symfony\Component\Console\Application;
  63840. use Symfony\Component\Console\Command\Command;
  63841. use Symfony\Component\Console\Exception\InvalidArgumentException;
  63842. use Symfony\Component\Console\Input\InputArgument;
  63843. use Symfony\Component\Console\Input\InputDefinition;
  63844. use Symfony\Component\Console\Input\InputOption;
  63845. use Symfony\Component\Console\Output\OutputInterface;
  63846. abstract class Descriptor implements DescriptorInterface
  63847. {
  63848. protected $output;
  63849. public function describe(OutputInterface $output, object $object, array $options = [])
  63850. {
  63851. $this->output = $output;
  63852. switch (true) {
  63853. case $object instanceof InputArgument:
  63854. $this->describeInputArgument($object, $options);
  63855. break;
  63856. case $object instanceof InputOption:
  63857. $this->describeInputOption($object, $options);
  63858. break;
  63859. case $object instanceof InputDefinition:
  63860. $this->describeInputDefinition($object, $options);
  63861. break;
  63862. case $object instanceof Command:
  63863. $this->describeCommand($object, $options);
  63864. break;
  63865. case $object instanceof Application:
  63866. $this->describeApplication($object, $options);
  63867. break;
  63868. default:
  63869. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object)));
  63870. }
  63871. }
  63872. protected function write(string $content, bool $decorated = false)
  63873. {
  63874. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  63875. }
  63876. abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
  63877. abstract protected function describeInputOption(InputOption $option, array $options = []);
  63878. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
  63879. abstract protected function describeCommand(Command $command, array $options = []);
  63880. abstract protected function describeApplication(Application $application, array $options = []);
  63881. }
  63882. <?php
  63883. namespace Symfony\Component\Console\Descriptor;
  63884. use Symfony\Component\Console\Output\OutputInterface;
  63885. interface DescriptorInterface
  63886. {
  63887. public function describe(OutputInterface $output, object $object, array $options = []);
  63888. }
  63889. <?php
  63890. namespace Symfony\Component\Console\Descriptor;
  63891. use Symfony\Component\Console\Application;
  63892. use Symfony\Component\Console\Command\Command;
  63893. use Symfony\Component\Console\Input\InputArgument;
  63894. use Symfony\Component\Console\Input\InputDefinition;
  63895. use Symfony\Component\Console\Input\InputOption;
  63896. class JsonDescriptor extends Descriptor
  63897. {
  63898. protected function describeInputArgument(InputArgument $argument, array $options = [])
  63899. {
  63900. $this->writeData($this->getInputArgumentData($argument), $options);
  63901. }
  63902. protected function describeInputOption(InputOption $option, array $options = [])
  63903. {
  63904. $this->writeData($this->getInputOptionData($option), $options);
  63905. if ($option->isNegatable()) {
  63906. $this->writeData($this->getInputOptionData($option, true), $options);
  63907. }
  63908. }
  63909. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  63910. {
  63911. $this->writeData($this->getInputDefinitionData($definition), $options);
  63912. }
  63913. protected function describeCommand(Command $command, array $options = [])
  63914. {
  63915. $this->writeData($this->getCommandData($command, $options['short'] ?? false), $options);
  63916. }
  63917. protected function describeApplication(Application $application, array $options = [])
  63918. {
  63919. $describedNamespace = $options['namespace'] ?? null;
  63920. $description = new ApplicationDescription($application, $describedNamespace, true);
  63921. $commands = [];
  63922. foreach ($description->getCommands() as $command) {
  63923. $commands[] = $this->getCommandData($command, $options['short'] ?? false);
  63924. }
  63925. $data = [];
  63926. if ('UNKNOWN' !== $application->getName()) {
  63927. $data['application']['name'] = $application->getName();
  63928. if ('UNKNOWN' !== $application->getVersion()) {
  63929. $data['application']['version'] = $application->getVersion();
  63930. }
  63931. }
  63932. $data['commands'] = $commands;
  63933. if ($describedNamespace) {
  63934. $data['namespace'] = $describedNamespace;
  63935. } else {
  63936. $data['namespaces'] = array_values($description->getNamespaces());
  63937. }
  63938. $this->writeData($data, $options);
  63939. }
  63940. private function writeData(array $data, array $options)
  63941. {
  63942. $flags = $options['json_encoding'] ?? 0;
  63943. $this->write(json_encode($data, $flags));
  63944. }
  63945. private function getInputArgumentData(InputArgument $argument): array
  63946. {
  63947. return [
  63948. 'name' => $argument->getName(),
  63949. 'is_required' => $argument->isRequired(),
  63950. 'is_array' => $argument->isArray(),
  63951. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  63952. 'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  63953. ];
  63954. }
  63955. private function getInputOptionData(InputOption $option, bool $negated = false): array
  63956. {
  63957. return $negated ? [
  63958. 'name' => '--no-'.$option->getName(),
  63959. 'shortcut' => '',
  63960. 'accept_value' => false,
  63961. 'is_value_required' => false,
  63962. 'is_multiple' => false,
  63963. 'description' => 'Negate the "--'.$option->getName().'" option',
  63964. 'default' => false,
  63965. ] : [
  63966. 'name' => '--'.$option->getName(),
  63967. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  63968. 'accept_value' => $option->acceptValue(),
  63969. 'is_value_required' => $option->isValueRequired(),
  63970. 'is_multiple' => $option->isArray(),
  63971. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  63972. 'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  63973. ];
  63974. }
  63975. private function getInputDefinitionData(InputDefinition $definition): array
  63976. {
  63977. $inputArguments = [];
  63978. foreach ($definition->getArguments() as $name => $argument) {
  63979. $inputArguments[$name] = $this->getInputArgumentData($argument);
  63980. }
  63981. $inputOptions = [];
  63982. foreach ($definition->getOptions() as $name => $option) {
  63983. $inputOptions[$name] = $this->getInputOptionData($option);
  63984. if ($option->isNegatable()) {
  63985. $inputOptions['no-'.$name] = $this->getInputOptionData($option, true);
  63986. }
  63987. }
  63988. return ['arguments' => $inputArguments, 'options' => $inputOptions];
  63989. }
  63990. private function getCommandData(Command $command, bool $short = false): array
  63991. {
  63992. $data = [
  63993. 'name' => $command->getName(),
  63994. 'description' => $command->getDescription(),
  63995. ];
  63996. if ($short) {
  63997. $data += [
  63998. 'usage' => $command->getAliases(),
  63999. ];
  64000. } else {
  64001. $command->mergeApplicationDefinition(false);
  64002. $data += [
  64003. 'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()),
  64004. 'help' => $command->getProcessedHelp(),
  64005. 'definition' => $this->getInputDefinitionData($command->getDefinition()),
  64006. ];
  64007. }
  64008. $data['hidden'] = $command->isHidden();
  64009. return $data;
  64010. }
  64011. }
  64012. <?php
  64013. namespace Symfony\Component\Console\Descriptor;
  64014. use Symfony\Component\Console\Application;
  64015. use Symfony\Component\Console\Command\Command;
  64016. use Symfony\Component\Console\Helper\Helper;
  64017. use Symfony\Component\Console\Input\InputArgument;
  64018. use Symfony\Component\Console\Input\InputDefinition;
  64019. use Symfony\Component\Console\Input\InputOption;
  64020. use Symfony\Component\Console\Output\OutputInterface;
  64021. class MarkdownDescriptor extends Descriptor
  64022. {
  64023. public function describe(OutputInterface $output, object $object, array $options = [])
  64024. {
  64025. $decorated = $output->isDecorated();
  64026. $output->setDecorated(false);
  64027. parent::describe($output, $object, $options);
  64028. $output->setDecorated($decorated);
  64029. }
  64030. protected function write(string $content, bool $decorated = true)
  64031. {
  64032. parent::write($content, $decorated);
  64033. }
  64034. protected function describeInputArgument(InputArgument $argument, array $options = [])
  64035. {
  64036. $this->write(
  64037. '#### `'.($argument->getName() ?: '<none>')."`\n\n"
  64038. .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
  64039. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  64040. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  64041. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  64042. );
  64043. }
  64044. protected function describeInputOption(InputOption $option, array $options = [])
  64045. {
  64046. $name = '--'.$option->getName();
  64047. if ($option->isNegatable()) {
  64048. $name .= '|--no-'.$option->getName();
  64049. }
  64050. if ($option->getShortcut()) {
  64051. $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
  64052. }
  64053. $this->write(
  64054. '#### `'.$name.'`'."\n\n"
  64055. .($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
  64056. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  64057. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  64058. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  64059. .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
  64060. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  64061. );
  64062. }
  64063. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  64064. {
  64065. if ($showArguments = \count($definition->getArguments()) > 0) {
  64066. $this->write('### Arguments');
  64067. foreach ($definition->getArguments() as $argument) {
  64068. $this->write("\n\n");
  64069. if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
  64070. $this->write($describeInputArgument);
  64071. }
  64072. }
  64073. }
  64074. if (\count($definition->getOptions()) > 0) {
  64075. if ($showArguments) {
  64076. $this->write("\n\n");
  64077. }
  64078. $this->write('### Options');
  64079. foreach ($definition->getOptions() as $option) {
  64080. $this->write("\n\n");
  64081. if (null !== $describeInputOption = $this->describeInputOption($option)) {
  64082. $this->write($describeInputOption);
  64083. }
  64084. }
  64085. }
  64086. }
  64087. protected function describeCommand(Command $command, array $options = [])
  64088. {
  64089. if ($options['short'] ?? false) {
  64090. $this->write(
  64091. '`'.$command->getName()."`\n"
  64092. .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
  64093. .($command->getDescription() ? $command->getDescription()."\n\n" : '')
  64094. .'### Usage'."\n\n"
  64095. .array_reduce($command->getAliases(), function ($carry, $usage) {
  64096. return $carry.'* `'.$usage.'`'."\n";
  64097. })
  64098. );
  64099. return;
  64100. }
  64101. $command->mergeApplicationDefinition(false);
  64102. $this->write(
  64103. '`'.$command->getName()."`\n"
  64104. .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
  64105. .($command->getDescription() ? $command->getDescription()."\n\n" : '')
  64106. .'### Usage'."\n\n"
  64107. .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  64108. return $carry.'* `'.$usage.'`'."\n";
  64109. })
  64110. );
  64111. if ($help = $command->getProcessedHelp()) {
  64112. $this->write("\n");
  64113. $this->write($help);
  64114. }
  64115. $definition = $command->getDefinition();
  64116. if ($definition->getOptions() || $definition->getArguments()) {
  64117. $this->write("\n\n");
  64118. $this->describeInputDefinition($definition);
  64119. }
  64120. }
  64121. protected function describeApplication(Application $application, array $options = [])
  64122. {
  64123. $describedNamespace = $options['namespace'] ?? null;
  64124. $description = new ApplicationDescription($application, $describedNamespace);
  64125. $title = $this->getApplicationTitle($application);
  64126. $this->write($title."\n".str_repeat('=', Helper::width($title)));
  64127. foreach ($description->getNamespaces() as $namespace) {
  64128. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  64129. $this->write("\n\n");
  64130. $this->write('**'.$namespace['id'].':**');
  64131. }
  64132. $this->write("\n\n");
  64133. $this->write(implode("\n", array_map(function ($commandName) use ($description) {
  64134. return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
  64135. }, $namespace['commands'])));
  64136. }
  64137. foreach ($description->getCommands() as $command) {
  64138. $this->write("\n\n");
  64139. if (null !== $describeCommand = $this->describeCommand($command, $options)) {
  64140. $this->write($describeCommand);
  64141. }
  64142. }
  64143. }
  64144. private function getApplicationTitle(Application $application): string
  64145. {
  64146. if ('UNKNOWN' !== $application->getName()) {
  64147. if ('UNKNOWN' !== $application->getVersion()) {
  64148. return sprintf('%s %s', $application->getName(), $application->getVersion());
  64149. }
  64150. return $application->getName();
  64151. }
  64152. return 'Console Tool';
  64153. }
  64154. }
  64155. <?php
  64156. namespace Symfony\Component\Console\Descriptor;
  64157. use Symfony\Component\Console\Application;
  64158. use Symfony\Component\Console\Command\Command;
  64159. use Symfony\Component\Console\Formatter\OutputFormatter;
  64160. use Symfony\Component\Console\Helper\Helper;
  64161. use Symfony\Component\Console\Input\InputArgument;
  64162. use Symfony\Component\Console\Input\InputDefinition;
  64163. use Symfony\Component\Console\Input\InputOption;
  64164. class TextDescriptor extends Descriptor
  64165. {
  64166. protected function describeInputArgument(InputArgument $argument, array $options = [])
  64167. {
  64168. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  64169. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  64170. } else {
  64171. $default = '';
  64172. }
  64173. $totalWidth = $options['total_width'] ?? Helper::width($argument->getName());
  64174. $spacingWidth = $totalWidth - \strlen($argument->getName());
  64175. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  64176. $argument->getName(),
  64177. str_repeat(' ', $spacingWidth),
  64178. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  64179. $default
  64180. ), $options);
  64181. }
  64182. protected function describeInputOption(InputOption $option, array $options = [])
  64183. {
  64184. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  64185. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  64186. } else {
  64187. $default = '';
  64188. }
  64189. $value = '';
  64190. if ($option->acceptValue()) {
  64191. $value = '='.strtoupper($option->getName());
  64192. if ($option->isValueOptional()) {
  64193. $value = '['.$value.']';
  64194. }
  64195. }
  64196. $totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
  64197. $synopsis = sprintf('%s%s',
  64198. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  64199. sprintf($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value)
  64200. );
  64201. $spacingWidth = $totalWidth - Helper::width($synopsis);
  64202. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  64203. $synopsis,
  64204. str_repeat(' ', $spacingWidth),
  64205. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  64206. $default,
  64207. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  64208. ), $options);
  64209. }
  64210. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  64211. {
  64212. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  64213. foreach ($definition->getArguments() as $argument) {
  64214. $totalWidth = max($totalWidth, Helper::width($argument->getName()));
  64215. }
  64216. if ($definition->getArguments()) {
  64217. $this->writeText('<comment>Arguments:</comment>', $options);
  64218. $this->writeText("\n");
  64219. foreach ($definition->getArguments() as $argument) {
  64220. $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
  64221. $this->writeText("\n");
  64222. }
  64223. }
  64224. if ($definition->getArguments() && $definition->getOptions()) {
  64225. $this->writeText("\n");
  64226. }
  64227. if ($definition->getOptions()) {
  64228. $laterOptions = [];
  64229. $this->writeText('<comment>Options:</comment>', $options);
  64230. foreach ($definition->getOptions() as $option) {
  64231. if (\strlen($option->getShortcut() ?? '') > 1) {
  64232. $laterOptions[] = $option;
  64233. continue;
  64234. }
  64235. $this->writeText("\n");
  64236. $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
  64237. }
  64238. foreach ($laterOptions as $option) {
  64239. $this->writeText("\n");
  64240. $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
  64241. }
  64242. }
  64243. }
  64244. protected function describeCommand(Command $command, array $options = [])
  64245. {
  64246. $command->mergeApplicationDefinition(false);
  64247. if ($description = $command->getDescription()) {
  64248. $this->writeText('<comment>Description:</comment>', $options);
  64249. $this->writeText("\n");
  64250. $this->writeText(' '.$description);
  64251. $this->writeText("\n\n");
  64252. }
  64253. $this->writeText('<comment>Usage:</comment>', $options);
  64254. foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
  64255. $this->writeText("\n");
  64256. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  64257. }
  64258. $this->writeText("\n");
  64259. $definition = $command->getDefinition();
  64260. if ($definition->getOptions() || $definition->getArguments()) {
  64261. $this->writeText("\n");
  64262. $this->describeInputDefinition($definition, $options);
  64263. $this->writeText("\n");
  64264. }
  64265. $help = $command->getProcessedHelp();
  64266. if ($help && $help !== $description) {
  64267. $this->writeText("\n");
  64268. $this->writeText('<comment>Help:</comment>', $options);
  64269. $this->writeText("\n");
  64270. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  64271. $this->writeText("\n");
  64272. }
  64273. }
  64274. protected function describeApplication(Application $application, array $options = [])
  64275. {
  64276. $describedNamespace = $options['namespace'] ?? null;
  64277. $description = new ApplicationDescription($application, $describedNamespace);
  64278. if (isset($options['raw_text']) && $options['raw_text']) {
  64279. $width = $this->getColumnWidth($description->getCommands());
  64280. foreach ($description->getCommands() as $command) {
  64281. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  64282. $this->writeText("\n");
  64283. }
  64284. } else {
  64285. if ('' != $help = $application->getHelp()) {
  64286. $this->writeText("$help\n\n", $options);
  64287. }
  64288. $this->writeText("<comment>Usage:</comment>\n", $options);
  64289. $this->writeText(" command [options] [arguments]\n\n", $options);
  64290. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  64291. $this->writeText("\n");
  64292. $this->writeText("\n");
  64293. $commands = $description->getCommands();
  64294. $namespaces = $description->getNamespaces();
  64295. if ($describedNamespace && $namespaces) {
  64296. $describedNamespaceInfo = reset($namespaces);
  64297. foreach ($describedNamespaceInfo['commands'] as $name) {
  64298. $commands[$name] = $description->getCommand($name);
  64299. }
  64300. }
  64301. $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
  64302. return array_intersect($namespace['commands'], array_keys($commands));
  64303. }, array_values($namespaces)))));
  64304. if ($describedNamespace) {
  64305. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  64306. } else {
  64307. $this->writeText('<comment>Available commands:</comment>', $options);
  64308. }
  64309. foreach ($namespaces as $namespace) {
  64310. $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
  64311. return isset($commands[$name]);
  64312. });
  64313. if (!$namespace['commands']) {
  64314. continue;
  64315. }
  64316. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  64317. $this->writeText("\n");
  64318. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  64319. }
  64320. foreach ($namespace['commands'] as $name) {
  64321. $this->writeText("\n");
  64322. $spacingWidth = $width - Helper::width($name);
  64323. $command = $commands[$name];
  64324. $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
  64325. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
  64326. }
  64327. }
  64328. $this->writeText("\n");
  64329. }
  64330. }
  64331. private function writeText(string $content, array $options = [])
  64332. {
  64333. $this->write(
  64334. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  64335. isset($options['raw_output']) ? !$options['raw_output'] : true
  64336. );
  64337. }
  64338. private function getCommandAliasesText(Command $command): string
  64339. {
  64340. $text = '';
  64341. $aliases = $command->getAliases();
  64342. if ($aliases) {
  64343. $text = '['.implode('|', $aliases).'] ';
  64344. }
  64345. return $text;
  64346. }
  64347. private function formatDefaultValue($default): string
  64348. {
  64349. if (\INF === $default) {
  64350. return 'INF';
  64351. }
  64352. if (\is_string($default)) {
  64353. $default = OutputFormatter::escape($default);
  64354. } elseif (\is_array($default)) {
  64355. foreach ($default as $key => $value) {
  64356. if (\is_string($value)) {
  64357. $default[$key] = OutputFormatter::escape($value);
  64358. }
  64359. }
  64360. }
  64361. return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
  64362. }
  64363. private function getColumnWidth(array $commands): int
  64364. {
  64365. $widths = [];
  64366. foreach ($commands as $command) {
  64367. if ($command instanceof Command) {
  64368. $widths[] = Helper::width($command->getName());
  64369. foreach ($command->getAliases() as $alias) {
  64370. $widths[] = Helper::width($alias);
  64371. }
  64372. } else {
  64373. $widths[] = Helper::width($command);
  64374. }
  64375. }
  64376. return $widths ? max($widths) + 2 : 0;
  64377. }
  64378. private function calculateTotalWidthForOptions(array $options): int
  64379. {
  64380. $totalWidth = 0;
  64381. foreach ($options as $option) {
  64382. $nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName());
  64383. if ($option->isNegatable()) {
  64384. $nameLength += 6 + Helper::width($option->getName());
  64385. } elseif ($option->acceptValue()) {
  64386. $valueLength = 1 + Helper::width($option->getName());
  64387. $valueLength += $option->isValueOptional() ? 2 : 0;
  64388. $nameLength += $valueLength;
  64389. }
  64390. $totalWidth = max($totalWidth, $nameLength);
  64391. }
  64392. return $totalWidth;
  64393. }
  64394. }
  64395. <?php
  64396. namespace Symfony\Component\Console\Descriptor;
  64397. use Symfony\Component\Console\Application;
  64398. use Symfony\Component\Console\Command\Command;
  64399. use Symfony\Component\Console\Input\InputArgument;
  64400. use Symfony\Component\Console\Input\InputDefinition;
  64401. use Symfony\Component\Console\Input\InputOption;
  64402. class XmlDescriptor extends Descriptor
  64403. {
  64404. public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
  64405. {
  64406. $dom = new \DOMDocument('1.0', 'UTF-8');
  64407. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  64408. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  64409. foreach ($definition->getArguments() as $argument) {
  64410. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  64411. }
  64412. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  64413. foreach ($definition->getOptions() as $option) {
  64414. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  64415. }
  64416. return $dom;
  64417. }
  64418. public function getCommandDocument(Command $command, bool $short = false): \DOMDocument
  64419. {
  64420. $dom = new \DOMDocument('1.0', 'UTF-8');
  64421. $dom->appendChild($commandXML = $dom->createElement('command'));
  64422. $commandXML->setAttribute('id', $command->getName());
  64423. $commandXML->setAttribute('name', $command->getName());
  64424. $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0);
  64425. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  64426. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  64427. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  64428. if ($short) {
  64429. foreach ($command->getAliases() as $usage) {
  64430. $usagesXML->appendChild($dom->createElement('usage', $usage));
  64431. }
  64432. } else {
  64433. $command->mergeApplicationDefinition(false);
  64434. foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
  64435. $usagesXML->appendChild($dom->createElement('usage', $usage));
  64436. }
  64437. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  64438. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  64439. $definitionXML = $this->getInputDefinitionDocument($command->getDefinition());
  64440. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  64441. }
  64442. return $dom;
  64443. }
  64444. public function getApplicationDocument(Application $application, ?string $namespace = null, bool $short = false): \DOMDocument
  64445. {
  64446. $dom = new \DOMDocument('1.0', 'UTF-8');
  64447. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  64448. if ('UNKNOWN' !== $application->getName()) {
  64449. $rootXml->setAttribute('name', $application->getName());
  64450. if ('UNKNOWN' !== $application->getVersion()) {
  64451. $rootXml->setAttribute('version', $application->getVersion());
  64452. }
  64453. }
  64454. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  64455. $description = new ApplicationDescription($application, $namespace, true);
  64456. if ($namespace) {
  64457. $commandsXML->setAttribute('namespace', $namespace);
  64458. }
  64459. foreach ($description->getCommands() as $command) {
  64460. $this->appendDocument($commandsXML, $this->getCommandDocument($command, $short));
  64461. }
  64462. if (!$namespace) {
  64463. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  64464. foreach ($description->getNamespaces() as $namespaceDescription) {
  64465. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  64466. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  64467. foreach ($namespaceDescription['commands'] as $name) {
  64468. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  64469. $commandXML->appendChild($dom->createTextNode($name));
  64470. }
  64471. }
  64472. }
  64473. return $dom;
  64474. }
  64475. protected function describeInputArgument(InputArgument $argument, array $options = [])
  64476. {
  64477. $this->writeDocument($this->getInputArgumentDocument($argument));
  64478. }
  64479. protected function describeInputOption(InputOption $option, array $options = [])
  64480. {
  64481. $this->writeDocument($this->getInputOptionDocument($option));
  64482. }
  64483. protected function describeInputDefinition(InputDefinition $definition, array $options = [])
  64484. {
  64485. $this->writeDocument($this->getInputDefinitionDocument($definition));
  64486. }
  64487. protected function describeCommand(Command $command, array $options = [])
  64488. {
  64489. $this->writeDocument($this->getCommandDocument($command, $options['short'] ?? false));
  64490. }
  64491. protected function describeApplication(Application $application, array $options = [])
  64492. {
  64493. $this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? false));
  64494. }
  64495. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  64496. {
  64497. foreach ($importedParent->childNodes as $childNode) {
  64498. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  64499. }
  64500. }
  64501. private function writeDocument(\DOMDocument $dom)
  64502. {
  64503. $dom->formatOutput = true;
  64504. $this->write($dom->saveXML());
  64505. }
  64506. private function getInputArgumentDocument(InputArgument $argument): \DOMDocument
  64507. {
  64508. $dom = new \DOMDocument('1.0', 'UTF-8');
  64509. $dom->appendChild($objectXML = $dom->createElement('argument'));
  64510. $objectXML->setAttribute('name', $argument->getName());
  64511. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  64512. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  64513. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  64514. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  64515. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  64516. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
  64517. foreach ($defaults as $default) {
  64518. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  64519. $defaultXML->appendChild($dom->createTextNode($default));
  64520. }
  64521. return $dom;
  64522. }
  64523. private function getInputOptionDocument(InputOption $option): \DOMDocument
  64524. {
  64525. $dom = new \DOMDocument('1.0', 'UTF-8');
  64526. $dom->appendChild($objectXML = $dom->createElement('option'));
  64527. $objectXML->setAttribute('name', '--'.$option->getName());
  64528. $pos = strpos($option->getShortcut() ?? '', '|');
  64529. if (false !== $pos) {
  64530. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  64531. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  64532. } else {
  64533. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  64534. }
  64535. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  64536. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  64537. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  64538. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  64539. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  64540. if ($option->acceptValue()) {
  64541. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
  64542. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  64543. if (!empty($defaults)) {
  64544. foreach ($defaults as $default) {
  64545. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  64546. $defaultXML->appendChild($dom->createTextNode($default));
  64547. }
  64548. }
  64549. }
  64550. if ($option->isNegatable()) {
  64551. $dom->appendChild($objectXML = $dom->createElement('option'));
  64552. $objectXML->setAttribute('name', '--no-'.$option->getName());
  64553. $objectXML->setAttribute('shortcut', '');
  64554. $objectXML->setAttribute('accept_value', 0);
  64555. $objectXML->setAttribute('is_value_required', 0);
  64556. $objectXML->setAttribute('is_multiple', 0);
  64557. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  64558. $descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option'));
  64559. }
  64560. return $dom;
  64561. }
  64562. }
  64563. <?php
  64564. namespace Symfony\Component\Console\Event;
  64565. final class ConsoleCommandEvent extends ConsoleEvent
  64566. {
  64567. public const RETURN_CODE_DISABLED = 113;
  64568. private $commandShouldRun = true;
  64569. public function disableCommand(): bool
  64570. {
  64571. return $this->commandShouldRun = false;
  64572. }
  64573. public function enableCommand(): bool
  64574. {
  64575. return $this->commandShouldRun = true;
  64576. }
  64577. public function commandShouldRun(): bool
  64578. {
  64579. return $this->commandShouldRun;
  64580. }
  64581. }
  64582. <?php
  64583. namespace Symfony\Component\Console\Event;
  64584. use Symfony\Component\Console\Command\Command;
  64585. use Symfony\Component\Console\Input\InputInterface;
  64586. use Symfony\Component\Console\Output\OutputInterface;
  64587. final class ConsoleErrorEvent extends ConsoleEvent
  64588. {
  64589. private $error;
  64590. private $exitCode;
  64591. public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, ?Command $command = null)
  64592. {
  64593. parent::__construct($command, $input, $output);
  64594. $this->error = $error;
  64595. }
  64596. public function getError(): \Throwable
  64597. {
  64598. return $this->error;
  64599. }
  64600. public function setError(\Throwable $error): void
  64601. {
  64602. $this->error = $error;
  64603. }
  64604. public function setExitCode(int $exitCode): void
  64605. {
  64606. $this->exitCode = $exitCode;
  64607. $r = new \ReflectionProperty($this->error, 'code');
  64608. $r->setAccessible(true);
  64609. $r->setValue($this->error, $this->exitCode);
  64610. }
  64611. public function getExitCode(): int
  64612. {
  64613. return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
  64614. }
  64615. }
  64616. <?php
  64617. namespace Symfony\Component\Console\Event;
  64618. use Symfony\Component\Console\Command\Command;
  64619. use Symfony\Component\Console\Input\InputInterface;
  64620. use Symfony\Component\Console\Output\OutputInterface;
  64621. use Symfony\Contracts\EventDispatcher\Event;
  64622. class ConsoleEvent extends Event
  64623. {
  64624. protected $command;
  64625. private $input;
  64626. private $output;
  64627. public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
  64628. {
  64629. $this->command = $command;
  64630. $this->input = $input;
  64631. $this->output = $output;
  64632. }
  64633. public function getCommand()
  64634. {
  64635. return $this->command;
  64636. }
  64637. public function getInput()
  64638. {
  64639. return $this->input;
  64640. }
  64641. public function getOutput()
  64642. {
  64643. return $this->output;
  64644. }
  64645. }
  64646. <?php
  64647. namespace Symfony\Component\Console\Event;
  64648. use Symfony\Component\Console\Command\Command;
  64649. use Symfony\Component\Console\Input\InputInterface;
  64650. use Symfony\Component\Console\Output\OutputInterface;
  64651. final class ConsoleSignalEvent extends ConsoleEvent
  64652. {
  64653. private $handlingSignal;
  64654. public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal)
  64655. {
  64656. parent::__construct($command, $input, $output);
  64657. $this->handlingSignal = $handlingSignal;
  64658. }
  64659. public function getHandlingSignal(): int
  64660. {
  64661. return $this->handlingSignal;
  64662. }
  64663. }
  64664. <?php
  64665. namespace Symfony\Component\Console\Event;
  64666. use Symfony\Component\Console\Command\Command;
  64667. use Symfony\Component\Console\Input\InputInterface;
  64668. use Symfony\Component\Console\Output\OutputInterface;
  64669. final class ConsoleTerminateEvent extends ConsoleEvent
  64670. {
  64671. private $exitCode;
  64672. public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
  64673. {
  64674. parent::__construct($command, $input, $output);
  64675. $this->setExitCode($exitCode);
  64676. }
  64677. public function setExitCode(int $exitCode): void
  64678. {
  64679. $this->exitCode = $exitCode;
  64680. }
  64681. public function getExitCode(): int
  64682. {
  64683. return $this->exitCode;
  64684. }
  64685. }
  64686. <?php
  64687. namespace Symfony\Component\Console\EventListener;
  64688. use Psr\Log\LoggerInterface;
  64689. use Symfony\Component\Console\ConsoleEvents;
  64690. use Symfony\Component\Console\Event\ConsoleErrorEvent;
  64691. use Symfony\Component\Console\Event\ConsoleEvent;
  64692. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  64693. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  64694. class ErrorListener implements EventSubscriberInterface
  64695. {
  64696. private $logger;
  64697. public function __construct(?LoggerInterface $logger = null)
  64698. {
  64699. $this->logger = $logger;
  64700. }
  64701. public function onConsoleError(ConsoleErrorEvent $event)
  64702. {
  64703. if (null === $this->logger) {
  64704. return;
  64705. }
  64706. $error = $event->getError();
  64707. if (!$inputString = $this->getInputString($event)) {
  64708. $this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
  64709. return;
  64710. }
  64711. $this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
  64712. }
  64713. public function onConsoleTerminate(ConsoleTerminateEvent $event)
  64714. {
  64715. if (null === $this->logger) {
  64716. return;
  64717. }
  64718. $exitCode = $event->getExitCode();
  64719. if (0 === $exitCode) {
  64720. return;
  64721. }
  64722. if (!$inputString = $this->getInputString($event)) {
  64723. $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
  64724. return;
  64725. }
  64726. $this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
  64727. }
  64728. public static function getSubscribedEvents()
  64729. {
  64730. return [
  64731. ConsoleEvents::ERROR => ['onConsoleError', -128],
  64732. ConsoleEvents::TERMINATE => ['onConsoleTerminate', -128],
  64733. ];
  64734. }
  64735. private static function getInputString(ConsoleEvent $event): ?string
  64736. {
  64737. $commandName = $event->getCommand() ? $event->getCommand()->getName() : null;
  64738. $input = $event->getInput();
  64739. if (method_exists($input, '__toString')) {
  64740. if ($commandName) {
  64741. return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input);
  64742. }
  64743. return (string) $input;
  64744. }
  64745. return $commandName;
  64746. }
  64747. }
  64748. <?php
  64749. namespace Symfony\Component\Console\Exception;
  64750. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  64751. {
  64752. private $alternatives;
  64753. public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null)
  64754. {
  64755. parent::__construct($message, $code, $previous);
  64756. $this->alternatives = $alternatives;
  64757. }
  64758. public function getAlternatives()
  64759. {
  64760. return $this->alternatives;
  64761. }
  64762. }
  64763. <?php
  64764. namespace Symfony\Component\Console\Exception;
  64765. interface ExceptionInterface extends \Throwable
  64766. {
  64767. }
  64768. <?php
  64769. namespace Symfony\Component\Console\Exception;
  64770. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  64771. {
  64772. }
  64773. <?php
  64774. namespace Symfony\Component\Console\Exception;
  64775. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  64776. {
  64777. }
  64778. <?php
  64779. namespace Symfony\Component\Console\Exception;
  64780. class LogicException extends \LogicException implements ExceptionInterface
  64781. {
  64782. }
  64783. <?php
  64784. namespace Symfony\Component\Console\Exception;
  64785. class MissingInputException extends RuntimeException implements ExceptionInterface
  64786. {
  64787. }
  64788. <?php
  64789. namespace Symfony\Component\Console\Exception;
  64790. class NamespaceNotFoundException extends CommandNotFoundException
  64791. {
  64792. }
  64793. <?php
  64794. namespace Symfony\Component\Console\Exception;
  64795. class RuntimeException extends \RuntimeException implements ExceptionInterface
  64796. {
  64797. }
  64798. <?php
  64799. namespace Symfony\Component\Console\Formatter;
  64800. final class NullOutputFormatter implements OutputFormatterInterface
  64801. {
  64802. private $style;
  64803. public function format(?string $message): ?string
  64804. {
  64805. return null;
  64806. }
  64807. public function getStyle(string $name): OutputFormatterStyleInterface
  64808. {
  64809. return $this->style ?? $this->style = new NullOutputFormatterStyle();
  64810. }
  64811. public function hasStyle(string $name): bool
  64812. {
  64813. return false;
  64814. }
  64815. public function isDecorated(): bool
  64816. {
  64817. return false;
  64818. }
  64819. public function setDecorated(bool $decorated): void
  64820. {
  64821. }
  64822. public function setStyle(string $name, OutputFormatterStyleInterface $style): void
  64823. {
  64824. }
  64825. }
  64826. <?php
  64827. namespace Symfony\Component\Console\Formatter;
  64828. final class NullOutputFormatterStyle implements OutputFormatterStyleInterface
  64829. {
  64830. public function apply(string $text): string
  64831. {
  64832. return $text;
  64833. }
  64834. public function setBackground(?string $color = null): void
  64835. {
  64836. }
  64837. public function setForeground(?string $color = null): void
  64838. {
  64839. }
  64840. public function setOption(string $option): void
  64841. {
  64842. }
  64843. public function setOptions(array $options): void
  64844. {
  64845. }
  64846. public function unsetOption(string $option): void
  64847. {
  64848. }
  64849. }
  64850. <?php
  64851. namespace Symfony\Component\Console\Formatter;
  64852. use Symfony\Component\Console\Exception\InvalidArgumentException;
  64853. use function Symfony\Component\String\b;
  64854. class OutputFormatter implements WrappableOutputFormatterInterface
  64855. {
  64856. private $decorated;
  64857. private $styles = [];
  64858. private $styleStack;
  64859. public function __clone()
  64860. {
  64861. $this->styleStack = clone $this->styleStack;
  64862. foreach ($this->styles as $key => $value) {
  64863. $this->styles[$key] = clone $value;
  64864. }
  64865. }
  64866. public static function escape(string $text)
  64867. {
  64868. $text = preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text);
  64869. return self::escapeTrailingBackslash($text);
  64870. }
  64871. public static function escapeTrailingBackslash(string $text): string
  64872. {
  64873. if (str_ends_with($text, '\\')) {
  64874. $len = \strlen($text);
  64875. $text = rtrim($text, '\\');
  64876. $text = str_replace("\0", '', $text);
  64877. $text .= str_repeat("\0", $len - \strlen($text));
  64878. }
  64879. return $text;
  64880. }
  64881. public function __construct(bool $decorated = false, array $styles = [])
  64882. {
  64883. $this->decorated = $decorated;
  64884. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  64885. $this->setStyle('info', new OutputFormatterStyle('green'));
  64886. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  64887. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  64888. foreach ($styles as $name => $style) {
  64889. $this->setStyle($name, $style);
  64890. }
  64891. $this->styleStack = new OutputFormatterStyleStack();
  64892. }
  64893. public function setDecorated(bool $decorated)
  64894. {
  64895. $this->decorated = $decorated;
  64896. }
  64897. public function isDecorated()
  64898. {
  64899. return $this->decorated;
  64900. }
  64901. public function setStyle(string $name, OutputFormatterStyleInterface $style)
  64902. {
  64903. $this->styles[strtolower($name)] = $style;
  64904. }
  64905. public function hasStyle(string $name)
  64906. {
  64907. return isset($this->styles[strtolower($name)]);
  64908. }
  64909. public function getStyle(string $name)
  64910. {
  64911. if (!$this->hasStyle($name)) {
  64912. throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
  64913. }
  64914. return $this->styles[strtolower($name)];
  64915. }
  64916. public function format(?string $message)
  64917. {
  64918. return $this->formatAndWrap($message, 0);
  64919. }
  64920. public function formatAndWrap(?string $message, int $width)
  64921. {
  64922. if (null === $message) {
  64923. return '';
  64924. }
  64925. $offset = 0;
  64926. $output = '';
  64927. $openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
  64928. $closeTagRegex = '[a-z][^<>]*+';
  64929. $currentLineLength = 0;
  64930. preg_match_all("#<(($openTagRegex) | /($closeTagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
  64931. foreach ($matches[0] as $i => $match) {
  64932. $pos = $match[1];
  64933. $text = $match[0];
  64934. if (0 != $pos && '\\' == $message[$pos - 1]) {
  64935. continue;
  64936. }
  64937. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset), $output, $width, $currentLineLength);
  64938. $offset = $pos + \strlen($text);
  64939. if ($open = '/' != $text[1]) {
  64940. $tag = $matches[1][$i][0];
  64941. } else {
  64942. $tag = $matches[3][$i][0] ?? '';
  64943. }
  64944. if (!$open && !$tag) {
  64945. $this->styleStack->pop();
  64946. } elseif (null === $style = $this->createStyleFromString($tag)) {
  64947. $output .= $this->applyCurrentStyle($text, $output, $width, $currentLineLength);
  64948. } elseif ($open) {
  64949. $this->styleStack->push($style);
  64950. } else {
  64951. $this->styleStack->pop($style);
  64952. }
  64953. }
  64954. $output .= $this->applyCurrentStyle(substr($message, $offset), $output, $width, $currentLineLength);
  64955. return strtr($output, ["\0" => '\\', '\\<' => '<', '\\>' => '>']);
  64956. }
  64957. public function getStyleStack()
  64958. {
  64959. return $this->styleStack;
  64960. }
  64961. private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
  64962. {
  64963. if (isset($this->styles[$string])) {
  64964. return $this->styles[$string];
  64965. }
  64966. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
  64967. return null;
  64968. }
  64969. $style = new OutputFormatterStyle();
  64970. foreach ($matches as $match) {
  64971. array_shift($match);
  64972. $match[0] = strtolower($match[0]);
  64973. if ('fg' == $match[0]) {
  64974. $style->setForeground(strtolower($match[1]));
  64975. } elseif ('bg' == $match[0]) {
  64976. $style->setBackground(strtolower($match[1]));
  64977. } elseif ('href' === $match[0]) {
  64978. $url = preg_replace('{\\\\([<>])}', '$1', $match[1]);
  64979. $style->setHref($url);
  64980. } elseif ('options' === $match[0]) {
  64981. preg_match_all('([^,;]+)', strtolower($match[1]), $options);
  64982. $options = array_shift($options);
  64983. foreach ($options as $option) {
  64984. $style->setOption($option);
  64985. }
  64986. } else {
  64987. return null;
  64988. }
  64989. }
  64990. return $style;
  64991. }
  64992. private function applyCurrentStyle(string $text, string $current, int $width, int &$currentLineLength): string
  64993. {
  64994. if ('' === $text) {
  64995. return '';
  64996. }
  64997. if (!$width) {
  64998. return $this->isDecorated() ? $this->styleStack->getCurrent()->apply($text) : $text;
  64999. }
  65000. if (!$currentLineLength && '' !== $current) {
  65001. $text = ltrim($text);
  65002. }
  65003. if ($currentLineLength) {
  65004. $prefix = substr($text, 0, $i = $width - $currentLineLength)."\n";
  65005. $text = substr($text, $i);
  65006. } else {
  65007. $prefix = '';
  65008. }
  65009. preg_match('~(\\n)$~', $text, $matches);
  65010. $text = $prefix.$this->addLineBreaks($text, $width);
  65011. $text = rtrim($text, "\n").($matches[1] ?? '');
  65012. if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) {
  65013. $text = "\n".$text;
  65014. }
  65015. $lines = explode("\n", $text);
  65016. foreach ($lines as $line) {
  65017. $currentLineLength += \strlen($line);
  65018. if ($width <= $currentLineLength) {
  65019. $currentLineLength = 0;
  65020. }
  65021. }
  65022. if ($this->isDecorated()) {
  65023. foreach ($lines as $i => $line) {
  65024. $lines[$i] = $this->styleStack->getCurrent()->apply($line);
  65025. }
  65026. }
  65027. return implode("\n", $lines);
  65028. }
  65029. private function addLineBreaks(string $text, int $width): string
  65030. {
  65031. $encoding = mb_detect_encoding($text, null, true) ?: 'UTF-8';
  65032. return b($text)->toCodePointString($encoding)->wordwrap($width, "\n", true)->toByteString($encoding);
  65033. }
  65034. }
  65035. <?php
  65036. namespace Symfony\Component\Console\Formatter;
  65037. interface OutputFormatterInterface
  65038. {
  65039. public function setDecorated(bool $decorated);
  65040. public function isDecorated();
  65041. public function setStyle(string $name, OutputFormatterStyleInterface $style);
  65042. public function hasStyle(string $name);
  65043. public function getStyle(string $name);
  65044. public function format(?string $message);
  65045. }
  65046. <?php
  65047. namespace Symfony\Component\Console\Formatter;
  65048. use Symfony\Component\Console\Color;
  65049. class OutputFormatterStyle implements OutputFormatterStyleInterface
  65050. {
  65051. private $color;
  65052. private $foreground;
  65053. private $background;
  65054. private $options;
  65055. private $href;
  65056. private $handlesHrefGracefully;
  65057. public function __construct(?string $foreground = null, ?string $background = null, array $options = [])
  65058. {
  65059. $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
  65060. }
  65061. public function setForeground(?string $color = null)
  65062. {
  65063. $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
  65064. }
  65065. public function setBackground(?string $color = null)
  65066. {
  65067. $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
  65068. }
  65069. public function setHref(string $url): void
  65070. {
  65071. $this->href = $url;
  65072. }
  65073. public function setOption(string $option)
  65074. {
  65075. $this->options[] = $option;
  65076. $this->color = new Color($this->foreground, $this->background, $this->options);
  65077. }
  65078. public function unsetOption(string $option)
  65079. {
  65080. $pos = array_search($option, $this->options);
  65081. if (false !== $pos) {
  65082. unset($this->options[$pos]);
  65083. }
  65084. $this->color = new Color($this->foreground, $this->background, $this->options);
  65085. }
  65086. public function setOptions(array $options)
  65087. {
  65088. $this->color = new Color($this->foreground, $this->background, $this->options = $options);
  65089. }
  65090. public function apply(string $text)
  65091. {
  65092. if (null === $this->handlesHrefGracefully) {
  65093. $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
  65094. && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100)
  65095. && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']);
  65096. }
  65097. if (null !== $this->href && $this->handlesHrefGracefully) {
  65098. $text = "\033]8;;$this->href\033\\$text\033]8;;\033\\";
  65099. }
  65100. return $this->color->apply($text);
  65101. }
  65102. }
  65103. <?php
  65104. namespace Symfony\Component\Console\Formatter;
  65105. interface OutputFormatterStyleInterface
  65106. {
  65107. public function setForeground(?string $color = null);
  65108. public function setBackground(?string $color = null);
  65109. public function setOption(string $option);
  65110. public function unsetOption(string $option);
  65111. public function setOptions(array $options);
  65112. public function apply(string $text);
  65113. }
  65114. <?php
  65115. namespace Symfony\Component\Console\Formatter;
  65116. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65117. use Symfony\Contracts\Service\ResetInterface;
  65118. class OutputFormatterStyleStack implements ResetInterface
  65119. {
  65120. private $styles;
  65121. private $emptyStyle;
  65122. public function __construct(?OutputFormatterStyleInterface $emptyStyle = null)
  65123. {
  65124. $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
  65125. $this->reset();
  65126. }
  65127. public function reset()
  65128. {
  65129. $this->styles = [];
  65130. }
  65131. public function push(OutputFormatterStyleInterface $style)
  65132. {
  65133. $this->styles[] = $style;
  65134. }
  65135. public function pop(?OutputFormatterStyleInterface $style = null)
  65136. {
  65137. if (empty($this->styles)) {
  65138. return $this->emptyStyle;
  65139. }
  65140. if (null === $style) {
  65141. return array_pop($this->styles);
  65142. }
  65143. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  65144. if ($style->apply('') === $stackedStyle->apply('')) {
  65145. $this->styles = \array_slice($this->styles, 0, $index);
  65146. return $stackedStyle;
  65147. }
  65148. }
  65149. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  65150. }
  65151. public function getCurrent()
  65152. {
  65153. if (empty($this->styles)) {
  65154. return $this->emptyStyle;
  65155. }
  65156. return $this->styles[\count($this->styles) - 1];
  65157. }
  65158. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  65159. {
  65160. $this->emptyStyle = $emptyStyle;
  65161. return $this;
  65162. }
  65163. public function getEmptyStyle()
  65164. {
  65165. return $this->emptyStyle;
  65166. }
  65167. }
  65168. <?php
  65169. namespace Symfony\Component\Console\Formatter;
  65170. interface WrappableOutputFormatterInterface extends OutputFormatterInterface
  65171. {
  65172. public function formatAndWrap(?string $message, int $width);
  65173. }
  65174. <?php
  65175. namespace Symfony\Component\Console\Helper;
  65176. class DebugFormatterHelper extends Helper
  65177. {
  65178. private const COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];
  65179. private $started = [];
  65180. private $count = -1;
  65181. public function start(string $id, string $message, string $prefix = 'RUN')
  65182. {
  65183. $this->started[$id] = ['border' => ++$this->count % \count(self::COLORS)];
  65184. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  65185. }
  65186. public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR')
  65187. {
  65188. $message = '';
  65189. if ($error) {
  65190. if (isset($this->started[$id]['out'])) {
  65191. $message .= "\n";
  65192. unset($this->started[$id]['out']);
  65193. }
  65194. if (!isset($this->started[$id]['err'])) {
  65195. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  65196. $this->started[$id]['err'] = true;
  65197. }
  65198. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  65199. } else {
  65200. if (isset($this->started[$id]['err'])) {
  65201. $message .= "\n";
  65202. unset($this->started[$id]['err']);
  65203. }
  65204. if (!isset($this->started[$id]['out'])) {
  65205. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  65206. $this->started[$id]['out'] = true;
  65207. }
  65208. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  65209. }
  65210. return $message;
  65211. }
  65212. public function stop(string $id, string $message, bool $successful, string $prefix = 'RES')
  65213. {
  65214. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  65215. if ($successful) {
  65216. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  65217. }
  65218. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  65219. unset($this->started[$id]['out'], $this->started[$id]['err']);
  65220. return $message;
  65221. }
  65222. private function getBorder(string $id): string
  65223. {
  65224. return sprintf('<bg=%s> </>', self::COLORS[$this->started[$id]['border']]);
  65225. }
  65226. public function getName()
  65227. {
  65228. return 'debug_formatter';
  65229. }
  65230. }
  65231. <?php
  65232. namespace Symfony\Component\Console\Helper;
  65233. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  65234. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  65235. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  65236. use Symfony\Component\Console\Descriptor\TextDescriptor;
  65237. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  65238. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65239. use Symfony\Component\Console\Output\OutputInterface;
  65240. class DescriptorHelper extends Helper
  65241. {
  65242. private $descriptors = [];
  65243. public function __construct()
  65244. {
  65245. $this
  65246. ->register('txt', new TextDescriptor())
  65247. ->register('xml', new XmlDescriptor())
  65248. ->register('json', new JsonDescriptor())
  65249. ->register('md', new MarkdownDescriptor())
  65250. ;
  65251. }
  65252. public function describe(OutputInterface $output, ?object $object, array $options = [])
  65253. {
  65254. $options = array_merge([
  65255. 'raw_text' => false,
  65256. 'format' => 'txt',
  65257. ], $options);
  65258. if (!isset($this->descriptors[$options['format']])) {
  65259. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  65260. }
  65261. $descriptor = $this->descriptors[$options['format']];
  65262. $descriptor->describe($output, $object, $options);
  65263. }
  65264. public function register(string $format, DescriptorInterface $descriptor)
  65265. {
  65266. $this->descriptors[$format] = $descriptor;
  65267. return $this;
  65268. }
  65269. public function getName()
  65270. {
  65271. return 'descriptor';
  65272. }
  65273. public function getFormats(): array
  65274. {
  65275. return array_keys($this->descriptors);
  65276. }
  65277. }
  65278. <?php
  65279. namespace Symfony\Component\Console\Helper;
  65280. use Symfony\Component\Console\Output\OutputInterface;
  65281. use Symfony\Component\VarDumper\Cloner\ClonerInterface;
  65282. use Symfony\Component\VarDumper\Cloner\VarCloner;
  65283. use Symfony\Component\VarDumper\Dumper\CliDumper;
  65284. final class Dumper
  65285. {
  65286. private $output;
  65287. private $dumper;
  65288. private $cloner;
  65289. private $handler;
  65290. public function __construct(OutputInterface $output, ?CliDumper $dumper = null, ?ClonerInterface $cloner = null)
  65291. {
  65292. $this->output = $output;
  65293. $this->dumper = $dumper;
  65294. $this->cloner = $cloner;
  65295. if (class_exists(CliDumper::class)) {
  65296. $this->handler = function ($var): string {
  65297. $dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
  65298. $dumper->setColors($this->output->isDecorated());
  65299. return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
  65300. };
  65301. } else {
  65302. $this->handler = function ($var): string {
  65303. switch (true) {
  65304. case null === $var:
  65305. return 'null';
  65306. case true === $var:
  65307. return 'true';
  65308. case false === $var:
  65309. return 'false';
  65310. case \is_string($var):
  65311. return '"'.$var.'"';
  65312. default:
  65313. return rtrim(print_r($var, true));
  65314. }
  65315. };
  65316. }
  65317. }
  65318. public function __invoke($var): string
  65319. {
  65320. return ($this->handler)($var);
  65321. }
  65322. }
  65323. <?php
  65324. namespace Symfony\Component\Console\Helper;
  65325. use Symfony\Component\Console\Formatter\OutputFormatter;
  65326. class FormatterHelper extends Helper
  65327. {
  65328. public function formatSection(string $section, string $message, string $style = 'info')
  65329. {
  65330. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  65331. }
  65332. public function formatBlock($messages, string $style, bool $large = false)
  65333. {
  65334. if (!\is_array($messages)) {
  65335. $messages = [$messages];
  65336. }
  65337. $len = 0;
  65338. $lines = [];
  65339. foreach ($messages as $message) {
  65340. $message = OutputFormatter::escape($message);
  65341. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  65342. $len = max(self::width($message) + ($large ? 4 : 2), $len);
  65343. }
  65344. $messages = $large ? [str_repeat(' ', $len)] : [];
  65345. for ($i = 0; isset($lines[$i]); ++$i) {
  65346. $messages[] = $lines[$i].str_repeat(' ', $len - self::width($lines[$i]));
  65347. }
  65348. if ($large) {
  65349. $messages[] = str_repeat(' ', $len);
  65350. }
  65351. for ($i = 0; isset($messages[$i]); ++$i) {
  65352. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  65353. }
  65354. return implode("\n", $messages);
  65355. }
  65356. public function truncate(string $message, int $length, string $suffix = '...')
  65357. {
  65358. $computedLength = $length - self::width($suffix);
  65359. if ($computedLength > self::width($message)) {
  65360. return $message;
  65361. }
  65362. return self::substr($message, 0, $length).$suffix;
  65363. }
  65364. public function getName()
  65365. {
  65366. return 'formatter';
  65367. }
  65368. }
  65369. <?php
  65370. namespace Symfony\Component\Console\Helper;
  65371. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  65372. use Symfony\Component\String\UnicodeString;
  65373. abstract class Helper implements HelperInterface
  65374. {
  65375. protected $helperSet = null;
  65376. public function setHelperSet(?HelperSet $helperSet = null)
  65377. {
  65378. $this->helperSet = $helperSet;
  65379. }
  65380. public function getHelperSet()
  65381. {
  65382. return $this->helperSet;
  65383. }
  65384. public static function strlen(?string $string)
  65385. {
  65386. trigger_deprecation('symfony/console', '5.3', 'Method "%s()" is deprecated and will be removed in Symfony 6.0. Use Helper::width() or Helper::length() instead.', __METHOD__);
  65387. return self::width($string);
  65388. }
  65389. public static function width(?string $string): int
  65390. {
  65391. $string ?? $string = '';
  65392. if (preg_match('//u', $string)) {
  65393. return (new UnicodeString($string))->width(false);
  65394. }
  65395. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  65396. return \strlen($string);
  65397. }
  65398. return mb_strwidth($string, $encoding);
  65399. }
  65400. public static function length(?string $string): int
  65401. {
  65402. $string ?? $string = '';
  65403. if (preg_match('//u', $string)) {
  65404. return (new UnicodeString($string))->length();
  65405. }
  65406. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  65407. return \strlen($string);
  65408. }
  65409. return mb_strlen($string, $encoding);
  65410. }
  65411. public static function substr(?string $string, int $from, ?int $length = null)
  65412. {
  65413. $string ?? $string = '';
  65414. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  65415. return substr($string, $from, $length);
  65416. }
  65417. return mb_substr($string, $from, $length, $encoding);
  65418. }
  65419. public static function formatTime($secs)
  65420. {
  65421. static $timeFormats = [
  65422. [0, '< 1 sec'],
  65423. [1, '1 sec'],
  65424. [2, 'secs', 1],
  65425. [60, '1 min'],
  65426. [120, 'mins', 60],
  65427. [3600, '1 hr'],
  65428. [7200, 'hrs', 3600],
  65429. [86400, '1 day'],
  65430. [172800, 'days', 86400],
  65431. ];
  65432. foreach ($timeFormats as $index => $format) {
  65433. if ($secs >= $format[0]) {
  65434. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  65435. || $index == \count($timeFormats) - 1
  65436. ) {
  65437. if (2 == \count($format)) {
  65438. return $format[1];
  65439. }
  65440. return floor($secs / $format[2]).' '.$format[1];
  65441. }
  65442. }
  65443. }
  65444. }
  65445. public static function formatMemory(int $memory)
  65446. {
  65447. if ($memory >= 1024 * 1024 * 1024) {
  65448. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  65449. }
  65450. if ($memory >= 1024 * 1024) {
  65451. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  65452. }
  65453. if ($memory >= 1024) {
  65454. return sprintf('%d KiB', $memory / 1024);
  65455. }
  65456. return sprintf('%d B', $memory);
  65457. }
  65458. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, ?string $string)
  65459. {
  65460. trigger_deprecation('symfony/console', '5.3', 'Method "%s()" is deprecated and will be removed in Symfony 6.0. Use Helper::removeDecoration() instead.', __METHOD__);
  65461. return self::width(self::removeDecoration($formatter, $string));
  65462. }
  65463. public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string)
  65464. {
  65465. $isDecorated = $formatter->isDecorated();
  65466. $formatter->setDecorated(false);
  65467. $string = $formatter->format($string ?? '');
  65468. $string = preg_replace("/\033\[[^m]*m/", '', $string ?? '');
  65469. $string = preg_replace('/\\033]8;[^;]*;[^\\033]*\\033\\\\/', '', $string ?? '');
  65470. $formatter->setDecorated($isDecorated);
  65471. return $string;
  65472. }
  65473. }
  65474. <?php
  65475. namespace Symfony\Component\Console\Helper;
  65476. interface HelperInterface
  65477. {
  65478. public function setHelperSet(?HelperSet $helperSet = null);
  65479. public function getHelperSet();
  65480. public function getName();
  65481. }
  65482. <?php
  65483. namespace Symfony\Component\Console\Helper;
  65484. use Symfony\Component\Console\Command\Command;
  65485. use Symfony\Component\Console\Exception\InvalidArgumentException;
  65486. class HelperSet implements \IteratorAggregate
  65487. {
  65488. private $helpers = [];
  65489. private $command;
  65490. public function __construct(array $helpers = [])
  65491. {
  65492. foreach ($helpers as $alias => $helper) {
  65493. $this->set($helper, \is_int($alias) ? null : $alias);
  65494. }
  65495. }
  65496. public function set(HelperInterface $helper, ?string $alias = null)
  65497. {
  65498. $this->helpers[$helper->getName()] = $helper;
  65499. if (null !== $alias) {
  65500. $this->helpers[$alias] = $helper;
  65501. }
  65502. $helper->setHelperSet($this);
  65503. }
  65504. public function has(string $name)
  65505. {
  65506. return isset($this->helpers[$name]);
  65507. }
  65508. public function get(string $name)
  65509. {
  65510. if (!$this->has($name)) {
  65511. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  65512. }
  65513. return $this->helpers[$name];
  65514. }
  65515. public function setCommand(?Command $command = null)
  65516. {
  65517. trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
  65518. $this->command = $command;
  65519. }
  65520. public function getCommand()
  65521. {
  65522. trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
  65523. return $this->command;
  65524. }
  65525. #[\ReturnTypeWillChange]
  65526. public function getIterator()
  65527. {
  65528. return new \ArrayIterator($this->helpers);
  65529. }
  65530. }
  65531. <?php
  65532. namespace Symfony\Component\Console\Helper;
  65533. use Symfony\Component\Console\Input\InputAwareInterface;
  65534. use Symfony\Component\Console\Input\InputInterface;
  65535. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  65536. {
  65537. protected $input;
  65538. public function setInput(InputInterface $input)
  65539. {
  65540. $this->input = $input;
  65541. }
  65542. }
  65543. <?php
  65544. namespace Symfony\Component\Console\Helper;
  65545. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  65546. use Symfony\Component\Console\Output\OutputInterface;
  65547. use Symfony\Component\Process\Exception\ProcessFailedException;
  65548. use Symfony\Component\Process\Process;
  65549. class ProcessHelper extends Helper
  65550. {
  65551. public function run(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process
  65552. {
  65553. if (!class_exists(Process::class)) {
  65554. throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
  65555. }
  65556. if ($output instanceof ConsoleOutputInterface) {
  65557. $output = $output->getErrorOutput();
  65558. }
  65559. $formatter = $this->getHelperSet()->get('debug_formatter');
  65560. if ($cmd instanceof Process) {
  65561. $cmd = [$cmd];
  65562. }
  65563. if (!\is_array($cmd)) {
  65564. throw new \TypeError(sprintf('The "command" argument of "%s()" must be an array or a "%s" instance, "%s" given.', __METHOD__, Process::class, get_debug_type($cmd)));
  65565. }
  65566. if (\is_string($cmd[0] ?? null)) {
  65567. $process = new Process($cmd);
  65568. $cmd = [];
  65569. } elseif (($cmd[0] ?? null) instanceof Process) {
  65570. $process = $cmd[0];
  65571. unset($cmd[0]);
  65572. } else {
  65573. throw new \InvalidArgumentException(sprintf('Invalid command provided to "%s()": the command should be an array whose first element is either the path to the binary to run or a "Process" object.', __METHOD__));
  65574. }
  65575. if ($verbosity <= $output->getVerbosity()) {
  65576. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  65577. }
  65578. if ($output->isDebug()) {
  65579. $callback = $this->wrapCallback($output, $process, $callback);
  65580. }
  65581. $process->run($callback, $cmd);
  65582. if ($verbosity <= $output->getVerbosity()) {
  65583. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  65584. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  65585. }
  65586. if (!$process->isSuccessful() && null !== $error) {
  65587. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  65588. }
  65589. return $process;
  65590. }
  65591. public function mustRun(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null): Process
  65592. {
  65593. $process = $this->run($output, $cmd, $error, $callback);
  65594. if (!$process->isSuccessful()) {
  65595. throw new ProcessFailedException($process);
  65596. }
  65597. return $process;
  65598. }
  65599. public function wrapCallback(OutputInterface $output, Process $process, ?callable $callback = null): callable
  65600. {
  65601. if ($output instanceof ConsoleOutputInterface) {
  65602. $output = $output->getErrorOutput();
  65603. }
  65604. $formatter = $this->getHelperSet()->get('debug_formatter');
  65605. return function ($type, $buffer) use ($output, $process, $callback, $formatter) {
  65606. $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));
  65607. if (null !== $callback) {
  65608. $callback($type, $buffer);
  65609. }
  65610. };
  65611. }
  65612. private function escapeString(string $str): string
  65613. {
  65614. return str_replace('<', '\\<', $str);
  65615. }
  65616. public function getName(): string
  65617. {
  65618. return 'process';
  65619. }
  65620. }
  65621. <?php
  65622. namespace Symfony\Component\Console\Helper;
  65623. use Symfony\Component\Console\Cursor;
  65624. use Symfony\Component\Console\Exception\LogicException;
  65625. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  65626. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  65627. use Symfony\Component\Console\Output\OutputInterface;
  65628. use Symfony\Component\Console\Terminal;
  65629. final class ProgressBar
  65630. {
  65631. public const FORMAT_VERBOSE = 'verbose';
  65632. public const FORMAT_VERY_VERBOSE = 'very_verbose';
  65633. public const FORMAT_DEBUG = 'debug';
  65634. public const FORMAT_NORMAL = 'normal';
  65635. private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax';
  65636. private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax';
  65637. private const FORMAT_DEBUG_NOMAX = 'debug_nomax';
  65638. private const FORMAT_NORMAL_NOMAX = 'normal_nomax';
  65639. private $barWidth = 28;
  65640. private $barChar;
  65641. private $emptyBarChar = '-';
  65642. private $progressChar = '>';
  65643. private $format;
  65644. private $internalFormat;
  65645. private $redrawFreq = 1;
  65646. private $writeCount;
  65647. private $lastWriteTime;
  65648. private $minSecondsBetweenRedraws = 0;
  65649. private $maxSecondsBetweenRedraws = 1;
  65650. private $output;
  65651. private $step = 0;
  65652. private $max;
  65653. private $startTime;
  65654. private $stepWidth;
  65655. private $percent = 0.0;
  65656. private $messages = [];
  65657. private $overwrite = true;
  65658. private $terminal;
  65659. private $previousMessage;
  65660. private $cursor;
  65661. private static $formatters;
  65662. private static $formats;
  65663. public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25)
  65664. {
  65665. if ($output instanceof ConsoleOutputInterface) {
  65666. $output = $output->getErrorOutput();
  65667. }
  65668. $this->output = $output;
  65669. $this->setMaxSteps($max);
  65670. $this->terminal = new Terminal();
  65671. if (0 < $minSecondsBetweenRedraws) {
  65672. $this->redrawFreq = null;
  65673. $this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws;
  65674. }
  65675. if (!$this->output->isDecorated()) {
  65676. $this->overwrite = false;
  65677. $this->redrawFreq = null;
  65678. }
  65679. $this->startTime = time();
  65680. $this->cursor = new Cursor($output);
  65681. }
  65682. public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void
  65683. {
  65684. if (!self::$formatters) {
  65685. self::$formatters = self::initPlaceholderFormatters();
  65686. }
  65687. self::$formatters[$name] = $callable;
  65688. }
  65689. public static function getPlaceholderFormatterDefinition(string $name): ?callable
  65690. {
  65691. if (!self::$formatters) {
  65692. self::$formatters = self::initPlaceholderFormatters();
  65693. }
  65694. return self::$formatters[$name] ?? null;
  65695. }
  65696. public static function setFormatDefinition(string $name, string $format): void
  65697. {
  65698. if (!self::$formats) {
  65699. self::$formats = self::initFormats();
  65700. }
  65701. self::$formats[$name] = $format;
  65702. }
  65703. public static function getFormatDefinition(string $name): ?string
  65704. {
  65705. if (!self::$formats) {
  65706. self::$formats = self::initFormats();
  65707. }
  65708. return self::$formats[$name] ?? null;
  65709. }
  65710. public function setMessage(string $message, string $name = 'message')
  65711. {
  65712. $this->messages[$name] = $message;
  65713. }
  65714. public function getMessage(string $name = 'message')
  65715. {
  65716. return $this->messages[$name] ?? null;
  65717. }
  65718. public function getStartTime(): int
  65719. {
  65720. return $this->startTime;
  65721. }
  65722. public function getMaxSteps(): int
  65723. {
  65724. return $this->max;
  65725. }
  65726. public function getProgress(): int
  65727. {
  65728. return $this->step;
  65729. }
  65730. private function getStepWidth(): int
  65731. {
  65732. return $this->stepWidth;
  65733. }
  65734. public function getProgressPercent(): float
  65735. {
  65736. return $this->percent;
  65737. }
  65738. public function getBarOffset(): float
  65739. {
  65740. return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
  65741. }
  65742. public function getEstimated(): float
  65743. {
  65744. if (!$this->step) {
  65745. return 0;
  65746. }
  65747. return round((time() - $this->startTime) / $this->step * $this->max);
  65748. }
  65749. public function getRemaining(): float
  65750. {
  65751. if (!$this->step) {
  65752. return 0;
  65753. }
  65754. return round((time() - $this->startTime) / $this->step * ($this->max - $this->step));
  65755. }
  65756. public function setBarWidth(int $size)
  65757. {
  65758. $this->barWidth = max(1, $size);
  65759. }
  65760. public function getBarWidth(): int
  65761. {
  65762. return $this->barWidth;
  65763. }
  65764. public function setBarCharacter(string $char)
  65765. {
  65766. $this->barChar = $char;
  65767. }
  65768. public function getBarCharacter(): string
  65769. {
  65770. return $this->barChar ?? ($this->max ? '=' : $this->emptyBarChar);
  65771. }
  65772. public function setEmptyBarCharacter(string $char)
  65773. {
  65774. $this->emptyBarChar = $char;
  65775. }
  65776. public function getEmptyBarCharacter(): string
  65777. {
  65778. return $this->emptyBarChar;
  65779. }
  65780. public function setProgressCharacter(string $char)
  65781. {
  65782. $this->progressChar = $char;
  65783. }
  65784. public function getProgressCharacter(): string
  65785. {
  65786. return $this->progressChar;
  65787. }
  65788. public function setFormat(string $format)
  65789. {
  65790. $this->format = null;
  65791. $this->internalFormat = $format;
  65792. }
  65793. public function setRedrawFrequency(?int $freq)
  65794. {
  65795. $this->redrawFreq = null !== $freq ? max(1, $freq) : null;
  65796. }
  65797. public function minSecondsBetweenRedraws(float $seconds): void
  65798. {
  65799. $this->minSecondsBetweenRedraws = $seconds;
  65800. }
  65801. public function maxSecondsBetweenRedraws(float $seconds): void
  65802. {
  65803. $this->maxSecondsBetweenRedraws = $seconds;
  65804. }
  65805. public function iterate(iterable $iterable, ?int $max = null): iterable
  65806. {
  65807. $this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));
  65808. foreach ($iterable as $key => $value) {
  65809. yield $key => $value;
  65810. $this->advance();
  65811. }
  65812. $this->finish();
  65813. }
  65814. public function start(?int $max = null)
  65815. {
  65816. $this->startTime = time();
  65817. $this->step = 0;
  65818. $this->percent = 0.0;
  65819. if (null !== $max) {
  65820. $this->setMaxSteps($max);
  65821. }
  65822. $this->display();
  65823. }
  65824. public function advance(int $step = 1)
  65825. {
  65826. $this->setProgress($this->step + $step);
  65827. }
  65828. public function setOverwrite(bool $overwrite)
  65829. {
  65830. $this->overwrite = $overwrite;
  65831. }
  65832. public function setProgress(int $step)
  65833. {
  65834. if ($this->max && $step > $this->max) {
  65835. $this->max = $step;
  65836. } elseif ($step < 0) {
  65837. $step = 0;
  65838. }
  65839. $redrawFreq = $this->redrawFreq ?? (($this->max ?: 10) / 10);
  65840. $prevPeriod = (int) ($this->step / $redrawFreq);
  65841. $currPeriod = (int) ($step / $redrawFreq);
  65842. $this->step = $step;
  65843. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  65844. $timeInterval = microtime(true) - $this->lastWriteTime;
  65845. if ($this->max === $step) {
  65846. $this->display();
  65847. return;
  65848. }
  65849. if ($timeInterval < $this->minSecondsBetweenRedraws) {
  65850. return;
  65851. }
  65852. if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) {
  65853. $this->display();
  65854. }
  65855. }
  65856. public function setMaxSteps(int $max)
  65857. {
  65858. $this->format = null;
  65859. $this->max = max(0, $max);
  65860. $this->stepWidth = $this->max ? Helper::width((string) $this->max) : 4;
  65861. }
  65862. public function finish(): void
  65863. {
  65864. if (!$this->max) {
  65865. $this->max = $this->step;
  65866. }
  65867. if ($this->step === $this->max && !$this->overwrite) {
  65868. return;
  65869. }
  65870. $this->setProgress($this->max);
  65871. }
  65872. public function display(): void
  65873. {
  65874. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  65875. return;
  65876. }
  65877. if (null === $this->format) {
  65878. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  65879. }
  65880. $this->overwrite($this->buildLine());
  65881. }
  65882. public function clear(): void
  65883. {
  65884. if (!$this->overwrite) {
  65885. return;
  65886. }
  65887. if (null === $this->format) {
  65888. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  65889. }
  65890. $this->overwrite('');
  65891. }
  65892. private function setRealFormat(string $format)
  65893. {
  65894. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  65895. $this->format = self::getFormatDefinition($format.'_nomax');
  65896. } elseif (null !== self::getFormatDefinition($format)) {
  65897. $this->format = self::getFormatDefinition($format);
  65898. } else {
  65899. $this->format = $format;
  65900. }
  65901. }
  65902. private function overwrite(string $message): void
  65903. {
  65904. if ($this->previousMessage === $message) {
  65905. return;
  65906. }
  65907. $originalMessage = $message;
  65908. if ($this->overwrite) {
  65909. if (null !== $this->previousMessage) {
  65910. if ($this->output instanceof ConsoleSectionOutput) {
  65911. $messageLines = explode("\n", $this->previousMessage);
  65912. $lineCount = \count($messageLines);
  65913. foreach ($messageLines as $messageLine) {
  65914. $messageLineLength = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $messageLine));
  65915. if ($messageLineLength > $this->terminal->getWidth()) {
  65916. $lineCount += floor($messageLineLength / $this->terminal->getWidth());
  65917. }
  65918. }
  65919. $this->output->clear($lineCount);
  65920. } else {
  65921. $lineCount = substr_count($this->previousMessage, "\n");
  65922. for ($i = 0; $i < $lineCount; ++$i) {
  65923. $this->cursor->moveToColumn(1);
  65924. $this->cursor->clearLine();
  65925. $this->cursor->moveUp();
  65926. }
  65927. $this->cursor->moveToColumn(1);
  65928. $this->cursor->clearLine();
  65929. }
  65930. }
  65931. } elseif ($this->step > 0) {
  65932. $message = \PHP_EOL.$message;
  65933. }
  65934. $this->previousMessage = $originalMessage;
  65935. $this->lastWriteTime = microtime(true);
  65936. $this->output->write($message);
  65937. ++$this->writeCount;
  65938. }
  65939. private function determineBestFormat(): string
  65940. {
  65941. switch ($this->output->getVerbosity()) {
  65942. case OutputInterface::VERBOSITY_VERBOSE:
  65943. return $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX;
  65944. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  65945. return $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX;
  65946. case OutputInterface::VERBOSITY_DEBUG:
  65947. return $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX;
  65948. default:
  65949. return $this->max ? self::FORMAT_NORMAL : self::FORMAT_NORMAL_NOMAX;
  65950. }
  65951. }
  65952. private static function initPlaceholderFormatters(): array
  65953. {
  65954. return [
  65955. 'bar' => function (self $bar, OutputInterface $output) {
  65956. $completeBars = $bar->getBarOffset();
  65957. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  65958. if ($completeBars < $bar->getBarWidth()) {
  65959. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter()));
  65960. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  65961. }
  65962. return $display;
  65963. },
  65964. 'elapsed' => function (self $bar) {
  65965. return Helper::formatTime(time() - $bar->getStartTime());
  65966. },
  65967. 'remaining' => function (self $bar) {
  65968. if (!$bar->getMaxSteps()) {
  65969. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  65970. }
  65971. return Helper::formatTime($bar->getRemaining());
  65972. },
  65973. 'estimated' => function (self $bar) {
  65974. if (!$bar->getMaxSteps()) {
  65975. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  65976. }
  65977. return Helper::formatTime($bar->getEstimated());
  65978. },
  65979. 'memory' => function (self $bar) {
  65980. return Helper::formatMemory(memory_get_usage(true));
  65981. },
  65982. 'current' => function (self $bar) {
  65983. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
  65984. },
  65985. 'max' => function (self $bar) {
  65986. return $bar->getMaxSteps();
  65987. },
  65988. 'percent' => function (self $bar) {
  65989. return floor($bar->getProgressPercent() * 100);
  65990. },
  65991. ];
  65992. }
  65993. private static function initFormats(): array
  65994. {
  65995. return [
  65996. self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%',
  65997. self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]',
  65998. self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  65999. self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
  66000. self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  66001. self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%',
  66002. self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  66003. self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  66004. ];
  66005. }
  66006. private function buildLine(): string
  66007. {
  66008. $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
  66009. $callback = function ($matches) {
  66010. if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
  66011. $text = $formatter($this, $this->output);
  66012. } elseif (isset($this->messages[$matches[1]])) {
  66013. $text = $this->messages[$matches[1]];
  66014. } else {
  66015. return $matches[0];
  66016. }
  66017. if (isset($matches[2])) {
  66018. $text = sprintf('%'.$matches[2], $text);
  66019. }
  66020. return $text;
  66021. };
  66022. $line = preg_replace_callback($regex, $callback, $this->format);
  66023. $linesLength = array_map(function ($subLine) {
  66024. return Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r")));
  66025. }, explode("\n", $line));
  66026. $linesWidth = max($linesLength);
  66027. $terminalWidth = $this->terminal->getWidth();
  66028. if ($linesWidth <= $terminalWidth) {
  66029. return $line;
  66030. }
  66031. $this->setBarWidth($this->barWidth - $linesWidth + $terminalWidth);
  66032. return preg_replace_callback($regex, $callback, $this->format);
  66033. }
  66034. }
  66035. <?php
  66036. namespace Symfony\Component\Console\Helper;
  66037. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66038. use Symfony\Component\Console\Exception\LogicException;
  66039. use Symfony\Component\Console\Output\OutputInterface;
  66040. class ProgressIndicator
  66041. {
  66042. private const FORMATS = [
  66043. 'normal' => ' %indicator% %message%',
  66044. 'normal_no_ansi' => ' %message%',
  66045. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  66046. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  66047. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  66048. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  66049. ];
  66050. private $output;
  66051. private $startTime;
  66052. private $format;
  66053. private $message;
  66054. private $indicatorValues;
  66055. private $indicatorCurrent;
  66056. private $indicatorChangeInterval;
  66057. private $indicatorUpdateTime;
  66058. private $started = false;
  66059. private static $formatters;
  66060. public function __construct(OutputInterface $output, ?string $format = null, int $indicatorChangeInterval = 100, ?array $indicatorValues = null)
  66061. {
  66062. $this->output = $output;
  66063. if (null === $format) {
  66064. $format = $this->determineBestFormat();
  66065. }
  66066. if (null === $indicatorValues) {
  66067. $indicatorValues = ['-', '\\', '|', '/'];
  66068. }
  66069. $indicatorValues = array_values($indicatorValues);
  66070. if (2 > \count($indicatorValues)) {
  66071. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  66072. }
  66073. $this->format = self::getFormatDefinition($format);
  66074. $this->indicatorChangeInterval = $indicatorChangeInterval;
  66075. $this->indicatorValues = $indicatorValues;
  66076. $this->startTime = time();
  66077. }
  66078. public function setMessage(?string $message)
  66079. {
  66080. $this->message = $message;
  66081. $this->display();
  66082. }
  66083. public function start(string $message)
  66084. {
  66085. if ($this->started) {
  66086. throw new LogicException('Progress indicator already started.');
  66087. }
  66088. $this->message = $message;
  66089. $this->started = true;
  66090. $this->startTime = time();
  66091. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  66092. $this->indicatorCurrent = 0;
  66093. $this->display();
  66094. }
  66095. public function advance()
  66096. {
  66097. if (!$this->started) {
  66098. throw new LogicException('Progress indicator has not yet been started.');
  66099. }
  66100. if (!$this->output->isDecorated()) {
  66101. return;
  66102. }
  66103. $currentTime = $this->getCurrentTimeInMilliseconds();
  66104. if ($currentTime < $this->indicatorUpdateTime) {
  66105. return;
  66106. }
  66107. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  66108. ++$this->indicatorCurrent;
  66109. $this->display();
  66110. }
  66111. public function finish(string $message)
  66112. {
  66113. if (!$this->started) {
  66114. throw new LogicException('Progress indicator has not yet been started.');
  66115. }
  66116. $this->message = $message;
  66117. $this->display();
  66118. $this->output->writeln('');
  66119. $this->started = false;
  66120. }
  66121. public static function getFormatDefinition(string $name)
  66122. {
  66123. return self::FORMATS[$name] ?? null;
  66124. }
  66125. public static function setPlaceholderFormatterDefinition(string $name, callable $callable)
  66126. {
  66127. if (!self::$formatters) {
  66128. self::$formatters = self::initPlaceholderFormatters();
  66129. }
  66130. self::$formatters[$name] = $callable;
  66131. }
  66132. public static function getPlaceholderFormatterDefinition(string $name)
  66133. {
  66134. if (!self::$formatters) {
  66135. self::$formatters = self::initPlaceholderFormatters();
  66136. }
  66137. return self::$formatters[$name] ?? null;
  66138. }
  66139. private function display()
  66140. {
  66141. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  66142. return;
  66143. }
  66144. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) {
  66145. if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) {
  66146. return $formatter($this);
  66147. }
  66148. return $matches[0];
  66149. }, $this->format ?? ''));
  66150. }
  66151. private function determineBestFormat(): string
  66152. {
  66153. switch ($this->output->getVerbosity()) {
  66154. case OutputInterface::VERBOSITY_VERBOSE:
  66155. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  66156. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  66157. case OutputInterface::VERBOSITY_DEBUG:
  66158. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  66159. default:
  66160. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  66161. }
  66162. }
  66163. private function overwrite(string $message)
  66164. {
  66165. if ($this->output->isDecorated()) {
  66166. $this->output->write("\x0D\x1B[2K");
  66167. $this->output->write($message);
  66168. } else {
  66169. $this->output->writeln($message);
  66170. }
  66171. }
  66172. private function getCurrentTimeInMilliseconds(): float
  66173. {
  66174. return round(microtime(true) * 1000);
  66175. }
  66176. private static function initPlaceholderFormatters(): array
  66177. {
  66178. return [
  66179. 'indicator' => function (self $indicator) {
  66180. return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)];
  66181. },
  66182. 'message' => function (self $indicator) {
  66183. return $indicator->message;
  66184. },
  66185. 'elapsed' => function (self $indicator) {
  66186. return Helper::formatTime(time() - $indicator->startTime);
  66187. },
  66188. 'memory' => function () {
  66189. return Helper::formatMemory(memory_get_usage(true));
  66190. },
  66191. ];
  66192. }
  66193. }
  66194. <?php
  66195. namespace Symfony\Component\Console\Helper;
  66196. use Symfony\Component\Console\Cursor;
  66197. use Symfony\Component\Console\Exception\MissingInputException;
  66198. use Symfony\Component\Console\Exception\RuntimeException;
  66199. use Symfony\Component\Console\Formatter\OutputFormatter;
  66200. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  66201. use Symfony\Component\Console\Input\InputInterface;
  66202. use Symfony\Component\Console\Input\StreamableInputInterface;
  66203. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  66204. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  66205. use Symfony\Component\Console\Output\OutputInterface;
  66206. use Symfony\Component\Console\Question\ChoiceQuestion;
  66207. use Symfony\Component\Console\Question\Question;
  66208. use Symfony\Component\Console\Terminal;
  66209. use function Symfony\Component\String\s;
  66210. class QuestionHelper extends Helper
  66211. {
  66212. private $inputStream;
  66213. private static $stty = true;
  66214. private static $stdinIsInteractive;
  66215. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  66216. {
  66217. if ($output instanceof ConsoleOutputInterface) {
  66218. $output = $output->getErrorOutput();
  66219. }
  66220. if (!$input->isInteractive()) {
  66221. return $this->getDefaultAnswer($question);
  66222. }
  66223. if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) {
  66224. $this->inputStream = $stream;
  66225. }
  66226. try {
  66227. if (!$question->getValidator()) {
  66228. return $this->doAsk($output, $question);
  66229. }
  66230. $interviewer = function () use ($output, $question) {
  66231. return $this->doAsk($output, $question);
  66232. };
  66233. return $this->validateAttempts($interviewer, $output, $question);
  66234. } catch (MissingInputException $exception) {
  66235. $input->setInteractive(false);
  66236. if (null === $fallbackOutput = $this->getDefaultAnswer($question)) {
  66237. throw $exception;
  66238. }
  66239. return $fallbackOutput;
  66240. }
  66241. }
  66242. public function getName()
  66243. {
  66244. return 'question';
  66245. }
  66246. public static function disableStty()
  66247. {
  66248. self::$stty = false;
  66249. }
  66250. private function doAsk(OutputInterface $output, Question $question)
  66251. {
  66252. $this->writePrompt($output, $question);
  66253. $inputStream = $this->inputStream ?: \STDIN;
  66254. $autocomplete = $question->getAutocompleterCallback();
  66255. if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
  66256. $ret = false;
  66257. if ($question->isHidden()) {
  66258. try {
  66259. $hiddenResponse = $this->getHiddenResponse($output, $inputStream, $question->isTrimmable());
  66260. $ret = $question->isTrimmable() ? trim($hiddenResponse) : $hiddenResponse;
  66261. } catch (RuntimeException $e) {
  66262. if (!$question->isHiddenFallback()) {
  66263. throw $e;
  66264. }
  66265. }
  66266. }
  66267. if (false === $ret) {
  66268. $isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true;
  66269. if (!$isBlocked) {
  66270. stream_set_blocking($inputStream, true);
  66271. }
  66272. $ret = $this->readInput($inputStream, $question);
  66273. if (!$isBlocked) {
  66274. stream_set_blocking($inputStream, false);
  66275. }
  66276. if (false === $ret) {
  66277. throw new MissingInputException('Aborted.');
  66278. }
  66279. if ($question->isTrimmable()) {
  66280. $ret = trim($ret);
  66281. }
  66282. }
  66283. } else {
  66284. $autocomplete = $this->autocomplete($output, $question, $inputStream, $autocomplete);
  66285. $ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
  66286. }
  66287. if ($output instanceof ConsoleSectionOutput) {
  66288. $output->addContent($ret);
  66289. }
  66290. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  66291. if ($normalizer = $question->getNormalizer()) {
  66292. return $normalizer($ret);
  66293. }
  66294. return $ret;
  66295. }
  66296. private function getDefaultAnswer(Question $question)
  66297. {
  66298. $default = $question->getDefault();
  66299. if (null === $default) {
  66300. return $default;
  66301. }
  66302. if ($validator = $question->getValidator()) {
  66303. return \call_user_func($question->getValidator(), $default);
  66304. } elseif ($question instanceof ChoiceQuestion) {
  66305. $choices = $question->getChoices();
  66306. if (!$question->isMultiselect()) {
  66307. return $choices[$default] ?? $default;
  66308. }
  66309. $default = explode(',', $default);
  66310. foreach ($default as $k => $v) {
  66311. $v = $question->isTrimmable() ? trim($v) : $v;
  66312. $default[$k] = $choices[$v] ?? $v;
  66313. }
  66314. }
  66315. return $default;
  66316. }
  66317. protected function writePrompt(OutputInterface $output, Question $question)
  66318. {
  66319. $message = $question->getQuestion();
  66320. if ($question instanceof ChoiceQuestion) {
  66321. $output->writeln(array_merge([
  66322. $question->getQuestion(),
  66323. ], $this->formatChoiceQuestionChoices($question, 'info')));
  66324. $message = $question->getPrompt();
  66325. }
  66326. $output->write($message);
  66327. }
  66328. protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag)
  66329. {
  66330. $messages = [];
  66331. $maxWidth = max(array_map([__CLASS__, 'width'], array_keys($choices = $question->getChoices())));
  66332. foreach ($choices as $key => $value) {
  66333. $padding = str_repeat(' ', $maxWidth - self::width($key));
  66334. $messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
  66335. }
  66336. return $messages;
  66337. }
  66338. protected function writeError(OutputInterface $output, \Exception $error)
  66339. {
  66340. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  66341. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  66342. } else {
  66343. $message = '<error>'.$error->getMessage().'</error>';
  66344. }
  66345. $output->writeln($message);
  66346. }
  66347. private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string
  66348. {
  66349. $cursor = new Cursor($output, $inputStream);
  66350. $fullChoice = '';
  66351. $ret = '';
  66352. $i = 0;
  66353. $ofs = -1;
  66354. $matches = $autocomplete($ret);
  66355. $numMatches = \count($matches);
  66356. $sttyMode = shell_exec('stty -g');
  66357. $isStdin = 'php://stdin' === (stream_get_meta_data($inputStream)['uri'] ?? null);
  66358. $r = [$inputStream];
  66359. $w = [];
  66360. shell_exec('stty -icanon -echo');
  66361. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  66362. while (!feof($inputStream)) {
  66363. while ($isStdin && 0 === @stream_select($r, $w, $w, 0, 100)) {
  66364. $r = [$inputStream];
  66365. }
  66366. $c = fread($inputStream, 1);
  66367. if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
  66368. shell_exec('stty '.$sttyMode);
  66369. throw new MissingInputException('Aborted.');
  66370. } elseif ("\177" === $c) {
  66371. if (0 === $numMatches && 0 !== $i) {
  66372. --$i;
  66373. $cursor->moveLeft(s($fullChoice)->slice(-1)->width(false));
  66374. $fullChoice = self::substr($fullChoice, 0, $i);
  66375. }
  66376. if (0 === $i) {
  66377. $ofs = -1;
  66378. $matches = $autocomplete($ret);
  66379. $numMatches = \count($matches);
  66380. } else {
  66381. $numMatches = 0;
  66382. }
  66383. $ret = self::substr($ret, 0, $i);
  66384. } elseif ("\033" === $c) {
  66385. $c .= fread($inputStream, 2);
  66386. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  66387. if ('A' === $c[2] && -1 === $ofs) {
  66388. $ofs = 0;
  66389. }
  66390. if (0 === $numMatches) {
  66391. continue;
  66392. }
  66393. $ofs += ('A' === $c[2]) ? -1 : 1;
  66394. $ofs = ($numMatches + $ofs) % $numMatches;
  66395. }
  66396. } elseif (\ord($c) < 32) {
  66397. if ("\t" === $c || "\n" === $c) {
  66398. if ($numMatches > 0 && -1 !== $ofs) {
  66399. $ret = (string) $matches[$ofs];
  66400. $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
  66401. $output->write($remainingCharacters);
  66402. $fullChoice .= $remainingCharacters;
  66403. $i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);
  66404. $matches = array_filter(
  66405. $autocomplete($ret),
  66406. function ($match) use ($ret) {
  66407. return '' === $ret || str_starts_with($match, $ret);
  66408. }
  66409. );
  66410. $numMatches = \count($matches);
  66411. $ofs = -1;
  66412. }
  66413. if ("\n" === $c) {
  66414. $output->write($c);
  66415. break;
  66416. }
  66417. $numMatches = 0;
  66418. }
  66419. continue;
  66420. } else {
  66421. if ("\x80" <= $c) {
  66422. $c .= fread($inputStream, ["\xC0" => 1, "\xD0" => 1, "\xE0" => 2, "\xF0" => 3][$c & "\xF0"]);
  66423. }
  66424. $output->write($c);
  66425. $ret .= $c;
  66426. $fullChoice .= $c;
  66427. ++$i;
  66428. $tempRet = $ret;
  66429. if ($question instanceof ChoiceQuestion && $question->isMultiselect()) {
  66430. $tempRet = $this->mostRecentlyEnteredValue($fullChoice);
  66431. }
  66432. $numMatches = 0;
  66433. $ofs = 0;
  66434. foreach ($autocomplete($ret) as $value) {
  66435. if (str_starts_with($value, $tempRet)) {
  66436. $matches[$numMatches++] = $value;
  66437. }
  66438. }
  66439. }
  66440. $cursor->clearLineAfter();
  66441. if ($numMatches > 0 && -1 !== $ofs) {
  66442. $cursor->savePosition();
  66443. $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)));
  66444. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).'</hl>');
  66445. $cursor->restorePosition();
  66446. }
  66447. }
  66448. shell_exec('stty '.$sttyMode);
  66449. return $fullChoice;
  66450. }
  66451. private function mostRecentlyEnteredValue(string $entered): string
  66452. {
  66453. if (!str_contains($entered, ',')) {
  66454. return $entered;
  66455. }
  66456. $choices = explode(',', $entered);
  66457. if ('' !== $lastChoice = trim($choices[\count($choices) - 1])) {
  66458. return $lastChoice;
  66459. }
  66460. return $entered;
  66461. }
  66462. private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string
  66463. {
  66464. if ('\\' === \DIRECTORY_SEPARATOR) {
  66465. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  66466. if ('phar:' === substr(__FILE__, 0, 5)) {
  66467. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  66468. copy($exe, $tmpExe);
  66469. $exe = $tmpExe;
  66470. }
  66471. $sExec = shell_exec('"'.$exe.'"');
  66472. $value = $trimmable ? rtrim($sExec) : $sExec;
  66473. $output->writeln('');
  66474. if (isset($tmpExe)) {
  66475. unlink($tmpExe);
  66476. }
  66477. return $value;
  66478. }
  66479. if (self::$stty && Terminal::hasSttyAvailable()) {
  66480. $sttyMode = shell_exec('stty -g');
  66481. shell_exec('stty -echo');
  66482. } elseif ($this->isInteractiveInput($inputStream)) {
  66483. throw new RuntimeException('Unable to hide the response.');
  66484. }
  66485. $value = fgets($inputStream, 4096);
  66486. if (self::$stty && Terminal::hasSttyAvailable()) {
  66487. shell_exec('stty '.$sttyMode);
  66488. }
  66489. if (false === $value) {
  66490. throw new MissingInputException('Aborted.');
  66491. }
  66492. if ($trimmable) {
  66493. $value = trim($value);
  66494. }
  66495. $output->writeln('');
  66496. return $value;
  66497. }
  66498. private function validateAttempts(callable $interviewer, OutputInterface $output, Question $question)
  66499. {
  66500. $error = null;
  66501. $attempts = $question->getMaxAttempts();
  66502. while (null === $attempts || $attempts--) {
  66503. if (null !== $error) {
  66504. $this->writeError($output, $error);
  66505. }
  66506. try {
  66507. return $question->getValidator()($interviewer());
  66508. } catch (RuntimeException $e) {
  66509. throw $e;
  66510. } catch (\Exception $error) {
  66511. }
  66512. }
  66513. throw $error;
  66514. }
  66515. private function isInteractiveInput($inputStream): bool
  66516. {
  66517. if ('php://stdin' !== (stream_get_meta_data($inputStream)['uri'] ?? null)) {
  66518. return false;
  66519. }
  66520. if (null !== self::$stdinIsInteractive) {
  66521. return self::$stdinIsInteractive;
  66522. }
  66523. return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
  66524. }
  66525. private function readInput($inputStream, Question $question)
  66526. {
  66527. if (!$question->isMultiline()) {
  66528. $cp = $this->setIOCodepage();
  66529. $ret = fgets($inputStream, 4096);
  66530. return $this->resetIOCodepage($cp, $ret);
  66531. }
  66532. $multiLineStreamReader = $this->cloneInputStream($inputStream);
  66533. if (null === $multiLineStreamReader) {
  66534. return false;
  66535. }
  66536. $ret = '';
  66537. $cp = $this->setIOCodepage();
  66538. while (false !== ($char = fgetc($multiLineStreamReader))) {
  66539. if (\PHP_EOL === "{$ret}{$char}") {
  66540. break;
  66541. }
  66542. $ret .= $char;
  66543. }
  66544. return $this->resetIOCodepage($cp, $ret);
  66545. }
  66546. private function setIOCodepage(): int
  66547. {
  66548. if (\function_exists('sapi_windows_cp_set')) {
  66549. $cp = sapi_windows_cp_get();
  66550. sapi_windows_cp_set(sapi_windows_cp_get('oem'));
  66551. return $cp;
  66552. }
  66553. return 0;
  66554. }
  66555. private function resetIOCodepage(int $cp, $input)
  66556. {
  66557. if (0 !== $cp) {
  66558. sapi_windows_cp_set($cp);
  66559. if (false !== $input && '' !== $input) {
  66560. $input = sapi_windows_cp_conv(sapi_windows_cp_get('oem'), $cp, $input);
  66561. }
  66562. }
  66563. return $input;
  66564. }
  66565. private function cloneInputStream($inputStream)
  66566. {
  66567. $streamMetaData = stream_get_meta_data($inputStream);
  66568. $seekable = $streamMetaData['seekable'] ?? false;
  66569. $mode = $streamMetaData['mode'] ?? 'rb';
  66570. $uri = $streamMetaData['uri'] ?? null;
  66571. if (null === $uri) {
  66572. return null;
  66573. }
  66574. $cloneStream = fopen($uri, $mode);
  66575. if (true === $seekable && !\in_array($mode, ['r', 'rb', 'rt'])) {
  66576. $offset = ftell($inputStream);
  66577. rewind($inputStream);
  66578. stream_copy_to_stream($inputStream, $cloneStream);
  66579. fseek($inputStream, $offset);
  66580. fseek($cloneStream, $offset);
  66581. }
  66582. return $cloneStream;
  66583. }
  66584. }
  66585. <?php
  66586. namespace Symfony\Component\Console\Helper;
  66587. use Symfony\Component\Console\Formatter\OutputFormatter;
  66588. use Symfony\Component\Console\Output\OutputInterface;
  66589. use Symfony\Component\Console\Question\ChoiceQuestion;
  66590. use Symfony\Component\Console\Question\ConfirmationQuestion;
  66591. use Symfony\Component\Console\Question\Question;
  66592. use Symfony\Component\Console\Style\SymfonyStyle;
  66593. class SymfonyQuestionHelper extends QuestionHelper
  66594. {
  66595. protected function writePrompt(OutputInterface $output, Question $question)
  66596. {
  66597. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  66598. $default = $question->getDefault();
  66599. if ($question->isMultiline()) {
  66600. $text .= sprintf(' (press %s to continue)', $this->getEofShortcut());
  66601. }
  66602. switch (true) {
  66603. case null === $default:
  66604. $text = sprintf(' <info>%s</info>:', $text);
  66605. break;
  66606. case $question instanceof ConfirmationQuestion:
  66607. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  66608. break;
  66609. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  66610. $choices = $question->getChoices();
  66611. $default = explode(',', $default);
  66612. foreach ($default as $key => $value) {
  66613. $default[$key] = $choices[trim($value)];
  66614. }
  66615. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  66616. break;
  66617. case $question instanceof ChoiceQuestion:
  66618. $choices = $question->getChoices();
  66619. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
  66620. break;
  66621. default:
  66622. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  66623. }
  66624. $output->writeln($text);
  66625. $prompt = ' > ';
  66626. if ($question instanceof ChoiceQuestion) {
  66627. $output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));
  66628. $prompt = $question->getPrompt();
  66629. }
  66630. $output->write($prompt);
  66631. }
  66632. protected function writeError(OutputInterface $output, \Exception $error)
  66633. {
  66634. if ($output instanceof SymfonyStyle) {
  66635. $output->newLine();
  66636. $output->error($error->getMessage());
  66637. return;
  66638. }
  66639. parent::writeError($output, $error);
  66640. }
  66641. private function getEofShortcut(): string
  66642. {
  66643. if ('Windows' === \PHP_OS_FAMILY) {
  66644. return '<comment>Ctrl+Z</comment> then <comment>Enter</comment>';
  66645. }
  66646. return '<comment>Ctrl+D</comment>';
  66647. }
  66648. }
  66649. <?php
  66650. namespace Symfony\Component\Console\Helper;
  66651. use Symfony\Component\Console\Exception\InvalidArgumentException;
  66652. use Symfony\Component\Console\Exception\RuntimeException;
  66653. use Symfony\Component\Console\Formatter\OutputFormatter;
  66654. use Symfony\Component\Console\Formatter\WrappableOutputFormatterInterface;
  66655. use Symfony\Component\Console\Output\ConsoleSectionOutput;
  66656. use Symfony\Component\Console\Output\OutputInterface;
  66657. class Table
  66658. {
  66659. private const SEPARATOR_TOP = 0;
  66660. private const SEPARATOR_TOP_BOTTOM = 1;
  66661. private const SEPARATOR_MID = 2;
  66662. private const SEPARATOR_BOTTOM = 3;
  66663. private const BORDER_OUTSIDE = 0;
  66664. private const BORDER_INSIDE = 1;
  66665. private $headerTitle;
  66666. private $footerTitle;
  66667. private $headers = [];
  66668. private $rows = [];
  66669. private $horizontal = false;
  66670. private $effectiveColumnWidths = [];
  66671. private $numberOfColumns;
  66672. private $output;
  66673. private $style;
  66674. private $columnStyles = [];
  66675. private $columnWidths = [];
  66676. private $columnMaxWidths = [];
  66677. private static $styles;
  66678. private $rendered = false;
  66679. public function __construct(OutputInterface $output)
  66680. {
  66681. $this->output = $output;
  66682. if (!self::$styles) {
  66683. self::$styles = self::initStyles();
  66684. }
  66685. $this->setStyle('default');
  66686. }
  66687. public static function setStyleDefinition(string $name, TableStyle $style)
  66688. {
  66689. if (!self::$styles) {
  66690. self::$styles = self::initStyles();
  66691. }
  66692. self::$styles[$name] = $style;
  66693. }
  66694. public static function getStyleDefinition(string $name)
  66695. {
  66696. if (!self::$styles) {
  66697. self::$styles = self::initStyles();
  66698. }
  66699. if (isset(self::$styles[$name])) {
  66700. return self::$styles[$name];
  66701. }
  66702. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  66703. }
  66704. public function setStyle($name)
  66705. {
  66706. $this->style = $this->resolveStyle($name);
  66707. return $this;
  66708. }
  66709. public function getStyle()
  66710. {
  66711. return $this->style;
  66712. }
  66713. public function setColumnStyle(int $columnIndex, $name)
  66714. {
  66715. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  66716. return $this;
  66717. }
  66718. public function getColumnStyle(int $columnIndex)
  66719. {
  66720. return $this->columnStyles[$columnIndex] ?? $this->getStyle();
  66721. }
  66722. public function setColumnWidth(int $columnIndex, int $width)
  66723. {
  66724. $this->columnWidths[$columnIndex] = $width;
  66725. return $this;
  66726. }
  66727. public function setColumnWidths(array $widths)
  66728. {
  66729. $this->columnWidths = [];
  66730. foreach ($widths as $index => $width) {
  66731. $this->setColumnWidth($index, $width);
  66732. }
  66733. return $this;
  66734. }
  66735. public function setColumnMaxWidth(int $columnIndex, int $width): self
  66736. {
  66737. if (!$this->output->getFormatter() instanceof WrappableOutputFormatterInterface) {
  66738. throw new \LogicException(sprintf('Setting a maximum column width is only supported when using a "%s" formatter, got "%s".', WrappableOutputFormatterInterface::class, get_debug_type($this->output->getFormatter())));
  66739. }
  66740. $this->columnMaxWidths[$columnIndex] = $width;
  66741. return $this;
  66742. }
  66743. public function setHeaders(array $headers)
  66744. {
  66745. $headers = array_values($headers);
  66746. if (!empty($headers) && !\is_array($headers[0])) {
  66747. $headers = [$headers];
  66748. }
  66749. $this->headers = $headers;
  66750. return $this;
  66751. }
  66752. public function setRows(array $rows)
  66753. {
  66754. $this->rows = [];
  66755. return $this->addRows($rows);
  66756. }
  66757. public function addRows(array $rows)
  66758. {
  66759. foreach ($rows as $row) {
  66760. $this->addRow($row);
  66761. }
  66762. return $this;
  66763. }
  66764. public function addRow($row)
  66765. {
  66766. if ($row instanceof TableSeparator) {
  66767. $this->rows[] = $row;
  66768. return $this;
  66769. }
  66770. if (!\is_array($row)) {
  66771. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  66772. }
  66773. $this->rows[] = array_values($row);
  66774. return $this;
  66775. }
  66776. public function appendRow($row): self
  66777. {
  66778. if (!$this->output instanceof ConsoleSectionOutput) {
  66779. throw new RuntimeException(sprintf('Output should be an instance of "%s" when calling "%s".', ConsoleSectionOutput::class, __METHOD__));
  66780. }
  66781. if ($this->rendered) {
  66782. $this->output->clear($this->calculateRowCount());
  66783. }
  66784. $this->addRow($row);
  66785. $this->render();
  66786. return $this;
  66787. }
  66788. public function setRow($column, array $row)
  66789. {
  66790. $this->rows[$column] = $row;
  66791. return $this;
  66792. }
  66793. public function setHeaderTitle(?string $title): self
  66794. {
  66795. $this->headerTitle = $title;
  66796. return $this;
  66797. }
  66798. public function setFooterTitle(?string $title): self
  66799. {
  66800. $this->footerTitle = $title;
  66801. return $this;
  66802. }
  66803. public function setHorizontal(bool $horizontal = true): self
  66804. {
  66805. $this->horizontal = $horizontal;
  66806. return $this;
  66807. }
  66808. public function render()
  66809. {
  66810. $divider = new TableSeparator();
  66811. if ($this->horizontal) {
  66812. $rows = [];
  66813. foreach ($this->headers[0] ?? [] as $i => $header) {
  66814. $rows[$i] = [$header];
  66815. foreach ($this->rows as $row) {
  66816. if ($row instanceof TableSeparator) {
  66817. continue;
  66818. }
  66819. if (isset($row[$i])) {
  66820. $rows[$i][] = $row[$i];
  66821. } elseif ($rows[$i][0] instanceof TableCell && $rows[$i][0]->getColspan() >= 2) {
  66822. } else {
  66823. $rows[$i][] = null;
  66824. }
  66825. }
  66826. }
  66827. } else {
  66828. $rows = array_merge($this->headers, [$divider], $this->rows);
  66829. }
  66830. $this->calculateNumberOfColumns($rows);
  66831. $rowGroups = $this->buildTableRows($rows);
  66832. $this->calculateColumnsWidth($rowGroups);
  66833. $isHeader = !$this->horizontal;
  66834. $isFirstRow = $this->horizontal;
  66835. $hasTitle = (bool) $this->headerTitle;
  66836. foreach ($rowGroups as $rowGroup) {
  66837. $isHeaderSeparatorRendered = false;
  66838. foreach ($rowGroup as $row) {
  66839. if ($divider === $row) {
  66840. $isHeader = false;
  66841. $isFirstRow = true;
  66842. continue;
  66843. }
  66844. if ($row instanceof TableSeparator) {
  66845. $this->renderRowSeparator();
  66846. continue;
  66847. }
  66848. if (!$row) {
  66849. continue;
  66850. }
  66851. if ($isHeader && !$isHeaderSeparatorRendered) {
  66852. $this->renderRowSeparator(
  66853. $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
  66854. $hasTitle ? $this->headerTitle : null,
  66855. $hasTitle ? $this->style->getHeaderTitleFormat() : null
  66856. );
  66857. $hasTitle = false;
  66858. $isHeaderSeparatorRendered = true;
  66859. }
  66860. if ($isFirstRow) {
  66861. $this->renderRowSeparator(
  66862. $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
  66863. $hasTitle ? $this->headerTitle : null,
  66864. $hasTitle ? $this->style->getHeaderTitleFormat() : null
  66865. );
  66866. $isFirstRow = false;
  66867. $hasTitle = false;
  66868. }
  66869. if ($this->horizontal) {
  66870. $this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
  66871. } else {
  66872. $this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
  66873. }
  66874. }
  66875. }
  66876. $this->renderRowSeparator(self::SEPARATOR_BOTTOM, $this->footerTitle, $this->style->getFooterTitleFormat());
  66877. $this->cleanup();
  66878. $this->rendered = true;
  66879. }
  66880. private function renderRowSeparator(int $type = self::SEPARATOR_MID, ?string $title = null, ?string $titleFormat = null)
  66881. {
  66882. if (0 === $count = $this->numberOfColumns) {
  66883. return;
  66884. }
  66885. $borders = $this->style->getBorderChars();
  66886. if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) {
  66887. return;
  66888. }
  66889. $crossings = $this->style->getCrossingChars();
  66890. if (self::SEPARATOR_MID === $type) {
  66891. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[2], $crossings[8], $crossings[0], $crossings[4]];
  66892. } elseif (self::SEPARATOR_TOP === $type) {
  66893. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[1], $crossings[2], $crossings[3]];
  66894. } elseif (self::SEPARATOR_TOP_BOTTOM === $type) {
  66895. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[9], $crossings[10], $crossings[11]];
  66896. } else {
  66897. [$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[7], $crossings[6], $crossings[5]];
  66898. }
  66899. $markup = $leftChar;
  66900. for ($column = 0; $column < $count; ++$column) {
  66901. $markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]);
  66902. $markup .= $column === $count - 1 ? $rightChar : $midChar;
  66903. }
  66904. if (null !== $title) {
  66905. $titleLength = Helper::width(Helper::removeDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title)));
  66906. $markupLength = Helper::width($markup);
  66907. if ($titleLength > $limit = $markupLength - 4) {
  66908. $titleLength = $limit;
  66909. $formatLength = Helper::width(Helper::removeDecoration($formatter, sprintf($titleFormat, '')));
  66910. $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
  66911. }
  66912. $titleStart = intdiv($markupLength - $titleLength, 2);
  66913. if (false === mb_detect_encoding($markup, null, true)) {
  66914. $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
  66915. } else {
  66916. $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength);
  66917. }
  66918. }
  66919. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  66920. }
  66921. private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
  66922. {
  66923. $borders = $this->style->getBorderChars();
  66924. return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]);
  66925. }
  66926. private function renderRow(array $row, string $cellFormat, ?string $firstCellFormat = null)
  66927. {
  66928. $rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
  66929. $columns = $this->getRowColumns($row);
  66930. $last = \count($columns) - 1;
  66931. foreach ($columns as $i => $column) {
  66932. if ($firstCellFormat && 0 === $i) {
  66933. $rowContent .= $this->renderCell($row, $column, $firstCellFormat);
  66934. } else {
  66935. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  66936. }
  66937. $rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
  66938. }
  66939. $this->output->writeln($rowContent);
  66940. }
  66941. private function renderCell(array $row, int $column, string $cellFormat): string
  66942. {
  66943. $cell = $row[$column] ?? '';
  66944. $width = $this->effectiveColumnWidths[$column];
  66945. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  66946. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  66947. $width += $this->getColumnSeparatorWidth() + $this->effectiveColumnWidths[$nextColumn];
  66948. }
  66949. }
  66950. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  66951. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  66952. }
  66953. $style = $this->getColumnStyle($column);
  66954. if ($cell instanceof TableSeparator) {
  66955. return sprintf($style->getBorderFormat(), str_repeat($style->getBorderChars()[2], $width));
  66956. }
  66957. $width += Helper::length($cell) - Helper::length(Helper::removeDecoration($this->output->getFormatter(), $cell));
  66958. $content = sprintf($style->getCellRowContentFormat(), $cell);
  66959. $padType = $style->getPadType();
  66960. if ($cell instanceof TableCell && $cell->getStyle() instanceof TableCellStyle) {
  66961. $isNotStyledByTag = !preg_match('/^<(\w+|(\w+=[\w,]+;?)*)>.+<\/(\w+|(\w+=\w+;?)*)?>$/', $cell);
  66962. if ($isNotStyledByTag) {
  66963. $cellFormat = $cell->getStyle()->getCellFormat();
  66964. if (!\is_string($cellFormat)) {
  66965. $tag = http_build_query($cell->getStyle()->getTagOptions(), '', ';');
  66966. $cellFormat = '<'.$tag.'>%s</>';
  66967. }
  66968. if (strstr($content, '</>')) {
  66969. $content = str_replace('</>', '', $content);
  66970. $width -= 3;
  66971. }
  66972. if (strstr($content, '<fg=default;bg=default>')) {
  66973. $content = str_replace('<fg=default;bg=default>', '', $content);
  66974. $width -= \strlen('<fg=default;bg=default>');
  66975. }
  66976. }
  66977. $padType = $cell->getStyle()->getPadByAlign();
  66978. }
  66979. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $padType));
  66980. }
  66981. private function calculateNumberOfColumns(array $rows)
  66982. {
  66983. $columns = [0];
  66984. foreach ($rows as $row) {
  66985. if ($row instanceof TableSeparator) {
  66986. continue;
  66987. }
  66988. $columns[] = $this->getNumberOfColumns($row);
  66989. }
  66990. $this->numberOfColumns = max($columns);
  66991. }
  66992. private function buildTableRows(array $rows): TableRows
  66993. {
  66994. $formatter = $this->output->getFormatter();
  66995. $unmergedRows = [];
  66996. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  66997. $rows = $this->fillNextRows($rows, $rowKey);
  66998. foreach ($rows[$rowKey] as $column => $cell) {
  66999. $colspan = $cell instanceof TableCell ? $cell->getColspan() : 1;
  67000. if (isset($this->columnMaxWidths[$column]) && Helper::width(Helper::removeDecoration($formatter, $cell)) > $this->columnMaxWidths[$column]) {
  67001. $cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
  67002. }
  67003. if (!strstr($cell ?? '', "\n")) {
  67004. continue;
  67005. }
  67006. $eol = str_contains($cell ?? '', "\r\n") ? "\r\n" : "\n";
  67007. $escaped = implode($eol, array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode($eol, $cell)));
  67008. $cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
  67009. $lines = explode($eol, str_replace($eol, '<fg=default;bg=default></>'.$eol, $cell));
  67010. foreach ($lines as $lineKey => $line) {
  67011. if ($colspan > 1) {
  67012. $line = new TableCell($line, ['colspan' => $colspan]);
  67013. }
  67014. if (0 === $lineKey) {
  67015. $rows[$rowKey][$column] = $line;
  67016. } else {
  67017. if (!\array_key_exists($rowKey, $unmergedRows) || !\array_key_exists($lineKey, $unmergedRows[$rowKey])) {
  67018. $unmergedRows[$rowKey][$lineKey] = $this->copyRow($rows, $rowKey);
  67019. }
  67020. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  67021. }
  67022. }
  67023. }
  67024. }
  67025. return new TableRows(function () use ($rows, $unmergedRows): \Traversable {
  67026. foreach ($rows as $rowKey => $row) {
  67027. $rowGroup = [$row instanceof TableSeparator ? $row : $this->fillCells($row)];
  67028. if (isset($unmergedRows[$rowKey])) {
  67029. foreach ($unmergedRows[$rowKey] as $row) {
  67030. $rowGroup[] = $row instanceof TableSeparator ? $row : $this->fillCells($row);
  67031. }
  67032. }
  67033. yield $rowGroup;
  67034. }
  67035. });
  67036. }
  67037. private function calculateRowCount(): int
  67038. {
  67039. $numberOfRows = \count(iterator_to_array($this->buildTableRows(array_merge($this->headers, [new TableSeparator()], $this->rows))));
  67040. if ($this->headers) {
  67041. ++$numberOfRows;
  67042. }
  67043. if (\count($this->rows) > 0) {
  67044. ++$numberOfRows;
  67045. }
  67046. return $numberOfRows;
  67047. }
  67048. private function fillNextRows(array $rows, int $line): array
  67049. {
  67050. $unmergedRows = [];
  67051. foreach ($rows[$line] as $column => $cell) {
  67052. if (null !== $cell && !$cell instanceof TableCell && !\is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
  67053. throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', get_debug_type($cell)));
  67054. }
  67055. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  67056. $nbLines = $cell->getRowspan() - 1;
  67057. $lines = [$cell];
  67058. if (strstr($cell, "\n")) {
  67059. $eol = str_contains($cell, "\r\n") ? "\r\n" : "\n";
  67060. $lines = explode($eol, str_replace($eol, '<fg=default;bg=default>'.$eol.'</>', $cell));
  67061. $nbLines = \count($lines) > $nbLines ? substr_count($cell, $eol) : $nbLines;
  67062. $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
  67063. unset($lines[0]);
  67064. }
  67065. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
  67066. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  67067. $value = $lines[$unmergedRowKey - $line] ?? '';
  67068. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
  67069. if ($nbLines === $unmergedRowKey - $line) {
  67070. break;
  67071. }
  67072. }
  67073. }
  67074. }
  67075. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  67076. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  67077. foreach ($unmergedRow as $cellKey => $cell) {
  67078. array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]);
  67079. }
  67080. } else {
  67081. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  67082. foreach ($unmergedRow as $column => $cell) {
  67083. if (!empty($cell)) {
  67084. $row[$column] = $unmergedRow[$column];
  67085. }
  67086. }
  67087. array_splice($rows, $unmergedRowKey, 0, [$row]);
  67088. }
  67089. }
  67090. return $rows;
  67091. }
  67092. private function fillCells(iterable $row)
  67093. {
  67094. $newRow = [];
  67095. foreach ($row as $column => $cell) {
  67096. $newRow[] = $cell;
  67097. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  67098. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  67099. $newRow[] = '';
  67100. }
  67101. }
  67102. }
  67103. return $newRow ?: $row;
  67104. }
  67105. private function copyRow(array $rows, int $line): array
  67106. {
  67107. $row = $rows[$line];
  67108. foreach ($row as $cellKey => $cellValue) {
  67109. $row[$cellKey] = '';
  67110. if ($cellValue instanceof TableCell) {
  67111. $row[$cellKey] = new TableCell('', ['colspan' => $cellValue->getColspan()]);
  67112. }
  67113. }
  67114. return $row;
  67115. }
  67116. private function getNumberOfColumns(array $row): int
  67117. {
  67118. $columns = \count($row);
  67119. foreach ($row as $column) {
  67120. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  67121. }
  67122. return $columns;
  67123. }
  67124. private function getRowColumns(array $row): array
  67125. {
  67126. $columns = range(0, $this->numberOfColumns - 1);
  67127. foreach ($row as $cellKey => $cell) {
  67128. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  67129. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  67130. }
  67131. }
  67132. return $columns;
  67133. }
  67134. private function calculateColumnsWidth(iterable $groups)
  67135. {
  67136. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  67137. $lengths = [];
  67138. foreach ($groups as $group) {
  67139. foreach ($group as $row) {
  67140. if ($row instanceof TableSeparator) {
  67141. continue;
  67142. }
  67143. foreach ($row as $i => $cell) {
  67144. if ($cell instanceof TableCell) {
  67145. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  67146. $textLength = Helper::width($textContent);
  67147. if ($textLength > 0) {
  67148. $contentColumns = mb_str_split($textContent, ceil($textLength / $cell->getColspan()));
  67149. foreach ($contentColumns as $position => $content) {
  67150. $row[$i + $position] = $content;
  67151. }
  67152. }
  67153. }
  67154. }
  67155. $lengths[] = $this->getCellWidth($row, $column);
  67156. }
  67157. }
  67158. $this->effectiveColumnWidths[$column] = max($lengths) + Helper::width($this->style->getCellRowContentFormat()) - 2;
  67159. }
  67160. }
  67161. private function getColumnSeparatorWidth(): int
  67162. {
  67163. return Helper::width(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
  67164. }
  67165. private function getCellWidth(array $row, int $column): int
  67166. {
  67167. $cellWidth = 0;
  67168. if (isset($row[$column])) {
  67169. $cell = $row[$column];
  67170. $cellWidth = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $cell));
  67171. }
  67172. $columnWidth = $this->columnWidths[$column] ?? 0;
  67173. $cellWidth = max($cellWidth, $columnWidth);
  67174. return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
  67175. }
  67176. private function cleanup()
  67177. {
  67178. $this->effectiveColumnWidths = [];
  67179. $this->numberOfColumns = null;
  67180. }
  67181. private static function initStyles(): array
  67182. {
  67183. $borderless = new TableStyle();
  67184. $borderless
  67185. ->setHorizontalBorderChars('=')
  67186. ->setVerticalBorderChars(' ')
  67187. ->setDefaultCrossingChar(' ')
  67188. ;
  67189. $compact = new TableStyle();
  67190. $compact
  67191. ->setHorizontalBorderChars('')
  67192. ->setVerticalBorderChars('')
  67193. ->setDefaultCrossingChar('')
  67194. ->setCellRowContentFormat('%s ')
  67195. ;
  67196. $styleGuide = new TableStyle();
  67197. $styleGuide
  67198. ->setHorizontalBorderChars('-')
  67199. ->setVerticalBorderChars(' ')
  67200. ->setDefaultCrossingChar(' ')
  67201. ->setCellHeaderFormat('%s')
  67202. ;
  67203. $box = (new TableStyle())
  67204. ->setHorizontalBorderChars('─')
  67205. ->setVerticalBorderChars('│')
  67206. ->setCrossingChars('┼', '┌', '┬', '�', '┤', '┘', '┴', '└', '├')
  67207. ;
  67208. $boxDouble = (new TableStyle())
  67209. ->setHorizontalBorderChars('�', '─')
  67210. ->setVerticalBorderChars('║', '│')
  67211. ->setCrossingChars('┼', '╔', '╤', '╗', '╢', '�', '╧', '╚', '╟', '╠', '╪', '╣')
  67212. ;
  67213. return [
  67214. 'default' => new TableStyle(),
  67215. 'borderless' => $borderless,
  67216. 'compact' => $compact,
  67217. 'symfony-style-guide' => $styleGuide,
  67218. 'box' => $box,
  67219. 'box-double' => $boxDouble,
  67220. ];
  67221. }
  67222. private function resolveStyle($name): TableStyle
  67223. {
  67224. if ($name instanceof TableStyle) {
  67225. return $name;
  67226. }
  67227. if (isset(self::$styles[$name])) {
  67228. return self::$styles[$name];
  67229. }
  67230. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  67231. }
  67232. }
  67233. <?php
  67234. namespace Symfony\Component\Console\Helper;
  67235. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67236. class TableCell
  67237. {
  67238. private $value;
  67239. private $options = [
  67240. 'rowspan' => 1,
  67241. 'colspan' => 1,
  67242. 'style' => null,
  67243. ];
  67244. public function __construct(string $value = '', array $options = [])
  67245. {
  67246. $this->value = $value;
  67247. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  67248. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  67249. }
  67250. if (isset($options['style']) && !$options['style'] instanceof TableCellStyle) {
  67251. throw new InvalidArgumentException('The style option must be an instance of "TableCellStyle".');
  67252. }
  67253. $this->options = array_merge($this->options, $options);
  67254. }
  67255. public function __toString()
  67256. {
  67257. return $this->value;
  67258. }
  67259. public function getColspan()
  67260. {
  67261. return (int) $this->options['colspan'];
  67262. }
  67263. public function getRowspan()
  67264. {
  67265. return (int) $this->options['rowspan'];
  67266. }
  67267. public function getStyle(): ?TableCellStyle
  67268. {
  67269. return $this->options['style'];
  67270. }
  67271. }
  67272. <?php
  67273. namespace Symfony\Component\Console\Helper;
  67274. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67275. class TableCellStyle
  67276. {
  67277. public const DEFAULT_ALIGN = 'left';
  67278. private const TAG_OPTIONS = [
  67279. 'fg',
  67280. 'bg',
  67281. 'options',
  67282. ];
  67283. private const ALIGN_MAP = [
  67284. 'left' => \STR_PAD_RIGHT,
  67285. 'center' => \STR_PAD_BOTH,
  67286. 'right' => \STR_PAD_LEFT,
  67287. ];
  67288. private $options = [
  67289. 'fg' => 'default',
  67290. 'bg' => 'default',
  67291. 'options' => null,
  67292. 'align' => self::DEFAULT_ALIGN,
  67293. 'cellFormat' => null,
  67294. ];
  67295. public function __construct(array $options = [])
  67296. {
  67297. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  67298. throw new InvalidArgumentException(sprintf('The TableCellStyle does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  67299. }
  67300. if (isset($options['align']) && !\array_key_exists($options['align'], self::ALIGN_MAP)) {
  67301. throw new InvalidArgumentException(sprintf('Wrong align value. Value must be following: \'%s\'.', implode('\', \'', array_keys(self::ALIGN_MAP))));
  67302. }
  67303. $this->options = array_merge($this->options, $options);
  67304. }
  67305. public function getOptions(): array
  67306. {
  67307. return $this->options;
  67308. }
  67309. public function getTagOptions()
  67310. {
  67311. return array_filter(
  67312. $this->getOptions(),
  67313. function ($key) {
  67314. return \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]);
  67315. },
  67316. \ARRAY_FILTER_USE_KEY
  67317. );
  67318. }
  67319. public function getPadByAlign()
  67320. {
  67321. return self::ALIGN_MAP[$this->getOptions()['align']];
  67322. }
  67323. public function getCellFormat(): ?string
  67324. {
  67325. return $this->getOptions()['cellFormat'];
  67326. }
  67327. }
  67328. <?php
  67329. namespace Symfony\Component\Console\Helper;
  67330. class TableRows implements \IteratorAggregate
  67331. {
  67332. private $generator;
  67333. public function __construct(\Closure $generator)
  67334. {
  67335. $this->generator = $generator;
  67336. }
  67337. public function getIterator(): \Traversable
  67338. {
  67339. return ($this->generator)();
  67340. }
  67341. }
  67342. <?php
  67343. namespace Symfony\Component\Console\Helper;
  67344. class TableSeparator extends TableCell
  67345. {
  67346. public function __construct(array $options = [])
  67347. {
  67348. parent::__construct('', $options);
  67349. }
  67350. }
  67351. <?php
  67352. namespace Symfony\Component\Console\Helper;
  67353. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67354. use Symfony\Component\Console\Exception\LogicException;
  67355. class TableStyle
  67356. {
  67357. private $paddingChar = ' ';
  67358. private $horizontalOutsideBorderChar = '-';
  67359. private $horizontalInsideBorderChar = '-';
  67360. private $verticalOutsideBorderChar = '|';
  67361. private $verticalInsideBorderChar = '|';
  67362. private $crossingChar = '+';
  67363. private $crossingTopRightChar = '+';
  67364. private $crossingTopMidChar = '+';
  67365. private $crossingTopLeftChar = '+';
  67366. private $crossingMidRightChar = '+';
  67367. private $crossingBottomRightChar = '+';
  67368. private $crossingBottomMidChar = '+';
  67369. private $crossingBottomLeftChar = '+';
  67370. private $crossingMidLeftChar = '+';
  67371. private $crossingTopLeftBottomChar = '+';
  67372. private $crossingTopMidBottomChar = '+';
  67373. private $crossingTopRightBottomChar = '+';
  67374. private $headerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
  67375. private $footerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
  67376. private $cellHeaderFormat = '<info>%s</info>';
  67377. private $cellRowFormat = '%s';
  67378. private $cellRowContentFormat = ' %s ';
  67379. private $borderFormat = '%s';
  67380. private $padType = \STR_PAD_RIGHT;
  67381. public function setPaddingChar(string $paddingChar)
  67382. {
  67383. if (!$paddingChar) {
  67384. throw new LogicException('The padding char must not be empty.');
  67385. }
  67386. $this->paddingChar = $paddingChar;
  67387. return $this;
  67388. }
  67389. public function getPaddingChar()
  67390. {
  67391. return $this->paddingChar;
  67392. }
  67393. public function setHorizontalBorderChars(string $outside, ?string $inside = null): self
  67394. {
  67395. $this->horizontalOutsideBorderChar = $outside;
  67396. $this->horizontalInsideBorderChar = $inside ?? $outside;
  67397. return $this;
  67398. }
  67399. public function setVerticalBorderChars(string $outside, ?string $inside = null): self
  67400. {
  67401. $this->verticalOutsideBorderChar = $outside;
  67402. $this->verticalInsideBorderChar = $inside ?? $outside;
  67403. return $this;
  67404. }
  67405. public function getBorderChars(): array
  67406. {
  67407. return [
  67408. $this->horizontalOutsideBorderChar,
  67409. $this->verticalOutsideBorderChar,
  67410. $this->horizontalInsideBorderChar,
  67411. $this->verticalInsideBorderChar,
  67412. ];
  67413. }
  67414. public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, ?string $topLeftBottom = null, ?string $topMidBottom = null, ?string $topRightBottom = null): self
  67415. {
  67416. $this->crossingChar = $cross;
  67417. $this->crossingTopLeftChar = $topLeft;
  67418. $this->crossingTopMidChar = $topMid;
  67419. $this->crossingTopRightChar = $topRight;
  67420. $this->crossingMidRightChar = $midRight;
  67421. $this->crossingBottomRightChar = $bottomRight;
  67422. $this->crossingBottomMidChar = $bottomMid;
  67423. $this->crossingBottomLeftChar = $bottomLeft;
  67424. $this->crossingMidLeftChar = $midLeft;
  67425. $this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
  67426. $this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
  67427. $this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
  67428. return $this;
  67429. }
  67430. public function setDefaultCrossingChar(string $char): self
  67431. {
  67432. return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
  67433. }
  67434. public function getCrossingChar()
  67435. {
  67436. return $this->crossingChar;
  67437. }
  67438. public function getCrossingChars(): array
  67439. {
  67440. return [
  67441. $this->crossingChar,
  67442. $this->crossingTopLeftChar,
  67443. $this->crossingTopMidChar,
  67444. $this->crossingTopRightChar,
  67445. $this->crossingMidRightChar,
  67446. $this->crossingBottomRightChar,
  67447. $this->crossingBottomMidChar,
  67448. $this->crossingBottomLeftChar,
  67449. $this->crossingMidLeftChar,
  67450. $this->crossingTopLeftBottomChar,
  67451. $this->crossingTopMidBottomChar,
  67452. $this->crossingTopRightBottomChar,
  67453. ];
  67454. }
  67455. public function setCellHeaderFormat(string $cellHeaderFormat)
  67456. {
  67457. $this->cellHeaderFormat = $cellHeaderFormat;
  67458. return $this;
  67459. }
  67460. public function getCellHeaderFormat()
  67461. {
  67462. return $this->cellHeaderFormat;
  67463. }
  67464. public function setCellRowFormat(string $cellRowFormat)
  67465. {
  67466. $this->cellRowFormat = $cellRowFormat;
  67467. return $this;
  67468. }
  67469. public function getCellRowFormat()
  67470. {
  67471. return $this->cellRowFormat;
  67472. }
  67473. public function setCellRowContentFormat(string $cellRowContentFormat)
  67474. {
  67475. $this->cellRowContentFormat = $cellRowContentFormat;
  67476. return $this;
  67477. }
  67478. public function getCellRowContentFormat()
  67479. {
  67480. return $this->cellRowContentFormat;
  67481. }
  67482. public function setBorderFormat(string $borderFormat)
  67483. {
  67484. $this->borderFormat = $borderFormat;
  67485. return $this;
  67486. }
  67487. public function getBorderFormat()
  67488. {
  67489. return $this->borderFormat;
  67490. }
  67491. public function setPadType(int $padType)
  67492. {
  67493. if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
  67494. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  67495. }
  67496. $this->padType = $padType;
  67497. return $this;
  67498. }
  67499. public function getPadType()
  67500. {
  67501. return $this->padType;
  67502. }
  67503. public function getHeaderTitleFormat(): string
  67504. {
  67505. return $this->headerTitleFormat;
  67506. }
  67507. public function setHeaderTitleFormat(string $format): self
  67508. {
  67509. $this->headerTitleFormat = $format;
  67510. return $this;
  67511. }
  67512. public function getFooterTitleFormat(): string
  67513. {
  67514. return $this->footerTitleFormat;
  67515. }
  67516. public function setFooterTitleFormat(string $format): self
  67517. {
  67518. $this->footerTitleFormat = $format;
  67519. return $this;
  67520. }
  67521. }
  67522. <?php
  67523. namespace Symfony\Component\Console\Input;
  67524. use Symfony\Component\Console\Exception\RuntimeException;
  67525. class ArgvInput extends Input
  67526. {
  67527. private $tokens;
  67528. private $parsed;
  67529. public function __construct(?array $argv = null, ?InputDefinition $definition = null)
  67530. {
  67531. $argv = $argv ?? $_SERVER['argv'] ?? [];
  67532. array_shift($argv);
  67533. $this->tokens = $argv;
  67534. parent::__construct($definition);
  67535. }
  67536. protected function setTokens(array $tokens)
  67537. {
  67538. $this->tokens = $tokens;
  67539. }
  67540. protected function parse()
  67541. {
  67542. $parseOptions = true;
  67543. $this->parsed = $this->tokens;
  67544. while (null !== $token = array_shift($this->parsed)) {
  67545. $parseOptions = $this->parseToken($token, $parseOptions);
  67546. }
  67547. }
  67548. protected function parseToken(string $token, bool $parseOptions): bool
  67549. {
  67550. if ($parseOptions && '' == $token) {
  67551. $this->parseArgument($token);
  67552. } elseif ($parseOptions && '--' == $token) {
  67553. return false;
  67554. } elseif ($parseOptions && str_starts_with($token, '--')) {
  67555. $this->parseLongOption($token);
  67556. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  67557. $this->parseShortOption($token);
  67558. } else {
  67559. $this->parseArgument($token);
  67560. }
  67561. return $parseOptions;
  67562. }
  67563. private function parseShortOption(string $token)
  67564. {
  67565. $name = substr($token, 1);
  67566. if (\strlen($name) > 1) {
  67567. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  67568. $this->addShortOption($name[0], substr($name, 1));
  67569. } else {
  67570. $this->parseShortOptionSet($name);
  67571. }
  67572. } else {
  67573. $this->addShortOption($name, null);
  67574. }
  67575. }
  67576. private function parseShortOptionSet(string $name)
  67577. {
  67578. $len = \strlen($name);
  67579. for ($i = 0; $i < $len; ++$i) {
  67580. if (!$this->definition->hasShortcut($name[$i])) {
  67581. $encoding = mb_detect_encoding($name, null, true);
  67582. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  67583. }
  67584. $option = $this->definition->getOptionForShortcut($name[$i]);
  67585. if ($option->acceptValue()) {
  67586. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  67587. break;
  67588. } else {
  67589. $this->addLongOption($option->getName(), null);
  67590. }
  67591. }
  67592. }
  67593. private function parseLongOption(string $token)
  67594. {
  67595. $name = substr($token, 2);
  67596. if (false !== $pos = strpos($name, '=')) {
  67597. if ('' === $value = substr($name, $pos + 1)) {
  67598. array_unshift($this->parsed, $value);
  67599. }
  67600. $this->addLongOption(substr($name, 0, $pos), $value);
  67601. } else {
  67602. $this->addLongOption($name, null);
  67603. }
  67604. }
  67605. private function parseArgument(string $token)
  67606. {
  67607. $c = \count($this->arguments);
  67608. if ($this->definition->hasArgument($c)) {
  67609. $arg = $this->definition->getArgument($c);
  67610. $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
  67611. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  67612. $arg = $this->definition->getArgument($c - 1);
  67613. $this->arguments[$arg->getName()][] = $token;
  67614. } else {
  67615. $all = $this->definition->getArguments();
  67616. $symfonyCommandName = null;
  67617. if (($inputArgument = $all[$key = array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) {
  67618. $symfonyCommandName = $this->arguments['command'] ?? null;
  67619. unset($all[$key]);
  67620. }
  67621. if (\count($all)) {
  67622. if ($symfonyCommandName) {
  67623. $message = sprintf('Too many arguments to "%s" command, expected arguments "%s".', $symfonyCommandName, implode('" "', array_keys($all)));
  67624. } else {
  67625. $message = sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)));
  67626. }
  67627. } elseif ($symfonyCommandName) {
  67628. $message = sprintf('No arguments expected for "%s" command, got "%s".', $symfonyCommandName, $token);
  67629. } else {
  67630. $message = sprintf('No arguments expected, got "%s".', $token);
  67631. }
  67632. throw new RuntimeException($message);
  67633. }
  67634. }
  67635. private function addShortOption(string $shortcut, $value)
  67636. {
  67637. if (!$this->definition->hasShortcut($shortcut)) {
  67638. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  67639. }
  67640. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  67641. }
  67642. private function addLongOption(string $name, $value)
  67643. {
  67644. if (!$this->definition->hasOption($name)) {
  67645. if (!$this->definition->hasNegation($name)) {
  67646. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  67647. }
  67648. $optionName = $this->definition->negationToName($name);
  67649. if (null !== $value) {
  67650. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  67651. }
  67652. $this->options[$optionName] = false;
  67653. return;
  67654. }
  67655. $option = $this->definition->getOption($name);
  67656. if (null !== $value && !$option->acceptValue()) {
  67657. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  67658. }
  67659. if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {
  67660. $next = array_shift($this->parsed);
  67661. if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, ['', null], true)) {
  67662. $value = $next;
  67663. } else {
  67664. array_unshift($this->parsed, $next);
  67665. }
  67666. }
  67667. if (null === $value) {
  67668. if ($option->isValueRequired()) {
  67669. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  67670. }
  67671. if (!$option->isArray() && !$option->isValueOptional()) {
  67672. $value = true;
  67673. }
  67674. }
  67675. if ($option->isArray()) {
  67676. $this->options[$name][] = $value;
  67677. } else {
  67678. $this->options[$name] = $value;
  67679. }
  67680. }
  67681. public function getFirstArgument()
  67682. {
  67683. $isOption = false;
  67684. foreach ($this->tokens as $i => $token) {
  67685. if ($token && '-' === $token[0]) {
  67686. if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) {
  67687. continue;
  67688. }
  67689. $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1);
  67690. if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) {
  67691. } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) {
  67692. $isOption = true;
  67693. }
  67694. continue;
  67695. }
  67696. if ($isOption) {
  67697. $isOption = false;
  67698. continue;
  67699. }
  67700. return $token;
  67701. }
  67702. return null;
  67703. }
  67704. public function hasParameterOption($values, bool $onlyParams = false)
  67705. {
  67706. $values = (array) $values;
  67707. foreach ($this->tokens as $token) {
  67708. if ($onlyParams && '--' === $token) {
  67709. return false;
  67710. }
  67711. foreach ($values as $value) {
  67712. $leading = str_starts_with($value, '--') ? $value.'=' : $value;
  67713. if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
  67714. return true;
  67715. }
  67716. }
  67717. }
  67718. return false;
  67719. }
  67720. public function getParameterOption($values, $default = false, bool $onlyParams = false)
  67721. {
  67722. $values = (array) $values;
  67723. $tokens = $this->tokens;
  67724. while (0 < \count($tokens)) {
  67725. $token = array_shift($tokens);
  67726. if ($onlyParams && '--' === $token) {
  67727. return $default;
  67728. }
  67729. foreach ($values as $value) {
  67730. if ($token === $value) {
  67731. return array_shift($tokens);
  67732. }
  67733. $leading = str_starts_with($value, '--') ? $value.'=' : $value;
  67734. if ('' !== $leading && str_starts_with($token, $leading)) {
  67735. return substr($token, \strlen($leading));
  67736. }
  67737. }
  67738. }
  67739. return $default;
  67740. }
  67741. public function __toString()
  67742. {
  67743. $tokens = array_map(function ($token) {
  67744. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  67745. return $match[1].$this->escapeToken($match[2]);
  67746. }
  67747. if ($token && '-' !== $token[0]) {
  67748. return $this->escapeToken($token);
  67749. }
  67750. return $token;
  67751. }, $this->tokens);
  67752. return implode(' ', $tokens);
  67753. }
  67754. }
  67755. <?php
  67756. namespace Symfony\Component\Console\Input;
  67757. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67758. use Symfony\Component\Console\Exception\InvalidOptionException;
  67759. class ArrayInput extends Input
  67760. {
  67761. private $parameters;
  67762. public function __construct(array $parameters, ?InputDefinition $definition = null)
  67763. {
  67764. $this->parameters = $parameters;
  67765. parent::__construct($definition);
  67766. }
  67767. public function getFirstArgument()
  67768. {
  67769. foreach ($this->parameters as $param => $value) {
  67770. if ($param && \is_string($param) && '-' === $param[0]) {
  67771. continue;
  67772. }
  67773. return $value;
  67774. }
  67775. return null;
  67776. }
  67777. public function hasParameterOption($values, bool $onlyParams = false)
  67778. {
  67779. $values = (array) $values;
  67780. foreach ($this->parameters as $k => $v) {
  67781. if (!\is_int($k)) {
  67782. $v = $k;
  67783. }
  67784. if ($onlyParams && '--' === $v) {
  67785. return false;
  67786. }
  67787. if (\in_array($v, $values)) {
  67788. return true;
  67789. }
  67790. }
  67791. return false;
  67792. }
  67793. public function getParameterOption($values, $default = false, bool $onlyParams = false)
  67794. {
  67795. $values = (array) $values;
  67796. foreach ($this->parameters as $k => $v) {
  67797. if ($onlyParams && ('--' === $k || (\is_int($k) && '--' === $v))) {
  67798. return $default;
  67799. }
  67800. if (\is_int($k)) {
  67801. if (\in_array($v, $values)) {
  67802. return true;
  67803. }
  67804. } elseif (\in_array($k, $values)) {
  67805. return $v;
  67806. }
  67807. }
  67808. return $default;
  67809. }
  67810. public function __toString()
  67811. {
  67812. $params = [];
  67813. foreach ($this->parameters as $param => $val) {
  67814. if ($param && \is_string($param) && '-' === $param[0]) {
  67815. $glue = ('-' === $param[1]) ? '=' : ' ';
  67816. if (\is_array($val)) {
  67817. foreach ($val as $v) {
  67818. $params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : '');
  67819. }
  67820. } else {
  67821. $params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : '');
  67822. }
  67823. } else {
  67824. $params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val);
  67825. }
  67826. }
  67827. return implode(' ', $params);
  67828. }
  67829. protected function parse()
  67830. {
  67831. foreach ($this->parameters as $key => $value) {
  67832. if ('--' === $key) {
  67833. return;
  67834. }
  67835. if (str_starts_with($key, '--')) {
  67836. $this->addLongOption(substr($key, 2), $value);
  67837. } elseif (str_starts_with($key, '-')) {
  67838. $this->addShortOption(substr($key, 1), $value);
  67839. } else {
  67840. $this->addArgument($key, $value);
  67841. }
  67842. }
  67843. }
  67844. private function addShortOption(string $shortcut, $value)
  67845. {
  67846. if (!$this->definition->hasShortcut($shortcut)) {
  67847. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  67848. }
  67849. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  67850. }
  67851. private function addLongOption(string $name, $value)
  67852. {
  67853. if (!$this->definition->hasOption($name)) {
  67854. if (!$this->definition->hasNegation($name)) {
  67855. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  67856. }
  67857. $optionName = $this->definition->negationToName($name);
  67858. $this->options[$optionName] = false;
  67859. return;
  67860. }
  67861. $option = $this->definition->getOption($name);
  67862. if (null === $value) {
  67863. if ($option->isValueRequired()) {
  67864. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  67865. }
  67866. if (!$option->isValueOptional()) {
  67867. $value = true;
  67868. }
  67869. }
  67870. $this->options[$name] = $value;
  67871. }
  67872. private function addArgument($name, $value)
  67873. {
  67874. if (!$this->definition->hasArgument($name)) {
  67875. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  67876. }
  67877. $this->arguments[$name] = $value;
  67878. }
  67879. }
  67880. <?php
  67881. namespace Symfony\Component\Console\Input;
  67882. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67883. use Symfony\Component\Console\Exception\RuntimeException;
  67884. abstract class Input implements InputInterface, StreamableInputInterface
  67885. {
  67886. protected $definition;
  67887. protected $stream;
  67888. protected $options = [];
  67889. protected $arguments = [];
  67890. protected $interactive = true;
  67891. public function __construct(?InputDefinition $definition = null)
  67892. {
  67893. if (null === $definition) {
  67894. $this->definition = new InputDefinition();
  67895. } else {
  67896. $this->bind($definition);
  67897. $this->validate();
  67898. }
  67899. }
  67900. public function bind(InputDefinition $definition)
  67901. {
  67902. $this->arguments = [];
  67903. $this->options = [];
  67904. $this->definition = $definition;
  67905. $this->parse();
  67906. }
  67907. abstract protected function parse();
  67908. public function validate()
  67909. {
  67910. $definition = $this->definition;
  67911. $givenArguments = $this->arguments;
  67912. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  67913. return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  67914. });
  67915. if (\count($missingArguments) > 0) {
  67916. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  67917. }
  67918. }
  67919. public function isInteractive()
  67920. {
  67921. return $this->interactive;
  67922. }
  67923. public function setInteractive(bool $interactive)
  67924. {
  67925. $this->interactive = $interactive;
  67926. }
  67927. public function getArguments()
  67928. {
  67929. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  67930. }
  67931. public function getArgument(string $name)
  67932. {
  67933. if (!$this->definition->hasArgument($name)) {
  67934. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  67935. }
  67936. return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
  67937. }
  67938. public function setArgument(string $name, $value)
  67939. {
  67940. if (!$this->definition->hasArgument($name)) {
  67941. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  67942. }
  67943. $this->arguments[$name] = $value;
  67944. }
  67945. public function hasArgument(string $name)
  67946. {
  67947. return $this->definition->hasArgument($name);
  67948. }
  67949. public function getOptions()
  67950. {
  67951. return array_merge($this->definition->getOptionDefaults(), $this->options);
  67952. }
  67953. public function getOption(string $name)
  67954. {
  67955. if ($this->definition->hasNegation($name)) {
  67956. if (null === $value = $this->getOption($this->definition->negationToName($name))) {
  67957. return $value;
  67958. }
  67959. return !$value;
  67960. }
  67961. if (!$this->definition->hasOption($name)) {
  67962. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  67963. }
  67964. return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  67965. }
  67966. public function setOption(string $name, $value)
  67967. {
  67968. if ($this->definition->hasNegation($name)) {
  67969. $this->options[$this->definition->negationToName($name)] = !$value;
  67970. return;
  67971. } elseif (!$this->definition->hasOption($name)) {
  67972. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  67973. }
  67974. $this->options[$name] = $value;
  67975. }
  67976. public function hasOption(string $name)
  67977. {
  67978. return $this->definition->hasOption($name) || $this->definition->hasNegation($name);
  67979. }
  67980. public function escapeToken(string $token)
  67981. {
  67982. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  67983. }
  67984. public function setStream($stream)
  67985. {
  67986. $this->stream = $stream;
  67987. }
  67988. public function getStream()
  67989. {
  67990. return $this->stream;
  67991. }
  67992. }
  67993. <?php
  67994. namespace Symfony\Component\Console\Input;
  67995. use Symfony\Component\Console\Exception\InvalidArgumentException;
  67996. use Symfony\Component\Console\Exception\LogicException;
  67997. class InputArgument
  67998. {
  67999. public const REQUIRED = 1;
  68000. public const OPTIONAL = 2;
  68001. public const IS_ARRAY = 4;
  68002. private $name;
  68003. private $mode;
  68004. private $default;
  68005. private $description;
  68006. public function __construct(string $name, ?int $mode = null, string $description = '', $default = null)
  68007. {
  68008. if (null === $mode) {
  68009. $mode = self::OPTIONAL;
  68010. } elseif ($mode > 7 || $mode < 1) {
  68011. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  68012. }
  68013. $this->name = $name;
  68014. $this->mode = $mode;
  68015. $this->description = $description;
  68016. $this->setDefault($default);
  68017. }
  68018. public function getName()
  68019. {
  68020. return $this->name;
  68021. }
  68022. public function isRequired()
  68023. {
  68024. return self::REQUIRED === (self::REQUIRED & $this->mode);
  68025. }
  68026. public function isArray()
  68027. {
  68028. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  68029. }
  68030. public function setDefault($default = null)
  68031. {
  68032. if ($this->isRequired() && null !== $default) {
  68033. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  68034. }
  68035. if ($this->isArray()) {
  68036. if (null === $default) {
  68037. $default = [];
  68038. } elseif (!\is_array($default)) {
  68039. throw new LogicException('A default value for an array argument must be an array.');
  68040. }
  68041. }
  68042. $this->default = $default;
  68043. }
  68044. public function getDefault()
  68045. {
  68046. return $this->default;
  68047. }
  68048. public function getDescription()
  68049. {
  68050. return $this->description;
  68051. }
  68052. }
  68053. <?php
  68054. namespace Symfony\Component\Console\Input;
  68055. interface InputAwareInterface
  68056. {
  68057. public function setInput(InputInterface $input);
  68058. }
  68059. <?php
  68060. namespace Symfony\Component\Console\Input;
  68061. use Symfony\Component\Console\Exception\InvalidArgumentException;
  68062. use Symfony\Component\Console\Exception\LogicException;
  68063. class InputDefinition
  68064. {
  68065. private $arguments;
  68066. private $requiredCount;
  68067. private $lastArrayArgument;
  68068. private $lastOptionalArgument;
  68069. private $options;
  68070. private $negations;
  68071. private $shortcuts;
  68072. public function __construct(array $definition = [])
  68073. {
  68074. $this->setDefinition($definition);
  68075. }
  68076. public function setDefinition(array $definition)
  68077. {
  68078. $arguments = [];
  68079. $options = [];
  68080. foreach ($definition as $item) {
  68081. if ($item instanceof InputOption) {
  68082. $options[] = $item;
  68083. } else {
  68084. $arguments[] = $item;
  68085. }
  68086. }
  68087. $this->setArguments($arguments);
  68088. $this->setOptions($options);
  68089. }
  68090. public function setArguments(array $arguments = [])
  68091. {
  68092. $this->arguments = [];
  68093. $this->requiredCount = 0;
  68094. $this->lastOptionalArgument = null;
  68095. $this->lastArrayArgument = null;
  68096. $this->addArguments($arguments);
  68097. }
  68098. public function addArguments(?array $arguments = [])
  68099. {
  68100. if (null !== $arguments) {
  68101. foreach ($arguments as $argument) {
  68102. $this->addArgument($argument);
  68103. }
  68104. }
  68105. }
  68106. public function addArgument(InputArgument $argument)
  68107. {
  68108. if (isset($this->arguments[$argument->getName()])) {
  68109. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  68110. }
  68111. if (null !== $this->lastArrayArgument) {
  68112. throw new LogicException(sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName()));
  68113. }
  68114. if ($argument->isRequired() && null !== $this->lastOptionalArgument) {
  68115. throw new LogicException(sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName()));
  68116. }
  68117. if ($argument->isArray()) {
  68118. $this->lastArrayArgument = $argument;
  68119. }
  68120. if ($argument->isRequired()) {
  68121. ++$this->requiredCount;
  68122. } else {
  68123. $this->lastOptionalArgument = $argument;
  68124. }
  68125. $this->arguments[$argument->getName()] = $argument;
  68126. }
  68127. public function getArgument($name)
  68128. {
  68129. if (!$this->hasArgument($name)) {
  68130. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  68131. }
  68132. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  68133. return $arguments[$name];
  68134. }
  68135. public function hasArgument($name)
  68136. {
  68137. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  68138. return isset($arguments[$name]);
  68139. }
  68140. public function getArguments()
  68141. {
  68142. return $this->arguments;
  68143. }
  68144. public function getArgumentCount()
  68145. {
  68146. return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count($this->arguments);
  68147. }
  68148. public function getArgumentRequiredCount()
  68149. {
  68150. return $this->requiredCount;
  68151. }
  68152. public function getArgumentDefaults()
  68153. {
  68154. $values = [];
  68155. foreach ($this->arguments as $argument) {
  68156. $values[$argument->getName()] = $argument->getDefault();
  68157. }
  68158. return $values;
  68159. }
  68160. public function setOptions(array $options = [])
  68161. {
  68162. $this->options = [];
  68163. $this->shortcuts = [];
  68164. $this->negations = [];
  68165. $this->addOptions($options);
  68166. }
  68167. public function addOptions(array $options = [])
  68168. {
  68169. foreach ($options as $option) {
  68170. $this->addOption($option);
  68171. }
  68172. }
  68173. public function addOption(InputOption $option)
  68174. {
  68175. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  68176. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  68177. }
  68178. if (isset($this->negations[$option->getName()])) {
  68179. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  68180. }
  68181. if ($option->getShortcut()) {
  68182. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  68183. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  68184. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  68185. }
  68186. }
  68187. }
  68188. $this->options[$option->getName()] = $option;
  68189. if ($option->getShortcut()) {
  68190. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  68191. $this->shortcuts[$shortcut] = $option->getName();
  68192. }
  68193. }
  68194. if ($option->isNegatable()) {
  68195. $negatedName = 'no-'.$option->getName();
  68196. if (isset($this->options[$negatedName])) {
  68197. throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName));
  68198. }
  68199. $this->negations[$negatedName] = $option->getName();
  68200. }
  68201. }
  68202. public function getOption(string $name)
  68203. {
  68204. if (!$this->hasOption($name)) {
  68205. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  68206. }
  68207. return $this->options[$name];
  68208. }
  68209. public function hasOption(string $name)
  68210. {
  68211. return isset($this->options[$name]);
  68212. }
  68213. public function getOptions()
  68214. {
  68215. return $this->options;
  68216. }
  68217. public function hasShortcut(string $name)
  68218. {
  68219. return isset($this->shortcuts[$name]);
  68220. }
  68221. public function hasNegation(string $name): bool
  68222. {
  68223. return isset($this->negations[$name]);
  68224. }
  68225. public function getOptionForShortcut(string $shortcut)
  68226. {
  68227. return $this->getOption($this->shortcutToName($shortcut));
  68228. }
  68229. public function getOptionDefaults()
  68230. {
  68231. $values = [];
  68232. foreach ($this->options as $option) {
  68233. $values[$option->getName()] = $option->getDefault();
  68234. }
  68235. return $values;
  68236. }
  68237. public function shortcutToName(string $shortcut): string
  68238. {
  68239. if (!isset($this->shortcuts[$shortcut])) {
  68240. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  68241. }
  68242. return $this->shortcuts[$shortcut];
  68243. }
  68244. public function negationToName(string $negation): string
  68245. {
  68246. if (!isset($this->negations[$negation])) {
  68247. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation));
  68248. }
  68249. return $this->negations[$negation];
  68250. }
  68251. public function getSynopsis(bool $short = false)
  68252. {
  68253. $elements = [];
  68254. if ($short && $this->getOptions()) {
  68255. $elements[] = '[options]';
  68256. } elseif (!$short) {
  68257. foreach ($this->getOptions() as $option) {
  68258. $value = '';
  68259. if ($option->acceptValue()) {
  68260. $value = sprintf(
  68261. ' %s%s%s',
  68262. $option->isValueOptional() ? '[' : '',
  68263. strtoupper($option->getName()),
  68264. $option->isValueOptional() ? ']' : ''
  68265. );
  68266. }
  68267. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  68268. $negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : '';
  68269. $elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
  68270. }
  68271. }
  68272. if (\count($elements) && $this->getArguments()) {
  68273. $elements[] = '[--]';
  68274. }
  68275. $tail = '';
  68276. foreach ($this->getArguments() as $argument) {
  68277. $element = '<'.$argument->getName().'>';
  68278. if ($argument->isArray()) {
  68279. $element .= '...';
  68280. }
  68281. if (!$argument->isRequired()) {
  68282. $element = '['.$element;
  68283. $tail .= ']';
  68284. }
  68285. $elements[] = $element;
  68286. }
  68287. return implode(' ', $elements).$tail;
  68288. }
  68289. }
  68290. <?php
  68291. namespace Symfony\Component\Console\Input;
  68292. use Symfony\Component\Console\Exception\InvalidArgumentException;
  68293. use Symfony\Component\Console\Exception\RuntimeException;
  68294. interface InputInterface
  68295. {
  68296. public function getFirstArgument();
  68297. public function hasParameterOption($values, bool $onlyParams = false);
  68298. public function getParameterOption($values, $default = false, bool $onlyParams = false);
  68299. public function bind(InputDefinition $definition);
  68300. public function validate();
  68301. public function getArguments();
  68302. public function getArgument(string $name);
  68303. public function setArgument(string $name, $value);
  68304. public function hasArgument(string $name);
  68305. public function getOptions();
  68306. public function getOption(string $name);
  68307. public function setOption(string $name, $value);
  68308. public function hasOption(string $name);
  68309. public function isInteractive();
  68310. public function setInteractive(bool $interactive);
  68311. }
  68312. <?php
  68313. namespace Symfony\Component\Console\Input;
  68314. use Symfony\Component\Console\Exception\InvalidArgumentException;
  68315. use Symfony\Component\Console\Exception\LogicException;
  68316. class InputOption
  68317. {
  68318. public const VALUE_NONE = 1;
  68319. public const VALUE_REQUIRED = 2;
  68320. public const VALUE_OPTIONAL = 4;
  68321. public const VALUE_IS_ARRAY = 8;
  68322. public const VALUE_NEGATABLE = 16;
  68323. private $name;
  68324. private $shortcut;
  68325. private $mode;
  68326. private $default;
  68327. private $description;
  68328. public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null)
  68329. {
  68330. if (str_starts_with($name, '--')) {
  68331. $name = substr($name, 2);
  68332. }
  68333. if (empty($name)) {
  68334. throw new InvalidArgumentException('An option name cannot be empty.');
  68335. }
  68336. if ('' === $shortcut || [] === $shortcut || false === $shortcut) {
  68337. $shortcut = null;
  68338. }
  68339. if (null !== $shortcut) {
  68340. if (\is_array($shortcut)) {
  68341. $shortcut = implode('|', $shortcut);
  68342. }
  68343. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  68344. $shortcuts = array_filter($shortcuts, 'strlen');
  68345. $shortcut = implode('|', $shortcuts);
  68346. if ('' === $shortcut) {
  68347. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  68348. }
  68349. }
  68350. if (null === $mode) {
  68351. $mode = self::VALUE_NONE;
  68352. } elseif ($mode >= (self::VALUE_NEGATABLE << 1) || $mode < 1) {
  68353. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  68354. }
  68355. $this->name = $name;
  68356. $this->shortcut = $shortcut;
  68357. $this->mode = $mode;
  68358. $this->description = $description;
  68359. if ($this->isArray() && !$this->acceptValue()) {
  68360. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  68361. }
  68362. if ($this->isNegatable() && $this->acceptValue()) {
  68363. throw new InvalidArgumentException('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.');
  68364. }
  68365. $this->setDefault($default);
  68366. }
  68367. public function getShortcut()
  68368. {
  68369. return $this->shortcut;
  68370. }
  68371. public function getName()
  68372. {
  68373. return $this->name;
  68374. }
  68375. public function acceptValue()
  68376. {
  68377. return $this->isValueRequired() || $this->isValueOptional();
  68378. }
  68379. public function isValueRequired()
  68380. {
  68381. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  68382. }
  68383. public function isValueOptional()
  68384. {
  68385. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  68386. }
  68387. public function isArray()
  68388. {
  68389. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  68390. }
  68391. public function isNegatable(): bool
  68392. {
  68393. return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode);
  68394. }
  68395. public function setDefault($default = null)
  68396. {
  68397. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  68398. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  68399. }
  68400. if ($this->isArray()) {
  68401. if (null === $default) {
  68402. $default = [];
  68403. } elseif (!\is_array($default)) {
  68404. throw new LogicException('A default value for an array option must be an array.');
  68405. }
  68406. }
  68407. $this->default = $this->acceptValue() || $this->isNegatable() ? $default : false;
  68408. }
  68409. public function getDefault()
  68410. {
  68411. return $this->default;
  68412. }
  68413. public function getDescription()
  68414. {
  68415. return $this->description;
  68416. }
  68417. public function equals(self $option)
  68418. {
  68419. return $option->getName() === $this->getName()
  68420. && $option->getShortcut() === $this->getShortcut()
  68421. && $option->getDefault() === $this->getDefault()
  68422. && $option->isNegatable() === $this->isNegatable()
  68423. && $option->isArray() === $this->isArray()
  68424. && $option->isValueRequired() === $this->isValueRequired()
  68425. && $option->isValueOptional() === $this->isValueOptional()
  68426. ;
  68427. }
  68428. }
  68429. <?php
  68430. namespace Symfony\Component\Console\Input;
  68431. interface StreamableInputInterface extends InputInterface
  68432. {
  68433. public function setStream($stream);
  68434. public function getStream();
  68435. }
  68436. <?php
  68437. namespace Symfony\Component\Console\Input;
  68438. use Symfony\Component\Console\Exception\InvalidArgumentException;
  68439. class StringInput extends ArgvInput
  68440. {
  68441. public const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  68442. public const REGEX_UNQUOTED_STRING = '([^\s\\\\]+?)';
  68443. public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  68444. public function __construct(string $input)
  68445. {
  68446. parent::__construct([]);
  68447. $this->setTokens($this->tokenize($input));
  68448. }
  68449. private function tokenize(string $input): array
  68450. {
  68451. $tokens = [];
  68452. $length = \strlen($input);
  68453. $cursor = 0;
  68454. $token = null;
  68455. while ($cursor < $length) {
  68456. if ('\\' === $input[$cursor]) {
  68457. $token .= $input[++$cursor] ?? '';
  68458. ++$cursor;
  68459. continue;
  68460. }
  68461. if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
  68462. if (null !== $token) {
  68463. $tokens[] = $token;
  68464. $token = null;
  68465. }
  68466. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
  68467. $token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
  68468. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
  68469. $token .= stripcslashes(substr($match[0], 1, -1));
  68470. } elseif (preg_match('/'.self::REGEX_UNQUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
  68471. $token .= $match[1];
  68472. } else {
  68473. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
  68474. }
  68475. $cursor += \strlen($match[0]);
  68476. }
  68477. if (null !== $token) {
  68478. $tokens[] = $token;
  68479. }
  68480. return $tokens;
  68481. }
  68482. }
  68483. Copyright (c) 2004-present Fabien Potencier
  68484. Permission is hereby granted, free of charge, to any person obtaining a copy
  68485. of this software and associated documentation files (the "Software"), to deal
  68486. in the Software without restriction, including without limitation the rights
  68487. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  68488. copies of the Software, and to permit persons to whom the Software is furnished
  68489. to do so, subject to the following conditions:
  68490. The above copyright notice and this permission notice shall be included in all
  68491. copies or substantial portions of the Software.
  68492. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  68493. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  68494. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  68495. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  68496. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  68497. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  68498. THE SOFTWARE.
  68499. <?php
  68500. namespace Symfony\Component\Console\Logger;
  68501. use Psr\Log\AbstractLogger;
  68502. use Psr\Log\InvalidArgumentException;
  68503. use Psr\Log\LogLevel;
  68504. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  68505. use Symfony\Component\Console\Output\OutputInterface;
  68506. class ConsoleLogger extends AbstractLogger
  68507. {
  68508. public const INFO = 'info';
  68509. public const ERROR = 'error';
  68510. private $output;
  68511. private $verbosityLevelMap = [
  68512. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  68513. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  68514. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  68515. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  68516. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  68517. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  68518. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  68519. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  68520. ];
  68521. private $formatLevelMap = [
  68522. LogLevel::EMERGENCY => self::ERROR,
  68523. LogLevel::ALERT => self::ERROR,
  68524. LogLevel::CRITICAL => self::ERROR,
  68525. LogLevel::ERROR => self::ERROR,
  68526. LogLevel::WARNING => self::INFO,
  68527. LogLevel::NOTICE => self::INFO,
  68528. LogLevel::INFO => self::INFO,
  68529. LogLevel::DEBUG => self::INFO,
  68530. ];
  68531. private $errored = false;
  68532. public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = [])
  68533. {
  68534. $this->output = $output;
  68535. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  68536. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  68537. }
  68538. public function log($level, $message, array $context = [])
  68539. {
  68540. if (!isset($this->verbosityLevelMap[$level])) {
  68541. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  68542. }
  68543. $output = $this->output;
  68544. if (self::ERROR === $this->formatLevelMap[$level]) {
  68545. if ($this->output instanceof ConsoleOutputInterface) {
  68546. $output = $output->getErrorOutput();
  68547. }
  68548. $this->errored = true;
  68549. }
  68550. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  68551. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)), $this->verbosityLevelMap[$level]);
  68552. }
  68553. }
  68554. public function hasErrored()
  68555. {
  68556. return $this->errored;
  68557. }
  68558. private function interpolate(string $message, array $context): string
  68559. {
  68560. if (!str_contains($message, '{')) {
  68561. return $message;
  68562. }
  68563. $replacements = [];
  68564. foreach ($context as $key => $val) {
  68565. if (null === $val || \is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) {
  68566. $replacements["{{$key}}"] = $val;
  68567. } elseif ($val instanceof \DateTimeInterface) {
  68568. $replacements["{{$key}}"] = $val->format(\DateTime::RFC3339);
  68569. } elseif (\is_object($val)) {
  68570. $replacements["{{$key}}"] = '[object '.\get_class($val).']';
  68571. } else {
  68572. $replacements["{{$key}}"] = '['.\gettype($val).']';
  68573. }
  68574. }
  68575. return strtr($message, $replacements);
  68576. }
  68577. }
  68578. <?php
  68579. namespace Symfony\Component\Console\Output;
  68580. class BufferedOutput extends Output
  68581. {
  68582. private $buffer = '';
  68583. public function fetch()
  68584. {
  68585. $content = $this->buffer;
  68586. $this->buffer = '';
  68587. return $content;
  68588. }
  68589. protected function doWrite(string $message, bool $newline)
  68590. {
  68591. $this->buffer .= $message;
  68592. if ($newline) {
  68593. $this->buffer .= \PHP_EOL;
  68594. }
  68595. }
  68596. }
  68597. <?php
  68598. namespace Symfony\Component\Console\Output;
  68599. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  68600. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  68601. {
  68602. private $stderr;
  68603. private $consoleSectionOutputs = [];
  68604. public function __construct(int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null)
  68605. {
  68606. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  68607. if (null === $formatter) {
  68608. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
  68609. return;
  68610. }
  68611. $actualDecorated = $this->isDecorated();
  68612. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  68613. if (null === $decorated) {
  68614. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  68615. }
  68616. }
  68617. public function section(): ConsoleSectionOutput
  68618. {
  68619. return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
  68620. }
  68621. public function setDecorated(bool $decorated)
  68622. {
  68623. parent::setDecorated($decorated);
  68624. $this->stderr->setDecorated($decorated);
  68625. }
  68626. public function setFormatter(OutputFormatterInterface $formatter)
  68627. {
  68628. parent::setFormatter($formatter);
  68629. $this->stderr->setFormatter($formatter);
  68630. }
  68631. public function setVerbosity(int $level)
  68632. {
  68633. parent::setVerbosity($level);
  68634. $this->stderr->setVerbosity($level);
  68635. }
  68636. public function getErrorOutput()
  68637. {
  68638. return $this->stderr;
  68639. }
  68640. public function setErrorOutput(OutputInterface $error)
  68641. {
  68642. $this->stderr = $error;
  68643. }
  68644. protected function hasStdoutSupport()
  68645. {
  68646. return false === $this->isRunningOS400();
  68647. }
  68648. protected function hasStderrSupport()
  68649. {
  68650. return false === $this->isRunningOS400();
  68651. }
  68652. private function isRunningOS400(): bool
  68653. {
  68654. $checks = [
  68655. \function_exists('php_uname') ? php_uname('s') : '',
  68656. getenv('OSTYPE'),
  68657. \PHP_OS,
  68658. ];
  68659. return false !== stripos(implode(';', $checks), 'OS400');
  68660. }
  68661. private function openOutputStream()
  68662. {
  68663. if (!$this->hasStdoutSupport()) {
  68664. return fopen('php://output', 'w');
  68665. }
  68666. return \defined('STDOUT') ? \STDOUT : (@fopen('php://stdout', 'w') ?: fopen('php://output', 'w'));
  68667. }
  68668. private function openErrorStream()
  68669. {
  68670. if (!$this->hasStderrSupport()) {
  68671. return fopen('php://output', 'w');
  68672. }
  68673. return \defined('STDERR') ? \STDERR : (@fopen('php://stderr', 'w') ?: fopen('php://output', 'w'));
  68674. }
  68675. }
  68676. <?php
  68677. namespace Symfony\Component\Console\Output;
  68678. interface ConsoleOutputInterface extends OutputInterface
  68679. {
  68680. public function getErrorOutput();
  68681. public function setErrorOutput(OutputInterface $error);
  68682. public function section(): ConsoleSectionOutput;
  68683. }
  68684. <?php
  68685. namespace Symfony\Component\Console\Output;
  68686. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  68687. use Symfony\Component\Console\Helper\Helper;
  68688. use Symfony\Component\Console\Terminal;
  68689. class ConsoleSectionOutput extends StreamOutput
  68690. {
  68691. private $content = [];
  68692. private $lines = 0;
  68693. private $sections;
  68694. private $terminal;
  68695. public function __construct($stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
  68696. {
  68697. parent::__construct($stream, $verbosity, $decorated, $formatter);
  68698. array_unshift($sections, $this);
  68699. $this->sections = &$sections;
  68700. $this->terminal = new Terminal();
  68701. }
  68702. public function clear(?int $lines = null)
  68703. {
  68704. if (empty($this->content) || !$this->isDecorated()) {
  68705. return;
  68706. }
  68707. if ($lines) {
  68708. array_splice($this->content, -($lines * 2));
  68709. } else {
  68710. $lines = $this->lines;
  68711. $this->content = [];
  68712. }
  68713. $this->lines -= $lines;
  68714. parent::doWrite($this->popStreamContentUntilCurrentSection($lines), false);
  68715. }
  68716. public function overwrite($message)
  68717. {
  68718. $this->clear();
  68719. $this->writeln($message);
  68720. }
  68721. public function getContent(): string
  68722. {
  68723. return implode('', $this->content);
  68724. }
  68725. public function addContent(string $input)
  68726. {
  68727. foreach (explode(\PHP_EOL, $input) as $lineContent) {
  68728. $this->lines += ceil($this->getDisplayLength($lineContent) / $this->terminal->getWidth()) ?: 1;
  68729. $this->content[] = $lineContent;
  68730. $this->content[] = \PHP_EOL;
  68731. }
  68732. }
  68733. protected function doWrite(string $message, bool $newline)
  68734. {
  68735. if (!$this->isDecorated()) {
  68736. parent::doWrite($message, $newline);
  68737. return;
  68738. }
  68739. $erasedContent = $this->popStreamContentUntilCurrentSection();
  68740. $this->addContent($message);
  68741. parent::doWrite($message, true);
  68742. parent::doWrite($erasedContent, false);
  68743. }
  68744. private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
  68745. {
  68746. $numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
  68747. $erasedContent = [];
  68748. foreach ($this->sections as $section) {
  68749. if ($section === $this) {
  68750. break;
  68751. }
  68752. $numberOfLinesToClear += $section->lines;
  68753. $erasedContent[] = $section->getContent();
  68754. }
  68755. if ($numberOfLinesToClear > 0) {
  68756. parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);
  68757. parent::doWrite("\x1b[0J", false);
  68758. }
  68759. return implode('', array_reverse($erasedContent));
  68760. }
  68761. private function getDisplayLength(string $text): int
  68762. {
  68763. return Helper::width(Helper::removeDecoration($this->getFormatter(), str_replace("\t", ' ', $text)));
  68764. }
  68765. }
  68766. <?php
  68767. namespace Symfony\Component\Console\Output;
  68768. use Symfony\Component\Console\Formatter\NullOutputFormatter;
  68769. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  68770. class NullOutput implements OutputInterface
  68771. {
  68772. private $formatter;
  68773. public function setFormatter(OutputFormatterInterface $formatter)
  68774. {
  68775. }
  68776. public function getFormatter()
  68777. {
  68778. if ($this->formatter) {
  68779. return $this->formatter;
  68780. }
  68781. return $this->formatter = new NullOutputFormatter();
  68782. }
  68783. public function setDecorated(bool $decorated)
  68784. {
  68785. }
  68786. public function isDecorated()
  68787. {
  68788. return false;
  68789. }
  68790. public function setVerbosity(int $level)
  68791. {
  68792. }
  68793. public function getVerbosity()
  68794. {
  68795. return self::VERBOSITY_QUIET;
  68796. }
  68797. public function isQuiet()
  68798. {
  68799. return true;
  68800. }
  68801. public function isVerbose()
  68802. {
  68803. return false;
  68804. }
  68805. public function isVeryVerbose()
  68806. {
  68807. return false;
  68808. }
  68809. public function isDebug()
  68810. {
  68811. return false;
  68812. }
  68813. public function writeln($messages, int $options = self::OUTPUT_NORMAL)
  68814. {
  68815. }
  68816. public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
  68817. {
  68818. }
  68819. }
  68820. <?php
  68821. namespace Symfony\Component\Console\Output;
  68822. use Symfony\Component\Console\Formatter\OutputFormatter;
  68823. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  68824. abstract class Output implements OutputInterface
  68825. {
  68826. private $verbosity;
  68827. private $formatter;
  68828. public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null)
  68829. {
  68830. $this->verbosity = $verbosity ?? self::VERBOSITY_NORMAL;
  68831. $this->formatter = $formatter ?? new OutputFormatter();
  68832. $this->formatter->setDecorated($decorated);
  68833. }
  68834. public function setFormatter(OutputFormatterInterface $formatter)
  68835. {
  68836. $this->formatter = $formatter;
  68837. }
  68838. public function getFormatter()
  68839. {
  68840. return $this->formatter;
  68841. }
  68842. public function setDecorated(bool $decorated)
  68843. {
  68844. $this->formatter->setDecorated($decorated);
  68845. }
  68846. public function isDecorated()
  68847. {
  68848. return $this->formatter->isDecorated();
  68849. }
  68850. public function setVerbosity(int $level)
  68851. {
  68852. $this->verbosity = $level;
  68853. }
  68854. public function getVerbosity()
  68855. {
  68856. return $this->verbosity;
  68857. }
  68858. public function isQuiet()
  68859. {
  68860. return self::VERBOSITY_QUIET === $this->verbosity;
  68861. }
  68862. public function isVerbose()
  68863. {
  68864. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  68865. }
  68866. public function isVeryVerbose()
  68867. {
  68868. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  68869. }
  68870. public function isDebug()
  68871. {
  68872. return self::VERBOSITY_DEBUG <= $this->verbosity;
  68873. }
  68874. public function writeln($messages, int $options = self::OUTPUT_NORMAL)
  68875. {
  68876. $this->write($messages, true, $options);
  68877. }
  68878. public function write($messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
  68879. {
  68880. if (!is_iterable($messages)) {
  68881. $messages = [$messages];
  68882. }
  68883. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  68884. $type = $types & $options ?: self::OUTPUT_NORMAL;
  68885. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  68886. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  68887. if ($verbosity > $this->getVerbosity()) {
  68888. return;
  68889. }
  68890. foreach ($messages as $message) {
  68891. switch ($type) {
  68892. case OutputInterface::OUTPUT_NORMAL:
  68893. $message = $this->formatter->format($message);
  68894. break;
  68895. case OutputInterface::OUTPUT_RAW:
  68896. break;
  68897. case OutputInterface::OUTPUT_PLAIN:
  68898. $message = strip_tags($this->formatter->format($message));
  68899. break;
  68900. }
  68901. $this->doWrite($message ?? '', $newline);
  68902. }
  68903. }
  68904. abstract protected function doWrite(string $message, bool $newline);
  68905. }
  68906. <?php
  68907. namespace Symfony\Component\Console\Output;
  68908. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  68909. interface OutputInterface
  68910. {
  68911. public const VERBOSITY_QUIET = 16;
  68912. public const VERBOSITY_NORMAL = 32;
  68913. public const VERBOSITY_VERBOSE = 64;
  68914. public const VERBOSITY_VERY_VERBOSE = 128;
  68915. public const VERBOSITY_DEBUG = 256;
  68916. public const OUTPUT_NORMAL = 1;
  68917. public const OUTPUT_RAW = 2;
  68918. public const OUTPUT_PLAIN = 4;
  68919. public function write($messages, bool $newline = false, int $options = 0);
  68920. public function writeln($messages, int $options = 0);
  68921. public function setVerbosity(int $level);
  68922. public function getVerbosity();
  68923. public function isQuiet();
  68924. public function isVerbose();
  68925. public function isVeryVerbose();
  68926. public function isDebug();
  68927. public function setDecorated(bool $decorated);
  68928. public function isDecorated();
  68929. public function setFormatter(OutputFormatterInterface $formatter);
  68930. public function getFormatter();
  68931. }
  68932. <?php
  68933. namespace Symfony\Component\Console\Output;
  68934. use Symfony\Component\Console\Exception\InvalidArgumentException;
  68935. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  68936. class StreamOutput extends Output
  68937. {
  68938. private $stream;
  68939. public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null)
  68940. {
  68941. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  68942. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  68943. }
  68944. $this->stream = $stream;
  68945. if (null === $decorated) {
  68946. $decorated = $this->hasColorSupport();
  68947. }
  68948. parent::__construct($verbosity, $decorated, $formatter);
  68949. }
  68950. public function getStream()
  68951. {
  68952. return $this->stream;
  68953. }
  68954. protected function doWrite(string $message, bool $newline)
  68955. {
  68956. if ($newline) {
  68957. $message .= \PHP_EOL;
  68958. }
  68959. @fwrite($this->stream, $message);
  68960. fflush($this->stream);
  68961. }
  68962. protected function hasColorSupport()
  68963. {
  68964. if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) {
  68965. return false;
  68966. }
  68967. if (!@stream_isatty($this->stream) && !\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {
  68968. return false;
  68969. }
  68970. if ('\\' === \DIRECTORY_SEPARATOR && @sapi_windows_vt100_support($this->stream)) {
  68971. return true;
  68972. }
  68973. if ('Hyper' === getenv('TERM_PROGRAM')
  68974. || false !== getenv('COLORTERM')
  68975. || false !== getenv('ANSICON')
  68976. || 'ON' === getenv('ConEmuANSI')
  68977. ) {
  68978. return true;
  68979. }
  68980. if ('dumb' === $term = (string) getenv('TERM')) {
  68981. return false;
  68982. }
  68983. return preg_match('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/', $term);
  68984. }
  68985. }
  68986. <?php
  68987. namespace Symfony\Component\Console\Output;
  68988. use Symfony\Component\Console\Exception\InvalidArgumentException;
  68989. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  68990. class TrimmedBufferOutput extends Output
  68991. {
  68992. private $maxLength;
  68993. private $buffer = '';
  68994. public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null)
  68995. {
  68996. if ($maxLength <= 0) {
  68997. throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
  68998. }
  68999. parent::__construct($verbosity, $decorated, $formatter);
  69000. $this->maxLength = $maxLength;
  69001. }
  69002. public function fetch()
  69003. {
  69004. $content = $this->buffer;
  69005. $this->buffer = '';
  69006. return $content;
  69007. }
  69008. protected function doWrite(string $message, bool $newline)
  69009. {
  69010. $this->buffer .= $message;
  69011. if ($newline) {
  69012. $this->buffer .= \PHP_EOL;
  69013. }
  69014. $this->buffer = substr($this->buffer, 0 - $this->maxLength);
  69015. }
  69016. }
  69017. <?php
  69018. namespace Symfony\Component\Console\Question;
  69019. use Symfony\Component\Console\Exception\InvalidArgumentException;
  69020. class ChoiceQuestion extends Question
  69021. {
  69022. private $choices;
  69023. private $multiselect = false;
  69024. private $prompt = ' > ';
  69025. private $errorMessage = 'Value "%s" is invalid';
  69026. public function __construct(string $question, array $choices, $default = null)
  69027. {
  69028. if (!$choices) {
  69029. throw new \LogicException('Choice question must have at least 1 choice available.');
  69030. }
  69031. parent::__construct($question, $default);
  69032. $this->choices = $choices;
  69033. $this->setValidator($this->getDefaultValidator());
  69034. $this->setAutocompleterValues($choices);
  69035. }
  69036. public function getChoices()
  69037. {
  69038. return $this->choices;
  69039. }
  69040. public function setMultiselect(bool $multiselect)
  69041. {
  69042. $this->multiselect = $multiselect;
  69043. $this->setValidator($this->getDefaultValidator());
  69044. return $this;
  69045. }
  69046. public function isMultiselect()
  69047. {
  69048. return $this->multiselect;
  69049. }
  69050. public function getPrompt()
  69051. {
  69052. return $this->prompt;
  69053. }
  69054. public function setPrompt(string $prompt)
  69055. {
  69056. $this->prompt = $prompt;
  69057. return $this;
  69058. }
  69059. public function setErrorMessage(string $errorMessage)
  69060. {
  69061. $this->errorMessage = $errorMessage;
  69062. $this->setValidator($this->getDefaultValidator());
  69063. return $this;
  69064. }
  69065. private function getDefaultValidator(): callable
  69066. {
  69067. $choices = $this->choices;
  69068. $errorMessage = $this->errorMessage;
  69069. $multiselect = $this->multiselect;
  69070. $isAssoc = $this->isAssoc($choices);
  69071. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  69072. if ($multiselect) {
  69073. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) {
  69074. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  69075. }
  69076. $selectedChoices = explode(',', (string) $selected);
  69077. } else {
  69078. $selectedChoices = [$selected];
  69079. }
  69080. if ($this->isTrimmable()) {
  69081. foreach ($selectedChoices as $k => $v) {
  69082. $selectedChoices[$k] = trim((string) $v);
  69083. }
  69084. }
  69085. $multiselectChoices = [];
  69086. foreach ($selectedChoices as $value) {
  69087. $results = [];
  69088. foreach ($choices as $key => $choice) {
  69089. if ($choice === $value) {
  69090. $results[] = $key;
  69091. }
  69092. }
  69093. if (\count($results) > 1) {
  69094. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
  69095. }
  69096. $result = array_search($value, $choices);
  69097. if (!$isAssoc) {
  69098. if (false !== $result) {
  69099. $result = $choices[$result];
  69100. } elseif (isset($choices[$value])) {
  69101. $result = $choices[$value];
  69102. }
  69103. } elseif (false === $result && isset($choices[$value])) {
  69104. $result = $value;
  69105. }
  69106. if (false === $result) {
  69107. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  69108. }
  69109. $multiselectChoices[] = $isAssoc ? (string) $result : $result;
  69110. }
  69111. if ($multiselect) {
  69112. return $multiselectChoices;
  69113. }
  69114. return current($multiselectChoices);
  69115. };
  69116. }
  69117. }
  69118. <?php
  69119. namespace Symfony\Component\Console\Question;
  69120. class ConfirmationQuestion extends Question
  69121. {
  69122. private $trueAnswerRegex;
  69123. public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i')
  69124. {
  69125. parent::__construct($question, $default);
  69126. $this->trueAnswerRegex = $trueAnswerRegex;
  69127. $this->setNormalizer($this->getDefaultNormalizer());
  69128. }
  69129. private function getDefaultNormalizer(): callable
  69130. {
  69131. $default = $this->getDefault();
  69132. $regex = $this->trueAnswerRegex;
  69133. return function ($answer) use ($default, $regex) {
  69134. if (\is_bool($answer)) {
  69135. return $answer;
  69136. }
  69137. $answerIsTrue = (bool) preg_match($regex, $answer);
  69138. if (false === $default) {
  69139. return $answer && $answerIsTrue;
  69140. }
  69141. return '' === $answer || $answerIsTrue;
  69142. };
  69143. }
  69144. }
  69145. <?php
  69146. namespace Symfony\Component\Console\Question;
  69147. use Symfony\Component\Console\Exception\InvalidArgumentException;
  69148. use Symfony\Component\Console\Exception\LogicException;
  69149. class Question
  69150. {
  69151. private $question;
  69152. private $attempts;
  69153. private $hidden = false;
  69154. private $hiddenFallback = true;
  69155. private $autocompleterCallback;
  69156. private $validator;
  69157. private $default;
  69158. private $normalizer;
  69159. private $trimmable = true;
  69160. private $multiline = false;
  69161. public function __construct(string $question, $default = null)
  69162. {
  69163. $this->question = $question;
  69164. $this->default = $default;
  69165. }
  69166. public function getQuestion()
  69167. {
  69168. return $this->question;
  69169. }
  69170. public function getDefault()
  69171. {
  69172. return $this->default;
  69173. }
  69174. public function isMultiline(): bool
  69175. {
  69176. return $this->multiline;
  69177. }
  69178. public function setMultiline(bool $multiline): self
  69179. {
  69180. $this->multiline = $multiline;
  69181. return $this;
  69182. }
  69183. public function isHidden()
  69184. {
  69185. return $this->hidden;
  69186. }
  69187. public function setHidden(bool $hidden)
  69188. {
  69189. if ($this->autocompleterCallback) {
  69190. throw new LogicException('A hidden question cannot use the autocompleter.');
  69191. }
  69192. $this->hidden = $hidden;
  69193. return $this;
  69194. }
  69195. public function isHiddenFallback()
  69196. {
  69197. return $this->hiddenFallback;
  69198. }
  69199. public function setHiddenFallback(bool $fallback)
  69200. {
  69201. $this->hiddenFallback = $fallback;
  69202. return $this;
  69203. }
  69204. public function getAutocompleterValues()
  69205. {
  69206. $callback = $this->getAutocompleterCallback();
  69207. return $callback ? $callback('') : null;
  69208. }
  69209. public function setAutocompleterValues(?iterable $values)
  69210. {
  69211. if (\is_array($values)) {
  69212. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  69213. $callback = static function () use ($values) {
  69214. return $values;
  69215. };
  69216. } elseif ($values instanceof \Traversable) {
  69217. $valueCache = null;
  69218. $callback = static function () use ($values, &$valueCache) {
  69219. return $valueCache ?? $valueCache = iterator_to_array($values, false);
  69220. };
  69221. } else {
  69222. $callback = null;
  69223. }
  69224. return $this->setAutocompleterCallback($callback);
  69225. }
  69226. public function getAutocompleterCallback(): ?callable
  69227. {
  69228. return $this->autocompleterCallback;
  69229. }
  69230. public function setAutocompleterCallback(?callable $callback = null): self
  69231. {
  69232. if ($this->hidden && null !== $callback) {
  69233. throw new LogicException('A hidden question cannot use the autocompleter.');
  69234. }
  69235. $this->autocompleterCallback = $callback;
  69236. return $this;
  69237. }
  69238. public function setValidator(?callable $validator = null)
  69239. {
  69240. $this->validator = $validator;
  69241. return $this;
  69242. }
  69243. public function getValidator()
  69244. {
  69245. return $this->validator;
  69246. }
  69247. public function setMaxAttempts(?int $attempts)
  69248. {
  69249. if (null !== $attempts && $attempts < 1) {
  69250. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  69251. }
  69252. $this->attempts = $attempts;
  69253. return $this;
  69254. }
  69255. public function getMaxAttempts()
  69256. {
  69257. return $this->attempts;
  69258. }
  69259. public function setNormalizer(callable $normalizer)
  69260. {
  69261. $this->normalizer = $normalizer;
  69262. return $this;
  69263. }
  69264. public function getNormalizer()
  69265. {
  69266. return $this->normalizer;
  69267. }
  69268. protected function isAssoc(array $array)
  69269. {
  69270. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  69271. }
  69272. public function isTrimmable(): bool
  69273. {
  69274. return $this->trimmable;
  69275. }
  69276. public function setTrimmable(bool $trimmable): self
  69277. {
  69278. $this->trimmable = $trimmable;
  69279. return $this;
  69280. }
  69281. }
  69282. MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  69283. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  69284. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  69285. ����������������� ��`.rdata����� ���
  69286. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  69287. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  69288. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  69289. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  69290. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  69291. <security>
  69292. <requestedPrivileges>
  69293. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  69294. </requestedPrivileges>
  69295. </security>
  69296. </trustInfo>
  69297. <dependency>
  69298. <dependentAssembly>
  69299. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  69300. </dependentAssembly>
  69301. </dependency>
  69302. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������# This file is part of the Symfony package.
  69303. #
  69304. # (c) Fabien Potencier <fabien@symfony.com>
  69305. #
  69306. # For the full copyright and license information, please view
  69307. # https://symfony.com/doc/current/contributing/code/license.html
  69308. _sf_{{ COMMAND_NAME }}() {
  69309. # Use newline as only separator to allow space in completion values
  69310. local IFS=$'\n'
  69311. local sf_cmd="${COMP_WORDS[0]}"
  69312. # for an alias, get the real script behind it
  69313. sf_cmd_type=$(type -t $sf_cmd)
  69314. if [[ $sf_cmd_type == "alias" ]]; then
  69315. sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
  69316. elif [[ $sf_cmd_type == "file" ]]; then
  69317. sf_cmd=$(type -p $sf_cmd)
  69318. fi
  69319. if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then
  69320. return 1
  69321. fi
  69322. local cur prev words cword
  69323. _get_comp_words_by_ref -n := cur prev words cword
  69324. local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S{{ VERSION }}")
  69325. for w in ${words[@]}; do
  69326. w=$(printf -- '%b' "$w")
  69327. # remove quotes from typed values
  69328. quote="${w:0:1}"
  69329. if [ "$quote" == \' ]; then
  69330. w="${w%\'}"
  69331. w="${w#\'}"
  69332. elif [ "$quote" == \" ]; then
  69333. w="${w%\"}"
  69334. w="${w#\"}"
  69335. fi
  69336. # empty values are ignored
  69337. if [ ! -z "$w" ]; then
  69338. completecmd+=("-i$w")
  69339. fi
  69340. done
  69341. local sfcomplete
  69342. if sfcomplete=$(${completecmd[@]} 2>&1); then
  69343. local quote suggestions
  69344. quote=${cur:0:1}
  69345. # Use single quotes by default if suggestions contains backslash (FQCN)
  69346. if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then
  69347. quote=\'
  69348. fi
  69349. if [ "$quote" == \' ]; then
  69350. # single quotes: no additional escaping (does not accept ' in values)
  69351. suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done)
  69352. elif [ "$quote" == \" ]; then
  69353. # double quotes: double escaping for \ $ ` "
  69354. suggestions=$(for s in $sfcomplete; do
  69355. s=${s//\\/\\\\}
  69356. s=${s//\$/\\\$}
  69357. s=${s//\`/\\\`}
  69358. s=${s//\"/\\\"}
  69359. printf $'%q%q%q\n' "$quote" "$s" "$quote";
  69360. done)
  69361. else
  69362. # no quotes: double escaping
  69363. suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done)
  69364. fi
  69365. COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur")))
  69366. __ltrim_colon_completions "$cur"
  69367. else
  69368. if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then
  69369. >&2 echo
  69370. >&2 echo $sfcomplete
  69371. fi
  69372. return 1
  69373. fi
  69374. }
  69375. complete -F _sf_{{ COMMAND_NAME }} {{ COMMAND_NAME }}
  69376. <?php
  69377. namespace Symfony\Component\Console\SignalRegistry;
  69378. final class SignalRegistry
  69379. {
  69380. private $signalHandlers = [];
  69381. public function __construct()
  69382. {
  69383. if (\function_exists('pcntl_async_signals')) {
  69384. pcntl_async_signals(true);
  69385. }
  69386. }
  69387. public function register(int $signal, callable $signalHandler): void
  69388. {
  69389. if (!isset($this->signalHandlers[$signal])) {
  69390. $previousCallback = pcntl_signal_get_handler($signal);
  69391. if (\is_callable($previousCallback)) {
  69392. $this->signalHandlers[$signal][] = $previousCallback;
  69393. }
  69394. }
  69395. $this->signalHandlers[$signal][] = $signalHandler;
  69396. pcntl_signal($signal, [$this, 'handle']);
  69397. }
  69398. public static function isSupported(): bool
  69399. {
  69400. if (!\function_exists('pcntl_signal')) {
  69401. return false;
  69402. }
  69403. if (\in_array('pcntl_signal', explode(',', \ini_get('disable_functions')))) {
  69404. return false;
  69405. }
  69406. return true;
  69407. }
  69408. public function handle(int $signal): void
  69409. {
  69410. $count = \count($this->signalHandlers[$signal]);
  69411. foreach ($this->signalHandlers[$signal] as $i => $signalHandler) {
  69412. $hasNext = $i !== $count - 1;
  69413. $signalHandler($signal, $hasNext);
  69414. }
  69415. }
  69416. }
  69417. <?php
  69418. namespace Symfony\Component\Console;
  69419. use Symfony\Component\Console\Command\Command;
  69420. use Symfony\Component\Console\Input\InputInterface;
  69421. use Symfony\Component\Console\Output\OutputInterface;
  69422. class SingleCommandApplication extends Command
  69423. {
  69424. private $version = 'UNKNOWN';
  69425. private $autoExit = true;
  69426. private $running = false;
  69427. public function setVersion(string $version): self
  69428. {
  69429. $this->version = $version;
  69430. return $this;
  69431. }
  69432. public function setAutoExit(bool $autoExit): self
  69433. {
  69434. $this->autoExit = $autoExit;
  69435. return $this;
  69436. }
  69437. public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
  69438. {
  69439. if ($this->running) {
  69440. return parent::run($input, $output);
  69441. }
  69442. $application = new Application($this->getName() ?: 'UNKNOWN', $this->version);
  69443. $application->setAutoExit($this->autoExit);
  69444. $this->setName($_SERVER['argv'][0]);
  69445. $application->add($this);
  69446. $application->setDefaultCommand($this->getName(), true);
  69447. $this->running = true;
  69448. try {
  69449. $ret = $application->run($input, $output);
  69450. } finally {
  69451. $this->running = false;
  69452. }
  69453. return $ret ?? 1;
  69454. }
  69455. }
  69456. <?php
  69457. namespace Symfony\Component\Console\Style;
  69458. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  69459. use Symfony\Component\Console\Helper\ProgressBar;
  69460. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  69461. use Symfony\Component\Console\Output\OutputInterface;
  69462. abstract class OutputStyle implements OutputInterface, StyleInterface
  69463. {
  69464. private $output;
  69465. public function __construct(OutputInterface $output)
  69466. {
  69467. $this->output = $output;
  69468. }
  69469. public function newLine(int $count = 1)
  69470. {
  69471. $this->output->write(str_repeat(\PHP_EOL, $count));
  69472. }
  69473. public function createProgressBar(int $max = 0)
  69474. {
  69475. return new ProgressBar($this->output, $max);
  69476. }
  69477. public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
  69478. {
  69479. $this->output->write($messages, $newline, $type);
  69480. }
  69481. public function writeln($messages, int $type = self::OUTPUT_NORMAL)
  69482. {
  69483. $this->output->writeln($messages, $type);
  69484. }
  69485. public function setVerbosity(int $level)
  69486. {
  69487. $this->output->setVerbosity($level);
  69488. }
  69489. public function getVerbosity()
  69490. {
  69491. return $this->output->getVerbosity();
  69492. }
  69493. public function setDecorated(bool $decorated)
  69494. {
  69495. $this->output->setDecorated($decorated);
  69496. }
  69497. public function isDecorated()
  69498. {
  69499. return $this->output->isDecorated();
  69500. }
  69501. public function setFormatter(OutputFormatterInterface $formatter)
  69502. {
  69503. $this->output->setFormatter($formatter);
  69504. }
  69505. public function getFormatter()
  69506. {
  69507. return $this->output->getFormatter();
  69508. }
  69509. public function isQuiet()
  69510. {
  69511. return $this->output->isQuiet();
  69512. }
  69513. public function isVerbose()
  69514. {
  69515. return $this->output->isVerbose();
  69516. }
  69517. public function isVeryVerbose()
  69518. {
  69519. return $this->output->isVeryVerbose();
  69520. }
  69521. public function isDebug()
  69522. {
  69523. return $this->output->isDebug();
  69524. }
  69525. protected function getErrorOutput()
  69526. {
  69527. if (!$this->output instanceof ConsoleOutputInterface) {
  69528. return $this->output;
  69529. }
  69530. return $this->output->getErrorOutput();
  69531. }
  69532. }
  69533. <?php
  69534. namespace Symfony\Component\Console\Style;
  69535. interface StyleInterface
  69536. {
  69537. public function title(string $message);
  69538. public function section(string $message);
  69539. public function listing(array $elements);
  69540. public function text($message);
  69541. public function success($message);
  69542. public function error($message);
  69543. public function warning($message);
  69544. public function note($message);
  69545. public function caution($message);
  69546. public function table(array $headers, array $rows);
  69547. public function ask(string $question, ?string $default = null, ?callable $validator = null);
  69548. public function askHidden(string $question, ?callable $validator = null);
  69549. public function confirm(string $question, bool $default = true);
  69550. public function choice(string $question, array $choices, $default = null);
  69551. public function newLine(int $count = 1);
  69552. public function progressStart(int $max = 0);
  69553. public function progressAdvance(int $step = 1);
  69554. public function progressFinish();
  69555. }
  69556. <?php
  69557. namespace Symfony\Component\Console\Style;
  69558. use Symfony\Component\Console\Exception\InvalidArgumentException;
  69559. use Symfony\Component\Console\Exception\RuntimeException;
  69560. use Symfony\Component\Console\Formatter\OutputFormatter;
  69561. use Symfony\Component\Console\Helper\Helper;
  69562. use Symfony\Component\Console\Helper\ProgressBar;
  69563. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  69564. use Symfony\Component\Console\Helper\Table;
  69565. use Symfony\Component\Console\Helper\TableCell;
  69566. use Symfony\Component\Console\Helper\TableSeparator;
  69567. use Symfony\Component\Console\Input\InputInterface;
  69568. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  69569. use Symfony\Component\Console\Output\OutputInterface;
  69570. use Symfony\Component\Console\Output\TrimmedBufferOutput;
  69571. use Symfony\Component\Console\Question\ChoiceQuestion;
  69572. use Symfony\Component\Console\Question\ConfirmationQuestion;
  69573. use Symfony\Component\Console\Question\Question;
  69574. use Symfony\Component\Console\Terminal;
  69575. class SymfonyStyle extends OutputStyle
  69576. {
  69577. public const MAX_LINE_LENGTH = 120;
  69578. private $input;
  69579. private $output;
  69580. private $questionHelper;
  69581. private $progressBar;
  69582. private $lineLength;
  69583. private $bufferedOutput;
  69584. public function __construct(InputInterface $input, OutputInterface $output)
  69585. {
  69586. $this->input = $input;
  69587. $this->bufferedOutput = new TrimmedBufferOutput(\DIRECTORY_SEPARATOR === '\\' ? 4 : 2, $output->getVerbosity(), false, clone $output->getFormatter());
  69588. $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
  69589. $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  69590. parent::__construct($this->output = $output);
  69591. }
  69592. public function block($messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
  69593. {
  69594. $messages = \is_array($messages) ? array_values($messages) : [$messages];
  69595. $this->autoPrependBlock();
  69596. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
  69597. $this->newLine();
  69598. }
  69599. public function title(string $message)
  69600. {
  69601. $this->autoPrependBlock();
  69602. $this->writeln([
  69603. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  69604. sprintf('<comment>%s</>', str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
  69605. ]);
  69606. $this->newLine();
  69607. }
  69608. public function section(string $message)
  69609. {
  69610. $this->autoPrependBlock();
  69611. $this->writeln([
  69612. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  69613. sprintf('<comment>%s</>', str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
  69614. ]);
  69615. $this->newLine();
  69616. }
  69617. public function listing(array $elements)
  69618. {
  69619. $this->autoPrependText();
  69620. $elements = array_map(function ($element) {
  69621. return sprintf(' * %s', $element);
  69622. }, $elements);
  69623. $this->writeln($elements);
  69624. $this->newLine();
  69625. }
  69626. public function text($message)
  69627. {
  69628. $this->autoPrependText();
  69629. $messages = \is_array($message) ? array_values($message) : [$message];
  69630. foreach ($messages as $message) {
  69631. $this->writeln(sprintf(' %s', $message));
  69632. }
  69633. }
  69634. public function comment($message)
  69635. {
  69636. $this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
  69637. }
  69638. public function success($message)
  69639. {
  69640. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  69641. }
  69642. public function error($message)
  69643. {
  69644. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  69645. }
  69646. public function warning($message)
  69647. {
  69648. $this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true);
  69649. }
  69650. public function note($message)
  69651. {
  69652. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  69653. }
  69654. public function info($message)
  69655. {
  69656. $this->block($message, 'INFO', 'fg=green', ' ', true);
  69657. }
  69658. public function caution($message)
  69659. {
  69660. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  69661. }
  69662. public function table(array $headers, array $rows)
  69663. {
  69664. $this->createTable()
  69665. ->setHeaders($headers)
  69666. ->setRows($rows)
  69667. ->render()
  69668. ;
  69669. $this->newLine();
  69670. }
  69671. public function horizontalTable(array $headers, array $rows)
  69672. {
  69673. $this->createTable()
  69674. ->setHorizontal(true)
  69675. ->setHeaders($headers)
  69676. ->setRows($rows)
  69677. ->render()
  69678. ;
  69679. $this->newLine();
  69680. }
  69681. public function definitionList(...$list)
  69682. {
  69683. $headers = [];
  69684. $row = [];
  69685. foreach ($list as $value) {
  69686. if ($value instanceof TableSeparator) {
  69687. $headers[] = $value;
  69688. $row[] = $value;
  69689. continue;
  69690. }
  69691. if (\is_string($value)) {
  69692. $headers[] = new TableCell($value, ['colspan' => 2]);
  69693. $row[] = null;
  69694. continue;
  69695. }
  69696. if (!\is_array($value)) {
  69697. throw new InvalidArgumentException('Value should be an array, string, or an instance of TableSeparator.');
  69698. }
  69699. $headers[] = key($value);
  69700. $row[] = current($value);
  69701. }
  69702. $this->horizontalTable($headers, [$row]);
  69703. }
  69704. public function ask(string $question, ?string $default = null, ?callable $validator = null)
  69705. {
  69706. $question = new Question($question, $default);
  69707. $question->setValidator($validator);
  69708. return $this->askQuestion($question);
  69709. }
  69710. public function askHidden(string $question, ?callable $validator = null)
  69711. {
  69712. $question = new Question($question);
  69713. $question->setHidden(true);
  69714. $question->setValidator($validator);
  69715. return $this->askQuestion($question);
  69716. }
  69717. public function confirm(string $question, bool $default = true)
  69718. {
  69719. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  69720. }
  69721. public function choice(string $question, array $choices, $default = null)
  69722. {
  69723. if (null !== $default) {
  69724. $values = array_flip($choices);
  69725. $default = $values[$default] ?? $default;
  69726. }
  69727. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  69728. }
  69729. public function progressStart(int $max = 0)
  69730. {
  69731. $this->progressBar = $this->createProgressBar($max);
  69732. $this->progressBar->start();
  69733. }
  69734. public function progressAdvance(int $step = 1)
  69735. {
  69736. $this->getProgressBar()->advance($step);
  69737. }
  69738. public function progressFinish()
  69739. {
  69740. $this->getProgressBar()->finish();
  69741. $this->newLine(2);
  69742. $this->progressBar = null;
  69743. }
  69744. public function createProgressBar(int $max = 0)
  69745. {
  69746. $progressBar = parent::createProgressBar($max);
  69747. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  69748. $progressBar->setEmptyBarCharacter('â–‘');
  69749. $progressBar->setProgressCharacter('');
  69750. $progressBar->setBarCharacter('â–“');
  69751. }
  69752. return $progressBar;
  69753. }
  69754. public function progressIterate(iterable $iterable, ?int $max = null): iterable
  69755. {
  69756. yield from $this->createProgressBar()->iterate($iterable, $max);
  69757. $this->newLine(2);
  69758. }
  69759. public function askQuestion(Question $question)
  69760. {
  69761. if ($this->input->isInteractive()) {
  69762. $this->autoPrependBlock();
  69763. }
  69764. if (!$this->questionHelper) {
  69765. $this->questionHelper = new SymfonyQuestionHelper();
  69766. }
  69767. $answer = $this->questionHelper->ask($this->input, $this, $question);
  69768. if ($this->input->isInteractive()) {
  69769. $this->newLine();
  69770. $this->bufferedOutput->write("\n");
  69771. }
  69772. return $answer;
  69773. }
  69774. public function writeln($messages, int $type = self::OUTPUT_NORMAL)
  69775. {
  69776. if (!is_iterable($messages)) {
  69777. $messages = [$messages];
  69778. }
  69779. foreach ($messages as $message) {
  69780. parent::writeln($message, $type);
  69781. $this->writeBuffer($message, true, $type);
  69782. }
  69783. }
  69784. public function write($messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
  69785. {
  69786. if (!is_iterable($messages)) {
  69787. $messages = [$messages];
  69788. }
  69789. foreach ($messages as $message) {
  69790. parent::write($message, $newline, $type);
  69791. $this->writeBuffer($message, $newline, $type);
  69792. }
  69793. }
  69794. public function newLine(int $count = 1)
  69795. {
  69796. parent::newLine($count);
  69797. $this->bufferedOutput->write(str_repeat("\n", $count));
  69798. }
  69799. public function getErrorStyle()
  69800. {
  69801. return new self($this->input, $this->getErrorOutput());
  69802. }
  69803. public function createTable(): Table
  69804. {
  69805. $output = $this->output instanceof ConsoleOutputInterface ? $this->output->section() : $this->output;
  69806. $style = clone Table::getStyleDefinition('symfony-style-guide');
  69807. $style->setCellHeaderFormat('<info>%s</info>');
  69808. return (new Table($output))->setStyle($style);
  69809. }
  69810. private function getProgressBar(): ProgressBar
  69811. {
  69812. if (!$this->progressBar) {
  69813. throw new RuntimeException('The ProgressBar is not started.');
  69814. }
  69815. return $this->progressBar;
  69816. }
  69817. private function autoPrependBlock(): void
  69818. {
  69819. $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  69820. if (!isset($chars[0])) {
  69821. $this->newLine();
  69822. return;
  69823. }
  69824. $this->newLine(2 - substr_count($chars, "\n"));
  69825. }
  69826. private function autoPrependText(): void
  69827. {
  69828. $fetched = $this->bufferedOutput->fetch();
  69829. if (!str_ends_with($fetched, "\n")) {
  69830. $this->newLine();
  69831. }
  69832. }
  69833. private function writeBuffer(string $message, bool $newLine, int $type): void
  69834. {
  69835. $this->bufferedOutput->write($message, $newLine, $type);
  69836. }
  69837. private function createBlock(iterable $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
  69838. {
  69839. $indentLength = 0;
  69840. $prefixLength = Helper::width(Helper::removeDecoration($this->getFormatter(), $prefix));
  69841. $lines = [];
  69842. if (null !== $type) {
  69843. $type = sprintf('[%s] ', $type);
  69844. $indentLength = \strlen($type);
  69845. $lineIndentation = str_repeat(' ', $indentLength);
  69846. }
  69847. foreach ($messages as $key => $message) {
  69848. if ($escape) {
  69849. $message = OutputFormatter::escape($message);
  69850. }
  69851. $decorationLength = Helper::width($message) - Helper::width(Helper::removeDecoration($this->getFormatter(), $message));
  69852. $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
  69853. $messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true));
  69854. foreach ($messageLines as $messageLine) {
  69855. $lines[] = $messageLine;
  69856. }
  69857. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  69858. $lines[] = '';
  69859. }
  69860. }
  69861. $firstLineIndex = 0;
  69862. if ($padding && $this->isDecorated()) {
  69863. $firstLineIndex = 1;
  69864. array_unshift($lines, '');
  69865. $lines[] = '';
  69866. }
  69867. foreach ($lines as $i => &$line) {
  69868. if (null !== $type) {
  69869. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  69870. }
  69871. $line = $prefix.$line;
  69872. $line .= str_repeat(' ', max($this->lineLength - Helper::width(Helper::removeDecoration($this->getFormatter(), $line)), 0));
  69873. if ($style) {
  69874. $line = sprintf('<%s>%s</>', $style, $line);
  69875. }
  69876. }
  69877. return $lines;
  69878. }
  69879. }
  69880. <?php
  69881. namespace Symfony\Component\Console;
  69882. class Terminal
  69883. {
  69884. private static $width;
  69885. private static $height;
  69886. private static $stty;
  69887. public function getWidth()
  69888. {
  69889. $width = getenv('COLUMNS');
  69890. if (false !== $width) {
  69891. return (int) trim($width);
  69892. }
  69893. if (null === self::$width) {
  69894. self::initDimensions();
  69895. }
  69896. return self::$width ?: 80;
  69897. }
  69898. public function getHeight()
  69899. {
  69900. $height = getenv('LINES');
  69901. if (false !== $height) {
  69902. return (int) trim($height);
  69903. }
  69904. if (null === self::$height) {
  69905. self::initDimensions();
  69906. }
  69907. return self::$height ?: 50;
  69908. }
  69909. public static function hasSttyAvailable(): bool
  69910. {
  69911. if (null !== self::$stty) {
  69912. return self::$stty;
  69913. }
  69914. if (!\function_exists('shell_exec')) {
  69915. return false;
  69916. }
  69917. return self::$stty = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
  69918. }
  69919. private static function initDimensions()
  69920. {
  69921. if ('\\' === \DIRECTORY_SEPARATOR) {
  69922. $ansicon = getenv('ANSICON');
  69923. if (false !== $ansicon && preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim($ansicon), $matches)) {
  69924. self::$width = (int) $matches[1];
  69925. self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
  69926. } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {
  69927. self::initDimensionsUsingStty();
  69928. } elseif (null !== $dimensions = self::getConsoleMode()) {
  69929. self::$width = (int) $dimensions[0];
  69930. self::$height = (int) $dimensions[1];
  69931. }
  69932. } else {
  69933. self::initDimensionsUsingStty();
  69934. }
  69935. }
  69936. private static function hasVt100Support(): bool
  69937. {
  69938. return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w'));
  69939. }
  69940. private static function initDimensionsUsingStty()
  69941. {
  69942. if ($sttyString = self::getSttyColumns()) {
  69943. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  69944. self::$width = (int) $matches[2];
  69945. self::$height = (int) $matches[1];
  69946. } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  69947. self::$width = (int) $matches[2];
  69948. self::$height = (int) $matches[1];
  69949. }
  69950. }
  69951. }
  69952. private static function getConsoleMode(): ?array
  69953. {
  69954. $info = self::readFromProcess('mode CON');
  69955. if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  69956. return null;
  69957. }
  69958. return [(int) $matches[2], (int) $matches[1]];
  69959. }
  69960. private static function getSttyColumns(): ?string
  69961. {
  69962. return self::readFromProcess('stty -a | grep columns');
  69963. }
  69964. private static function readFromProcess(string $command): ?string
  69965. {
  69966. if (!\function_exists('proc_open')) {
  69967. return null;
  69968. }
  69969. $descriptorspec = [
  69970. 1 => ['pipe', 'w'],
  69971. 2 => ['pipe', 'w'],
  69972. ];
  69973. $cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;
  69974. if (!$process = @proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true])) {
  69975. return null;
  69976. }
  69977. $info = stream_get_contents($pipes[1]);
  69978. fclose($pipes[1]);
  69979. fclose($pipes[2]);
  69980. proc_close($process);
  69981. if ($cp) {
  69982. sapi_windows_cp_set($cp);
  69983. }
  69984. return $info;
  69985. }
  69986. }
  69987. <?php
  69988. namespace Symfony\Component\Console\Tester;
  69989. use Symfony\Component\Console\Application;
  69990. use Symfony\Component\Console\Input\ArrayInput;
  69991. class ApplicationTester
  69992. {
  69993. use TesterTrait;
  69994. private $application;
  69995. public function __construct(Application $application)
  69996. {
  69997. $this->application = $application;
  69998. }
  69999. public function run(array $input, array $options = [])
  70000. {
  70001. $prevShellVerbosity = getenv('SHELL_VERBOSITY');
  70002. try {
  70003. $this->input = new ArrayInput($input);
  70004. if (isset($options['interactive'])) {
  70005. $this->input->setInteractive($options['interactive']);
  70006. }
  70007. if ($this->inputs) {
  70008. $this->input->setStream(self::createStream($this->inputs));
  70009. }
  70010. $this->initOutput($options);
  70011. return $this->statusCode = $this->application->run($this->input, $this->output);
  70012. } finally {
  70013. if (false === $prevShellVerbosity) {
  70014. if (\function_exists('putenv')) {
  70015. @putenv('SHELL_VERBOSITY');
  70016. }
  70017. unset($_ENV['SHELL_VERBOSITY']);
  70018. unset($_SERVER['SHELL_VERBOSITY']);
  70019. } else {
  70020. if (\function_exists('putenv')) {
  70021. @putenv('SHELL_VERBOSITY='.$prevShellVerbosity);
  70022. }
  70023. $_ENV['SHELL_VERBOSITY'] = $prevShellVerbosity;
  70024. $_SERVER['SHELL_VERBOSITY'] = $prevShellVerbosity;
  70025. }
  70026. }
  70027. }
  70028. }
  70029. <?php
  70030. namespace Symfony\Component\Console\Tester;
  70031. use Symfony\Component\Console\Command\Command;
  70032. use Symfony\Component\Console\Completion\CompletionInput;
  70033. use Symfony\Component\Console\Completion\CompletionSuggestions;
  70034. class CommandCompletionTester
  70035. {
  70036. private $command;
  70037. public function __construct(Command $command)
  70038. {
  70039. $this->command = $command;
  70040. }
  70041. public function complete(array $input): array
  70042. {
  70043. $currentIndex = \count($input);
  70044. if ('' === end($input)) {
  70045. array_pop($input);
  70046. }
  70047. array_unshift($input, $this->command->getName());
  70048. $completionInput = CompletionInput::fromTokens($input, $currentIndex);
  70049. $completionInput->bind($this->command->getDefinition());
  70050. $suggestions = new CompletionSuggestions();
  70051. $this->command->complete($completionInput, $suggestions);
  70052. $options = [];
  70053. foreach ($suggestions->getOptionSuggestions() as $option) {
  70054. $options[] = '--'.$option->getName();
  70055. }
  70056. return array_map('strval', array_merge($options, $suggestions->getValueSuggestions()));
  70057. }
  70058. }
  70059. <?php
  70060. namespace Symfony\Component\Console\Tester;
  70061. use Symfony\Component\Console\Command\Command;
  70062. use Symfony\Component\Console\Input\ArrayInput;
  70063. class CommandTester
  70064. {
  70065. use TesterTrait;
  70066. private $command;
  70067. public function __construct(Command $command)
  70068. {
  70069. $this->command = $command;
  70070. }
  70071. public function execute(array $input, array $options = [])
  70072. {
  70073. if (!isset($input['command'])
  70074. && (null !== $application = $this->command->getApplication())
  70075. && $application->getDefinition()->hasArgument('command')
  70076. ) {
  70077. $input = array_merge(['command' => $this->command->getName()], $input);
  70078. }
  70079. $this->input = new ArrayInput($input);
  70080. $this->input->setStream(self::createStream($this->inputs));
  70081. if (isset($options['interactive'])) {
  70082. $this->input->setInteractive($options['interactive']);
  70083. }
  70084. if (!isset($options['decorated'])) {
  70085. $options['decorated'] = false;
  70086. }
  70087. $this->initOutput($options);
  70088. return $this->statusCode = $this->command->run($this->input, $this->output);
  70089. }
  70090. }
  70091. <?php
  70092. namespace Symfony\Component\Console\Tester\Constraint;
  70093. use PHPUnit\Framework\Constraint\Constraint;
  70094. use Symfony\Component\Console\Command\Command;
  70095. final class CommandIsSuccessful extends Constraint
  70096. {
  70097. public function toString(): string
  70098. {
  70099. return 'is successful';
  70100. }
  70101. protected function matches($other): bool
  70102. {
  70103. return Command::SUCCESS === $other;
  70104. }
  70105. protected function failureDescription($other): string
  70106. {
  70107. return 'the command '.$this->toString();
  70108. }
  70109. protected function additionalFailureDescription($other): string
  70110. {
  70111. $mapping = [
  70112. Command::FAILURE => 'Command failed.',
  70113. Command::INVALID => 'Command was invalid.',
  70114. ];
  70115. return $mapping[$other] ?? sprintf('Command returned exit status %d.', $other);
  70116. }
  70117. }
  70118. <?php
  70119. namespace Symfony\Component\Console\Tester;
  70120. use PHPUnit\Framework\Assert;
  70121. use Symfony\Component\Console\Input\InputInterface;
  70122. use Symfony\Component\Console\Output\ConsoleOutput;
  70123. use Symfony\Component\Console\Output\OutputInterface;
  70124. use Symfony\Component\Console\Output\StreamOutput;
  70125. use Symfony\Component\Console\Tester\Constraint\CommandIsSuccessful;
  70126. trait TesterTrait
  70127. {
  70128. private $output;
  70129. private $inputs = [];
  70130. private $captureStreamsIndependently = false;
  70131. private $input;
  70132. private $statusCode;
  70133. public function getDisplay(bool $normalize = false)
  70134. {
  70135. if (null === $this->output) {
  70136. throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
  70137. }
  70138. rewind($this->output->getStream());
  70139. $display = stream_get_contents($this->output->getStream());
  70140. if ($normalize) {
  70141. $display = str_replace(\PHP_EOL, "\n", $display);
  70142. }
  70143. return $display;
  70144. }
  70145. public function getErrorOutput(bool $normalize = false)
  70146. {
  70147. if (!$this->captureStreamsIndependently) {
  70148. throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.');
  70149. }
  70150. rewind($this->output->getErrorOutput()->getStream());
  70151. $display = stream_get_contents($this->output->getErrorOutput()->getStream());
  70152. if ($normalize) {
  70153. $display = str_replace(\PHP_EOL, "\n", $display);
  70154. }
  70155. return $display;
  70156. }
  70157. public function getInput()
  70158. {
  70159. return $this->input;
  70160. }
  70161. public function getOutput()
  70162. {
  70163. return $this->output;
  70164. }
  70165. public function getStatusCode()
  70166. {
  70167. if (null === $this->statusCode) {
  70168. throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?');
  70169. }
  70170. return $this->statusCode;
  70171. }
  70172. public function assertCommandIsSuccessful(string $message = ''): void
  70173. {
  70174. Assert::assertThat($this->statusCode, new CommandIsSuccessful(), $message);
  70175. }
  70176. public function setInputs(array $inputs)
  70177. {
  70178. $this->inputs = $inputs;
  70179. return $this;
  70180. }
  70181. private function initOutput(array $options)
  70182. {
  70183. $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
  70184. if (!$this->captureStreamsIndependently) {
  70185. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  70186. if (isset($options['decorated'])) {
  70187. $this->output->setDecorated($options['decorated']);
  70188. }
  70189. if (isset($options['verbosity'])) {
  70190. $this->output->setVerbosity($options['verbosity']);
  70191. }
  70192. } else {
  70193. $this->output = new ConsoleOutput(
  70194. $options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
  70195. $options['decorated'] ?? null
  70196. );
  70197. $errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
  70198. $errorOutput->setFormatter($this->output->getFormatter());
  70199. $errorOutput->setVerbosity($this->output->getVerbosity());
  70200. $errorOutput->setDecorated($this->output->isDecorated());
  70201. $reflectedOutput = new \ReflectionObject($this->output);
  70202. $strErrProperty = $reflectedOutput->getProperty('stderr');
  70203. $strErrProperty->setAccessible(true);
  70204. $strErrProperty->setValue($this->output, $errorOutput);
  70205. $reflectedParent = $reflectedOutput->getParentClass();
  70206. $streamProperty = $reflectedParent->getProperty('stream');
  70207. $streamProperty->setAccessible(true);
  70208. $streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
  70209. }
  70210. }
  70211. private static function createStream(array $inputs)
  70212. {
  70213. $stream = fopen('php://memory', 'r+', false);
  70214. foreach ($inputs as $input) {
  70215. fwrite($stream, $input.\PHP_EOL);
  70216. }
  70217. rewind($stream);
  70218. return $stream;
  70219. }
  70220. }
  70221. Copyright (c) 2020-present Fabien Potencier
  70222. Permission is hereby granted, free of charge, to any person obtaining a copy
  70223. of this software and associated documentation files (the "Software"), to deal
  70224. in the Software without restriction, including without limitation the rights
  70225. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  70226. copies of the Software, and to permit persons to whom the Software is furnished
  70227. to do so, subject to the following conditions:
  70228. The above copyright notice and this permission notice shall be included in all
  70229. copies or substantial portions of the Software.
  70230. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  70231. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70232. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  70233. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  70234. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70235. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70236. THE SOFTWARE.
  70237. <?php
  70238. if (!function_exists('trigger_deprecation')) {
  70239. function trigger_deprecation(string $package, string $version, string $message, ...$args): void
  70240. {
  70241. @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
  70242. }
  70243. }
  70244. <?php
  70245. namespace Symfony\Component\Filesystem\Exception;
  70246. interface ExceptionInterface extends \Throwable
  70247. {
  70248. }
  70249. <?php
  70250. namespace Symfony\Component\Filesystem\Exception;
  70251. class FileNotFoundException extends IOException
  70252. {
  70253. public function __construct(?string $message = null, int $code = 0, ?\Throwable $previous = null, ?string $path = null)
  70254. {
  70255. if (null === $message) {
  70256. if (null === $path) {
  70257. $message = 'File could not be found.';
  70258. } else {
  70259. $message = sprintf('File "%s" could not be found.', $path);
  70260. }
  70261. }
  70262. parent::__construct($message, $code, $previous, $path);
  70263. }
  70264. }
  70265. <?php
  70266. namespace Symfony\Component\Filesystem\Exception;
  70267. class IOException extends \RuntimeException implements IOExceptionInterface
  70268. {
  70269. private $path;
  70270. public function __construct(string $message, int $code = 0, ?\Throwable $previous = null, ?string $path = null)
  70271. {
  70272. $this->path = $path;
  70273. parent::__construct($message, $code, $previous);
  70274. }
  70275. public function getPath()
  70276. {
  70277. return $this->path;
  70278. }
  70279. }
  70280. <?php
  70281. namespace Symfony\Component\Filesystem\Exception;
  70282. interface IOExceptionInterface extends ExceptionInterface
  70283. {
  70284. public function getPath();
  70285. }
  70286. <?php
  70287. namespace Symfony\Component\Filesystem\Exception;
  70288. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  70289. {
  70290. }
  70291. <?php
  70292. namespace Symfony\Component\Filesystem\Exception;
  70293. class RuntimeException extends \RuntimeException implements ExceptionInterface
  70294. {
  70295. }
  70296. <?php
  70297. namespace Symfony\Component\Filesystem;
  70298. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  70299. use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
  70300. use Symfony\Component\Filesystem\Exception\IOException;
  70301. class Filesystem
  70302. {
  70303. private static $lastError;
  70304. public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false)
  70305. {
  70306. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  70307. if ($originIsLocal && !is_file($originFile)) {
  70308. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  70309. }
  70310. $this->mkdir(\dirname($targetFile));
  70311. $doCopy = true;
  70312. if (!$overwriteNewerFiles && !parse_url($originFile, \PHP_URL_HOST) && is_file($targetFile)) {
  70313. $doCopy = filemtime($originFile) > filemtime($targetFile);
  70314. }
  70315. if ($doCopy) {
  70316. if (!$source = self::box('fopen', $originFile, 'r')) {
  70317. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
  70318. }
  70319. if (!$target = self::box('fopen', $targetFile, 'w', false, stream_context_create(['ftp' => ['overwrite' => true]]))) {
  70320. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
  70321. }
  70322. $bytesCopied = stream_copy_to_stream($source, $target);
  70323. fclose($source);
  70324. fclose($target);
  70325. unset($source, $target);
  70326. if (!is_file($targetFile)) {
  70327. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  70328. }
  70329. if ($originIsLocal) {
  70330. self::box('chmod', $targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  70331. self::box('touch', $targetFile, filemtime($originFile));
  70332. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  70333. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  70334. }
  70335. }
  70336. }
  70337. }
  70338. public function mkdir($dirs, int $mode = 0777)
  70339. {
  70340. foreach ($this->toIterable($dirs) as $dir) {
  70341. if (is_dir($dir)) {
  70342. continue;
  70343. }
  70344. if (!self::box('mkdir', $dir, $mode, true) && !is_dir($dir)) {
  70345. throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
  70346. }
  70347. }
  70348. }
  70349. public function exists($files)
  70350. {
  70351. $maxPathLength = \PHP_MAXPATHLEN - 2;
  70352. foreach ($this->toIterable($files) as $file) {
  70353. if (\strlen($file) > $maxPathLength) {
  70354. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  70355. }
  70356. if (!file_exists($file)) {
  70357. return false;
  70358. }
  70359. }
  70360. return true;
  70361. }
  70362. public function touch($files, ?int $time = null, ?int $atime = null)
  70363. {
  70364. foreach ($this->toIterable($files) as $file) {
  70365. if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) {
  70366. throw new IOException(sprintf('Failed to touch "%s": ', $file).self::$lastError, 0, null, $file);
  70367. }
  70368. }
  70369. }
  70370. public function remove($files)
  70371. {
  70372. if ($files instanceof \Traversable) {
  70373. $files = iterator_to_array($files, false);
  70374. } elseif (!\is_array($files)) {
  70375. $files = [$files];
  70376. }
  70377. self::doRemove($files, false);
  70378. }
  70379. private static function doRemove(array $files, bool $isRecursive): void
  70380. {
  70381. $files = array_reverse($files);
  70382. foreach ($files as $file) {
  70383. if (is_link($file)) {
  70384. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  70385. throw new IOException(sprintf('Failed to remove symlink "%s": ', $file).self::$lastError);
  70386. }
  70387. } elseif (is_dir($file)) {
  70388. if (!$isRecursive) {
  70389. $tmpName = \dirname(realpath($file)).'/.!'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-!'));
  70390. if (file_exists($tmpName)) {
  70391. try {
  70392. self::doRemove([$tmpName], true);
  70393. } catch (IOException $e) {
  70394. }
  70395. }
  70396. if (!file_exists($tmpName) && self::box('rename', $file, $tmpName)) {
  70397. $origFile = $file;
  70398. $file = $tmpName;
  70399. } else {
  70400. $origFile = null;
  70401. }
  70402. }
  70403. $files = new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS);
  70404. self::doRemove(iterator_to_array($files, true), true);
  70405. if (!self::box('rmdir', $file) && file_exists($file) && !$isRecursive) {
  70406. $lastError = self::$lastError;
  70407. if (null !== $origFile && self::box('rename', $file, $origFile)) {
  70408. $file = $origFile;
  70409. }
  70410. throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$lastError);
  70411. }
  70412. } elseif (!self::box('unlink', $file) && ((self::$lastError && str_contains(self::$lastError, 'Permission denied')) || file_exists($file))) {
  70413. throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
  70414. }
  70415. }
  70416. }
  70417. public function chmod($files, int $mode, int $umask = 0000, bool $recursive = false)
  70418. {
  70419. foreach ($this->toIterable($files) as $file) {
  70420. if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && !self::box('chmod', $file, $mode & ~$umask)) {
  70421. throw new IOException(sprintf('Failed to chmod file "%s": ', $file).self::$lastError, 0, null, $file);
  70422. }
  70423. if ($recursive && is_dir($file) && !is_link($file)) {
  70424. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  70425. }
  70426. }
  70427. }
  70428. public function chown($files, $user, bool $recursive = false)
  70429. {
  70430. foreach ($this->toIterable($files) as $file) {
  70431. if ($recursive && is_dir($file) && !is_link($file)) {
  70432. $this->chown(new \FilesystemIterator($file), $user, true);
  70433. }
  70434. if (is_link($file) && \function_exists('lchown')) {
  70435. if (!self::box('lchown', $file, $user)) {
  70436. throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
  70437. }
  70438. } else {
  70439. if (!self::box('chown', $file, $user)) {
  70440. throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file);
  70441. }
  70442. }
  70443. }
  70444. }
  70445. public function chgrp($files, $group, bool $recursive = false)
  70446. {
  70447. foreach ($this->toIterable($files) as $file) {
  70448. if ($recursive && is_dir($file) && !is_link($file)) {
  70449. $this->chgrp(new \FilesystemIterator($file), $group, true);
  70450. }
  70451. if (is_link($file) && \function_exists('lchgrp')) {
  70452. if (!self::box('lchgrp', $file, $group)) {
  70453. throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
  70454. }
  70455. } else {
  70456. if (!self::box('chgrp', $file, $group)) {
  70457. throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file);
  70458. }
  70459. }
  70460. }
  70461. }
  70462. public function rename(string $origin, string $target, bool $overwrite = false)
  70463. {
  70464. if (!$overwrite && $this->isReadable($target)) {
  70465. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  70466. }
  70467. if (!self::box('rename', $origin, $target)) {
  70468. if (is_dir($origin)) {
  70469. $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);
  70470. $this->remove($origin);
  70471. return;
  70472. }
  70473. throw new IOException(sprintf('Cannot rename "%s" to "%s": ', $origin, $target).self::$lastError, 0, null, $target);
  70474. }
  70475. }
  70476. private function isReadable(string $filename): bool
  70477. {
  70478. $maxPathLength = \PHP_MAXPATHLEN - 2;
  70479. if (\strlen($filename) > $maxPathLength) {
  70480. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  70481. }
  70482. return is_readable($filename);
  70483. }
  70484. public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false)
  70485. {
  70486. self::assertFunctionExists('symlink');
  70487. if ('\\' === \DIRECTORY_SEPARATOR) {
  70488. $originDir = strtr($originDir, '/', '\\');
  70489. $targetDir = strtr($targetDir, '/', '\\');
  70490. if ($copyOnWindows) {
  70491. $this->mirror($originDir, $targetDir);
  70492. return;
  70493. }
  70494. }
  70495. $this->mkdir(\dirname($targetDir));
  70496. if (is_link($targetDir)) {
  70497. if (readlink($targetDir) === $originDir) {
  70498. return;
  70499. }
  70500. $this->remove($targetDir);
  70501. }
  70502. if (!self::box('symlink', $originDir, $targetDir)) {
  70503. $this->linkException($originDir, $targetDir, 'symbolic');
  70504. }
  70505. }
  70506. public function hardlink(string $originFile, $targetFiles)
  70507. {
  70508. self::assertFunctionExists('link');
  70509. if (!$this->exists($originFile)) {
  70510. throw new FileNotFoundException(null, 0, null, $originFile);
  70511. }
  70512. if (!is_file($originFile)) {
  70513. throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile));
  70514. }
  70515. foreach ($this->toIterable($targetFiles) as $targetFile) {
  70516. if (is_file($targetFile)) {
  70517. if (fileinode($originFile) === fileinode($targetFile)) {
  70518. continue;
  70519. }
  70520. $this->remove($targetFile);
  70521. }
  70522. if (!self::box('link', $originFile, $targetFile)) {
  70523. $this->linkException($originFile, $targetFile, 'hard');
  70524. }
  70525. }
  70526. }
  70527. private function linkException(string $origin, string $target, string $linkType)
  70528. {
  70529. if (self::$lastError) {
  70530. if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
  70531. throw new IOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
  70532. }
  70533. }
  70534. throw new IOException(sprintf('Failed to create "%s" link from "%s" to "%s": ', $linkType, $origin, $target).self::$lastError, 0, null, $target);
  70535. }
  70536. public function readlink(string $path, bool $canonicalize = false)
  70537. {
  70538. if (!$canonicalize && !is_link($path)) {
  70539. return null;
  70540. }
  70541. if ($canonicalize) {
  70542. if (!$this->exists($path)) {
  70543. return null;
  70544. }
  70545. if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) {
  70546. $path = readlink($path);
  70547. }
  70548. return realpath($path);
  70549. }
  70550. if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
  70551. return realpath($path);
  70552. }
  70553. return readlink($path);
  70554. }
  70555. public function makePathRelative(string $endPath, string $startPath)
  70556. {
  70557. if (!$this->isAbsolutePath($startPath)) {
  70558. throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
  70559. }
  70560. if (!$this->isAbsolutePath($endPath)) {
  70561. throw new InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
  70562. }
  70563. if ('\\' === \DIRECTORY_SEPARATOR) {
  70564. $endPath = str_replace('\\', '/', $endPath);
  70565. $startPath = str_replace('\\', '/', $startPath);
  70566. }
  70567. $splitDriveLetter = function ($path) {
  70568. return (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0]))
  70569. ? [substr($path, 2), strtoupper($path[0])]
  70570. : [$path, null];
  70571. };
  70572. $splitPath = function ($path) {
  70573. $result = [];
  70574. foreach (explode('/', trim($path, '/')) as $segment) {
  70575. if ('..' === $segment) {
  70576. array_pop($result);
  70577. } elseif ('.' !== $segment && '' !== $segment) {
  70578. $result[] = $segment;
  70579. }
  70580. }
  70581. return $result;
  70582. };
  70583. [$endPath, $endDriveLetter] = $splitDriveLetter($endPath);
  70584. [$startPath, $startDriveLetter] = $splitDriveLetter($startPath);
  70585. $startPathArr = $splitPath($startPath);
  70586. $endPathArr = $splitPath($endPath);
  70587. if ($endDriveLetter && $startDriveLetter && $endDriveLetter != $startDriveLetter) {
  70588. return $endDriveLetter.':/'.($endPathArr ? implode('/', $endPathArr).'/' : '');
  70589. }
  70590. $index = 0;
  70591. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  70592. ++$index;
  70593. }
  70594. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  70595. $depth = 0;
  70596. } else {
  70597. $depth = \count($startPathArr) - $index;
  70598. }
  70599. $traverser = str_repeat('../', $depth);
  70600. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  70601. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  70602. return '' === $relativePath ? './' : $relativePath;
  70603. }
  70604. public function mirror(string $originDir, string $targetDir, ?\Traversable $iterator = null, array $options = [])
  70605. {
  70606. $targetDir = rtrim($targetDir, '/\\');
  70607. $originDir = rtrim($originDir, '/\\');
  70608. $originDirLen = \strlen($originDir);
  70609. if (!$this->exists($originDir)) {
  70610. throw new IOException(sprintf('The origin directory specified "%s" was not found.', $originDir), 0, null, $originDir);
  70611. }
  70612. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  70613. $deleteIterator = $iterator;
  70614. if (null === $deleteIterator) {
  70615. $flags = \FilesystemIterator::SKIP_DOTS;
  70616. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  70617. }
  70618. $targetDirLen = \strlen($targetDir);
  70619. foreach ($deleteIterator as $file) {
  70620. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  70621. if (!$this->exists($origin)) {
  70622. $this->remove($file);
  70623. }
  70624. }
  70625. }
  70626. $copyOnWindows = $options['copy_on_windows'] ?? false;
  70627. if (null === $iterator) {
  70628. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  70629. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  70630. }
  70631. $this->mkdir($targetDir);
  70632. $filesCreatedWhileMirroring = [];
  70633. foreach ($iterator as $file) {
  70634. if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) {
  70635. continue;
  70636. }
  70637. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  70638. $filesCreatedWhileMirroring[$target] = true;
  70639. if (!$copyOnWindows && is_link($file)) {
  70640. $this->symlink($file->getLinkTarget(), $target);
  70641. } elseif (is_dir($file)) {
  70642. $this->mkdir($target);
  70643. } elseif (is_file($file)) {
  70644. $this->copy($file, $target, $options['override'] ?? false);
  70645. } else {
  70646. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  70647. }
  70648. }
  70649. }
  70650. public function isAbsolutePath(string $file)
  70651. {
  70652. return '' !== $file && (strspn($file, '/\\', 0, 1)
  70653. || (\strlen($file) > 3 && ctype_alpha($file[0])
  70654. && ':' === $file[1]
  70655. && strspn($file, '/\\', 2, 1)
  70656. )
  70657. || null !== parse_url($file, \PHP_URL_SCHEME)
  70658. );
  70659. }
  70660. public function tempnam(string $dir, string $prefix)
  70661. {
  70662. $suffix = \func_num_args() > 2 ? func_get_arg(2) : '';
  70663. [$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir);
  70664. if ((null === $scheme || 'file' === $scheme || 'gs' === $scheme) && '' === $suffix) {
  70665. if ($tmpFile = self::box('tempnam', $hierarchy, $prefix)) {
  70666. if (null !== $scheme && 'gs' !== $scheme) {
  70667. return $scheme.'://'.$tmpFile;
  70668. }
  70669. return $tmpFile;
  70670. }
  70671. throw new IOException('A temporary file could not be created: '.self::$lastError);
  70672. }
  70673. for ($i = 0; $i < 10; ++$i) {
  70674. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true).$suffix;
  70675. if (!$handle = self::box('fopen', $tmpFile, 'x+')) {
  70676. continue;
  70677. }
  70678. self::box('fclose', $handle);
  70679. return $tmpFile;
  70680. }
  70681. throw new IOException('A temporary file could not be created: '.self::$lastError);
  70682. }
  70683. public function dumpFile(string $filename, $content)
  70684. {
  70685. if (\is_array($content)) {
  70686. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
  70687. }
  70688. $dir = \dirname($filename);
  70689. if (is_link($filename) && $linkTarget = $this->readlink($filename)) {
  70690. $this->dumpFile(Path::makeAbsolute($linkTarget, $dir), $content);
  70691. return;
  70692. }
  70693. if (!is_dir($dir)) {
  70694. $this->mkdir($dir);
  70695. }
  70696. $tmpFile = $this->tempnam($dir, basename($filename));
  70697. try {
  70698. if (false === self::box('file_put_contents', $tmpFile, $content)) {
  70699. throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
  70700. }
  70701. self::box('chmod', $tmpFile, self::box('fileperms', $filename) ?: 0666 & ~umask());
  70702. $this->rename($tmpFile, $filename, true);
  70703. } finally {
  70704. if (file_exists($tmpFile)) {
  70705. if ('\\' === \DIRECTORY_SEPARATOR && !is_writable($tmpFile)) {
  70706. self::box('chmod', $tmpFile, self::box('fileperms', $tmpFile) | 0200);
  70707. }
  70708. self::box('unlink', $tmpFile);
  70709. }
  70710. }
  70711. }
  70712. public function appendToFile(string $filename, $content)
  70713. {
  70714. if (\is_array($content)) {
  70715. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
  70716. }
  70717. $dir = \dirname($filename);
  70718. if (!is_dir($dir)) {
  70719. $this->mkdir($dir);
  70720. }
  70721. $lock = \func_num_args() > 2 && func_get_arg(2);
  70722. if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND | ($lock ? \LOCK_EX : 0))) {
  70723. throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
  70724. }
  70725. }
  70726. private function toIterable($files): iterable
  70727. {
  70728. return is_iterable($files) ? $files : [$files];
  70729. }
  70730. private function getSchemeAndHierarchy(string $filename): array
  70731. {
  70732. $components = explode('://', $filename, 2);
  70733. return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
  70734. }
  70735. private static function assertFunctionExists(string $func): void
  70736. {
  70737. if (!\function_exists($func)) {
  70738. throw new IOException(sprintf('Unable to perform filesystem operation because the "%s()" function has been disabled.', $func));
  70739. }
  70740. }
  70741. private static function box(string $func, ...$args)
  70742. {
  70743. self::assertFunctionExists($func);
  70744. self::$lastError = null;
  70745. set_error_handler(__CLASS__.'::handleError');
  70746. try {
  70747. return $func(...$args);
  70748. } finally {
  70749. restore_error_handler();
  70750. }
  70751. }
  70752. public static function handleError(int $type, string $msg)
  70753. {
  70754. self::$lastError = $msg;
  70755. }
  70756. }
  70757. Copyright (c) 2004-present Fabien Potencier
  70758. Permission is hereby granted, free of charge, to any person obtaining a copy
  70759. of this software and associated documentation files (the "Software"), to deal
  70760. in the Software without restriction, including without limitation the rights
  70761. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  70762. copies of the Software, and to permit persons to whom the Software is furnished
  70763. to do so, subject to the following conditions:
  70764. The above copyright notice and this permission notice shall be included in all
  70765. copies or substantial portions of the Software.
  70766. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  70767. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  70768. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  70769. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  70770. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70771. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70772. THE SOFTWARE.
  70773. <?php
  70774. namespace Symfony\Component\Filesystem;
  70775. use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
  70776. use Symfony\Component\Filesystem\Exception\RuntimeException;
  70777. final class Path
  70778. {
  70779. private const CLEANUP_THRESHOLD = 1250;
  70780. private const CLEANUP_SIZE = 1000;
  70781. private static $buffer = [];
  70782. private static $bufferSize = 0;
  70783. public static function canonicalize(string $path): string
  70784. {
  70785. if ('' === $path) {
  70786. return '';
  70787. }
  70788. if (isset(self::$buffer[$path])) {
  70789. return self::$buffer[$path];
  70790. }
  70791. if ('~' === $path[0]) {
  70792. $path = self::getHomeDirectory().substr($path, 1);
  70793. }
  70794. $path = self::normalize($path);
  70795. [$root, $pathWithoutRoot] = self::split($path);
  70796. $canonicalParts = self::findCanonicalParts($root, $pathWithoutRoot);
  70797. self::$buffer[$path] = $canonicalPath = $root.implode('/', $canonicalParts);
  70798. ++self::$bufferSize;
  70799. if (self::$bufferSize > self::CLEANUP_THRESHOLD) {
  70800. self::$buffer = \array_slice(self::$buffer, -self::CLEANUP_SIZE, null, true);
  70801. self::$bufferSize = self::CLEANUP_SIZE;
  70802. }
  70803. return $canonicalPath;
  70804. }
  70805. public static function normalize(string $path): string
  70806. {
  70807. return str_replace('\\', '/', $path);
  70808. }
  70809. public static function getDirectory(string $path): string
  70810. {
  70811. if ('' === $path) {
  70812. return '';
  70813. }
  70814. $path = self::canonicalize($path);
  70815. if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
  70816. $scheme = substr($path, 0, $schemeSeparatorPosition + 3);
  70817. $path = substr($path, $schemeSeparatorPosition + 3);
  70818. } else {
  70819. $scheme = '';
  70820. }
  70821. if (false === $dirSeparatorPosition = strrpos($path, '/')) {
  70822. return '';
  70823. }
  70824. if (0 === $dirSeparatorPosition) {
  70825. return $scheme.'/';
  70826. }
  70827. if (2 === $dirSeparatorPosition && ctype_alpha($path[0]) && ':' === $path[1]) {
  70828. return $scheme.substr($path, 0, 3);
  70829. }
  70830. return $scheme.substr($path, 0, $dirSeparatorPosition);
  70831. }
  70832. public static function getHomeDirectory(): string
  70833. {
  70834. if (getenv('HOME')) {
  70835. return self::canonicalize(getenv('HOME'));
  70836. }
  70837. if (getenv('HOMEDRIVE') && getenv('HOMEPATH')) {
  70838. return self::canonicalize(getenv('HOMEDRIVE').getenv('HOMEPATH'));
  70839. }
  70840. throw new RuntimeException("Cannot find the home directory path: Your environment or operating system isn't supported.");
  70841. }
  70842. public static function getRoot(string $path): string
  70843. {
  70844. if ('' === $path) {
  70845. return '';
  70846. }
  70847. if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
  70848. $scheme = substr($path, 0, $schemeSeparatorPosition + 3);
  70849. $path = substr($path, $schemeSeparatorPosition + 3);
  70850. } else {
  70851. $scheme = '';
  70852. }
  70853. $firstCharacter = $path[0];
  70854. if ('/' === $firstCharacter || '\\' === $firstCharacter) {
  70855. return $scheme.'/';
  70856. }
  70857. $length = \strlen($path);
  70858. if ($length > 1 && ':' === $path[1] && ctype_alpha($firstCharacter)) {
  70859. if (2 === $length) {
  70860. return $scheme.$path.'/';
  70861. }
  70862. if ('/' === $path[2] || '\\' === $path[2]) {
  70863. return $scheme.$firstCharacter.$path[1].'/';
  70864. }
  70865. }
  70866. return '';
  70867. }
  70868. public static function getFilenameWithoutExtension(string $path, ?string $extension = null): string
  70869. {
  70870. if ('' === $path) {
  70871. return '';
  70872. }
  70873. if (null !== $extension) {
  70874. return rtrim(basename($path, $extension), '.');
  70875. }
  70876. return pathinfo($path, \PATHINFO_FILENAME);
  70877. }
  70878. public static function getExtension(string $path, bool $forceLowerCase = false): string
  70879. {
  70880. if ('' === $path) {
  70881. return '';
  70882. }
  70883. $extension = pathinfo($path, \PATHINFO_EXTENSION);
  70884. if ($forceLowerCase) {
  70885. $extension = self::toLower($extension);
  70886. }
  70887. return $extension;
  70888. }
  70889. public static function hasExtension(string $path, $extensions = null, bool $ignoreCase = false): bool
  70890. {
  70891. if ('' === $path) {
  70892. return false;
  70893. }
  70894. $actualExtension = self::getExtension($path, $ignoreCase);
  70895. if ([] === $extensions || null === $extensions) {
  70896. return '' !== $actualExtension;
  70897. }
  70898. if (\is_string($extensions)) {
  70899. $extensions = [$extensions];
  70900. }
  70901. foreach ($extensions as $key => $extension) {
  70902. if ($ignoreCase) {
  70903. $extension = self::toLower($extension);
  70904. }
  70905. $extensions[$key] = ltrim($extension, '.');
  70906. }
  70907. return \in_array($actualExtension, $extensions, true);
  70908. }
  70909. public static function changeExtension(string $path, string $extension): string
  70910. {
  70911. if ('' === $path) {
  70912. return '';
  70913. }
  70914. $actualExtension = self::getExtension($path);
  70915. $extension = ltrim($extension, '.');
  70916. if ('/' === substr($path, -1)) {
  70917. return $path;
  70918. }
  70919. if (empty($actualExtension)) {
  70920. return $path.('.' === substr($path, -1) ? '' : '.').$extension;
  70921. }
  70922. return substr($path, 0, -\strlen($actualExtension)).$extension;
  70923. }
  70924. public static function isAbsolute(string $path): bool
  70925. {
  70926. if ('' === $path) {
  70927. return false;
  70928. }
  70929. if (false !== ($schemeSeparatorPosition = strpos($path, '://')) && 1 !== $schemeSeparatorPosition) {
  70930. $path = substr($path, $schemeSeparatorPosition + 3);
  70931. }
  70932. $firstCharacter = $path[0];
  70933. if ('/' === $firstCharacter || '\\' === $firstCharacter) {
  70934. return true;
  70935. }
  70936. if (\strlen($path) > 1 && ctype_alpha($firstCharacter) && ':' === $path[1]) {
  70937. if (2 === \strlen($path)) {
  70938. return true;
  70939. }
  70940. if ('/' === $path[2] || '\\' === $path[2]) {
  70941. return true;
  70942. }
  70943. }
  70944. return false;
  70945. }
  70946. public static function isRelative(string $path): bool
  70947. {
  70948. return !self::isAbsolute($path);
  70949. }
  70950. public static function makeAbsolute(string $path, string $basePath): string
  70951. {
  70952. if ('' === $basePath) {
  70953. throw new InvalidArgumentException(sprintf('The base path must be a non-empty string. Got: "%s".', $basePath));
  70954. }
  70955. if (!self::isAbsolute($basePath)) {
  70956. throw new InvalidArgumentException(sprintf('The base path "%s" is not an absolute path.', $basePath));
  70957. }
  70958. if (self::isAbsolute($path)) {
  70959. return self::canonicalize($path);
  70960. }
  70961. if (false !== $schemeSeparatorPosition = strpos($basePath, '://')) {
  70962. $scheme = substr($basePath, 0, $schemeSeparatorPosition + 3);
  70963. $basePath = substr($basePath, $schemeSeparatorPosition + 3);
  70964. } else {
  70965. $scheme = '';
  70966. }
  70967. return $scheme.self::canonicalize(rtrim($basePath, '/\\').'/'.$path);
  70968. }
  70969. public static function makeRelative(string $path, string $basePath): string
  70970. {
  70971. $path = self::canonicalize($path);
  70972. $basePath = self::canonicalize($basePath);
  70973. [$root, $relativePath] = self::split($path);
  70974. [$baseRoot, $relativeBasePath] = self::split($basePath);
  70975. if ('' === $root && '' !== $baseRoot) {
  70976. if ('' === $relativeBasePath) {
  70977. $relativePath = ltrim($relativePath, './\\');
  70978. }
  70979. return $relativePath;
  70980. }
  70981. if ('' !== $root && '' === $baseRoot) {
  70982. throw new InvalidArgumentException(sprintf('The absolute path "%s" cannot be made relative to the relative path "%s". You should provide an absolute base path instead.', $path, $basePath));
  70983. }
  70984. if ($baseRoot && $root !== $baseRoot) {
  70985. throw new InvalidArgumentException(sprintf('The path "%s" cannot be made relative to "%s", because they have different roots ("%s" and "%s").', $path, $basePath, $root, $baseRoot));
  70986. }
  70987. if ('' === $relativeBasePath) {
  70988. return $relativePath;
  70989. }
  70990. $parts = explode('/', $relativePath);
  70991. $baseParts = explode('/', $relativeBasePath);
  70992. $dotDotPrefix = '';
  70993. $match = true;
  70994. foreach ($baseParts as $index => $basePart) {
  70995. if ($match && isset($parts[$index]) && $basePart === $parts[$index]) {
  70996. unset($parts[$index]);
  70997. continue;
  70998. }
  70999. $match = false;
  71000. $dotDotPrefix .= '../';
  71001. }
  71002. return rtrim($dotDotPrefix.implode('/', $parts), '/');
  71003. }
  71004. public static function isLocal(string $path): bool
  71005. {
  71006. return '' !== $path && false === strpos($path, '://');
  71007. }
  71008. public static function getLongestCommonBasePath(string ...$paths): ?string
  71009. {
  71010. [$bpRoot, $basePath] = self::split(self::canonicalize(reset($paths)));
  71011. for (next($paths); null !== key($paths) && '' !== $basePath; next($paths)) {
  71012. [$root, $path] = self::split(self::canonicalize(current($paths)));
  71013. if ($root !== $bpRoot) {
  71014. return null;
  71015. }
  71016. while (true) {
  71017. if ('.' === $basePath) {
  71018. $basePath = '';
  71019. continue 2;
  71020. }
  71021. if (0 === strpos($path.'/', $basePath.'/')) {
  71022. continue 2;
  71023. }
  71024. $basePath = \dirname($basePath);
  71025. }
  71026. }
  71027. return $bpRoot.$basePath;
  71028. }
  71029. public static function join(string ...$paths): string
  71030. {
  71031. $finalPath = null;
  71032. $wasScheme = false;
  71033. foreach ($paths as $path) {
  71034. if ('' === $path) {
  71035. continue;
  71036. }
  71037. if (null === $finalPath) {
  71038. $finalPath = $path;
  71039. $wasScheme = (false !== strpos($path, '://'));
  71040. continue;
  71041. }
  71042. if (!\in_array(substr($finalPath, -1), ['/', '\\'])) {
  71043. $finalPath .= '/';
  71044. }
  71045. $finalPath .= $wasScheme ? $path : ltrim($path, '/');
  71046. $wasScheme = false;
  71047. }
  71048. if (null === $finalPath) {
  71049. return '';
  71050. }
  71051. return self::canonicalize($finalPath);
  71052. }
  71053. public static function isBasePath(string $basePath, string $ofPath): bool
  71054. {
  71055. $basePath = self::canonicalize($basePath);
  71056. $ofPath = self::canonicalize($ofPath);
  71057. return 0 === strpos($ofPath.'/', rtrim($basePath, '/').'/');
  71058. }
  71059. private static function findCanonicalParts(string $root, string $pathWithoutRoot): array
  71060. {
  71061. $parts = explode('/', $pathWithoutRoot);
  71062. $canonicalParts = [];
  71063. foreach ($parts as $part) {
  71064. if ('.' === $part || '' === $part) {
  71065. continue;
  71066. }
  71067. if ('..' === $part && \count($canonicalParts) > 0 && '..' !== $canonicalParts[\count($canonicalParts) - 1]) {
  71068. array_pop($canonicalParts);
  71069. continue;
  71070. }
  71071. if ('..' !== $part || '' === $root) {
  71072. $canonicalParts[] = $part;
  71073. }
  71074. }
  71075. return $canonicalParts;
  71076. }
  71077. private static function split(string $path): array
  71078. {
  71079. if ('' === $path) {
  71080. return ['', ''];
  71081. }
  71082. if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
  71083. $root = substr($path, 0, $schemeSeparatorPosition + 3);
  71084. $path = substr($path, $schemeSeparatorPosition + 3);
  71085. } else {
  71086. $root = '';
  71087. }
  71088. $length = \strlen($path);
  71089. if (0 === strpos($path, '/')) {
  71090. $root .= '/';
  71091. $path = $length > 1 ? substr($path, 1) : '';
  71092. } elseif ($length > 1 && ctype_alpha($path[0]) && ':' === $path[1]) {
  71093. if (2 === $length) {
  71094. $root .= $path.'/';
  71095. $path = '';
  71096. } elseif ('/' === $path[2]) {
  71097. $root .= substr($path, 0, 3);
  71098. $path = $length > 3 ? substr($path, 3) : '';
  71099. }
  71100. }
  71101. return [$root, $path];
  71102. }
  71103. private static function toLower(string $string): string
  71104. {
  71105. if (false !== $encoding = mb_detect_encoding($string, null, true)) {
  71106. return mb_strtolower($string, $encoding);
  71107. }
  71108. return strtolower($string);
  71109. }
  71110. private function __construct()
  71111. {
  71112. }
  71113. }
  71114. <?php
  71115. namespace Symfony\Component\Finder\Comparator;
  71116. class Comparator
  71117. {
  71118. private $target;
  71119. private $operator = '==';
  71120. public function __construct(?string $target = null, string $operator = '==')
  71121. {
  71122. if (null === $target) {
  71123. trigger_deprecation('symfony/finder', '5.4', 'Constructing a "%s" without setting "$target" is deprecated.', __CLASS__);
  71124. }
  71125. $this->target = $target;
  71126. $this->doSetOperator($operator);
  71127. }
  71128. public function getTarget()
  71129. {
  71130. if (null === $this->target) {
  71131. trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
  71132. }
  71133. return $this->target;
  71134. }
  71135. public function setTarget(string $target)
  71136. {
  71137. trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the target via the constructor instead.', __METHOD__);
  71138. $this->target = $target;
  71139. }
  71140. public function getOperator()
  71141. {
  71142. return $this->operator;
  71143. }
  71144. public function setOperator(string $operator)
  71145. {
  71146. trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the operator via the constructor instead.', __METHOD__);
  71147. $this->doSetOperator('' === $operator ? '==' : $operator);
  71148. }
  71149. public function test($test)
  71150. {
  71151. if (null === $this->target) {
  71152. trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
  71153. }
  71154. switch ($this->operator) {
  71155. case '>':
  71156. return $test > $this->target;
  71157. case '>=':
  71158. return $test >= $this->target;
  71159. case '<':
  71160. return $test < $this->target;
  71161. case '<=':
  71162. return $test <= $this->target;
  71163. case '!=':
  71164. return $test != $this->target;
  71165. }
  71166. return $test == $this->target;
  71167. }
  71168. private function doSetOperator(string $operator): void
  71169. {
  71170. if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
  71171. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  71172. }
  71173. $this->operator = $operator;
  71174. }
  71175. }
  71176. <?php
  71177. namespace Symfony\Component\Finder\Comparator;
  71178. class DateComparator extends Comparator
  71179. {
  71180. public function __construct(string $test)
  71181. {
  71182. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  71183. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  71184. }
  71185. try {
  71186. $date = new \DateTime($matches[2]);
  71187. $target = $date->format('U');
  71188. } catch (\Exception $e) {
  71189. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  71190. }
  71191. $operator = $matches[1] ?? '==';
  71192. if ('since' === $operator || 'after' === $operator) {
  71193. $operator = '>';
  71194. }
  71195. if ('until' === $operator || 'before' === $operator) {
  71196. $operator = '<';
  71197. }
  71198. parent::__construct($target, $operator);
  71199. }
  71200. }
  71201. <?php
  71202. namespace Symfony\Component\Finder\Comparator;
  71203. class NumberComparator extends Comparator
  71204. {
  71205. public function __construct(?string $test)
  71206. {
  71207. if (null === $test || !preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  71208. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test ?? 'null'));
  71209. }
  71210. $target = $matches[2];
  71211. if (!is_numeric($target)) {
  71212. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  71213. }
  71214. if (isset($matches[3])) {
  71215. switch (strtolower($matches[3])) {
  71216. case 'k':
  71217. $target *= 1000;
  71218. break;
  71219. case 'ki':
  71220. $target *= 1024;
  71221. break;
  71222. case 'm':
  71223. $target *= 1000000;
  71224. break;
  71225. case 'mi':
  71226. $target *= 1024 * 1024;
  71227. break;
  71228. case 'g':
  71229. $target *= 1000000000;
  71230. break;
  71231. case 'gi':
  71232. $target *= 1024 * 1024 * 1024;
  71233. break;
  71234. }
  71235. }
  71236. parent::__construct($target, $matches[1] ?: '==');
  71237. }
  71238. }
  71239. <?php
  71240. namespace Symfony\Component\Finder\Exception;
  71241. class AccessDeniedException extends \UnexpectedValueException
  71242. {
  71243. }
  71244. <?php
  71245. namespace Symfony\Component\Finder\Exception;
  71246. class DirectoryNotFoundException extends \InvalidArgumentException
  71247. {
  71248. }
  71249. <?php
  71250. namespace Symfony\Component\Finder;
  71251. use Symfony\Component\Finder\Comparator\DateComparator;
  71252. use Symfony\Component\Finder\Comparator\NumberComparator;
  71253. use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
  71254. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  71255. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  71256. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  71257. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  71258. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  71259. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  71260. use Symfony\Component\Finder\Iterator\LazyIterator;
  71261. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  71262. use Symfony\Component\Finder\Iterator\SortableIterator;
  71263. class Finder implements \IteratorAggregate, \Countable
  71264. {
  71265. public const IGNORE_VCS_FILES = 1;
  71266. public const IGNORE_DOT_FILES = 2;
  71267. public const IGNORE_VCS_IGNORED_FILES = 4;
  71268. private $mode = 0;
  71269. private $names = [];
  71270. private $notNames = [];
  71271. private $exclude = [];
  71272. private $filters = [];
  71273. private $depths = [];
  71274. private $sizes = [];
  71275. private $followLinks = false;
  71276. private $reverseSorting = false;
  71277. private $sort = false;
  71278. private $ignore = 0;
  71279. private $dirs = [];
  71280. private $dates = [];
  71281. private $iterators = [];
  71282. private $contains = [];
  71283. private $notContains = [];
  71284. private $paths = [];
  71285. private $notPaths = [];
  71286. private $ignoreUnreadableDirs = false;
  71287. private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'];
  71288. public function __construct()
  71289. {
  71290. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  71291. }
  71292. public static function create()
  71293. {
  71294. return new static();
  71295. }
  71296. public function directories()
  71297. {
  71298. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  71299. return $this;
  71300. }
  71301. public function files()
  71302. {
  71303. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  71304. return $this;
  71305. }
  71306. public function depth($levels)
  71307. {
  71308. foreach ((array) $levels as $level) {
  71309. $this->depths[] = new Comparator\NumberComparator($level);
  71310. }
  71311. return $this;
  71312. }
  71313. public function date($dates)
  71314. {
  71315. foreach ((array) $dates as $date) {
  71316. $this->dates[] = new Comparator\DateComparator($date);
  71317. }
  71318. return $this;
  71319. }
  71320. public function name($patterns)
  71321. {
  71322. $this->names = array_merge($this->names, (array) $patterns);
  71323. return $this;
  71324. }
  71325. public function notName($patterns)
  71326. {
  71327. $this->notNames = array_merge($this->notNames, (array) $patterns);
  71328. return $this;
  71329. }
  71330. public function contains($patterns)
  71331. {
  71332. $this->contains = array_merge($this->contains, (array) $patterns);
  71333. return $this;
  71334. }
  71335. public function notContains($patterns)
  71336. {
  71337. $this->notContains = array_merge($this->notContains, (array) $patterns);
  71338. return $this;
  71339. }
  71340. public function path($patterns)
  71341. {
  71342. $this->paths = array_merge($this->paths, (array) $patterns);
  71343. return $this;
  71344. }
  71345. public function notPath($patterns)
  71346. {
  71347. $this->notPaths = array_merge($this->notPaths, (array) $patterns);
  71348. return $this;
  71349. }
  71350. public function size($sizes)
  71351. {
  71352. foreach ((array) $sizes as $size) {
  71353. $this->sizes[] = new Comparator\NumberComparator($size);
  71354. }
  71355. return $this;
  71356. }
  71357. public function exclude($dirs)
  71358. {
  71359. $this->exclude = array_merge($this->exclude, (array) $dirs);
  71360. return $this;
  71361. }
  71362. public function ignoreDotFiles(bool $ignoreDotFiles)
  71363. {
  71364. if ($ignoreDotFiles) {
  71365. $this->ignore |= static::IGNORE_DOT_FILES;
  71366. } else {
  71367. $this->ignore &= ~static::IGNORE_DOT_FILES;
  71368. }
  71369. return $this;
  71370. }
  71371. public function ignoreVCS(bool $ignoreVCS)
  71372. {
  71373. if ($ignoreVCS) {
  71374. $this->ignore |= static::IGNORE_VCS_FILES;
  71375. } else {
  71376. $this->ignore &= ~static::IGNORE_VCS_FILES;
  71377. }
  71378. return $this;
  71379. }
  71380. public function ignoreVCSIgnored(bool $ignoreVCSIgnored)
  71381. {
  71382. if ($ignoreVCSIgnored) {
  71383. $this->ignore |= static::IGNORE_VCS_IGNORED_FILES;
  71384. } else {
  71385. $this->ignore &= ~static::IGNORE_VCS_IGNORED_FILES;
  71386. }
  71387. return $this;
  71388. }
  71389. public static function addVCSPattern($pattern)
  71390. {
  71391. foreach ((array) $pattern as $p) {
  71392. self::$vcsPatterns[] = $p;
  71393. }
  71394. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  71395. }
  71396. public function sort(\Closure $closure)
  71397. {
  71398. $this->sort = $closure;
  71399. return $this;
  71400. }
  71401. public function sortByName(bool $useNaturalSort = false)
  71402. {
  71403. $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME;
  71404. return $this;
  71405. }
  71406. public function sortByType()
  71407. {
  71408. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  71409. return $this;
  71410. }
  71411. public function sortByAccessedTime()
  71412. {
  71413. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  71414. return $this;
  71415. }
  71416. public function reverseSorting()
  71417. {
  71418. $this->reverseSorting = true;
  71419. return $this;
  71420. }
  71421. public function sortByChangedTime()
  71422. {
  71423. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  71424. return $this;
  71425. }
  71426. public function sortByModifiedTime()
  71427. {
  71428. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  71429. return $this;
  71430. }
  71431. public function filter(\Closure $closure)
  71432. {
  71433. $this->filters[] = $closure;
  71434. return $this;
  71435. }
  71436. public function followLinks()
  71437. {
  71438. $this->followLinks = true;
  71439. return $this;
  71440. }
  71441. public function ignoreUnreadableDirs(bool $ignore = true)
  71442. {
  71443. $this->ignoreUnreadableDirs = $ignore;
  71444. return $this;
  71445. }
  71446. public function in($dirs)
  71447. {
  71448. $resolvedDirs = [];
  71449. foreach ((array) $dirs as $dir) {
  71450. if (is_dir($dir)) {
  71451. $resolvedDirs[] = [$this->normalizeDir($dir)];
  71452. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) {
  71453. sort($glob);
  71454. $resolvedDirs[] = array_map([$this, 'normalizeDir'], $glob);
  71455. } else {
  71456. throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
  71457. }
  71458. }
  71459. $this->dirs = array_merge($this->dirs, ...$resolvedDirs);
  71460. return $this;
  71461. }
  71462. #[\ReturnTypeWillChange]
  71463. public function getIterator()
  71464. {
  71465. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  71466. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  71467. }
  71468. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  71469. $iterator = $this->searchInDirectory($this->dirs[0]);
  71470. if ($this->sort || $this->reverseSorting) {
  71471. $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
  71472. }
  71473. return $iterator;
  71474. }
  71475. $iterator = new \AppendIterator();
  71476. foreach ($this->dirs as $dir) {
  71477. $iterator->append(new \IteratorIterator(new LazyIterator(function () use ($dir) {
  71478. return $this->searchInDirectory($dir);
  71479. })));
  71480. }
  71481. foreach ($this->iterators as $it) {
  71482. $iterator->append($it);
  71483. }
  71484. if ($this->sort || $this->reverseSorting) {
  71485. $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
  71486. }
  71487. return $iterator;
  71488. }
  71489. public function append(iterable $iterator)
  71490. {
  71491. if ($iterator instanceof \IteratorAggregate) {
  71492. $this->iterators[] = $iterator->getIterator();
  71493. } elseif ($iterator instanceof \Iterator) {
  71494. $this->iterators[] = $iterator;
  71495. } elseif (is_iterable($iterator)) {
  71496. $it = new \ArrayIterator();
  71497. foreach ($iterator as $file) {
  71498. $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
  71499. $it[$file->getPathname()] = $file;
  71500. }
  71501. $this->iterators[] = $it;
  71502. } else {
  71503. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  71504. }
  71505. return $this;
  71506. }
  71507. public function hasResults()
  71508. {
  71509. foreach ($this->getIterator() as $_) {
  71510. return true;
  71511. }
  71512. return false;
  71513. }
  71514. #[\ReturnTypeWillChange]
  71515. public function count()
  71516. {
  71517. return iterator_count($this->getIterator());
  71518. }
  71519. private function searchInDirectory(string $dir): \Iterator
  71520. {
  71521. $exclude = $this->exclude;
  71522. $notPaths = $this->notPaths;
  71523. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  71524. $exclude = array_merge($exclude, self::$vcsPatterns);
  71525. }
  71526. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  71527. $notPaths[] = '#(^|/)\..+(/|$)#';
  71528. }
  71529. $minDepth = 0;
  71530. $maxDepth = \PHP_INT_MAX;
  71531. foreach ($this->depths as $comparator) {
  71532. switch ($comparator->getOperator()) {
  71533. case '>':
  71534. $minDepth = $comparator->getTarget() + 1;
  71535. break;
  71536. case '>=':
  71537. $minDepth = $comparator->getTarget();
  71538. break;
  71539. case '<':
  71540. $maxDepth = $comparator->getTarget() - 1;
  71541. break;
  71542. case '<=':
  71543. $maxDepth = $comparator->getTarget();
  71544. break;
  71545. default:
  71546. $minDepth = $maxDepth = $comparator->getTarget();
  71547. }
  71548. }
  71549. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  71550. if ($this->followLinks) {
  71551. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  71552. }
  71553. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  71554. if ($exclude) {
  71555. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $exclude);
  71556. }
  71557. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  71558. if ($minDepth > 0 || $maxDepth < \PHP_INT_MAX) {
  71559. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  71560. }
  71561. if ($this->mode) {
  71562. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  71563. }
  71564. if ($this->names || $this->notNames) {
  71565. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  71566. }
  71567. if ($this->contains || $this->notContains) {
  71568. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  71569. }
  71570. if ($this->sizes) {
  71571. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  71572. }
  71573. if ($this->dates) {
  71574. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  71575. }
  71576. if ($this->filters) {
  71577. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  71578. }
  71579. if ($this->paths || $notPaths) {
  71580. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
  71581. }
  71582. if (static::IGNORE_VCS_IGNORED_FILES === (static::IGNORE_VCS_IGNORED_FILES & $this->ignore)) {
  71583. $iterator = new Iterator\VcsIgnoredFilterIterator($iterator, $dir);
  71584. }
  71585. return $iterator;
  71586. }
  71587. private function normalizeDir(string $dir): string
  71588. {
  71589. if ('/' === $dir) {
  71590. return $dir;
  71591. }
  71592. $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  71593. if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
  71594. $dir .= '/';
  71595. }
  71596. return $dir;
  71597. }
  71598. }
  71599. <?php
  71600. namespace Symfony\Component\Finder;
  71601. class Gitignore
  71602. {
  71603. public static function toRegex(string $gitignoreFileContent): string
  71604. {
  71605. return self::buildRegex($gitignoreFileContent, false);
  71606. }
  71607. public static function toRegexMatchingNegatedPatterns(string $gitignoreFileContent): string
  71608. {
  71609. return self::buildRegex($gitignoreFileContent, true);
  71610. }
  71611. private static function buildRegex(string $gitignoreFileContent, bool $inverted): string
  71612. {
  71613. $gitignoreFileContent = preg_replace('~(?<!\\\\)#[^\n\r]*~', '', $gitignoreFileContent);
  71614. $gitignoreLines = preg_split('~\r\n?|\n~', $gitignoreFileContent);
  71615. $res = self::lineToRegex('');
  71616. foreach ($gitignoreLines as $line) {
  71617. $line = preg_replace('~(?<!\\\\)[ \t]+$~', '', $line);
  71618. if ('!' === substr($line, 0, 1)) {
  71619. $line = substr($line, 1);
  71620. $isNegative = true;
  71621. } else {
  71622. $isNegative = false;
  71623. }
  71624. if ('' !== $line) {
  71625. if ($isNegative xor $inverted) {
  71626. $res = '(?!'.self::lineToRegex($line).'$)'.$res;
  71627. } else {
  71628. $res = '(?:'.$res.'|'.self::lineToRegex($line).')';
  71629. }
  71630. }
  71631. }
  71632. return '~^(?:'.$res.')~s';
  71633. }
  71634. private static function lineToRegex(string $gitignoreLine): string
  71635. {
  71636. if ('' === $gitignoreLine) {
  71637. return '$f';
  71638. }
  71639. $slashPos = strpos($gitignoreLine, '/');
  71640. if (false !== $slashPos && \strlen($gitignoreLine) - 1 !== $slashPos) {
  71641. if (0 === $slashPos) {
  71642. $gitignoreLine = substr($gitignoreLine, 1);
  71643. }
  71644. $isAbsolute = true;
  71645. } else {
  71646. $isAbsolute = false;
  71647. }
  71648. $regex = preg_quote(str_replace('\\', '', $gitignoreLine), '~');
  71649. $regex = preg_replace_callback('~\\\\\[((?:\\\\!)?)([^\[\]]*)\\\\\]~', function (array $matches): string {
  71650. return '['.('' !== $matches[1] ? '^' : '').str_replace('\\-', '-', $matches[2]).']';
  71651. }, $regex);
  71652. $regex = preg_replace('~(?:(?:\\\\\*){2,}(/?))+~', '(?:(?:(?!//).(?<!//))+$1)?', $regex);
  71653. $regex = preg_replace('~\\\\\*~', '[^/]*', $regex);
  71654. $regex = preg_replace('~\\\\\?~', '[^/]', $regex);
  71655. return ($isAbsolute ? '' : '(?:[^/]+/)*')
  71656. .$regex
  71657. .(!str_ends_with($gitignoreLine, '/') ? '(?:$|/)' : '');
  71658. }
  71659. }
  71660. <?php
  71661. namespace Symfony\Component\Finder;
  71662. class Glob
  71663. {
  71664. public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#')
  71665. {
  71666. $firstByte = true;
  71667. $escaping = false;
  71668. $inCurlies = 0;
  71669. $regex = '';
  71670. $sizeGlob = \strlen($glob);
  71671. for ($i = 0; $i < $sizeGlob; ++$i) {
  71672. $car = $glob[$i];
  71673. if ($firstByte && $strictLeadingDot && '.' !== $car) {
  71674. $regex .= '(?=[^\.])';
  71675. }
  71676. $firstByte = '/' === $car;
  71677. if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) {
  71678. $car = '[^/]++/';
  71679. if (!isset($glob[$i + 3])) {
  71680. $car .= '?';
  71681. }
  71682. if ($strictLeadingDot) {
  71683. $car = '(?=[^\.])'.$car;
  71684. }
  71685. $car = '/(?:'.$car.')*';
  71686. $i += 2 + isset($glob[$i + 3]);
  71687. if ('/' === $delimiter) {
  71688. $car = str_replace('/', '\\/', $car);
  71689. }
  71690. }
  71691. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  71692. $regex .= "\\$car";
  71693. } elseif ('*' === $car) {
  71694. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  71695. } elseif ('?' === $car) {
  71696. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  71697. } elseif ('{' === $car) {
  71698. $regex .= $escaping ? '\\{' : '(';
  71699. if (!$escaping) {
  71700. ++$inCurlies;
  71701. }
  71702. } elseif ('}' === $car && $inCurlies) {
  71703. $regex .= $escaping ? '}' : ')';
  71704. if (!$escaping) {
  71705. --$inCurlies;
  71706. }
  71707. } elseif (',' === $car && $inCurlies) {
  71708. $regex .= $escaping ? ',' : '|';
  71709. } elseif ('\\' === $car) {
  71710. if ($escaping) {
  71711. $regex .= '\\\\';
  71712. $escaping = false;
  71713. } else {
  71714. $escaping = true;
  71715. }
  71716. continue;
  71717. } else {
  71718. $regex .= $car;
  71719. }
  71720. $escaping = false;
  71721. }
  71722. return $delimiter.'^'.$regex.'$'.$delimiter;
  71723. }
  71724. }
  71725. <?php
  71726. namespace Symfony\Component\Finder\Iterator;
  71727. class CustomFilterIterator extends \FilterIterator
  71728. {
  71729. private $filters = [];
  71730. public function __construct(\Iterator $iterator, array $filters)
  71731. {
  71732. foreach ($filters as $filter) {
  71733. if (!\is_callable($filter)) {
  71734. throw new \InvalidArgumentException('Invalid PHP callback.');
  71735. }
  71736. }
  71737. $this->filters = $filters;
  71738. parent::__construct($iterator);
  71739. }
  71740. #[\ReturnTypeWillChange]
  71741. public function accept()
  71742. {
  71743. $fileinfo = $this->current();
  71744. foreach ($this->filters as $filter) {
  71745. if (false === $filter($fileinfo)) {
  71746. return false;
  71747. }
  71748. }
  71749. return true;
  71750. }
  71751. }
  71752. <?php
  71753. namespace Symfony\Component\Finder\Iterator;
  71754. use Symfony\Component\Finder\Comparator\DateComparator;
  71755. class DateRangeFilterIterator extends \FilterIterator
  71756. {
  71757. private $comparators = [];
  71758. public function __construct(\Iterator $iterator, array $comparators)
  71759. {
  71760. $this->comparators = $comparators;
  71761. parent::__construct($iterator);
  71762. }
  71763. #[\ReturnTypeWillChange]
  71764. public function accept()
  71765. {
  71766. $fileinfo = $this->current();
  71767. if (!file_exists($fileinfo->getPathname())) {
  71768. return false;
  71769. }
  71770. $filedate = $fileinfo->getMTime();
  71771. foreach ($this->comparators as $compare) {
  71772. if (!$compare->test($filedate)) {
  71773. return false;
  71774. }
  71775. }
  71776. return true;
  71777. }
  71778. }
  71779. <?php
  71780. namespace Symfony\Component\Finder\Iterator;
  71781. class DepthRangeFilterIterator extends \FilterIterator
  71782. {
  71783. private $minDepth = 0;
  71784. public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth = 0, int $maxDepth = \PHP_INT_MAX)
  71785. {
  71786. $this->minDepth = $minDepth;
  71787. $iterator->setMaxDepth(\PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  71788. parent::__construct($iterator);
  71789. }
  71790. #[\ReturnTypeWillChange]
  71791. public function accept()
  71792. {
  71793. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  71794. }
  71795. }
  71796. <?php
  71797. namespace Symfony\Component\Finder\Iterator;
  71798. class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator
  71799. {
  71800. private $iterator;
  71801. private $isRecursive;
  71802. private $excludedDirs = [];
  71803. private $excludedPattern;
  71804. public function __construct(\Iterator $iterator, array $directories)
  71805. {
  71806. $this->iterator = $iterator;
  71807. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  71808. $patterns = [];
  71809. foreach ($directories as $directory) {
  71810. $directory = rtrim($directory, '/');
  71811. if (!$this->isRecursive || str_contains($directory, '/')) {
  71812. $patterns[] = preg_quote($directory, '#');
  71813. } else {
  71814. $this->excludedDirs[$directory] = true;
  71815. }
  71816. }
  71817. if ($patterns) {
  71818. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  71819. }
  71820. parent::__construct($iterator);
  71821. }
  71822. #[\ReturnTypeWillChange]
  71823. public function accept()
  71824. {
  71825. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  71826. return false;
  71827. }
  71828. if ($this->excludedPattern) {
  71829. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  71830. $path = str_replace('\\', '/', $path);
  71831. return !preg_match($this->excludedPattern, $path);
  71832. }
  71833. return true;
  71834. }
  71835. #[\ReturnTypeWillChange]
  71836. public function hasChildren()
  71837. {
  71838. return $this->isRecursive && $this->iterator->hasChildren();
  71839. }
  71840. #[\ReturnTypeWillChange]
  71841. public function getChildren()
  71842. {
  71843. $children = new self($this->iterator->getChildren(), []);
  71844. $children->excludedDirs = $this->excludedDirs;
  71845. $children->excludedPattern = $this->excludedPattern;
  71846. return $children;
  71847. }
  71848. }
  71849. <?php
  71850. namespace Symfony\Component\Finder\Iterator;
  71851. class FileTypeFilterIterator extends \FilterIterator
  71852. {
  71853. public const ONLY_FILES = 1;
  71854. public const ONLY_DIRECTORIES = 2;
  71855. private $mode;
  71856. public function __construct(\Iterator $iterator, int $mode)
  71857. {
  71858. $this->mode = $mode;
  71859. parent::__construct($iterator);
  71860. }
  71861. #[\ReturnTypeWillChange]
  71862. public function accept()
  71863. {
  71864. $fileinfo = $this->current();
  71865. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  71866. return false;
  71867. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  71868. return false;
  71869. }
  71870. return true;
  71871. }
  71872. }
  71873. <?php
  71874. namespace Symfony\Component\Finder\Iterator;
  71875. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  71876. {
  71877. #[\ReturnTypeWillChange]
  71878. public function accept()
  71879. {
  71880. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  71881. return true;
  71882. }
  71883. $fileinfo = $this->current();
  71884. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  71885. return false;
  71886. }
  71887. $content = $fileinfo->getContents();
  71888. if (!$content) {
  71889. return false;
  71890. }
  71891. return $this->isAccepted($content);
  71892. }
  71893. protected function toRegex(string $str)
  71894. {
  71895. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  71896. }
  71897. }
  71898. <?php
  71899. namespace Symfony\Component\Finder\Iterator;
  71900. use Symfony\Component\Finder\Glob;
  71901. class FilenameFilterIterator extends MultiplePcreFilterIterator
  71902. {
  71903. #[\ReturnTypeWillChange]
  71904. public function accept()
  71905. {
  71906. return $this->isAccepted($this->current()->getFilename());
  71907. }
  71908. protected function toRegex(string $str)
  71909. {
  71910. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  71911. }
  71912. }
  71913. <?php
  71914. namespace Symfony\Component\Finder\Iterator;
  71915. class LazyIterator implements \IteratorAggregate
  71916. {
  71917. private $iteratorFactory;
  71918. public function __construct(callable $iteratorFactory)
  71919. {
  71920. $this->iteratorFactory = $iteratorFactory;
  71921. }
  71922. public function getIterator(): \Traversable
  71923. {
  71924. yield from ($this->iteratorFactory)();
  71925. }
  71926. }
  71927. <?php
  71928. namespace Symfony\Component\Finder\Iterator;
  71929. abstract class MultiplePcreFilterIterator extends \FilterIterator
  71930. {
  71931. protected $matchRegexps = [];
  71932. protected $noMatchRegexps = [];
  71933. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  71934. {
  71935. foreach ($matchPatterns as $pattern) {
  71936. $this->matchRegexps[] = $this->toRegex($pattern);
  71937. }
  71938. foreach ($noMatchPatterns as $pattern) {
  71939. $this->noMatchRegexps[] = $this->toRegex($pattern);
  71940. }
  71941. parent::__construct($iterator);
  71942. }
  71943. protected function isAccepted(string $string)
  71944. {
  71945. foreach ($this->noMatchRegexps as $regex) {
  71946. if (preg_match($regex, $string)) {
  71947. return false;
  71948. }
  71949. }
  71950. if ($this->matchRegexps) {
  71951. foreach ($this->matchRegexps as $regex) {
  71952. if (preg_match($regex, $string)) {
  71953. return true;
  71954. }
  71955. }
  71956. return false;
  71957. }
  71958. return true;
  71959. }
  71960. protected function isRegex(string $str)
  71961. {
  71962. $availableModifiers = 'imsxuADU';
  71963. if (\PHP_VERSION_ID >= 80200) {
  71964. $availableModifiers .= 'n';
  71965. }
  71966. if (preg_match('/^(.{3,}?)['.$availableModifiers.']*$/', $str, $m)) {
  71967. $start = substr($m[1], 0, 1);
  71968. $end = substr($m[1], -1);
  71969. if ($start === $end) {
  71970. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  71971. }
  71972. foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
  71973. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  71974. return true;
  71975. }
  71976. }
  71977. }
  71978. return false;
  71979. }
  71980. abstract protected function toRegex(string $str);
  71981. }
  71982. <?php
  71983. namespace Symfony\Component\Finder\Iterator;
  71984. class PathFilterIterator extends MultiplePcreFilterIterator
  71985. {
  71986. #[\ReturnTypeWillChange]
  71987. public function accept()
  71988. {
  71989. $filename = $this->current()->getRelativePathname();
  71990. if ('\\' === \DIRECTORY_SEPARATOR) {
  71991. $filename = str_replace('\\', '/', $filename);
  71992. }
  71993. return $this->isAccepted($filename);
  71994. }
  71995. protected function toRegex(string $str)
  71996. {
  71997. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  71998. }
  71999. }
  72000. <?php
  72001. namespace Symfony\Component\Finder\Iterator;
  72002. use Symfony\Component\Finder\Exception\AccessDeniedException;
  72003. use Symfony\Component\Finder\SplFileInfo;
  72004. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  72005. {
  72006. private $ignoreUnreadableDirs;
  72007. private $ignoreFirstRewind = true;
  72008. private $rootPath;
  72009. private $subPath;
  72010. private $directorySeparator = '/';
  72011. public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = false)
  72012. {
  72013. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  72014. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  72015. }
  72016. parent::__construct($path, $flags);
  72017. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  72018. $this->rootPath = $path;
  72019. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  72020. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  72021. }
  72022. }
  72023. #[\ReturnTypeWillChange]
  72024. public function current()
  72025. {
  72026. if (null === $subPathname = $this->subPath) {
  72027. $subPathname = $this->subPath = $this->getSubPath();
  72028. }
  72029. if ('' !== $subPathname) {
  72030. $subPathname .= $this->directorySeparator;
  72031. }
  72032. $subPathname .= $this->getFilename();
  72033. $basePath = $this->rootPath;
  72034. if ('/' !== $basePath && !str_ends_with($basePath, $this->directorySeparator) && !str_ends_with($basePath, '/')) {
  72035. $basePath .= $this->directorySeparator;
  72036. }
  72037. return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
  72038. }
  72039. #[\ReturnTypeWillChange]
  72040. public function hasChildren($allowLinks = false)
  72041. {
  72042. $hasChildren = parent::hasChildren($allowLinks);
  72043. if (!$hasChildren || !$this->ignoreUnreadableDirs) {
  72044. return $hasChildren;
  72045. }
  72046. try {
  72047. parent::getChildren();
  72048. return true;
  72049. } catch (\UnexpectedValueException $e) {
  72050. return false;
  72051. }
  72052. }
  72053. #[\ReturnTypeWillChange]
  72054. public function getChildren()
  72055. {
  72056. try {
  72057. $children = parent::getChildren();
  72058. if ($children instanceof self) {
  72059. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  72060. $children->rootPath = $this->rootPath;
  72061. }
  72062. return $children;
  72063. } catch (\UnexpectedValueException $e) {
  72064. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  72065. }
  72066. }
  72067. #[\ReturnTypeWillChange]
  72068. public function next()
  72069. {
  72070. $this->ignoreFirstRewind = false;
  72071. parent::next();
  72072. }
  72073. #[\ReturnTypeWillChange]
  72074. public function rewind()
  72075. {
  72076. if ($this->ignoreFirstRewind) {
  72077. $this->ignoreFirstRewind = false;
  72078. return;
  72079. }
  72080. parent::rewind();
  72081. }
  72082. }
  72083. <?php
  72084. namespace Symfony\Component\Finder\Iterator;
  72085. use Symfony\Component\Finder\Comparator\NumberComparator;
  72086. class SizeRangeFilterIterator extends \FilterIterator
  72087. {
  72088. private $comparators = [];
  72089. public function __construct(\Iterator $iterator, array $comparators)
  72090. {
  72091. $this->comparators = $comparators;
  72092. parent::__construct($iterator);
  72093. }
  72094. #[\ReturnTypeWillChange]
  72095. public function accept()
  72096. {
  72097. $fileinfo = $this->current();
  72098. if (!$fileinfo->isFile()) {
  72099. return true;
  72100. }
  72101. $filesize = $fileinfo->getSize();
  72102. foreach ($this->comparators as $compare) {
  72103. if (!$compare->test($filesize)) {
  72104. return false;
  72105. }
  72106. }
  72107. return true;
  72108. }
  72109. }
  72110. <?php
  72111. namespace Symfony\Component\Finder\Iterator;
  72112. class SortableIterator implements \IteratorAggregate
  72113. {
  72114. public const SORT_BY_NONE = 0;
  72115. public const SORT_BY_NAME = 1;
  72116. public const SORT_BY_TYPE = 2;
  72117. public const SORT_BY_ACCESSED_TIME = 3;
  72118. public const SORT_BY_CHANGED_TIME = 4;
  72119. public const SORT_BY_MODIFIED_TIME = 5;
  72120. public const SORT_BY_NAME_NATURAL = 6;
  72121. private $iterator;
  72122. private $sort;
  72123. public function __construct(\Traversable $iterator, $sort, bool $reverseOrder = false)
  72124. {
  72125. $this->iterator = $iterator;
  72126. $order = $reverseOrder ? -1 : 1;
  72127. if (self::SORT_BY_NAME === $sort) {
  72128. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  72129. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  72130. };
  72131. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  72132. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  72133. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  72134. };
  72135. } elseif (self::SORT_BY_TYPE === $sort) {
  72136. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  72137. if ($a->isDir() && $b->isFile()) {
  72138. return -$order;
  72139. } elseif ($a->isFile() && $b->isDir()) {
  72140. return $order;
  72141. }
  72142. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  72143. };
  72144. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  72145. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  72146. return $order * ($a->getATime() - $b->getATime());
  72147. };
  72148. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  72149. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  72150. return $order * ($a->getCTime() - $b->getCTime());
  72151. };
  72152. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  72153. $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
  72154. return $order * ($a->getMTime() - $b->getMTime());
  72155. };
  72156. } elseif (self::SORT_BY_NONE === $sort) {
  72157. $this->sort = $order;
  72158. } elseif (\is_callable($sort)) {
  72159. $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort;
  72160. } else {
  72161. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  72162. }
  72163. }
  72164. #[\ReturnTypeWillChange]
  72165. public function getIterator()
  72166. {
  72167. if (1 === $this->sort) {
  72168. return $this->iterator;
  72169. }
  72170. $array = iterator_to_array($this->iterator, true);
  72171. if (-1 === $this->sort) {
  72172. $array = array_reverse($array);
  72173. } else {
  72174. uasort($array, $this->sort);
  72175. }
  72176. return new \ArrayIterator($array);
  72177. }
  72178. }
  72179. <?php
  72180. namespace Symfony\Component\Finder\Iterator;
  72181. use Symfony\Component\Finder\Gitignore;
  72182. final class VcsIgnoredFilterIterator extends \FilterIterator
  72183. {
  72184. private $baseDir;
  72185. private $gitignoreFilesCache = [];
  72186. private $ignoredPathsCache = [];
  72187. public function __construct(\Iterator $iterator, string $baseDir)
  72188. {
  72189. $this->baseDir = $this->normalizePath($baseDir);
  72190. parent::__construct($iterator);
  72191. }
  72192. public function accept(): bool
  72193. {
  72194. $file = $this->current();
  72195. $fileRealPath = $this->normalizePath($file->getRealPath());
  72196. return !$this->isIgnored($fileRealPath);
  72197. }
  72198. private function isIgnored(string $fileRealPath): bool
  72199. {
  72200. if (is_dir($fileRealPath) && !str_ends_with($fileRealPath, '/')) {
  72201. $fileRealPath .= '/';
  72202. }
  72203. if (isset($this->ignoredPathsCache[$fileRealPath])) {
  72204. return $this->ignoredPathsCache[$fileRealPath];
  72205. }
  72206. $ignored = false;
  72207. foreach ($this->parentsDirectoryDownward($fileRealPath) as $parentDirectory) {
  72208. if ($this->isIgnored($parentDirectory)) {
  72209. break;
  72210. }
  72211. $fileRelativePath = substr($fileRealPath, \strlen($parentDirectory) + 1);
  72212. if (null === $regexps = $this->readGitignoreFile("{$parentDirectory}/.gitignore")) {
  72213. continue;
  72214. }
  72215. [$exclusionRegex, $inclusionRegex] = $regexps;
  72216. if (preg_match($exclusionRegex, $fileRelativePath)) {
  72217. $ignored = true;
  72218. continue;
  72219. }
  72220. if (preg_match($inclusionRegex, $fileRelativePath)) {
  72221. $ignored = false;
  72222. }
  72223. }
  72224. return $this->ignoredPathsCache[$fileRealPath] = $ignored;
  72225. }
  72226. private function parentsDirectoryDownward(string $fileRealPath): array
  72227. {
  72228. $parentDirectories = [];
  72229. $parentDirectory = $fileRealPath;
  72230. while (true) {
  72231. $newParentDirectory = \dirname($parentDirectory);
  72232. if ($newParentDirectory === $parentDirectory) {
  72233. break;
  72234. }
  72235. $parentDirectory = $newParentDirectory;
  72236. if (0 !== strpos($parentDirectory, $this->baseDir)) {
  72237. break;
  72238. }
  72239. $parentDirectories[] = $parentDirectory;
  72240. }
  72241. return array_reverse($parentDirectories);
  72242. }
  72243. private function readGitignoreFile(string $path): ?array
  72244. {
  72245. if (\array_key_exists($path, $this->gitignoreFilesCache)) {
  72246. return $this->gitignoreFilesCache[$path];
  72247. }
  72248. if (!file_exists($path)) {
  72249. return $this->gitignoreFilesCache[$path] = null;
  72250. }
  72251. if (!is_file($path) || !is_readable($path)) {
  72252. throw new \RuntimeException("The \"ignoreVCSIgnored\" option cannot be used by the Finder as the \"{$path}\" file is not readable.");
  72253. }
  72254. $gitignoreFileContent = file_get_contents($path);
  72255. return $this->gitignoreFilesCache[$path] = [
  72256. Gitignore::toRegex($gitignoreFileContent),
  72257. Gitignore::toRegexMatchingNegatedPatterns($gitignoreFileContent),
  72258. ];
  72259. }
  72260. private function normalizePath(string $path): string
  72261. {
  72262. if ('\\' === \DIRECTORY_SEPARATOR) {
  72263. return str_replace('\\', '/', $path);
  72264. }
  72265. return $path;
  72266. }
  72267. }
  72268. Copyright (c) 2004-present Fabien Potencier
  72269. Permission is hereby granted, free of charge, to any person obtaining a copy
  72270. of this software and associated documentation files (the "Software"), to deal
  72271. in the Software without restriction, including without limitation the rights
  72272. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  72273. copies of the Software, and to permit persons to whom the Software is furnished
  72274. to do so, subject to the following conditions:
  72275. The above copyright notice and this permission notice shall be included in all
  72276. copies or substantial portions of the Software.
  72277. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  72278. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  72279. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  72280. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  72281. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  72282. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  72283. THE SOFTWARE.
  72284. <?php
  72285. namespace Symfony\Component\Finder;
  72286. class SplFileInfo extends \SplFileInfo
  72287. {
  72288. private $relativePath;
  72289. private $relativePathname;
  72290. public function __construct(string $file, string $relativePath, string $relativePathname)
  72291. {
  72292. parent::__construct($file);
  72293. $this->relativePath = $relativePath;
  72294. $this->relativePathname = $relativePathname;
  72295. }
  72296. public function getRelativePath()
  72297. {
  72298. return $this->relativePath;
  72299. }
  72300. public function getRelativePathname()
  72301. {
  72302. return $this->relativePathname;
  72303. }
  72304. public function getFilenameWithoutExtension(): string
  72305. {
  72306. $filename = $this->getFilename();
  72307. return pathinfo($filename, \PATHINFO_FILENAME);
  72308. }
  72309. public function getContents()
  72310. {
  72311. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  72312. try {
  72313. $content = file_get_contents($this->getPathname());
  72314. } finally {
  72315. restore_error_handler();
  72316. }
  72317. if (false === $content) {
  72318. throw new \RuntimeException($error);
  72319. }
  72320. return $content;
  72321. }
  72322. }
  72323. <?php
  72324. namespace Symfony\Polyfill\Ctype;
  72325. final class Ctype
  72326. {
  72327. public static function ctype_alnum($text)
  72328. {
  72329. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72330. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  72331. }
  72332. public static function ctype_alpha($text)
  72333. {
  72334. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72335. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  72336. }
  72337. public static function ctype_cntrl($text)
  72338. {
  72339. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72340. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  72341. }
  72342. public static function ctype_digit($text)
  72343. {
  72344. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72345. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  72346. }
  72347. public static function ctype_graph($text)
  72348. {
  72349. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72350. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  72351. }
  72352. public static function ctype_lower($text)
  72353. {
  72354. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72355. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  72356. }
  72357. public static function ctype_print($text)
  72358. {
  72359. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72360. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  72361. }
  72362. public static function ctype_punct($text)
  72363. {
  72364. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72365. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  72366. }
  72367. public static function ctype_space($text)
  72368. {
  72369. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72370. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  72371. }
  72372. public static function ctype_upper($text)
  72373. {
  72374. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72375. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  72376. }
  72377. public static function ctype_xdigit($text)
  72378. {
  72379. $text = self::convert_int_to_char_for_ctype($text, __FUNCTION__);
  72380. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  72381. }
  72382. private static function convert_int_to_char_for_ctype($int, $function)
  72383. {
  72384. if (!\is_int($int)) {
  72385. return $int;
  72386. }
  72387. if ($int < -128 || $int > 255) {
  72388. return (string) $int;
  72389. }
  72390. if (\PHP_VERSION_ID >= 80100) {
  72391. @trigger_error($function.'(): Argument of type int will be interpreted as string in the future', \E_USER_DEPRECATED);
  72392. }
  72393. if ($int < 0) {
  72394. $int += 256;
  72395. }
  72396. return \chr($int);
  72397. }
  72398. }
  72399. Copyright (c) 2018-present Fabien Potencier
  72400. Permission is hereby granted, free of charge, to any person obtaining a copy
  72401. of this software and associated documentation files (the "Software"), to deal
  72402. in the Software without restriction, including without limitation the rights
  72403. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  72404. copies of the Software, and to permit persons to whom the Software is furnished
  72405. to do so, subject to the following conditions:
  72406. The above copyright notice and this permission notice shall be included in all
  72407. copies or substantial portions of the Software.
  72408. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  72409. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  72410. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  72411. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  72412. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  72413. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  72414. THE SOFTWARE.
  72415. <?php
  72416. use Symfony\Polyfill\Ctype as p;
  72417. if (\PHP_VERSION_ID >= 80000) {
  72418. return require __DIR__.'/bootstrap80.php';
  72419. }
  72420. if (!function_exists('ctype_alnum')) {
  72421. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  72422. }
  72423. if (!function_exists('ctype_alpha')) {
  72424. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  72425. }
  72426. if (!function_exists('ctype_cntrl')) {
  72427. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  72428. }
  72429. if (!function_exists('ctype_digit')) {
  72430. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  72431. }
  72432. if (!function_exists('ctype_graph')) {
  72433. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  72434. }
  72435. if (!function_exists('ctype_lower')) {
  72436. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  72437. }
  72438. if (!function_exists('ctype_print')) {
  72439. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  72440. }
  72441. if (!function_exists('ctype_punct')) {
  72442. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  72443. }
  72444. if (!function_exists('ctype_space')) {
  72445. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  72446. }
  72447. if (!function_exists('ctype_upper')) {
  72448. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  72449. }
  72450. if (!function_exists('ctype_xdigit')) {
  72451. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  72452. }
  72453. <?php
  72454. use Symfony\Polyfill\Ctype as p;
  72455. if (!function_exists('ctype_alnum')) {
  72456. function ctype_alnum(mixed $text): bool { return p\Ctype::ctype_alnum($text); }
  72457. }
  72458. if (!function_exists('ctype_alpha')) {
  72459. function ctype_alpha(mixed $text): bool { return p\Ctype::ctype_alpha($text); }
  72460. }
  72461. if (!function_exists('ctype_cntrl')) {
  72462. function ctype_cntrl(mixed $text): bool { return p\Ctype::ctype_cntrl($text); }
  72463. }
  72464. if (!function_exists('ctype_digit')) {
  72465. function ctype_digit(mixed $text): bool { return p\Ctype::ctype_digit($text); }
  72466. }
  72467. if (!function_exists('ctype_graph')) {
  72468. function ctype_graph(mixed $text): bool { return p\Ctype::ctype_graph($text); }
  72469. }
  72470. if (!function_exists('ctype_lower')) {
  72471. function ctype_lower(mixed $text): bool { return p\Ctype::ctype_lower($text); }
  72472. }
  72473. if (!function_exists('ctype_print')) {
  72474. function ctype_print(mixed $text): bool { return p\Ctype::ctype_print($text); }
  72475. }
  72476. if (!function_exists('ctype_punct')) {
  72477. function ctype_punct(mixed $text): bool { return p\Ctype::ctype_punct($text); }
  72478. }
  72479. if (!function_exists('ctype_space')) {
  72480. function ctype_space(mixed $text): bool { return p\Ctype::ctype_space($text); }
  72481. }
  72482. if (!function_exists('ctype_upper')) {
  72483. function ctype_upper(mixed $text): bool { return p\Ctype::ctype_upper($text); }
  72484. }
  72485. if (!function_exists('ctype_xdigit')) {
  72486. function ctype_xdigit(mixed $text): bool { return p\Ctype::ctype_xdigit($text); }
  72487. }
  72488. <?php
  72489. namespace Symfony\Polyfill\Intl\Grapheme;
  72490. \define('SYMFONY_GRAPHEME_CLUSTER_RX', ((float) \PCRE_VERSION < 10 ? (float) \PCRE_VERSION >= 8.32 : (float) \PCRE_VERSION >= 10.39) ? '\X' : Grapheme::GRAPHEME_CLUSTER_RX);
  72491. final class Grapheme
  72492. {
  72493. public const GRAPHEME_CLUSTER_RX = '(?:\r\n|(?:[ -~\x{200C}\x{200D}]|[ᆨ-ᇹ]+|[ᄀ-ᅟ]*(?:[가개갸걔거게겨계고과괘괴�구궈궤귀규그긔기까깨꺄꺠꺼께껴�꼬꽈꽤꾀꾜꾸꿔꿰뀌뀨���나내�냬너네녀녜노놔놰뇌뇨누눠눼뉘뉴�늬니다대댜댸��뎌뎨������둬뒈뒤듀드듸디따때땨떄떠떼뗘뗴�똬뙈뙤뚀뚜뚸뛔뛰뜌뜨���래랴�러레려례로롸뢔뢰료루뤄뤠뤼류르�리마매먀먜머메며몌모뫄뫠뫼묘무�뭬뮈뮤므믜미바배뱌뱨버베벼볘보�봬뵈뵤부붜붸뷔뷰브븨비빠빼뺘뺴�뻬뼈뼤뽀뽜뽸뾔뾰뿌뿨쀄쀠쀼���사새샤섀서세셔셰소솨쇄쇠쇼수숴�쉬슈스싀시싸쌔쌰��쎄쎠쎼����쑈쑤쒀쒜쒸쓔쓰씌씨아애야얘어�여예오와왜외요우워웨위유으���재쟈쟤저제져졔조좌좨죄죠주줘줴�쥬즈즤지짜째쨔쨰쩌쩨쪄쪠쪼쫘쫴�쬬쭈쭤쮀쮜쮸쯔쯰찌차채챠챼처체�쳬초촤쵀최쵸추춰췌취츄츠츼치카�캬컈커케켜켸코콰쾌쾨쿄쿠쿼퀘퀴��킈키타태탸턔터테텨톄토톼퇘퇴�투퉈퉤튀튜트틔티파패���페펴����푀표푸풔풰퓌퓨프픠피하해�햬허헤혀혜호화홰회효후훠훼휘휴��히]?[ᅠ-ᆢ]+|[가-힣])[ᆨ-ᇹ]*|[ᄀ-ᅟ]+|[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}])[\p{Mn}\p{Me}\x{09BE}\x{09D7}\x{0B3E}\x{0B57}\x{0BBE}\x{0BD7}\x{0CC2}\x{0CD5}\x{0CD6}\x{0D3E}\x{0D57}\x{0DCF}\x{0DDF}\x{200C}\x{200D}\x{1D165}\x{1D16E}-\x{1D172}]*|[\p{Cc}\p{Cf}\p{Zl}\p{Zp}])';
  72494. private const CASE_FOLD = [
  72495. ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
  72496. ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
  72497. ];
  72498. public static function grapheme_extract($s, $size, $type = \GRAPHEME_EXTR_COUNT, $start = 0, &$next = 0)
  72499. {
  72500. if (0 > $start) {
  72501. $start = \strlen($s) + $start;
  72502. }
  72503. if (!\is_scalar($s)) {
  72504. $hasError = false;
  72505. set_error_handler(function () use (&$hasError) { $hasError = true; });
  72506. $next = substr($s, $start);
  72507. restore_error_handler();
  72508. if ($hasError) {
  72509. substr($s, $start);
  72510. $s = '';
  72511. } else {
  72512. $s = $next;
  72513. }
  72514. } else {
  72515. $s = substr($s, $start);
  72516. }
  72517. $size = (int) $size;
  72518. $type = (int) $type;
  72519. $start = (int) $start;
  72520. if (\GRAPHEME_EXTR_COUNT !== $type && \GRAPHEME_EXTR_MAXBYTES !== $type && \GRAPHEME_EXTR_MAXCHARS !== $type) {
  72521. if (80000 > \PHP_VERSION_ID) {
  72522. return false;
  72523. }
  72524. throw new \ValueError('grapheme_extract(): Argument #3 ($type) must be one of GRAPHEME_EXTR_COUNT, GRAPHEME_EXTR_MAXBYTES, or GRAPHEME_EXTR_MAXCHARS');
  72525. }
  72526. if (!isset($s[0]) || 0 > $size || 0 > $start) {
  72527. return false;
  72528. }
  72529. if (0 === $size) {
  72530. return '';
  72531. }
  72532. $next = $start;
  72533. $s = preg_split('/('.SYMFONY_GRAPHEME_CLUSTER_RX.')/u', "\r\n".$s, $size + 1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
  72534. if (!isset($s[1])) {
  72535. return false;
  72536. }
  72537. $i = 1;
  72538. $ret = '';
  72539. do {
  72540. if (\GRAPHEME_EXTR_COUNT === $type) {
  72541. --$size;
  72542. } elseif (\GRAPHEME_EXTR_MAXBYTES === $type) {
  72543. $size -= \strlen($s[$i]);
  72544. } else {
  72545. $size -= iconv_strlen($s[$i], 'UTF-8//IGNORE');
  72546. }
  72547. if ($size >= 0) {
  72548. $ret .= $s[$i];
  72549. }
  72550. } while (isset($s[++$i]) && $size > 0);
  72551. $next += \strlen($ret);
  72552. return $ret;
  72553. }
  72554. public static function grapheme_strlen($s)
  72555. {
  72556. preg_replace('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', '', $s, -1, $len);
  72557. return 0 === $len && '' !== $s ? null : $len;
  72558. }
  72559. public static function grapheme_substr($s, $start, $len = null)
  72560. {
  72561. if (null === $len) {
  72562. $len = 2147483647;
  72563. }
  72564. preg_match_all('/'.SYMFONY_GRAPHEME_CLUSTER_RX.'/u', $s, $s);
  72565. $slen = \count($s[0]);
  72566. $start = (int) $start;
  72567. if (0 > $start) {
  72568. $start += $slen;
  72569. }
  72570. if (0 > $start) {
  72571. if (\PHP_VERSION_ID < 80000) {
  72572. return false;
  72573. }
  72574. $start = 0;
  72575. }
  72576. if ($start >= $slen) {
  72577. return \PHP_VERSION_ID >= 80000 ? '' : false;
  72578. }
  72579. $rem = $slen - $start;
  72580. if (0 > $len) {
  72581. $len += $rem;
  72582. }
  72583. if (0 === $len) {
  72584. return '';
  72585. }
  72586. if (0 > $len) {
  72587. return \PHP_VERSION_ID >= 80000 ? '' : false;
  72588. }
  72589. if ($len > $rem) {
  72590. $len = $rem;
  72591. }
  72592. return implode('', \array_slice($s[0], $start, $len));
  72593. }
  72594. public static function grapheme_strpos($s, $needle, $offset = 0)
  72595. {
  72596. return self::grapheme_position($s, $needle, $offset, 0);
  72597. }
  72598. public static function grapheme_stripos($s, $needle, $offset = 0)
  72599. {
  72600. return self::grapheme_position($s, $needle, $offset, 1);
  72601. }
  72602. public static function grapheme_strrpos($s, $needle, $offset = 0)
  72603. {
  72604. return self::grapheme_position($s, $needle, $offset, 2);
  72605. }
  72606. public static function grapheme_strripos($s, $needle, $offset = 0)
  72607. {
  72608. return self::grapheme_position($s, $needle, $offset, 3);
  72609. }
  72610. public static function grapheme_stristr($s, $needle, $beforeNeedle = false)
  72611. {
  72612. return mb_stristr($s, $needle, $beforeNeedle, 'UTF-8');
  72613. }
  72614. public static function grapheme_strstr($s, $needle, $beforeNeedle = false)
  72615. {
  72616. return mb_strstr($s, $needle, $beforeNeedle, 'UTF-8');
  72617. }
  72618. private static function grapheme_position($s, $needle, $offset, $mode)
  72619. {
  72620. $needle = (string) $needle;
  72621. if (80000 > \PHP_VERSION_ID && !preg_match('/./us', $needle)) {
  72622. return false;
  72623. }
  72624. $s = (string) $s;
  72625. if (!preg_match('/./us', $s)) {
  72626. return false;
  72627. }
  72628. if ($offset > 0) {
  72629. $s = self::grapheme_substr($s, $offset);
  72630. } elseif ($offset < 0) {
  72631. if (2 > $mode) {
  72632. $offset += self::grapheme_strlen($s);
  72633. $s = self::grapheme_substr($s, $offset);
  72634. if (0 > $offset) {
  72635. $offset = 0;
  72636. }
  72637. } elseif (0 > $offset += self::grapheme_strlen($needle)) {
  72638. $s = self::grapheme_substr($s, 0, $offset);
  72639. $offset = 0;
  72640. } else {
  72641. $offset = 0;
  72642. }
  72643. }
  72644. $caseInsensitive = $mode & 1;
  72645. $reverse = $mode & 2;
  72646. if ($caseInsensitive) {
  72647. $mode = \defined('MB_CASE_FOLD_SIMPLE') ? \MB_CASE_FOLD_SIMPLE : \MB_CASE_LOWER;
  72648. $s = mb_convert_case($s, $mode, 'UTF-8');
  72649. $needle = mb_convert_case($needle, $mode, 'UTF-8');
  72650. if (!\defined('MB_CASE_FOLD_SIMPLE')) {
  72651. $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s);
  72652. $needle = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $needle);
  72653. }
  72654. }
  72655. if ($reverse) {
  72656. $needlePos = strrpos($s, $needle);
  72657. } else {
  72658. $needlePos = strpos($s, $needle);
  72659. }
  72660. return false !== $needlePos ? self::grapheme_strlen(substr($s, 0, $needlePos)) + $offset : false;
  72661. }
  72662. }
  72663. Copyright (c) 2015-present Fabien Potencier
  72664. Permission is hereby granted, free of charge, to any person obtaining a copy
  72665. of this software and associated documentation files (the "Software"), to deal
  72666. in the Software without restriction, including without limitation the rights
  72667. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  72668. copies of the Software, and to permit persons to whom the Software is furnished
  72669. to do so, subject to the following conditions:
  72670. The above copyright notice and this permission notice shall be included in all
  72671. copies or substantial portions of the Software.
  72672. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  72673. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  72674. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  72675. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  72676. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  72677. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  72678. THE SOFTWARE.
  72679. <?php
  72680. use Symfony\Polyfill\Intl\Grapheme as p;
  72681. if (extension_loaded('intl')) {
  72682. return;
  72683. }
  72684. if (\PHP_VERSION_ID >= 80000) {
  72685. return require __DIR__.'/bootstrap80.php';
  72686. }
  72687. if (!defined('GRAPHEME_EXTR_COUNT')) {
  72688. define('GRAPHEME_EXTR_COUNT', 0);
  72689. }
  72690. if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
  72691. define('GRAPHEME_EXTR_MAXBYTES', 1);
  72692. }
  72693. if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
  72694. define('GRAPHEME_EXTR_MAXCHARS', 2);
  72695. }
  72696. if (!function_exists('grapheme_extract')) {
  72697. function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); }
  72698. }
  72699. if (!function_exists('grapheme_stripos')) {
  72700. function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); }
  72701. }
  72702. if (!function_exists('grapheme_stristr')) {
  72703. function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); }
  72704. }
  72705. if (!function_exists('grapheme_strlen')) {
  72706. function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); }
  72707. }
  72708. if (!function_exists('grapheme_strpos')) {
  72709. function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); }
  72710. }
  72711. if (!function_exists('grapheme_strripos')) {
  72712. function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); }
  72713. }
  72714. if (!function_exists('grapheme_strrpos')) {
  72715. function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); }
  72716. }
  72717. if (!function_exists('grapheme_strstr')) {
  72718. function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); }
  72719. }
  72720. if (!function_exists('grapheme_substr')) {
  72721. function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); }
  72722. }
  72723. <?php
  72724. use Symfony\Polyfill\Intl\Grapheme as p;
  72725. if (!defined('GRAPHEME_EXTR_COUNT')) {
  72726. define('GRAPHEME_EXTR_COUNT', 0);
  72727. }
  72728. if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
  72729. define('GRAPHEME_EXTR_MAXBYTES', 1);
  72730. }
  72731. if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
  72732. define('GRAPHEME_EXTR_MAXCHARS', 2);
  72733. }
  72734. if (!function_exists('grapheme_extract')) {
  72735. function grapheme_extract(?string $haystack, ?int $size, ?int $type = GRAPHEME_EXTR_COUNT, ?int $offset = 0, &$next = null): string|false { return p\Grapheme::grapheme_extract((string) $haystack, (int) $size, (int) $type, (int) $offset, $next); }
  72736. }
  72737. if (!function_exists('grapheme_stripos')) {
  72738. function grapheme_stripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_stripos((string) $haystack, (string) $needle, (int) $offset); }
  72739. }
  72740. if (!function_exists('grapheme_stristr')) {
  72741. function grapheme_stristr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_stristr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  72742. }
  72743. if (!function_exists('grapheme_strlen')) {
  72744. function grapheme_strlen(?string $string): int|false|null { return p\Grapheme::grapheme_strlen((string) $string); }
  72745. }
  72746. if (!function_exists('grapheme_strpos')) {
  72747. function grapheme_strpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strpos((string) $haystack, (string) $needle, (int) $offset); }
  72748. }
  72749. if (!function_exists('grapheme_strripos')) {
  72750. function grapheme_strripos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strripos((string) $haystack, (string) $needle, (int) $offset); }
  72751. }
  72752. if (!function_exists('grapheme_strrpos')) {
  72753. function grapheme_strrpos(?string $haystack, ?string $needle, ?int $offset = 0): int|false { return p\Grapheme::grapheme_strrpos((string) $haystack, (string) $needle, (int) $offset); }
  72754. }
  72755. if (!function_exists('grapheme_strstr')) {
  72756. function grapheme_strstr(?string $haystack, ?string $needle, ?bool $beforeNeedle = false): string|false { return p\Grapheme::grapheme_strstr((string) $haystack, (string) $needle, (bool) $beforeNeedle); }
  72757. }
  72758. if (!function_exists('grapheme_substr')) {
  72759. function grapheme_substr(?string $string, ?int $offset, ?int $length = null): string|false { return p\Grapheme::grapheme_substr((string) $string, (int) $offset, $length); }
  72760. }
  72761. Copyright (c) 2015-present Fabien Potencier
  72762. Permission is hereby granted, free of charge, to any person obtaining a copy
  72763. of this software and associated documentation files (the "Software"), to deal
  72764. in the Software without restriction, including without limitation the rights
  72765. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  72766. copies of the Software, and to permit persons to whom the Software is furnished
  72767. to do so, subject to the following conditions:
  72768. The above copyright notice and this permission notice shall be included in all
  72769. copies or substantial portions of the Software.
  72770. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  72771. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  72772. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  72773. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  72774. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  72775. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  72776. THE SOFTWARE.
  72777. <?php
  72778. namespace Symfony\Polyfill\Intl\Normalizer;
  72779. class Normalizer
  72780. {
  72781. public const FORM_D = \Normalizer::FORM_D;
  72782. public const FORM_KD = \Normalizer::FORM_KD;
  72783. public const FORM_C = \Normalizer::FORM_C;
  72784. public const FORM_KC = \Normalizer::FORM_KC;
  72785. public const NFD = \Normalizer::NFD;
  72786. public const NFKD = \Normalizer::NFKD;
  72787. public const NFC = \Normalizer::NFC;
  72788. public const NFKC = \Normalizer::NFKC;
  72789. private static $C;
  72790. private static $D;
  72791. private static $KD;
  72792. private static $cC;
  72793. private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  72794. private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
  72795. public static function isNormalized(string $s, int $form = self::FORM_C)
  72796. {
  72797. if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) {
  72798. return false;
  72799. }
  72800. if (!isset($s[strspn($s, self::$ASCII)])) {
  72801. return true;
  72802. }
  72803. if (self::NFC == $form && preg_match('//u', $s) && !preg_match('/[^\x00-\x{2FF}]/u', $s)) {
  72804. return true;
  72805. }
  72806. return self::normalize($s, $form) === $s;
  72807. }
  72808. public static function normalize(string $s, int $form = self::FORM_C)
  72809. {
  72810. if (!preg_match('//u', $s)) {
  72811. return false;
  72812. }
  72813. switch ($form) {
  72814. case self::NFC: $C = true; $K = false; break;
  72815. case self::NFD: $C = false; $K = false; break;
  72816. case self::NFKC: $C = true; $K = true; break;
  72817. case self::NFKD: $C = false; $K = true; break;
  72818. default:
  72819. if (\defined('Normalizer::NONE') && \Normalizer::NONE == $form) {
  72820. return $s;
  72821. }
  72822. if (80000 > \PHP_VERSION_ID) {
  72823. return false;
  72824. }
  72825. throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form');
  72826. }
  72827. if ('' === $s) {
  72828. return '';
  72829. }
  72830. if ($K && null === self::$KD) {
  72831. self::$KD = self::getData('compatibilityDecomposition');
  72832. }
  72833. if (null === self::$D) {
  72834. self::$D = self::getData('canonicalDecomposition');
  72835. self::$cC = self::getData('combiningClass');
  72836. }
  72837. if (null !== $mbEncoding = (2 & (int) \ini_get('mbstring.func_overload')) ? mb_internal_encoding() : null) {
  72838. mb_internal_encoding('8bit');
  72839. }
  72840. $r = self::decompose($s, $K);
  72841. if ($C) {
  72842. if (null === self::$C) {
  72843. self::$C = self::getData('canonicalComposition');
  72844. }
  72845. $r = self::recompose($r);
  72846. }
  72847. if (null !== $mbEncoding) {
  72848. mb_internal_encoding($mbEncoding);
  72849. }
  72850. return $r;
  72851. }
  72852. private static function recompose($s)
  72853. {
  72854. $ASCII = self::$ASCII;
  72855. $compMap = self::$C;
  72856. $combClass = self::$cC;
  72857. $ulenMask = self::$ulenMask;
  72858. $result = $tail = '';
  72859. $i = $s[0] < "\x80" ? 1 : $ulenMask[$s[0] & "\xF0"];
  72860. $len = \strlen($s);
  72861. $lastUchr = substr($s, 0, $i);
  72862. $lastUcls = isset($combClass[$lastUchr]) ? 256 : 0;
  72863. while ($i < $len) {
  72864. if ($s[$i] < "\x80") {
  72865. if ($tail) {
  72866. $lastUchr .= $tail;
  72867. $tail = '';
  72868. }
  72869. if ($j = strspn($s, $ASCII, $i + 1)) {
  72870. $lastUchr .= substr($s, $i, $j);
  72871. $i += $j;
  72872. }
  72873. $result .= $lastUchr;
  72874. $lastUchr = $s[$i];
  72875. $lastUcls = 0;
  72876. ++$i;
  72877. continue;
  72878. }
  72879. $ulen = $ulenMask[$s[$i] & "\xF0"];
  72880. $uchr = substr($s, $i, $ulen);
  72881. if ($lastUchr < "\xE1\x84\x80" || "\xE1\x84\x92" < $lastUchr
  72882. || $uchr < "\xE1\x85\xA1" || "\xE1\x85\xB5" < $uchr
  72883. || $lastUcls) {
  72884. $ucls = $combClass[$uchr] ?? 0;
  72885. if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) {
  72886. $lastUchr = $compMap[$lastUchr.$uchr];
  72887. } elseif ($lastUcls = $ucls) {
  72888. $tail .= $uchr;
  72889. } else {
  72890. if ($tail) {
  72891. $lastUchr .= $tail;
  72892. $tail = '';
  72893. }
  72894. $result .= $lastUchr;
  72895. $lastUchr = $uchr;
  72896. }
  72897. } else {
  72898. $L = \ord($lastUchr[2]) - 0x80;
  72899. $V = \ord($uchr[2]) - 0xA1;
  72900. $T = 0;
  72901. $uchr = substr($s, $i + $ulen, 3);
  72902. if ("\xE1\x86\xA7" <= $uchr && $uchr <= "\xE1\x87\x82") {
  72903. $T = \ord($uchr[2]) - 0xA7;
  72904. 0 > $T && $T += 0x40;
  72905. $ulen += 3;
  72906. }
  72907. $L = 0xAC00 + ($L * 21 + $V) * 28 + $T;
  72908. $lastUchr = \chr(0xE0 | $L >> 12).\chr(0x80 | $L >> 6 & 0x3F).\chr(0x80 | $L & 0x3F);
  72909. }
  72910. $i += $ulen;
  72911. }
  72912. return $result.$lastUchr.$tail;
  72913. }
  72914. private static function decompose($s, $c)
  72915. {
  72916. $result = '';
  72917. $ASCII = self::$ASCII;
  72918. $decompMap = self::$D;
  72919. $combClass = self::$cC;
  72920. $ulenMask = self::$ulenMask;
  72921. if ($c) {
  72922. $compatMap = self::$KD;
  72923. }
  72924. $c = [];
  72925. $i = 0;
  72926. $len = \strlen($s);
  72927. while ($i < $len) {
  72928. if ($s[$i] < "\x80") {
  72929. if ($c) {
  72930. ksort($c);
  72931. $result .= implode('', $c);
  72932. $c = [];
  72933. }
  72934. $j = 1 + strspn($s, $ASCII, $i + 1);
  72935. $result .= substr($s, $i, $j);
  72936. $i += $j;
  72937. continue;
  72938. }
  72939. $ulen = $ulenMask[$s[$i] & "\xF0"];
  72940. $uchr = substr($s, $i, $ulen);
  72941. $i += $ulen;
  72942. if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) {
  72943. if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) {
  72944. $uchr = $j;
  72945. $j = \strlen($uchr);
  72946. $ulen = $uchr[0] < "\x80" ? 1 : $ulenMask[$uchr[0] & "\xF0"];
  72947. if ($ulen != $j) {
  72948. $j -= $ulen;
  72949. $i -= $j;
  72950. if (0 > $i) {
  72951. $s = str_repeat(' ', -$i).$s;
  72952. $len -= $i;
  72953. $i = 0;
  72954. }
  72955. while ($j--) {
  72956. $s[$i + $j] = $uchr[$ulen + $j];
  72957. }
  72958. $uchr = substr($uchr, 0, $ulen);
  72959. }
  72960. }
  72961. if (isset($combClass[$uchr])) {
  72962. if (!isset($c[$combClass[$uchr]])) {
  72963. $c[$combClass[$uchr]] = '';
  72964. }
  72965. $c[$combClass[$uchr]] .= $uchr;
  72966. continue;
  72967. }
  72968. } else {
  72969. $uchr = unpack('C*', $uchr);
  72970. $j = (($uchr[1] - 224) << 12) + (($uchr[2] - 128) << 6) + $uchr[3] - 0xAC80;
  72971. $uchr = "\xE1\x84".\chr(0x80 + (int) ($j / 588))
  72972. ."\xE1\x85".\chr(0xA1 + (int) (($j % 588) / 28));
  72973. if ($j %= 28) {
  72974. $uchr .= $j < 25
  72975. ? ("\xE1\x86".\chr(0xA7 + $j))
  72976. : ("\xE1\x87".\chr(0x67 + $j));
  72977. }
  72978. }
  72979. if ($c) {
  72980. ksort($c);
  72981. $result .= implode('', $c);
  72982. $c = [];
  72983. }
  72984. $result .= $uchr;
  72985. }
  72986. if ($c) {
  72987. ksort($c);
  72988. $result .= implode('', $c);
  72989. }
  72990. return $result;
  72991. }
  72992. private static function getData($file)
  72993. {
  72994. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  72995. return require $file;
  72996. }
  72997. return false;
  72998. }
  72999. }
  73000. <?php
  73001. class Normalizer extends Symfony\Polyfill\Intl\Normalizer\Normalizer
  73002. {
  73003. public const NONE = 2;
  73004. public const FORM_D = 4;
  73005. public const FORM_KD = 8;
  73006. public const FORM_C = 16;
  73007. public const FORM_KC = 32;
  73008. public const NFD = 4;
  73009. public const NFKD = 8;
  73010. public const NFC = 16;
  73011. public const NFKC = 32;
  73012. }
  73013. <?php
  73014. return array (
  73015. 'À' => 'À',
  73016. 'A�' => '�',
  73017. 'Â' => 'Â',
  73018. 'Ã' => 'Ã',
  73019. 'Ä' => 'Ä',
  73020. 'AÌŠ' => 'Ã…',
  73021. 'Ç' => 'Ç',
  73022. 'È' => 'È',
  73023. 'E�' => 'É',
  73024. 'Ê' => 'Ê',
  73025. 'Ë' => 'Ë',
  73026. 'Ì' => 'Ì',
  73027. 'I�' => '�',
  73028. 'IÌ‚' => 'ÃŽ',
  73029. 'Ï' => '�',
  73030. 'Ñ' => 'Ñ',
  73031. 'OÌ€' => 'Ã’',
  73032. 'O�' => 'Ó',
  73033. 'Ô' => 'Ô',
  73034. 'Õ' => 'Õ',
  73035. 'Ö' => 'Ö',
  73036. 'Ù' => 'Ù',
  73037. 'U�' => 'Ú',
  73038. 'Û' => 'Û',
  73039. 'Ü' => 'Ü',
  73040. 'Y�' => '�',
  73041. 'à' => 'à',
  73042. 'a�' => 'á',
  73043. 'â' => 'â',
  73044. 'ã' => 'ã',
  73045. 'ä' => 'ä',
  73046. 'aÌŠ' => 'Ã¥',
  73047. 'ç' => 'ç',
  73048. 'è' => 'è',
  73049. 'e�' => 'é',
  73050. 'ê' => 'ê',
  73051. 'ë' => 'ë',
  73052. 'ì' => 'ì',
  73053. 'i�' => 'í',
  73054. 'î' => 'î',
  73055. 'ï' => 'ï',
  73056. 'ñ' => 'ñ',
  73057. 'ò' => 'ò',
  73058. 'o�' => 'ó',
  73059. 'ô' => 'ô',
  73060. 'õ' => 'õ',
  73061. 'ö' => 'ö',
  73062. 'ù' => 'ù',
  73063. 'u�' => 'ú',
  73064. 'û' => 'û',
  73065. 'ü' => 'ü',
  73066. 'y�' => 'ý',
  73067. 'ÿ' => 'ÿ',
  73068. 'AÌ„' => 'Ä€',
  73069. 'ā' => '�',
  73070. 'Ă' => 'Ă',
  73071. 'ă' => 'ă',
  73072. 'Ą' => 'Ą',
  73073. 'ą' => 'ą',
  73074. 'C�' => 'Ć',
  73075. 'c�' => 'ć',
  73076. 'Ĉ' => 'Ĉ',
  73077. 'ĉ' => 'ĉ',
  73078. 'Ċ' => 'Ċ',
  73079. 'ċ' => 'ċ',
  73080. 'Č' => 'Č',
  73081. 'č' => '�',
  73082. 'Ď' => 'Ď',
  73083. 'ď' => '�',
  73084. 'EÌ„' => 'Ä’',
  73085. 'ē' => 'ē',
  73086. 'Ĕ' => 'Ĕ',
  73087. 'ĕ' => 'ĕ',
  73088. 'Ė' => 'Ė',
  73089. 'ė' => 'ė',
  73090. 'Ę' => 'Ę',
  73091. 'ę' => 'ę',
  73092. 'Ě' => 'Ě',
  73093. 'ě' => 'ě',
  73094. 'Ĝ' => 'Ĝ',
  73095. 'ĝ' => '�',
  73096. 'Ğ' => 'Ğ',
  73097. 'ğ' => 'ğ',
  73098. 'Ġ' => 'Ġ',
  73099. 'ġ' => 'ġ',
  73100. 'Ģ' => 'Ģ',
  73101. 'ģ' => 'ģ',
  73102. 'Ĥ' => 'Ĥ',
  73103. 'ĥ' => 'ĥ',
  73104. 'Ĩ' => 'Ĩ',
  73105. 'ĩ' => 'ĩ',
  73106. 'Ī' => 'Ī',
  73107. 'ī' => 'ī',
  73108. 'Ĭ' => 'Ĭ',
  73109. 'ĭ' => 'ĭ',
  73110. 'Į' => 'Į',
  73111. 'į' => 'į',
  73112. 'İ' => 'İ',
  73113. 'JÌ‚' => 'Ä´',
  73114. 'ĵ' => 'ĵ',
  73115. 'Ķ' => 'Ķ',
  73116. 'ķ' => 'ķ',
  73117. 'L�' => 'Ĺ',
  73118. 'l�' => 'ĺ',
  73119. 'Ļ' => 'Ļ',
  73120. 'ļ' => 'ļ',
  73121. 'Ľ' => 'Ľ',
  73122. 'ľ' => 'ľ',
  73123. 'N�' => 'Ń',
  73124. 'n�' => 'ń',
  73125. 'Ņ' => 'Ņ',
  73126. 'ņ' => 'ņ',
  73127. 'Ň' => 'Ň',
  73128. 'ň' => 'ň',
  73129. 'Ō' => 'Ō',
  73130. 'ō' => '�',
  73131. 'Ŏ' => 'Ŏ',
  73132. 'ŏ' => '�',
  73133. 'Ő' => '�',
  73134. 'ő' => 'ő',
  73135. 'R�' => 'Ŕ',
  73136. 'r�' => 'ŕ',
  73137. 'Ŗ' => 'Ŗ',
  73138. 'ŗ' => 'ŗ',
  73139. 'Ř' => 'Ř',
  73140. 'ř' => 'ř',
  73141. 'S�' => 'Ś',
  73142. 's�' => 'ś',
  73143. 'Ŝ' => 'Ŝ',
  73144. 'ŝ' => '�',
  73145. 'Ş' => 'Ş',
  73146. 'ş' => 'ş',
  73147. 'Š' => 'Š',
  73148. 'š' => 'š',
  73149. 'Ţ' => 'Ţ',
  73150. 'ţ' => 'ţ',
  73151. 'Ť' => 'Ť',
  73152. 'ť' => 'ť',
  73153. 'Ũ' => 'Ũ',
  73154. 'ũ' => 'ũ',
  73155. 'Ū' => 'Ū',
  73156. 'ū' => 'ū',
  73157. 'Ŭ' => 'Ŭ',
  73158. 'ŭ' => 'ŭ',
  73159. 'UÌŠ' => 'Å®',
  73160. 'ů' => 'ů',
  73161. 'UÌ‹' => 'Å°',
  73162. 'ű' => 'ű',
  73163. 'Ų' => 'Ų',
  73164. 'ų' => 'ų',
  73165. 'WÌ‚' => 'Å´',
  73166. 'ŵ' => 'ŵ',
  73167. 'Ŷ' => 'Ŷ',
  73168. 'ŷ' => 'ŷ',
  73169. 'Ÿ' => 'Ÿ',
  73170. 'Z�' => 'Ź',
  73171. 'z�' => 'ź',
  73172. 'Ż' => 'Ż',
  73173. 'ż' => 'ż',
  73174. 'Ž' => 'Ž',
  73175. 'ž' => 'ž',
  73176. 'OÌ›' => 'Æ ',
  73177. 'oÌ›' => 'Æ¡',
  73178. 'Ư' => 'Ư',
  73179. 'uÌ›' => 'Æ°',
  73180. 'Ǎ' => '�',
  73181. 'ǎ' => 'ǎ',
  73182. 'Ǐ' => '�',
  73183. 'ǐ' => '�',
  73184. 'Ǒ' => 'Ǒ',
  73185. 'ǒ' => 'ǒ',
  73186. 'Ǔ' => 'Ǔ',
  73187. 'ǔ' => 'ǔ',
  73188. 'Ǖ' => 'Ǖ',
  73189. 'ǖ' => 'ǖ',
  73190. 'Ü�' => 'Ǘ',
  73191. 'ü�' => 'ǘ',
  73192. 'Ǚ' => 'Ǚ',
  73193. 'ǚ' => 'ǚ',
  73194. 'Ǜ' => 'Ǜ',
  73195. 'ǜ' => 'ǜ',
  73196. 'Ǟ' => 'Ǟ',
  73197. 'ǟ' => 'ǟ',
  73198. 'Ǡ' => 'Ǡ',
  73199. 'ǡ' => 'ǡ',
  73200. 'Ǣ' => 'Ǣ',
  73201. 'ǣ' => 'ǣ',
  73202. 'Ǧ' => 'Ǧ',
  73203. 'ǧ' => 'ǧ',
  73204. 'Ǩ' => 'Ǩ',
  73205. 'ǩ' => 'ǩ',
  73206. 'Ǫ' => 'Ǫ',
  73207. 'ǫ' => 'ǫ',
  73208. 'Ǭ' => 'Ǭ',
  73209. 'Ç«Ì„' => 'Ç­',
  73210. 'Ǯ' => 'Ǯ',
  73211. 'ǯ' => 'ǯ',
  73212. 'ǰ' => 'ǰ',
  73213. 'G�' => 'Ǵ',
  73214. 'g�' => 'ǵ',
  73215. 'Ǹ' => 'Ǹ',
  73216. 'ǹ' => 'ǹ',
  73217. 'Å�' => 'Ǻ',
  73218. 'å�' => 'ǻ',
  73219. 'Æ�' => 'Ǽ',
  73220. 'æ�' => 'ǽ',
  73221. 'Ø�' => 'Ǿ',
  73222. 'ø�' => 'ǿ',
  73223. 'A�' => 'Ȁ',
  73224. 'a�' => '�',
  73225. 'AÌ‘' => 'È‚',
  73226. 'ȃ' => 'ȃ',
  73227. 'E�' => 'Ȅ',
  73228. 'e�' => 'ȅ',
  73229. 'Ȇ' => 'Ȇ',
  73230. 'ȇ' => 'ȇ',
  73231. 'I�' => 'Ȉ',
  73232. 'i�' => 'ȉ',
  73233. 'IÌ‘' => 'ÈŠ',
  73234. 'ȋ' => 'ȋ',
  73235. 'O�' => 'Ȍ',
  73236. 'o�' => '�',
  73237. 'OÌ‘' => 'ÈŽ',
  73238. 'ȏ' => '�',
  73239. 'R�' => '�',
  73240. 'r�' => 'ȑ',
  73241. 'RÌ‘' => 'È’',
  73242. 'ȓ' => 'ȓ',
  73243. 'U�' => 'Ȕ',
  73244. 'u�' => 'ȕ',
  73245. 'UÌ‘' => 'È–',
  73246. 'ȗ' => 'ȗ',
  73247. 'Ș' => 'Ș',
  73248. 'ș' => 'ș',
  73249. 'Ț' => 'Ț',
  73250. 'ț' => 'ț',
  73251. 'Ȟ' => 'Ȟ',
  73252. 'ȟ' => 'ȟ',
  73253. 'Ȧ' => 'Ȧ',
  73254. 'ȧ' => 'ȧ',
  73255. 'Ȩ' => 'Ȩ',
  73256. 'ȩ' => 'ȩ',
  73257. 'Ȫ' => 'Ȫ',
  73258. 'ȫ' => 'ȫ',
  73259. 'Ȭ' => 'Ȭ',
  73260. 'ȭ' => 'ȭ',
  73261. 'Ȯ' => 'Ȯ',
  73262. 'ȯ' => 'ȯ',
  73263. 'Ȱ' => 'Ȱ',
  73264. 'ȱ' => 'ȱ',
  73265. 'Ȳ' => 'Ȳ',
  73266. 'ȳ' => 'ȳ',
  73267. '¨�' => '΅',
  73268. 'Α�' => 'Ά',
  73269. 'Ε�' => 'Έ',
  73270. 'Η�' => 'Ή',
  73271. 'Ι�' => 'Ί',
  73272. 'Ο�' => 'Ό',
  73273. 'Υ�' => 'Ύ',
  73274. 'Ω�' => '�',
  73275. 'ϊ�' => '�',
  73276. 'Ϊ' => 'Ϊ',
  73277. 'Ϋ' => 'Ϋ',
  73278. 'α�' => 'ά',
  73279. 'ε�' => 'έ',
  73280. 'η�' => 'ή',
  73281. 'ι�' => 'ί',
  73282. 'ϋ�' => 'ΰ',
  73283. 'ϊ' => 'ϊ',
  73284. 'ϋ' => 'ϋ',
  73285. 'ο�' => 'ό',
  73286. 'υ�' => '�',
  73287. 'ω�' => 'ώ',
  73288. 'ϒ�' => 'ϓ',
  73289. 'ϔ' => 'ϔ',
  73290. 'Ѐ' => 'Ѐ',
  73291. 'Ё' => '�',
  73292. 'Г�' => 'Ѓ',
  73293. 'Ї' => 'Ї',
  73294. 'К�' => 'Ќ',
  73295. 'Ѝ' => '�',
  73296. 'Ў' => 'Ў',
  73297. 'Й' => 'Й',
  73298. 'й' => 'й',
  73299. 'ѐ' => '�',
  73300. 'ё' => 'ё',
  73301. 'г�' => 'ѓ',
  73302. 'ї' => 'ї',
  73303. 'к�' => 'ќ',
  73304. 'ѝ' => '�',
  73305. 'ў' => 'ў',
  73306. 'Ѵ�' => 'Ѷ',
  73307. 'ѵ�' => 'ѷ',
  73308. 'Ӂ' => '�',
  73309. 'ӂ' => 'ӂ',
  73310. '�̆' => '�',
  73311. 'ӑ' => 'ӑ',
  73312. '�̈' => 'Ӓ',
  73313. 'ӓ' => 'ӓ',
  73314. 'Ӗ' => 'Ӗ',
  73315. 'ӗ' => 'ӗ',
  73316. 'Ӛ' => 'Ӛ',
  73317. 'ӛ' => 'ӛ',
  73318. 'Ӝ' => 'Ӝ',
  73319. 'ӝ' => '�',
  73320. 'Ӟ' => 'Ӟ',
  73321. 'ӟ' => 'ӟ',
  73322. 'Ӣ' => 'Ӣ',
  73323. 'ӣ' => 'ӣ',
  73324. 'Ӥ' => 'Ӥ',
  73325. 'ӥ' => 'ӥ',
  73326. 'Ӧ' => 'Ӧ',
  73327. 'ӧ' => 'ӧ',
  73328. 'Ӫ' => 'Ӫ',
  73329. 'ӫ' => 'ӫ',
  73330. 'Ӭ' => 'Ӭ',
  73331. '�̈' => 'ӭ',
  73332. 'Ӯ' => 'Ӯ',
  73333. 'ӯ' => 'ӯ',
  73334. 'Ӱ' => 'Ӱ',
  73335. 'ӱ' => 'ӱ',
  73336. 'Ӳ' => 'Ӳ',
  73337. 'ӳ' => 'ӳ',
  73338. 'Ӵ' => 'Ӵ',
  73339. 'ӵ' => 'ӵ',
  73340. 'Ӹ' => 'Ӹ',
  73341. 'ӹ' => 'ӹ',
  73342. 'آ' => 'آ',
  73343. 'أ' => 'أ',
  73344. 'ؤ' => 'ؤ',
  73345. 'إ' => 'إ',
  73346. 'ئ' => 'ئ',
  73347. 'Û•Ù”' => 'Û€',
  73348. 'Û�Ù”' => 'Û‚',
  73349. 'Û’Ù”' => 'Û“',
  73350. 'ऩ' => 'ऩ',
  73351. 'ऱ' => 'ऱ',
  73352. 'ऴ' => 'ऴ',
  73353. 'ো' => 'ো',
  73354. 'ৌ' => 'ৌ',
  73355. 'ୈ' => 'ୈ',
  73356. 'ୋ' => 'ୋ',
  73357. 'ୌ' => 'ୌ',
  73358. 'ஔ' => 'ஔ',
  73359. 'ொ' => 'ொ',
  73360. 'ோ' => 'ோ',
  73361. 'ௌ' => 'ௌ',
  73362. 'ై' => 'ై',
  73363. 'ೀ' => 'ೀ',
  73364. 'ೇ' => 'ೇ',
  73365. 'ೈ' => 'ೈ',
  73366. 'ೊ' => 'ೊ',
  73367. 'ೋ' => 'ೋ',
  73368. 'ൊ' => 'ൊ',
  73369. 'ോ' => 'ോ',
  73370. 'ൌ' => 'ൌ',
  73371. 'ේ' => 'ේ',
  73372. 'ෙ�' => 'ො',
  73373. 'ෝ' => '�',
  73374. 'ෞ' => 'ෞ',
  73375. 'ဦ' => 'ဦ',
  73376. 'ᬆ' => 'ᬆ',
  73377. 'ᬈ' => 'ᬈ',
  73378. 'ᬊ' => 'ᬊ',
  73379. 'ᬌ' => 'ᬌ',
  73380. '�ᬵ' => 'ᬎ',
  73381. 'ᬒ' => 'ᬒ',
  73382. 'ᬻ' => 'ᬻ',
  73383. 'ᬽ' => 'ᬽ',
  73384. 'ᭀ' => 'ᭀ',
  73385. 'ᭁ' => '�',
  73386. 'ᭃ' => 'ᭃ',
  73387. 'Ḁ' => 'Ḁ',
  73388. 'ḁ' => '�',
  73389. 'Ḃ' => 'Ḃ',
  73390. 'ḃ' => 'ḃ',
  73391. 'Ḅ' => 'Ḅ',
  73392. 'ḅ' => 'ḅ',
  73393. 'Ḇ' => 'Ḇ',
  73394. 'ḇ' => 'ḇ',
  73395. 'Ç�' => 'Ḉ',
  73396. 'ç�' => 'ḉ',
  73397. 'Ḋ' => 'Ḋ',
  73398. 'ḋ' => 'ḋ',
  73399. 'Ḍ' => 'Ḍ',
  73400. 'ḍ' => '�',
  73401. 'Ḏ' => 'Ḏ',
  73402. 'ḏ' => '�',
  73403. 'Ḑ' => '�',
  73404. 'ḑ' => 'ḑ',
  73405. 'Ḓ' => 'Ḓ',
  73406. 'ḓ' => 'ḓ',
  73407. 'Ḕ' => 'Ḕ',
  73408. 'ḕ' => 'ḕ',
  73409. 'Ē�' => 'Ḗ',
  73410. 'ē�' => 'ḗ',
  73411. 'Ḙ' => 'Ḙ',
  73412. 'ḙ' => 'ḙ',
  73413. 'Ḛ' => 'Ḛ',
  73414. 'ḛ' => 'ḛ',
  73415. 'Ḝ' => 'Ḝ',
  73416. 'ḝ' => '�',
  73417. 'Ḟ' => 'Ḟ',
  73418. 'ḟ' => 'ḟ',
  73419. 'Ḡ' => 'Ḡ',
  73420. 'ḡ' => 'ḡ',
  73421. 'Ḣ' => 'Ḣ',
  73422. 'ḣ' => 'ḣ',
  73423. 'Ḥ' => 'Ḥ',
  73424. 'ḥ' => 'ḥ',
  73425. 'Ḧ' => 'Ḧ',
  73426. 'ḧ' => 'ḧ',
  73427. 'Ḩ' => 'Ḩ',
  73428. 'ḩ' => 'ḩ',
  73429. 'Ḫ' => 'Ḫ',
  73430. 'ḫ' => 'ḫ',
  73431. 'Ḭ' => 'Ḭ',
  73432. 'ḭ' => 'ḭ',
  73433. '��' => 'Ḯ',
  73434. 'ï�' => 'ḯ',
  73435. 'K�' => 'Ḱ',
  73436. 'k�' => 'ḱ',
  73437. 'Ḳ' => 'Ḳ',
  73438. 'ḳ' => 'ḳ',
  73439. 'Ḵ' => 'Ḵ',
  73440. 'ḵ' => 'ḵ',
  73441. 'Ḷ' => 'Ḷ',
  73442. 'ḷ' => 'ḷ',
  73443. 'Ḹ' => 'Ḹ',
  73444. 'ḹ' => 'ḹ',
  73445. 'Ḻ' => 'Ḻ',
  73446. 'ḻ' => 'ḻ',
  73447. 'Ḽ' => 'Ḽ',
  73448. 'ḽ' => 'ḽ',
  73449. 'M�' => 'Ḿ',
  73450. 'm�' => 'ḿ',
  73451. 'Ṁ' => 'Ṁ',
  73452. 'ṁ' => '�',
  73453. 'Ṃ' => 'Ṃ',
  73454. 'ṃ' => 'ṃ',
  73455. 'Ṅ' => 'Ṅ',
  73456. 'ṅ' => 'ṅ',
  73457. 'Ṇ' => 'Ṇ',
  73458. 'ṇ' => 'ṇ',
  73459. 'Ṉ' => 'Ṉ',
  73460. 'ṉ' => 'ṉ',
  73461. 'Ṋ' => 'Ṋ',
  73462. 'ṋ' => 'ṋ',
  73463. 'Õ�' => 'Ṍ',
  73464. 'õ�' => '�',
  73465. 'Ṏ' => 'Ṏ',
  73466. 'ṏ' => '�',
  73467. 'Ṑ' => '�',
  73468. '�̀' => 'ṑ',
  73469. 'Ō�' => 'Ṓ',
  73470. '��' => 'ṓ',
  73471. 'P�' => 'Ṕ',
  73472. 'p�' => 'ṕ',
  73473. 'Ṗ' => 'Ṗ',
  73474. 'ṗ' => 'ṗ',
  73475. 'Ṙ' => 'Ṙ',
  73476. 'ṙ' => 'ṙ',
  73477. 'Ṛ' => 'Ṛ',
  73478. 'ṛ' => 'ṛ',
  73479. 'Ṝ' => 'Ṝ',
  73480. 'ṝ' => '�',
  73481. 'Ṟ' => 'Ṟ',
  73482. 'ṟ' => 'ṟ',
  73483. 'Ṡ' => 'Ṡ',
  73484. 'ṡ' => 'ṡ',
  73485. 'SÌ£' => 'á¹¢',
  73486. 'ṣ' => 'ṣ',
  73487. 'Ṥ' => 'Ṥ',
  73488. 'ṥ' => 'ṥ',
  73489. 'Ṧ' => 'Ṧ',
  73490. 'ṧ' => 'ṧ',
  73491. 'Ṩ' => 'Ṩ',
  73492. 'ṩ' => 'ṩ',
  73493. 'Ṫ' => 'Ṫ',
  73494. 'ṫ' => 'ṫ',
  73495. 'Ṭ' => 'Ṭ',
  73496. 'ṭ' => 'ṭ',
  73497. 'Ṯ' => 'Ṯ',
  73498. 'ṯ' => 'ṯ',
  73499. 'TÌ­' => 'á¹°',
  73500. 'tÌ­' => 'á¹±',
  73501. 'Ṳ' => 'Ṳ',
  73502. 'ṳ' => 'ṳ',
  73503. 'UÌ°' => 'á¹´',
  73504. 'uÌ°' => 'á¹µ',
  73505. 'Ṷ' => 'Ṷ',
  73506. 'uÌ­' => 'á¹·',
  73507. 'Ũ�' => 'Ṹ',
  73508. 'ũ�' => 'ṹ',
  73509. 'Ṻ' => 'Ṻ',
  73510. 'ṻ' => 'ṻ',
  73511. 'Ṽ' => 'Ṽ',
  73512. 'ṽ' => 'ṽ',
  73513. 'VÌ£' => 'á¹¾',
  73514. 'ṿ' => 'ṿ',
  73515. 'Ẁ' => 'Ẁ',
  73516. 'ẁ' => '�',
  73517. 'W�' => 'Ẃ',
  73518. 'w�' => 'ẃ',
  73519. 'Ẅ' => 'Ẅ',
  73520. 'ẅ' => 'ẅ',
  73521. 'Ẇ' => 'Ẇ',
  73522. 'ẇ' => 'ẇ',
  73523. 'Ẉ' => 'Ẉ',
  73524. 'ẉ' => 'ẉ',
  73525. 'Ẋ' => 'Ẋ',
  73526. 'ẋ' => 'ẋ',
  73527. 'Ẍ' => 'Ẍ',
  73528. 'ẍ' => '�',
  73529. 'Ẏ' => 'Ẏ',
  73530. 'ẏ' => '�',
  73531. 'Ẑ' => '�',
  73532. 'ẑ' => 'ẑ',
  73533. 'Ẓ' => 'Ẓ',
  73534. 'ẓ' => 'ẓ',
  73535. 'Ẕ' => 'Ẕ',
  73536. 'ẕ' => 'ẕ',
  73537. 'ẖ' => 'ẖ',
  73538. 'ẗ' => 'ẗ',
  73539. 'ẘ' => 'ẘ',
  73540. 'ẙ' => 'ẙ',
  73541. 'ẛ' => 'ẛ',
  73542. 'Ạ' => 'Ạ',
  73543. 'ạ' => 'ạ',
  73544. 'Ả' => 'Ả',
  73545. 'ả' => 'ả',
  73546. 'Â�' => 'Ấ',
  73547. 'â�' => 'ấ',
  73548. 'Ầ' => 'Ầ',
  73549. 'ầ' => 'ầ',
  73550. 'Ẩ' => 'Ẩ',
  73551. 'ẩ' => 'ẩ',
  73552. 'Ẫ' => 'Ẫ',
  73553. 'ẫ' => 'ẫ',
  73554. 'Ậ' => 'Ậ',
  73555. 'ậ' => 'ậ',
  73556. 'Ă�' => 'Ắ',
  73557. 'ă�' => 'ắ',
  73558. 'Ằ' => 'Ằ',
  73559. 'ằ' => 'ằ',
  73560. 'Ẳ' => 'Ẳ',
  73561. 'ẳ' => 'ẳ',
  73562. 'Ẵ' => 'Ẵ',
  73563. 'ẵ' => 'ẵ',
  73564. 'Ặ' => 'Ặ',
  73565. 'ặ' => 'ặ',
  73566. 'Ẹ' => 'Ẹ',
  73567. 'ẹ' => 'ẹ',
  73568. 'Ẻ' => 'Ẻ',
  73569. 'ẻ' => 'ẻ',
  73570. 'Ẽ' => 'Ẽ',
  73571. 'ẽ' => 'ẽ',
  73572. 'Ê�' => 'Ế',
  73573. 'ê�' => 'ế',
  73574. 'Ề' => 'Ề',
  73575. 'ề' => '�',
  73576. 'Ể' => 'Ể',
  73577. 'ể' => 'ể',
  73578. 'Ễ' => 'Ễ',
  73579. 'ễ' => 'ễ',
  73580. 'Ệ' => 'Ệ',
  73581. 'ệ' => 'ệ',
  73582. 'Ỉ' => 'Ỉ',
  73583. 'ỉ' => 'ỉ',
  73584. 'Ị' => 'Ị',
  73585. 'ị' => 'ị',
  73586. 'Ọ' => 'Ọ',
  73587. 'ọ' => '�',
  73588. 'Ỏ' => 'Ỏ',
  73589. 'ỏ' => '�',
  73590. 'Ô�' => '�',
  73591. 'ô�' => 'ố',
  73592. 'Ồ' => 'Ồ',
  73593. 'ồ' => 'ồ',
  73594. 'Ổ' => 'Ổ',
  73595. 'ổ' => 'ổ',
  73596. 'Ỗ' => 'Ỗ',
  73597. 'ỗ' => 'ỗ',
  73598. 'Ộ' => 'Ộ',
  73599. '�̂' => 'ộ',
  73600. 'Ơ�' => 'Ớ',
  73601. 'ơ�' => 'ớ',
  73602. 'Ờ' => 'Ờ',
  73603. 'ờ' => '�',
  73604. 'Ở' => 'Ở',
  73605. 'ở' => 'ở',
  73606. 'Ỡ' => 'Ỡ',
  73607. 'ỡ' => 'ỡ',
  73608. 'Ợ' => 'Ợ',
  73609. 'ợ' => 'ợ',
  73610. 'Ụ' => 'Ụ',
  73611. 'ụ' => 'ụ',
  73612. 'Ủ' => 'Ủ',
  73613. 'ủ' => 'ủ',
  73614. 'Ư�' => 'Ứ',
  73615. 'ư�' => 'ứ',
  73616. 'Ừ' => 'Ừ',
  73617. 'ừ' => 'ừ',
  73618. 'Ử' => 'Ử',
  73619. 'ử' => 'ử',
  73620. 'Ữ' => 'Ữ',
  73621. 'ữ' => 'ữ',
  73622. 'Ự' => 'Ự',
  73623. 'Æ°Ì£' => 'á»±',
  73624. 'Ỳ' => 'Ỳ',
  73625. 'ỳ' => 'ỳ',
  73626. 'YÌ£' => 'á»´',
  73627. 'ỵ' => 'ỵ',
  73628. 'Ỷ' => 'Ỷ',
  73629. 'ỷ' => 'ỷ',
  73630. 'Ỹ' => 'Ỹ',
  73631. 'ỹ' => 'ỹ',
  73632. 'ἀ' => 'ἀ',
  73633. 'ἁ' => '�',
  73634. 'ἂ' => 'ἂ',
  73635. '�̀' => 'ἃ',
  73636. 'ἀ�' => 'ἄ',
  73637. '��' => 'ἅ',
  73638. 'ἆ' => 'ἆ',
  73639. '�͂' => 'ἇ',
  73640. 'Ἀ' => 'Ἀ',
  73641. 'Ἁ' => 'Ἁ',
  73642. 'Ἂ' => 'Ἂ',
  73643. 'Ἃ' => 'Ἃ',
  73644. 'Ἀ�' => 'Ἄ',
  73645. 'Ἁ�' => '�',
  73646. 'Ἆ' => 'Ἆ',
  73647. 'Ἇ' => '�',
  73648. 'ἐ' => '�',
  73649. 'ἑ' => 'ἑ',
  73650. '�̀' => 'ἒ',
  73651. 'ἓ' => 'ἓ',
  73652. '��' => 'ἔ',
  73653. 'ἑ�' => 'ἕ',
  73654. 'Ἐ' => 'Ἐ',
  73655. 'Ἑ' => 'Ἑ',
  73656. 'Ἒ' => 'Ἒ',
  73657. 'Ἓ' => 'Ἓ',
  73658. 'Ἐ�' => 'Ἔ',
  73659. 'Ἑ�' => '�',
  73660. 'ἠ' => 'ἠ',
  73661. 'ἡ' => 'ἡ',
  73662. 'ἢ' => 'ἢ',
  73663. 'ἣ' => 'ἣ',
  73664. 'ἠ�' => 'ἤ',
  73665. 'ἡ�' => 'ἥ',
  73666. 'ἦ' => 'ἦ',
  73667. 'ἧ' => 'ἧ',
  73668. 'Ἠ' => 'Ἠ',
  73669. 'Ἡ' => 'Ἡ',
  73670. 'Ἢ' => 'Ἢ',
  73671. 'Ἣ' => 'Ἣ',
  73672. 'Ἠ�' => 'Ἤ',
  73673. 'Ἡ�' => 'Ἥ',
  73674. 'Ἦ' => 'Ἦ',
  73675. 'Ἧ' => 'Ἧ',
  73676. 'ἰ' => 'ἰ',
  73677. 'ἱ' => 'ἱ',
  73678. 'á¼°Ì€' => 'á¼²',
  73679. 'ἳ' => 'ἳ',
  73680. 'ἰ�' => 'ἴ',
  73681. 'ἱ�' => 'ἵ',
  73682. 'ἶ' => 'ἶ',
  73683. 'ἷ' => 'ἷ',
  73684. 'Ἰ' => 'Ἰ',
  73685. 'Ἱ' => 'Ἱ',
  73686. 'Ἲ' => 'Ἲ',
  73687. 'Ἳ' => 'Ἳ',
  73688. 'Ἰ�' => 'Ἴ',
  73689. 'Ἱ�' => 'Ἵ',
  73690. 'Ἶ' => 'Ἶ',
  73691. 'Ἷ' => 'Ἷ',
  73692. 'ὀ' => 'ὀ',
  73693. 'ὁ' => '�',
  73694. 'ὂ' => 'ὂ',
  73695. '�̀' => 'ὃ',
  73696. 'ὀ�' => 'ὄ',
  73697. '��' => 'ὅ',
  73698. 'Ὀ' => 'Ὀ',
  73699. 'Ὁ' => 'Ὁ',
  73700. 'Ὂ' => 'Ὂ',
  73701. 'Ὃ' => 'Ὃ',
  73702. 'Ὀ�' => 'Ὄ',
  73703. 'Ὁ�' => '�',
  73704. 'ὐ' => '�',
  73705. 'ὑ' => 'ὑ',
  73706. '�̀' => 'ὒ',
  73707. 'ὓ' => 'ὓ',
  73708. '��' => 'ὔ',
  73709. 'ὑ�' => 'ὕ',
  73710. '�͂' => 'ὖ',
  73711. 'ὗ' => 'ὗ',
  73712. 'Ὑ' => 'Ὑ',
  73713. 'Ὓ' => 'Ὓ',
  73714. 'Ὑ�' => '�',
  73715. 'Ὗ' => 'Ὗ',
  73716. 'ὠ' => 'ὠ',
  73717. 'ὡ' => 'ὡ',
  73718. 'ὢ' => 'ὢ',
  73719. 'ὣ' => 'ὣ',
  73720. 'ὠ�' => 'ὤ',
  73721. 'ὡ�' => 'ὥ',
  73722. 'ὦ' => 'ὦ',
  73723. 'ὧ' => 'ὧ',
  73724. 'Ὠ' => 'Ὠ',
  73725. 'Ὡ' => 'Ὡ',
  73726. 'Ὢ' => 'Ὢ',
  73727. 'Ὣ' => 'Ὣ',
  73728. 'Ὠ�' => 'Ὤ',
  73729. 'Ὡ�' => 'Ὥ',
  73730. 'Ὦ' => 'Ὦ',
  73731. 'Ὧ' => 'Ὧ',
  73732. 'ὰ' => 'ὰ',
  73733. 'ὲ' => 'ὲ',
  73734. 'ὴ' => 'ὴ',
  73735. 'ὶ' => 'ὶ',
  73736. 'ὸ' => 'ὸ',
  73737. 'ὺ' => 'ὺ',
  73738. 'ὼ' => 'ὼ',
  73739. 'ᾀ' => 'ᾀ',
  73740. '�ͅ' => '�',
  73741. 'ᾂ' => 'ᾂ',
  73742. 'ᾃ' => 'ᾃ',
  73743. 'ᾄ' => 'ᾄ',
  73744. 'á¼…Í…' => 'á¾…',
  73745. 'ᾆ' => 'ᾆ',
  73746. 'ᾇ' => 'ᾇ',
  73747. 'ᾈ' => 'ᾈ',
  73748. 'ᾉ' => 'ᾉ',
  73749. 'ᾊ' => 'ᾊ',
  73750. 'ᾋ' => 'ᾋ',
  73751. 'ᾌ' => 'ᾌ',
  73752. '�ͅ' => '�',
  73753. 'ᾎ' => 'ᾎ',
  73754. '�ͅ' => '�',
  73755. 'ᾐ' => '�',
  73756. 'ᾑ' => 'ᾑ',
  73757. 'ᾒ' => 'ᾒ',
  73758. 'ᾓ' => 'ᾓ',
  73759. 'ᾔ' => 'ᾔ',
  73760. 'ᾕ' => 'ᾕ',
  73761. 'ᾖ' => 'ᾖ',
  73762. 'ᾗ' => 'ᾗ',
  73763. 'ᾘ' => 'ᾘ',
  73764. 'ᾙ' => 'ᾙ',
  73765. 'ᾚ' => 'ᾚ',
  73766. 'ᾛ' => 'ᾛ',
  73767. 'ᾜ' => 'ᾜ',
  73768. 'ᾝ' => '�',
  73769. 'ᾞ' => 'ᾞ',
  73770. 'ᾟ' => 'ᾟ',
  73771. 'á½ Í…' => 'á¾ ',
  73772. 'ᾡ' => 'ᾡ',
  73773. 'ᾢ' => 'ᾢ',
  73774. 'ᾣ' => 'ᾣ',
  73775. 'ᾤ' => 'ᾤ',
  73776. 'ᾥ' => 'ᾥ',
  73777. 'ᾦ' => 'ᾦ',
  73778. 'ᾧ' => 'ᾧ',
  73779. 'ᾨ' => 'ᾨ',
  73780. 'ᾩ' => 'ᾩ',
  73781. 'ᾪ' => 'ᾪ',
  73782. 'ᾫ' => 'ᾫ',
  73783. 'ᾬ' => 'ᾬ',
  73784. 'á½­Í…' => 'á¾­',
  73785. 'ᾮ' => 'ᾮ',
  73786. 'ᾯ' => 'ᾯ',
  73787. 'ᾰ' => 'ᾰ',
  73788. 'ᾱ' => 'ᾱ',
  73789. 'á½°Í…' => 'á¾²',
  73790. 'ᾳ' => 'ᾳ',
  73791. 'ᾴ' => 'ᾴ',
  73792. 'ᾶ' => 'ᾶ',
  73793. 'ᾷ' => 'ᾷ',
  73794. 'Ᾰ' => 'Ᾰ',
  73795. 'Ᾱ' => 'Ᾱ',
  73796. 'Ὰ' => 'Ὰ',
  73797. 'ᾼ' => 'ᾼ',
  73798. '῁' => '�',
  73799. 'á½´Í…' => 'á¿‚',
  73800. 'ῃ' => 'ῃ',
  73801. 'ῄ' => 'ῄ',
  73802. 'ῆ' => 'ῆ',
  73803. 'ῇ' => 'ῇ',
  73804. 'Ὲ' => 'Ὲ',
  73805. 'Ὴ' => 'Ὴ',
  73806. 'ῌ' => 'ῌ',
  73807. '῍' => '�',
  73808. '᾿�' => '῎',
  73809. '῏' => '�',
  73810. 'ῐ' => '�',
  73811. 'ῑ' => 'ῑ',
  73812. 'ÏŠÌ€' => 'á¿’',
  73813. 'ῖ' => 'ῖ',
  73814. 'ÏŠÍ‚' => 'á¿—',
  73815. 'Ῐ' => 'Ῐ',
  73816. 'Ῑ' => 'Ῑ',
  73817. 'Ὶ' => 'Ὶ',
  73818. '῝' => '�',
  73819. '῾�' => '῞',
  73820. '῟' => '῟',
  73821. 'ῠ' => 'ῠ',
  73822. 'Ï…Ì„' => 'á¿¡',
  73823. 'Ï‹Ì€' => 'á¿¢',
  73824. '�̓' => 'ῤ',
  73825. '�̔' => 'ῥ',
  73826. 'ῦ' => 'ῦ',
  73827. 'ῧ' => 'ῧ',
  73828. 'Ῠ' => 'Ῠ',
  73829. 'Ῡ' => 'Ῡ',
  73830. 'Ὺ' => 'Ὺ',
  73831. 'Ῥ' => 'Ῥ',
  73832. '῭' => '῭',
  73833. 'ῲ' => 'ῲ',
  73834. 'ῳ' => 'ῳ',
  73835. 'ÏŽÍ…' => 'á¿´',
  73836. 'ῶ' => 'ῶ',
  73837. 'ῷ' => 'ῷ',
  73838. 'Ὸ' => 'Ὸ',
  73839. 'Ὼ' => 'Ὼ',
  73840. 'ῼ' => 'ῼ',
  73841. '�̸' => '↚',
  73842. '↛' => '↛',
  73843. '↮' => '↮',
  73844. '�̸' => '�',
  73845. '⇎' => '⇎',
  73846. '⇏' => '�',
  73847. '∄' => '∄',
  73848. '∉' => '∉',
  73849. '∌' => '∌',
  73850. '∤' => '∤',
  73851. '∦' => '∦',
  73852. '≁' => '�',
  73853. '≄' => '≄',
  73854. '≇' => '≇',
  73855. '≉' => '≉',
  73856. '≠' => '≠',
  73857. '≢' => '≢',
  73858. '�̸' => '≭',
  73859. '≮' => '≮',
  73860. '≯' => '≯',
  73861. '≰' => '≰',
  73862. '≱' => '≱',
  73863. '≴' => '≴',
  73864. '≵' => '≵',
  73865. '≸' => '≸',
  73866. '≹' => '≹',
  73867. '⊀' => '⊀',
  73868. '⊁' => '�',
  73869. '⊄' => '⊄',
  73870. '⊅' => '⊅',
  73871. '⊈' => '⊈',
  73872. '⊉' => '⊉',
  73873. '⊬' => '⊬',
  73874. '⊭' => '⊭',
  73875. '⊮' => '⊮',
  73876. '⊯' => '⊯',
  73877. '⋠' => '⋠',
  73878. '⋡' => '⋡',
  73879. '⋢' => '⋢',
  73880. '⋣' => '⋣',
  73881. '⋪' => '⋪',
  73882. '⋫' => '⋫',
  73883. '⋬' => '⋬',
  73884. '⋭' => '⋭',
  73885. '�゙' => '�',
  73886. '�゙' => '�',
  73887. '�゙' => '�',
  73888. '�゙' => '�',
  73889. '�゙' => '�',
  73890. '�゙' => '�',
  73891. '�゙' => '�',
  73892. '�゙' => '�',
  73893. '�゙' => '�',
  73894. '�゙' => '�',
  73895. '�゙' => '�',
  73896. '�゙' => '�',
  73897. '�゙' => '�',
  73898. '�゙' => '�',
  73899. '�゙' => '�',
  73900. '�゙' => '�',
  73901. '�゚' => '�',
  73902. '�゙' => '�',
  73903. '�゚' => '�',
  73904. '�゙' => '�',
  73905. '�゚' => '�',
  73906. '�゙' => '�',
  73907. '�゚' => '�',
  73908. '�゙' => '�',
  73909. '�゚' => '�',
  73910. '�゙' => 'ゔ',
  73911. '�゙' => 'ゞ',
  73912. 'ガ' => 'ガ',
  73913. 'ã‚­ã‚™' => 'ã‚®',
  73914. 'グ' => 'グ',
  73915. 'ゲ' => 'ゲ',
  73916. 'ゴ' => 'ゴ',
  73917. 'ザ' => 'ザ',
  73918. 'ジ' => 'ジ',
  73919. 'ズ' => 'ズ',
  73920. 'ゼ' => 'ゼ',
  73921. 'ゾ' => 'ゾ',
  73922. 'ダ' => 'ダ',
  73923. '�゙' => 'ヂ',
  73924. 'ヅ' => 'ヅ',
  73925. 'デ' => 'デ',
  73926. 'ド' => 'ド',
  73927. '�゙' => '�',
  73928. '�゚' => 'パ',
  73929. 'ビ' => 'ビ',
  73930. 'ピ' => 'ピ',
  73931. 'ブ' => 'ブ',
  73932. 'プ' => 'プ',
  73933. 'ベ' => 'ベ',
  73934. 'ペ' => 'ペ',
  73935. 'ボ' => 'ボ',
  73936. 'ポ' => '�',
  73937. 'ヴ' => 'ヴ',
  73938. 'ヷ' => 'ヷ',
  73939. 'ヸ' => 'ヸ',
  73940. 'ヹ' => 'ヹ',
  73941. 'ヺ' => 'ヺ',
  73942. 'ヾ' => 'ヾ',
  73943. '𑂚' => '𑂚',
  73944. '𑂜' => '𑂜',
  73945. '𑂫' => '𑂫',
  73946. '𑄮' => '𑄮',
  73947. '𑄯' => '𑄯',
  73948. '�𑌾' => '�',
  73949. '��' => '�',
  73950. '𑒻' => '𑒻',
  73951. '𑒼' => '𑒼',
  73952. '𑒾' => '𑒾',
  73953. '𑖺' => '𑖺',
  73954. '𑖻' => '𑖻',
  73955. '𑤸' => '𑤸',
  73956. );
  73957. <?php
  73958. return array (
  73959. 'À' => 'À',
  73960. '�' => 'A�',
  73961. 'Â' => 'Â',
  73962. 'Ã' => 'Ã',
  73963. 'Ä' => 'Ä',
  73964. 'Ã…' => 'AÌŠ',
  73965. 'Ç' => 'Ç',
  73966. 'È' => 'È',
  73967. 'É' => 'E�',
  73968. 'Ê' => 'Ê',
  73969. 'Ë' => 'Ë',
  73970. 'Ì' => 'Ì',
  73971. '�' => 'I�',
  73972. 'ÃŽ' => 'IÌ‚',
  73973. '�' => 'Ï',
  73974. 'Ñ' => 'Ñ',
  73975. 'Ã’' => 'OÌ€',
  73976. 'Ó' => 'O�',
  73977. 'Ô' => 'Ô',
  73978. 'Õ' => 'Õ',
  73979. 'Ö' => 'Ö',
  73980. 'Ù' => 'Ù',
  73981. 'Ú' => 'U�',
  73982. 'Û' => 'Û',
  73983. 'Ü' => 'Ü',
  73984. '�' => 'Y�',
  73985. 'à' => 'à',
  73986. 'á' => 'a�',
  73987. 'â' => 'â',
  73988. 'ã' => 'ã',
  73989. 'ä' => 'ä',
  73990. 'Ã¥' => 'aÌŠ',
  73991. 'ç' => 'ç',
  73992. 'è' => 'è',
  73993. 'é' => 'e�',
  73994. 'ê' => 'ê',
  73995. 'ë' => 'ë',
  73996. 'ì' => 'ì',
  73997. 'í' => 'i�',
  73998. 'î' => 'î',
  73999. 'ï' => 'ï',
  74000. 'ñ' => 'ñ',
  74001. 'ò' => 'ò',
  74002. 'ó' => 'o�',
  74003. 'ô' => 'ô',
  74004. 'õ' => 'õ',
  74005. 'ö' => 'ö',
  74006. 'ù' => 'ù',
  74007. 'ú' => 'u�',
  74008. 'û' => 'û',
  74009. 'ü' => 'ü',
  74010. 'ý' => 'y�',
  74011. 'ÿ' => 'ÿ',
  74012. 'Ä€' => 'AÌ„',
  74013. '�' => 'ā',
  74014. 'Ă' => 'Ă',
  74015. 'ă' => 'ă',
  74016. 'Ą' => 'Ą',
  74017. 'ą' => 'ą',
  74018. 'Ć' => 'C�',
  74019. 'ć' => 'c�',
  74020. 'Ĉ' => 'Ĉ',
  74021. 'ĉ' => 'ĉ',
  74022. 'Ċ' => 'Ċ',
  74023. 'ċ' => 'ċ',
  74024. 'Č' => 'Č',
  74025. '�' => 'č',
  74026. 'Ď' => 'Ď',
  74027. '�' => 'ď',
  74028. 'Ä’' => 'EÌ„',
  74029. 'ē' => 'ē',
  74030. 'Ĕ' => 'Ĕ',
  74031. 'ĕ' => 'ĕ',
  74032. 'Ė' => 'Ė',
  74033. 'ė' => 'ė',
  74034. 'Ę' => 'Ę',
  74035. 'ę' => 'ę',
  74036. 'Ě' => 'Ě',
  74037. 'ě' => 'ě',
  74038. 'Ĝ' => 'Ĝ',
  74039. '�' => 'ĝ',
  74040. 'Ğ' => 'Ğ',
  74041. 'ğ' => 'ğ',
  74042. 'Ġ' => 'Ġ',
  74043. 'ġ' => 'ġ',
  74044. 'Ģ' => 'Ģ',
  74045. 'ģ' => 'ģ',
  74046. 'Ĥ' => 'Ĥ',
  74047. 'ĥ' => 'ĥ',
  74048. 'Ĩ' => 'Ĩ',
  74049. 'ĩ' => 'ĩ',
  74050. 'Ī' => 'Ī',
  74051. 'ī' => 'ī',
  74052. 'Ĭ' => 'Ĭ',
  74053. 'ĭ' => 'ĭ',
  74054. 'Į' => 'Į',
  74055. 'į' => 'į',
  74056. 'İ' => 'İ',
  74057. 'Ä´' => 'JÌ‚',
  74058. 'ĵ' => 'ĵ',
  74059. 'Ķ' => 'Ķ',
  74060. 'ķ' => 'ķ',
  74061. 'Ĺ' => 'L�',
  74062. 'ĺ' => 'l�',
  74063. 'Ļ' => 'Ļ',
  74064. 'ļ' => 'ļ',
  74065. 'Ľ' => 'Ľ',
  74066. 'ľ' => 'ľ',
  74067. 'Ń' => 'N�',
  74068. 'ń' => 'n�',
  74069. 'Ņ' => 'Ņ',
  74070. 'ņ' => 'ņ',
  74071. 'Ň' => 'Ň',
  74072. 'ň' => 'ň',
  74073. 'Ō' => 'Ō',
  74074. '�' => 'ō',
  74075. 'Ŏ' => 'Ŏ',
  74076. '�' => 'ŏ',
  74077. '�' => 'Ő',
  74078. 'ő' => 'ő',
  74079. 'Ŕ' => 'R�',
  74080. 'ŕ' => 'r�',
  74081. 'Ŗ' => 'Ŗ',
  74082. 'ŗ' => 'ŗ',
  74083. 'Ř' => 'Ř',
  74084. 'ř' => 'ř',
  74085. 'Ś' => 'S�',
  74086. 'ś' => 's�',
  74087. 'Ŝ' => 'Ŝ',
  74088. '�' => 'ŝ',
  74089. 'Ş' => 'Ş',
  74090. 'ş' => 'ş',
  74091. 'Š' => 'Š',
  74092. 'š' => 'š',
  74093. 'Ţ' => 'Ţ',
  74094. 'ţ' => 'ţ',
  74095. 'Ť' => 'Ť',
  74096. 'ť' => 'ť',
  74097. 'Ũ' => 'Ũ',
  74098. 'ũ' => 'ũ',
  74099. 'Ū' => 'Ū',
  74100. 'ū' => 'ū',
  74101. 'Ŭ' => 'Ŭ',
  74102. 'ŭ' => 'ŭ',
  74103. 'Å®' => 'UÌŠ',
  74104. 'ů' => 'ů',
  74105. 'Å°' => 'UÌ‹',
  74106. 'ű' => 'ű',
  74107. 'Ų' => 'Ų',
  74108. 'ų' => 'ų',
  74109. 'Å´' => 'WÌ‚',
  74110. 'ŵ' => 'ŵ',
  74111. 'Ŷ' => 'Ŷ',
  74112. 'ŷ' => 'ŷ',
  74113. 'Ÿ' => 'Ÿ',
  74114. 'Ź' => 'Z�',
  74115. 'ź' => 'z�',
  74116. 'Ż' => 'Ż',
  74117. 'ż' => 'ż',
  74118. 'Ž' => 'Ž',
  74119. 'ž' => 'ž',
  74120. 'Æ ' => 'OÌ›',
  74121. 'Æ¡' => 'oÌ›',
  74122. 'Ư' => 'Ư',
  74123. 'Æ°' => 'uÌ›',
  74124. '�' => 'Ǎ',
  74125. 'ǎ' => 'ǎ',
  74126. '�' => 'Ǐ',
  74127. '�' => 'ǐ',
  74128. 'Ǒ' => 'Ǒ',
  74129. 'ǒ' => 'ǒ',
  74130. 'Ǔ' => 'Ǔ',
  74131. 'ǔ' => 'ǔ',
  74132. 'Ǖ' => 'Ǖ',
  74133. 'ǖ' => 'ǖ',
  74134. 'Ǘ' => 'Ü�',
  74135. 'ǘ' => 'ü�',
  74136. 'Ǚ' => 'Ǚ',
  74137. 'ǚ' => 'ǚ',
  74138. 'Ǜ' => 'Ǜ',
  74139. 'ǜ' => 'ǜ',
  74140. 'Ǟ' => 'Ǟ',
  74141. 'ǟ' => 'ǟ',
  74142. 'Ǡ' => 'Ǡ',
  74143. 'ǡ' => 'ǡ',
  74144. 'Ǣ' => 'Ǣ',
  74145. 'ǣ' => 'ǣ',
  74146. 'Ǧ' => 'Ǧ',
  74147. 'ǧ' => 'ǧ',
  74148. 'Ǩ' => 'Ǩ',
  74149. 'ǩ' => 'ǩ',
  74150. 'Ǫ' => 'Ǫ',
  74151. 'ǫ' => 'ǫ',
  74152. 'Ǭ' => 'Ǭ',
  74153. 'ǭ' => 'ǭ',
  74154. 'Ǯ' => 'Ǯ',
  74155. 'ǯ' => 'ǯ',
  74156. 'ǰ' => 'ǰ',
  74157. 'Ǵ' => 'G�',
  74158. 'ǵ' => 'g�',
  74159. 'Ǹ' => 'Ǹ',
  74160. 'ǹ' => 'ǹ',
  74161. 'Ǻ' => 'Å�',
  74162. 'ǻ' => 'å�',
  74163. 'Ǽ' => 'Æ�',
  74164. 'ǽ' => 'æ�',
  74165. 'Ǿ' => 'Ø�',
  74166. 'ǿ' => 'ø�',
  74167. 'Ȁ' => 'A�',
  74168. '�' => 'a�',
  74169. 'È‚' => 'AÌ‘',
  74170. 'ȃ' => 'ȃ',
  74171. 'Ȅ' => 'E�',
  74172. 'ȅ' => 'e�',
  74173. 'Ȇ' => 'Ȇ',
  74174. 'ȇ' => 'ȇ',
  74175. 'Ȉ' => 'I�',
  74176. 'ȉ' => 'i�',
  74177. 'ÈŠ' => 'IÌ‘',
  74178. 'ȋ' => 'ȋ',
  74179. 'Ȍ' => 'O�',
  74180. '�' => 'o�',
  74181. 'ÈŽ' => 'OÌ‘',
  74182. '�' => 'ȏ',
  74183. '�' => 'R�',
  74184. 'ȑ' => 'r�',
  74185. 'È’' => 'RÌ‘',
  74186. 'ȓ' => 'ȓ',
  74187. 'Ȕ' => 'U�',
  74188. 'ȕ' => 'u�',
  74189. 'È–' => 'UÌ‘',
  74190. 'ȗ' => 'ȗ',
  74191. 'Ș' => 'Ș',
  74192. 'ș' => 'ș',
  74193. 'Ț' => 'Ț',
  74194. 'ț' => 'ț',
  74195. 'Ȟ' => 'Ȟ',
  74196. 'ȟ' => 'ȟ',
  74197. 'Ȧ' => 'Ȧ',
  74198. 'ȧ' => 'ȧ',
  74199. 'Ȩ' => 'Ȩ',
  74200. 'ȩ' => 'ȩ',
  74201. 'Ȫ' => 'Ȫ',
  74202. 'ȫ' => 'ȫ',
  74203. 'Ȭ' => 'Ȭ',
  74204. 'ȭ' => 'ȭ',
  74205. 'Ȯ' => 'Ȯ',
  74206. 'ȯ' => 'ȯ',
  74207. 'Ȱ' => 'Ȱ',
  74208. 'ȱ' => 'ȱ',
  74209. 'Ȳ' => 'Ȳ',
  74210. 'ȳ' => 'ȳ',
  74211. 'Í€' => 'Ì€',
  74212. '�' => '�',
  74213. '̓' => '̓',
  74214. '̈́' => '̈�',
  74215. 'ʹ' => 'ʹ',
  74216. ';' => ';',
  74217. '΅' => '¨�',
  74218. 'Ά' => 'Α�',
  74219. '·' => '·',
  74220. 'Έ' => 'Ε�',
  74221. 'Ή' => 'Η�',
  74222. 'Ί' => 'Ι�',
  74223. 'Ό' => 'Ο�',
  74224. 'Ύ' => 'Υ�',
  74225. '�' => 'Ω�',
  74226. '�' => 'ϊ�',
  74227. 'Ϊ' => 'Ϊ',
  74228. 'Ϋ' => 'Ϋ',
  74229. 'ά' => 'α�',
  74230. 'έ' => 'ε�',
  74231. 'ή' => 'η�',
  74232. 'ί' => 'ι�',
  74233. 'ΰ' => 'ϋ�',
  74234. 'ϊ' => 'ϊ',
  74235. 'ϋ' => 'ϋ',
  74236. 'ό' => 'ο�',
  74237. '�' => 'υ�',
  74238. 'ώ' => 'ω�',
  74239. 'ϓ' => 'ϒ�',
  74240. 'ϔ' => 'ϔ',
  74241. 'Ѐ' => 'Ѐ',
  74242. '�' => 'Ё',
  74243. 'Ѓ' => 'Г�',
  74244. 'Ї' => 'Ї',
  74245. 'Ќ' => 'К�',
  74246. '�' => 'Ѝ',
  74247. 'Ў' => 'Ў',
  74248. 'Й' => 'Й',
  74249. 'й' => 'й',
  74250. '�' => 'ѐ',
  74251. 'ё' => 'ё',
  74252. 'ѓ' => 'г�',
  74253. 'ї' => 'ї',
  74254. 'ќ' => 'к�',
  74255. '�' => 'ѝ',
  74256. 'ў' => 'ў',
  74257. 'Ѷ' => 'Ѵ�',
  74258. 'ѷ' => 'ѵ�',
  74259. '�' => 'Ӂ',
  74260. 'ӂ' => 'ӂ',
  74261. '�' => '�̆',
  74262. 'ӑ' => 'ӑ',
  74263. 'Ӓ' => '�̈',
  74264. 'ӓ' => 'ӓ',
  74265. 'Ӗ' => 'Ӗ',
  74266. 'ӗ' => 'ӗ',
  74267. 'Ӛ' => 'Ӛ',
  74268. 'ӛ' => 'ӛ',
  74269. 'Ӝ' => 'Ӝ',
  74270. '�' => 'ӝ',
  74271. 'Ӟ' => 'Ӟ',
  74272. 'ӟ' => 'ӟ',
  74273. 'Ӣ' => 'Ӣ',
  74274. 'ӣ' => 'ӣ',
  74275. 'Ӥ' => 'Ӥ',
  74276. 'ӥ' => 'ӥ',
  74277. 'Ӧ' => 'Ӧ',
  74278. 'ӧ' => 'ӧ',
  74279. 'Ӫ' => 'Ӫ',
  74280. 'ӫ' => 'ӫ',
  74281. 'Ӭ' => 'Ӭ',
  74282. 'ӭ' => '�̈',
  74283. 'Ӯ' => 'Ӯ',
  74284. 'ӯ' => 'ӯ',
  74285. 'Ӱ' => 'Ӱ',
  74286. 'ӱ' => 'ӱ',
  74287. 'Ӳ' => 'Ӳ',
  74288. 'ӳ' => 'ӳ',
  74289. 'Ӵ' => 'Ӵ',
  74290. 'ӵ' => 'ӵ',
  74291. 'Ӹ' => 'Ӹ',
  74292. 'ӹ' => 'ӹ',
  74293. 'آ' => 'آ',
  74294. 'أ' => 'أ',
  74295. 'ؤ' => 'ؤ',
  74296. 'إ' => 'إ',
  74297. 'ئ' => 'ئ',
  74298. 'Û€' => 'Û•Ù”',
  74299. 'Û‚' => 'Û�Ù”',
  74300. 'Û“' => 'Û’Ù”',
  74301. 'ऩ' => 'ऩ',
  74302. 'ऱ' => 'ऱ',
  74303. 'ऴ' => 'ऴ',
  74304. 'क़' => 'क़',
  74305. 'ख़' => 'ख़',
  74306. 'ग़' => 'ग़',
  74307. 'ज़' => 'ज़',
  74308. 'ड़' => 'ड़',
  74309. '�' => 'ढ़',
  74310. 'फ़' => 'फ़',
  74311. 'य़' => 'य़',
  74312. 'ো' => 'ো',
  74313. 'ৌ' => 'ৌ',
  74314. 'ড়' => 'ড়',
  74315. '�' => 'ঢ়',
  74316. 'য়' => 'য়',
  74317. 'ਲ਼' => 'ਲ਼',
  74318. 'ਸ਼' => 'ਸ਼',
  74319. 'ਖ਼' => 'ਖ਼',
  74320. 'ਗ਼' => 'ਗ਼',
  74321. 'ਜ਼' => 'ਜ਼',
  74322. 'ਫ਼' => 'ਫ਼',
  74323. 'ୈ' => 'ୈ',
  74324. 'ୋ' => 'ୋ',
  74325. 'ୌ' => 'ୌ',
  74326. 'ଡ଼' => 'ଡ଼',
  74327. '�' => 'ଢ଼',
  74328. 'ஔ' => 'ஔ',
  74329. 'ொ' => 'ொ',
  74330. 'ோ' => 'ோ',
  74331. 'ௌ' => 'ௌ',
  74332. 'ై' => 'ై',
  74333. 'ೀ' => 'ೀ',
  74334. 'ೇ' => 'ೇ',
  74335. 'ೈ' => 'ೈ',
  74336. 'ೊ' => 'ೊ',
  74337. 'ೋ' => 'ೋ',
  74338. 'ൊ' => 'ൊ',
  74339. 'ോ' => 'ോ',
  74340. 'ൌ' => 'ൌ',
  74341. 'ේ' => 'ේ',
  74342. 'ො' => 'ෙ�',
  74343. '�' => 'ෙ�්',
  74344. 'ෞ' => 'ෞ',
  74345. 'གྷ' => 'གྷ',
  74346. '�' => 'ཌྷ',
  74347. 'དྷ' => 'དྷ',
  74348. 'བྷ' => 'བྷ',
  74349. 'ཛྷ' => 'ཛྷ',
  74350. 'ཀྵ' => 'ཀྵ',
  74351. 'ཱི' => 'ཱི',
  74352. 'ཱུ' => 'ཱུ',
  74353. 'ྲྀ' => 'ྲྀ',
  74354. 'ླྀ' => 'ླྀ',
  74355. '�' => 'ཱྀ',
  74356. 'ྒྷ' => 'ྒྷ',
  74357. '�' => 'ྜྷ',
  74358. 'ྡྷ' => 'ྡྷ',
  74359. 'ྦྷ' => 'ྦྷ',
  74360. 'ྫྷ' => 'ྫྷ',
  74361. 'ྐྵ' => '�ྵ',
  74362. 'ဦ' => 'ဦ',
  74363. 'ᬆ' => 'ᬆ',
  74364. 'ᬈ' => 'ᬈ',
  74365. 'ᬊ' => 'ᬊ',
  74366. 'ᬌ' => 'ᬌ',
  74367. 'ᬎ' => '�ᬵ',
  74368. 'ᬒ' => 'ᬒ',
  74369. 'ᬻ' => 'ᬻ',
  74370. 'ᬽ' => 'ᬽ',
  74371. 'ᭀ' => 'ᭀ',
  74372. '�' => 'ᭁ',
  74373. 'ᭃ' => 'ᭃ',
  74374. 'Ḁ' => 'Ḁ',
  74375. '�' => 'ḁ',
  74376. 'Ḃ' => 'Ḃ',
  74377. 'ḃ' => 'ḃ',
  74378. 'Ḅ' => 'Ḅ',
  74379. 'ḅ' => 'ḅ',
  74380. 'Ḇ' => 'Ḇ',
  74381. 'ḇ' => 'ḇ',
  74382. 'Ḉ' => 'Ç�',
  74383. 'ḉ' => 'ç�',
  74384. 'Ḋ' => 'Ḋ',
  74385. 'ḋ' => 'ḋ',
  74386. 'Ḍ' => 'Ḍ',
  74387. '�' => 'ḍ',
  74388. 'Ḏ' => 'Ḏ',
  74389. '�' => 'ḏ',
  74390. '�' => 'Ḑ',
  74391. 'ḑ' => 'ḑ',
  74392. 'Ḓ' => 'Ḓ',
  74393. 'ḓ' => 'ḓ',
  74394. 'Ḕ' => 'Ḕ',
  74395. 'ḕ' => 'ḕ',
  74396. 'Ḗ' => 'Ē�',
  74397. 'ḗ' => 'ē�',
  74398. 'Ḙ' => 'Ḙ',
  74399. 'ḙ' => 'ḙ',
  74400. 'Ḛ' => 'Ḛ',
  74401. 'ḛ' => 'ḛ',
  74402. 'Ḝ' => 'Ḝ',
  74403. '�' => 'ḝ',
  74404. 'Ḟ' => 'Ḟ',
  74405. 'ḟ' => 'ḟ',
  74406. 'Ḡ' => 'Ḡ',
  74407. 'ḡ' => 'ḡ',
  74408. 'Ḣ' => 'Ḣ',
  74409. 'ḣ' => 'ḣ',
  74410. 'Ḥ' => 'Ḥ',
  74411. 'ḥ' => 'ḥ',
  74412. 'Ḧ' => 'Ḧ',
  74413. 'ḧ' => 'ḧ',
  74414. 'Ḩ' => 'Ḩ',
  74415. 'ḩ' => 'ḩ',
  74416. 'Ḫ' => 'Ḫ',
  74417. 'ḫ' => 'ḫ',
  74418. 'Ḭ' => 'Ḭ',
  74419. 'ḭ' => 'ḭ',
  74420. 'Ḯ' => 'Ï�',
  74421. 'ḯ' => 'ï�',
  74422. 'Ḱ' => 'K�',
  74423. 'ḱ' => 'k�',
  74424. 'Ḳ' => 'Ḳ',
  74425. 'ḳ' => 'ḳ',
  74426. 'Ḵ' => 'Ḵ',
  74427. 'ḵ' => 'ḵ',
  74428. 'Ḷ' => 'Ḷ',
  74429. 'ḷ' => 'ḷ',
  74430. 'Ḹ' => 'Ḹ',
  74431. 'ḹ' => 'ḹ',
  74432. 'Ḻ' => 'Ḻ',
  74433. 'ḻ' => 'ḻ',
  74434. 'Ḽ' => 'Ḽ',
  74435. 'ḽ' => 'ḽ',
  74436. 'Ḿ' => 'M�',
  74437. 'ḿ' => 'm�',
  74438. 'Ṁ' => 'Ṁ',
  74439. '�' => 'ṁ',
  74440. 'Ṃ' => 'Ṃ',
  74441. 'ṃ' => 'ṃ',
  74442. 'Ṅ' => 'Ṅ',
  74443. 'ṅ' => 'ṅ',
  74444. 'Ṇ' => 'Ṇ',
  74445. 'ṇ' => 'ṇ',
  74446. 'Ṉ' => 'Ṉ',
  74447. 'ṉ' => 'ṉ',
  74448. 'Ṋ' => 'Ṋ',
  74449. 'ṋ' => 'ṋ',
  74450. 'Ṍ' => 'Õ�',
  74451. '�' => 'õ�',
  74452. 'Ṏ' => 'Ṏ',
  74453. '�' => 'ṏ',
  74454. '�' => 'Ṑ',
  74455. 'ṑ' => 'ṑ',
  74456. 'Ṓ' => 'Ō�',
  74457. 'ṓ' => 'ō�',
  74458. 'Ṕ' => 'P�',
  74459. 'ṕ' => 'p�',
  74460. 'Ṗ' => 'Ṗ',
  74461. 'ṗ' => 'ṗ',
  74462. 'Ṙ' => 'Ṙ',
  74463. 'ṙ' => 'ṙ',
  74464. 'Ṛ' => 'Ṛ',
  74465. 'ṛ' => 'ṛ',
  74466. 'Ṝ' => 'Ṝ',
  74467. '�' => 'ṝ',
  74468. 'Ṟ' => 'Ṟ',
  74469. 'ṟ' => 'ṟ',
  74470. 'Ṡ' => 'Ṡ',
  74471. 'ṡ' => 'ṡ',
  74472. 'á¹¢' => 'SÌ£',
  74473. 'ṣ' => 'ṣ',
  74474. 'Ṥ' => 'S�̇',
  74475. 'ṥ' => 's�̇',
  74476. 'Ṧ' => 'Ṧ',
  74477. 'ṧ' => 'ṧ',
  74478. 'Ṩ' => 'Ṩ',
  74479. 'ṩ' => 'ṩ',
  74480. 'Ṫ' => 'Ṫ',
  74481. 'ṫ' => 'ṫ',
  74482. 'Ṭ' => 'Ṭ',
  74483. 'ṭ' => 'ṭ',
  74484. 'Ṯ' => 'Ṯ',
  74485. 'ṯ' => 'ṯ',
  74486. 'á¹°' => 'TÌ­',
  74487. 'á¹±' => 'tÌ­',
  74488. 'Ṳ' => 'Ṳ',
  74489. 'ṳ' => 'ṳ',
  74490. 'á¹´' => 'UÌ°',
  74491. 'á¹µ' => 'uÌ°',
  74492. 'Ṷ' => 'Ṷ',
  74493. 'á¹·' => 'uÌ­',
  74494. 'Ṹ' => 'Ũ�',
  74495. 'ṹ' => 'ũ�',
  74496. 'Ṻ' => 'Ṻ',
  74497. 'ṻ' => 'ṻ',
  74498. 'Ṽ' => 'Ṽ',
  74499. 'ṽ' => 'ṽ',
  74500. 'á¹¾' => 'VÌ£',
  74501. 'ṿ' => 'ṿ',
  74502. 'Ẁ' => 'Ẁ',
  74503. '�' => 'ẁ',
  74504. 'Ẃ' => 'W�',
  74505. 'ẃ' => 'w�',
  74506. 'Ẅ' => 'Ẅ',
  74507. 'ẅ' => 'ẅ',
  74508. 'Ẇ' => 'Ẇ',
  74509. 'ẇ' => 'ẇ',
  74510. 'Ẉ' => 'Ẉ',
  74511. 'ẉ' => 'ẉ',
  74512. 'Ẋ' => 'Ẋ',
  74513. 'ẋ' => 'ẋ',
  74514. 'Ẍ' => 'Ẍ',
  74515. '�' => 'ẍ',
  74516. 'Ẏ' => 'Ẏ',
  74517. '�' => 'ẏ',
  74518. '�' => 'Ẑ',
  74519. 'ẑ' => 'ẑ',
  74520. 'Ẓ' => 'Ẓ',
  74521. 'ẓ' => 'ẓ',
  74522. 'Ẕ' => 'Ẕ',
  74523. 'ẕ' => 'ẕ',
  74524. 'ẖ' => 'ẖ',
  74525. 'ẗ' => 'ẗ',
  74526. 'ẘ' => 'ẘ',
  74527. 'ẙ' => 'ẙ',
  74528. 'ẛ' => 'ẛ',
  74529. 'Ạ' => 'Ạ',
  74530. 'ạ' => 'ạ',
  74531. 'Ả' => 'Ả',
  74532. 'ả' => 'ả',
  74533. 'Ấ' => 'Â�',
  74534. 'ấ' => 'â�',
  74535. 'Ầ' => 'Ầ',
  74536. 'ầ' => 'ầ',
  74537. 'Ẩ' => 'Ẩ',
  74538. 'ẩ' => 'ẩ',
  74539. 'Ẫ' => 'Ẫ',
  74540. 'ẫ' => 'ẫ',
  74541. 'Ậ' => 'Ậ',
  74542. 'ậ' => 'ậ',
  74543. 'Ắ' => 'Ă�',
  74544. 'ắ' => 'ă�',
  74545. 'Ằ' => 'Ằ',
  74546. 'ằ' => 'ằ',
  74547. 'Ẳ' => 'Ẳ',
  74548. 'ẳ' => 'ẳ',
  74549. 'Ẵ' => 'Ẵ',
  74550. 'ẵ' => 'ẵ',
  74551. 'Ặ' => 'Ặ',
  74552. 'ặ' => 'ặ',
  74553. 'Ẹ' => 'Ẹ',
  74554. 'ẹ' => 'ẹ',
  74555. 'Ẻ' => 'Ẻ',
  74556. 'ẻ' => 'ẻ',
  74557. 'Ẽ' => 'Ẽ',
  74558. 'ẽ' => 'ẽ',
  74559. 'Ế' => 'Ê�',
  74560. 'ế' => 'ê�',
  74561. 'Ề' => 'Ề',
  74562. '�' => 'ề',
  74563. 'Ể' => 'Ể',
  74564. 'ể' => 'ể',
  74565. 'Ễ' => 'Ễ',
  74566. 'ễ' => 'ễ',
  74567. 'Ệ' => 'Ệ',
  74568. 'ệ' => 'ệ',
  74569. 'Ỉ' => 'Ỉ',
  74570. 'ỉ' => 'ỉ',
  74571. 'Ị' => 'Ị',
  74572. 'ị' => 'ị',
  74573. 'Ọ' => 'Ọ',
  74574. '�' => 'ọ',
  74575. 'Ỏ' => 'Ỏ',
  74576. '�' => 'ỏ',
  74577. '�' => 'Ô�',
  74578. 'ố' => 'ô�',
  74579. 'á»’' => 'OÌ‚Ì€',
  74580. 'ồ' => 'ồ',
  74581. 'Ổ' => 'Ổ',
  74582. 'ổ' => 'ổ',
  74583. 'Ỗ' => 'Ỗ',
  74584. 'ỗ' => 'ỗ',
  74585. 'Ộ' => 'Ộ',
  74586. 'ộ' => 'ộ',
  74587. 'Ớ' => 'Ơ�',
  74588. 'ớ' => 'ơ�',
  74589. 'Ờ' => 'Ờ',
  74590. '�' => 'ờ',
  74591. 'Ở' => 'Ở',
  74592. 'ở' => 'ở',
  74593. 'Ỡ' => 'Ỡ',
  74594. 'ỡ' => 'ỡ',
  74595. 'Ợ' => 'Ợ',
  74596. 'ợ' => 'ợ',
  74597. 'Ụ' => 'Ụ',
  74598. 'ụ' => 'ụ',
  74599. 'Ủ' => 'Ủ',
  74600. 'ủ' => 'ủ',
  74601. 'Ứ' => 'Ư�',
  74602. 'ứ' => 'ư�',
  74603. 'Ừ' => 'Ừ',
  74604. 'ừ' => 'ừ',
  74605. 'Ử' => 'Ử',
  74606. 'ử' => 'ử',
  74607. 'Ữ' => 'Ữ',
  74608. 'ữ' => 'ữ',
  74609. 'Ự' => 'Ự',
  74610. 'ự' => 'ự',
  74611. 'Ỳ' => 'Ỳ',
  74612. 'ỳ' => 'ỳ',
  74613. 'á»´' => 'YÌ£',
  74614. 'ỵ' => 'ỵ',
  74615. 'Ỷ' => 'Ỷ',
  74616. 'ỷ' => 'ỷ',
  74617. 'Ỹ' => 'Ỹ',
  74618. 'ỹ' => 'ỹ',
  74619. 'ἀ' => 'ἀ',
  74620. '�' => 'ἁ',
  74621. 'ἂ' => 'ἂ',
  74622. 'ἃ' => 'ἃ',
  74623. 'ἄ' => 'ἀ�',
  74624. 'ἅ' => 'ἁ�',
  74625. 'ἆ' => 'ἆ',
  74626. 'ἇ' => 'ἇ',
  74627. 'Ἀ' => 'Ἀ',
  74628. 'Ἁ' => 'Ἁ',
  74629. 'Ἂ' => 'Ἂ',
  74630. 'Ἃ' => 'Ἃ',
  74631. 'Ἄ' => 'Ἀ�',
  74632. '�' => 'Ἁ�',
  74633. 'Ἆ' => 'Ἆ',
  74634. '�' => 'Ἇ',
  74635. '�' => 'ἐ',
  74636. 'ἑ' => 'ἑ',
  74637. 'ἒ' => 'ἒ',
  74638. 'ἓ' => 'ἓ',
  74639. 'ἔ' => 'ἐ�',
  74640. 'ἕ' => 'ἑ�',
  74641. 'Ἐ' => 'Ἐ',
  74642. 'Ἑ' => 'Ἑ',
  74643. 'Ἒ' => 'Ἒ',
  74644. 'Ἓ' => 'Ἓ',
  74645. 'Ἔ' => 'Ἐ�',
  74646. '�' => 'Ἑ�',
  74647. 'ἠ' => 'ἠ',
  74648. 'ἡ' => 'ἡ',
  74649. 'ἢ' => 'ἢ',
  74650. 'ἣ' => 'ἣ',
  74651. 'ἤ' => 'ἠ�',
  74652. 'ἥ' => 'ἡ�',
  74653. 'ἦ' => 'ἦ',
  74654. 'ἧ' => 'ἧ',
  74655. 'Ἠ' => 'Ἠ',
  74656. 'Ἡ' => 'Ἡ',
  74657. 'Ἢ' => 'Ἢ',
  74658. 'Ἣ' => 'Ἣ',
  74659. 'Ἤ' => 'Ἠ�',
  74660. 'Ἥ' => 'Ἡ�',
  74661. 'Ἦ' => 'Ἦ',
  74662. 'Ἧ' => 'Ἧ',
  74663. 'ἰ' => 'ἰ',
  74664. 'ἱ' => 'ἱ',
  74665. 'ἲ' => 'ἲ',
  74666. 'ἳ' => 'ἳ',
  74667. 'ἴ' => 'ἰ�',
  74668. 'ἵ' => 'ἱ�',
  74669. 'ἶ' => 'ἶ',
  74670. 'ἷ' => 'ἷ',
  74671. 'Ἰ' => 'Ἰ',
  74672. 'Ἱ' => 'Ἱ',
  74673. 'Ἲ' => 'Ἲ',
  74674. 'Ἳ' => 'Ἳ',
  74675. 'Ἴ' => 'Ἰ�',
  74676. 'Ἵ' => 'Ἱ�',
  74677. 'Ἶ' => 'Ἶ',
  74678. 'Ἷ' => 'Ἷ',
  74679. 'ὀ' => 'ὀ',
  74680. '�' => 'ὁ',
  74681. 'ὂ' => 'ὂ',
  74682. 'ὃ' => 'ὃ',
  74683. 'ὄ' => 'ὀ�',
  74684. 'ὅ' => 'ὁ�',
  74685. 'Ὀ' => 'Ὀ',
  74686. 'Ὁ' => 'Ὁ',
  74687. 'Ὂ' => 'Ὂ',
  74688. 'Ὃ' => 'Ὃ',
  74689. 'Ὄ' => 'Ὀ�',
  74690. '�' => 'Ὁ�',
  74691. '�' => 'ὐ',
  74692. 'ὑ' => 'ὑ',
  74693. 'á½’' => 'Ï…Ì“Ì€',
  74694. 'ὓ' => 'ὓ',
  74695. 'ὔ' => 'ὐ�',
  74696. 'ὕ' => 'ὑ�',
  74697. 'á½–' => 'Ï…Ì“Í‚',
  74698. 'ὗ' => 'ὗ',
  74699. 'Ὑ' => 'Ὑ',
  74700. 'Ὓ' => 'Ὓ',
  74701. '�' => 'Ὑ�',
  74702. 'Ὗ' => 'Ὗ',
  74703. 'ὠ' => 'ὠ',
  74704. 'ὡ' => 'ὡ',
  74705. 'ὢ' => 'ὢ',
  74706. 'ὣ' => 'ὣ',
  74707. 'ὤ' => 'ὠ�',
  74708. 'ὥ' => 'ὡ�',
  74709. 'ὦ' => 'ὦ',
  74710. 'ὧ' => 'ὧ',
  74711. 'Ὠ' => 'Ὠ',
  74712. 'Ὡ' => 'Ὡ',
  74713. 'Ὢ' => 'Ὢ',
  74714. 'Ὣ' => 'Ὣ',
  74715. 'Ὤ' => 'Ὠ�',
  74716. 'Ὥ' => 'Ὡ�',
  74717. 'Ὦ' => 'Ὦ',
  74718. 'Ὧ' => 'Ὧ',
  74719. 'ὰ' => 'ὰ',
  74720. 'ά' => 'α�',
  74721. 'ὲ' => 'ὲ',
  74722. 'έ' => 'ε�',
  74723. 'ὴ' => 'ὴ',
  74724. 'ή' => 'η�',
  74725. 'ὶ' => 'ὶ',
  74726. 'ί' => 'ι�',
  74727. 'ὸ' => 'ὸ',
  74728. 'ό' => 'ο�',
  74729. 'ὺ' => 'ὺ',
  74730. 'ύ' => 'υ�',
  74731. 'ὼ' => 'ὼ',
  74732. 'ώ' => 'ω�',
  74733. 'ᾀ' => 'ᾀ',
  74734. '�' => 'ᾁ',
  74735. 'ᾂ' => 'ᾂ',
  74736. 'ᾃ' => 'ᾃ',
  74737. 'ᾄ' => 'ἀ�ͅ',
  74738. 'ᾅ' => 'ἁ�ͅ',
  74739. 'ᾆ' => 'ᾆ',
  74740. 'ᾇ' => 'ᾇ',
  74741. 'ᾈ' => 'ᾈ',
  74742. 'ᾉ' => 'ᾉ',
  74743. 'ᾊ' => 'ᾊ',
  74744. 'ᾋ' => 'ᾋ',
  74745. 'ᾌ' => 'Ἀ�ͅ',
  74746. '�' => 'Ἁ�ͅ',
  74747. 'ᾎ' => 'ᾎ',
  74748. '�' => 'ᾏ',
  74749. '�' => 'ᾐ',
  74750. 'ᾑ' => 'ᾑ',
  74751. 'ᾒ' => 'ᾒ',
  74752. 'ᾓ' => 'ᾓ',
  74753. 'ᾔ' => 'ἠ�ͅ',
  74754. 'ᾕ' => 'ἡ�ͅ',
  74755. 'ᾖ' => 'ᾖ',
  74756. 'ᾗ' => 'ᾗ',
  74757. 'ᾘ' => 'ᾘ',
  74758. 'ᾙ' => 'ᾙ',
  74759. 'ᾚ' => 'ᾚ',
  74760. 'ᾛ' => 'ᾛ',
  74761. 'ᾜ' => 'Ἠ�ͅ',
  74762. '�' => 'Ἡ�ͅ',
  74763. 'ᾞ' => 'ᾞ',
  74764. 'ᾟ' => 'ᾟ',
  74765. 'ᾠ' => 'ᾠ',
  74766. 'ᾡ' => 'ᾡ',
  74767. 'ᾢ' => 'ᾢ',
  74768. 'ᾣ' => 'ᾣ',
  74769. 'ᾤ' => 'ὠ�ͅ',
  74770. 'ᾥ' => 'ὡ�ͅ',
  74771. 'ᾦ' => 'ᾦ',
  74772. 'ᾧ' => 'ᾧ',
  74773. 'ᾨ' => 'ᾨ',
  74774. 'ᾩ' => 'ᾩ',
  74775. 'ᾪ' => 'ᾪ',
  74776. 'ᾫ' => 'ᾫ',
  74777. 'ᾬ' => 'Ὠ�ͅ',
  74778. 'ᾭ' => 'Ὡ�ͅ',
  74779. 'ᾮ' => 'ᾮ',
  74780. 'ᾯ' => 'ᾯ',
  74781. 'ᾰ' => 'ᾰ',
  74782. 'ᾱ' => 'ᾱ',
  74783. 'ᾲ' => 'ᾲ',
  74784. 'ᾳ' => 'ᾳ',
  74785. 'ᾴ' => 'α�ͅ',
  74786. 'ᾶ' => 'ᾶ',
  74787. 'ᾷ' => 'ᾷ',
  74788. 'Ᾰ' => 'Ᾰ',
  74789. 'Ᾱ' => 'Ᾱ',
  74790. 'Ὰ' => 'Ὰ',
  74791. 'Ά' => 'Α�',
  74792. 'ᾼ' => 'ᾼ',
  74793. 'ι' => 'ι',
  74794. '�' => '῁',
  74795. 'ῂ' => 'ῂ',
  74796. 'ῃ' => 'ῃ',
  74797. 'ῄ' => 'η�ͅ',
  74798. 'ῆ' => 'ῆ',
  74799. 'ῇ' => 'ῇ',
  74800. 'Ὲ' => 'Ὲ',
  74801. 'Έ' => 'Ε�',
  74802. 'Ὴ' => 'Ὴ',
  74803. 'Ή' => 'Η�',
  74804. 'ῌ' => 'ῌ',
  74805. '�' => '῍',
  74806. '῎' => '᾿�',
  74807. '�' => '῏',
  74808. '�' => 'ῐ',
  74809. 'ῑ' => 'ῑ',
  74810. 'ῒ' => 'ῒ',
  74811. 'ΐ' => 'ϊ�',
  74812. 'ῖ' => 'ῖ',
  74813. 'ῗ' => 'ῗ',
  74814. 'Ῐ' => 'Ῐ',
  74815. 'Ῑ' => 'Ῑ',
  74816. 'Ὶ' => 'Ὶ',
  74817. 'Ί' => 'Ι�',
  74818. '�' => '῝',
  74819. '῞' => '῾�',
  74820. '῟' => '῟',
  74821. 'ῠ' => 'ῠ',
  74822. 'á¿¡' => 'Ï…Ì„',
  74823. 'ῢ' => 'ῢ',
  74824. 'ΰ' => 'ϋ�',
  74825. 'ῤ' => '�̓',
  74826. 'ῥ' => '�̔',
  74827. 'ῦ' => 'ῦ',
  74828. 'ῧ' => 'ῧ',
  74829. 'Ῠ' => 'Ῠ',
  74830. 'Ῡ' => 'Ῡ',
  74831. 'Ὺ' => 'Ὺ',
  74832. 'Ύ' => 'Υ�',
  74833. 'Ῥ' => 'Ῥ',
  74834. '῭' => '῭',
  74835. '΅' => '¨�',
  74836. '`' => '`',
  74837. 'ῲ' => 'ῲ',
  74838. 'ῳ' => 'ῳ',
  74839. 'ῴ' => 'ω�ͅ',
  74840. 'ῶ' => 'ῶ',
  74841. 'ῷ' => 'ῷ',
  74842. 'Ὸ' => 'Ὸ',
  74843. 'Ό' => 'Ο�',
  74844. 'Ὼ' => 'Ὼ',
  74845. 'Ώ' => 'Ω�',
  74846. 'ῼ' => 'ῼ',
  74847. '´' => '´',
  74848. ' ' => ' ',
  74849. '�' => ' ',
  74850. 'Ω' => 'Ω',
  74851. 'K' => 'K',
  74852. 'â„«' => 'AÌŠ',
  74853. '↚' => '�̸',
  74854. '↛' => '↛',
  74855. '↮' => '↮',
  74856. '�' => '�̸',
  74857. '⇎' => '⇎',
  74858. '�' => '⇏',
  74859. '∄' => '∄',
  74860. '∉' => '∉',
  74861. '∌' => '∌',
  74862. '∤' => '∤',
  74863. '∦' => '∦',
  74864. '�' => '≁',
  74865. '≄' => '≄',
  74866. '≇' => '≇',
  74867. '≉' => '≉',
  74868. '≠' => '≠',
  74869. '≢' => '≢',
  74870. '≭' => '�̸',
  74871. '≮' => '≮',
  74872. '≯' => '≯',
  74873. '≰' => '≰',
  74874. '≱' => '≱',
  74875. '≴' => '≴',
  74876. '≵' => '≵',
  74877. '≸' => '≸',
  74878. '≹' => '≹',
  74879. '⊀' => '⊀',
  74880. '�' => '⊁',
  74881. '⊄' => '⊄',
  74882. '⊅' => '⊅',
  74883. '⊈' => '⊈',
  74884. '⊉' => '⊉',
  74885. '⊬' => '⊬',
  74886. '⊭' => '⊭',
  74887. '⊮' => '⊮',
  74888. '⊯' => '⊯',
  74889. '⋠' => '⋠',
  74890. '⋡' => '⋡',
  74891. '⋢' => '⋢',
  74892. '⋣' => '⋣',
  74893. '⋪' => '⋪',
  74894. '⋫' => '⋫',
  74895. '⋬' => '⋬',
  74896. '⋭' => '⋭',
  74897. '〈' => '〈',
  74898. '〉' => '〉',
  74899. '⫝̸' => '�̸',
  74900. '�' => '�゙',
  74901. '�' => '�゙',
  74902. '�' => '�゙',
  74903. '�' => '�゙',
  74904. '�' => '�゙',
  74905. '�' => '�゙',
  74906. '�' => '�゙',
  74907. '�' => '�゙',
  74908. '�' => '�゙',
  74909. '�' => '�゙',
  74910. '�' => '�゙',
  74911. '�' => '�゙',
  74912. '�' => '�゙',
  74913. '�' => '�゙',
  74914. '�' => '�゙',
  74915. '�' => '�゙',
  74916. '�' => '�゚',
  74917. '�' => '�゙',
  74918. '�' => '�゚',
  74919. '�' => '�゙',
  74920. '�' => '�゚',
  74921. '�' => '�゙',
  74922. '�' => '�゚',
  74923. '�' => '�゙',
  74924. '�' => '�゚',
  74925. 'ゔ' => '�゙',
  74926. 'ゞ' => '�゙',
  74927. 'ガ' => 'ガ',
  74928. 'ã‚®' => 'ã‚­ã‚™',
  74929. 'グ' => 'グ',
  74930. 'ゲ' => 'ゲ',
  74931. 'ゴ' => 'ゴ',
  74932. 'ザ' => 'ザ',
  74933. 'ジ' => 'ジ',
  74934. 'ズ' => 'ズ',
  74935. 'ゼ' => 'ゼ',
  74936. 'ゾ' => 'ゾ',
  74937. 'ダ' => 'ダ',
  74938. 'ヂ' => '�゙',
  74939. 'ヅ' => 'ヅ',
  74940. 'デ' => 'デ',
  74941. 'ド' => 'ド',
  74942. '�' => '�゙',
  74943. 'パ' => '�゚',
  74944. 'ビ' => 'ビ',
  74945. 'ピ' => 'ピ',
  74946. 'ブ' => 'ブ',
  74947. 'プ' => 'プ',
  74948. 'ベ' => 'ベ',
  74949. 'ペ' => 'ペ',
  74950. 'ボ' => 'ボ',
  74951. '�' => 'ポ',
  74952. 'ヴ' => 'ヴ',
  74953. 'ヷ' => 'ヷ',
  74954. 'ヸ' => 'ヸ',
  74955. 'ヹ' => 'ヹ',
  74956. 'ヺ' => 'ヺ',
  74957. 'ヾ' => 'ヾ',
  74958. '豈' => '豈',
  74959. '�' => '更',
  74960. '車' => '車',
  74961. '賈' => '賈',
  74962. '滑' => '滑',
  74963. '串' => '串',
  74964. '句' => '�',
  74965. '龜' => '龜',
  74966. '龜' => '龜',
  74967. '契' => '契',
  74968. '金' => '金',
  74969. '喇' => '喇',
  74970. '奈' => '奈',
  74971. '�' => '懶',
  74972. '癩' => '癩',
  74973. '�' => '羅',
  74974. '�' => '蘿',
  74975. '螺' => '螺',
  74976. '裸' => '裸',
  74977. '邏' => '�',
  74978. '樂' => '樂',
  74979. '洛' => '洛',
  74980. '烙' => '烙',
  74981. '珞' => '�',
  74982. '落' => '�',
  74983. '酪' => '酪',
  74984. '駱' => '駱',
  74985. '亂' => '亂',
  74986. '卵' => '�',
  74987. '�' => '欄',
  74988. '爛' => '爛',
  74989. '蘭' => '蘭',
  74990. '鸞' => '鸞',
  74991. '嵐' => '�',
  74992. '濫' => '濫',
  74993. '藍' => '�',
  74994. '襤' => '襤',
  74995. '拉' => '拉',
  74996. '臘' => '臘',
  74997. '蠟' => '蠟',
  74998. '廊' => '廊',
  74999. '朗' => '朗',
  75000. '浪' => '浪',
  75001. '狼' => '狼',
  75002. '郎' => '郎',
  75003. '來' => '來',
  75004. '冷' => '冷',
  75005. '勞' => '勞',
  75006. '擄' => '擄',
  75007. '櫓' => '櫓',
  75008. '爐' => '�',
  75009. '盧' => '盧',
  75010. '老' => '�',
  75011. '蘆' => '蘆',
  75012. '虜' => '虜',
  75013. '路' => '路',
  75014. '露' => '露',
  75015. '魯' => '魯',
  75016. '鷺' => '鷺',
  75017. '碌' => '碌',
  75018. '祿' => '祿',
  75019. '綠' => '綠',
  75020. '菉' => '�',
  75021. '錄' => '錄',
  75022. '鹿' => '鹿',
  75023. '�' => '論',
  75024. '壟' => '壟',
  75025. '弄' => '弄',
  75026. '籠' => '籠',
  75027. '聾' => '�',
  75028. '牢' => '牢',
  75029. '磊' => '磊',
  75030. '賂' => '賂',
  75031. '雷' => '雷',
  75032. '壘' => '壘',
  75033. '屢' => '屢',
  75034. '樓' => '樓',
  75035. '�' => '淚',
  75036. '漏' => '�',
  75037. '�' => '累',
  75038. '�' => '縷',
  75039. '陋' => '陋',
  75040. '勒' => '勒',
  75041. '肋' => '肋',
  75042. '凜' => '凜',
  75043. '凌' => '凌',
  75044. '稜' => '稜',
  75045. '綾' => '綾',
  75046. '菱' => '�',
  75047. '陵' => '陵',
  75048. '讀' => '讀',
  75049. '拏' => '�',
  75050. '樂' => '樂',
  75051. '�' => '諾',
  75052. '丹' => '丹',
  75053. '寧' => '寧',
  75054. '怒' => '怒',
  75055. '率' => '率',
  75056. '異' => '異',
  75057. '北' => '北',
  75058. '磻' => '磻',
  75059. '便' => '便',
  75060. '復' => '復',
  75061. '不' => '�',
  75062. '泌' => '泌',
  75063. '數' => '數',
  75064. '索' => '索',
  75065. '參' => '�',
  75066. '塞' => '塞',
  75067. '省' => '�',
  75068. '葉' => '葉',
  75069. '說' => '說',
  75070. '殺' => '殺',
  75071. '辰' => '辰',
  75072. '沈' => '沈',
  75073. '拾' => '拾',
  75074. '若' => '若',
  75075. '掠' => '掠',
  75076. '略' => '略',
  75077. '亮' => '亮',
  75078. '兩' => '兩',
  75079. '凉' => '凉',
  75080. '梁' => '�',
  75081. '糧' => '糧',
  75082. '良' => '良',
  75083. '諒' => '諒',
  75084. '量' => '�',
  75085. '勵' => '勵',
  75086. '呂' => '呂',
  75087. '�' => '女',
  75088. '廬' => '廬',
  75089. '旅' => '旅',
  75090. '濾' => '濾',
  75091. '礪' => '礪',
  75092. '閭' => '閭',
  75093. '驪' => '驪',
  75094. '麗' => '麗',
  75095. '黎' => '黎',
  75096. '力' => '力',
  75097. '曆' => '曆',
  75098. '歷' => '歷',
  75099. '�' => '轢',
  75100. '年' => '年',
  75101. '�' => '�',
  75102. '�' => '戀',
  75103. '撚' => '撚',
  75104. '漣' => '漣',
  75105. '煉' => '煉',
  75106. '璉' => '璉',
  75107. '秊' => '秊',
  75108. '練' => '練',
  75109. '聯' => '�',
  75110. '輦' => '輦',
  75111. '蓮' => '蓮',
  75112. '連' => '連',
  75113. '鍊' => '�',
  75114. '列' => '列',
  75115. '�' => '劣',
  75116. '咽' => '咽',
  75117. '烈' => '烈',
  75118. '裂' => '裂',
  75119. '說' => '說',
  75120. '廉' => '廉',
  75121. '念' => '念',
  75122. '捻' => '�',
  75123. '殮' => '殮',
  75124. '簾' => '簾',
  75125. '獵' => '�',
  75126. '令' => '令',
  75127. '囹' => '囹',
  75128. '寧' => '寧',
  75129. '嶺' => '嶺',
  75130. '怜' => '怜',
  75131. '玲' => '玲',
  75132. '瑩' => '瑩',
  75133. '羚' => '羚',
  75134. '聆' => '�',
  75135. '鈴' => '鈴',
  75136. '零' => '零',
  75137. '靈' => '�',
  75138. '領' => '領',
  75139. '例' => '例',
  75140. '禮' => '禮',
  75141. '醴' => '醴',
  75142. '隸' => '隸',
  75143. '惡' => '惡',
  75144. '了' => '了',
  75145. '僚' => '僚',
  75146. '寮' => '寮',
  75147. '尿' => '尿',
  75148. '料' => '料',
  75149. '樂' => '樂',
  75150. '燎' => '燎',
  75151. '�' => '療',
  75152. '蓼' => '蓼',
  75153. '遼' => '�',
  75154. '龍' => '�',
  75155. '暈' => '暈',
  75156. '阮' => '阮',
  75157. '劉' => '劉',
  75158. '杻' => '�',
  75159. '柳' => '柳',
  75160. '流' => '�',
  75161. '溜' => '溜',
  75162. '琉' => '�',
  75163. '�' => '留',
  75164. '硫' => '硫',
  75165. '�' => '�',
  75166. '�' => '類',
  75167. '六' => '六',
  75168. '戮' => '戮',
  75169. '陸' => '陸',
  75170. '倫' => '倫',
  75171. '崙' => '崙',
  75172. '淪' => '淪',
  75173. '輪' => '輪',
  75174. '律' => '律',
  75175. '慄' => '慄',
  75176. '栗' => '栗',
  75177. '率' => '率',
  75178. '隆' => '隆',
  75179. '�' => '利',
  75180. '吏' => '�',
  75181. '履' => '履',
  75182. '易' => '易',
  75183. '李' => '�',
  75184. '梨' => '梨',
  75185. '泥' => '泥',
  75186. '理' => '�',
  75187. '痢' => '痢',
  75188. '罹' => '罹',
  75189. '裏' => '�',
  75190. '裡' => '裡',
  75191. '里' => '里',
  75192. '離' => '離',
  75193. '匿' => '匿',
  75194. '溺' => '溺',
  75195. '吝' => '�',
  75196. '燐' => '�',
  75197. '璘' => '璘',
  75198. '藺' => '藺',
  75199. '隣' => '隣',
  75200. '鱗' => '鱗',
  75201. '麟' => '麟',
  75202. '林' => '林',
  75203. '淋' => '淋',
  75204. '臨' => '臨',
  75205. '立' => '立',
  75206. '笠' => '笠',
  75207. '粒' => '粒',
  75208. '狀' => '狀',
  75209. '炙' => '炙',
  75210. '識' => '識',
  75211. '什' => '什',
  75212. '茶' => '茶',
  75213. '刺' => '刺',
  75214. '切' => '切',
  75215. '�' => '度',
  75216. '拓' => '拓',
  75217. '糖' => '糖',
  75218. '宅' => '宅',
  75219. '洞' => '洞',
  75220. '暴' => '暴',
  75221. '輻' => '輻',
  75222. '行' => '行',
  75223. '降' => '�',
  75224. '見' => '見',
  75225. '廓' => '廓',
  75226. '兀' => '兀',
  75227. '�' => '嗀',
  75228. '�' => '塚',
  75229. '晴' => '晴',
  75230. '凞' => '凞',
  75231. '猪' => '猪',
  75232. '益' => '益',
  75233. '礼' => '礼',
  75234. '神' => '神',
  75235. '祥' => '祥',
  75236. '福' => '�',
  75237. '靖' => '�',
  75238. '�' => '精',
  75239. '羽' => '羽',
  75240. '蘒' => '蘒',
  75241. '諸' => '諸',
  75242. '逸' => '逸',
  75243. '都' => '都',
  75244. '飯' => '飯',
  75245. '飼' => '飼',
  75246. '館' => '館',
  75247. '鶴' => '鶴',
  75248. '郞' => '郞',
  75249. '隷' => '隷',
  75250. '侮' => '侮',
  75251. '僧' => '僧',
  75252. '免' => '�',
  75253. '勉' => '勉',
  75254. '勤' => '勤',
  75255. '卑' => '�',
  75256. '喝' => '�',
  75257. '嘆' => '嘆',
  75258. '器' => '器',
  75259. '塀' => '塀',
  75260. '墨' => '墨',
  75261. '層' => '層',
  75262. '屮' => '屮',
  75263. '悔' => '悔',
  75264. '慨' => '慨',
  75265. '憎' => '憎',
  75266. '懲' => '懲',
  75267. '�' => '�',
  75268. 'ï©‚' => 'æ—¢',
  75269. '暑' => '暑',
  75270. '梅' => '梅',
  75271. 'ï©…' => 'æµ·',
  75272. '渚' => '渚',
  75273. '漢' => '漢',
  75274. '煮' => '煮',
  75275. '爫' => '爫',
  75276. '琢' => '�',
  75277. '碑' => '碑',
  75278. '社' => '社',
  75279. '�' => '祉',
  75280. '祈' => '祈',
  75281. '�' => '�',
  75282. '�' => '祖',
  75283. '祝' => '�',
  75284. '禍' => '�',
  75285. '禎' => '禎',
  75286. 'ï©”' => 'ç©€',
  75287. '突' => '�',
  75288. '節' => '節',
  75289. 'ï©—' => 'ç·´',
  75290. '縉' => '縉',
  75291. '繁' => '�',
  75292. 'ï©š' => 'ç½²',
  75293. '者' => '者',
  75294. '臭' => '臭',
  75295. '�' => '艹',
  75296. '艹' => '艹',
  75297. 'ï©Ÿ' => 'è‘—',
  75298. '褐' => '�',
  75299. '視' => '視',
  75300. '謁' => '�',
  75301. '謹' => '謹',
  75302. '賓' => '賓',
  75303. 'ï©¥' => 'è´ˆ',
  75304. '辶' => '辶',
  75305. '逸' => '逸',
  75306. '難' => '難',
  75307. '響' => '響',
  75308. '頻' => '頻',
  75309. '恵' => '�',
  75310. '𤋮' => '𤋮',
  75311. '舘' => '舘',
  75312. '並' => '並',
  75313. '况' => '况',
  75314. '全' => '全',
  75315. '侀' => '侀',
  75316. 'ï©´' => 'å……',
  75317. '冀' => '冀',
  75318. '勇' => '勇',
  75319. '勺' => '勺',
  75320. '喝' => '�',
  75321. '啕' => '啕',
  75322. '喙' => '喙',
  75323. 'ï©»' => 'å—¢',
  75324. '塚' => '塚',
  75325. '墳' => '墳',
  75326. '奄' => '奄',
  75327. '奔' => '奔',
  75328. '婢' => '婢',
  75329. '�' => '嬨',
  75330. '廒' => '廒',
  75331. '廙' => '廙',
  75332. '彩' => '彩',
  75333. '徭' => '徭',
  75334. '惘' => '惘',
  75335. '慎' => '慎',
  75336. '愈' => '愈',
  75337. '憎' => '憎',
  75338. '慠' => '慠',
  75339. '懲' => '懲',
  75340. '戴' => '戴',
  75341. '�' => '�',
  75342. '搜' => '�',
  75343. '�' => '摒',
  75344. '�' => '敖',
  75345. '晴' => '晴',
  75346. '朗' => '朗',
  75347. '望' => '望',
  75348. '杖' => '�',
  75349. '歹' => '歹',
  75350. '殺' => '殺',
  75351. '流' => '�',
  75352. '滛' => '滛',
  75353. '滋' => '滋',
  75354. '漢' => '漢',
  75355. '瀞' => '瀞',
  75356. '煮' => '煮',
  75357. '�' => '瞧',
  75358. '爵' => '爵',
  75359. '犯' => '犯',
  75360. '猪' => '猪',
  75361. '瑱' => '瑱',
  75362. '甆' => '甆',
  75363. '画' => '画',
  75364. '瘝' => '�',
  75365. '瘟' => '瘟',
  75366. '益' => '益',
  75367. '盛' => '盛',
  75368. '直' => '直',
  75369. '睊' => '�',
  75370. '着' => '�',
  75371. '磌' => '磌',
  75372. '窱' => '窱',
  75373. '節' => '節',
  75374. '类' => '类',
  75375. '絛' => '絛',
  75376. '練' => '練',
  75377. '缾' => '缾',
  75378. '者' => '者',
  75379. '荒' => '�',
  75380. '華' => '�',
  75381. '蝹' => '�',
  75382. '襁' => '�',
  75383. '覆' => '覆',
  75384. '視' => '視',
  75385. '調' => '調',
  75386. '諸' => '諸',
  75387. '請' => '請',
  75388. '謁' => '�',
  75389. '諾' => '諾',
  75390. '諭' => '諭',
  75391. '謹' => '謹',
  75392. '變' => '變',
  75393. '�' => '贈',
  75394. '輸' => '輸',
  75395. '遲' => '�',
  75396. '醙' => '醙',
  75397. '鉶' => '鉶',
  75398. '陼' => '陼',
  75399. '難' => '難',
  75400. '靖' => '�',
  75401. '韛' => '韛',
  75402. '響' => '響',
  75403. 'ï«‹' => 'é ‹',
  75404. '頻' => '頻',
  75405. '�' => '鬒',
  75406. '龜' => '龜',
  75407. '�' => '𢡊',
  75408. '�' => '𢡄',
  75409. '𣏕' => '�',
  75410. '㮝' => '�',
  75411. '䀘' => '䀘',
  75412. '䀹' => '䀹',
  75413. '𥉉' => '𥉉',
  75414. '𥳐' => '�',
  75415. '𧻓' => '𧻓',
  75416. '齃' => '齃',
  75417. '龎' => '龎',
  75418. '�' => 'יִ',
  75419. 'ײַ' => 'ײַ',
  75420. 'שׁ' => 'ש�',
  75421. 'שׂ' => 'שׂ',
  75422. 'שּׁ' => 'שּ�',
  75423. 'שּׂ' => 'שּׂ',
  75424. 'אַ' => '�ַ',
  75425. 'אָ' => '�ָ',
  75426. 'אּ' => '�ּ',
  75427. 'בּ' => 'בּ',
  75428. 'גּ' => 'גּ',
  75429. 'דּ' => 'דּ',
  75430. 'הּ' => 'הּ',
  75431. 'וּ' => 'וּ',
  75432. 'זּ' => 'זּ',
  75433. 'טּ' => 'טּ',
  75434. 'יּ' => 'יּ',
  75435. 'ךּ' => 'ךּ',
  75436. 'כּ' => 'כּ',
  75437. 'לּ' => 'לּ',
  75438. 'מּ' => 'מּ',
  75439. 'ï­€' => '× Ö¼',
  75440. '�' => 'סּ',
  75441. 'ï­ƒ' => '×£Ö¼',
  75442. 'פּ' => 'פּ',
  75443. 'צּ' => 'צּ',
  75444. 'קּ' => 'קּ',
  75445. 'רּ' => 'רּ',
  75446. 'שּ' => 'שּ',
  75447. 'תּ' => 'תּ',
  75448. 'וֹ' => 'וֹ',
  75449. 'בֿ' => 'בֿ',
  75450. 'ï­�' => '×›Ö¿',
  75451. 'פֿ' => 'פֿ',
  75452. '𑂚' => '𑂚',
  75453. '𑂜' => '𑂜',
  75454. '𑂫' => '𑂫',
  75455. '𑄮' => '𑄮',
  75456. '𑄯' => '𑄯',
  75457. '�' => '�𑌾',
  75458. '�' => '��',
  75459. '𑒻' => '𑒻',
  75460. '𑒼' => '𑒼',
  75461. '𑒾' => '𑒾',
  75462. '𑖺' => '𑖺',
  75463. '𑖻' => '𑖻',
  75464. '𑤸' => '𑤸',
  75465. '�' => '��',
  75466. '�' => '��',
  75467. '�' => '���',
  75468. '�' => '���',
  75469. '�' => '���',
  75470. '�' => '���',
  75471. '�' => '���',
  75472. '�' => '��',
  75473. '�' => '��',
  75474. '�' => '���',
  75475. '�' => '���',
  75476. '�' => '���',
  75477. '�' => '���',
  75478. '丽' => '丽',
  75479. '�' => '丸',
  75480. '乁' => '�',
  75481. '𠄢' => '𠄢',
  75482. '你' => '你',
  75483. '侮' => '侮',
  75484. '侻' => '侻',
  75485. '倂' => '倂',
  75486. '偺' => '�',
  75487. '備' => '備',
  75488. '僧' => '僧',
  75489. '像' => '�',
  75490. '㒞' => '㒞',
  75491. '�' => '𠘺',
  75492. '免' => '�',
  75493. '�' => '兔',
  75494. '�' => '兤',
  75495. '具' => '具',
  75496. '𠔜' => '𠔜',
  75497. '㒹' => '㒹',
  75498. '內' => '內',
  75499. '再' => '�',
  75500. '𠕋' => '𠕋',
  75501. '冗' => '冗',
  75502. '冤' => '冤',
  75503. '仌' => '仌',
  75504. '冬' => '冬',
  75505. '况' => '况',
  75506. '𩇟' => '𩇟',
  75507. '�' => '凵',
  75508. '刃' => '刃',
  75509. '㓟' => '㓟',
  75510. '刻' => '刻',
  75511. '剆' => '剆',
  75512. '割' => '割',
  75513. '剷' => '剷',
  75514. '㔕' => '㔕',
  75515. '勇' => '勇',
  75516. '勉' => '勉',
  75517. '勤' => '勤',
  75518. '勺' => '勺',
  75519. '包' => '包',
  75520. '匆' => '匆',
  75521. '北' => '北',
  75522. '卉' => '�',
  75523. '卑' => '�',
  75524. '博' => '�',
  75525. '即' => '�',
  75526. '卽' => '�',
  75527. '卿' => '�',
  75528. '卿' => '�',
  75529. '卿' => '�',
  75530. '𠨬' => '𠨬',
  75531. '灰' => '�',
  75532. '及' => '�',
  75533. '叟' => '�',
  75534. '𠭣' => '𠭣',
  75535. '叫' => '�',
  75536. '叱' => '�',
  75537. '吆' => '�',
  75538. '咞' => '咞',
  75539. '吸' => '�',
  75540. '呈' => '呈',
  75541. '周' => '周',
  75542. '咢' => '咢',
  75543. '�' => '哶',
  75544. '唐' => '�',
  75545. '啓' => '啓',
  75546. '啣' => '啣',
  75547. '善' => '善',
  75548. '善' => '善',
  75549. '喙' => '喙',
  75550. '喫' => '喫',
  75551. '喳' => '喳',
  75552. '嗂' => '嗂',
  75553. '圖' => '圖',
  75554. '嘆' => '嘆',
  75555. '�' => '圗',
  75556. '噑' => '噑',
  75557. '�' => '噴',
  75558. '�' => '切',
  75559. '壮' => '壮',
  75560. '城' => '城',
  75561. '埴' => '埴',
  75562. '堍' => '�',
  75563. '型' => '型',
  75564. '堲' => '堲',
  75565. '報' => '報',
  75566. '墬' => '墬',
  75567. '𡓤' => '𡓤',
  75568. '売' => '売',
  75569. '壷' => '壷',
  75570. '夆' => '夆',
  75571. '�' => '多',
  75572. '夢' => '夢',
  75573. '奢' => '奢',
  75574. '𡚨' => '𡚨',
  75575. '𡛪' => '𡛪',
  75576. '姬' => '姬',
  75577. '娛' => '娛',
  75578. '娧' => '娧',
  75579. '姘' => '姘',
  75580. '婦' => '婦',
  75581. '㛮' => '㛮',
  75582. '㛼' => '㛼',
  75583. '嬈' => '嬈',
  75584. '嬾' => '嬾',
  75585. '嬾' => '嬾',
  75586. '𡧈' => '𡧈',
  75587. '寃' => '寃',
  75588. '寘' => '寘',
  75589. '寧' => '寧',
  75590. '寳' => '寳',
  75591. '𡬘' => '𡬘',
  75592. '寿' => '寿',
  75593. '将' => '将',
  75594. '当' => '当',
  75595. '尢' => '尢',
  75596. '㞁' => '�',
  75597. '屠' => '屠',
  75598. '屮' => '屮',
  75599. '峀' => '峀',
  75600. '岍' => '�',
  75601. '𡷤' => '𡷤',
  75602. '嵃' => '嵃',
  75603. '𡷦' => '𡷦',
  75604. '嵮' => '嵮',
  75605. '嵫' => '嵫',
  75606. '嵼' => '嵼',
  75607. '�' => '巡',
  75608. '巢' => '巢',
  75609. '㠯' => '㠯',
  75610. '巽' => '巽',
  75611. '帨' => '帨',
  75612. '帽' => '帽',
  75613. '幩' => '幩',
  75614. '㡢' => '㡢',
  75615. '𢆃' => '𢆃',
  75616. '㡼' => '㡼',
  75617. '庰' => '庰',
  75618. '庳' => '庳',
  75619. '�' => '庶',
  75620. '廊' => '廊',
  75621. '�' => '𪎒',
  75622. '�' => '廾',
  75623. '𢌱' => '𢌱',
  75624. '𢌱' => '𢌱',
  75625. '舁' => '�',
  75626. '弢' => '弢',
  75627. '弢' => '弢',
  75628. '㣇' => '㣇',
  75629. '𣊸' => '𣊸',
  75630. '𦇚' => '𦇚',
  75631. '形' => '形',
  75632. '彫' => '彫',
  75633. '㣣' => '㣣',
  75634. '徚' => '徚',
  75635. '�' => '�',
  75636. '志' => '志',
  75637. '忹' => '忹',
  75638. '悁' => '�',
  75639. '㤺' => '㤺',
  75640. '㤜' => '㤜',
  75641. '悔' => '悔',
  75642. '𢛔' => '𢛔',
  75643. '惇' => '惇',
  75644. '慈' => '慈',
  75645. '慌' => '慌',
  75646. '慎' => '慎',
  75647. '慌' => '慌',
  75648. '慺' => '慺',
  75649. '憎' => '憎',
  75650. '憲' => '憲',
  75651. '憤' => '憤',
  75652. '憯' => '憯',
  75653. '懞' => '懞',
  75654. '懲' => '懲',
  75655. '懶' => '懶',
  75656. '成' => '�',
  75657. '戛' => '戛',
  75658. '扝' => '�',
  75659. '抱' => '抱',
  75660. '拔' => '拔',
  75661. '捐' => '�',
  75662. '𢬌' => '𢬌',
  75663. '挽' => '挽',
  75664. '拼' => '拼',
  75665. '捨' => '�',
  75666. '掃' => '掃',
  75667. '揤' => '�',
  75668. '𢯱' => '𢯱',
  75669. '搢' => '�',
  75670. '揅' => '�',
  75671. '�' => '掩',
  75672. '㨮' => '㨮',
  75673. '摩' => '摩',
  75674. '摾' => '摾',
  75675. '撝' => '�',
  75676. '摷' => '摷',
  75677. '㩬' => '㩬',
  75678. '敏' => '�',
  75679. '敬' => '敬',
  75680. '𣀊' => '𣀊',
  75681. '旣' => '旣',
  75682. '書' => '書',
  75683. '�' => '晉',
  75684. '㬙' => '㬙',
  75685. '�' => '暑',
  75686. '�' => '㬈',
  75687. '㫤' => '㫤',
  75688. '冒' => '冒',
  75689. '冕' => '冕',
  75690. '最' => '最',
  75691. '暜' => '暜',
  75692. '肭' => '肭',
  75693. '䏙' => '�',
  75694. '朗' => '朗',
  75695. '望' => '望',
  75696. '朡' => '朡',
  75697. '杞' => '�',
  75698. '杓' => '�',
  75699. '�' => '�',
  75700. '㭉' => '㭉',
  75701. '柺' => '柺',
  75702. '枅' => '枅',
  75703. '桒' => '桒',
  75704. '梅' => '梅',
  75705. '𣑭' => '𣑭',
  75706. '梎' => '梎',
  75707. '栟' => '栟',
  75708. '椔' => '椔',
  75709. '㮝' => '�',
  75710. '楂' => '楂',
  75711. '榣' => '榣',
  75712. '槪' => '槪',
  75713. '檨' => '檨',
  75714. '𣚣' => '𣚣',
  75715. '櫛' => '櫛',
  75716. '㰘' => '㰘',
  75717. '次' => '次',
  75718. '𣢧' => '𣢧',
  75719. '歔' => '歔',
  75720. '㱎' => '㱎',
  75721. '歲' => '歲',
  75722. '殟' => '殟',
  75723. '殺' => '殺',
  75724. '殻' => '殻',
  75725. '𣪍' => '�',
  75726. '𡴋' => '𡴋',
  75727. '𣫺' => '𣫺',
  75728. '汎' => '汎',
  75729. '𣲼' => '𣲼',
  75730. '沿' => '沿',
  75731. '泍' => '�',
  75732. '汧' => '汧',
  75733. '洖' => '洖',
  75734. '派' => '派',
  75735. '�' => '海',
  75736. '流' => '�',
  75737. '浩' => '浩',
  75738. '浸' => '浸',
  75739. '涅' => '涅',
  75740. '𣴞' => '𣴞',
  75741. '洴' => '洴',
  75742. '港' => '港',
  75743. '湮' => '湮',
  75744. '㴳' => '㴳',
  75745. '滋' => '滋',
  75746. '滇' => '滇',
  75747. '�' => '𣻑',
  75748. '淹' => '淹',
  75749. '�' => '潮',
  75750. '�' => '𣽞',
  75751. '𣾎' => '𣾎',
  75752. '濆' => '濆',
  75753. '瀹' => '瀹',
  75754. '瀞' => '瀞',
  75755. '瀛' => '瀛',
  75756. '㶖' => '㶖',
  75757. '灊' => '�',
  75758. '災' => '�',
  75759. '灷' => '�',
  75760. '炭' => '炭',
  75761. '𠔥' => '𠔥',
  75762. '煅' => '煅',
  75763. '�' => '𤉣',
  75764. '熜' => '熜',
  75765. '𤎫' => '𤎫',
  75766. '爨' => '爨',
  75767. '爵' => '爵',
  75768. '牐' => '�',
  75769. '𤘈' => '𤘈',
  75770. '犀' => '犀',
  75771. '犕' => '犕',
  75772. '𤜵' => '𤜵',
  75773. '𤠔' => '𤠔',
  75774. '獺' => '�',
  75775. '王' => '王',
  75776. '㺬' => '㺬',
  75777. '玥' => '玥',
  75778. '㺸' => '㺸',
  75779. '㺸' => '㺸',
  75780. '瑇' => '瑇',
  75781. '瑜' => '瑜',
  75782. '瑱' => '瑱',
  75783. '璅' => '璅',
  75784. '瓊' => '瓊',
  75785. '㼛' => '㼛',
  75786. '甤' => '甤',
  75787. '𤰶' => '𤰶',
  75788. '甾' => '甾',
  75789. '𤲒' => '𤲒',
  75790. '異' => '異',
  75791. '𢆟' => '𢆟',
  75792. '瘐' => '�',
  75793. '𤾡' => '𤾡',
  75794. '𤾸' => '𤾸',
  75795. '𥁄' => '�',
  75796. '㿼' => '㿼',
  75797. '䀈' => '䀈',
  75798. '直' => '直',
  75799. '�' => '𥃳',
  75800. '𥃲' => '𥃲',
  75801. '𥄙' => '𥄙',
  75802. '𥄳' => '𥄳',
  75803. '眞' => '眞',
  75804. '真' => '真',
  75805. '真' => '真',
  75806. '睊' => '�',
  75807. '䀹' => '䀹',
  75808. '瞋' => '瞋',
  75809. '䁆' => '�',
  75810. '䂖' => '䂖',
  75811. '�' => '�',
  75812. '硎' => '硎',
  75813. '�' => '碌',
  75814. '�' => '磌',
  75815. '䃣' => '䃣',
  75816. '𥘦' => '𥘦',
  75817. '祖' => '祖',
  75818. '𥚚' => '𥚚',
  75819. '𥛅' => '𥛅',
  75820. '福' => '�',
  75821. '秫' => '秫',
  75822. '䄯' => '䄯',
  75823. '穀' => '穀',
  75824. '穊' => '穊',
  75825. '穏' => '�',
  75826. '𥥼' => '𥥼',
  75827. '�' => '𥪧',
  75828. '𥪧' => '𥪧',
  75829. '竮' => '竮',
  75830. '䈂' => '䈂',
  75831. '𥮫' => '𥮫',
  75832. '篆' => '篆',
  75833. '築' => '築',
  75834. '䈧' => '䈧',
  75835. '𥲀' => '𥲀',
  75836. '糒' => '糒',
  75837. '䊠' => '䊠',
  75838. '糨' => '糨',
  75839. '糣' => '糣',
  75840. '紀' => '紀',
  75841. '𥾆' => '𥾆',
  75842. '絣' => '絣',
  75843. '䌁' => '�',
  75844. '緇' => '緇',
  75845. '縂' => '縂',
  75846. '繅' => '繅',
  75847. '䌴' => '䌴',
  75848. '𦈨' => '𦈨',
  75849. '𦉇' => '𦉇',
  75850. '䍙' => '�',
  75851. '𦋙' => '𦋙',
  75852. '罺' => '罺',
  75853. '𦌾' => '𦌾',
  75854. '羕' => '羕',
  75855. '翺' => '翺',
  75856. '者' => '者',
  75857. '𦓚' => '𦓚',
  75858. '𦔣' => '𦔣',
  75859. '聠' => '�',
  75860. '𦖨' => '𦖨',
  75861. '聰' => '�',
  75862. '𣍟' => '�',
  75863. '�' => '�',
  75864. '育' => '育',
  75865. '脃' => '脃',
  75866. '䐋' => '�',
  75867. '脾' => '脾',
  75868. '媵' => '媵',
  75869. '𦞧' => '𦞧',
  75870. '𦞵' => '𦞵',
  75871. '𣎓' => '𣎓',
  75872. '𣎜' => '𣎜',
  75873. '舁' => '�',
  75874. '舄' => '舄',
  75875. '�' => '辞',
  75876. '䑫' => '䑫',
  75877. '�' => '芑',
  75878. '�' => '芋',
  75879. '芝' => '�',
  75880. '劳' => '劳',
  75881. '花' => '花',
  75882. '芳' => '芳',
  75883. '芽' => '芽',
  75884. '苦' => '苦',
  75885. '𦬼' => '𦬼',
  75886. '若' => '若',
  75887. '茝' => '�',
  75888. '荣' => '�',
  75889. '莭' => '莭',
  75890. '茣' => '茣',
  75891. '�' => '莽',
  75892. '菧' => '�',
  75893. '著' => '著',
  75894. '荓' => '�',
  75895. '菊' => '�',
  75896. '菌' => '�',
  75897. '菜' => '�',
  75898. '𦰶' => '𦰶',
  75899. '𦵫' => '𦵫',
  75900. '𦳕' => '𦳕',
  75901. '䔫' => '䔫',
  75902. '蓱' => '蓱',
  75903. '蓳' => '蓳',
  75904. '蔖' => '蔖',
  75905. '𧏊' => '�',
  75906. '蕤' => '蕤',
  75907. '𦼬' => '𦼬',
  75908. '䕝' => '�',
  75909. '䕡' => '䕡',
  75910. '𦾱' => '𦾱',
  75911. '𧃒' => '𧃒',
  75912. '䕫' => '䕫',
  75913. '虐' => '�',
  75914. '虜' => '虜',
  75915. '虧' => '虧',
  75916. '虩' => '虩',
  75917. '蚩' => '蚩',
  75918. '蚈' => '蚈',
  75919. '蜎' => '蜎',
  75920. '蛢' => '蛢',
  75921. '蝹' => '�',
  75922. '蜨' => '蜨',
  75923. '蝫' => '�',
  75924. '螆' => '螆',
  75925. '䗗' => '䗗',
  75926. '蟡' => '蟡',
  75927. '�' => '�',
  75928. '䗹' => '䗹',
  75929. '衠' => '衠',
  75930. '衣' => '衣',
  75931. '𧙧' => '𧙧',
  75932. '裗' => '裗',
  75933. '裞' => '裞',
  75934. '䘵' => '䘵',
  75935. '裺' => '裺',
  75936. '㒻' => '㒻',
  75937. '𧢮' => '𧢮',
  75938. '𧥦' => '𧥦',
  75939. '�' => '䚾',
  75940. '䛇' => '䛇',
  75941. '�' => '誠',
  75942. '�' => '諭',
  75943. '變' => '變',
  75944. '豕' => '豕',
  75945. '𧲨' => '𧲨',
  75946. '貫' => '貫',
  75947. '賁' => '�',
  75948. '贛' => '贛',
  75949. '起' => '起',
  75950. '𧼯' => '𧼯',
  75951. '𠠄' => '𠠄',
  75952. '跋' => '跋',
  75953. '趼' => '趼',
  75954. '跰' => '跰',
  75955. '�' => '𠣞',
  75956. '軔' => '軔',
  75957. '輸' => '輸',
  75958. '𨗒' => '𨗒',
  75959. '𨗭' => '𨗭',
  75960. '邔' => '邔',
  75961. '郱' => '郱',
  75962. '鄑' => '鄑',
  75963. '𨜮' => '𨜮',
  75964. '鄛' => '鄛',
  75965. '鈸' => '鈸',
  75966. '鋗' => '鋗',
  75967. '鋘' => '鋘',
  75968. '鉼' => '鉼',
  75969. '鏹' => '�',
  75970. '鐕' => '�',
  75971. '𨯺' => '𨯺',
  75972. '開' => '開',
  75973. '䦕' => '䦕',
  75974. '閷' => '閷',
  75975. '𨵷' => '𨵷',
  75976. '䧦' => '䧦',
  75977. '雃' => '雃',
  75978. '嶲' => '嶲',
  75979. '霣' => '霣',
  75980. '𩅅' => '𩅅',
  75981. '𩈚' => '𩈚',
  75982. '䩮' => '䩮',
  75983. '䩶' => '䩶',
  75984. '韠' => '韠',
  75985. '𩐊' => '�',
  75986. '䪲' => '䪲',
  75987. '𩒖' => '𩒖',
  75988. '頋' => '頋',
  75989. '頋' => '頋',
  75990. '頩' => '頩',
  75991. '�' => '𩖶',
  75992. '飢' => '飢',
  75993. '䬳' => '䬳',
  75994. '餩' => '餩',
  75995. '馧' => '馧',
  75996. '駂' => '駂',
  75997. '駾' => '駾',
  75998. '䯎' => '䯎',
  75999. '𩬰' => '𩬰',
  76000. '鬒' => '鬒',
  76001. '鱀' => '鱀',
  76002. '鳽' => '鳽',
  76003. '�' => '䳎',
  76004. '䳭' => '䳭',
  76005. '�' => '鵧',
  76006. '�' => '𪃎',
  76007. '䳸' => '䳸',
  76008. '𪄅' => '𪄅',
  76009. '𪈎' => '𪈎',
  76010. '𪊑' => '𪊑',
  76011. '麻' => '麻',
  76012. '䵖' => '䵖',
  76013. '黹' => '黹',
  76014. '黾' => '黾',
  76015. '鼅' => '鼅',
  76016. '鼏' => '�',
  76017. '鼖' => '鼖',
  76018. '鼻' => '鼻',
  76019. '�' => '𪘀',
  76020. );
  76021. <?php
  76022. return array (
  76023. 'Ì€' => 230,
  76024. '�' => 230,
  76025. 'Ì‚' => 230,
  76026. '̃' => 230,
  76027. 'Ì„' => 230,
  76028. 'Ì…' => 230,
  76029. '̆' => 230,
  76030. '̇' => 230,
  76031. '̈' => 230,
  76032. '̉' => 230,
  76033. 'ÌŠ' => 230,
  76034. 'Ì‹' => 230,
  76035. '̌' => 230,
  76036. '�' => 230,
  76037. 'ÌŽ' => 230,
  76038. '�' => 230,
  76039. '�' => 230,
  76040. 'Ì‘' => 230,
  76041. 'Ì’' => 230,
  76042. 'Ì“' => 230,
  76043. 'Ì”' => 230,
  76044. 'Ì•' => 232,
  76045. 'Ì–' => 220,
  76046. 'Ì—' => 220,
  76047. '̘' => 220,
  76048. 'Ì™' => 220,
  76049. 'Ìš' => 232,
  76050. 'Ì›' => 216,
  76051. '̜' => 220,
  76052. '�' => 220,
  76053. 'Ìž' => 220,
  76054. 'ÌŸ' => 220,
  76055. 'Ì ' => 220,
  76056. 'Ì¡' => 202,
  76057. 'Ì¢' => 202,
  76058. 'Ì£' => 220,
  76059. '̤' => 220,
  76060. 'Ì¥' => 220,
  76061. '̦' => 220,
  76062. '̧' => 202,
  76063. '̨' => 202,
  76064. 'Ì©' => 220,
  76065. '̪' => 220,
  76066. 'Ì«' => 220,
  76067. '̬' => 220,
  76068. 'Ì­' => 220,
  76069. 'Ì®' => 220,
  76070. '̯' => 220,
  76071. 'Ì°' => 220,
  76072. '̱' => 220,
  76073. '̲' => 220,
  76074. '̳' => 220,
  76075. 'Ì´' => 1,
  76076. '̵' => 1,
  76077. '̶' => 1,
  76078. 'Ì·' => 1,
  76079. '̸' => 1,
  76080. '̹' => 220,
  76081. '̺' => 220,
  76082. 'Ì»' => 220,
  76083. '̼' => 220,
  76084. '̽' => 230,
  76085. '̾' => 230,
  76086. 'Ì¿' => 230,
  76087. 'Í€' => 230,
  76088. '�' => 230,
  76089. 'Í‚' => 230,
  76090. '̓' => 230,
  76091. 'Í„' => 230,
  76092. 'Í…' => 240,
  76093. '͆' => 230,
  76094. '͇' => 220,
  76095. '͈' => 220,
  76096. '͉' => 220,
  76097. 'ÍŠ' => 230,
  76098. 'Í‹' => 230,
  76099. '͌' => 230,
  76100. '�' => 220,
  76101. 'ÍŽ' => 220,
  76102. '�' => 230,
  76103. 'Í‘' => 230,
  76104. 'Í’' => 230,
  76105. 'Í“' => 220,
  76106. 'Í”' => 220,
  76107. 'Í•' => 220,
  76108. 'Í–' => 220,
  76109. 'Í—' => 230,
  76110. '͘' => 232,
  76111. 'Í™' => 220,
  76112. 'Íš' => 220,
  76113. 'Í›' => 230,
  76114. '͜' => 233,
  76115. '�' => 234,
  76116. 'Íž' => 234,
  76117. 'ÍŸ' => 233,
  76118. 'Í ' => 234,
  76119. 'Í¡' => 234,
  76120. 'Í¢' => 233,
  76121. 'Í£' => 230,
  76122. 'ͤ' => 230,
  76123. 'Í¥' => 230,
  76124. 'ͦ' => 230,
  76125. 'ͧ' => 230,
  76126. 'ͨ' => 230,
  76127. 'Í©' => 230,
  76128. 'ͪ' => 230,
  76129. 'Í«' => 230,
  76130. 'ͬ' => 230,
  76131. 'Í­' => 230,
  76132. 'Í®' => 230,
  76133. 'ͯ' => 230,
  76134. 'Òƒ' => 230,
  76135. 'Ò„' => 230,
  76136. 'Ò…' => 230,
  76137. 'Ò†' => 230,
  76138. 'Ò‡' => 230,
  76139. 'Ö‘' => 220,
  76140. 'Ö’' => 230,
  76141. 'Ö“' => 230,
  76142. 'Ö”' => 230,
  76143. 'Ö•' => 230,
  76144. 'Ö–' => 220,
  76145. 'Ö—' => 230,
  76146. 'Ö˜' => 230,
  76147. 'Ö™' => 230,
  76148. 'Öš' => 222,
  76149. 'Ö›' => 220,
  76150. '֜' => 230,
  76151. 'Ö�' => 230,
  76152. 'Öž' => 230,
  76153. 'ÖŸ' => 230,
  76154. 'Ö ' => 230,
  76155. 'Ö¡' => 230,
  76156. 'Ö¢' => 220,
  76157. 'Ö£' => 220,
  76158. 'Ö¤' => 220,
  76159. 'Ö¥' => 220,
  76160. 'Ö¦' => 220,
  76161. 'Ö§' => 220,
  76162. 'Ö¨' => 230,
  76163. 'Ö©' => 230,
  76164. 'Öª' => 220,
  76165. 'Ö«' => 230,
  76166. 'Ö¬' => 230,
  76167. 'Ö­' => 222,
  76168. 'Ö®' => 228,
  76169. 'Ö¯' => 230,
  76170. 'Ö°' => 10,
  76171. 'Ö±' => 11,
  76172. 'Ö²' => 12,
  76173. 'Ö³' => 13,
  76174. 'Ö´' => 14,
  76175. 'Öµ' => 15,
  76176. 'Ö¶' => 16,
  76177. 'Ö·' => 17,
  76178. 'Ö¸' => 18,
  76179. 'Ö¹' => 19,
  76180. 'Öº' => 19,
  76181. 'Ö»' => 20,
  76182. 'Ö¼' => 21,
  76183. 'Ö½' => 22,
  76184. 'Ö¿' => 23,
  76185. '�' => 24,
  76186. 'ׂ' => 25,
  76187. 'ׄ' => 230,
  76188. '×…' => 220,
  76189. 'ׇ' => 18,
  76190. '�' => 230,
  76191. 'Ø‘' => 230,
  76192. 'Ø’' => 230,
  76193. 'Ø“' => 230,
  76194. 'Ø”' => 230,
  76195. 'Ø•' => 230,
  76196. 'Ø–' => 230,
  76197. 'Ø—' => 230,
  76198. 'ؘ' => 30,
  76199. 'Ø™' => 31,
  76200. 'Øš' => 32,
  76201. 'Ù‹' => 27,
  76202. 'ٌ' => 28,
  76203. 'Ù�' => 29,
  76204. 'ÙŽ' => 30,
  76205. 'Ù�' => 31,
  76206. 'Ù�' => 32,
  76207. 'Ù‘' => 33,
  76208. 'Ù’' => 34,
  76209. 'Ù“' => 230,
  76210. 'Ù”' => 230,
  76211. 'Ù•' => 220,
  76212. 'Ù–' => 220,
  76213. 'Ù—' => 230,
  76214. 'Ù˜' => 230,
  76215. 'Ù™' => 230,
  76216. 'Ùš' => 230,
  76217. 'Ù›' => 230,
  76218. 'ٜ' => 220,
  76219. 'Ù�' => 230,
  76220. 'Ùž' => 230,
  76221. 'ÙŸ' => 220,
  76222. 'Ù°' => 35,
  76223. 'Û–' => 230,
  76224. 'Û—' => 230,
  76225. 'Û˜' => 230,
  76226. 'Û™' => 230,
  76227. 'Ûš' => 230,
  76228. 'Û›' => 230,
  76229. 'ۜ' => 230,
  76230. 'ÛŸ' => 230,
  76231. 'Û ' => 230,
  76232. 'Û¡' => 230,
  76233. 'Û¢' => 230,
  76234. 'Û£' => 220,
  76235. 'Û¤' => 230,
  76236. 'Û§' => 230,
  76237. 'Û¨' => 230,
  76238. 'Ûª' => 220,
  76239. 'Û«' => 230,
  76240. 'Û¬' => 230,
  76241. 'Û­' => 220,
  76242. 'Ü‘' => 36,
  76243. 'Ü°' => 230,
  76244. 'ܱ' => 220,
  76245. 'ܲ' => 230,
  76246. 'ܳ' => 230,
  76247. 'Ü´' => 220,
  76248. 'ܵ' => 230,
  76249. 'ܶ' => 230,
  76250. 'Ü·' => 220,
  76251. 'ܸ' => 220,
  76252. 'ܹ' => 220,
  76253. 'ܺ' => 230,
  76254. 'Ü»' => 220,
  76255. 'ܼ' => 220,
  76256. 'ܽ' => 230,
  76257. 'ܾ' => 220,
  76258. 'Ü¿' => 230,
  76259. 'Ý€' => 230,
  76260. '�' => 230,
  76261. 'Ý‚' => 220,
  76262. '݃' => 230,
  76263. 'Ý„' => 220,
  76264. 'Ý…' => 230,
  76265. '݆' => 220,
  76266. '݇' => 230,
  76267. '݈' => 220,
  76268. '݉' => 230,
  76269. 'ÝŠ' => 230,
  76270. 'ß«' => 230,
  76271. '߬' => 230,
  76272. 'ß­' => 230,
  76273. 'ß®' => 230,
  76274. '߯' => 230,
  76275. 'ß°' => 230,
  76276. 'ß±' => 230,
  76277. 'ß²' => 220,
  76278. 'ß³' => 230,
  76279. 'ß½' => 220,
  76280. 'à –' => 230,
  76281. 'à —' => 230,
  76282. 'à ˜' => 230,
  76283. 'à ™' => 230,
  76284. 'à ›' => 230,
  76285. 'ࠜ' => 230,
  76286. 'à �' => 230,
  76287. 'à ž' => 230,
  76288. 'à Ÿ' => 230,
  76289. 'à  ' => 230,
  76290. 'à ¡' => 230,
  76291. 'à ¢' => 230,
  76292. 'à £' => 230,
  76293. 'à ¥' => 230,
  76294. 'à ¦' => 230,
  76295. 'à §' => 230,
  76296. 'à ©' => 230,
  76297. 'à ª' => 230,
  76298. 'à «' => 230,
  76299. 'à ¬' => 230,
  76300. 'à ­' => 230,
  76301. 'à¡™' => 220,
  76302. 'à¡š' => 220,
  76303. 'à¡›' => 220,
  76304. '࣓' => 220,
  76305. 'ࣔ' => 230,
  76306. 'ࣕ' => 230,
  76307. 'ࣖ' => 230,
  76308. 'ࣗ' => 230,
  76309. 'ࣘ' => 230,
  76310. 'ࣙ' => 230,
  76311. 'ࣚ' => 230,
  76312. 'ࣛ' => 230,
  76313. 'ࣜ' => 230,
  76314. '�' => 230,
  76315. 'ࣞ' => 230,
  76316. 'ࣟ' => 230,
  76317. '࣠' => 230,
  76318. '࣡' => 230,
  76319. 'ࣣ' => 220,
  76320. 'ࣤ' => 230,
  76321. 'ࣥ' => 230,
  76322. 'ࣦ' => 220,
  76323. 'ࣧ' => 230,
  76324. 'ࣨ' => 230,
  76325. 'ࣩ' => 220,
  76326. '࣪' => 230,
  76327. '࣫' => 230,
  76328. '࣬' => 230,
  76329. '࣭' => 220,
  76330. '࣮' => 220,
  76331. '࣯' => 220,
  76332. 'ࣰ' => 27,
  76333. 'ࣱ' => 28,
  76334. 'ࣲ' => 29,
  76335. 'ࣳ' => 230,
  76336. 'ࣴ' => 230,
  76337. 'ࣵ' => 230,
  76338. 'ࣶ' => 220,
  76339. 'ࣷ' => 230,
  76340. 'ࣸ' => 230,
  76341. 'ࣹ' => 220,
  76342. 'ࣺ' => 220,
  76343. 'ࣻ' => 230,
  76344. 'ࣼ' => 230,
  76345. 'ࣽ' => 230,
  76346. 'ࣾ' => 230,
  76347. 'ࣿ' => 230,
  76348. '़' => 7,
  76349. '�' => 9,
  76350. '॑' => 230,
  76351. '॒' => 220,
  76352. '॓' => 230,
  76353. '॔' => 230,
  76354. '়' => 7,
  76355. '�' => 9,
  76356. '৾' => 230,
  76357. '਼' => 7,
  76358. '�' => 9,
  76359. '઼' => 7,
  76360. '�' => 9,
  76361. '଼' => 7,
  76362. 'à­�' => 9,
  76363. '�' => 9,
  76364. '�' => 9,
  76365. 'ౕ' => 84,
  76366. 'à±–' => 91,
  76367. '಼' => 7,
  76368. '�' => 9,
  76369. 'à´»' => 9,
  76370. 'à´¼' => 9,
  76371. '�' => 9,
  76372. 'à·Š' => 9,
  76373. 'ุ' => 103,
  76374. 'ู' => 103,
  76375. 'ฺ' => 9,
  76376. '่' => 107,
  76377. '้' => 107,
  76378. '๊' => 107,
  76379. '๋' => 107,
  76380. 'ຸ' => 118,
  76381. 'ູ' => 118,
  76382. '຺' => 9,
  76383. '່' => 122,
  76384. '້' => 122,
  76385. '໊' => 122,
  76386. '໋' => 122,
  76387. '༘' => 220,
  76388. '༙' => 220,
  76389. '༵' => 220,
  76390. '༷' => 220,
  76391. '༹' => 216,
  76392. 'ཱ' => 129,
  76393. 'ི' => 130,
  76394. 'ུ' => 132,
  76395. 'ེ' => 130,
  76396. 'ཻ' => 130,
  76397. 'ོ' => 130,
  76398. 'ཽ' => 130,
  76399. 'ྀ' => 130,
  76400. 'ྂ' => 230,
  76401. 'ྃ' => 230,
  76402. '྄' => 9,
  76403. '྆' => 230,
  76404. '྇' => 230,
  76405. '࿆' => 220,
  76406. '့' => 7,
  76407. '္' => 9,
  76408. '်' => 9,
  76409. '�' => 220,
  76410. '�' => 230,
  76411. '�' => 230,
  76412. '�' => 230,
  76413. '᜔' => 9,
  76414. '᜴' => 9,
  76415. '្' => 9,
  76416. '�' => 230,
  76417. 'ᢩ' => 228,
  76418. '᤹' => 222,
  76419. '᤺' => 230,
  76420. '᤻' => 220,
  76421. 'ᨗ' => 230,
  76422. 'ᨘ' => 220,
  76423. 'á© ' => 9,
  76424. '᩵' => 230,
  76425. '᩶' => 230,
  76426. 'á©·' => 230,
  76427. '᩸' => 230,
  76428. '᩹' => 230,
  76429. '᩺' => 230,
  76430. 'á©»' => 230,
  76431. '᩼' => 230,
  76432. 'á©¿' => 220,
  76433. '᪰' => 230,
  76434. '᪱' => 230,
  76435. '᪲' => 230,
  76436. '᪳' => 230,
  76437. '᪴' => 230,
  76438. '᪵' => 220,
  76439. '᪶' => 220,
  76440. '᪷' => 220,
  76441. '᪸' => 220,
  76442. '᪹' => 220,
  76443. '᪺' => 220,
  76444. '᪻' => 230,
  76445. '᪼' => 230,
  76446. '᪽' => 220,
  76447. 'ᪿ' => 220,
  76448. 'á«€' => 220,
  76449. '᬴' => 7,
  76450. 'á­„' => 9,
  76451. 'á­«' => 230,
  76452. 'á­¬' => 220,
  76453. 'á­­' => 230,
  76454. 'á­®' => 230,
  76455. 'á­¯' => 230,
  76456. 'á­°' => 230,
  76457. 'á­±' => 230,
  76458. 'á­²' => 230,
  76459. 'á­³' => 230,
  76460. '᮪' => 9,
  76461. '᮫' => 9,
  76462. '᯦' => 7,
  76463. '᯲' => 9,
  76464. '᯳' => 9,
  76465. 'á°·' => 7,
  76466. '�' => 230,
  76467. '᳑' => 230,
  76468. 'á³’' => 230,
  76469. 'á³”' => 1,
  76470. '᳕' => 220,
  76471. 'á³–' => 220,
  76472. 'á³—' => 220,
  76473. '᳘' => 220,
  76474. 'á³™' => 220,
  76475. '᳚' => 230,
  76476. 'á³›' => 230,
  76477. '᳜' => 220,
  76478. '�' => 220,
  76479. '᳞' => 220,
  76480. '᳟' => 220,
  76481. 'á³ ' => 230,
  76482. 'á³¢' => 1,
  76483. 'á³£' => 1,
  76484. '᳤' => 1,
  76485. 'á³¥' => 1,
  76486. '᳦' => 1,
  76487. '᳧' => 1,
  76488. '᳨' => 1,
  76489. 'á³­' => 220,
  76490. 'á³´' => 230,
  76491. '᳸' => 230,
  76492. 'á³¹' => 230,
  76493. 'á·€' => 230,
  76494. 'á·�' => 230,
  76495. 'á·‚' => 220,
  76496. 'á·ƒ' => 230,
  76497. 'á·„' => 230,
  76498. 'á·…' => 230,
  76499. 'á·†' => 230,
  76500. 'á·‡' => 230,
  76501. 'á·ˆ' => 230,
  76502. 'á·‰' => 230,
  76503. 'á·Š' => 220,
  76504. 'á·‹' => 230,
  76505. '᷌' => 230,
  76506. 'á·�' => 234,
  76507. 'á·Ž' => 214,
  76508. 'á·�' => 220,
  76509. 'á·�' => 202,
  76510. 'á·‘' => 230,
  76511. 'á·’' => 230,
  76512. 'á·“' => 230,
  76513. 'á·”' => 230,
  76514. 'á·•' => 230,
  76515. 'á·–' => 230,
  76516. 'á·—' => 230,
  76517. 'á·˜' => 230,
  76518. 'á·™' => 230,
  76519. 'á·š' => 230,
  76520. 'á·›' => 230,
  76521. 'ᷜ' => 230,
  76522. 'á·�' => 230,
  76523. 'á·ž' => 230,
  76524. 'á·Ÿ' => 230,
  76525. 'á· ' => 230,
  76526. 'á·¡' => 230,
  76527. 'á·¢' => 230,
  76528. 'á·£' => 230,
  76529. 'á·¤' => 230,
  76530. 'á·¥' => 230,
  76531. 'á·¦' => 230,
  76532. 'á·§' => 230,
  76533. 'á·¨' => 230,
  76534. 'á·©' => 230,
  76535. 'á·ª' => 230,
  76536. 'á·«' => 230,
  76537. 'á·¬' => 230,
  76538. 'á·­' => 230,
  76539. 'á·®' => 230,
  76540. 'á·¯' => 230,
  76541. 'á·°' => 230,
  76542. 'á·±' => 230,
  76543. 'á·²' => 230,
  76544. 'á·³' => 230,
  76545. 'á·´' => 230,
  76546. 'á·µ' => 230,
  76547. 'á·¶' => 232,
  76548. 'á··' => 228,
  76549. 'á·¸' => 228,
  76550. 'á·¹' => 220,
  76551. 'á·»' => 230,
  76552. 'á·¼' => 233,
  76553. 'á·½' => 220,
  76554. 'á·¾' => 230,
  76555. 'á·¿' => 220,
  76556. '�' => 230,
  76557. '⃑' => 230,
  76558. '⃒' => 1,
  76559. '⃓' => 1,
  76560. '⃔' => 230,
  76561. '⃕' => 230,
  76562. '⃖' => 230,
  76563. '⃗' => 230,
  76564. '⃘' => 1,
  76565. '⃙' => 1,
  76566. '⃚' => 1,
  76567. '⃛' => 230,
  76568. '⃜' => 230,
  76569. '⃡' => 230,
  76570. '⃥' => 1,
  76571. '⃦' => 1,
  76572. '⃧' => 230,
  76573. '⃨' => 220,
  76574. '⃩' => 230,
  76575. '⃪' => 1,
  76576. '⃫' => 1,
  76577. '⃬' => 220,
  76578. '⃭' => 220,
  76579. '⃮' => 220,
  76580. '⃯' => 220,
  76581. '⃰' => 230,
  76582. '⳯' => 230,
  76583. 'â³°' => 230,
  76584. 'â³±' => 230,
  76585. '⵿' => 9,
  76586. 'â· ' => 230,
  76587. 'â·¡' => 230,
  76588. 'â·¢' => 230,
  76589. 'â·£' => 230,
  76590. 'â·¤' => 230,
  76591. 'â·¥' => 230,
  76592. 'â·¦' => 230,
  76593. 'â·§' => 230,
  76594. 'â·¨' => 230,
  76595. 'â·©' => 230,
  76596. 'â·ª' => 230,
  76597. 'â·«' => 230,
  76598. 'â·¬' => 230,
  76599. 'â·­' => 230,
  76600. 'â·®' => 230,
  76601. 'â·¯' => 230,
  76602. 'â·°' => 230,
  76603. 'â·±' => 230,
  76604. 'â·²' => 230,
  76605. 'â·³' => 230,
  76606. 'â·´' => 230,
  76607. 'â·µ' => 230,
  76608. 'â·¶' => 230,
  76609. 'â··' => 230,
  76610. 'â·¸' => 230,
  76611. 'â·¹' => 230,
  76612. 'â·º' => 230,
  76613. 'â·»' => 230,
  76614. 'â·¼' => 230,
  76615. 'â·½' => 230,
  76616. 'â·¾' => 230,
  76617. 'â·¿' => 230,
  76618. '〪' => 218,
  76619. '〫' => 228,
  76620. '〬' => 232,
  76621. '〭' => 222,
  76622. '〮' => 224,
  76623. '〯' => 224,
  76624. 'ã‚™' => 8,
  76625. 'ã‚š' => 8,
  76626. '꙯' => 230,
  76627. 'ê™´' => 230,
  76628. 'ꙵ' => 230,
  76629. 'ꙶ' => 230,
  76630. 'ê™·' => 230,
  76631. 'ꙸ' => 230,
  76632. 'ꙹ' => 230,
  76633. 'ꙺ' => 230,
  76634. 'ê™»' => 230,
  76635. '꙼' => 230,
  76636. '꙽' => 230,
  76637. 'êšž' => 230,
  76638. 'ꚟ' => 230,
  76639. 'ê›°' => 230,
  76640. 'ê›±' => 230,
  76641. 'ê †' => 9,
  76642. 'ê ¬' => 9,
  76643. '꣄' => 9,
  76644. '꣠' => 230,
  76645. '꣡' => 230,
  76646. '꣢' => 230,
  76647. '꣣' => 230,
  76648. '꣤' => 230,
  76649. '꣥' => 230,
  76650. '꣦' => 230,
  76651. '꣧' => 230,
  76652. '꣨' => 230,
  76653. '꣩' => 230,
  76654. '꣪' => 230,
  76655. '꣫' => 230,
  76656. '꣬' => 230,
  76657. '꣭' => 230,
  76658. '꣮' => 230,
  76659. '꣯' => 230,
  76660. '꣰' => 230,
  76661. '꣱' => 230,
  76662. '꤫' => 220,
  76663. '꤬' => 220,
  76664. '꤭' => 220,
  76665. '꥓' => 9,
  76666. '꦳' => 7,
  76667. '꧀' => 9,
  76668. 'ꪰ' => 230,
  76669. 'ꪲ' => 230,
  76670. 'ꪳ' => 230,
  76671. 'ꪴ' => 220,
  76672. 'ꪷ' => 230,
  76673. 'ꪸ' => 230,
  76674. 'ꪾ' => 230,
  76675. '꪿' => 230,
  76676. '�' => 230,
  76677. '꫶' => 9,
  76678. '꯭' => 9,
  76679. 'ﬞ' => 26,
  76680. '︠' => 230,
  76681. '︡' => 230,
  76682. '︢' => 230,
  76683. '︣' => 230,
  76684. '︤' => 230,
  76685. '︥' => 230,
  76686. '︦' => 230,
  76687. '︧' => 220,
  76688. '︨' => 220,
  76689. '︩' => 220,
  76690. '︪' => 220,
  76691. '︫' => 220,
  76692. '︬' => 220,
  76693. '︭' => 220,
  76694. '︮' => 230,
  76695. '︯' => 230,
  76696. '�' => 220,
  76697. '�' => 220,
  76698. '�' => 230,
  76699. '�' => 230,
  76700. '�' => 230,
  76701. '�' => 230,
  76702. '�' => 230,
  76703. '�' => 220,
  76704. '�' => 230,
  76705. '�' => 230,
  76706. '�' => 1,
  76707. '�' => 220,
  76708. '�' => 9,
  76709. '�' => 230,
  76710. '�' => 220,
  76711. '�' => 230,
  76712. '�' => 230,
  76713. '�' => 230,
  76714. '�' => 230,
  76715. '�' => 230,
  76716. '�' => 230,
  76717. '�' => 220,
  76718. '�' => 220,
  76719. '�' => 230,
  76720. '�' => 230,
  76721. '�' => 230,
  76722. '�' => 220,
  76723. '�' => 230,
  76724. '�' => 220,
  76725. '�' => 220,
  76726. '�' => 220,
  76727. '�' => 220,
  76728. '�' => 9,
  76729. '�' => 9,
  76730. 'ð‘‚¹' => 9,
  76731. '𑂺' => 7,
  76732. 'ð‘„€' => 230,
  76733. '�' => 230,
  76734. 'ð‘„‚' => 230,
  76735. 'ð‘„³' => 9,
  76736. 'ð‘„´' => 9,
  76737. 'ð‘…³' => 7,
  76738. '𑇀' => 9,
  76739. '𑇊' => 7,
  76740. '𑈵' => 9,
  76741. '𑈶' => 7,
  76742. 'ð‘‹©' => 7,
  76743. '𑋪' => 9,
  76744. '𑌻' => 7,
  76745. '𑌼' => 7,
  76746. '�' => 9,
  76747. '�' => 230,
  76748. '�' => 230,
  76749. '�' => 230,
  76750. '�' => 230,
  76751. '�' => 230,
  76752. '�' => 230,
  76753. '�' => 230,
  76754. '�' => 230,
  76755. '�' => 230,
  76756. '�' => 230,
  76757. '�' => 230,
  76758. '�' => 230,
  76759. 'ð‘‘‚' => 9,
  76760. '𑑆' => 7,
  76761. 'ð‘‘ž' => 230,
  76762. 'ð‘“‚' => 9,
  76763. '𑓃' => 7,
  76764. 'ð‘–¿' => 9,
  76765. 'ð‘—€' => 7,
  76766. '𑘿' => 9,
  76767. '𑚶' => 9,
  76768. 'ð‘š·' => 7,
  76769. '𑜫' => 9,
  76770. 'ð‘ ¹' => 9,
  76771. 'ð‘ º' => 7,
  76772. '𑤽' => 9,
  76773. '𑤾' => 9,
  76774. '𑥃' => 7,
  76775. '𑧠' => 9,
  76776. '𑨴' => 9,
  76777. '𑩇' => 9,
  76778. '𑪙' => 9,
  76779. 'ð‘°¿' => 9,
  76780. '𑵂' => 7,
  76781. '𑵄' => 9,
  76782. '𑵅' => 9,
  76783. '𑶗' => 9,
  76784. 'ð–«°' => 1,
  76785. 'ð–«±' => 1,
  76786. 'ð–«²' => 1,
  76787. 'ð–«³' => 1,
  76788. 'ð–«´' => 1,
  76789. 'ð–¬°' => 230,
  76790. '𖬱' => 230,
  76791. '𖬲' => 230,
  76792. '𖬳' => 230,
  76793. 'ð–¬´' => 230,
  76794. '𖬵' => 230,
  76795. '𖬶' => 230,
  76796. 'ð–¿°' => 6,
  76797. 'ð–¿±' => 6,
  76798. '𛲞' => 1,
  76799. '�' => 216,
  76800. '�' => 216,
  76801. '�' => 1,
  76802. '�' => 1,
  76803. '�' => 1,
  76804. '�' => 226,
  76805. '�' => 216,
  76806. '�' => 216,
  76807. '�' => 216,
  76808. '�' => 216,
  76809. '�' => 216,
  76810. '�' => 220,
  76811. '�' => 220,
  76812. '�' => 220,
  76813. '�' => 220,
  76814. '�' => 220,
  76815. '�' => 220,
  76816. '�' => 220,
  76817. '�' => 220,
  76818. '�' => 230,
  76819. '�' => 230,
  76820. '�' => 230,
  76821. '�' => 230,
  76822. '�' => 230,
  76823. '�' => 220,
  76824. '�' => 220,
  76825. '�' => 230,
  76826. '�' => 230,
  76827. '�' => 230,
  76828. '�' => 230,
  76829. '�' => 230,
  76830. '�' => 230,
  76831. '�' => 230,
  76832. '𞀀' => 230,
  76833. '�' => 230,
  76834. '𞀂' => 230,
  76835. '𞀃' => 230,
  76836. '𞀄' => 230,
  76837. '𞀅' => 230,
  76838. '𞀆' => 230,
  76839. '𞀈' => 230,
  76840. '𞀉' => 230,
  76841. '𞀊' => 230,
  76842. '𞀋' => 230,
  76843. '𞀌' => 230,
  76844. '�' => 230,
  76845. '𞀎' => 230,
  76846. '�' => 230,
  76847. '�' => 230,
  76848. '𞀑' => 230,
  76849. '𞀒' => 230,
  76850. '𞀓' => 230,
  76851. '𞀔' => 230,
  76852. '𞀕' => 230,
  76853. '𞀖' => 230,
  76854. '𞀗' => 230,
  76855. '𞀘' => 230,
  76856. '𞀛' => 230,
  76857. '𞀜' => 230,
  76858. '�' => 230,
  76859. '𞀞' => 230,
  76860. '𞀟' => 230,
  76861. '𞀠' => 230,
  76862. '𞀡' => 230,
  76863. '𞀣' => 230,
  76864. '𞀤' => 230,
  76865. '𞀦' => 230,
  76866. '𞀧' => 230,
  76867. '𞀨' => 230,
  76868. '𞀩' => 230,
  76869. '𞀪' => 230,
  76870. 'ðž„°' => 230,
  76871. '𞄱' => 230,
  76872. '𞄲' => 230,
  76873. '𞄳' => 230,
  76874. 'ðž„´' => 230,
  76875. '𞄵' => 230,
  76876. '𞄶' => 230,
  76877. '𞋬' => 230,
  76878. 'ðž‹­' => 230,
  76879. 'ðž‹®' => 230,
  76880. '𞋯' => 230,
  76881. '�' => 220,
  76882. '𞣑' => 220,
  76883. '𞣒' => 220,
  76884. '𞣓' => 220,
  76885. '𞣔' => 220,
  76886. '𞣕' => 220,
  76887. '𞣖' => 220,
  76888. '𞥄' => 230,
  76889. '𞥅' => 230,
  76890. '𞥆' => 230,
  76891. '𞥇' => 230,
  76892. '𞥈' => 230,
  76893. '𞥉' => 230,
  76894. '𞥊' => 7,
  76895. );
  76896. <?php
  76897. return array (
  76898. ' ' => ' ',
  76899. '¨' => ' ̈',
  76900. 'ª' => 'a',
  76901. '¯' => ' ̄',
  76902. '²' => '2',
  76903. '³' => '3',
  76904. '´' => ' �',
  76905. 'µ' => 'μ',
  76906. '¸' => ' ̧',
  76907. '¹' => '1',
  76908. 'º' => 'o',
  76909. '¼' => '1�4',
  76910. '½' => '1�2',
  76911. '¾' => '3�4',
  76912. 'IJ' => 'IJ',
  76913. 'ij' => 'ij',
  76914. 'Ŀ' => 'L·',
  76915. 'ŀ' => 'l·',
  76916. 'ʼn' => 'ʼn',
  76917. 'Å¿' => 's',
  76918. 'DŽ' => 'DŽ',
  76919. 'Dž' => 'Dž',
  76920. 'dž' => 'dž',
  76921. 'LJ' => 'LJ',
  76922. 'Lj' => 'Lj',
  76923. 'lj' => 'lj',
  76924. 'ÇŠ' => 'NJ',
  76925. 'Ç‹' => 'Nj',
  76926. 'nj' => 'nj',
  76927. 'DZ' => 'DZ',
  76928. 'Dz' => 'Dz',
  76929. 'dz' => 'dz',
  76930. 'Ê°' => 'h',
  76931. 'ʱ' => 'ɦ',
  76932. 'ʲ' => 'j',
  76933. 'ʳ' => 'r',
  76934. 'ʴ' => 'ɹ',
  76935. 'ʵ' => 'ɻ',
  76936. 'ʶ' => '�',
  76937. 'Ê·' => 'w',
  76938. 'ʸ' => 'y',
  76939. '˘' => ' ̆',
  76940. '˙' => ' ̇',
  76941. 'Ëš' => ' ÌŠ',
  76942. '˛' => ' ̨',
  76943. '˜' => ' ̃',
  76944. '�' => ' ̋',
  76945. 'Ë ' => 'É£',
  76946. 'Ë¡' => 'l',
  76947. 'Ë¢' => 's',
  76948. 'Ë£' => 'x',
  76949. 'ˤ' => 'ʕ',
  76950. 'ͺ' => ' ͅ',
  76951. '΄' => ' �',
  76952. '΅' => ' ̈�',
  76953. '�' => 'β',
  76954. 'ϑ' => 'θ',
  76955. 'Ï’' => 'Î¥',
  76956. 'ϓ' => 'Υ�',
  76957. 'ϔ' => 'Ϋ',
  76958. 'ϕ' => 'φ',
  76959. 'Ï–' => 'Ï€',
  76960. 'ϰ' => 'κ',
  76961. 'ϱ' => '�',
  76962. 'ϲ' => 'ς',
  76963. 'ϴ' => 'Θ',
  76964. 'ϵ' => 'ε',
  76965. 'Ϲ' => 'Σ',
  76966. 'Ö‡' => 'Õ¥Ö‚',
  76967. 'ٵ' => 'اٴ',
  76968. 'ٶ' => 'وٴ',
  76969. 'Ù·' => 'Û‡Ù´',
  76970. 'ٸ' => 'يٴ',
  76971. 'ำ' => '�า',
  76972. 'ຳ' => '�າ',
  76973. 'ໜ' => 'ຫນ',
  76974. '�' => 'ຫມ',
  76975. '༌' => '་',
  76976. 'ཷ' => 'ྲཱྀ',
  76977. 'ཹ' => 'ླཱྀ',
  76978. 'ჼ' => 'ნ',
  76979. 'á´¬' => 'A',
  76980. 'ᴭ' => 'Æ',
  76981. 'á´®' => 'B',
  76982. 'á´°' => 'D',
  76983. 'á´±' => 'E',
  76984. 'á´²' => 'ÆŽ',
  76985. 'á´³' => 'G',
  76986. 'á´´' => 'H',
  76987. 'á´µ' => 'I',
  76988. 'á´¶' => 'J',
  76989. 'á´·' => 'K',
  76990. 'á´¸' => 'L',
  76991. 'á´¹' => 'M',
  76992. 'á´º' => 'N',
  76993. 'á´¼' => 'O',
  76994. 'á´½' => 'È¢',
  76995. 'á´¾' => 'P',
  76996. 'á´¿' => 'R',
  76997. 'áµ€' => 'T',
  76998. '�' => 'U',
  76999. 'ᵂ' => 'W',
  77000. 'ᵃ' => 'a',
  77001. 'ᵄ' => '�',
  77002. 'áµ…' => 'É‘',
  77003. 'ᵆ' => 'ᴂ',
  77004. 'ᵇ' => 'b',
  77005. 'ᵈ' => 'd',
  77006. 'ᵉ' => 'e',
  77007. 'ᵊ' => 'ə',
  77008. 'ᵋ' => 'ɛ',
  77009. 'ᵌ' => 'ɜ',
  77010. '�' => 'g',
  77011. '�' => 'k',
  77012. '�' => 'm',
  77013. 'ᵑ' => 'ŋ',
  77014. 'áµ’' => 'o',
  77015. 'ᵓ' => 'ɔ',
  77016. 'áµ”' => 'á´–',
  77017. 'ᵕ' => 'ᴗ',
  77018. 'áµ–' => 'p',
  77019. 'áµ—' => 't',
  77020. 'ᵘ' => 'u',
  77021. 'áµ™' => 'á´�',
  77022. 'ᵚ' => 'ɯ',
  77023. 'áµ›' => 'v',
  77024. 'ᵜ' => 'ᴥ',
  77025. '�' => 'β',
  77026. 'ᵞ' => 'γ',
  77027. 'ᵟ' => 'δ',
  77028. 'ᵠ' => 'φ',
  77029. 'ᵡ' => 'χ',
  77030. 'áµ¢' => 'i',
  77031. 'áµ£' => 'r',
  77032. 'ᵤ' => 'u',
  77033. 'áµ¥' => 'v',
  77034. 'ᵦ' => 'β',
  77035. 'ᵧ' => 'γ',
  77036. 'ᵨ' => '�',
  77037. 'ᵩ' => 'φ',
  77038. 'ᵪ' => 'χ',
  77039. 'ᵸ' => 'н',
  77040. 'ᶛ' => 'ɒ',
  77041. 'ᶜ' => 'c',
  77042. '�' => 'ɕ',
  77043. 'ᶞ' => 'ð',
  77044. 'ᶟ' => 'ɜ',
  77045. 'ᶠ' => 'f',
  77046. 'ᶡ' => 'ɟ',
  77047. 'ᶢ' => 'ɡ',
  77048. 'ᶣ' => 'ɥ',
  77049. 'ᶤ' => 'ɨ',
  77050. 'ᶥ' => 'ɩ',
  77051. 'ᶦ' => 'ɪ',
  77052. 'ᶧ' => 'ᵻ',
  77053. 'ᶨ' => '�',
  77054. 'ᶩ' => 'ɭ',
  77055. 'ᶪ' => 'ᶅ',
  77056. 'ᶫ' => 'ʟ',
  77057. 'ᶬ' => 'ɱ',
  77058. 'ᶭ' => 'ɰ',
  77059. 'ᶮ' => 'ɲ',
  77060. 'ᶯ' => 'ɳ',
  77061. 'ᶰ' => 'ɴ',
  77062. 'ᶱ' => 'ɵ',
  77063. 'ᶲ' => 'ɸ',
  77064. 'ᶳ' => 'ʂ',
  77065. 'ᶴ' => 'ʃ',
  77066. 'ᶵ' => 'ƫ',
  77067. 'ᶶ' => 'ʉ',
  77068. 'ᶷ' => 'ʊ',
  77069. 'ᶸ' => 'ᴜ',
  77070. 'ᶹ' => 'ʋ',
  77071. 'ᶺ' => 'ʌ',
  77072. 'ᶻ' => 'z',
  77073. 'ᶼ' => '�',
  77074. 'ᶽ' => 'ʑ',
  77075. 'ᶾ' => 'ʒ',
  77076. 'ᶿ' => 'θ',
  77077. 'ẚ' => 'aʾ',
  77078. 'ẛ' => 'ṡ',
  77079. 'á¾½' => ' Ì“',
  77080. '᾿' => ' ̓',
  77081. 'á¿€' => ' Í‚',
  77082. '�' => ' ̈͂',
  77083. '�' => ' ̓̀',
  77084. '῎' => ' ̓�',
  77085. '�' => ' ̓͂',
  77086. '�' => ' ̔̀',
  77087. '῞' => ' ̔�',
  77088. '῟' => ' ̔͂',
  77089. '῭' => ' ̈̀',
  77090. '΅' => ' ̈�',
  77091. '´' => ' �',
  77092. '῾' => ' ̔',
  77093. ' ' => ' ',
  77094. '�' => ' ',
  77095. ' ' => ' ',
  77096. ' ' => ' ',
  77097. ' ' => ' ',
  77098. ' ' => ' ',
  77099. ' ' => ' ',
  77100. ' ' => ' ',
  77101. ' ' => ' ',
  77102. ' ' => ' ',
  77103. ' ' => ' ',
  77104. '‑' => '�',
  77105. '‗' => ' ̳',
  77106. '․' => '.',
  77107. '‥' => '..',
  77108. '…' => '...',
  77109. ' ' => ' ',
  77110. '″' => '′′',
  77111. '‴' => '′′′',
  77112. '‶' => '‵‵',
  77113. '‷' => '‵‵‵',
  77114. '‼' => '!!',
  77115. '‾' => ' ̅',
  77116. '�' => '??',
  77117. '�' => '?!',
  77118. '�' => '!?',
  77119. '�' => '′′′′',
  77120. '�' => ' ',
  77121. '�' => '0',
  77122. '�' => 'i',
  77123. '�' => '4',
  77124. '�' => '5',
  77125. '�' => '6',
  77126. '�' => '7',
  77127. '�' => '8',
  77128. '�' => '9',
  77129. '�' => '+',
  77130. '�' => '−',
  77131. '�' => '=',
  77132. '�' => '(',
  77133. '�' => ')',
  77134. '�' => 'n',
  77135. 'â‚€' => '0',
  77136. '�' => '1',
  77137. 'â‚‚' => '2',
  77138. '₃' => '3',
  77139. 'â‚„' => '4',
  77140. 'â‚…' => '5',
  77141. '₆' => '6',
  77142. '₇' => '7',
  77143. '₈' => '8',
  77144. '₉' => '9',
  77145. 'â‚Š' => '+',
  77146. '₋' => '−',
  77147. '₌' => '=',
  77148. '�' => '(',
  77149. 'â‚Ž' => ')',
  77150. '�' => 'a',
  77151. 'â‚‘' => 'e',
  77152. 'â‚’' => 'o',
  77153. 'â‚“' => 'x',
  77154. 'â‚”' => 'É™',
  77155. 'â‚•' => 'h',
  77156. 'â‚–' => 'k',
  77157. 'â‚—' => 'l',
  77158. 'ₘ' => 'm',
  77159. 'â‚™' => 'n',
  77160. 'â‚š' => 'p',
  77161. 'â‚›' => 's',
  77162. 'ₜ' => 't',
  77163. '₨' => 'Rs',
  77164. 'â„€' => 'a/c',
  77165. '�' => 'a/s',
  77166. 'â„‚' => 'C',
  77167. '℃' => '°C',
  77168. 'â„…' => 'c/o',
  77169. '℆' => 'c/u',
  77170. 'ℇ' => '�',
  77171. '℉' => '°F',
  77172. 'â„Š' => 'g',
  77173. 'â„‹' => 'H',
  77174. 'ℌ' => 'H',
  77175. '�' => 'H',
  77176. 'â„Ž' => 'h',
  77177. '�' => 'ħ',
  77178. '�' => 'I',
  77179. 'â„‘' => 'I',
  77180. 'â„’' => 'L',
  77181. 'â„“' => 'l',
  77182. 'â„•' => 'N',
  77183. 'â„–' => 'No',
  77184. 'â„™' => 'P',
  77185. 'â„š' => 'Q',
  77186. 'â„›' => 'R',
  77187. 'ℜ' => 'R',
  77188. '�' => 'R',
  77189. 'â„ ' => 'SM',
  77190. 'â„¡' => 'TEL',
  77191. 'â„¢' => 'TM',
  77192. 'ℤ' => 'Z',
  77193. 'ℨ' => 'Z',
  77194. 'ℬ' => 'B',
  77195. 'â„­' => 'C',
  77196. 'ℯ' => 'e',
  77197. 'â„°' => 'E',
  77198. 'ℱ' => 'F',
  77199. 'ℳ' => 'M',
  77200. 'â„´' => 'o',
  77201. 'ℵ' => '�',
  77202. 'ℶ' => 'ב',
  77203. 'â„·' => '×’',
  77204. 'ℸ' => 'ד',
  77205. 'ℹ' => 'i',
  77206. 'â„»' => 'FAX',
  77207. 'ℼ' => 'π',
  77208. 'ℽ' => 'γ',
  77209. 'ℾ' => 'Γ',
  77210. 'ℿ' => 'Π',
  77211. '⅀' => '∑',
  77212. 'â……' => 'D',
  77213. 'â…†' => 'd',
  77214. 'â…‡' => 'e',
  77215. 'â…ˆ' => 'i',
  77216. 'â…‰' => 'j',
  77217. '�' => '1�7',
  77218. '⅑' => '1�9',
  77219. '⅒' => '1�10',
  77220. '⅓' => '1�3',
  77221. '⅔' => '2�3',
  77222. '⅕' => '1�5',
  77223. '⅖' => '2�5',
  77224. '⅗' => '3�5',
  77225. '⅘' => '4�5',
  77226. '⅙' => '1�6',
  77227. '⅚' => '5�6',
  77228. '⅛' => '1�8',
  77229. '⅜' => '3�8',
  77230. '�' => '5�8',
  77231. '⅞' => '7�8',
  77232. '⅟' => '1�',
  77233. 'â… ' => 'I',
  77234. 'â…¡' => 'II',
  77235. 'â…¢' => 'III',
  77236. 'â…£' => 'IV',
  77237. 'â…¤' => 'V',
  77238. 'â…¥' => 'VI',
  77239. 'â…¦' => 'VII',
  77240. 'â…§' => 'VIII',
  77241. 'â…¨' => 'IX',
  77242. 'â…©' => 'X',
  77243. 'â…ª' => 'XI',
  77244. 'â…«' => 'XII',
  77245. 'â…¬' => 'L',
  77246. 'â…­' => 'C',
  77247. 'â…®' => 'D',
  77248. 'â…¯' => 'M',
  77249. 'â…°' => 'i',
  77250. 'â…±' => 'ii',
  77251. 'â…²' => 'iii',
  77252. 'â…³' => 'iv',
  77253. 'â…´' => 'v',
  77254. 'â…µ' => 'vi',
  77255. 'â…¶' => 'vii',
  77256. 'â…·' => 'viii',
  77257. 'â…¸' => 'ix',
  77258. 'â…¹' => 'x',
  77259. 'â…º' => 'xi',
  77260. 'â…»' => 'xii',
  77261. 'â…¼' => 'l',
  77262. 'â…½' => 'c',
  77263. 'â…¾' => 'd',
  77264. 'â…¿' => 'm',
  77265. '↉' => '0�3',
  77266. '∬' => '∫∫',
  77267. '∭' => '∫∫∫',
  77268. '∯' => '∮∮',
  77269. '∰' => '∮∮∮',
  77270. 'â‘ ' => '1',
  77271. 'â‘¡' => '2',
  77272. 'â‘¢' => '3',
  77273. 'â‘£' => '4',
  77274. '⑤' => '5',
  77275. 'â‘¥' => '6',
  77276. '⑦' => '7',
  77277. '⑧' => '8',
  77278. '⑨' => '9',
  77279. 'â‘©' => '10',
  77280. '⑪' => '11',
  77281. 'â‘«' => '12',
  77282. '⑬' => '13',
  77283. 'â‘­' => '14',
  77284. 'â‘®' => '15',
  77285. '⑯' => '16',
  77286. 'â‘°' => '17',
  77287. '⑱' => '18',
  77288. '⑲' => '19',
  77289. '⑳' => '20',
  77290. 'â‘´' => '(1)',
  77291. '⑵' => '(2)',
  77292. '⑶' => '(3)',
  77293. 'â‘·' => '(4)',
  77294. '⑸' => '(5)',
  77295. '⑹' => '(6)',
  77296. '⑺' => '(7)',
  77297. 'â‘»' => '(8)',
  77298. '⑼' => '(9)',
  77299. '⑽' => '(10)',
  77300. '⑾' => '(11)',
  77301. 'â‘¿' => '(12)',
  77302. 'â’€' => '(13)',
  77303. 'â’�' => '(14)',
  77304. 'â’‚' => '(15)',
  77305. 'â’ƒ' => '(16)',
  77306. 'â’„' => '(17)',
  77307. 'â’…' => '(18)',
  77308. 'â’†' => '(19)',
  77309. 'â’‡' => '(20)',
  77310. 'â’ˆ' => '1.',
  77311. 'â’‰' => '2.',
  77312. 'â’Š' => '3.',
  77313. 'â’‹' => '4.',
  77314. '⒌' => '5.',
  77315. 'â’�' => '6.',
  77316. 'â’Ž' => '7.',
  77317. 'â’�' => '8.',
  77318. 'â’�' => '9.',
  77319. 'â’‘' => '10.',
  77320. 'â’’' => '11.',
  77321. 'â’“' => '12.',
  77322. 'â’”' => '13.',
  77323. 'â’•' => '14.',
  77324. 'â’–' => '15.',
  77325. 'â’—' => '16.',
  77326. 'â’˜' => '17.',
  77327. 'â’™' => '18.',
  77328. 'â’š' => '19.',
  77329. 'â’›' => '20.',
  77330. '⒜' => '(a)',
  77331. 'â’�' => '(b)',
  77332. 'â’ž' => '(c)',
  77333. 'â’Ÿ' => '(d)',
  77334. 'â’ ' => '(e)',
  77335. 'â’¡' => '(f)',
  77336. 'â’¢' => '(g)',
  77337. 'â’£' => '(h)',
  77338. 'â’¤' => '(i)',
  77339. 'â’¥' => '(j)',
  77340. 'â’¦' => '(k)',
  77341. 'â’§' => '(l)',
  77342. 'â’¨' => '(m)',
  77343. 'â’©' => '(n)',
  77344. 'â’ª' => '(o)',
  77345. 'â’«' => '(p)',
  77346. 'â’¬' => '(q)',
  77347. 'â’­' => '(r)',
  77348. 'â’®' => '(s)',
  77349. 'â’¯' => '(t)',
  77350. 'â’°' => '(u)',
  77351. 'â’±' => '(v)',
  77352. 'â’²' => '(w)',
  77353. 'â’³' => '(x)',
  77354. 'â’´' => '(y)',
  77355. 'â’µ' => '(z)',
  77356. 'â’¶' => 'A',
  77357. 'â’·' => 'B',
  77358. 'â’¸' => 'C',
  77359. 'â’¹' => 'D',
  77360. 'â’º' => 'E',
  77361. 'â’»' => 'F',
  77362. 'â’¼' => 'G',
  77363. 'â’½' => 'H',
  77364. 'â’¾' => 'I',
  77365. 'â’¿' => 'J',
  77366. 'â“€' => 'K',
  77367. '�' => 'L',
  77368. 'â“‚' => 'M',
  77369. 'Ⓝ' => 'N',
  77370. 'â“„' => 'O',
  77371. 'â“…' => 'P',
  77372. 'Ⓠ' => 'Q',
  77373. 'Ⓡ' => 'R',
  77374. 'Ⓢ' => 'S',
  77375. 'Ⓣ' => 'T',
  77376. 'â“Š' => 'U',
  77377. 'â“‹' => 'V',
  77378. 'Ⓦ' => 'W',
  77379. '�' => 'X',
  77380. 'â“Ž' => 'Y',
  77381. '�' => 'Z',
  77382. '�' => 'a',
  77383. 'â“‘' => 'b',
  77384. 'â“’' => 'c',
  77385. 'â““' => 'd',
  77386. 'â“”' => 'e',
  77387. 'â“•' => 'f',
  77388. 'â“–' => 'g',
  77389. 'â“—' => 'h',
  77390. 'ⓘ' => 'i',
  77391. 'â“™' => 'j',
  77392. 'â“š' => 'k',
  77393. 'â“›' => 'l',
  77394. 'ⓜ' => 'm',
  77395. '�' => 'n',
  77396. 'â“ž' => 'o',
  77397. 'â“Ÿ' => 'p',
  77398. 'â“ ' => 'q',
  77399. 'â“¡' => 'r',
  77400. 'â“¢' => 's',
  77401. 'â“£' => 't',
  77402. 'ⓤ' => 'u',
  77403. 'â“¥' => 'v',
  77404. 'ⓦ' => 'w',
  77405. 'ⓧ' => 'x',
  77406. 'ⓨ' => 'y',
  77407. 'â“©' => 'z',
  77408. '⓪' => '0',
  77409. '⨌' => '∫∫∫∫',
  77410. 'â©´' => '::=',
  77411. '⩵' => '==',
  77412. '⩶' => '===',
  77413. 'â±¼' => 'j',
  77414. 'â±½' => 'V',
  77415. 'ⵯ' => 'ⵡ',
  77416. '⺟' => '�',
  77417. '⻳' => '龟',
  77418. '⼀' => '一',
  77419. '�' => '丨',
  77420. '⼂' => '丶',
  77421. '⼃' => '丿',
  77422. '⼄' => '乙',
  77423. '⼅' => '亅',
  77424. '⼆' => '二',
  77425. '⼇' => '亠',
  77426. '⼈' => '人',
  77427. '⼉' => '儿',
  77428. '⼊' => '入',
  77429. '⼋' => '八',
  77430. '⼌' => '冂',
  77431. '�' => '冖',
  77432. '⼎' => '冫',
  77433. '�' => '几',
  77434. '�' => '凵',
  77435. '⼑' => '刀',
  77436. '⼒' => '力',
  77437. '⼓' => '勹',
  77438. '⼔' => '匕',
  77439. '⼕' => '匚',
  77440. '⼖' => '匸',
  77441. '⼗' => '�',
  77442. '⼘' => '�',
  77443. '⼙' => '�',
  77444. '⼚' => '厂',
  77445. '⼛' => '厶',
  77446. '⼜' => '�',
  77447. '�' => '�',
  77448. '⼞' => '囗',
  77449. '⼟' => '土',
  77450. '⼠' => '士',
  77451. '⼡' => '夂',
  77452. '⼢' => '夊',
  77453. '⼣' => '夕',
  77454. '⼤' => '大',
  77455. '⼥' => '女',
  77456. '⼦' => '�',
  77457. '⼧' => '宀',
  77458. '⼨' => '寸',
  77459. '⼩' => '�',
  77460. '⼪' => '尢',
  77461. '⼫' => '尸',
  77462. '⼬' => '屮',
  77463. 'â¼­' => 'å±±',
  77464. 'â¼®' => 'å·›',
  77465. '⼯' => '工',
  77466. 'â¼°' => 'å·±',
  77467. 'â¼±' => 'å·¾',
  77468. 'â¼²' => 'å¹²',
  77469. '⼳' => '幺',
  77470. '⼴' => '广',
  77471. 'â¼µ' => 'å»´',
  77472. '⼶' => '廾',
  77473. '⼷' => '弋',
  77474. '⼸' => '弓',
  77475. '⼹' => '�',
  77476. '⼺' => '彡',
  77477. 'â¼»' => 'å½³',
  77478. '⼼' => '心',
  77479. '⼽' => '戈',
  77480. '⼾' => '戶',
  77481. '⼿' => '手',
  77482. '⽀' => '支',
  77483. '�' => '攴',
  77484. '⽂' => '文',
  77485. '⽃' => '斗',
  77486. '⽄' => '斤',
  77487. 'â½…' => 'æ–¹',
  77488. '⽆' => '无',
  77489. '⽇' => '日',
  77490. '⽈' => '曰',
  77491. '⽉' => '月',
  77492. '⽊' => '木',
  77493. '⽋' => '欠',
  77494. '⽌' => '止',
  77495. '�' => '歹',
  77496. '⽎' => '殳',
  77497. '�' => '毋',
  77498. '�' => '比',
  77499. '⽑' => '毛',
  77500. 'â½’' => 'æ°�',
  77501. '⽓' => '气',
  77502. 'â½”' => 'æ°´',
  77503. '⽕' => '�',
  77504. '⽖' => '爪',
  77505. '⽗' => '父',
  77506. '⽘' => '爻',
  77507. '⽙' => '爿',
  77508. '⽚' => '片',
  77509. '⽛' => '牙',
  77510. '⽜' => '牛',
  77511. '�' => '犬',
  77512. '⽞' => '玄',
  77513. '⽟' => '玉',
  77514. '⽠' => '瓜',
  77515. '⽡' => '瓦',
  77516. '⽢' => '甘',
  77517. '⽣' => '生',
  77518. '⽤' => '用',
  77519. 'â½¥' => 'ç”°',
  77520. '⽦' => '疋',
  77521. '⽧' => '疒',
  77522. '⽨' => '癶',
  77523. '⽩' => '白',
  77524. '⽪' => '皮',
  77525. '⽫' => '皿',
  77526. '⽬' => '目',
  77527. '⽭' => '矛',
  77528. '⽮' => '矢',
  77529. '⽯' => '石',
  77530. '⽰' => '示',
  77531. '⽱' => '禸',
  77532. '⽲' => '禾',
  77533. 'â½³' => 'ç©´',
  77534. 'â½´' => 'ç«‹',
  77535. '⽵' => '竹',
  77536. '⽶' => '米',
  77537. '⽷' => '糸',
  77538. '⽸' => '缶',
  77539. '⽹' => '网',
  77540. '⽺' => '羊',
  77541. 'â½»' => 'ç¾½',
  77542. '⽼' => '�',
  77543. '⽽' => '而',
  77544. '⽾' => '耒',
  77545. '⽿' => '耳',
  77546. '⾀' => '�',
  77547. '�' => '肉',
  77548. '⾂' => '臣',
  77549. '⾃' => '自',
  77550. '⾄' => '至',
  77551. '⾅' => '臼',
  77552. '⾆' => '舌',
  77553. '⾇' => '舛',
  77554. '⾈' => '舟',
  77555. '⾉' => '艮',
  77556. '⾊' => '色',
  77557. '⾋' => '艸',
  77558. '⾌' => '�',
  77559. '�' => '虫',
  77560. '⾎' => '血',
  77561. '�' => '行',
  77562. '�' => '衣',
  77563. '⾑' => '襾',
  77564. '⾒' => '見',
  77565. '⾓' => '角',
  77566. '⾔' => '言',
  77567. '⾕' => '谷',
  77568. '⾖' => '豆',
  77569. '⾗' => '豕',
  77570. '⾘' => '豸',
  77571. '⾙' => '�',
  77572. '⾚' => '赤',
  77573. 'â¾›' => 'èµ°',
  77574. '⾜' => '足',
  77575. '�' => '身',
  77576. '⾞' => '車',
  77577. '⾟' => '辛',
  77578. 'â¾ ' => 'è¾°',
  77579. '⾡' => '辵',
  77580. 'â¾¢' => 'é‚‘',
  77581. 'â¾£' => 'é…‰',
  77582. '⾤' => '釆',
  77583. '⾥' => '里',
  77584. '⾦' => '金',
  77585. '⾧' => '長',
  77586. '⾨' => '門',
  77587. '⾩' => '阜',
  77588. '⾪' => '隶',
  77589. '⾫' => '隹',
  77590. '⾬' => '雨',
  77591. '⾭' => '�',
  77592. '⾮' => '�',
  77593. '⾯' => '�',
  77594. '⾰' => '�',
  77595. '⾱' => '韋',
  77596. '⾲' => '韭',
  77597. '⾳' => '音',
  77598. 'â¾´' => 'é �',
  77599. '⾵' => '風',
  77600. '⾶' => '飛',
  77601. '⾷' => '食',
  77602. '⾸' => '首',
  77603. '⾹' => '香',
  77604. '⾺' => '馬',
  77605. '⾻' => '骨',
  77606. '⾼' => '高',
  77607. 'â¾½' => 'é«Ÿ',
  77608. '⾾' => '鬥',
  77609. '⾿' => '鬯',
  77610. '⿀' => '鬲',
  77611. '�' => '鬼',
  77612. 'â¿‚' => 'é­š',
  77613. '⿃' => '鳥',
  77614. 'â¿„' => 'é¹µ',
  77615. '⿅' => '鹿',
  77616. '⿆' => '麥',
  77617. '⿇' => '麻',
  77618. '⿈' => '黃',
  77619. '⿉' => '�',
  77620. '⿊' => '黑',
  77621. '⿋' => '黹',
  77622. '⿌' => '黽',
  77623. '�' => '鼎',
  77624. '⿎' => '鼓',
  77625. '�' => '鼠',
  77626. '�' => '鼻',
  77627. '⿑' => '齊',
  77628. 'â¿’' => 'é½’',
  77629. '⿓' => '�',
  77630. '⿔' => '龜',
  77631. 'â¿•' => 'é¾ ',
  77632. ' ' => ' ',
  77633. '〶' => '〒',
  77634. '〸' => '�',
  77635. '〹' => '�',
  77636. '〺' => '�',
  77637. 'ã‚›' => ' ã‚™',
  77638. '゜' => ' ゚',
  77639. 'ゟ' => 'より',
  77640. 'ヿ' => 'コト',
  77641. 'ㄱ' => 'ᄀ',
  77642. 'ㄲ' => '�',
  77643. 'ㄳ' => 'ᆪ',
  77644. 'ã„´' => 'á„‚',
  77645. 'ㄵ' => 'ᆬ',
  77646. 'ㄶ' => 'ᆭ',
  77647. 'ㄷ' => 'ᄃ',
  77648. 'ㄸ' => 'ᄄ',
  77649. 'ㄹ' => 'ᄅ',
  77650. 'ㄺ' => 'ᆰ',
  77651. 'ㄻ' => 'ᆱ',
  77652. 'ㄼ' => 'ᆲ',
  77653. 'ㄽ' => 'ᆳ',
  77654. 'ㄾ' => 'ᆴ',
  77655. 'ㄿ' => 'ᆵ',
  77656. 'ã…€' => 'á„š',
  77657. '�' => 'ᄆ',
  77658. 'ㅂ' => 'ᄇ',
  77659. 'ㅃ' => 'ᄈ',
  77660. 'ã…„' => 'á„¡',
  77661. 'ㅅ' => 'ᄉ',
  77662. 'ã…†' => 'á„Š',
  77663. 'ã…‡' => 'á„‹',
  77664. 'ㅈ' => 'ᄌ',
  77665. 'ㅉ' => '�',
  77666. 'ã…Š' => 'á„Ž',
  77667. 'ㅋ' => '�',
  77668. 'ㅌ' => '�',
  77669. 'ã…�' => 'á„‘',
  77670. 'ã…Ž' => 'á„’',
  77671. 'ã…�' => 'á…¡',
  77672. 'ã…�' => 'á…¢',
  77673. 'ã…‘' => 'á…£',
  77674. 'ã…’' => 'á…¤',
  77675. 'ã…“' => 'á…¥',
  77676. 'ã…”' => 'á…¦',
  77677. 'ã…•' => 'á…§',
  77678. 'ã…–' => 'á…¨',
  77679. 'ã…—' => 'á…©',
  77680. 'ã…˜' => 'á…ª',
  77681. 'ã…™' => 'á…«',
  77682. 'ã…š' => 'á…¬',
  77683. 'ã…›' => 'á…­',
  77684. 'ㅜ' => 'ᅮ',
  77685. 'ã…�' => 'á…¯',
  77686. 'ã…ž' => 'á…°',
  77687. 'ã…Ÿ' => 'á…±',
  77688. 'ã… ' => 'á…²',
  77689. 'ã…¡' => 'á…³',
  77690. 'ã…¢' => 'á…´',
  77691. 'ã…£' => 'á…µ',
  77692. 'ã…¤' => 'á… ',
  77693. 'ã…¥' => 'á„”',
  77694. 'ã…¦' => 'á„•',
  77695. 'ㅧ' => 'ᇇ',
  77696. 'ㅨ' => 'ᇈ',
  77697. 'ㅩ' => 'ᇌ',
  77698. 'ㅪ' => 'ᇎ',
  77699. 'ㅫ' => 'ᇓ',
  77700. 'ㅬ' => 'ᇗ',
  77701. 'ㅭ' => 'ᇙ',
  77702. 'ㅮ' => 'ᄜ',
  77703. 'ㅯ' => '�',
  77704. 'ㅰ' => 'ᇟ',
  77705. 'ㅱ' => '�',
  77706. 'ã…²' => 'á„ž',
  77707. 'ã…³' => 'á„ ',
  77708. 'ã…´' => 'á„¢',
  77709. 'ã…µ' => 'á„£',
  77710. 'ㅶ' => 'ᄧ',
  77711. 'ã…·' => 'á„©',
  77712. 'ã…¸' => 'á„«',
  77713. 'ㅹ' => 'ᄬ',
  77714. 'ã…º' => 'á„­',
  77715. 'ã…»' => 'á„®',
  77716. 'ㅼ' => 'ᄯ',
  77717. 'ㅽ' => 'ᄲ',
  77718. 'ㅾ' => 'ᄶ',
  77719. 'ã…¿' => 'á…€',
  77720. 'ㆀ' => 'ᅇ',
  77721. '�' => 'ᅌ',
  77722. 'ㆂ' => 'ᇱ',
  77723. 'ㆃ' => 'ᇲ',
  77724. 'ㆄ' => 'ᅗ',
  77725. 'ㆅ' => 'ᅘ',
  77726. 'ㆆ' => 'ᅙ',
  77727. 'ㆇ' => 'ᆄ',
  77728. 'ㆈ' => 'ᆅ',
  77729. 'ㆉ' => 'ᆈ',
  77730. 'ㆊ' => 'ᆑ',
  77731. 'ㆋ' => 'ᆒ',
  77732. 'ㆌ' => 'ᆔ',
  77733. '�' => 'ᆞ',
  77734. 'ㆎ' => 'ᆡ',
  77735. '㆒' => '一',
  77736. '㆓' => '二',
  77737. '㆔' => '三',
  77738. '㆕' => '四',
  77739. '㆖' => '上',
  77740. '㆗' => '中',
  77741. '㆘' => '下',
  77742. '㆙' => '甲',
  77743. '㆚' => '乙',
  77744. '㆛' => '丙',
  77745. '㆜' => '�',
  77746. '�' => '天',
  77747. '㆞' => '地',
  77748. '㆟' => '人',
  77749. '㈀' => '(ᄀ)',
  77750. '�' => '(ᄂ)',
  77751. '㈂' => '(ᄃ)',
  77752. '㈃' => '(ᄅ)',
  77753. '㈄' => '(ᄆ)',
  77754. '㈅' => '(ᄇ)',
  77755. '㈆' => '(ᄉ)',
  77756. '㈇' => '(ᄋ)',
  77757. '㈈' => '(ᄌ)',
  77758. '㈉' => '(ᄎ)',
  77759. '㈊' => '(�)',
  77760. '㈋' => '(�)',
  77761. '㈌' => '(ᄑ)',
  77762. '�' => '(ᄒ)',
  77763. '㈎' => '(가)',
  77764. '�' => '(나)',
  77765. '�' => '(다)',
  77766. '㈑' => '(라)',
  77767. '㈒' => '(마)',
  77768. '㈓' => '(바)',
  77769. '㈔' => '(사)',
  77770. '㈕' => '(아)',
  77771. '㈖' => '(자)',
  77772. '㈗' => '(차)',
  77773. '㈘' => '(�ᅡ)',
  77774. '㈙' => '(�ᅡ)',
  77775. '㈚' => '(파)',
  77776. '㈛' => '(하)',
  77777. '㈜' => '(주)',
  77778. '�' => '(오전)',
  77779. '㈞' => '(오후)',
  77780. '㈠' => '(一)',
  77781. '㈡' => '(二)',
  77782. '㈢' => '(三)',
  77783. '㈣' => '(四)',
  77784. '㈤' => '(五)',
  77785. '㈥' => '(六)',
  77786. '㈦' => '(七)',
  77787. '㈧' => '(八)',
  77788. '㈨' => '(�)',
  77789. '㈩' => '(�)',
  77790. '㈪' => '(月)',
  77791. '㈫' => '(�)',
  77792. '㈬' => '(水)',
  77793. '㈭' => '(木)',
  77794. '㈮' => '(金)',
  77795. '㈯' => '(土)',
  77796. '㈰' => '(日)',
  77797. '㈱' => '(株)',
  77798. '㈲' => '(有)',
  77799. '㈳' => '(社)',
  77800. '㈴' => '(�)',
  77801. '㈵' => '(特)',
  77802. '㈶' => '(財)',
  77803. '㈷' => '(�)',
  77804. '㈸' => '(労)',
  77805. '㈹' => '(代)',
  77806. '㈺' => '(呼)',
  77807. '㈻' => '(学)',
  77808. '㈼' => '(監)',
  77809. '㈽' => '(�)',
  77810. '㈾' => '(資)',
  77811. '㈿' => '(�)',
  77812. '㉀' => '(祭)',
  77813. '�' => '(休)',
  77814. '㉂' => '(自)',
  77815. '㉃' => '(至)',
  77816. '㉄' => '�',
  77817. '㉅' => '幼',
  77818. '㉆' => '文',
  77819. '㉇' => '�',
  77820. '�' => 'PTE',
  77821. '㉑' => '21',
  77822. '㉒' => '22',
  77823. '㉓' => '23',
  77824. '㉔' => '24',
  77825. '㉕' => '25',
  77826. '㉖' => '26',
  77827. '㉗' => '27',
  77828. '㉘' => '28',
  77829. '㉙' => '29',
  77830. '㉚' => '30',
  77831. '㉛' => '31',
  77832. '㉜' => '32',
  77833. '�' => '33',
  77834. '㉞' => '34',
  77835. '㉟' => '35',
  77836. '㉠' => 'ᄀ',
  77837. '㉡' => 'ᄂ',
  77838. '㉢' => 'ᄃ',
  77839. '㉣' => 'ᄅ',
  77840. '㉤' => 'ᄆ',
  77841. '㉥' => 'ᄇ',
  77842. '㉦' => 'ᄉ',
  77843. '㉧' => 'ᄋ',
  77844. '㉨' => 'ᄌ',
  77845. '㉩' => 'ᄎ',
  77846. '㉪' => '�',
  77847. '㉫' => '�',
  77848. '㉬' => 'ᄑ',
  77849. '㉭' => 'ᄒ',
  77850. '㉮' => '가',
  77851. '㉯' => '나',
  77852. '㉰' => '다',
  77853. '㉱' => '라',
  77854. '㉲' => '마',
  77855. '㉳' => '바',
  77856. '㉴' => '사',
  77857. '㉵' => '아',
  77858. '㉶' => '자',
  77859. '㉷' => '차',
  77860. '㉸' => '�ᅡ',
  77861. '㉹' => '�ᅡ',
  77862. '㉺' => '파',
  77863. '㉻' => '하',
  77864. '㉼' => '참고',
  77865. '㉽' => '주의',
  77866. '㉾' => '우',
  77867. '㊀' => '一',
  77868. '�' => '二',
  77869. '㊂' => '三',
  77870. '㊃' => '四',
  77871. '㊄' => '五',
  77872. '㊅' => '六',
  77873. '㊆' => '七',
  77874. '㊇' => '八',
  77875. '㊈' => '�',
  77876. '㊉' => '�',
  77877. '㊊' => '月',
  77878. '㊋' => '�',
  77879. '㊌' => '水',
  77880. '�' => '木',
  77881. '㊎' => '金',
  77882. '�' => '土',
  77883. '�' => '日',
  77884. '㊑' => '株',
  77885. '㊒' => '有',
  77886. '㊓' => '社',
  77887. '㊔' => '�',
  77888. '㊕' => '特',
  77889. '㊖' => '財',
  77890. '㊗' => '�',
  77891. '㊘' => '労',
  77892. '㊙' => '秘',
  77893. '㊚' => '男',
  77894. '㊛' => '女',
  77895. '㊜' => '�',
  77896. '�' => '優',
  77897. '㊞' => '�',
  77898. '㊟' => '注',
  77899. '㊠' => '項',
  77900. '㊡' => '休',
  77901. '㊢' => '写',
  77902. '㊣' => '正',
  77903. '㊤' => '上',
  77904. '㊥' => '中',
  77905. '㊦' => '下',
  77906. '㊧' => '左',
  77907. '㊨' => '�',
  77908. '㊩' => '医',
  77909. '㊪' => '宗',
  77910. '㊫' => '学',
  77911. '㊬' => '監',
  77912. '㊭' => '�',
  77913. '㊮' => '資',
  77914. '㊯' => '�',
  77915. '㊰' => '夜',
  77916. '㊱' => '36',
  77917. '㊲' => '37',
  77918. '㊳' => '38',
  77919. '㊴' => '39',
  77920. '㊵' => '40',
  77921. '㊶' => '41',
  77922. '㊷' => '42',
  77923. '㊸' => '43',
  77924. '㊹' => '44',
  77925. '㊺' => '45',
  77926. '㊻' => '46',
  77927. '㊼' => '47',
  77928. '㊽' => '48',
  77929. '㊾' => '49',
  77930. '㊿' => '50',
  77931. '㋀' => '1月',
  77932. '�' => '2月',
  77933. '㋂' => '3月',
  77934. '㋃' => '4月',
  77935. '㋄' => '5月',
  77936. '㋅' => '6月',
  77937. '㋆' => '7月',
  77938. '㋇' => '8月',
  77939. '㋈' => '9月',
  77940. '㋉' => '10月',
  77941. '㋊' => '11月',
  77942. '㋋' => '12月',
  77943. '㋌' => 'Hg',
  77944. '�' => 'erg',
  77945. 'ã‹Ž' => 'eV',
  77946. '�' => 'LTD',
  77947. '�' => 'ア',
  77948. '㋑' => 'イ',
  77949. '㋒' => 'ウ',
  77950. '㋓' => 'エ',
  77951. '㋔' => 'オ',
  77952. 'ã‹•' => 'ã‚«',
  77953. 'ã‹–' => 'ã‚­',
  77954. '㋗' => 'ク',
  77955. '㋘' => 'ケ',
  77956. '㋙' => 'コ',
  77957. '㋚' => 'サ',
  77958. 'ã‹›' => 'ã‚·',
  77959. '㋜' => 'ス',
  77960. '�' => 'セ',
  77961. '㋞' => 'ソ',
  77962. 'ã‹Ÿ' => 'ã‚¿',
  77963. '㋠' => '�',
  77964. '㋡' => 'ツ',
  77965. '㋢' => 'テ',
  77966. '㋣' => 'ト',
  77967. '㋤' => 'ナ',
  77968. '㋥' => 'ニ',
  77969. '㋦' => 'ヌ',
  77970. '㋧' => '�',
  77971. '㋨' => 'ノ',
  77972. '㋩' => '�',
  77973. '㋪' => 'ヒ',
  77974. '㋫' => 'フ',
  77975. '㋬' => 'ヘ',
  77976. '㋭' => 'ホ',
  77977. '㋮' => 'マ',
  77978. '㋯' => 'ミ',
  77979. '㋰' => 'ム',
  77980. '㋱' => 'メ',
  77981. '㋲' => 'モ',
  77982. '㋳' => 'ヤ',
  77983. '㋴' => 'ユ',
  77984. '㋵' => 'ヨ',
  77985. '㋶' => 'ラ',
  77986. '㋷' => 'リ',
  77987. '㋸' => 'ル',
  77988. '㋹' => 'レ',
  77989. '㋺' => 'ロ',
  77990. '㋻' => 'ワ',
  77991. '㋼' => 'ヰ',
  77992. '㋽' => 'ヱ',
  77993. '㋾' => 'ヲ',
  77994. '㋿' => '令和',
  77995. '㌀' => 'ア�゚ート',
  77996. '�' => 'アルファ',
  77997. '㌂' => 'アンペア',
  77998. '㌃' => 'アール',
  77999. '㌄' => 'イニング',
  78000. '㌅' => 'イン�',
  78001. '㌆' => 'ウォン',
  78002. '㌇' => 'エスクード',
  78003. '㌈' => 'エーカー',
  78004. '㌉' => 'オンス',
  78005. '㌊' => 'オーム',
  78006. '㌋' => 'カイリ',
  78007. '㌌' => 'カラット',
  78008. '�' => 'カロリー',
  78009. '㌎' => 'ガロン',
  78010. '�' => 'ガンマ',
  78011. '�' => 'ギガ',
  78012. '㌑' => 'ギニー',
  78013. '㌒' => 'キュリー',
  78014. '㌓' => 'ギルダー',
  78015. '㌔' => 'キロ',
  78016. '㌕' => 'キログラム',
  78017. '㌖' => 'キロメートル',
  78018. '㌗' => 'キロワット',
  78019. '㌘' => 'グラム',
  78020. '㌙' => 'グラムトン',
  78021. '㌚' => 'クルゼイロ',
  78022. '㌛' => 'クロー�',
  78023. '㌜' => 'ケース',
  78024. '�' => 'コルナ',
  78025. '㌞' => 'コーポ',
  78026. '㌟' => 'サイクル',
  78027. '㌠' => 'サン�ーム',
  78028. '㌡' => 'シリング',
  78029. '㌢' => 'セン�',
  78030. '㌣' => 'セント',
  78031. '㌤' => 'ダース',
  78032. '㌥' => 'デシ',
  78033. '㌦' => 'ドル',
  78034. '㌧' => 'トン',
  78035. '㌨' => 'ナノ',
  78036. '㌩' => 'ノット',
  78037. '㌪' => '�イツ',
  78038. '㌫' => '�゚ーセント',
  78039. '㌬' => '�゚ーツ',
  78040. '㌭' => '�゙ーレル',
  78041. '㌮' => 'ピアストル',
  78042. '㌯' => 'ピクル',
  78043. '㌰' => 'ピコ',
  78044. '㌱' => 'ビル',
  78045. '㌲' => 'ファラッド',
  78046. '㌳' => 'フィート',
  78047. '㌴' => 'ブッシェル',
  78048. '㌵' => 'フラン',
  78049. '㌶' => 'ヘクタール',
  78050. '㌷' => 'ペソ',
  78051. '㌸' => 'ペニヒ',
  78052. '㌹' => 'ヘルツ',
  78053. '㌺' => 'ペンス',
  78054. '㌻' => 'ページ',
  78055. '㌼' => 'ベータ',
  78056. '㌽' => 'ポイント',
  78057. '㌾' => 'ボルト',
  78058. '㌿' => 'ホン',
  78059. '�' => 'ポンド',
  78060. '�' => 'ホール',
  78061. '�' => 'ホーン',
  78062. '�' => 'マイクロ',
  78063. '�' => 'マイル',
  78064. '�' => 'マッ�',
  78065. '�' => 'マルク',
  78066. '�' => 'マンション',
  78067. '�' => 'ミクロン',
  78068. '�' => 'ミリ',
  78069. '�' => 'ミリ�゙ール',
  78070. '�' => 'メガ',
  78071. '�' => 'メガトン',
  78072. '�' => 'メートル',
  78073. '�' => 'ヤード',
  78074. '�' => 'ヤール',
  78075. '�' => 'ユアン',
  78076. '�' => 'リットル',
  78077. '�' => 'リラ',
  78078. '�' => 'ルピー',
  78079. '�' => 'ルーブル',
  78080. '�' => 'レム',
  78081. '�' => 'レントゲン',
  78082. '�' => 'ワット',
  78083. '�' => '0点',
  78084. '�' => '1点',
  78085. '�' => '2点',
  78086. '�' => '3点',
  78087. '�' => '4点',
  78088. '�' => '5点',
  78089. '�' => '6点',
  78090. '�' => '7点',
  78091. '�' => '8点',
  78092. '�' => '9点',
  78093. '�' => '10点',
  78094. '�' => '11点',
  78095. '�' => '12点',
  78096. '�' => '13点',
  78097. '�' => '14点',
  78098. '�' => '15点',
  78099. '�' => '16点',
  78100. '�' => '17点',
  78101. '�' => '18点',
  78102. '�' => '19点',
  78103. '�' => '20点',
  78104. '�' => '21点',
  78105. '�' => '22点',
  78106. '�' => '23点',
  78107. '�' => '24点',
  78108. '�' => 'hPa',
  78109. '�' => 'da',
  78110. '�' => 'AU',
  78111. '�' => 'bar',
  78112. '�' => 'oV',
  78113. '�' => 'pc',
  78114. '�' => 'dm',
  78115. '�' => 'dm2',
  78116. '�' => 'dm3',
  78117. '�' => 'IU',
  78118. '�' => '平�',
  78119. '�' => '昭和',
  78120. '�' => '大正',
  78121. '�' => '明治',
  78122. '�' => '株�会社',
  78123. '㎀' => 'pA',
  78124. '�' => 'nA',
  78125. '㎂' => 'μA',
  78126. '㎃' => 'mA',
  78127. '㎄' => 'kA',
  78128. '㎅' => 'KB',
  78129. '㎆' => 'MB',
  78130. '㎇' => 'GB',
  78131. '㎈' => 'cal',
  78132. '㎉' => 'kcal',
  78133. '㎊' => 'pF',
  78134. '㎋' => 'nF',
  78135. '㎌' => 'μF',
  78136. '�' => 'μg',
  78137. '㎎' => 'mg',
  78138. '�' => 'kg',
  78139. '�' => 'Hz',
  78140. '㎑' => 'kHz',
  78141. '㎒' => 'MHz',
  78142. '㎓' => 'GHz',
  78143. '㎔' => 'THz',
  78144. '㎕' => 'μl',
  78145. '㎖' => 'ml',
  78146. '㎗' => 'dl',
  78147. '㎘' => 'kl',
  78148. '㎙' => 'fm',
  78149. '㎚' => 'nm',
  78150. '㎛' => 'μm',
  78151. '㎜' => 'mm',
  78152. '�' => 'cm',
  78153. '㎞' => 'km',
  78154. '㎟' => 'mm2',
  78155. '㎠' => 'cm2',
  78156. '㎡' => 'm2',
  78157. '㎢' => 'km2',
  78158. '㎣' => 'mm3',
  78159. '㎤' => 'cm3',
  78160. '㎥' => 'm3',
  78161. '㎦' => 'km3',
  78162. '㎧' => 'm∕s',
  78163. '㎨' => 'm∕s2',
  78164. '㎩' => 'Pa',
  78165. '㎪' => 'kPa',
  78166. '㎫' => 'MPa',
  78167. '㎬' => 'GPa',
  78168. '㎭' => 'rad',
  78169. '㎮' => 'rad∕s',
  78170. '㎯' => 'rad∕s2',
  78171. '㎰' => 'ps',
  78172. '㎱' => 'ns',
  78173. '㎲' => 'μs',
  78174. '㎳' => 'ms',
  78175. '㎴' => 'pV',
  78176. '㎵' => 'nV',
  78177. '㎶' => 'μV',
  78178. '㎷' => 'mV',
  78179. '㎸' => 'kV',
  78180. '㎹' => 'MV',
  78181. '㎺' => 'pW',
  78182. '㎻' => 'nW',
  78183. '㎼' => 'μW',
  78184. '㎽' => 'mW',
  78185. '㎾' => 'kW',
  78186. '㎿' => 'MW',
  78187. '�' => 'kΩ',
  78188. '�' => 'MΩ',
  78189. '�' => 'a.m.',
  78190. '�' => 'Bq',
  78191. '�' => 'cc',
  78192. '�' => 'cd',
  78193. '�' => 'C∕kg',
  78194. '�' => 'Co.',
  78195. '�' => 'dB',
  78196. '�' => 'Gy',
  78197. '�' => 'ha',
  78198. '�' => 'HP',
  78199. '�' => 'in',
  78200. '�' => 'KK',
  78201. '�' => 'KM',
  78202. '�' => 'kt',
  78203. '�' => 'lm',
  78204. '�' => 'ln',
  78205. '�' => 'log',
  78206. '�' => 'lx',
  78207. '�' => 'mb',
  78208. '�' => 'mil',
  78209. '�' => 'mol',
  78210. '�' => 'PH',
  78211. '�' => 'p.m.',
  78212. '�' => 'PPM',
  78213. '�' => 'PR',
  78214. '�' => 'sr',
  78215. '�' => 'Sv',
  78216. '�' => 'Wb',
  78217. '�' => 'V∕m',
  78218. '�' => 'A∕m',
  78219. '�' => '1日',
  78220. '�' => '2日',
  78221. '�' => '3日',
  78222. '�' => '4日',
  78223. '�' => '5日',
  78224. '�' => '6日',
  78225. '�' => '7日',
  78226. '�' => '8日',
  78227. '�' => '9日',
  78228. '�' => '10日',
  78229. '�' => '11日',
  78230. '�' => '12日',
  78231. '�' => '13日',
  78232. '�' => '14日',
  78233. '�' => '15日',
  78234. '�' => '16日',
  78235. '�' => '17日',
  78236. '�' => '18日',
  78237. '�' => '19日',
  78238. '�' => '20日',
  78239. '�' => '21日',
  78240. '�' => '22日',
  78241. '�' => '23日',
  78242. '�' => '24日',
  78243. '�' => '25日',
  78244. '�' => '26日',
  78245. '�' => '27日',
  78246. '�' => '28日',
  78247. '�' => '29日',
  78248. '�' => '30日',
  78249. '�' => '31日',
  78250. '�' => 'gal',
  78251. 'ꚜ' => 'ъ',
  78252. '�' => 'ь',
  78253. '�' => '�',
  78254. 'ꟸ' => 'Ħ',
  78255. 'ꟹ' => 'œ',
  78256. 'ꭜ' => 'ꜧ',
  78257. '�' => 'ꬷ',
  78258. 'ê­ž' => 'É«',
  78259. 'ê­Ÿ' => 'ê­’',
  78260. 'ꭩ' => '�',
  78261. 'ff' => 'ff',
  78262. '�' => 'fi',
  78263. 'fl' => 'fl',
  78264. 'ffi' => 'ffi',
  78265. 'ffl' => 'ffl',
  78266. 'ſt' => 'st',
  78267. 'st' => 'st',
  78268. 'ﬓ' => 'մն',
  78269. 'ﬔ' => 'մե',
  78270. 'ﬕ' => 'մի',
  78271. 'ﬖ' => 'վն',
  78272. 'ﬗ' => 'մխ',
  78273. 'ﬠ' => 'ע',
  78274. 'ﬡ' => '�',
  78275. 'ﬢ' => 'ד',
  78276. 'ﬣ' => 'ה',
  78277. 'ﬤ' => 'כ',
  78278. 'ﬥ' => 'ל',
  78279. 'ﬦ' => '�',
  78280. 'ﬧ' => 'ר',
  78281. 'ﬨ' => 'ת',
  78282. '﬩' => '+',
  78283. '�' => '�ל',
  78284. 'ï­�' => 'Ù±',
  78285. 'ï­‘' => 'Ù±',
  78286. 'ï­’' => 'Ù»',
  78287. 'ï­“' => 'Ù»',
  78288. 'ï­”' => 'Ù»',
  78289. 'ï­•' => 'Ù»',
  78290. 'ï­–' => 'Ù¾',
  78291. 'ï­—' => 'Ù¾',
  78292. 'ï­˜' => 'Ù¾',
  78293. 'ï­™' => 'Ù¾',
  78294. 'ï­š' => 'Ú€',
  78295. 'ï­›' => 'Ú€',
  78296. 'ﭜ' => 'ڀ',
  78297. 'ï­�' => 'Ú€',
  78298. 'ï­ž' => 'Ùº',
  78299. 'ï­Ÿ' => 'Ùº',
  78300. 'ï­ ' => 'Ùº',
  78301. 'ï­¡' => 'Ùº',
  78302. 'ï­¢' => 'Ù¿',
  78303. 'ï­£' => 'Ù¿',
  78304. 'ï­¤' => 'Ù¿',
  78305. 'ï­¥' => 'Ù¿',
  78306. 'ï­¦' => 'Ù¹',
  78307. 'ï­§' => 'Ù¹',
  78308. 'ï­¨' => 'Ù¹',
  78309. 'ï­©' => 'Ù¹',
  78310. 'ï­ª' => 'Ú¤',
  78311. 'ï­«' => 'Ú¤',
  78312. 'ï­¬' => 'Ú¤',
  78313. 'ï­­' => 'Ú¤',
  78314. 'ï­®' => 'Ú¦',
  78315. 'ï­¯' => 'Ú¦',
  78316. 'ï­°' => 'Ú¦',
  78317. 'ï­±' => 'Ú¦',
  78318. 'ï­²' => 'Ú„',
  78319. 'ï­³' => 'Ú„',
  78320. 'ï­´' => 'Ú„',
  78321. 'ï­µ' => 'Ú„',
  78322. 'ï­¶' => 'Úƒ',
  78323. 'ï­·' => 'Úƒ',
  78324. 'ï­¸' => 'Úƒ',
  78325. 'ï­¹' => 'Úƒ',
  78326. 'ï­º' => 'Ú†',
  78327. 'ï­»' => 'Ú†',
  78328. 'ï­¼' => 'Ú†',
  78329. 'ï­½' => 'Ú†',
  78330. 'ï­¾' => 'Ú‡',
  78331. 'ï­¿' => 'Ú‡',
  78332. 'ﮀ' => 'ڇ',
  78333. '�' => 'ڇ',
  78334. 'ﮂ' => '�',
  78335. 'ﮃ' => '�',
  78336. 'ﮄ' => 'ڌ',
  78337. 'ﮅ' => 'ڌ',
  78338. 'ﮆ' => 'ڎ',
  78339. 'ﮇ' => 'ڎ',
  78340. 'ﮈ' => 'ڈ',
  78341. 'ﮉ' => 'ڈ',
  78342. 'ﮊ' => 'ژ',
  78343. 'ﮋ' => 'ژ',
  78344. 'ﮌ' => 'ڑ',
  78345. '�' => 'ڑ',
  78346. 'ﮎ' => 'ک',
  78347. '�' => 'ک',
  78348. '�' => 'ک',
  78349. 'ﮑ' => 'ک',
  78350. 'ï®’' => 'Ú¯',
  78351. 'ﮓ' => 'گ',
  78352. 'ï®”' => 'Ú¯',
  78353. 'ﮕ' => 'گ',
  78354. 'ï®–' => 'Ú³',
  78355. 'ï®—' => 'Ú³',
  78356. 'ﮘ' => 'ڳ',
  78357. 'ï®™' => 'Ú³',
  78358. 'ﮚ' => 'ڱ',
  78359. 'ï®›' => 'Ú±',
  78360. 'ﮜ' => 'ڱ',
  78361. '�' => 'ڱ',
  78362. 'ﮞ' => 'ں',
  78363. 'ﮟ' => 'ں',
  78364. 'ï® ' => 'Ú»',
  78365. 'ﮡ' => 'ڻ',
  78366. 'ﮢ' => 'ڻ',
  78367. 'ﮣ' => 'ڻ',
  78368. 'ﮤ' => 'ۀ',
  78369. 'ﮥ' => 'ۀ',
  78370. 'ﮦ' => '�',
  78371. 'ﮧ' => '�',
  78372. 'ﮨ' => '�',
  78373. 'ﮩ' => '�',
  78374. 'ﮪ' => 'ھ',
  78375. 'ﮫ' => 'ھ',
  78376. 'ﮬ' => 'ھ',
  78377. 'ï®­' => 'Ú¾',
  78378. 'ï®®' => 'Û’',
  78379. 'ﮯ' => 'ے',
  78380. 'ï®°' => 'Û’Ù”',
  78381. 'ï®±' => 'Û’Ù”',
  78382. 'ﯓ' => 'ڭ',
  78383. 'ﯔ' => 'ڭ',
  78384. 'ﯕ' => 'ڭ',
  78385. 'ﯖ' => 'ڭ',
  78386. 'ﯗ' => 'ۇ',
  78387. 'ﯘ' => 'ۇ',
  78388. 'ﯙ' => 'ۆ',
  78389. 'ﯚ' => 'ۆ',
  78390. 'ﯛ' => 'ۈ',
  78391. 'ﯜ' => 'ۈ',
  78392. '�' => 'ۇٴ',
  78393. 'ﯞ' => 'ۋ',
  78394. 'ﯟ' => 'ۋ',
  78395. 'ﯠ' => 'ۅ',
  78396. 'ﯡ' => 'ۅ',
  78397. 'ﯢ' => 'ۉ',
  78398. 'ﯣ' => 'ۉ',
  78399. 'ﯤ' => '�',
  78400. 'ﯥ' => '�',
  78401. 'ﯦ' => '�',
  78402. 'ﯧ' => '�',
  78403. 'ﯨ' => 'ى',
  78404. 'ﯩ' => 'ى',
  78405. 'ﯪ' => 'ئا',
  78406. 'ﯫ' => 'ئا',
  78407. 'ﯬ' => 'ئە',
  78408. 'ﯭ' => 'ئە',
  78409. 'ﯮ' => 'ئو',
  78410. 'ﯯ' => 'ئو',
  78411. 'ﯰ' => 'ئۇ',
  78412. 'ﯱ' => 'ئۇ',
  78413. 'ﯲ' => 'ئۆ',
  78414. 'ﯳ' => 'ئۆ',
  78415. 'ﯴ' => 'ئۈ',
  78416. 'ﯵ' => 'ئۈ',
  78417. 'ﯶ' => 'ئ�',
  78418. 'ﯷ' => 'ئ�',
  78419. 'ﯸ' => 'ئ�',
  78420. 'ﯹ' => 'ئى',
  78421. 'ﯺ' => 'ئى',
  78422. 'ﯻ' => 'ئى',
  78423. 'ﯼ' => 'ی',
  78424. 'ﯽ' => 'ی',
  78425. 'ﯾ' => 'ی',
  78426. 'ﯿ' => 'ی',
  78427. 'ﰀ' => 'ئج',
  78428. '�' => 'ئح',
  78429. 'ï°‚' => 'ÙŠÙ”Ù…',
  78430. 'ï°ƒ' => 'ÙŠÙ”Ù‰',
  78431. 'ï°„' => 'ÙŠÙ”ÙŠ',
  78432. 'ﰅ' => 'بج',
  78433. 'ﰆ' => 'بح',
  78434. 'ﰇ' => 'بخ',
  78435. 'ﰈ' => 'بم',
  78436. 'ﰉ' => 'بى',
  78437. 'ﰊ' => 'بي',
  78438. 'ﰋ' => 'تج',
  78439. 'ﰌ' => 'تح',
  78440. '�' => 'تخ',
  78441. 'ﰎ' => 'تم',
  78442. '�' => 'تى',
  78443. '�' => 'تي',
  78444. 'ﰑ' => 'ثج',
  78445. 'ﰒ' => 'ثم',
  78446. 'ﰓ' => 'ثى',
  78447. 'ﰔ' => 'ثي',
  78448. 'ﰕ' => 'جح',
  78449. 'ﰖ' => 'جم',
  78450. 'ﰗ' => 'حج',
  78451. 'ﰘ' => 'حم',
  78452. 'ﰙ' => 'خج',
  78453. 'ﰚ' => 'خح',
  78454. 'ﰛ' => 'خم',
  78455. 'ﰜ' => 'سج',
  78456. '�' => 'سح',
  78457. 'ﰞ' => 'سخ',
  78458. 'ﰟ' => 'سم',
  78459. 'ﰠ' => 'صح',
  78460. 'ﰡ' => 'صم',
  78461. 'ﰢ' => 'ضج',
  78462. 'ﰣ' => 'ضح',
  78463. 'ﰤ' => 'ضخ',
  78464. 'ﰥ' => 'ضم',
  78465. 'ﰦ' => 'طح',
  78466. 'ﰧ' => 'طم',
  78467. 'ﰨ' => 'ظم',
  78468. 'ﰩ' => 'عج',
  78469. 'ﰪ' => 'عم',
  78470. 'ﰫ' => 'غج',
  78471. 'ﰬ' => 'غم',
  78472. 'ﰭ' => '�ج',
  78473. 'ﰮ' => '�ح',
  78474. 'ﰯ' => '�خ',
  78475. 'ﰰ' => '�م',
  78476. 'ﰱ' => '�ى',
  78477. 'ﰲ' => '�ي',
  78478. 'ﰳ' => 'قح',
  78479. 'ﰴ' => 'قم',
  78480. 'ﰵ' => 'قى',
  78481. 'ﰶ' => 'قي',
  78482. 'ﰷ' => 'كا',
  78483. 'ﰸ' => 'كج',
  78484. 'ﰹ' => 'كح',
  78485. 'ﰺ' => 'كخ',
  78486. 'ﰻ' => 'كل',
  78487. 'ﰼ' => 'كم',
  78488. 'ﰽ' => 'كى',
  78489. 'ﰾ' => 'كي',
  78490. 'ﰿ' => 'لج',
  78491. 'ﱀ' => 'لح',
  78492. '�' => 'لخ',
  78493. 'ﱂ' => 'لم',
  78494. 'ﱃ' => 'لى',
  78495. 'ﱄ' => 'لي',
  78496. 'ﱅ' => 'مج',
  78497. 'ﱆ' => 'مح',
  78498. 'ﱇ' => 'مخ',
  78499. 'ﱈ' => 'مم',
  78500. 'ﱉ' => 'مى',
  78501. 'ﱊ' => 'مي',
  78502. 'ﱋ' => 'نج',
  78503. 'ﱌ' => 'نح',
  78504. '�' => 'نخ',
  78505. 'ﱎ' => 'نم',
  78506. '�' => 'نى',
  78507. '�' => 'ني',
  78508. 'ﱑ' => 'هج',
  78509. 'ﱒ' => 'هم',
  78510. 'ﱓ' => 'هى',
  78511. 'ﱔ' => 'هي',
  78512. 'ﱕ' => 'يج',
  78513. 'ﱖ' => 'يح',
  78514. 'ﱗ' => 'يخ',
  78515. 'ﱘ' => 'يم',
  78516. 'ﱙ' => 'يى',
  78517. 'ﱚ' => 'يي',
  78518. 'ﱛ' => 'ذٰ',
  78519. 'ﱜ' => 'رٰ',
  78520. '�' => 'ىٰ',
  78521. 'ﱞ' => ' ٌّ',
  78522. 'ﱟ' => ' �ّ',
  78523. 'ï± ' => ' ÙŽÙ‘',
  78524. 'ﱡ' => ' �ّ',
  78525. 'ﱢ' => ' �ّ',
  78526. 'ﱣ' => ' ّٰ',
  78527. 'ﱤ' => 'ئر',
  78528. 'ﱥ' => 'ئز',
  78529. 'ﱦ' => 'ئم',
  78530. 'ﱧ' => 'ئن',
  78531. 'ﱨ' => 'ئى',
  78532. 'ﱩ' => 'ئي',
  78533. 'ﱪ' => 'بر',
  78534. 'ﱫ' => 'بز',
  78535. 'ﱬ' => 'بم',
  78536. 'ﱭ' => 'بن',
  78537. 'ﱮ' => 'بى',
  78538. 'ﱯ' => 'بي',
  78539. 'ﱰ' => 'تر',
  78540. 'ﱱ' => 'تز',
  78541. 'ﱲ' => 'تم',
  78542. 'ﱳ' => 'تن',
  78543. 'ﱴ' => 'تى',
  78544. 'ﱵ' => 'تي',
  78545. 'ﱶ' => 'ثر',
  78546. 'ﱷ' => 'ثز',
  78547. 'ﱸ' => 'ثم',
  78548. 'ﱹ' => 'ثن',
  78549. 'ﱺ' => 'ثى',
  78550. 'ﱻ' => 'ثي',
  78551. 'ﱼ' => '�ى',
  78552. 'ﱽ' => '�ي',
  78553. 'ﱾ' => 'قى',
  78554. 'ﱿ' => 'قي',
  78555. 'ﲀ' => 'كا',
  78556. '�' => 'كل',
  78557. 'ﲂ' => 'كم',
  78558. 'ﲃ' => 'كى',
  78559. 'ﲄ' => 'كي',
  78560. 'ﲅ' => 'لم',
  78561. 'ﲆ' => 'لى',
  78562. 'ﲇ' => 'لي',
  78563. 'ﲈ' => 'ما',
  78564. 'ﲉ' => 'مم',
  78565. 'ﲊ' => 'نر',
  78566. 'ﲋ' => 'نز',
  78567. 'ﲌ' => 'نم',
  78568. '�' => 'نن',
  78569. 'ﲎ' => 'نى',
  78570. '�' => 'ني',
  78571. '�' => 'ىٰ',
  78572. 'ﲑ' => 'ير',
  78573. 'ﲒ' => 'يز',
  78574. 'ﲓ' => 'يم',
  78575. 'ﲔ' => 'ين',
  78576. 'ﲕ' => 'يى',
  78577. 'ﲖ' => 'يي',
  78578. 'ﲗ' => 'ئج',
  78579. 'ﲘ' => 'ئح',
  78580. 'ﲙ' => 'ئخ',
  78581. 'ﲚ' => 'ئم',
  78582. 'ï²›' => 'ÙŠÙ”Ù‡',
  78583. 'ﲜ' => 'بج',
  78584. '�' => 'بح',
  78585. 'ﲞ' => 'بخ',
  78586. 'ﲟ' => 'بم',
  78587. 'ﲠ' => 'به',
  78588. 'ﲡ' => 'تج',
  78589. 'ﲢ' => 'تح',
  78590. 'ﲣ' => 'تخ',
  78591. 'ﲤ' => 'تم',
  78592. 'ﲥ' => 'ته',
  78593. 'ﲦ' => 'ثم',
  78594. 'ﲧ' => 'جح',
  78595. 'ﲨ' => 'جم',
  78596. 'ﲩ' => 'حج',
  78597. 'ﲪ' => 'حم',
  78598. 'ﲫ' => 'خج',
  78599. 'ﲬ' => 'خم',
  78600. 'ﲭ' => 'سج',
  78601. 'ﲮ' => 'سح',
  78602. 'ﲯ' => 'سخ',
  78603. 'ﲰ' => 'سم',
  78604. 'ﲱ' => 'صح',
  78605. 'ﲲ' => 'صخ',
  78606. 'ﲳ' => 'صم',
  78607. 'ﲴ' => 'ضج',
  78608. 'ﲵ' => 'ضح',
  78609. 'ﲶ' => 'ضخ',
  78610. 'ﲷ' => 'ضم',
  78611. 'ﲸ' => 'طح',
  78612. 'ﲹ' => 'ظم',
  78613. 'ﲺ' => 'عج',
  78614. 'ﲻ' => 'عم',
  78615. 'ﲼ' => 'غج',
  78616. 'ﲽ' => 'غم',
  78617. 'ﲾ' => '�ج',
  78618. 'ﲿ' => '�ح',
  78619. 'ﳀ' => '�خ',
  78620. '�' => '�م',
  78621. 'ﳂ' => 'قح',
  78622. 'ﳃ' => 'قم',
  78623. 'ﳄ' => 'كج',
  78624. 'ﳅ' => 'كح',
  78625. 'ﳆ' => 'كخ',
  78626. 'ﳇ' => 'كل',
  78627. 'ﳈ' => 'كم',
  78628. 'ﳉ' => 'لج',
  78629. 'ﳊ' => 'لح',
  78630. 'ﳋ' => 'لخ',
  78631. 'ﳌ' => 'لم',
  78632. '�' => 'له',
  78633. 'ﳎ' => 'مج',
  78634. '�' => 'مح',
  78635. '�' => 'مخ',
  78636. 'ﳑ' => 'مم',
  78637. 'ﳒ' => 'نج',
  78638. 'ﳓ' => 'نح',
  78639. 'ﳔ' => 'نخ',
  78640. 'ﳕ' => 'نم',
  78641. 'ﳖ' => 'نه',
  78642. 'ﳗ' => 'هج',
  78643. 'ﳘ' => 'هم',
  78644. 'ﳙ' => 'هٰ',
  78645. 'ﳚ' => 'يج',
  78646. 'ﳛ' => 'يح',
  78647. 'ﳜ' => 'يخ',
  78648. '�' => 'يم',
  78649. 'ﳞ' => 'يه',
  78650. 'ﳟ' => 'ئم',
  78651. 'ï³ ' => 'ÙŠÙ”Ù‡',
  78652. 'ﳡ' => 'بم',
  78653. 'ﳢ' => 'به',
  78654. 'ﳣ' => 'تم',
  78655. 'ﳤ' => 'ته',
  78656. 'ﳥ' => 'ثم',
  78657. 'ﳦ' => 'ثه',
  78658. 'ﳧ' => 'سم',
  78659. 'ﳨ' => 'سه',
  78660. 'ﳩ' => 'شم',
  78661. 'ﳪ' => 'شه',
  78662. 'ﳫ' => 'كل',
  78663. 'ﳬ' => 'كم',
  78664. 'ﳭ' => 'لم',
  78665. 'ﳮ' => 'نم',
  78666. 'ﳯ' => 'نه',
  78667. 'ﳰ' => 'يم',
  78668. 'ﳱ' => 'يه',
  78669. 'ï³²' => 'Ù€ÙŽÙ‘',
  78670. 'ﳳ' => 'ـ�ّ',
  78671. 'ﳴ' => 'ـ�ّ',
  78672. 'ﳵ' => 'طى',
  78673. 'ﳶ' => 'طي',
  78674. 'ﳷ' => 'عى',
  78675. 'ﳸ' => 'عي',
  78676. 'ﳹ' => 'غى',
  78677. 'ﳺ' => 'غي',
  78678. 'ﳻ' => 'سى',
  78679. 'ﳼ' => 'سي',
  78680. 'ﳽ' => 'شى',
  78681. 'ﳾ' => 'شي',
  78682. 'ﳿ' => 'حى',
  78683. 'ﴀ' => 'حي',
  78684. '�' => 'جى',
  78685. 'ﴂ' => 'جي',
  78686. 'ﴃ' => 'خى',
  78687. 'ﴄ' => 'خي',
  78688. 'ﴅ' => 'صى',
  78689. 'ﴆ' => 'صي',
  78690. 'ﴇ' => 'ضى',
  78691. 'ﴈ' => 'ضي',
  78692. 'ﴉ' => 'شج',
  78693. 'ﴊ' => 'شح',
  78694. 'ﴋ' => 'شخ',
  78695. 'ﴌ' => 'شم',
  78696. '�' => 'شر',
  78697. 'ﴎ' => 'سر',
  78698. '�' => 'صر',
  78699. '�' => 'ضر',
  78700. 'ﴑ' => 'طى',
  78701. 'ﴒ' => 'طي',
  78702. 'ﴓ' => 'عى',
  78703. 'ﴔ' => 'عي',
  78704. 'ﴕ' => 'غى',
  78705. 'ﴖ' => 'غي',
  78706. 'ﴗ' => 'سى',
  78707. 'ﴘ' => 'سي',
  78708. 'ﴙ' => 'شى',
  78709. 'ﴚ' => 'شي',
  78710. 'ﴛ' => 'حى',
  78711. 'ﴜ' => 'حي',
  78712. '�' => 'جى',
  78713. 'ﴞ' => 'جي',
  78714. 'ﴟ' => 'خى',
  78715. 'ﴠ' => 'خي',
  78716. 'ﴡ' => 'صى',
  78717. 'ﴢ' => 'صي',
  78718. 'ﴣ' => 'ضى',
  78719. 'ﴤ' => 'ضي',
  78720. 'ﴥ' => 'شج',
  78721. 'ﴦ' => 'شح',
  78722. 'ﴧ' => 'شخ',
  78723. 'ﴨ' => 'شم',
  78724. 'ﴩ' => 'شر',
  78725. 'ﴪ' => 'سر',
  78726. 'ﴫ' => 'صر',
  78727. 'ﴬ' => 'ضر',
  78728. 'ﴭ' => 'شج',
  78729. 'ﴮ' => 'شح',
  78730. 'ﴯ' => 'شخ',
  78731. 'ﴰ' => 'شم',
  78732. 'ﴱ' => 'سه',
  78733. 'ﴲ' => 'شه',
  78734. 'ﴳ' => 'طم',
  78735. 'ﴴ' => 'سج',
  78736. 'ﴵ' => 'سح',
  78737. 'ﴶ' => 'سخ',
  78738. 'ﴷ' => 'شج',
  78739. 'ﴸ' => 'شح',
  78740. 'ﴹ' => 'شخ',
  78741. 'ﴺ' => 'طم',
  78742. 'ﴻ' => 'ظم',
  78743. 'ﴼ' => 'اً',
  78744. 'ﴽ' => 'اً',
  78745. '�' => 'تجم',
  78746. 'ﵑ' => 'تحج',
  78747. 'ﵒ' => 'تحج',
  78748. 'ﵓ' => 'تحم',
  78749. 'ﵔ' => 'تخم',
  78750. 'ﵕ' => 'تمج',
  78751. 'ﵖ' => 'تمح',
  78752. 'ﵗ' => 'تمخ',
  78753. 'ﵘ' => 'جمح',
  78754. 'ﵙ' => 'جمح',
  78755. 'ﵚ' => 'حمي',
  78756. 'ﵛ' => 'حمى',
  78757. 'ﵜ' => 'سحج',
  78758. '�' => 'سجح',
  78759. 'ﵞ' => 'سجى',
  78760. 'ﵟ' => 'سمح',
  78761. 'ﵠ' => 'سمح',
  78762. 'ﵡ' => 'سمج',
  78763. 'ﵢ' => 'سمم',
  78764. 'ﵣ' => 'سمم',
  78765. 'ﵤ' => 'صحح',
  78766. 'ﵥ' => 'صحح',
  78767. 'ﵦ' => 'صمم',
  78768. 'ﵧ' => 'شحم',
  78769. 'ﵨ' => 'شحم',
  78770. 'ﵩ' => 'شجي',
  78771. 'ﵪ' => 'شمخ',
  78772. 'ﵫ' => 'شمخ',
  78773. 'ﵬ' => 'شمم',
  78774. 'ﵭ' => 'شمم',
  78775. 'ﵮ' => 'ضحى',
  78776. 'ﵯ' => 'ضخم',
  78777. 'ﵰ' => 'ضخم',
  78778. 'ﵱ' => 'طمح',
  78779. 'ﵲ' => 'طمح',
  78780. 'ﵳ' => 'طمم',
  78781. 'ﵴ' => 'طمي',
  78782. 'ﵵ' => 'عجم',
  78783. 'ﵶ' => 'عمم',
  78784. 'ﵷ' => 'عمم',
  78785. 'ﵸ' => 'عمى',
  78786. 'ﵹ' => 'غمم',
  78787. 'ﵺ' => 'غمي',
  78788. 'ﵻ' => 'غمى',
  78789. 'ﵼ' => '�خم',
  78790. 'ﵽ' => '�خم',
  78791. 'ﵾ' => 'قمح',
  78792. 'ﵿ' => 'قمم',
  78793. 'ﶀ' => 'لحم',
  78794. '�' => 'لحي',
  78795. 'ﶂ' => 'لحى',
  78796. 'ﶃ' => 'لجج',
  78797. 'ﶄ' => 'لجج',
  78798. 'ﶅ' => 'لخم',
  78799. 'ﶆ' => 'لخم',
  78800. 'ﶇ' => 'لمح',
  78801. 'ﶈ' => 'لمح',
  78802. 'ﶉ' => 'محج',
  78803. 'ﶊ' => 'محم',
  78804. 'ﶋ' => 'محي',
  78805. 'ﶌ' => 'مجح',
  78806. '�' => 'مجم',
  78807. 'ﶎ' => 'مخج',
  78808. '�' => 'مخم',
  78809. 'ﶒ' => 'مجخ',
  78810. 'ﶓ' => 'همج',
  78811. 'ﶔ' => 'همم',
  78812. 'ﶕ' => 'نحم',
  78813. 'ﶖ' => 'نحى',
  78814. 'ﶗ' => 'نجم',
  78815. 'ﶘ' => 'نجم',
  78816. 'ﶙ' => 'نجى',
  78817. 'ﶚ' => 'نمي',
  78818. 'ﶛ' => 'نمى',
  78819. 'ﶜ' => 'يمم',
  78820. '�' => 'يمم',
  78821. 'ﶞ' => 'بخي',
  78822. 'ﶟ' => 'تجي',
  78823. 'ﶠ' => 'تجى',
  78824. 'ﶡ' => 'تخي',
  78825. 'ﶢ' => 'تخى',
  78826. 'ﶣ' => 'تمي',
  78827. 'ﶤ' => 'تمى',
  78828. 'ﶥ' => 'جمي',
  78829. 'ﶦ' => 'جحى',
  78830. 'ﶧ' => 'جمى',
  78831. 'ﶨ' => 'سخى',
  78832. 'ﶩ' => 'صحي',
  78833. 'ﶪ' => 'شحي',
  78834. 'ﶫ' => 'ضحي',
  78835. 'ﶬ' => 'لجي',
  78836. 'ﶭ' => 'لمي',
  78837. 'ﶮ' => 'يحي',
  78838. 'ﶯ' => 'يجي',
  78839. 'ﶰ' => 'يمي',
  78840. 'ﶱ' => 'ممي',
  78841. 'ﶲ' => 'قمي',
  78842. 'ﶳ' => 'نحي',
  78843. 'ﶴ' => 'قمح',
  78844. 'ﶵ' => 'لحم',
  78845. 'ﶶ' => 'عمي',
  78846. 'ﶷ' => 'كمي',
  78847. 'ﶸ' => 'نجح',
  78848. 'ﶹ' => 'مخي',
  78849. 'ﶺ' => 'لجم',
  78850. 'ﶻ' => 'كمم',
  78851. 'ﶼ' => 'لجم',
  78852. 'ﶽ' => 'نجح',
  78853. 'ﶾ' => 'جحي',
  78854. 'ﶿ' => 'حجي',
  78855. 'ﷀ' => 'مجي',
  78856. '�' => '�مي',
  78857. 'ﷂ' => 'بحي',
  78858. 'ﷃ' => 'كمم',
  78859. 'ﷄ' => 'عجم',
  78860. 'ﷅ' => 'صمم',
  78861. 'ﷆ' => 'سخي',
  78862. 'ﷇ' => 'نجي',
  78863. 'ﷰ' => 'صلے',
  78864. 'ﷱ' => 'قلے',
  78865. 'ﷲ' => 'الله',
  78866. 'ﷳ' => 'اكبر',
  78867. 'ﷴ' => 'محمد',
  78868. 'ﷵ' => 'صلعم',
  78869. 'ﷶ' => 'رسول',
  78870. 'ﷷ' => 'عليه',
  78871. 'ﷸ' => 'وسلم',
  78872. 'ﷹ' => 'صلى',
  78873. 'ﷺ' => 'صلى الله عليه وسلم',
  78874. 'ﷻ' => 'جل جلاله',
  78875. '﷼' => 'ریال',
  78876. '�' => ',',
  78877. '︑' => '�',
  78878. '︒' => '。',
  78879. '︓' => ':',
  78880. '︔' => ';',
  78881. '︕' => '!',
  78882. '︖' => '?',
  78883. '︗' => '〖',
  78884. '︘' => '〗',
  78885. '︙' => '...',
  78886. '︰' => '..',
  78887. '︱' => '—',
  78888. '︲' => '–',
  78889. '︳' => '_',
  78890. '︴' => '_',
  78891. '︵' => '(',
  78892. '︶' => ')',
  78893. '︷' => '{',
  78894. '︸' => '}',
  78895. '︹' => '〔',
  78896. '︺' => '〕',
  78897. '︻' => '�',
  78898. '︼' => '】',
  78899. '︽' => '《',
  78900. '︾' => '》',
  78901. '︿' => '〈',
  78902. '﹀' => '〉',
  78903. '�' => '「',
  78904. '﹂' => '�',
  78905. '﹃' => '『',
  78906. '﹄' => '�',
  78907. '﹇' => '[',
  78908. '﹈' => ']',
  78909. '﹉' => ' ̅',
  78910. '﹊' => ' ̅',
  78911. '﹋' => ' ̅',
  78912. '﹌' => ' ̅',
  78913. '�' => '_',
  78914. '﹎' => '_',
  78915. '�' => '_',
  78916. '�' => ',',
  78917. '﹑' => '�',
  78918. 'ï¹’' => '.',
  78919. 'ï¹”' => ';',
  78920. '﹕' => ':',
  78921. 'ï¹–' => '?',
  78922. 'ï¹—' => '!',
  78923. '﹘' => '—',
  78924. 'ï¹™' => '(',
  78925. '﹚' => ')',
  78926. 'ï¹›' => '{',
  78927. '﹜' => '}',
  78928. '�' => '〔',
  78929. '﹞' => '〕',
  78930. '﹟' => '#',
  78931. 'ï¹ ' => '&',
  78932. '﹡' => '*',
  78933. 'ï¹¢' => '+',
  78934. 'ï¹£' => '-',
  78935. '﹤' => '<',
  78936. 'ï¹¥' => '>',
  78937. '﹦' => '=',
  78938. '﹨' => '\\',
  78939. '﹩' => '$',
  78940. '﹪' => '%',
  78941. '﹫' => '@',
  78942. 'ï¹°' => ' Ù‹',
  78943. 'ﹱ' => 'ـً',
  78944. 'ﹲ' => ' ٌ',
  78945. 'ï¹´' => ' Ù�',
  78946. 'ﹶ' => ' َ',
  78947. 'ï¹·' => 'Ù€ÙŽ',
  78948. 'ﹸ' => ' �',
  78949. 'ﹹ' => 'ـ�',
  78950. 'ﹺ' => ' �',
  78951. 'ﹻ' => 'ـ�',
  78952. 'ï¹¼' => ' Ù‘',
  78953. 'ﹽ' => 'ـّ',
  78954. 'ï¹¾' => ' Ù’',
  78955. 'ﹿ' => 'ـْ',
  78956. 'ﺀ' => 'ء',
  78957. '�' => 'آ',
  78958. 'ﺂ' => 'آ',
  78959. 'ﺃ' => 'أ',
  78960. 'ﺄ' => 'أ',
  78961. 'ﺅ' => 'ؤ',
  78962. 'ﺆ' => 'ؤ',
  78963. 'ﺇ' => 'إ',
  78964. 'ﺈ' => 'إ',
  78965. 'ﺉ' => 'ئ',
  78966. 'ﺊ' => 'ئ',
  78967. 'ﺋ' => 'ئ',
  78968. 'ﺌ' => 'ئ',
  78969. '�' => 'ا',
  78970. 'ﺎ' => 'ا',
  78971. '�' => 'ب',
  78972. '�' => 'ب',
  78973. 'ﺑ' => 'ب',
  78974. 'ﺒ' => 'ب',
  78975. 'ﺓ' => 'ة',
  78976. 'ﺔ' => 'ة',
  78977. 'ﺕ' => 'ت',
  78978. 'ﺖ' => 'ت',
  78979. 'ﺗ' => 'ت',
  78980. 'ﺘ' => 'ت',
  78981. 'ﺙ' => 'ث',
  78982. 'ﺚ' => 'ث',
  78983. 'ﺛ' => 'ث',
  78984. 'ﺜ' => 'ث',
  78985. '�' => 'ج',
  78986. 'ﺞ' => 'ج',
  78987. 'ﺟ' => 'ج',
  78988. 'ﺠ' => 'ج',
  78989. 'ﺡ' => 'ح',
  78990. 'ﺢ' => 'ح',
  78991. 'ﺣ' => 'ح',
  78992. 'ﺤ' => 'ح',
  78993. 'ﺥ' => 'خ',
  78994. 'ﺦ' => 'خ',
  78995. 'ﺧ' => 'خ',
  78996. 'ﺨ' => 'خ',
  78997. 'ﺩ' => 'د',
  78998. 'ﺪ' => 'د',
  78999. 'ﺫ' => 'ذ',
  79000. 'ﺬ' => 'ذ',
  79001. 'ﺭ' => 'ر',
  79002. 'ﺮ' => 'ر',
  79003. 'ﺯ' => 'ز',
  79004. 'ﺰ' => 'ز',
  79005. 'ﺱ' => 'س',
  79006. 'ﺲ' => 'س',
  79007. 'ﺳ' => 'س',
  79008. 'ﺴ' => 'س',
  79009. 'ﺵ' => 'ش',
  79010. 'ﺶ' => 'ش',
  79011. 'ﺷ' => 'ش',
  79012. 'ﺸ' => 'ش',
  79013. 'ﺹ' => 'ص',
  79014. 'ﺺ' => 'ص',
  79015. 'ﺻ' => 'ص',
  79016. 'ﺼ' => 'ص',
  79017. 'ﺽ' => 'ض',
  79018. 'ﺾ' => 'ض',
  79019. 'ﺿ' => 'ض',
  79020. 'ﻀ' => 'ض',
  79021. '�' => 'ط',
  79022. 'ﻂ' => 'ط',
  79023. 'ﻃ' => 'ط',
  79024. 'ﻄ' => 'ط',
  79025. 'ﻅ' => 'ظ',
  79026. 'ﻆ' => 'ظ',
  79027. 'ﻇ' => 'ظ',
  79028. 'ﻈ' => 'ظ',
  79029. 'ﻉ' => 'ع',
  79030. 'ﻊ' => 'ع',
  79031. 'ﻋ' => 'ع',
  79032. 'ﻌ' => 'ع',
  79033. '�' => 'غ',
  79034. 'ﻎ' => 'غ',
  79035. '�' => 'غ',
  79036. '�' => 'غ',
  79037. 'ﻑ' => '�',
  79038. 'ï»’' => 'Ù�',
  79039. 'ﻓ' => '�',
  79040. 'ï»”' => 'Ù�',
  79041. 'ﻕ' => 'ق',
  79042. 'ï»–' => 'Ù‚',
  79043. 'ï»—' => 'Ù‚',
  79044. 'ﻘ' => 'ق',
  79045. 'ï»™' => 'Ùƒ',
  79046. 'ﻚ' => 'ك',
  79047. 'ï»›' => 'Ùƒ',
  79048. 'ﻜ' => 'ك',
  79049. '�' => 'ل',
  79050. 'ﻞ' => 'ل',
  79051. 'ﻟ' => 'ل',
  79052. 'ï» ' => 'Ù„',
  79053. 'ﻡ' => 'م',
  79054. 'ﻢ' => 'م',
  79055. 'ﻣ' => 'م',
  79056. 'ﻤ' => 'م',
  79057. 'ﻥ' => 'ن',
  79058. 'ﻦ' => 'ن',
  79059. 'ﻧ' => 'ن',
  79060. 'ﻨ' => 'ن',
  79061. 'ﻩ' => 'ه',
  79062. 'ﻪ' => 'ه',
  79063. 'ﻫ' => 'ه',
  79064. 'ﻬ' => 'ه',
  79065. 'ï»­' => 'Ùˆ',
  79066. 'ï»®' => 'Ùˆ',
  79067. 'ﻯ' => 'ى',
  79068. 'ï»°' => 'Ù‰',
  79069. 'ï»±' => 'ÙŠ',
  79070. 'ﻲ' => 'ي',
  79071. 'ﻳ' => 'ي',
  79072. 'ï»´' => 'ÙŠ',
  79073. 'ﻵ' => 'لآ',
  79074. 'ﻶ' => 'لآ',
  79075. 'ﻷ' => 'لأ',
  79076. 'ﻸ' => 'لأ',
  79077. 'ﻹ' => 'لإ',
  79078. 'ﻺ' => 'لإ',
  79079. 'ﻻ' => 'لا',
  79080. 'ﻼ' => 'لا',
  79081. '�' => '!',
  79082. '"' => '"',
  79083. '#' => '#',
  79084. '$' => '$',
  79085. 'ï¼…' => '%',
  79086. '&' => '&',
  79087. ''' => '\'',
  79088. '(' => '(',
  79089. ')' => ')',
  79090. '*' => '*',
  79091. '+' => '+',
  79092. ',' => ',',
  79093. '�' => '-',
  79094. '.' => '.',
  79095. '�' => '/',
  79096. '�' => '0',
  79097. '1' => '1',
  79098. 'ï¼’' => '2',
  79099. '3' => '3',
  79100. 'ï¼”' => '4',
  79101. '5' => '5',
  79102. 'ï¼–' => '6',
  79103. 'ï¼—' => '7',
  79104. '8' => '8',
  79105. 'ï¼™' => '9',
  79106. ':' => ':',
  79107. 'ï¼›' => ';',
  79108. '<' => '<',
  79109. '�' => '=',
  79110. '>' => '>',
  79111. '?' => '?',
  79112. 'ï¼ ' => '@',
  79113. 'A' => 'A',
  79114. 'ï¼¢' => 'B',
  79115. 'ï¼£' => 'C',
  79116. 'D' => 'D',
  79117. 'ï¼¥' => 'E',
  79118. 'F' => 'F',
  79119. 'G' => 'G',
  79120. 'H' => 'H',
  79121. 'I' => 'I',
  79122. 'J' => 'J',
  79123. 'K' => 'K',
  79124. 'L' => 'L',
  79125. 'ï¼­' => 'M',
  79126. 'ï¼®' => 'N',
  79127. 'O' => 'O',
  79128. 'ï¼°' => 'P',
  79129. 'ï¼±' => 'Q',
  79130. 'ï¼²' => 'R',
  79131. 'ï¼³' => 'S',
  79132. 'ï¼´' => 'T',
  79133. 'ï¼µ' => 'U',
  79134. 'V' => 'V',
  79135. 'ï¼·' => 'W',
  79136. 'X' => 'X',
  79137. 'ï¼¹' => 'Y',
  79138. 'Z' => 'Z',
  79139. 'ï¼»' => '[',
  79140. 'ï¼¼' => '\\',
  79141. 'ï¼½' => ']',
  79142. 'ï¼¾' => '^',
  79143. '_' => '_',
  79144. 'ï½€' => '`',
  79145. '�' => 'a',
  79146. 'b' => 'b',
  79147. 'c' => 'c',
  79148. 'd' => 'd',
  79149. 'ï½…' => 'e',
  79150. 'f' => 'f',
  79151. 'g' => 'g',
  79152. 'h' => 'h',
  79153. 'i' => 'i',
  79154. 'j' => 'j',
  79155. 'k' => 'k',
  79156. 'l' => 'l',
  79157. '�' => 'm',
  79158. 'n' => 'n',
  79159. '�' => 'o',
  79160. '�' => 'p',
  79161. 'q' => 'q',
  79162. 'ï½’' => 'r',
  79163. 's' => 's',
  79164. 'ï½”' => 't',
  79165. 'u' => 'u',
  79166. 'ï½–' => 'v',
  79167. 'ï½—' => 'w',
  79168. 'x' => 'x',
  79169. 'ï½™' => 'y',
  79170. 'z' => 'z',
  79171. 'ï½›' => '{',
  79172. '|' => '|',
  79173. '�' => '}',
  79174. '~' => '~',
  79175. '⦅' => '⦅',
  79176. '⦆' => '⦆',
  79177. '。' => '。',
  79178. '「' => '「',
  79179. '」' => '�',
  79180. '、' => '�',
  79181. '・' => '・',
  79182. 'ヲ' => 'ヲ',
  79183. 'ァ' => 'ァ',
  79184. 'ィ' => 'ィ',
  79185. 'ゥ' => 'ゥ',
  79186. 'ェ' => 'ェ',
  79187. 'ォ' => 'ォ',
  79188. 'ャ' => 'ャ',
  79189. 'ュ' => 'ュ',
  79190. 'ョ' => 'ョ',
  79191. 'ッ' => 'ッ',
  79192. 'ー' => 'ー',
  79193. 'ï½±' => 'ã‚¢',
  79194. 'イ' => 'イ',
  79195. 'ウ' => 'ウ',
  79196. 'エ' => 'エ',
  79197. 'オ' => 'オ',
  79198. 'カ' => 'カ',
  79199. 'ï½·' => 'ã‚­',
  79200. 'ク' => 'ク',
  79201. 'ケ' => 'ケ',
  79202. 'コ' => 'コ',
  79203. 'サ' => 'サ',
  79204. 'ï½¼' => 'ã‚·',
  79205. 'ス' => 'ス',
  79206. 'ï½¾' => 'ã‚»',
  79207. 'ソ' => 'ソ',
  79208. 'ï¾€' => 'ã‚¿',
  79209. '�' => '�',
  79210. 'ツ' => 'ツ',
  79211. 'テ' => 'テ',
  79212. 'ト' => 'ト',
  79213. 'ナ' => 'ナ',
  79214. 'ニ' => 'ニ',
  79215. 'ヌ' => 'ヌ',
  79216. 'ネ' => '�',
  79217. 'ノ' => 'ノ',
  79218. 'ハ' => '�',
  79219. 'ヒ' => 'ヒ',
  79220. 'フ' => 'フ',
  79221. '�' => 'ヘ',
  79222. 'ホ' => 'ホ',
  79223. '�' => 'マ',
  79224. '�' => 'ミ',
  79225. 'ム' => 'ム',
  79226. 'メ' => 'メ',
  79227. 'モ' => 'モ',
  79228. 'ヤ' => 'ヤ',
  79229. 'ユ' => 'ユ',
  79230. 'ヨ' => 'ヨ',
  79231. 'ラ' => 'ラ',
  79232. 'リ' => 'リ',
  79233. 'ル' => 'ル',
  79234. 'レ' => 'レ',
  79235. 'ロ' => 'ロ',
  79236. 'ワ' => 'ワ',
  79237. '�' => 'ン',
  79238. '゙' => '゙',
  79239. '゚' => '゚',
  79240. 'ï¾ ' => 'á… ',
  79241. 'ᄀ' => 'ᄀ',
  79242. 'ᄁ' => '�',
  79243. 'ᆪ' => 'ᆪ',
  79244. 'ᄂ' => 'ᄂ',
  79245. 'ᆬ' => 'ᆬ',
  79246. 'ᆭ' => 'ᆭ',
  79247. 'ᄃ' => 'ᄃ',
  79248. 'ᄄ' => 'ᄄ',
  79249. 'ᄅ' => 'ᄅ',
  79250. 'ᆰ' => 'ᆰ',
  79251. 'ᆱ' => 'ᆱ',
  79252. 'ᆲ' => 'ᆲ',
  79253. 'ᆳ' => 'ᆳ',
  79254. 'ᆴ' => 'ᆴ',
  79255. 'ᆵ' => 'ᆵ',
  79256. 'ï¾°' => 'á„š',
  79257. 'ᄆ' => 'ᄆ',
  79258. 'ᄇ' => 'ᄇ',
  79259. 'ᄈ' => 'ᄈ',
  79260. 'ï¾´' => 'á„¡',
  79261. 'ᄉ' => 'ᄉ',
  79262. 'ᄊ' => 'ᄊ',
  79263. 'ï¾·' => 'á„‹',
  79264. 'ᄌ' => 'ᄌ',
  79265. 'ᄍ' => '�',
  79266. 'ᄎ' => 'ᄎ',
  79267. 'ᄏ' => '�',
  79268. 'ᄐ' => '�',
  79269. 'ï¾½' => 'á„‘',
  79270. 'ï¾¾' => 'á„’',
  79271. 'ï¿‚' => 'á…¡',
  79272. 'ᅢ' => 'ᅢ',
  79273. 'ï¿„' => 'á…£',
  79274. 'ï¿…' => 'á…¤',
  79275. 'ᅥ' => 'ᅥ',
  79276. 'ᅦ' => 'ᅦ',
  79277. 'ï¿Š' => 'á…§',
  79278. 'ï¿‹' => 'á…¨',
  79279. 'ᅩ' => 'ᅩ',
  79280. '�' => 'ᅪ',
  79281. 'ï¿Ž' => 'á…«',
  79282. '�' => 'ᅬ',
  79283. 'ï¿’' => 'á…­',
  79284. 'ï¿“' => 'á…®',
  79285. 'ï¿”' => 'á…¯',
  79286. 'ï¿•' => 'á…°',
  79287. 'ï¿–' => 'á…±',
  79288. 'ï¿—' => 'á…²',
  79289. 'ï¿š' => 'á…³',
  79290. 'ï¿›' => 'á…´',
  79291. 'ᅵ' => 'ᅵ',
  79292. '¢' => '¢',
  79293. '£' => '£',
  79294. '¬' => '¬',
  79295. 'ï¿£' => ' Ì„',
  79296. '¦' => '¦',
  79297. 'ï¿¥' => 'Â¥',
  79298. '₩' => '₩',
  79299. '│' => '│',
  79300. '←' => '�',
  79301. '↑' => '↑',
  79302. '→' => '→',
  79303. '↓' => '↓',
  79304. 'ï¿­' => 'â– ',
  79305. 'ï¿®' => 'â—‹',
  79306. '�' => 'A',
  79307. '�' => 'B',
  79308. '�' => 'C',
  79309. '�' => 'D',
  79310. '�' => 'E',
  79311. '�' => 'F',
  79312. '�' => 'G',
  79313. '�' => 'H',
  79314. '�' => 'I',
  79315. '�' => 'J',
  79316. '�' => 'K',
  79317. '�' => 'L',
  79318. '�' => 'M',
  79319. '�' => 'N',
  79320. '�' => 'O',
  79321. '�' => 'P',
  79322. '�' => 'Q',
  79323. '�' => 'R',
  79324. '�' => 'S',
  79325. '�' => 'T',
  79326. '�' => 'U',
  79327. '�' => 'V',
  79328. '�' => 'W',
  79329. '�' => 'X',
  79330. '�' => 'Y',
  79331. '�' => 'Z',
  79332. '�' => 'a',
  79333. '�' => 'b',
  79334. '�' => 'c',
  79335. '�' => 'd',
  79336. '�' => 'e',
  79337. '�' => 'f',
  79338. '�' => 'g',
  79339. '�' => 'h',
  79340. '�' => 'i',
  79341. '�' => 'j',
  79342. '�' => 'k',
  79343. '�' => 'l',
  79344. '�' => 'm',
  79345. '�' => 'n',
  79346. '�' => 'o',
  79347. '�' => 'p',
  79348. '�' => 'q',
  79349. '�' => 'r',
  79350. '�' => 's',
  79351. '�' => 't',
  79352. '�' => 'u',
  79353. '�' => 'v',
  79354. '�' => 'w',
  79355. '�' => 'x',
  79356. '�' => 'y',
  79357. '�' => 'z',
  79358. '�' => 'A',
  79359. '�' => 'B',
  79360. '�' => 'C',
  79361. '�' => 'D',
  79362. '�' => 'E',
  79363. '�' => 'F',
  79364. '�' => 'G',
  79365. '�' => 'H',
  79366. '�' => 'I',
  79367. '�' => 'J',
  79368. '�' => 'K',
  79369. '�' => 'L',
  79370. '�' => 'M',
  79371. '�' => 'N',
  79372. '�' => 'O',
  79373. '�' => 'P',
  79374. '�' => 'Q',
  79375. '�' => 'R',
  79376. '�' => 'S',
  79377. '�' => 'T',
  79378. '�' => 'U',
  79379. '�' => 'V',
  79380. '�' => 'W',
  79381. '�' => 'X',
  79382. '�' => 'Y',
  79383. '�' => 'Z',
  79384. '�' => 'a',
  79385. '�' => 'b',
  79386. '�' => 'c',
  79387. '�' => 'd',
  79388. '�' => 'e',
  79389. '�' => 'f',
  79390. '�' => 'g',
  79391. '�' => 'i',
  79392. '�' => 'j',
  79393. '�' => 'k',
  79394. '�' => 'l',
  79395. '�' => 'm',
  79396. '�' => 'n',
  79397. '�' => 'o',
  79398. '�' => 'p',
  79399. '�' => 'q',
  79400. '�' => 'r',
  79401. '�' => 's',
  79402. '�' => 't',
  79403. '�' => 'u',
  79404. '�' => 'v',
  79405. '�' => 'w',
  79406. '�' => 'x',
  79407. '�' => 'y',
  79408. '�' => 'z',
  79409. '�' => 'A',
  79410. '�' => 'B',
  79411. '�' => 'C',
  79412. '�' => 'D',
  79413. '�' => 'E',
  79414. '�' => 'F',
  79415. '�' => 'G',
  79416. '�' => 'H',
  79417. '�' => 'I',
  79418. '�' => 'J',
  79419. '�' => 'K',
  79420. '�' => 'L',
  79421. '�' => 'M',
  79422. '�' => 'N',
  79423. '�' => 'O',
  79424. '�' => 'P',
  79425. '�' => 'Q',
  79426. '�' => 'R',
  79427. '�' => 'S',
  79428. '�' => 'T',
  79429. '�' => 'U',
  79430. '�' => 'V',
  79431. '�' => 'W',
  79432. '�' => 'X',
  79433. '�' => 'Y',
  79434. '�' => 'Z',
  79435. '�' => 'a',
  79436. '�' => 'b',
  79437. '�' => 'c',
  79438. '�' => 'd',
  79439. '�' => 'e',
  79440. '�' => 'f',
  79441. '�' => 'g',
  79442. '�' => 'h',
  79443. '�' => 'i',
  79444. '�' => 'j',
  79445. '�' => 'k',
  79446. '�' => 'l',
  79447. '�' => 'm',
  79448. '�' => 'n',
  79449. '�' => 'o',
  79450. '�' => 'p',
  79451. '�' => 'q',
  79452. '�' => 'r',
  79453. '�' => 's',
  79454. '�' => 't',
  79455. '�' => 'u',
  79456. '�' => 'v',
  79457. '�' => 'w',
  79458. '�' => 'x',
  79459. '�' => 'y',
  79460. '�' => 'z',
  79461. '�' => 'A',
  79462. '�' => 'C',
  79463. '�' => 'D',
  79464. '�' => 'G',
  79465. '�' => 'J',
  79466. '�' => 'K',
  79467. '�' => 'N',
  79468. '�' => 'O',
  79469. '�' => 'P',
  79470. '�' => 'Q',
  79471. '�' => 'S',
  79472. '�' => 'T',
  79473. '�' => 'U',
  79474. '�' => 'V',
  79475. '�' => 'W',
  79476. '�' => 'X',
  79477. '�' => 'Y',
  79478. '�' => 'Z',
  79479. '�' => 'a',
  79480. '�' => 'b',
  79481. '�' => 'c',
  79482. '�' => 'd',
  79483. '�' => 'f',
  79484. '�' => 'h',
  79485. '�' => 'i',
  79486. '�' => 'j',
  79487. '�' => 'k',
  79488. '�' => 'l',
  79489. '�' => 'm',
  79490. '�' => 'n',
  79491. '�' => 'p',
  79492. '�' => 'q',
  79493. '�' => 'r',
  79494. '�' => 's',
  79495. '�' => 't',
  79496. '�' => 'u',
  79497. '�' => 'v',
  79498. '�' => 'w',
  79499. '�' => 'x',
  79500. '�' => 'y',
  79501. '�' => 'z',
  79502. '�' => 'A',
  79503. '�' => 'B',
  79504. '�' => 'C',
  79505. '�' => 'D',
  79506. '�' => 'E',
  79507. '�' => 'F',
  79508. '�' => 'G',
  79509. '�' => 'H',
  79510. '�' => 'I',
  79511. '�' => 'J',
  79512. '�' => 'K',
  79513. '�' => 'L',
  79514. '�' => 'M',
  79515. '�' => 'N',
  79516. '�' => 'O',
  79517. '�' => 'P',
  79518. '�' => 'Q',
  79519. '�' => 'R',
  79520. '�' => 'S',
  79521. '�' => 'T',
  79522. '�' => 'U',
  79523. '�' => 'V',
  79524. '�' => 'W',
  79525. '�' => 'X',
  79526. '�' => 'Y',
  79527. '�' => 'Z',
  79528. '�' => 'a',
  79529. '�' => 'b',
  79530. '�' => 'c',
  79531. '�' => 'd',
  79532. '�' => 'e',
  79533. '�' => 'f',
  79534. '�' => 'g',
  79535. '�' => 'h',
  79536. '�' => 'i',
  79537. '�' => 'j',
  79538. '�' => 'k',
  79539. '�' => 'l',
  79540. '�' => 'm',
  79541. '�' => 'n',
  79542. '�' => 'o',
  79543. '�' => 'p',
  79544. '�' => 'q',
  79545. '�' => 'r',
  79546. '�' => 's',
  79547. '�' => 't',
  79548. '�' => 'u',
  79549. '�' => 'v',
  79550. '�' => 'w',
  79551. '�' => 'x',
  79552. '�' => 'y',
  79553. '�' => 'z',
  79554. '�' => 'A',
  79555. '�' => 'B',
  79556. '�' => 'D',
  79557. '�' => 'E',
  79558. '�' => 'F',
  79559. '�' => 'G',
  79560. '�' => 'J',
  79561. '�' => 'K',
  79562. '�' => 'L',
  79563. '�' => 'M',
  79564. '�' => 'N',
  79565. '�' => 'O',
  79566. '�' => 'P',
  79567. '�' => 'Q',
  79568. '�' => 'S',
  79569. '�' => 'T',
  79570. '�' => 'U',
  79571. '�' => 'V',
  79572. '�' => 'W',
  79573. '�' => 'X',
  79574. '�' => 'Y',
  79575. '�' => 'a',
  79576. '�' => 'b',
  79577. '�' => 'c',
  79578. '�' => 'd',
  79579. '�' => 'e',
  79580. '�' => 'f',
  79581. '�' => 'g',
  79582. '�' => 'h',
  79583. '�' => 'i',
  79584. '�' => 'j',
  79585. '�' => 'k',
  79586. '�' => 'l',
  79587. '�' => 'm',
  79588. '�' => 'n',
  79589. '�' => 'o',
  79590. '�' => 'p',
  79591. '�' => 'q',
  79592. '�' => 'r',
  79593. '�' => 's',
  79594. '�' => 't',
  79595. '�' => 'u',
  79596. '�' => 'v',
  79597. '�' => 'w',
  79598. '�' => 'x',
  79599. '�' => 'y',
  79600. '�' => 'z',
  79601. '�' => 'A',
  79602. '�' => 'B',
  79603. '�' => 'D',
  79604. '�' => 'E',
  79605. '�' => 'F',
  79606. '�' => 'G',
  79607. '�' => 'I',
  79608. '�' => 'J',
  79609. '�' => 'K',
  79610. '�' => 'L',
  79611. '�' => 'M',
  79612. '�' => 'O',
  79613. '�' => 'S',
  79614. '�' => 'T',
  79615. '�' => 'U',
  79616. '�' => 'V',
  79617. '�' => 'W',
  79618. '�' => 'X',
  79619. '�' => 'Y',
  79620. '�' => 'a',
  79621. '�' => 'b',
  79622. '�' => 'c',
  79623. '�' => 'd',
  79624. '�' => 'e',
  79625. '�' => 'f',
  79626. '�' => 'g',
  79627. '�' => 'h',
  79628. '�' => 'i',
  79629. '�' => 'j',
  79630. '�' => 'k',
  79631. '�' => 'l',
  79632. '�' => 'm',
  79633. '�' => 'n',
  79634. '�' => 'o',
  79635. '�' => 'p',
  79636. '�' => 'q',
  79637. '�' => 'r',
  79638. '�' => 's',
  79639. '�' => 't',
  79640. '�' => 'u',
  79641. '�' => 'v',
  79642. '�' => 'w',
  79643. '�' => 'x',
  79644. '�' => 'y',
  79645. '�' => 'z',
  79646. '�' => 'A',
  79647. '�' => 'B',
  79648. '�' => 'C',
  79649. '�' => 'D',
  79650. '�' => 'E',
  79651. '�' => 'F',
  79652. '�' => 'G',
  79653. '�' => 'H',
  79654. '�' => 'I',
  79655. '�' => 'J',
  79656. '�' => 'K',
  79657. '�' => 'L',
  79658. '�' => 'M',
  79659. '�' => 'N',
  79660. '�' => 'O',
  79661. '�' => 'P',
  79662. '�' => 'Q',
  79663. '�' => 'R',
  79664. '�' => 'S',
  79665. '�' => 'T',
  79666. '�' => 'U',
  79667. '�' => 'V',
  79668. '�' => 'W',
  79669. '�' => 'X',
  79670. '�' => 'Y',
  79671. '�' => 'Z',
  79672. '�' => 'a',
  79673. '�' => 'b',
  79674. '�' => 'c',
  79675. '�' => 'd',
  79676. '�' => 'e',
  79677. '�' => 'f',
  79678. '�' => 'g',
  79679. '�' => 'h',
  79680. '�' => 'i',
  79681. '�' => 'j',
  79682. '�' => 'k',
  79683. '�' => 'l',
  79684. '�' => 'm',
  79685. '�' => 'n',
  79686. '�' => 'o',
  79687. '�' => 'p',
  79688. '�' => 'q',
  79689. '�' => 'r',
  79690. '�' => 's',
  79691. '�' => 't',
  79692. '�' => 'u',
  79693. '�' => 'v',
  79694. '�' => 'w',
  79695. '�' => 'x',
  79696. '�' => 'y',
  79697. '�' => 'z',
  79698. '�' => 'A',
  79699. '�' => 'B',
  79700. '�' => 'C',
  79701. '�' => 'D',
  79702. '�' => 'E',
  79703. '�' => 'F',
  79704. '�' => 'G',
  79705. '�' => 'H',
  79706. '�' => 'I',
  79707. '�' => 'J',
  79708. '�' => 'K',
  79709. '�' => 'L',
  79710. '�' => 'M',
  79711. '�' => 'N',
  79712. '�' => 'O',
  79713. '�' => 'P',
  79714. '�' => 'Q',
  79715. '�' => 'R',
  79716. '�' => 'S',
  79717. '�' => 'T',
  79718. '�' => 'U',
  79719. '�' => 'V',
  79720. '�' => 'W',
  79721. '�' => 'X',
  79722. '�' => 'Y',
  79723. '�' => 'Z',
  79724. '�' => 'a',
  79725. '�' => 'b',
  79726. '�' => 'c',
  79727. '�' => 'd',
  79728. '�' => 'e',
  79729. '�' => 'f',
  79730. '�' => 'g',
  79731. '�' => 'h',
  79732. '�' => 'i',
  79733. '�' => 'j',
  79734. '�' => 'k',
  79735. '�' => 'l',
  79736. '�' => 'm',
  79737. '�' => 'n',
  79738. '�' => 'o',
  79739. '�' => 'p',
  79740. '�' => 'q',
  79741. '�' => 'r',
  79742. '�' => 's',
  79743. '�' => 't',
  79744. '�' => 'u',
  79745. '�' => 'v',
  79746. '�' => 'w',
  79747. '�' => 'x',
  79748. '�' => 'y',
  79749. '�' => 'z',
  79750. '�' => 'A',
  79751. '�' => 'B',
  79752. '�' => 'C',
  79753. '�' => 'D',
  79754. '�' => 'E',
  79755. '�' => 'F',
  79756. '�' => 'G',
  79757. '�' => 'H',
  79758. '�' => 'I',
  79759. '�' => 'J',
  79760. '�' => 'K',
  79761. '�' => 'L',
  79762. '�' => 'M',
  79763. '�' => 'N',
  79764. '�' => 'O',
  79765. '�' => 'P',
  79766. '�' => 'Q',
  79767. '�' => 'R',
  79768. '�' => 'S',
  79769. '�' => 'T',
  79770. '�' => 'U',
  79771. '�' => 'V',
  79772. '�' => 'W',
  79773. '�' => 'X',
  79774. '�' => 'Y',
  79775. '�' => 'Z',
  79776. '�' => 'a',
  79777. '�' => 'b',
  79778. '�' => 'c',
  79779. '�' => 'd',
  79780. '�' => 'e',
  79781. '�' => 'f',
  79782. '�' => 'g',
  79783. '�' => 'h',
  79784. '�' => 'i',
  79785. '�' => 'j',
  79786. '�' => 'k',
  79787. '�' => 'l',
  79788. '�' => 'm',
  79789. '�' => 'n',
  79790. '�' => 'o',
  79791. '�' => 'p',
  79792. '�' => 'q',
  79793. '�' => 'r',
  79794. '�' => 's',
  79795. '�' => 't',
  79796. '�' => 'u',
  79797. '�' => 'v',
  79798. '�' => 'w',
  79799. '�' => 'x',
  79800. '�' => 'y',
  79801. '�' => 'z',
  79802. '�' => 'A',
  79803. '�' => 'B',
  79804. '�' => 'C',
  79805. '�' => 'D',
  79806. '�' => 'E',
  79807. '�' => 'F',
  79808. '�' => 'G',
  79809. '�' => 'H',
  79810. '�' => 'I',
  79811. '�' => 'J',
  79812. '�' => 'K',
  79813. '�' => 'L',
  79814. '�' => 'M',
  79815. '�' => 'N',
  79816. '�' => 'O',
  79817. '�' => 'P',
  79818. '�' => 'Q',
  79819. '�' => 'R',
  79820. '�' => 'S',
  79821. '�' => 'T',
  79822. '�' => 'U',
  79823. '�' => 'V',
  79824. '�' => 'W',
  79825. '�' => 'X',
  79826. '�' => 'Y',
  79827. '�' => 'Z',
  79828. '�' => 'a',
  79829. '�' => 'b',
  79830. '�' => 'c',
  79831. '�' => 'd',
  79832. '�' => 'e',
  79833. '�' => 'f',
  79834. '�' => 'g',
  79835. '�' => 'h',
  79836. '�' => 'i',
  79837. '�' => 'j',
  79838. '�' => 'k',
  79839. '�' => 'l',
  79840. '�' => 'm',
  79841. '�' => 'n',
  79842. '�' => 'o',
  79843. '�' => 'p',
  79844. '�' => 'q',
  79845. '�' => 'r',
  79846. '�' => 's',
  79847. '�' => 't',
  79848. '�' => 'u',
  79849. '�' => 'v',
  79850. '�' => 'w',
  79851. '�' => 'x',
  79852. '�' => 'y',
  79853. '�' => 'z',
  79854. '�' => 'A',
  79855. '�' => 'B',
  79856. '�' => 'C',
  79857. '�' => 'D',
  79858. '�' => 'E',
  79859. '�' => 'F',
  79860. '�' => 'G',
  79861. '�' => 'H',
  79862. '�' => 'I',
  79863. '�' => 'J',
  79864. '�' => 'K',
  79865. '�' => 'L',
  79866. '�' => 'M',
  79867. '�' => 'N',
  79868. '�' => 'O',
  79869. '�' => 'P',
  79870. '�' => 'Q',
  79871. '�' => 'R',
  79872. '�' => 'S',
  79873. '�' => 'T',
  79874. '�' => 'U',
  79875. '�' => 'V',
  79876. '�' => 'W',
  79877. '�' => 'X',
  79878. '�' => 'Y',
  79879. '�' => 'Z',
  79880. '�' => 'a',
  79881. '�' => 'b',
  79882. '�' => 'c',
  79883. '�' => 'd',
  79884. '�' => 'e',
  79885. '�' => 'f',
  79886. '�' => 'g',
  79887. '�' => 'h',
  79888. '�' => 'i',
  79889. '�' => 'j',
  79890. '�' => 'k',
  79891. '�' => 'l',
  79892. '�' => 'm',
  79893. '�' => 'n',
  79894. '�' => 'o',
  79895. '�' => 'p',
  79896. '�' => 'q',
  79897. '�' => 'r',
  79898. '�' => 's',
  79899. '�' => 't',
  79900. '�' => 'u',
  79901. '�' => 'v',
  79902. '�' => 'w',
  79903. '�' => 'x',
  79904. '�' => 'y',
  79905. '�' => 'z',
  79906. '�' => 'A',
  79907. '�' => 'B',
  79908. '�' => 'C',
  79909. '�' => 'D',
  79910. '�' => 'E',
  79911. '�' => 'F',
  79912. '�' => 'G',
  79913. '�' => 'H',
  79914. '�' => 'I',
  79915. '�' => 'J',
  79916. '�' => 'K',
  79917. '�' => 'L',
  79918. '�' => 'M',
  79919. '�' => 'N',
  79920. '�' => 'O',
  79921. '�' => 'P',
  79922. '�' => 'Q',
  79923. '�' => 'R',
  79924. '�' => 'S',
  79925. '�' => 'T',
  79926. '�' => 'U',
  79927. '�' => 'V',
  79928. '�' => 'W',
  79929. '�' => 'X',
  79930. '�' => 'Y',
  79931. '�' => 'Z',
  79932. '�' => 'a',
  79933. '�' => 'b',
  79934. '�' => 'c',
  79935. '�' => 'd',
  79936. '�' => 'e',
  79937. '�' => 'f',
  79938. '�' => 'g',
  79939. '�' => 'h',
  79940. '�' => 'i',
  79941. '�' => 'j',
  79942. '�' => 'k',
  79943. '�' => 'l',
  79944. '�' => 'm',
  79945. '�' => 'n',
  79946. '�' => 'o',
  79947. '�' => 'p',
  79948. '�' => 'q',
  79949. '�' => 'r',
  79950. '�' => 's',
  79951. '�' => 't',
  79952. '�' => 'u',
  79953. '�' => 'v',
  79954. '�' => 'w',
  79955. '�' => 'x',
  79956. '�' => 'y',
  79957. '�' => 'z',
  79958. '�' => 'ı',
  79959. '�' => 'ȷ',
  79960. '�' => 'Α',
  79961. '�' => 'Β',
  79962. '�' => 'Γ',
  79963. '�' => 'Δ',
  79964. '�' => 'Ε',
  79965. '�' => 'Ζ',
  79966. '�' => 'Η',
  79967. '�' => 'Θ',
  79968. '�' => 'Ι',
  79969. '�' => 'Κ',
  79970. '�' => 'Λ',
  79971. '�' => 'Μ',
  79972. '�' => '�',
  79973. '�' => 'Ξ',
  79974. '�' => 'Ο',
  79975. '�' => 'Π',
  79976. '�' => 'Ρ',
  79977. '�' => 'Θ',
  79978. '�' => 'Σ',
  79979. '�' => 'Τ',
  79980. '�' => 'Υ',
  79981. '�' => 'Φ',
  79982. '�' => 'Χ',
  79983. '�' => 'Ψ',
  79984. '�' => 'Ω',
  79985. '�' => '∇',
  79986. '�' => 'α',
  79987. '�' => 'β',
  79988. '�' => 'γ',
  79989. '�' => 'δ',
  79990. '�' => 'ε',
  79991. '�' => 'ζ',
  79992. '�' => 'η',
  79993. '�' => 'θ',
  79994. '�' => 'ι',
  79995. '�' => 'κ',
  79996. '�' => 'λ',
  79997. '�' => 'μ',
  79998. '�' => 'ν',
  79999. '�' => 'ξ',
  80000. '�' => 'ο',
  80001. '�' => 'π',
  80002. '�' => '�',
  80003. '�' => 'ς',
  80004. '�' => 'σ',
  80005. '�' => 'τ',
  80006. '�' => 'υ',
  80007. '�' => 'φ',
  80008. '�' => 'χ',
  80009. '�' => 'ψ',
  80010. '�' => 'ω',
  80011. '�' => '∂',
  80012. '�' => 'ε',
  80013. '�' => 'θ',
  80014. '�' => 'κ',
  80015. '�' => 'φ',
  80016. '�' => '�',
  80017. '�' => 'π',
  80018. '�' => 'Α',
  80019. '�' => 'Β',
  80020. '�' => 'Γ',
  80021. '�' => 'Δ',
  80022. '�' => 'Ε',
  80023. '�' => 'Ζ',
  80024. '�' => 'Η',
  80025. '�' => 'Θ',
  80026. '�' => 'Ι',
  80027. '�' => 'Κ',
  80028. '�' => 'Λ',
  80029. '�' => 'Μ',
  80030. '�' => '�',
  80031. '�' => 'Ξ',
  80032. '�' => 'Ο',
  80033. '�' => 'Π',
  80034. '�' => 'Ρ',
  80035. '�' => 'Θ',
  80036. '�' => 'Σ',
  80037. '�' => 'Τ',
  80038. '�' => 'Υ',
  80039. '�' => 'Φ',
  80040. '�' => 'Χ',
  80041. '�' => 'Ψ',
  80042. '�' => 'Ω',
  80043. '�' => '∇',
  80044. '�' => 'α',
  80045. '�' => 'β',
  80046. '�' => 'γ',
  80047. '�' => 'δ',
  80048. '�' => 'ε',
  80049. '�' => 'ζ',
  80050. '�' => 'η',
  80051. '�' => 'θ',
  80052. '�' => 'ι',
  80053. '�' => 'κ',
  80054. '�' => 'λ',
  80055. '�' => 'μ',
  80056. '�' => 'ν',
  80057. '�' => 'ξ',
  80058. '�' => 'ο',
  80059. '�' => 'π',
  80060. '�' => '�',
  80061. '�' => 'ς',
  80062. '�' => 'σ',
  80063. '�' => 'τ',
  80064. '�' => 'υ',
  80065. '�' => 'φ',
  80066. '�' => 'χ',
  80067. '�' => 'ψ',
  80068. '�' => 'ω',
  80069. '�' => '∂',
  80070. '�' => 'ε',
  80071. '�' => 'θ',
  80072. '�' => 'κ',
  80073. '�' => 'φ',
  80074. '�' => '�',
  80075. '�' => 'π',
  80076. '�' => 'Α',
  80077. '�' => 'Β',
  80078. '�' => 'Γ',
  80079. '�' => 'Δ',
  80080. '�' => 'Ε',
  80081. '�' => 'Ζ',
  80082. '�' => 'Η',
  80083. '�' => 'Θ',
  80084. '�' => 'Ι',
  80085. '�' => 'Κ',
  80086. '�' => 'Λ',
  80087. '�' => 'Μ',
  80088. '�' => '�',
  80089. '�' => 'Ξ',
  80090. '�' => 'Ο',
  80091. '�' => 'Π',
  80092. '�' => 'Ρ',
  80093. '�' => 'Θ',
  80094. '�' => 'Σ',
  80095. '�' => 'Τ',
  80096. '�' => 'Υ',
  80097. '�' => 'Φ',
  80098. '�' => 'Χ',
  80099. '�' => 'Ψ',
  80100. '�' => 'Ω',
  80101. '�' => '∇',
  80102. '�' => 'α',
  80103. '�' => 'β',
  80104. '�' => 'γ',
  80105. '�' => 'δ',
  80106. '�' => 'ε',
  80107. '�' => 'ζ',
  80108. '�' => 'η',
  80109. '�' => 'θ',
  80110. '�' => 'ι',
  80111. '�' => 'κ',
  80112. '�' => 'λ',
  80113. '�' => 'μ',
  80114. '�' => 'ν',
  80115. '�' => 'ξ',
  80116. '�' => 'ο',
  80117. '�' => 'π',
  80118. '�' => '�',
  80119. '�' => 'ς',
  80120. '�' => 'σ',
  80121. '�' => 'τ',
  80122. '�' => 'υ',
  80123. '�' => 'φ',
  80124. '�' => 'χ',
  80125. '�' => 'ψ',
  80126. '�' => 'ω',
  80127. '�' => '∂',
  80128. '�' => 'ε',
  80129. '�' => 'θ',
  80130. '�' => 'κ',
  80131. '�' => 'φ',
  80132. '�' => '�',
  80133. '�' => 'π',
  80134. '�' => 'Α',
  80135. '�' => 'Β',
  80136. '�' => 'Γ',
  80137. '�' => 'Δ',
  80138. '�' => 'Ε',
  80139. '�' => 'Ζ',
  80140. '�' => 'Η',
  80141. '�' => 'Θ',
  80142. '�' => 'Ι',
  80143. '�' => 'Κ',
  80144. '�' => 'Λ',
  80145. '�' => 'Μ',
  80146. '�' => '�',
  80147. '�' => 'Ξ',
  80148. '�' => 'Ο',
  80149. '�' => 'Π',
  80150. '�' => 'Ρ',
  80151. '�' => 'Θ',
  80152. '�' => 'Σ',
  80153. '�' => 'Τ',
  80154. '�' => 'Υ',
  80155. '�' => 'Φ',
  80156. '�' => 'Χ',
  80157. '�' => 'Ψ',
  80158. '�' => 'Ω',
  80159. '�' => '∇',
  80160. '�' => 'α',
  80161. '�' => 'β',
  80162. '�' => 'γ',
  80163. '�' => 'δ',
  80164. '�' => 'ε',
  80165. '�' => 'ζ',
  80166. '�' => 'η',
  80167. '�' => 'θ',
  80168. '�' => 'ι',
  80169. '�' => 'κ',
  80170. '�' => 'λ',
  80171. '�' => 'μ',
  80172. '�' => 'ν',
  80173. '�' => 'ξ',
  80174. '�' => 'ο',
  80175. '�' => 'π',
  80176. '�' => '�',
  80177. '�' => 'ς',
  80178. '�' => 'σ',
  80179. '�' => 'τ',
  80180. '�' => 'υ',
  80181. '�' => 'φ',
  80182. '�' => 'χ',
  80183. '�' => 'ψ',
  80184. '�' => 'ω',
  80185. '�' => '∂',
  80186. '�' => 'ε',
  80187. '�' => 'θ',
  80188. '�' => 'κ',
  80189. '�' => 'φ',
  80190. '�' => '�',
  80191. '�' => 'π',
  80192. '�' => 'Α',
  80193. '�' => 'Β',
  80194. '�' => 'Γ',
  80195. '�' => 'Δ',
  80196. '�' => 'Ε',
  80197. '�' => 'Ζ',
  80198. '�' => 'Η',
  80199. '�' => 'Θ',
  80200. '�' => 'Ι',
  80201. '�' => 'Κ',
  80202. '�' => 'Λ',
  80203. '�' => 'Μ',
  80204. '�' => '�',
  80205. '�' => 'Ξ',
  80206. '�' => 'Ο',
  80207. '�' => 'Π',
  80208. '�' => 'Ρ',
  80209. '�' => 'Θ',
  80210. '�' => 'Σ',
  80211. '�' => 'Τ',
  80212. '�' => 'Υ',
  80213. '�' => 'Φ',
  80214. '�' => 'Χ',
  80215. '�' => 'Ψ',
  80216. '�' => 'Ω',
  80217. '�' => '∇',
  80218. '�' => 'α',
  80219. '�' => 'β',
  80220. '�' => 'γ',
  80221. '�' => 'δ',
  80222. '�' => 'ε',
  80223. '�' => 'ζ',
  80224. '�' => 'η',
  80225. '�' => 'θ',
  80226. '�' => 'ι',
  80227. '�' => 'κ',
  80228. '�' => 'λ',
  80229. '�' => 'μ',
  80230. '�' => 'ν',
  80231. '�' => 'ξ',
  80232. '�' => 'ο',
  80233. '�' => 'π',
  80234. '�' => '�',
  80235. '�' => 'ς',
  80236. '�' => 'σ',
  80237. '�' => 'τ',
  80238. '�' => 'υ',
  80239. '�' => 'φ',
  80240. '�' => 'χ',
  80241. '�' => 'ψ',
  80242. '�' => 'ω',
  80243. '�' => '∂',
  80244. '�' => 'ε',
  80245. '�' => 'θ',
  80246. '�' => 'κ',
  80247. '�' => 'φ',
  80248. '�' => '�',
  80249. '�' => 'π',
  80250. '�' => 'Ϝ',
  80251. '�' => '�',
  80252. '�' => '0',
  80253. '�' => '1',
  80254. '�' => '2',
  80255. '�' => '3',
  80256. '�' => '4',
  80257. '�' => '5',
  80258. '�' => '6',
  80259. '�' => '7',
  80260. '�' => '8',
  80261. '�' => '9',
  80262. '�' => '0',
  80263. '�' => '1',
  80264. '�' => '2',
  80265. '�' => '3',
  80266. '�' => '4',
  80267. '�' => '5',
  80268. '�' => '6',
  80269. '�' => '7',
  80270. '�' => '8',
  80271. '�' => '9',
  80272. '�' => '0',
  80273. '�' => '1',
  80274. '�' => '2',
  80275. '�' => '3',
  80276. '�' => '4',
  80277. '�' => '5',
  80278. '�' => '6',
  80279. '�' => '7',
  80280. '�' => '8',
  80281. '�' => '9',
  80282. '�' => '0',
  80283. '�' => '1',
  80284. '�' => '2',
  80285. '�' => '3',
  80286. '�' => '4',
  80287. '�' => '5',
  80288. '�' => '6',
  80289. '�' => '7',
  80290. '�' => '8',
  80291. '�' => '9',
  80292. '�' => '0',
  80293. '�' => '1',
  80294. '�' => '2',
  80295. '�' => '3',
  80296. '�' => '4',
  80297. '�' => '5',
  80298. '�' => '6',
  80299. '�' => '7',
  80300. '�' => '8',
  80301. '�' => '9',
  80302. '𞸀' => 'ا',
  80303. '�' => 'ب',
  80304. '𞸂' => 'ج',
  80305. '𞸃' => 'د',
  80306. '𞸅' => 'و',
  80307. '𞸆' => 'ز',
  80308. '𞸇' => 'ح',
  80309. '𞸈' => 'ط',
  80310. '𞸉' => 'ي',
  80311. '𞸊' => 'ك',
  80312. '𞸋' => 'ل',
  80313. '𞸌' => 'م',
  80314. '�' => 'ن',
  80315. '𞸎' => 'س',
  80316. '�' => 'ع',
  80317. '�' => '�',
  80318. '𞸑' => 'ص',
  80319. '𞸒' => 'ق',
  80320. '𞸓' => 'ر',
  80321. '𞸔' => 'ش',
  80322. '𞸕' => 'ت',
  80323. '𞸖' => 'ث',
  80324. '𞸗' => 'خ',
  80325. '𞸘' => 'ذ',
  80326. '𞸙' => 'ض',
  80327. '𞸚' => 'ظ',
  80328. '𞸛' => 'غ',
  80329. '𞸜' => 'ٮ',
  80330. '�' => 'ں',
  80331. '𞸞' => 'ڡ',
  80332. '𞸟' => 'ٯ',
  80333. '𞸡' => 'ب',
  80334. '𞸢' => 'ج',
  80335. '𞸤' => 'ه',
  80336. '𞸧' => 'ح',
  80337. '𞸩' => 'ي',
  80338. '𞸪' => 'ك',
  80339. '𞸫' => 'ل',
  80340. '𞸬' => 'م',
  80341. '𞸭' => 'ن',
  80342. '𞸮' => 'س',
  80343. '𞸯' => 'ع',
  80344. '𞸰' => '�',
  80345. '𞸱' => 'ص',
  80346. '𞸲' => 'ق',
  80347. '𞸴' => 'ش',
  80348. '𞸵' => 'ت',
  80349. '𞸶' => 'ث',
  80350. '𞸷' => 'خ',
  80351. '𞸹' => 'ض',
  80352. '𞸻' => 'غ',
  80353. '𞹂' => 'ج',
  80354. '𞹇' => 'ح',
  80355. '𞹉' => 'ي',
  80356. '𞹋' => 'ل',
  80357. '�' => 'ن',
  80358. '𞹎' => 'س',
  80359. '�' => 'ع',
  80360. '𞹑' => 'ص',
  80361. 'ðž¹’' => 'Ù‚',
  80362. 'ðž¹”' => 'Ø´',
  80363. 'ðž¹—' => 'Ø®',
  80364. '𞹙' => 'ض',
  80365. '𞹛' => 'غ',
  80366. '�' => 'ں',
  80367. '𞹟' => 'ٯ',
  80368. '𞹡' => 'ب',
  80369. '𞹢' => 'ج',
  80370. '𞹤' => 'ه',
  80371. '𞹧' => 'ح',
  80372. '𞹨' => 'ط',
  80373. '𞹩' => 'ي',
  80374. '𞹪' => 'ك',
  80375. '𞹬' => 'م',
  80376. 'ðž¹­' => 'Ù†',
  80377. '𞹮' => 'س',
  80378. '𞹯' => 'ع',
  80379. 'ðž¹°' => 'Ù�',
  80380. '𞹱' => 'ص',
  80381. 'ðž¹²' => 'Ù‚',
  80382. 'ðž¹´' => 'Ø´',
  80383. '𞹵' => 'ت',
  80384. '𞹶' => 'ث',
  80385. 'ðž¹·' => 'Ø®',
  80386. '𞹹' => 'ض',
  80387. '𞹺' => 'ظ',
  80388. '𞹻' => 'غ',
  80389. 'ðž¹¼' => 'Ù®',
  80390. 'ðž¹¾' => 'Ú¡',
  80391. '𞺀' => 'ا',
  80392. '�' => 'ب',
  80393. '𞺂' => 'ج',
  80394. '𞺃' => 'د',
  80395. '𞺄' => 'ه',
  80396. '𞺅' => 'و',
  80397. '𞺆' => 'ز',
  80398. '𞺇' => 'ح',
  80399. '𞺈' => 'ط',
  80400. '𞺉' => 'ي',
  80401. '𞺋' => 'ل',
  80402. '𞺌' => 'م',
  80403. '�' => 'ن',
  80404. '𞺎' => 'س',
  80405. '�' => 'ع',
  80406. '�' => '�',
  80407. '𞺑' => 'ص',
  80408. '𞺒' => 'ق',
  80409. '𞺓' => 'ر',
  80410. '𞺔' => 'ش',
  80411. '𞺕' => 'ت',
  80412. '𞺖' => 'ث',
  80413. '𞺗' => 'خ',
  80414. '𞺘' => 'ذ',
  80415. '𞺙' => 'ض',
  80416. '𞺚' => 'ظ',
  80417. '𞺛' => 'غ',
  80418. '𞺡' => 'ب',
  80419. '𞺢' => 'ج',
  80420. '𞺣' => 'د',
  80421. '𞺥' => 'و',
  80422. '𞺦' => 'ز',
  80423. '𞺧' => 'ح',
  80424. '𞺨' => 'ط',
  80425. '𞺩' => 'ي',
  80426. '𞺫' => 'ل',
  80427. '𞺬' => 'م',
  80428. '𞺭' => 'ن',
  80429. '𞺮' => 'س',
  80430. '𞺯' => 'ع',
  80431. '𞺰' => '�',
  80432. '𞺱' => 'ص',
  80433. '𞺲' => 'ق',
  80434. '𞺳' => 'ر',
  80435. '𞺴' => 'ش',
  80436. '𞺵' => 'ت',
  80437. '𞺶' => 'ث',
  80438. '𞺷' => 'خ',
  80439. '𞺸' => 'ذ',
  80440. '𞺹' => 'ض',
  80441. '𞺺' => 'ظ',
  80442. '𞺻' => 'غ',
  80443. '🄀' => '0.',
  80444. '�' => '0,',
  80445. '🄂' => '1,',
  80446. '🄃' => '2,',
  80447. '🄄' => '3,',
  80448. '🄅' => '4,',
  80449. '🄆' => '5,',
  80450. '🄇' => '6,',
  80451. '🄈' => '7,',
  80452. '🄉' => '8,',
  80453. '🄊' => '9,',
  80454. '�' => '(A)',
  80455. '🄑' => '(B)',
  80456. '🄒' => '(C)',
  80457. '🄓' => '(D)',
  80458. '🄔' => '(E)',
  80459. '🄕' => '(F)',
  80460. '🄖' => '(G)',
  80461. '🄗' => '(H)',
  80462. '🄘' => '(I)',
  80463. '🄙' => '(J)',
  80464. '🄚' => '(K)',
  80465. '🄛' => '(L)',
  80466. '🄜' => '(M)',
  80467. '�' => '(N)',
  80468. '🄞' => '(O)',
  80469. '🄟' => '(P)',
  80470. '🄠' => '(Q)',
  80471. '🄡' => '(R)',
  80472. '🄢' => '(S)',
  80473. '🄣' => '(T)',
  80474. '🄤' => '(U)',
  80475. '🄥' => '(V)',
  80476. '🄦' => '(W)',
  80477. '🄧' => '(X)',
  80478. '🄨' => '(Y)',
  80479. '🄩' => '(Z)',
  80480. '🄪' => '〔S〕',
  80481. '🄫' => 'C',
  80482. '🄬' => 'R',
  80483. '🄭' => 'CD',
  80484. '🄮' => 'WZ',
  80485. '🄰' => 'A',
  80486. '🄱' => 'B',
  80487. '🄲' => 'C',
  80488. '🄳' => 'D',
  80489. '🄴' => 'E',
  80490. '🄵' => 'F',
  80491. '🄶' => 'G',
  80492. '🄷' => 'H',
  80493. '🄸' => 'I',
  80494. '🄹' => 'J',
  80495. '🄺' => 'K',
  80496. '🄻' => 'L',
  80497. '🄼' => 'M',
  80498. '🄽' => 'N',
  80499. '🄾' => 'O',
  80500. '🄿' => 'P',
  80501. '🅀' => 'Q',
  80502. '�' => 'R',
  80503. '🅂' => 'S',
  80504. '🅃' => 'T',
  80505. '🅄' => 'U',
  80506. '🅅' => 'V',
  80507. '🅆' => 'W',
  80508. '🅇' => 'X',
  80509. '🅈' => 'Y',
  80510. '🅉' => 'Z',
  80511. '🅊' => 'HV',
  80512. '🅋' => 'MV',
  80513. '🅌' => 'SD',
  80514. '�' => 'SS',
  80515. '🅎' => 'PPV',
  80516. '�' => 'WC',
  80517. '🅪' => 'MC',
  80518. '🅫' => 'MD',
  80519. '🅬' => 'MR',
  80520. '�' => 'DJ',
  80521. '🈀' => '��',
  80522. '�' => 'ココ',
  80523. '🈂' => 'サ',
  80524. '�' => '手',
  80525. '🈑' => '字',
  80526. '🈒' => '�',
  80527. '🈓' => 'デ',
  80528. '🈔' => '二',
  80529. '🈕' => '多',
  80530. '🈖' => '解',
  80531. '🈗' => '天',
  80532. '🈘' => '交',
  80533. '🈙' => '映',
  80534. '🈚' => '無',
  80535. '🈛' => '料',
  80536. '🈜' => '�',
  80537. '�' => '後',
  80538. '🈞' => '�',
  80539. '🈟' => '新',
  80540. '🈠' => '�',
  80541. '🈡' => '終',
  80542. '🈢' => '生',
  80543. '🈣' => '販',
  80544. '🈤' => '声',
  80545. '🈥' => '�',
  80546. '🈦' => '演',
  80547. '🈧' => '投',
  80548. '🈨' => '�',
  80549. '🈩' => '一',
  80550. '🈪' => '三',
  80551. '🈫' => '�',
  80552. '🈬' => '左',
  80553. '🈭' => '中',
  80554. '🈮' => '�',
  80555. '🈯' => '指',
  80556. '🈰' => '走',
  80557. '🈱' => '打',
  80558. '🈲' => '�',
  80559. '🈳' => '空',
  80560. '🈴' => '�',
  80561. '🈵' => '満',
  80562. '🈶' => '有',
  80563. '🈷' => '月',
  80564. '🈸' => '申',
  80565. '🈹' => '割',
  80566. '🈺' => '営',
  80567. '🈻' => '�',
  80568. '🉀' => '〔本〕',
  80569. '�' => '〔三〕',
  80570. '🉂' => '〔二〕',
  80571. '🉃' => '〔安〕',
  80572. '🉄' => '〔点〕',
  80573. '🉅' => '〔打〕',
  80574. '🉆' => '〔盗〕',
  80575. '🉇' => '〔�〕',
  80576. '🉈' => '〔敗〕',
  80577. '�' => '得',
  80578. '🉑' => '�',
  80579. '🯰' => '0',
  80580. '🯱' => '1',
  80581. '🯲' => '2',
  80582. '🯳' => '3',
  80583. '🯴' => '4',
  80584. '🯵' => '5',
  80585. '🯶' => '6',
  80586. '🯷' => '7',
  80587. '🯸' => '8',
  80588. '🯹' => '9',
  80589. );
  80590. <?php
  80591. use Symfony\Polyfill\Intl\Normalizer as p;
  80592. if (\PHP_VERSION_ID >= 80000) {
  80593. return require __DIR__.'/bootstrap80.php';
  80594. }
  80595. if (!function_exists('normalizer_is_normalized')) {
  80596. function normalizer_is_normalized($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::isNormalized($string, $form); }
  80597. }
  80598. if (!function_exists('normalizer_normalize')) {
  80599. function normalizer_normalize($string, $form = p\Normalizer::FORM_C) { return p\Normalizer::normalize($string, $form); }
  80600. }
  80601. <?php
  80602. use Symfony\Polyfill\Intl\Normalizer as p;
  80603. if (!function_exists('normalizer_is_normalized')) {
  80604. function normalizer_is_normalized(?string $string, ?int $form = p\Normalizer::FORM_C): bool { return p\Normalizer::isNormalized((string) $string, (int) $form); }
  80605. }
  80606. if (!function_exists('normalizer_normalize')) {
  80607. function normalizer_normalize(?string $string, ?int $form = p\Normalizer::FORM_C): string|false { return p\Normalizer::normalize((string) $string, (int) $form); }
  80608. }
  80609. Copyright (c) 2015-present Fabien Potencier
  80610. Permission is hereby granted, free of charge, to any person obtaining a copy
  80611. of this software and associated documentation files (the "Software"), to deal
  80612. in the Software without restriction, including without limitation the rights
  80613. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  80614. copies of the Software, and to permit persons to whom the Software is furnished
  80615. to do so, subject to the following conditions:
  80616. The above copyright notice and this permission notice shall be included in all
  80617. copies or substantial portions of the Software.
  80618. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  80619. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  80620. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  80621. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  80622. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  80623. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  80624. THE SOFTWARE.
  80625. <?php
  80626. namespace Symfony\Polyfill\Mbstring;
  80627. final class Mbstring
  80628. {
  80629. public const MB_CASE_FOLD = \PHP_INT_MAX;
  80630. private const SIMPLE_CASE_FOLD = [
  80631. ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"],
  80632. ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'],
  80633. ];
  80634. private static $encodingList = ['ASCII', 'UTF-8'];
  80635. private static $language = 'neutral';
  80636. private static $internalEncoding = 'UTF-8';
  80637. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  80638. {
  80639. if (\is_array($s)) {
  80640. $r = [];
  80641. foreach ($s as $str) {
  80642. $r[] = self::mb_convert_encoding($str, $toEncoding, $fromEncoding);
  80643. }
  80644. return $r;
  80645. }
  80646. if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) {
  80647. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  80648. } else {
  80649. $fromEncoding = self::getEncoding($fromEncoding);
  80650. }
  80651. $toEncoding = self::getEncoding($toEncoding);
  80652. if ('BASE64' === $fromEncoding) {
  80653. $s = base64_decode($s);
  80654. $fromEncoding = $toEncoding;
  80655. }
  80656. if ('BASE64' === $toEncoding) {
  80657. return base64_encode($s);
  80658. }
  80659. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  80660. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  80661. $fromEncoding = 'Windows-1252';
  80662. }
  80663. if ('UTF-8' !== $fromEncoding) {
  80664. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  80665. }
  80666. return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s);
  80667. }
  80668. if ('HTML-ENTITIES' === $fromEncoding) {
  80669. $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8');
  80670. $fromEncoding = 'UTF-8';
  80671. }
  80672. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  80673. }
  80674. public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars)
  80675. {
  80676. $ok = true;
  80677. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  80678. if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  80679. $ok = false;
  80680. }
  80681. });
  80682. return $ok ? $fromEncoding : false;
  80683. }
  80684. public static function mb_decode_mimeheader($s)
  80685. {
  80686. return iconv_mime_decode($s, 2, self::$internalEncoding);
  80687. }
  80688. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  80689. {
  80690. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING);
  80691. }
  80692. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  80693. {
  80694. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
  80695. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  80696. return null;
  80697. }
  80698. if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
  80699. return false;
  80700. }
  80701. if (null !== $encoding && !\is_scalar($encoding)) {
  80702. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  80703. return '';
  80704. }
  80705. $s = (string) $s;
  80706. if ('' === $s) {
  80707. return '';
  80708. }
  80709. $encoding = self::getEncoding($encoding);
  80710. if ('UTF-8' === $encoding) {
  80711. $encoding = null;
  80712. if (!preg_match('//u', $s)) {
  80713. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  80714. }
  80715. } else {
  80716. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  80717. }
  80718. $cnt = floor(\count($convmap) / 4) * 4;
  80719. for ($i = 0; $i < $cnt; $i += 4) {
  80720. $convmap[$i] += $convmap[$i + 2];
  80721. $convmap[$i + 1] += $convmap[$i + 2];
  80722. }
  80723. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  80724. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  80725. for ($i = 0; $i < $cnt; $i += 4) {
  80726. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  80727. return self::mb_chr($c - $convmap[$i + 2]);
  80728. }
  80729. }
  80730. return $m[0];
  80731. }, $s);
  80732. if (null === $encoding) {
  80733. return $s;
  80734. }
  80735. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  80736. }
  80737. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  80738. {
  80739. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
  80740. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  80741. return null;
  80742. }
  80743. if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) {
  80744. return false;
  80745. }
  80746. if (null !== $encoding && !\is_scalar($encoding)) {
  80747. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
  80748. return null;
  80749. }
  80750. if (null !== $is_hex && !\is_scalar($is_hex)) {
  80751. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING);
  80752. return null;
  80753. }
  80754. $s = (string) $s;
  80755. if ('' === $s) {
  80756. return '';
  80757. }
  80758. $encoding = self::getEncoding($encoding);
  80759. if ('UTF-8' === $encoding) {
  80760. $encoding = null;
  80761. if (!preg_match('//u', $s)) {
  80762. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  80763. }
  80764. } else {
  80765. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  80766. }
  80767. static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  80768. $cnt = floor(\count($convmap) / 4) * 4;
  80769. $i = 0;
  80770. $len = \strlen($s);
  80771. $result = '';
  80772. while ($i < $len) {
  80773. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  80774. $uchr = substr($s, $i, $ulen);
  80775. $i += $ulen;
  80776. $c = self::mb_ord($uchr);
  80777. for ($j = 0; $j < $cnt; $j += 4) {
  80778. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  80779. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  80780. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  80781. continue 2;
  80782. }
  80783. }
  80784. $result .= $uchr;
  80785. }
  80786. if (null === $encoding) {
  80787. return $result;
  80788. }
  80789. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  80790. }
  80791. public static function mb_convert_case($s, $mode, $encoding = null)
  80792. {
  80793. $s = (string) $s;
  80794. if ('' === $s) {
  80795. return '';
  80796. }
  80797. $encoding = self::getEncoding($encoding);
  80798. if ('UTF-8' === $encoding) {
  80799. $encoding = null;
  80800. if (!preg_match('//u', $s)) {
  80801. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  80802. }
  80803. } else {
  80804. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  80805. }
  80806. if (\MB_CASE_TITLE == $mode) {
  80807. static $titleRegexp = null;
  80808. if (null === $titleRegexp) {
  80809. $titleRegexp = self::getData('titleCaseRegexp');
  80810. }
  80811. $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s);
  80812. } else {
  80813. if (\MB_CASE_UPPER == $mode) {
  80814. static $upper = null;
  80815. if (null === $upper) {
  80816. $upper = self::getData('upperCase');
  80817. }
  80818. $map = $upper;
  80819. } else {
  80820. if (self::MB_CASE_FOLD === $mode) {
  80821. static $caseFolding = null;
  80822. if (null === $caseFolding) {
  80823. $caseFolding = self::getData('caseFolding');
  80824. }
  80825. $s = strtr($s, $caseFolding);
  80826. }
  80827. static $lower = null;
  80828. if (null === $lower) {
  80829. $lower = self::getData('lowerCase');
  80830. }
  80831. $map = $lower;
  80832. }
  80833. static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
  80834. $i = 0;
  80835. $len = \strlen($s);
  80836. while ($i < $len) {
  80837. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  80838. $uchr = substr($s, $i, $ulen);
  80839. $i += $ulen;
  80840. if (isset($map[$uchr])) {
  80841. $uchr = $map[$uchr];
  80842. $nlen = \strlen($uchr);
  80843. if ($nlen == $ulen) {
  80844. $nlen = $i;
  80845. do {
  80846. $s[--$nlen] = $uchr[--$ulen];
  80847. } while ($ulen);
  80848. } else {
  80849. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  80850. $len += $nlen - $ulen;
  80851. $i += $nlen - $ulen;
  80852. }
  80853. }
  80854. }
  80855. }
  80856. if (null === $encoding) {
  80857. return $s;
  80858. }
  80859. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  80860. }
  80861. public static function mb_internal_encoding($encoding = null)
  80862. {
  80863. if (null === $encoding) {
  80864. return self::$internalEncoding;
  80865. }
  80866. $normalizedEncoding = self::getEncoding($encoding);
  80867. if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
  80868. self::$internalEncoding = $normalizedEncoding;
  80869. return true;
  80870. }
  80871. if (80000 > \PHP_VERSION_ID) {
  80872. return false;
  80873. }
  80874. throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding));
  80875. }
  80876. public static function mb_language($lang = null)
  80877. {
  80878. if (null === $lang) {
  80879. return self::$language;
  80880. }
  80881. switch ($normalizedLang = strtolower($lang)) {
  80882. case 'uni':
  80883. case 'neutral':
  80884. self::$language = $normalizedLang;
  80885. return true;
  80886. }
  80887. if (80000 > \PHP_VERSION_ID) {
  80888. return false;
  80889. }
  80890. throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang));
  80891. }
  80892. public static function mb_list_encodings()
  80893. {
  80894. return ['UTF-8'];
  80895. }
  80896. public static function mb_encoding_aliases($encoding)
  80897. {
  80898. switch (strtoupper($encoding)) {
  80899. case 'UTF8':
  80900. case 'UTF-8':
  80901. return ['utf8'];
  80902. }
  80903. return false;
  80904. }
  80905. public static function mb_check_encoding($var = null, $encoding = null)
  80906. {
  80907. if (null === $encoding) {
  80908. if (null === $var) {
  80909. return false;
  80910. }
  80911. $encoding = self::$internalEncoding;
  80912. }
  80913. if (!\is_array($var)) {
  80914. return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var);
  80915. }
  80916. foreach ($var as $key => $value) {
  80917. if (!self::mb_check_encoding($key, $encoding)) {
  80918. return false;
  80919. }
  80920. if (!self::mb_check_encoding($value, $encoding)) {
  80921. return false;
  80922. }
  80923. }
  80924. return true;
  80925. }
  80926. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  80927. {
  80928. if (null === $encodingList) {
  80929. $encodingList = self::$encodingList;
  80930. } else {
  80931. if (!\is_array($encodingList)) {
  80932. $encodingList = array_map('trim', explode(',', $encodingList));
  80933. }
  80934. $encodingList = array_map('strtoupper', $encodingList);
  80935. }
  80936. foreach ($encodingList as $enc) {
  80937. switch ($enc) {
  80938. case 'ASCII':
  80939. if (!preg_match('/[\x80-\xFF]/', $str)) {
  80940. return $enc;
  80941. }
  80942. break;
  80943. case 'UTF8':
  80944. case 'UTF-8':
  80945. if (preg_match('//u', $str)) {
  80946. return 'UTF-8';
  80947. }
  80948. break;
  80949. default:
  80950. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  80951. return $enc;
  80952. }
  80953. }
  80954. }
  80955. return false;
  80956. }
  80957. public static function mb_detect_order($encodingList = null)
  80958. {
  80959. if (null === $encodingList) {
  80960. return self::$encodingList;
  80961. }
  80962. if (!\is_array($encodingList)) {
  80963. $encodingList = array_map('trim', explode(',', $encodingList));
  80964. }
  80965. $encodingList = array_map('strtoupper', $encodingList);
  80966. foreach ($encodingList as $enc) {
  80967. switch ($enc) {
  80968. default:
  80969. if (strncmp($enc, 'ISO-8859-', 9)) {
  80970. return false;
  80971. }
  80972. case 'ASCII':
  80973. case 'UTF8':
  80974. case 'UTF-8':
  80975. }
  80976. }
  80977. self::$encodingList = $encodingList;
  80978. return true;
  80979. }
  80980. public static function mb_strlen($s, $encoding = null)
  80981. {
  80982. $encoding = self::getEncoding($encoding);
  80983. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  80984. return \strlen($s);
  80985. }
  80986. return @iconv_strlen($s, $encoding);
  80987. }
  80988. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  80989. {
  80990. $encoding = self::getEncoding($encoding);
  80991. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  80992. return strpos($haystack, $needle, $offset);
  80993. }
  80994. $needle = (string) $needle;
  80995. if ('' === $needle) {
  80996. if (80000 > \PHP_VERSION_ID) {
  80997. trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING);
  80998. return false;
  80999. }
  81000. return 0;
  81001. }
  81002. return iconv_strpos($haystack, $needle, $offset, $encoding);
  81003. }
  81004. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  81005. {
  81006. $encoding = self::getEncoding($encoding);
  81007. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  81008. return strrpos($haystack, $needle, $offset);
  81009. }
  81010. if ($offset != (int) $offset) {
  81011. $offset = 0;
  81012. } elseif ($offset = (int) $offset) {
  81013. if ($offset < 0) {
  81014. if (0 > $offset += self::mb_strlen($needle)) {
  81015. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  81016. }
  81017. $offset = 0;
  81018. } else {
  81019. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  81020. }
  81021. }
  81022. $pos = '' !== $needle || 80000 > \PHP_VERSION_ID
  81023. ? iconv_strrpos($haystack, $needle, $encoding)
  81024. : self::mb_strlen($haystack, $encoding);
  81025. return false !== $pos ? $offset + $pos : false;
  81026. }
  81027. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  81028. {
  81029. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
  81030. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING);
  81031. return null;
  81032. }
  81033. if (1 > $split_length = (int) $split_length) {
  81034. if (80000 > \PHP_VERSION_ID) {
  81035. trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING);
  81036. return false;
  81037. }
  81038. throw new \ValueError('Argument #2 ($length) must be greater than 0');
  81039. }
  81040. if (null === $encoding) {
  81041. $encoding = mb_internal_encoding();
  81042. }
  81043. if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
  81044. $rx = '/(';
  81045. while (65535 < $split_length) {
  81046. $rx .= '.{65535}';
  81047. $split_length -= 65535;
  81048. }
  81049. $rx .= '.{'.$split_length.'})/us';
  81050. return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
  81051. }
  81052. $result = [];
  81053. $length = mb_strlen($string, $encoding);
  81054. for ($i = 0; $i < $length; $i += $split_length) {
  81055. $result[] = mb_substr($string, $i, $split_length, $encoding);
  81056. }
  81057. return $result;
  81058. }
  81059. public static function mb_strtolower($s, $encoding = null)
  81060. {
  81061. return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding);
  81062. }
  81063. public static function mb_strtoupper($s, $encoding = null)
  81064. {
  81065. return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding);
  81066. }
  81067. public static function mb_substitute_character($c = null)
  81068. {
  81069. if (null === $c) {
  81070. return 'none';
  81071. }
  81072. if (0 === strcasecmp($c, 'none')) {
  81073. return true;
  81074. }
  81075. if (80000 > \PHP_VERSION_ID) {
  81076. return false;
  81077. }
  81078. if (\is_int($c) || 'long' === $c || 'entity' === $c) {
  81079. return false;
  81080. }
  81081. throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint');
  81082. }
  81083. public static function mb_substr($s, $start, $length = null, $encoding = null)
  81084. {
  81085. $encoding = self::getEncoding($encoding);
  81086. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  81087. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  81088. }
  81089. if ($start < 0) {
  81090. $start = iconv_strlen($s, $encoding) + $start;
  81091. if ($start < 0) {
  81092. $start = 0;
  81093. }
  81094. }
  81095. if (null === $length) {
  81096. $length = 2147483647;
  81097. } elseif ($length < 0) {
  81098. $length = iconv_strlen($s, $encoding) + $length - $start;
  81099. if ($length < 0) {
  81100. return '';
  81101. }
  81102. }
  81103. return (string) iconv_substr($s, $start, $length, $encoding);
  81104. }
  81105. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  81106. {
  81107. [$haystack, $needle] = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], [
  81108. self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding),
  81109. self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding),
  81110. ]);
  81111. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  81112. }
  81113. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  81114. {
  81115. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  81116. return self::getSubpart($pos, $part, $haystack, $encoding);
  81117. }
  81118. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  81119. {
  81120. $encoding = self::getEncoding($encoding);
  81121. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  81122. $pos = strrpos($haystack, $needle);
  81123. } else {
  81124. $needle = self::mb_substr($needle, 0, 1, $encoding);
  81125. $pos = iconv_strrpos($haystack, $needle, $encoding);
  81126. }
  81127. return self::getSubpart($pos, $part, $haystack, $encoding);
  81128. }
  81129. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  81130. {
  81131. $needle = self::mb_substr($needle, 0, 1, $encoding);
  81132. $pos = self::mb_strripos($haystack, $needle, $encoding);
  81133. return self::getSubpart($pos, $part, $haystack, $encoding);
  81134. }
  81135. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  81136. {
  81137. $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding);
  81138. $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding);
  81139. $haystack = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $haystack);
  81140. $needle = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $needle);
  81141. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  81142. }
  81143. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  81144. {
  81145. $pos = strpos($haystack, $needle);
  81146. if (false === $pos) {
  81147. return false;
  81148. }
  81149. if ($part) {
  81150. return substr($haystack, 0, $pos);
  81151. }
  81152. return substr($haystack, $pos);
  81153. }
  81154. public static function mb_get_info($type = 'all')
  81155. {
  81156. $info = [
  81157. 'internal_encoding' => self::$internalEncoding,
  81158. 'http_output' => 'pass',
  81159. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  81160. 'func_overload' => 0,
  81161. 'func_overload_list' => 'no overload',
  81162. 'mail_charset' => 'UTF-8',
  81163. 'mail_header_encoding' => 'BASE64',
  81164. 'mail_body_encoding' => 'BASE64',
  81165. 'illegal_chars' => 0,
  81166. 'encoding_translation' => 'Off',
  81167. 'language' => self::$language,
  81168. 'detect_order' => self::$encodingList,
  81169. 'substitute_character' => 'none',
  81170. 'strict_detection' => 'Off',
  81171. ];
  81172. if ('all' === $type) {
  81173. return $info;
  81174. }
  81175. if (isset($info[$type])) {
  81176. return $info[$type];
  81177. }
  81178. return false;
  81179. }
  81180. public static function mb_http_input($type = '')
  81181. {
  81182. return false;
  81183. }
  81184. public static function mb_http_output($encoding = null)
  81185. {
  81186. return null !== $encoding ? 'pass' === $encoding : 'pass';
  81187. }
  81188. public static function mb_strwidth($s, $encoding = null)
  81189. {
  81190. $encoding = self::getEncoding($encoding);
  81191. if ('UTF-8' !== $encoding) {
  81192. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  81193. }
  81194. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  81195. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  81196. }
  81197. public static function mb_substr_count($haystack, $needle, $encoding = null)
  81198. {
  81199. return substr_count($haystack, $needle);
  81200. }
  81201. public static function mb_output_handler($contents, $status)
  81202. {
  81203. return $contents;
  81204. }
  81205. public static function mb_chr($code, $encoding = null)
  81206. {
  81207. if (0x80 > $code %= 0x200000) {
  81208. $s = \chr($code);
  81209. } elseif (0x800 > $code) {
  81210. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  81211. } elseif (0x10000 > $code) {
  81212. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  81213. } else {
  81214. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  81215. }
  81216. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  81217. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  81218. }
  81219. return $s;
  81220. }
  81221. public static function mb_ord($s, $encoding = null)
  81222. {
  81223. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  81224. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  81225. }
  81226. if (1 === \strlen($s)) {
  81227. return \ord($s);
  81228. }
  81229. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  81230. if (0xF0 <= $code) {
  81231. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  81232. }
  81233. if (0xE0 <= $code) {
  81234. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  81235. }
  81236. if (0xC0 <= $code) {
  81237. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  81238. }
  81239. return $code;
  81240. }
  81241. public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string
  81242. {
  81243. if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) {
  81244. throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH');
  81245. }
  81246. if (null === $encoding) {
  81247. $encoding = self::mb_internal_encoding();
  81248. } else {
  81249. self::assertEncoding($encoding, 'mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given');
  81250. }
  81251. if (self::mb_strlen($pad_string, $encoding) <= 0) {
  81252. throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string');
  81253. }
  81254. $paddingRequired = $length - self::mb_strlen($string, $encoding);
  81255. if ($paddingRequired < 1) {
  81256. return $string;
  81257. }
  81258. switch ($pad_type) {
  81259. case \STR_PAD_LEFT:
  81260. return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string;
  81261. case \STR_PAD_RIGHT:
  81262. return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding);
  81263. default:
  81264. $leftPaddingLength = floor($paddingRequired / 2);
  81265. $rightPaddingLength = $paddingRequired - $leftPaddingLength;
  81266. return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding);
  81267. }
  81268. }
  81269. public static function mb_ucfirst(string $string, ?string $encoding = null): string
  81270. {
  81271. if (null === $encoding) {
  81272. $encoding = self::mb_internal_encoding();
  81273. } else {
  81274. self::assertEncoding($encoding, 'mb_ucfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given');
  81275. }
  81276. $firstChar = mb_substr($string, 0, 1, $encoding);
  81277. $firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding);
  81278. return $firstChar.mb_substr($string, 1, null, $encoding);
  81279. }
  81280. public static function mb_lcfirst(string $string, ?string $encoding = null): string
  81281. {
  81282. if (null === $encoding) {
  81283. $encoding = self::mb_internal_encoding();
  81284. } else {
  81285. self::assertEncoding($encoding, 'mb_lcfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given');
  81286. }
  81287. $firstChar = mb_substr($string, 0, 1, $encoding);
  81288. $firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding);
  81289. return $firstChar.mb_substr($string, 1, null, $encoding);
  81290. }
  81291. private static function getSubpart($pos, $part, $haystack, $encoding)
  81292. {
  81293. if (false === $pos) {
  81294. return false;
  81295. }
  81296. if ($part) {
  81297. return self::mb_substr($haystack, 0, $pos, $encoding);
  81298. }
  81299. return self::mb_substr($haystack, $pos, null, $encoding);
  81300. }
  81301. private static function html_encoding_callback(array $m)
  81302. {
  81303. $i = 1;
  81304. $entities = '';
  81305. $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8'));
  81306. while (isset($m[$i])) {
  81307. if (0x80 > $m[$i]) {
  81308. $entities .= \chr($m[$i++]);
  81309. continue;
  81310. }
  81311. if (0xF0 <= $m[$i]) {
  81312. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  81313. } elseif (0xE0 <= $m[$i]) {
  81314. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  81315. } else {
  81316. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  81317. }
  81318. $entities .= '&#'.$c.';';
  81319. }
  81320. return $entities;
  81321. }
  81322. private static function title_case(array $s)
  81323. {
  81324. return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8');
  81325. }
  81326. private static function getData($file)
  81327. {
  81328. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  81329. return require $file;
  81330. }
  81331. return false;
  81332. }
  81333. private static function getEncoding($encoding)
  81334. {
  81335. if (null === $encoding) {
  81336. return self::$internalEncoding;
  81337. }
  81338. if ('UTF-8' === $encoding) {
  81339. return 'UTF-8';
  81340. }
  81341. $encoding = strtoupper($encoding);
  81342. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  81343. return 'CP850';
  81344. }
  81345. if ('UTF8' === $encoding) {
  81346. return 'UTF-8';
  81347. }
  81348. return $encoding;
  81349. }
  81350. public static function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string
  81351. {
  81352. return self::mb_internal_trim('{^[%s]+|[%1$s]+$}Du', $string, $characters, $encoding, __FUNCTION__);
  81353. }
  81354. public static function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string
  81355. {
  81356. return self::mb_internal_trim('{^[%s]+}Du', $string, $characters, $encoding, __FUNCTION__);
  81357. }
  81358. public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string
  81359. {
  81360. return self::mb_internal_trim('{[%s]+$}D', $string, $characters, $encoding, __FUNCTION__);
  81361. }
  81362. private static function mb_internal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function): string
  81363. {
  81364. if (null === $encoding) {
  81365. $encoding = self::mb_internal_encoding();
  81366. } else {
  81367. self::assertEncoding($encoding, $function.'(): Argument #3 ($encoding) must be a valid encoding, "%s" given');
  81368. }
  81369. if ('' === $characters) {
  81370. return null === $encoding ? $string : self::mb_convert_encoding($string, $encoding);
  81371. }
  81372. if ('UTF-8' === $encoding) {
  81373. $encoding = null;
  81374. if (!preg_match('//u', $string)) {
  81375. $string = @iconv('UTF-8', 'UTF-8//IGNORE', $string);
  81376. }
  81377. if (null !== $characters && !preg_match('//u', $characters)) {
  81378. $characters = @iconv('UTF-8', 'UTF-8//IGNORE', $characters);
  81379. }
  81380. } else {
  81381. $string = iconv($encoding, 'UTF-8//IGNORE', $string);
  81382. if (null !== $characters) {
  81383. $characters = iconv($encoding, 'UTF-8//IGNORE', $characters);
  81384. }
  81385. }
  81386. if (null === $characters) {
  81387. $characters = "\\0 \f\n\r\t\v\u{00A0}\u{1680}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{2028}\u{2029}\u{202F}\u{205F}\u{3000}\u{0085}\u{180E}";
  81388. } else {
  81389. $characters = preg_quote($characters);
  81390. }
  81391. $string = preg_replace(sprintf($regex, $characters), '', $string);
  81392. if (null === $encoding) {
  81393. return $string;
  81394. }
  81395. return iconv('UTF-8', $encoding.'//IGNORE', $string);
  81396. }
  81397. private static function assertEncoding(string $encoding, string $errorFormat): void
  81398. {
  81399. try {
  81400. $validEncoding = @self::mb_check_encoding('', $encoding);
  81401. } catch (\ValueError $e) {
  81402. throw new \ValueError(sprintf($errorFormat, $encoding));
  81403. }
  81404. if (!$validEncoding) {
  81405. throw new \ValueError(sprintf($errorFormat, $encoding));
  81406. }
  81407. }
  81408. }
  81409. <?php
  81410. return [
  81411. 'İ' => 'i̇',
  81412. 'µ' => 'μ',
  81413. 'Å¿' => 's',
  81414. 'ͅ' => 'ι',
  81415. 'ς' => 'σ',
  81416. '�' => 'β',
  81417. 'ϑ' => 'θ',
  81418. 'ϕ' => 'φ',
  81419. 'Ï–' => 'Ï€',
  81420. 'ϰ' => 'κ',
  81421. 'ϱ' => '�',
  81422. 'ϵ' => 'ε',
  81423. 'ẛ' => 'ṡ',
  81424. 'ι' => 'ι',
  81425. 'ß' => 'ss',
  81426. 'ʼn' => 'ʼn',
  81427. 'Ç°' => 'Ç°',
  81428. '�' => '�',
  81429. 'ΰ' => 'ΰ',
  81430. 'Ö‡' => 'Õ¥Ö‚',
  81431. 'ẖ' => 'ẖ',
  81432. 'ẗ' => 'ẗ',
  81433. 'ẘ' => 'ẘ',
  81434. 'ẙ' => 'ẙ',
  81435. 'ẚ' => 'aʾ',
  81436. 'ẞ' => 'ss',
  81437. '�' => '�',
  81438. 'á½’' => 'á½’',
  81439. 'á½”' => 'á½”',
  81440. 'á½–' => 'á½–',
  81441. 'ᾀ' => 'ἀι',
  81442. '�' => '�ι',
  81443. 'ᾂ' => 'ἂι',
  81444. 'ᾃ' => 'ἃι',
  81445. 'ᾄ' => 'ἄι',
  81446. 'ᾅ' => 'ἅι',
  81447. 'ᾆ' => 'ἆι',
  81448. 'ᾇ' => 'ἇι',
  81449. 'ᾈ' => 'ἀι',
  81450. 'ᾉ' => '�ι',
  81451. 'ᾊ' => 'ἂι',
  81452. 'ᾋ' => 'ἃι',
  81453. 'ᾌ' => 'ἄι',
  81454. '�' => 'ἅι',
  81455. 'ᾎ' => 'ἆι',
  81456. '�' => 'ἇι',
  81457. '�' => 'ἠι',
  81458. 'ᾑ' => 'ἡι',
  81459. 'ᾒ' => 'ἢι',
  81460. 'ᾓ' => 'ἣι',
  81461. 'ᾔ' => 'ἤι',
  81462. 'ᾕ' => 'ἥι',
  81463. 'ᾖ' => 'ἦι',
  81464. 'ᾗ' => 'ἧι',
  81465. 'ᾘ' => 'ἠι',
  81466. 'ᾙ' => 'ἡι',
  81467. 'ᾚ' => 'ἢι',
  81468. 'ᾛ' => 'ἣι',
  81469. 'ᾜ' => 'ἤι',
  81470. '�' => 'ἥι',
  81471. 'ᾞ' => 'ἦι',
  81472. 'ᾟ' => 'ἧι',
  81473. 'ᾠ' => 'ὠι',
  81474. 'ᾡ' => 'ὡι',
  81475. 'ᾢ' => 'ὢι',
  81476. 'ᾣ' => 'ὣι',
  81477. 'ᾤ' => 'ὤι',
  81478. 'ᾥ' => 'ὥι',
  81479. 'ᾦ' => 'ὦι',
  81480. 'ᾧ' => 'ὧι',
  81481. 'ᾨ' => 'ὠι',
  81482. 'ᾩ' => 'ὡι',
  81483. 'ᾪ' => 'ὢι',
  81484. 'ᾫ' => 'ὣι',
  81485. 'ᾬ' => 'ὤι',
  81486. 'ᾭ' => 'ὥι',
  81487. 'ᾮ' => 'ὦι',
  81488. 'ᾯ' => 'ὧι',
  81489. 'ᾲ' => 'ὰι',
  81490. 'ᾳ' => 'αι',
  81491. 'ᾴ' => 'άι',
  81492. 'ᾶ' => 'ᾶ',
  81493. 'ᾷ' => 'ᾶι',
  81494. 'ᾼ' => 'αι',
  81495. 'ῂ' => 'ὴι',
  81496. 'ῃ' => 'ηι',
  81497. 'ῄ' => 'ήι',
  81498. 'ῆ' => 'ῆ',
  81499. 'ῇ' => 'ῆι',
  81500. 'ῌ' => 'ηι',
  81501. 'á¿’' => 'á¿’',
  81502. 'á¿–' => 'á¿–',
  81503. 'á¿—' => 'á¿—',
  81504. 'á¿¢' => 'á¿¢',
  81505. 'ῤ' => 'ῤ',
  81506. 'ῦ' => 'ῦ',
  81507. 'ῧ' => 'ῧ',
  81508. 'ῲ' => 'ὼι',
  81509. 'ῳ' => 'ωι',
  81510. 'ῴ' => 'ώι',
  81511. 'ῶ' => 'ῶ',
  81512. 'ῷ' => 'ῶι',
  81513. 'ῼ' => 'ωι',
  81514. 'ff' => 'ff',
  81515. '�' => 'fi',
  81516. 'fl' => 'fl',
  81517. 'ffi' => 'ffi',
  81518. 'ffl' => 'ffl',
  81519. 'ſt' => 'st',
  81520. 'st' => 'st',
  81521. 'ﬓ' => 'մն',
  81522. 'ﬔ' => 'մե',
  81523. 'ﬕ' => 'մի',
  81524. 'ﬖ' => 'վն',
  81525. 'ﬗ' => 'մխ',
  81526. ];
  81527. <?php
  81528. return array (
  81529. 'A' => 'a',
  81530. 'B' => 'b',
  81531. 'C' => 'c',
  81532. 'D' => 'd',
  81533. 'E' => 'e',
  81534. 'F' => 'f',
  81535. 'G' => 'g',
  81536. 'H' => 'h',
  81537. 'I' => 'i',
  81538. 'J' => 'j',
  81539. 'K' => 'k',
  81540. 'L' => 'l',
  81541. 'M' => 'm',
  81542. 'N' => 'n',
  81543. 'O' => 'o',
  81544. 'P' => 'p',
  81545. 'Q' => 'q',
  81546. 'R' => 'r',
  81547. 'S' => 's',
  81548. 'T' => 't',
  81549. 'U' => 'u',
  81550. 'V' => 'v',
  81551. 'W' => 'w',
  81552. 'X' => 'x',
  81553. 'Y' => 'y',
  81554. 'Z' => 'z',
  81555. 'À' => 'à',
  81556. '�' => 'á',
  81557. 'Â' => 'â',
  81558. 'Ã' => 'ã',
  81559. 'Ä' => 'ä',
  81560. 'Ã…' => 'Ã¥',
  81561. 'Æ' => 'æ',
  81562. 'Ç' => 'ç',
  81563. 'È' => 'è',
  81564. 'É' => 'é',
  81565. 'Ê' => 'ê',
  81566. 'Ë' => 'ë',
  81567. 'Ì' => 'ì',
  81568. '�' => 'í',
  81569. 'Î' => 'î',
  81570. '�' => 'ï',
  81571. '�' => 'ð',
  81572. 'Ñ' => 'ñ',
  81573. 'Ò' => 'ò',
  81574. 'Ó' => 'ó',
  81575. 'Ô' => 'ô',
  81576. 'Õ' => 'õ',
  81577. 'Ö' => 'ö',
  81578. 'Ø' => 'ø',
  81579. 'Ù' => 'ù',
  81580. 'Ú' => 'ú',
  81581. 'Û' => 'û',
  81582. 'Ü' => 'ü',
  81583. '�' => 'ý',
  81584. 'Þ' => 'þ',
  81585. 'Ā' => '�',
  81586. 'Ă' => 'ă',
  81587. 'Ä„' => 'Ä…',
  81588. 'Ć' => 'ć',
  81589. 'Ĉ' => 'ĉ',
  81590. 'ÄŠ' => 'Ä‹',
  81591. 'Č' => '�',
  81592. 'Ď' => '�',
  81593. '�' => 'đ',
  81594. 'Ä’' => 'Ä“',
  81595. 'Ä”' => 'Ä•',
  81596. 'Ä–' => 'Ä—',
  81597. 'Ę' => 'ę',
  81598. 'Äš' => 'Ä›',
  81599. 'Ĝ' => '�',
  81600. 'Äž' => 'ÄŸ',
  81601. 'Ä ' => 'Ä¡',
  81602. 'Ä¢' => 'Ä£',
  81603. 'Ĥ' => 'ĥ',
  81604. 'Ħ' => 'ħ',
  81605. 'Ĩ' => 'ĩ',
  81606. 'Ī' => 'ī',
  81607. 'Ĭ' => 'ĭ',
  81608. 'Į' => 'į',
  81609. 'İ' => 'i̇',
  81610. 'IJ' => 'ij',
  81611. 'Ĵ' => 'ĵ',
  81612. 'Ķ' => 'ķ',
  81613. 'Ĺ' => 'ĺ',
  81614. 'Ļ' => 'ļ',
  81615. 'Ľ' => 'ľ',
  81616. 'Ä¿' => 'Å€',
  81617. '�' => 'ł',
  81618. 'Ń' => 'ń',
  81619. 'Ņ' => 'ņ',
  81620. 'Ň' => 'ň',
  81621. 'ÅŠ' => 'Å‹',
  81622. 'Ō' => '�',
  81623. 'Ŏ' => '�',
  81624. '�' => 'ő',
  81625. 'Å’' => 'Å“',
  81626. 'Å”' => 'Å•',
  81627. 'Å–' => 'Å—',
  81628. 'Ř' => 'ř',
  81629. 'Åš' => 'Å›',
  81630. 'Ŝ' => '�',
  81631. 'Åž' => 'ÅŸ',
  81632. 'Å ' => 'Å¡',
  81633. 'Å¢' => 'Å£',
  81634. 'Ť' => 'ť',
  81635. 'Ŧ' => 'ŧ',
  81636. 'Ũ' => 'ũ',
  81637. 'Ū' => 'ū',
  81638. 'Ŭ' => 'ŭ',
  81639. 'Ů' => 'ů',
  81640. 'Ű' => 'ű',
  81641. 'Ų' => 'ų',
  81642. 'Ŵ' => 'ŵ',
  81643. 'Ŷ' => 'ŷ',
  81644. 'Ÿ' => 'ÿ',
  81645. 'Ź' => 'ź',
  81646. 'Ż' => 'ż',
  81647. 'Ž' => 'ž',
  81648. '�' => 'ɓ',
  81649. 'Ƃ' => 'ƃ',
  81650. 'Æ„' => 'Æ…',
  81651. 'Ɔ' => 'ɔ',
  81652. 'Ƈ' => 'ƈ',
  81653. 'Ɖ' => 'ɖ',
  81654. 'ÆŠ' => 'É—',
  81655. 'Ƌ' => 'ƌ',
  81656. 'Ǝ' => '�',
  81657. '�' => 'ə',
  81658. '�' => 'ɛ',
  81659. 'Æ‘' => 'Æ’',
  81660. 'Æ“' => 'É ',
  81661. 'Æ”' => 'É£',
  81662. 'Æ–' => 'É©',
  81663. 'Ɨ' => 'ɨ',
  81664. 'Ƙ' => 'ƙ',
  81665. 'Ɯ' => 'ɯ',
  81666. '�' => 'ɲ',
  81667. 'Ɵ' => 'ɵ',
  81668. 'Æ ' => 'Æ¡',
  81669. 'Æ¢' => 'Æ£',
  81670. 'Ƥ' => 'ƥ',
  81671. 'Ʀ' => 'ʀ',
  81672. 'Ƨ' => 'ƨ',
  81673. 'Ʃ' => 'ʃ',
  81674. 'Ƭ' => 'ƭ',
  81675. 'Ʈ' => 'ʈ',
  81676. 'Ư' => 'ư',
  81677. 'Ʊ' => 'ʊ',
  81678. 'Ʋ' => 'ʋ',
  81679. 'Ƴ' => 'ƴ',
  81680. 'Ƶ' => 'ƶ',
  81681. 'Æ·' => 'Ê’',
  81682. 'Ƹ' => 'ƹ',
  81683. 'Ƽ' => 'ƽ',
  81684. 'DŽ' => 'dž',
  81685. 'Dž' => 'dž',
  81686. 'LJ' => 'lj',
  81687. 'Lj' => 'lj',
  81688. 'NJ' => 'nj',
  81689. 'Nj' => 'nj',
  81690. '�' => 'ǎ',
  81691. '�' => '�',
  81692. 'Ç‘' => 'Ç’',
  81693. 'Ç“' => 'Ç”',
  81694. 'Ç•' => 'Ç–',
  81695. 'Ǘ' => 'ǘ',
  81696. 'Ç™' => 'Çš',
  81697. 'Ǜ' => 'ǜ',
  81698. 'Çž' => 'ÇŸ',
  81699. 'Ç ' => 'Ç¡',
  81700. 'Ç¢' => 'Ç£',
  81701. 'Ǥ' => 'ǥ',
  81702. 'Ǧ' => 'ǧ',
  81703. 'Ǩ' => 'ǩ',
  81704. 'Ǫ' => 'ǫ',
  81705. 'Ǭ' => 'ǭ',
  81706. 'Ǯ' => 'ǯ',
  81707. 'DZ' => 'dz',
  81708. 'Dz' => 'dz',
  81709. 'Ǵ' => 'ǵ',
  81710. 'Ƕ' => 'ƕ',
  81711. 'Ç·' => 'Æ¿',
  81712. 'Ǹ' => 'ǹ',
  81713. 'Ǻ' => 'ǻ',
  81714. 'Ǽ' => 'ǽ',
  81715. 'Ǿ' => 'ǿ',
  81716. 'Ȁ' => '�',
  81717. 'Ȃ' => 'ȃ',
  81718. 'È„' => 'È…',
  81719. 'Ȇ' => 'ȇ',
  81720. 'Ȉ' => 'ȉ',
  81721. 'ÈŠ' => 'È‹',
  81722. 'Ȍ' => '�',
  81723. 'Ȏ' => '�',
  81724. '�' => 'ȑ',
  81725. 'È’' => 'È“',
  81726. 'È”' => 'È•',
  81727. 'È–' => 'È—',
  81728. 'Ș' => 'ș',
  81729. 'Èš' => 'È›',
  81730. 'Ȝ' => '�',
  81731. 'Èž' => 'ÈŸ',
  81732. 'È ' => 'Æž',
  81733. 'È¢' => 'È£',
  81734. 'Ȥ' => 'ȥ',
  81735. 'Ȧ' => 'ȧ',
  81736. 'Ȩ' => 'ȩ',
  81737. 'Ȫ' => 'ȫ',
  81738. 'Ȭ' => 'ȭ',
  81739. 'Ȯ' => 'ȯ',
  81740. 'Ȱ' => 'ȱ',
  81741. 'Ȳ' => 'ȳ',
  81742. 'Ⱥ' => 'ⱥ',
  81743. 'Ȼ' => 'ȼ',
  81744. 'Ƚ' => 'ƚ',
  81745. 'Ⱦ' => 'ⱦ',
  81746. '�' => 'ɂ',
  81747. 'Ƀ' => 'ƀ',
  81748. 'Ʉ' => 'ʉ',
  81749. 'Ʌ' => 'ʌ',
  81750. 'Ɇ' => 'ɇ',
  81751. 'Ɉ' => 'ɉ',
  81752. 'ÉŠ' => 'É‹',
  81753. 'Ɍ' => '�',
  81754. 'Ɏ' => '�',
  81755. 'Ͱ' => 'ͱ',
  81756. 'Ͳ' => 'ͳ',
  81757. 'Ͷ' => 'ͷ',
  81758. 'Ϳ' => 'ϳ',
  81759. 'Ά' => 'ά',
  81760. 'Έ' => 'έ',
  81761. 'Ή' => 'ή',
  81762. 'Ί' => 'ί',
  81763. 'Ό' => 'ό',
  81764. 'Ύ' => '�',
  81765. '�' => 'ώ',
  81766. 'Α' => 'α',
  81767. 'Β' => 'β',
  81768. 'Γ' => 'γ',
  81769. 'Δ' => 'δ',
  81770. 'Ε' => 'ε',
  81771. 'Ζ' => 'ζ',
  81772. 'Η' => 'η',
  81773. 'Θ' => 'θ',
  81774. 'Ι' => 'ι',
  81775. 'Κ' => 'κ',
  81776. 'Λ' => 'λ',
  81777. 'Μ' => 'μ',
  81778. '�' => 'ν',
  81779. 'Ξ' => 'ξ',
  81780. 'Ο' => 'ο',
  81781. 'Π' => 'π',
  81782. 'Ρ' => '�',
  81783. 'Σ' => 'σ',
  81784. 'Τ' => 'τ',
  81785. 'Î¥' => 'Ï…',
  81786. 'Φ' => 'φ',
  81787. 'Χ' => 'χ',
  81788. 'Ψ' => 'ψ',
  81789. 'Ω' => 'ω',
  81790. 'Ϊ' => 'ϊ',
  81791. 'Ϋ' => 'ϋ',
  81792. '�' => 'ϗ',
  81793. 'Ϙ' => 'ϙ',
  81794. 'Ïš' => 'Ï›',
  81795. 'Ϝ' => '�',
  81796. 'Ïž' => 'ÏŸ',
  81797. 'Ï ' => 'Ï¡',
  81798. 'Ï¢' => 'Ï£',
  81799. 'Ϥ' => 'ϥ',
  81800. 'Ϧ' => 'ϧ',
  81801. 'Ϩ' => 'ϩ',
  81802. 'Ϫ' => 'ϫ',
  81803. 'Ϭ' => 'ϭ',
  81804. 'Ϯ' => 'ϯ',
  81805. 'ϴ' => 'θ',
  81806. 'Ϸ' => 'ϸ',
  81807. 'Ϲ' => 'ϲ',
  81808. 'Ϻ' => 'ϻ',
  81809. 'Ͻ' => 'ͻ',
  81810. 'Ͼ' => 'ͼ',
  81811. 'Ͽ' => 'ͽ',
  81812. 'Ѐ' => '�',
  81813. '�' => 'ё',
  81814. 'Ђ' => 'ђ',
  81815. 'Ѓ' => 'ѓ',
  81816. 'Є' => 'є',
  81817. 'Ð…' => 'Ñ•',
  81818. 'І' => 'і',
  81819. 'Ї' => 'ї',
  81820. 'Ј' => 'ј',
  81821. 'Љ' => 'љ',
  81822. 'Њ' => 'њ',
  81823. 'Ћ' => 'ћ',
  81824. 'Ќ' => 'ќ',
  81825. '�' => '�',
  81826. 'ÐŽ' => 'Ñž',
  81827. '�' => 'џ',
  81828. '�' => 'а',
  81829. 'Б' => 'б',
  81830. 'В' => 'в',
  81831. 'Г' => 'г',
  81832. 'Д' => 'д',
  81833. 'Е' => 'е',
  81834. 'Ж' => 'ж',
  81835. 'З' => 'з',
  81836. 'И' => 'и',
  81837. 'Й' => 'й',
  81838. 'К' => 'к',
  81839. 'Л' => 'л',
  81840. 'М' => 'м',
  81841. '�' => 'н',
  81842. 'О' => 'о',
  81843. 'П' => 'п',
  81844. 'Р' => 'р',
  81845. 'С' => '�',
  81846. 'Т' => 'т',
  81847. 'У' => 'у',
  81848. 'Ф' => 'ф',
  81849. 'Ð¥' => 'Ñ…',
  81850. 'Ц' => 'ц',
  81851. 'Ч' => 'ч',
  81852. 'Ш' => 'ш',
  81853. 'Щ' => 'щ',
  81854. 'Ъ' => 'ъ',
  81855. 'Ы' => 'ы',
  81856. 'Ь' => 'ь',
  81857. 'Э' => '�',
  81858. 'Ю' => 'ю',
  81859. 'Я' => '�',
  81860. 'Ñ ' => 'Ñ¡',
  81861. 'Ñ¢' => 'Ñ£',
  81862. 'Ѥ' => 'ѥ',
  81863. 'Ѧ' => 'ѧ',
  81864. 'Ѩ' => 'ѩ',
  81865. 'Ѫ' => 'ѫ',
  81866. 'Ѭ' => 'ѭ',
  81867. 'Ѯ' => 'ѯ',
  81868. 'Ѱ' => 'ѱ',
  81869. 'Ѳ' => 'ѳ',
  81870. 'Ѵ' => 'ѵ',
  81871. 'Ѷ' => 'ѷ',
  81872. 'Ѹ' => 'ѹ',
  81873. 'Ѻ' => 'ѻ',
  81874. 'Ѽ' => 'ѽ',
  81875. 'Ѿ' => 'ѿ',
  81876. 'Ò€' => 'Ò�',
  81877. 'ÒŠ' => 'Ò‹',
  81878. 'Ҍ' => '�',
  81879. 'ÒŽ' => 'Ò�',
  81880. 'Ò�' => 'Ò‘',
  81881. 'Ò’' => 'Ò“',
  81882. 'Ò”' => 'Ò•',
  81883. 'Ò–' => 'Ò—',
  81884. 'Ò˜' => 'Ò™',
  81885. 'Òš' => 'Ò›',
  81886. 'Ҝ' => '�',
  81887. 'Òž' => 'ÒŸ',
  81888. 'Ò ' => 'Ò¡',
  81889. 'Ò¢' => 'Ò£',
  81890. 'Ò¤' => 'Ò¥',
  81891. 'Ò¦' => 'Ò§',
  81892. 'Ò¨' => 'Ò©',
  81893. 'Òª' => 'Ò«',
  81894. 'Ò¬' => 'Ò­',
  81895. 'Ò®' => 'Ò¯',
  81896. 'Ò°' => 'Ò±',
  81897. 'Ò²' => 'Ò³',
  81898. 'Ò´' => 'Òµ',
  81899. 'Ò¶' => 'Ò·',
  81900. 'Ò¸' => 'Ò¹',
  81901. 'Òº' => 'Ò»',
  81902. 'Ò¼' => 'Ò½',
  81903. 'Ò¾' => 'Ò¿',
  81904. 'Ó€' => 'Ó�',
  81905. 'Ó�' => 'Ó‚',
  81906. 'Óƒ' => 'Ó„',
  81907. 'Ó…' => 'Ó†',
  81908. 'Ó‡' => 'Óˆ',
  81909. 'Ó‰' => 'ÓŠ',
  81910. 'Ӌ' => 'ӌ',
  81911. 'Ó�' => 'ÓŽ',
  81912. 'Ó�' => 'Ó‘',
  81913. 'Ó’' => 'Ó“',
  81914. 'Ó”' => 'Ó•',
  81915. 'Ó–' => 'Ó—',
  81916. 'Ó˜' => 'Ó™',
  81917. 'Óš' => 'Ó›',
  81918. 'Ӝ' => '�',
  81919. 'Óž' => 'ÓŸ',
  81920. 'Ó ' => 'Ó¡',
  81921. 'Ó¢' => 'Ó£',
  81922. 'Ó¤' => 'Ó¥',
  81923. 'Ó¦' => 'Ó§',
  81924. 'Ó¨' => 'Ó©',
  81925. 'Óª' => 'Ó«',
  81926. 'Ó¬' => 'Ó­',
  81927. 'Ó®' => 'Ó¯',
  81928. 'Ó°' => 'Ó±',
  81929. 'Ó²' => 'Ó³',
  81930. 'Ó´' => 'Óµ',
  81931. 'Ó¶' => 'Ó·',
  81932. 'Ó¸' => 'Ó¹',
  81933. 'Óº' => 'Ó»',
  81934. 'Ó¼' => 'Ó½',
  81935. 'Ó¾' => 'Ó¿',
  81936. 'Ô€' => 'Ô�',
  81937. 'Ô‚' => 'Ôƒ',
  81938. 'Ô„' => 'Ô…',
  81939. 'Ô†' => 'Ô‡',
  81940. 'Ôˆ' => 'Ô‰',
  81941. 'ÔŠ' => 'Ô‹',
  81942. 'Ԍ' => '�',
  81943. 'ÔŽ' => 'Ô�',
  81944. 'Ô�' => 'Ô‘',
  81945. 'Ô’' => 'Ô“',
  81946. 'Ô”' => 'Ô•',
  81947. 'Ô–' => 'Ô—',
  81948. 'Ô˜' => 'Ô™',
  81949. 'Ôš' => 'Ô›',
  81950. 'Ԝ' => '�',
  81951. 'Ôž' => 'ÔŸ',
  81952. 'Ô ' => 'Ô¡',
  81953. 'Ô¢' => 'Ô£',
  81954. 'Ô¤' => 'Ô¥',
  81955. 'Ô¦' => 'Ô§',
  81956. 'Ô¨' => 'Ô©',
  81957. 'Ôª' => 'Ô«',
  81958. 'Ô¬' => 'Ô­',
  81959. 'Ô®' => 'Ô¯',
  81960. 'Ô±' => 'Õ¡',
  81961. 'Ô²' => 'Õ¢',
  81962. 'Ô³' => 'Õ£',
  81963. 'Ô´' => 'Õ¤',
  81964. 'Ôµ' => 'Õ¥',
  81965. 'Ô¶' => 'Õ¦',
  81966. 'Ô·' => 'Õ§',
  81967. 'Ô¸' => 'Õ¨',
  81968. 'Ô¹' => 'Õ©',
  81969. 'Ôº' => 'Õª',
  81970. 'Ô»' => 'Õ«',
  81971. 'Ô¼' => 'Õ¬',
  81972. 'Ô½' => 'Õ­',
  81973. 'Ô¾' => 'Õ®',
  81974. 'Ô¿' => 'Õ¯',
  81975. 'Õ€' => 'Õ°',
  81976. 'Õ�' => 'Õ±',
  81977. 'Õ‚' => 'Õ²',
  81978. 'Õƒ' => 'Õ³',
  81979. 'Õ„' => 'Õ´',
  81980. 'Õ…' => 'Õµ',
  81981. 'Õ†' => 'Õ¶',
  81982. 'Õ‡' => 'Õ·',
  81983. 'Õˆ' => 'Õ¸',
  81984. 'Õ‰' => 'Õ¹',
  81985. 'ÕŠ' => 'Õº',
  81986. 'Õ‹' => 'Õ»',
  81987. 'Ռ' => 'ռ',
  81988. 'Õ�' => 'Õ½',
  81989. 'ÕŽ' => 'Õ¾',
  81990. 'Õ�' => 'Õ¿',
  81991. 'Õ�' => 'Ö€',
  81992. 'Õ‘' => 'Ö�',
  81993. 'Õ’' => 'Ö‚',
  81994. 'Õ“' => 'Öƒ',
  81995. 'Õ”' => 'Ö„',
  81996. 'Õ•' => 'Ö…',
  81997. 'Õ–' => 'Ö†',
  81998. 'á‚ ' => 'â´€',
  81999. 'á‚¡' => 'â´�',
  82000. 'á‚¢' => 'â´‚',
  82001. 'á‚£' => 'â´ƒ',
  82002. 'Ⴄ' => 'ⴄ',
  82003. 'á‚¥' => 'â´…',
  82004. 'Ⴆ' => 'ⴆ',
  82005. 'Ⴇ' => 'ⴇ',
  82006. 'Ⴈ' => 'ⴈ',
  82007. 'á‚©' => 'â´‰',
  82008. 'Ⴊ' => 'ⴊ',
  82009. 'á‚«' => 'â´‹',
  82010. 'Ⴌ' => 'ⴌ',
  82011. 'á‚­' => 'â´�',
  82012. 'á‚®' => 'â´Ž',
  82013. 'Ⴏ' => '�',
  82014. 'á‚°' => 'â´�',
  82015. 'Ⴑ' => 'ⴑ',
  82016. 'Ⴒ' => 'ⴒ',
  82017. 'Ⴓ' => 'ⴓ',
  82018. 'á‚´' => 'â´”',
  82019. 'Ⴕ' => 'ⴕ',
  82020. 'Ⴖ' => 'ⴖ',
  82021. 'á‚·' => 'â´—',
  82022. 'Ⴘ' => 'ⴘ',
  82023. 'Ⴙ' => 'ⴙ',
  82024. 'Ⴚ' => 'ⴚ',
  82025. 'á‚»' => 'â´›',
  82026. 'Ⴜ' => 'ⴜ',
  82027. 'Ⴝ' => '�',
  82028. 'Ⴞ' => 'ⴞ',
  82029. 'á‚¿' => 'â´Ÿ',
  82030. 'Ⴠ' => 'ⴠ',
  82031. '�' => 'ⴡ',
  82032. 'Ⴢ' => 'ⴢ',
  82033. 'Ⴣ' => 'ⴣ',
  82034. 'Ⴤ' => 'ⴤ',
  82035. 'Ⴥ' => 'ⴥ',
  82036. 'Ⴧ' => 'ⴧ',
  82037. '�' => 'ⴭ',
  82038. 'Ꭰ' => 'ꭰ',
  82039. 'Ꭱ' => 'ꭱ',
  82040. 'Ꭲ' => 'ꭲ',
  82041. 'Ꭳ' => 'ꭳ',
  82042. 'Ꭴ' => 'ꭴ',
  82043. 'Ꭵ' => 'ꭵ',
  82044. 'Ꭶ' => 'ꭶ',
  82045. 'Ꭷ' => 'ꭷ',
  82046. 'Ꭸ' => 'ꭸ',
  82047. 'Ꭹ' => 'ꭹ',
  82048. 'Ꭺ' => 'ꭺ',
  82049. 'Ꭻ' => 'ꭻ',
  82050. 'Ꭼ' => 'ꭼ',
  82051. 'Ꭽ' => 'ꭽ',
  82052. 'Ꭾ' => 'ꭾ',
  82053. 'Ꭿ' => 'ꭿ',
  82054. 'Ꮀ' => 'ꮀ',
  82055. 'Ꮁ' => '�',
  82056. 'Ꮂ' => 'ꮂ',
  82057. 'Ꮃ' => 'ꮃ',
  82058. 'Ꮄ' => 'ꮄ',
  82059. 'Ꮅ' => 'ꮅ',
  82060. 'Ꮆ' => 'ꮆ',
  82061. 'Ꮇ' => 'ꮇ',
  82062. 'Ꮈ' => 'ꮈ',
  82063. 'Ꮉ' => 'ꮉ',
  82064. 'Ꮊ' => 'ꮊ',
  82065. 'Ꮋ' => 'ꮋ',
  82066. 'Ꮌ' => 'ꮌ',
  82067. 'Ꮍ' => '�',
  82068. 'Ꮎ' => 'ꮎ',
  82069. 'Ꮏ' => '�',
  82070. '�' => '�',
  82071. '�' => 'ꮑ',
  82072. '�' => 'ꮒ',
  82073. '�' => 'ꮓ',
  82074. '�' => 'ꮔ',
  82075. '�' => 'ꮕ',
  82076. '�' => 'ꮖ',
  82077. '�' => 'ꮗ',
  82078. '�' => 'ꮘ',
  82079. '�' => 'ꮙ',
  82080. '�' => 'ꮚ',
  82081. '�' => 'ꮛ',
  82082. '�' => 'ꮜ',
  82083. '�' => '�',
  82084. '�' => 'ꮞ',
  82085. '�' => 'ꮟ',
  82086. '�' => 'ꮠ',
  82087. '�' => 'ꮡ',
  82088. '�' => 'ꮢ',
  82089. '�' => 'ꮣ',
  82090. '�' => 'ꮤ',
  82091. '�' => 'ꮥ',
  82092. '�' => 'ꮦ',
  82093. '�' => 'ꮧ',
  82094. '�' => 'ꮨ',
  82095. '�' => 'ꮩ',
  82096. '�' => 'ꮪ',
  82097. '�' => 'ꮫ',
  82098. '�' => 'ꮬ',
  82099. '�' => 'ꮭ',
  82100. '�' => 'ꮮ',
  82101. '�' => 'ꮯ',
  82102. '�' => 'ꮰ',
  82103. '�' => 'ꮱ',
  82104. '�' => 'ꮲ',
  82105. '�' => 'ꮳ',
  82106. '�' => 'ꮴ',
  82107. '�' => 'ꮵ',
  82108. '�' => 'ꮶ',
  82109. '�' => 'ꮷ',
  82110. '�' => 'ꮸ',
  82111. '�' => 'ꮹ',
  82112. '�' => 'ꮺ',
  82113. '�' => 'ꮻ',
  82114. '�' => 'ꮼ',
  82115. '�' => 'ꮽ',
  82116. '�' => 'ꮾ',
  82117. '�' => 'ꮿ',
  82118. '�' => '�',
  82119. '�' => '�',
  82120. '�' => '�',
  82121. '�' => '�',
  82122. '�' => '�',
  82123. '�' => '�',
  82124. '�' => '�',
  82125. 'Ბ' => 'ბ',
  82126. 'Გ' => 'გ',
  82127. 'Დ' => 'დ',
  82128. 'Ე' => 'ე',
  82129. 'Ვ' => 'ვ',
  82130. 'Ზ' => 'ზ',
  82131. 'Თ' => 'თ',
  82132. 'Ი' => 'ი',
  82133. 'Კ' => 'კ',
  82134. 'Ლ' => 'ლ',
  82135. 'Მ' => 'მ',
  82136. 'Ნ' => 'ნ',
  82137. '�' => '�',
  82138. 'Პ' => 'პ',
  82139. 'Ჟ' => 'ჟ',
  82140. 'Რ' => 'რ',
  82141. 'Ს' => 'ს',
  82142. 'Ტ' => 'ტ',
  82143. 'Უ' => 'უ',
  82144. 'Ფ' => 'ფ',
  82145. 'Ქ' => 'ქ',
  82146. 'Ღ' => 'ღ',
  82147. 'Ყ' => 'ყ',
  82148. 'Შ' => 'შ',
  82149. 'Ჩ' => 'ჩ',
  82150. 'Ც' => 'ც',
  82151. 'Ძ' => 'ძ',
  82152. 'Წ' => 'წ',
  82153. 'Ჭ' => 'ჭ',
  82154. 'Ხ' => 'ხ',
  82155. 'Ჯ' => 'ჯ',
  82156. 'Ჰ' => 'ჰ',
  82157. 'Ჱ' => 'ჱ',
  82158. 'Ჲ' => 'ჲ',
  82159. 'Ჳ' => 'ჳ',
  82160. 'Ჴ' => 'ჴ',
  82161. 'Ჵ' => 'ჵ',
  82162. 'Ჶ' => 'ჶ',
  82163. 'Ჷ' => 'ჷ',
  82164. 'Ჸ' => 'ჸ',
  82165. 'Ჹ' => 'ჹ',
  82166. 'Ჺ' => 'ჺ',
  82167. 'Ჽ' => 'ჽ',
  82168. 'Ჾ' => 'ჾ',
  82169. 'Ჿ' => 'ჿ',
  82170. 'Ḁ' => '�',
  82171. 'Ḃ' => 'ḃ',
  82172. 'Ḅ' => 'ḅ',
  82173. 'Ḇ' => 'ḇ',
  82174. 'Ḉ' => 'ḉ',
  82175. 'Ḋ' => 'ḋ',
  82176. 'Ḍ' => '�',
  82177. 'Ḏ' => '�',
  82178. '�' => 'ḑ',
  82179. 'Ḓ' => 'ḓ',
  82180. 'Ḕ' => 'ḕ',
  82181. 'Ḗ' => 'ḗ',
  82182. 'Ḙ' => 'ḙ',
  82183. 'Ḛ' => 'ḛ',
  82184. 'Ḝ' => '�',
  82185. 'Ḟ' => 'ḟ',
  82186. 'Ḡ' => 'ḡ',
  82187. 'Ḣ' => 'ḣ',
  82188. 'Ḥ' => 'ḥ',
  82189. 'Ḧ' => 'ḧ',
  82190. 'Ḩ' => 'ḩ',
  82191. 'Ḫ' => 'ḫ',
  82192. 'Ḭ' => 'ḭ',
  82193. 'Ḯ' => 'ḯ',
  82194. 'Ḱ' => 'ḱ',
  82195. 'Ḳ' => 'ḳ',
  82196. 'Ḵ' => 'ḵ',
  82197. 'Ḷ' => 'ḷ',
  82198. 'Ḹ' => 'ḹ',
  82199. 'Ḻ' => 'ḻ',
  82200. 'Ḽ' => 'ḽ',
  82201. 'Ḿ' => 'ḿ',
  82202. 'Ṁ' => '�',
  82203. 'Ṃ' => 'ṃ',
  82204. 'Ṅ' => 'ṅ',
  82205. 'Ṇ' => 'ṇ',
  82206. 'Ṉ' => 'ṉ',
  82207. 'Ṋ' => 'ṋ',
  82208. 'Ṍ' => '�',
  82209. 'Ṏ' => '�',
  82210. '�' => 'ṑ',
  82211. 'Ṓ' => 'ṓ',
  82212. 'Ṕ' => 'ṕ',
  82213. 'á¹–' => 'á¹—',
  82214. 'Ṙ' => 'ṙ',
  82215. 'Ṛ' => 'ṛ',
  82216. 'Ṝ' => '�',
  82217. 'Ṟ' => 'ṟ',
  82218. 'Ṡ' => 'ṡ',
  82219. 'á¹¢' => 'á¹£',
  82220. 'Ṥ' => 'ṥ',
  82221. 'Ṧ' => 'ṧ',
  82222. 'Ṩ' => 'ṩ',
  82223. 'Ṫ' => 'ṫ',
  82224. 'Ṭ' => 'ṭ',
  82225. 'Ṯ' => 'ṯ',
  82226. 'á¹°' => 'á¹±',
  82227. 'á¹²' => 'á¹³',
  82228. 'á¹´' => 'á¹µ',
  82229. 'Ṷ' => 'ṷ',
  82230. 'Ṹ' => 'ṹ',
  82231. 'Ṻ' => 'ṻ',
  82232. 'á¹¼' => 'á¹½',
  82233. 'Ṿ' => 'ṿ',
  82234. 'Ẁ' => '�',
  82235. 'Ẃ' => 'ẃ',
  82236. 'Ẅ' => 'ẅ',
  82237. 'Ẇ' => 'ẇ',
  82238. 'Ẉ' => 'ẉ',
  82239. 'Ẋ' => 'ẋ',
  82240. 'Ẍ' => '�',
  82241. 'Ẏ' => '�',
  82242. '�' => 'ẑ',
  82243. 'Ẓ' => 'ẓ',
  82244. 'Ẕ' => 'ẕ',
  82245. 'ẞ' => 'ß',
  82246. 'Ạ' => 'ạ',
  82247. 'Ả' => 'ả',
  82248. 'Ấ' => 'ấ',
  82249. 'Ầ' => 'ầ',
  82250. 'Ẩ' => 'ẩ',
  82251. 'Ẫ' => 'ẫ',
  82252. 'Ậ' => 'ậ',
  82253. 'Ắ' => 'ắ',
  82254. 'Ằ' => 'ằ',
  82255. 'Ẳ' => 'ẳ',
  82256. 'Ẵ' => 'ẵ',
  82257. 'Ặ' => 'ặ',
  82258. 'Ẹ' => 'ẹ',
  82259. 'Ẻ' => 'ẻ',
  82260. 'Ẽ' => 'ẽ',
  82261. 'Ế' => 'ế',
  82262. 'Ề' => '�',
  82263. 'Ể' => 'ể',
  82264. 'Ễ' => 'ễ',
  82265. 'Ệ' => 'ệ',
  82266. 'Ỉ' => 'ỉ',
  82267. 'Ị' => 'ị',
  82268. 'Ọ' => '�',
  82269. 'Ỏ' => '�',
  82270. '�' => 'ố',
  82271. 'Ồ' => 'ồ',
  82272. 'Ổ' => 'ổ',
  82273. 'á»–' => 'á»—',
  82274. 'Ộ' => 'ộ',
  82275. 'Ớ' => 'ớ',
  82276. 'Ờ' => '�',
  82277. 'Ở' => 'ở',
  82278. 'Ỡ' => 'ỡ',
  82279. 'Ợ' => 'ợ',
  82280. 'Ụ' => 'ụ',
  82281. 'Ủ' => 'ủ',
  82282. 'Ứ' => 'ứ',
  82283. 'Ừ' => 'ừ',
  82284. 'Ử' => 'ử',
  82285. 'Ữ' => 'ữ',
  82286. 'á»°' => 'á»±',
  82287. 'Ỳ' => 'ỳ',
  82288. 'Ỵ' => 'ỵ',
  82289. 'Ỷ' => 'ỷ',
  82290. 'Ỹ' => 'ỹ',
  82291. 'Ỻ' => 'ỻ',
  82292. 'Ỽ' => 'ỽ',
  82293. 'Ỿ' => 'ỿ',
  82294. 'Ἀ' => 'ἀ',
  82295. 'Ἁ' => '�',
  82296. 'Ἂ' => 'ἂ',
  82297. 'Ἃ' => 'ἃ',
  82298. 'Ἄ' => 'ἄ',
  82299. '�' => 'ἅ',
  82300. 'Ἆ' => 'ἆ',
  82301. '�' => 'ἇ',
  82302. 'Ἐ' => '�',
  82303. 'Ἑ' => 'ἑ',
  82304. 'Ἒ' => 'ἒ',
  82305. 'Ἓ' => 'ἓ',
  82306. 'Ἔ' => 'ἔ',
  82307. '�' => 'ἕ',
  82308. 'Ἠ' => 'ἠ',
  82309. 'Ἡ' => 'ἡ',
  82310. 'Ἢ' => 'ἢ',
  82311. 'Ἣ' => 'ἣ',
  82312. 'Ἤ' => 'ἤ',
  82313. 'á¼­' => 'á¼¥',
  82314. 'Ἦ' => 'ἦ',
  82315. 'Ἧ' => 'ἧ',
  82316. 'Ἰ' => 'ἰ',
  82317. 'á¼¹' => 'á¼±',
  82318. 'Ἲ' => 'ἲ',
  82319. 'á¼»' => 'á¼³',
  82320. 'á¼¼' => 'á¼´',
  82321. 'á¼½' => 'á¼µ',
  82322. 'Ἶ' => 'ἶ',
  82323. 'Ἷ' => 'ἷ',
  82324. 'Ὀ' => 'ὀ',
  82325. 'Ὁ' => '�',
  82326. 'Ὂ' => 'ὂ',
  82327. 'Ὃ' => 'ὃ',
  82328. 'Ὄ' => 'ὄ',
  82329. '�' => 'ὅ',
  82330. 'Ὑ' => 'ὑ',
  82331. 'Ὓ' => 'ὓ',
  82332. '�' => 'ὕ',
  82333. 'Ὗ' => 'ὗ',
  82334. 'Ὠ' => 'ὠ',
  82335. 'Ὡ' => 'ὡ',
  82336. 'Ὢ' => 'ὢ',
  82337. 'Ὣ' => 'ὣ',
  82338. 'Ὤ' => 'ὤ',
  82339. 'á½­' => 'á½¥',
  82340. 'Ὦ' => 'ὦ',
  82341. 'Ὧ' => 'ὧ',
  82342. 'ᾈ' => 'ᾀ',
  82343. 'ᾉ' => '�',
  82344. 'ᾊ' => 'ᾂ',
  82345. 'ᾋ' => 'ᾃ',
  82346. 'ᾌ' => 'ᾄ',
  82347. '�' => 'ᾅ',
  82348. 'ᾎ' => 'ᾆ',
  82349. '�' => 'ᾇ',
  82350. 'ᾘ' => '�',
  82351. 'ᾙ' => 'ᾑ',
  82352. 'ᾚ' => 'ᾒ',
  82353. 'ᾛ' => 'ᾓ',
  82354. 'ᾜ' => 'ᾔ',
  82355. '�' => 'ᾕ',
  82356. 'ᾞ' => 'ᾖ',
  82357. 'ᾟ' => 'ᾗ',
  82358. 'ᾨ' => 'ᾠ',
  82359. 'ᾩ' => 'ᾡ',
  82360. 'ᾪ' => 'ᾢ',
  82361. 'ᾫ' => 'ᾣ',
  82362. 'ᾬ' => 'ᾤ',
  82363. 'á¾­' => 'á¾¥',
  82364. 'ᾮ' => 'ᾦ',
  82365. 'ᾯ' => 'ᾧ',
  82366. 'Ᾰ' => 'ᾰ',
  82367. 'á¾¹' => 'á¾±',
  82368. 'Ὰ' => 'ὰ',
  82369. 'á¾»' => 'á½±',
  82370. 'á¾¼' => 'á¾³',
  82371. 'Ὲ' => 'ὲ',
  82372. 'Έ' => 'έ',
  82373. 'á¿Š' => 'á½´',
  82374. 'á¿‹' => 'á½µ',
  82375. 'ῌ' => 'ῃ',
  82376. 'Ῐ' => '�',
  82377. 'á¿™' => 'á¿‘',
  82378. 'Ὶ' => 'ὶ',
  82379. 'á¿›' => 'á½·',
  82380. 'Ῠ' => 'ῠ',
  82381. 'á¿©' => 'á¿¡',
  82382. 'Ὺ' => 'ὺ',
  82383. 'á¿«' => 'á½»',
  82384. 'Ῥ' => 'ῥ',
  82385. 'Ὸ' => 'ὸ',
  82386. 'Ό' => 'ό',
  82387. 'Ὼ' => 'ὼ',
  82388. 'á¿»' => 'á½½',
  82389. 'ῼ' => 'ῳ',
  82390. 'Ω' => 'ω',
  82391. 'K' => 'k',
  82392. 'â„«' => 'Ã¥',
  82393. 'Ⅎ' => 'ⅎ',
  82394. 'â… ' => 'â…°',
  82395. 'â…¡' => 'â…±',
  82396. 'â…¢' => 'â…²',
  82397. 'â…£' => 'â…³',
  82398. 'â…¤' => 'â…´',
  82399. 'â…¥' => 'â…µ',
  82400. 'â…¦' => 'â…¶',
  82401. 'â…§' => 'â…·',
  82402. 'â…¨' => 'â…¸',
  82403. 'â…©' => 'â…¹',
  82404. 'â…ª' => 'â…º',
  82405. 'â…«' => 'â…»',
  82406. 'â…¬' => 'â…¼',
  82407. 'â…­' => 'â…½',
  82408. 'â…®' => 'â…¾',
  82409. 'â…¯' => 'â…¿',
  82410. 'Ↄ' => 'ↄ',
  82411. 'Ⓐ' => '�',
  82412. 'â’·' => 'â“‘',
  82413. 'â’¸' => 'â“’',
  82414. 'â’¹' => 'â““',
  82415. 'â’º' => 'â“”',
  82416. 'â’»' => 'â“•',
  82417. 'â’¼' => 'â“–',
  82418. 'â’½' => 'â“—',
  82419. 'Ⓘ' => 'ⓘ',
  82420. 'â’¿' => 'â“™',
  82421. 'â“€' => 'â“š',
  82422. '�' => 'ⓛ',
  82423. 'Ⓜ' => 'ⓜ',
  82424. 'Ⓝ' => '�',
  82425. 'â“„' => 'â“ž',
  82426. 'â“…' => 'â“Ÿ',
  82427. 'Ⓠ' => 'ⓠ',
  82428. 'Ⓡ' => 'ⓡ',
  82429. 'Ⓢ' => 'ⓢ',
  82430. 'Ⓣ' => 'ⓣ',
  82431. 'Ⓤ' => 'ⓤ',
  82432. 'â“‹' => 'â“¥',
  82433. 'Ⓦ' => 'ⓦ',
  82434. '�' => 'ⓧ',
  82435. 'Ⓨ' => 'ⓨ',
  82436. '�' => 'ⓩ',
  82437. 'â°€' => 'â°°',
  82438. 'â°�' => 'â°±',
  82439. 'â°‚' => 'â°²',
  82440. 'â°ƒ' => 'â°³',
  82441. 'â°„' => 'â°´',
  82442. 'â°…' => 'â°µ',
  82443. 'â°†' => 'â°¶',
  82444. 'â°‡' => 'â°·',
  82445. 'â°ˆ' => 'â°¸',
  82446. 'â°‰' => 'â°¹',
  82447. 'â°Š' => 'â°º',
  82448. 'â°‹' => 'â°»',
  82449. 'Ⰼ' => 'ⰼ',
  82450. 'â°�' => 'â°½',
  82451. 'â°Ž' => 'â°¾',
  82452. 'â°�' => 'â°¿',
  82453. 'â°�' => 'â±€',
  82454. 'Ⱁ' => '�',
  82455. 'Ⱂ' => 'ⱂ',
  82456. 'Ⱃ' => 'ⱃ',
  82457. 'Ⱄ' => 'ⱄ',
  82458. 'â°•' => 'â±…',
  82459. 'Ⱆ' => 'ⱆ',
  82460. 'Ⱇ' => 'ⱇ',
  82461. 'Ⱈ' => 'ⱈ',
  82462. 'Ⱉ' => 'ⱉ',
  82463. 'Ⱊ' => 'ⱊ',
  82464. 'Ⱋ' => 'ⱋ',
  82465. 'Ⱌ' => 'ⱌ',
  82466. '�' => '�',
  82467. 'Ⱎ' => 'ⱎ',
  82468. 'Ⱏ' => '�',
  82469. 'Ⱐ' => '�',
  82470. 'Ⱑ' => 'ⱑ',
  82471. 'â°¢' => 'â±’',
  82472. 'Ⱓ' => 'ⱓ',
  82473. 'â°¤' => 'â±”',
  82474. 'Ⱕ' => 'ⱕ',
  82475. 'â°¦' => 'â±–',
  82476. 'â°§' => 'â±—',
  82477. 'Ⱘ' => 'ⱘ',
  82478. 'â°©' => 'â±™',
  82479. 'Ⱚ' => 'ⱚ',
  82480. 'â°«' => 'â±›',
  82481. 'Ⱜ' => 'ⱜ',
  82482. 'Ⱝ' => '�',
  82483. 'Ⱞ' => 'ⱞ',
  82484. 'Ⱡ' => 'ⱡ',
  82485. 'â±¢' => 'É«',
  82486. 'â±£' => 'áµ½',
  82487. 'Ɽ' => 'ɽ',
  82488. 'Ⱨ' => 'ⱨ',
  82489. 'Ⱪ' => 'ⱪ',
  82490. 'Ⱬ' => 'ⱬ',
  82491. 'â±­' => 'É‘',
  82492. 'Ɱ' => 'ɱ',
  82493. 'Ɐ' => '�',
  82494. 'â±°' => 'É’',
  82495. 'â±²' => 'â±³',
  82496. 'Ⱶ' => 'ⱶ',
  82497. 'â±¾' => 'È¿',
  82498. 'Ɀ' => 'ɀ',
  82499. 'Ⲁ' => '�',
  82500. 'Ⲃ' => 'ⲃ',
  82501. 'Ⲅ' => 'ⲅ',
  82502. 'Ⲇ' => 'ⲇ',
  82503. 'Ⲉ' => 'ⲉ',
  82504. 'Ⲋ' => 'ⲋ',
  82505. 'Ⲍ' => '�',
  82506. 'Ⲏ' => '�',
  82507. '�' => 'ⲑ',
  82508. 'Ⲓ' => 'ⲓ',
  82509. 'Ⲕ' => 'ⲕ',
  82510. 'â²–' => 'â²—',
  82511. 'Ⲙ' => 'ⲙ',
  82512. 'Ⲛ' => 'ⲛ',
  82513. 'Ⲝ' => '�',
  82514. 'Ⲟ' => 'ⲟ',
  82515. 'Ⲡ' => 'ⲡ',
  82516. 'â²¢' => 'â²£',
  82517. 'Ⲥ' => 'ⲥ',
  82518. 'Ⲧ' => 'ⲧ',
  82519. 'Ⲩ' => 'ⲩ',
  82520. 'Ⲫ' => 'ⲫ',
  82521. 'Ⲭ' => 'ⲭ',
  82522. 'Ⲯ' => 'ⲯ',
  82523. 'â²°' => 'â²±',
  82524. 'â²²' => 'â²³',
  82525. 'â²´' => 'â²µ',
  82526. 'Ⲷ' => 'ⲷ',
  82527. 'Ⲹ' => 'ⲹ',
  82528. 'Ⲻ' => 'ⲻ',
  82529. 'â²¼' => 'â²½',
  82530. 'Ⲿ' => 'ⲿ',
  82531. 'Ⳁ' => '�',
  82532. 'Ⳃ' => 'ⳃ',
  82533. 'Ⳅ' => 'ⳅ',
  82534. 'Ⳇ' => 'ⳇ',
  82535. 'Ⳉ' => 'ⳉ',
  82536. 'Ⳋ' => 'ⳋ',
  82537. 'Ⳍ' => '�',
  82538. 'Ⳏ' => '�',
  82539. '�' => 'ⳑ',
  82540. 'Ⳓ' => 'ⳓ',
  82541. 'Ⳕ' => 'ⳕ',
  82542. 'â³–' => 'â³—',
  82543. 'Ⳙ' => 'ⳙ',
  82544. 'Ⳛ' => 'ⳛ',
  82545. 'Ⳝ' => '�',
  82546. 'Ⳟ' => 'ⳟ',
  82547. 'Ⳡ' => 'ⳡ',
  82548. 'â³¢' => 'â³£',
  82549. 'Ⳬ' => 'ⳬ',
  82550. 'â³­' => 'â³®',
  82551. 'â³²' => 'â³³',
  82552. 'Ꙁ' => '�',
  82553. 'Ꙃ' => 'ꙃ',
  82554. 'Ꙅ' => 'ꙅ',
  82555. 'Ꙇ' => 'ꙇ',
  82556. 'Ꙉ' => 'ꙉ',
  82557. 'Ꙋ' => 'ꙋ',
  82558. 'Ꙍ' => '�',
  82559. 'Ꙏ' => '�',
  82560. '�' => 'ꙑ',
  82561. 'Ꙓ' => 'ꙓ',
  82562. 'Ꙕ' => 'ꙕ',
  82563. 'ê™–' => 'ê™—',
  82564. 'Ꙙ' => 'ꙙ',
  82565. 'Ꙛ' => 'ꙛ',
  82566. 'Ꙝ' => '�',
  82567. 'Ꙟ' => 'ꙟ',
  82568. 'Ꙡ' => 'ꙡ',
  82569. 'Ꙣ' => 'ꙣ',
  82570. 'Ꙥ' => 'ꙥ',
  82571. 'Ꙧ' => 'ꙧ',
  82572. 'Ꙩ' => 'ꙩ',
  82573. 'Ꙫ' => 'ꙫ',
  82574. 'Ꙭ' => 'ꙭ',
  82575. 'Ꚁ' => '�',
  82576. 'Ꚃ' => 'ꚃ',
  82577. 'êš„' => 'êš…',
  82578. 'Ꚇ' => 'ꚇ',
  82579. 'Ꚉ' => 'ꚉ',
  82580. 'Ꚋ' => 'ꚋ',
  82581. 'Ꚍ' => '�',
  82582. 'Ꚏ' => '�',
  82583. '�' => 'ꚑ',
  82584. 'êš’' => 'êš“',
  82585. 'êš”' => 'êš•',
  82586. 'êš–' => 'êš—',
  82587. 'Ꚙ' => 'ꚙ',
  82588. 'êšš' => 'êš›',
  82589. 'Ꜣ' => 'ꜣ',
  82590. 'Ꜥ' => 'ꜥ',
  82591. 'Ꜧ' => 'ꜧ',
  82592. 'Ꜩ' => 'ꜩ',
  82593. 'Ꜫ' => 'ꜫ',
  82594. 'Ꜭ' => 'ꜭ',
  82595. 'Ꜯ' => 'ꜯ',
  82596. 'Ꜳ' => 'ꜳ',
  82597. 'Ꜵ' => 'ꜵ',
  82598. 'Ꜷ' => 'ꜷ',
  82599. 'Ꜹ' => 'ꜹ',
  82600. 'Ꜻ' => 'ꜻ',
  82601. 'Ꜽ' => 'ꜽ',
  82602. 'Ꜿ' => 'ꜿ',
  82603. '�' => '�',
  82604. '�' => '�',
  82605. '�' => '�',
  82606. '�' => '�',
  82607. '�' => '�',
  82608. '�' => '�',
  82609. '�' => '�',
  82610. '�' => '�',
  82611. '�' => '�',
  82612. '�' => '�',
  82613. '�' => '�',
  82614. '�' => '�',
  82615. '�' => '�',
  82616. '�' => '�',
  82617. '�' => '�',
  82618. '�' => '�',
  82619. '�' => '�',
  82620. '�' => '�',
  82621. '�' => '�',
  82622. '�' => '�',
  82623. '�' => '�',
  82624. '�' => '�',
  82625. '�' => '�',
  82626. '�' => '�',
  82627. '�' => '�',
  82628. '�' => '�',
  82629. '�' => 'ᵹ',
  82630. '�' => '�',
  82631. 'Ꞁ' => '�',
  82632. 'Ꞃ' => 'ꞃ',
  82633. 'êž„' => 'êž…',
  82634. 'Ꞇ' => 'ꞇ',
  82635. 'Ꞌ' => 'ꞌ',
  82636. '�' => 'ɥ',
  82637. '�' => 'ꞑ',
  82638. 'êž’' => 'êž“',
  82639. 'êž–' => 'êž—',
  82640. 'Ꞙ' => 'ꞙ',
  82641. 'êžš' => 'êž›',
  82642. 'Ꞝ' => '�',
  82643. 'Ꞟ' => 'ꞟ',
  82644. 'êž ' => 'êž¡',
  82645. 'Ꞣ' => 'ꞣ',
  82646. 'Ꞥ' => 'ꞥ',
  82647. 'Ꞧ' => 'ꞧ',
  82648. 'Ꞩ' => 'ꞩ',
  82649. 'Ɦ' => 'ɦ',
  82650. 'Ɜ' => 'ɜ',
  82651. 'Ɡ' => 'ɡ',
  82652. 'Ɬ' => 'ɬ',
  82653. 'Ɪ' => 'ɪ',
  82654. 'êž°' => 'Êž',
  82655. 'Ʇ' => 'ʇ',
  82656. 'Ʝ' => '�',
  82657. 'êž³' => 'ê­“',
  82658. 'êž´' => 'êžµ',
  82659. 'Ꞷ' => 'ꞷ',
  82660. 'Ꞹ' => 'ꞹ',
  82661. 'Ꞻ' => 'ꞻ',
  82662. 'êž¼' => 'êž½',
  82663. 'êž¾' => 'êž¿',
  82664. 'Ꟃ' => 'ꟃ',
  82665. 'Ꞔ' => 'ꞔ',
  82666. 'Ʂ' => 'ʂ',
  82667. 'Ᶎ' => 'ᶎ',
  82668. 'Ꟈ' => 'ꟈ',
  82669. 'Ꟊ' => 'ꟊ',
  82670. 'Ꟶ' => 'ꟶ',
  82671. 'A' => '�',
  82672. 'B' => 'b',
  82673. 'C' => 'c',
  82674. 'D' => 'd',
  82675. 'ï¼¥' => 'ï½…',
  82676. 'F' => 'f',
  82677. 'G' => 'g',
  82678. 'H' => 'h',
  82679. 'I' => 'i',
  82680. 'J' => 'j',
  82681. 'K' => 'k',
  82682. 'L' => 'l',
  82683. 'M' => '�',
  82684. 'N' => 'n',
  82685. 'O' => '�',
  82686. 'P' => '�',
  82687. 'Q' => 'q',
  82688. 'ï¼²' => 'ï½’',
  82689. 'S' => 's',
  82690. 'ï¼´' => 'ï½”',
  82691. 'U' => 'u',
  82692. 'V' => 'v',
  82693. 'ï¼·' => 'ï½—',
  82694. 'X' => 'x',
  82695. 'ï¼¹' => 'ï½™',
  82696. 'Z' => 'z',
  82697. '�' => '�',
  82698. '�' => '�',
  82699. '�' => '�',
  82700. '�' => '�',
  82701. '�' => '�',
  82702. '�' => '�',
  82703. '�' => '�',
  82704. '�' => '�',
  82705. '�' => '�',
  82706. '�' => '�',
  82707. '�' => '�',
  82708. '�' => '�',
  82709. '�' => '�',
  82710. '�' => '�',
  82711. '�' => '�',
  82712. '�' => '�',
  82713. '�' => '�',
  82714. '�' => '�',
  82715. '�' => '�',
  82716. '�' => '�',
  82717. '�' => '�',
  82718. '�' => '�',
  82719. '�' => '�',
  82720. '�' => '�',
  82721. '�' => '�',
  82722. '�' => '�',
  82723. '�' => '�',
  82724. '�' => '�',
  82725. '�' => '�',
  82726. '�' => '�',
  82727. '�' => '�',
  82728. '�' => '�',
  82729. '�' => '�',
  82730. '�' => '�',
  82731. '�' => '�',
  82732. '�' => '�',
  82733. '�' => '�',
  82734. '�' => '�',
  82735. '�' => '�',
  82736. '�' => '�',
  82737. '�' => '�',
  82738. '�' => '�',
  82739. '�' => '�',
  82740. '�' => '�',
  82741. '�' => '�',
  82742. '�' => '�',
  82743. '�' => '�',
  82744. '�' => '�',
  82745. '�' => '�',
  82746. '�' => '�',
  82747. '�' => '�',
  82748. '�' => '�',
  82749. '�' => '�',
  82750. '�' => '�',
  82751. '�' => '�',
  82752. '�' => '�',
  82753. '�' => '�',
  82754. '�' => '�',
  82755. '�' => '�',
  82756. '�' => '�',
  82757. '�' => '�',
  82758. '�' => '�',
  82759. '�' => '�',
  82760. '�' => '�',
  82761. '�' => '�',
  82762. '�' => '�',
  82763. '�' => '�',
  82764. '�' => '�',
  82765. '�' => '�',
  82766. '�' => '�',
  82767. '�' => '�',
  82768. '�' => '�',
  82769. '�' => '�',
  82770. '�' => '�',
  82771. '�' => '�',
  82772. '�' => '�',
  82773. '�' => '�',
  82774. '�' => '�',
  82775. '�' => '�',
  82776. '�' => '�',
  82777. '�' => '�',
  82778. '�' => '�',
  82779. '�' => '�',
  82780. '�' => '�',
  82781. '�' => '�',
  82782. '�' => '�',
  82783. '�' => '�',
  82784. '�' => '�',
  82785. '�' => '�',
  82786. '�' => '�',
  82787. '�' => '�',
  82788. '�' => '�',
  82789. '�' => '�',
  82790. '�' => '�',
  82791. '�' => '�',
  82792. '�' => '�',
  82793. '�' => '�',
  82794. '�' => '�',
  82795. '�' => '�',
  82796. '�' => '�',
  82797. '�' => '�',
  82798. '�' => '�',
  82799. '�' => '�',
  82800. '�' => '�',
  82801. '�' => '�',
  82802. '�' => '�',
  82803. '�' => '�',
  82804. '�' => '�',
  82805. '�' => '�',
  82806. '�' => '�',
  82807. '�' => '�',
  82808. '�' => '�',
  82809. '�' => '�',
  82810. '�' => '�',
  82811. '�' => '�',
  82812. '�' => '�',
  82813. '�' => '�',
  82814. '�' => '�',
  82815. '�' => '�',
  82816. '�' => '�',
  82817. '�' => '�',
  82818. '�' => '�',
  82819. '�' => '�',
  82820. '�' => '�',
  82821. '�' => '�',
  82822. '�' => '�',
  82823. '�' => '�',
  82824. 'ð‘¢ ' => 'ð‘£€',
  82825. '𑢡' => '�',
  82826. '𑢢' => '𑣂',
  82827. '𑢣' => '𑣃',
  82828. '𑢤' => '𑣄',
  82829. 'ð‘¢¥' => 'ð‘£…',
  82830. '𑢦' => '𑣆',
  82831. '𑢧' => '𑣇',
  82832. '𑢨' => '𑣈',
  82833. '𑢩' => '𑣉',
  82834. '𑢪' => '𑣊',
  82835. '𑢫' => '𑣋',
  82836. '𑢬' => '𑣌',
  82837. '𑢭' => '�',
  82838. '𑢮' => '𑣎',
  82839. '𑢯' => '�',
  82840. '𑢰' => '�',
  82841. '𑢱' => '𑣑',
  82842. 'ð‘¢²' => 'ð‘£’',
  82843. '𑢳' => '𑣓',
  82844. 'ð‘¢´' => 'ð‘£”',
  82845. '𑢵' => '𑣕',
  82846. '𑢶' => '𑣖',
  82847. 'ð‘¢·' => 'ð‘£—',
  82848. '𑢸' => '𑣘',
  82849. 'ð‘¢¹' => 'ð‘£™',
  82850. '𑢺' => '𑣚',
  82851. 'ð‘¢»' => 'ð‘£›',
  82852. '𑢼' => '𑣜',
  82853. '𑢽' => '�',
  82854. '𑢾' => '𑣞',
  82855. '𑢿' => '𑣟',
  82856. 'ð–¹€' => 'ð–¹ ',
  82857. '�' => '𖹡',
  82858. '𖹂' => '𖹢',
  82859. '𖹃' => '𖹣',
  82860. '𖹄' => '𖹤',
  82861. 'ð–¹…' => 'ð–¹¥',
  82862. '𖹆' => '𖹦',
  82863. '𖹇' => '𖹧',
  82864. '𖹈' => '𖹨',
  82865. '𖹉' => '𖹩',
  82866. '𖹊' => '𖹪',
  82867. '𖹋' => '𖹫',
  82868. '𖹌' => '𖹬',
  82869. '�' => '𖹭',
  82870. '𖹎' => '𖹮',
  82871. '�' => '𖹯',
  82872. '�' => '𖹰',
  82873. '𖹑' => '𖹱',
  82874. 'ð–¹’' => 'ð–¹²',
  82875. '𖹓' => '𖹳',
  82876. 'ð–¹”' => 'ð–¹´',
  82877. '𖹕' => '𖹵',
  82878. '𖹖' => '𖹶',
  82879. 'ð–¹—' => 'ð–¹·',
  82880. '𖹘' => '𖹸',
  82881. 'ð–¹™' => 'ð–¹¹',
  82882. '𖹚' => '𖹺',
  82883. 'ð–¹›' => 'ð–¹»',
  82884. '𖹜' => '𖹼',
  82885. '�' => '𖹽',
  82886. '𖹞' => '𖹾',
  82887. '𖹟' => '𖹿',
  82888. '𞤀' => '𞤢',
  82889. '�' => '𞤣',
  82890. '𞤂' => '𞤤',
  82891. '𞤃' => '𞤥',
  82892. '𞤄' => '𞤦',
  82893. '𞤅' => '𞤧',
  82894. '𞤆' => '𞤨',
  82895. '𞤇' => '𞤩',
  82896. '𞤈' => '𞤪',
  82897. '𞤉' => '𞤫',
  82898. '𞤊' => '𞤬',
  82899. '𞤋' => '𞤭',
  82900. '𞤌' => '𞤮',
  82901. '�' => '𞤯',
  82902. '𞤎' => '𞤰',
  82903. '�' => '𞤱',
  82904. '�' => '𞤲',
  82905. '𞤑' => '𞤳',
  82906. '𞤒' => '𞤴',
  82907. '𞤓' => '𞤵',
  82908. '𞤔' => '𞤶',
  82909. '𞤕' => '𞤷',
  82910. '𞤖' => '𞤸',
  82911. '𞤗' => '𞤹',
  82912. '𞤘' => '𞤺',
  82913. '𞤙' => '𞤻',
  82914. '𞤚' => '𞤼',
  82915. '𞤛' => '𞤽',
  82916. '𞤜' => '𞤾',
  82917. '�' => '𞤿',
  82918. '𞤞' => '𞥀',
  82919. '𞤟' => '�',
  82920. '𞤠' => '𞥂',
  82921. '𞤡' => '𞥃',
  82922. );
  82923. <?php
  82924. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  82925. <?php
  82926. return array (
  82927. 'a' => 'A',
  82928. 'b' => 'B',
  82929. 'c' => 'C',
  82930. 'd' => 'D',
  82931. 'e' => 'E',
  82932. 'f' => 'F',
  82933. 'g' => 'G',
  82934. 'h' => 'H',
  82935. 'i' => 'I',
  82936. 'j' => 'J',
  82937. 'k' => 'K',
  82938. 'l' => 'L',
  82939. 'm' => 'M',
  82940. 'n' => 'N',
  82941. 'o' => 'O',
  82942. 'p' => 'P',
  82943. 'q' => 'Q',
  82944. 'r' => 'R',
  82945. 's' => 'S',
  82946. 't' => 'T',
  82947. 'u' => 'U',
  82948. 'v' => 'V',
  82949. 'w' => 'W',
  82950. 'x' => 'X',
  82951. 'y' => 'Y',
  82952. 'z' => 'Z',
  82953. 'µ' => 'Μ',
  82954. 'à' => 'À',
  82955. 'á' => '�',
  82956. 'â' => 'Â',
  82957. 'ã' => 'Ã',
  82958. 'ä' => 'Ä',
  82959. 'Ã¥' => 'Ã…',
  82960. 'æ' => 'Æ',
  82961. 'ç' => 'Ç',
  82962. 'è' => 'È',
  82963. 'é' => 'É',
  82964. 'ê' => 'Ê',
  82965. 'ë' => 'Ë',
  82966. 'ì' => 'Ì',
  82967. 'í' => '�',
  82968. 'î' => 'Î',
  82969. 'ï' => '�',
  82970. 'ð' => '�',
  82971. 'ñ' => 'Ñ',
  82972. 'ò' => 'Ò',
  82973. 'ó' => 'Ó',
  82974. 'ô' => 'Ô',
  82975. 'õ' => 'Õ',
  82976. 'ö' => 'Ö',
  82977. 'ø' => 'Ø',
  82978. 'ù' => 'Ù',
  82979. 'ú' => 'Ú',
  82980. 'û' => 'Û',
  82981. 'ü' => 'Ü',
  82982. 'ý' => '�',
  82983. 'þ' => 'Þ',
  82984. 'ÿ' => 'Ÿ',
  82985. '�' => 'Ā',
  82986. 'ă' => 'Ă',
  82987. 'Ä…' => 'Ä„',
  82988. 'ć' => 'Ć',
  82989. 'ĉ' => 'Ĉ',
  82990. 'Ä‹' => 'ÄŠ',
  82991. '�' => 'Č',
  82992. '�' => 'Ď',
  82993. 'đ' => '�',
  82994. 'Ä“' => 'Ä’',
  82995. 'Ä•' => 'Ä”',
  82996. 'Ä—' => 'Ä–',
  82997. 'ę' => 'Ę',
  82998. 'Ä›' => 'Äš',
  82999. '�' => 'Ĝ',
  83000. 'ÄŸ' => 'Äž',
  83001. 'Ä¡' => 'Ä ',
  83002. 'Ä£' => 'Ä¢',
  83003. 'ĥ' => 'Ĥ',
  83004. 'ħ' => 'Ħ',
  83005. 'ĩ' => 'Ĩ',
  83006. 'ī' => 'Ī',
  83007. 'ĭ' => 'Ĭ',
  83008. 'į' => 'Į',
  83009. 'ı' => 'I',
  83010. 'ij' => 'IJ',
  83011. 'ĵ' => 'Ĵ',
  83012. 'ķ' => 'Ķ',
  83013. 'ĺ' => 'Ĺ',
  83014. 'ļ' => 'Ļ',
  83015. 'ľ' => 'Ľ',
  83016. 'Å€' => 'Ä¿',
  83017. 'ł' => '�',
  83018. 'ń' => 'Ń',
  83019. 'ņ' => 'Ņ',
  83020. 'ň' => 'Ň',
  83021. 'Å‹' => 'ÅŠ',
  83022. '�' => 'Ō',
  83023. '�' => 'Ŏ',
  83024. 'ő' => '�',
  83025. 'Å“' => 'Å’',
  83026. 'Å•' => 'Å”',
  83027. 'Å—' => 'Å–',
  83028. 'ř' => 'Ř',
  83029. 'Å›' => 'Åš',
  83030. '�' => 'Ŝ',
  83031. 'ÅŸ' => 'Åž',
  83032. 'Å¡' => 'Å ',
  83033. 'Å£' => 'Å¢',
  83034. 'ť' => 'Ť',
  83035. 'ŧ' => 'Ŧ',
  83036. 'ũ' => 'Ũ',
  83037. 'ū' => 'Ū',
  83038. 'ŭ' => 'Ŭ',
  83039. 'ů' => 'Ů',
  83040. 'ű' => 'Ű',
  83041. 'ų' => 'Ų',
  83042. 'ŵ' => 'Ŵ',
  83043. 'ŷ' => 'Ŷ',
  83044. 'ź' => 'Ź',
  83045. 'ż' => 'Ż',
  83046. 'ž' => 'Ž',
  83047. 'Å¿' => 'S',
  83048. 'ƀ' => 'Ƀ',
  83049. 'ƃ' => 'Ƃ',
  83050. 'Æ…' => 'Æ„',
  83051. 'ƈ' => 'Ƈ',
  83052. 'ƌ' => 'Ƌ',
  83053. 'Æ’' => 'Æ‘',
  83054. 'ƕ' => 'Ƕ',
  83055. 'ƙ' => 'Ƙ',
  83056. 'ƚ' => 'Ƚ',
  83057. 'Æž' => 'È ',
  83058. 'Æ¡' => 'Æ ',
  83059. 'Æ£' => 'Æ¢',
  83060. 'ƥ' => 'Ƥ',
  83061. 'ƨ' => 'Ƨ',
  83062. 'ƭ' => 'Ƭ',
  83063. 'ư' => 'Ư',
  83064. 'ƴ' => 'Ƴ',
  83065. 'ƶ' => 'Ƶ',
  83066. 'ƹ' => 'Ƹ',
  83067. 'ƽ' => 'Ƽ',
  83068. 'Æ¿' => 'Ç·',
  83069. 'Ç…' => 'Ç„',
  83070. 'dž' => 'DŽ',
  83071. 'Lj' => 'LJ',
  83072. 'lj' => 'LJ',
  83073. 'Ç‹' => 'ÇŠ',
  83074. 'nj' => 'NJ',
  83075. 'ǎ' => '�',
  83076. '�' => '�',
  83077. 'Ç’' => 'Ç‘',
  83078. 'Ç”' => 'Ç“',
  83079. 'Ç–' => 'Ç•',
  83080. 'ǘ' => 'Ǘ',
  83081. 'Çš' => 'Ç™',
  83082. 'ǜ' => 'Ǜ',
  83083. '�' => 'Ǝ',
  83084. 'ÇŸ' => 'Çž',
  83085. 'Ç¡' => 'Ç ',
  83086. 'Ç£' => 'Ç¢',
  83087. 'ǥ' => 'Ǥ',
  83088. 'ǧ' => 'Ǧ',
  83089. 'ǩ' => 'Ǩ',
  83090. 'ǫ' => 'Ǫ',
  83091. 'ǭ' => 'Ǭ',
  83092. 'ǯ' => 'Ǯ',
  83093. 'Dz' => 'DZ',
  83094. 'dz' => 'DZ',
  83095. 'ǵ' => 'Ǵ',
  83096. 'ǹ' => 'Ǹ',
  83097. 'ǻ' => 'Ǻ',
  83098. 'ǽ' => 'Ǽ',
  83099. 'ǿ' => 'Ǿ',
  83100. '�' => 'Ȁ',
  83101. 'ȃ' => 'Ȃ',
  83102. 'È…' => 'È„',
  83103. 'ȇ' => 'Ȇ',
  83104. 'ȉ' => 'Ȉ',
  83105. 'È‹' => 'ÈŠ',
  83106. '�' => 'Ȍ',
  83107. '�' => 'Ȏ',
  83108. 'ȑ' => '�',
  83109. 'È“' => 'È’',
  83110. 'È•' => 'È”',
  83111. 'È—' => 'È–',
  83112. 'ș' => 'Ș',
  83113. 'È›' => 'Èš',
  83114. '�' => 'Ȝ',
  83115. 'ÈŸ' => 'Èž',
  83116. 'È£' => 'È¢',
  83117. 'ȥ' => 'Ȥ',
  83118. 'ȧ' => 'Ȧ',
  83119. 'ȩ' => 'Ȩ',
  83120. 'ȫ' => 'Ȫ',
  83121. 'ȭ' => 'Ȭ',
  83122. 'ȯ' => 'Ȯ',
  83123. 'ȱ' => 'Ȱ',
  83124. 'ȳ' => 'Ȳ',
  83125. 'ȼ' => 'Ȼ',
  83126. 'È¿' => 'â±¾',
  83127. 'ɀ' => 'Ɀ',
  83128. 'ɂ' => '�',
  83129. 'ɇ' => 'Ɇ',
  83130. 'ɉ' => 'Ɉ',
  83131. 'É‹' => 'ÉŠ',
  83132. '�' => 'Ɍ',
  83133. '�' => 'Ɏ',
  83134. '�' => 'Ɐ',
  83135. 'É‘' => 'â±­',
  83136. 'É’' => 'â±°',
  83137. 'ɓ' => '�',
  83138. 'ɔ' => 'Ɔ',
  83139. 'ɖ' => 'Ɖ',
  83140. 'É—' => 'ÆŠ',
  83141. 'ə' => '�',
  83142. 'ɛ' => '�',
  83143. 'ɜ' => 'Ɜ',
  83144. 'É ' => 'Æ“',
  83145. 'ɡ' => 'Ɡ',
  83146. 'É£' => 'Æ”',
  83147. 'ɥ' => '�',
  83148. 'ɦ' => 'Ɦ',
  83149. 'ɨ' => 'Ɨ',
  83150. 'É©' => 'Æ–',
  83151. 'ɪ' => 'Ɪ',
  83152. 'É«' => 'â±¢',
  83153. 'ɬ' => 'Ɬ',
  83154. 'ɯ' => 'Ɯ',
  83155. 'ɱ' => 'Ɱ',
  83156. 'ɲ' => '�',
  83157. 'ɵ' => 'Ɵ',
  83158. 'ɽ' => 'Ɽ',
  83159. 'ʀ' => 'Ʀ',
  83160. 'ʂ' => 'Ʂ',
  83161. 'ʃ' => 'Ʃ',
  83162. 'ʇ' => 'Ʇ',
  83163. 'ʈ' => 'Ʈ',
  83164. 'ʉ' => 'Ʉ',
  83165. 'ʊ' => 'Ʊ',
  83166. 'ʋ' => 'Ʋ',
  83167. 'ʌ' => 'Ʌ',
  83168. 'Ê’' => 'Æ·',
  83169. '�' => 'Ʝ',
  83170. 'Êž' => 'êž°',
  83171. 'ͅ' => 'Ι',
  83172. 'ͱ' => 'Ͱ',
  83173. 'ͳ' => 'Ͳ',
  83174. 'ͷ' => 'Ͷ',
  83175. 'ͻ' => 'Ͻ',
  83176. 'ͼ' => 'Ͼ',
  83177. 'ͽ' => 'Ͽ',
  83178. 'ά' => 'Ά',
  83179. 'έ' => 'Έ',
  83180. 'ή' => 'Ή',
  83181. 'ί' => 'Ί',
  83182. 'α' => 'Α',
  83183. 'β' => 'Β',
  83184. 'γ' => 'Γ',
  83185. 'δ' => 'Δ',
  83186. 'ε' => 'Ε',
  83187. 'ζ' => 'Ζ',
  83188. 'η' => 'Η',
  83189. 'θ' => 'Θ',
  83190. 'ι' => 'Ι',
  83191. 'κ' => 'Κ',
  83192. 'λ' => 'Λ',
  83193. 'μ' => 'Μ',
  83194. 'ν' => '�',
  83195. 'ξ' => 'Ξ',
  83196. 'ο' => 'Ο',
  83197. 'π' => 'Π',
  83198. '�' => 'Ρ',
  83199. 'ς' => 'Σ',
  83200. 'σ' => 'Σ',
  83201. 'τ' => 'Τ',
  83202. 'Ï…' => 'Î¥',
  83203. 'φ' => 'Φ',
  83204. 'χ' => 'Χ',
  83205. 'ψ' => 'Ψ',
  83206. 'ω' => 'Ω',
  83207. 'ϊ' => 'Ϊ',
  83208. 'ϋ' => 'Ϋ',
  83209. 'ό' => 'Ό',
  83210. '�' => 'Ύ',
  83211. 'ώ' => '�',
  83212. '�' => 'Β',
  83213. 'ϑ' => 'Θ',
  83214. 'ϕ' => 'Φ',
  83215. 'ϖ' => 'Π',
  83216. 'ϗ' => '�',
  83217. 'ϙ' => 'Ϙ',
  83218. 'Ï›' => 'Ïš',
  83219. '�' => 'Ϝ',
  83220. 'ÏŸ' => 'Ïž',
  83221. 'Ï¡' => 'Ï ',
  83222. 'Ï£' => 'Ï¢',
  83223. 'ϥ' => 'Ϥ',
  83224. 'ϧ' => 'Ϧ',
  83225. 'ϩ' => 'Ϩ',
  83226. 'ϫ' => 'Ϫ',
  83227. 'ϭ' => 'Ϭ',
  83228. 'ϯ' => 'Ϯ',
  83229. 'ϰ' => 'Κ',
  83230. 'ϱ' => 'Ρ',
  83231. 'ϲ' => 'Ϲ',
  83232. 'ϳ' => 'Ϳ',
  83233. 'ϵ' => 'Ε',
  83234. 'ϸ' => 'Ϸ',
  83235. 'ϻ' => 'Ϻ',
  83236. 'а' => '�',
  83237. 'б' => 'Б',
  83238. 'в' => 'В',
  83239. 'г' => 'Г',
  83240. 'д' => 'Д',
  83241. 'е' => 'Е',
  83242. 'ж' => 'Ж',
  83243. 'з' => 'З',
  83244. 'и' => 'И',
  83245. 'й' => 'Й',
  83246. 'к' => 'К',
  83247. 'л' => 'Л',
  83248. 'м' => 'М',
  83249. 'н' => '�',
  83250. 'о' => 'О',
  83251. 'п' => 'П',
  83252. 'р' => 'Р',
  83253. '�' => 'С',
  83254. 'т' => 'Т',
  83255. 'у' => 'У',
  83256. 'ф' => 'Ф',
  83257. 'Ñ…' => 'Ð¥',
  83258. 'ц' => 'Ц',
  83259. 'ч' => 'Ч',
  83260. 'ш' => 'Ш',
  83261. 'щ' => 'Щ',
  83262. 'ъ' => 'Ъ',
  83263. 'ы' => 'Ы',
  83264. 'ь' => 'Ь',
  83265. '�' => 'Э',
  83266. 'ю' => 'Ю',
  83267. '�' => 'Я',
  83268. '�' => 'Ѐ',
  83269. 'ё' => '�',
  83270. 'ђ' => 'Ђ',
  83271. 'ѓ' => 'Ѓ',
  83272. 'є' => 'Є',
  83273. 'Ñ•' => 'Ð…',
  83274. 'і' => 'І',
  83275. 'ї' => 'Ї',
  83276. 'ј' => 'Ј',
  83277. 'љ' => 'Љ',
  83278. 'њ' => 'Њ',
  83279. 'ћ' => 'Ћ',
  83280. 'ќ' => 'Ќ',
  83281. '�' => '�',
  83282. 'Ñž' => 'ÐŽ',
  83283. 'џ' => '�',
  83284. 'Ñ¡' => 'Ñ ',
  83285. 'Ñ£' => 'Ñ¢',
  83286. 'ѥ' => 'Ѥ',
  83287. 'ѧ' => 'Ѧ',
  83288. 'ѩ' => 'Ѩ',
  83289. 'ѫ' => 'Ѫ',
  83290. 'ѭ' => 'Ѭ',
  83291. 'ѯ' => 'Ѯ',
  83292. 'ѱ' => 'Ѱ',
  83293. 'ѳ' => 'Ѳ',
  83294. 'ѵ' => 'Ѵ',
  83295. 'ѷ' => 'Ѷ',
  83296. 'ѹ' => 'Ѹ',
  83297. 'ѻ' => 'Ѻ',
  83298. 'ѽ' => 'Ѽ',
  83299. 'ѿ' => 'Ѿ',
  83300. 'Ò�' => 'Ò€',
  83301. 'Ò‹' => 'ÒŠ',
  83302. '�' => 'Ҍ',
  83303. 'Ò�' => 'ÒŽ',
  83304. 'Ò‘' => 'Ò�',
  83305. 'Ò“' => 'Ò’',
  83306. 'Ò•' => 'Ò”',
  83307. 'Ò—' => 'Ò–',
  83308. 'Ò™' => 'Ò˜',
  83309. 'Ò›' => 'Òš',
  83310. '�' => 'Ҝ',
  83311. 'ÒŸ' => 'Òž',
  83312. 'Ò¡' => 'Ò ',
  83313. 'Ò£' => 'Ò¢',
  83314. 'Ò¥' => 'Ò¤',
  83315. 'Ò§' => 'Ò¦',
  83316. 'Ò©' => 'Ò¨',
  83317. 'Ò«' => 'Òª',
  83318. 'Ò­' => 'Ò¬',
  83319. 'Ò¯' => 'Ò®',
  83320. 'Ò±' => 'Ò°',
  83321. 'Ò³' => 'Ò²',
  83322. 'Òµ' => 'Ò´',
  83323. 'Ò·' => 'Ò¶',
  83324. 'Ò¹' => 'Ò¸',
  83325. 'Ò»' => 'Òº',
  83326. 'Ò½' => 'Ò¼',
  83327. 'Ò¿' => 'Ò¾',
  83328. 'Ó‚' => 'Ó�',
  83329. 'Ó„' => 'Óƒ',
  83330. 'Ó†' => 'Ó…',
  83331. 'Óˆ' => 'Ó‡',
  83332. 'ÓŠ' => 'Ó‰',
  83333. 'ӌ' => 'Ӌ',
  83334. 'ÓŽ' => 'Ó�',
  83335. 'Ó�' => 'Ó€',
  83336. 'Ó‘' => 'Ó�',
  83337. 'Ó“' => 'Ó’',
  83338. 'Ó•' => 'Ó”',
  83339. 'Ó—' => 'Ó–',
  83340. 'Ó™' => 'Ó˜',
  83341. 'Ó›' => 'Óš',
  83342. '�' => 'Ӝ',
  83343. 'ÓŸ' => 'Óž',
  83344. 'Ó¡' => 'Ó ',
  83345. 'Ó£' => 'Ó¢',
  83346. 'Ó¥' => 'Ó¤',
  83347. 'Ó§' => 'Ó¦',
  83348. 'Ó©' => 'Ó¨',
  83349. 'Ó«' => 'Óª',
  83350. 'Ó­' => 'Ó¬',
  83351. 'Ó¯' => 'Ó®',
  83352. 'Ó±' => 'Ó°',
  83353. 'Ó³' => 'Ó²',
  83354. 'Óµ' => 'Ó´',
  83355. 'Ó·' => 'Ó¶',
  83356. 'Ó¹' => 'Ó¸',
  83357. 'Ó»' => 'Óº',
  83358. 'Ó½' => 'Ó¼',
  83359. 'Ó¿' => 'Ó¾',
  83360. 'Ô�' => 'Ô€',
  83361. 'Ôƒ' => 'Ô‚',
  83362. 'Ô…' => 'Ô„',
  83363. 'Ô‡' => 'Ô†',
  83364. 'Ô‰' => 'Ôˆ',
  83365. 'Ô‹' => 'ÔŠ',
  83366. '�' => 'Ԍ',
  83367. 'Ô�' => 'ÔŽ',
  83368. 'Ô‘' => 'Ô�',
  83369. 'Ô“' => 'Ô’',
  83370. 'Ô•' => 'Ô”',
  83371. 'Ô—' => 'Ô–',
  83372. 'Ô™' => 'Ô˜',
  83373. 'Ô›' => 'Ôš',
  83374. '�' => 'Ԝ',
  83375. 'ÔŸ' => 'Ôž',
  83376. 'Ô¡' => 'Ô ',
  83377. 'Ô£' => 'Ô¢',
  83378. 'Ô¥' => 'Ô¤',
  83379. 'Ô§' => 'Ô¦',
  83380. 'Ô©' => 'Ô¨',
  83381. 'Ô«' => 'Ôª',
  83382. 'Ô­' => 'Ô¬',
  83383. 'Ô¯' => 'Ô®',
  83384. 'Õ¡' => 'Ô±',
  83385. 'Õ¢' => 'Ô²',
  83386. 'Õ£' => 'Ô³',
  83387. 'Õ¤' => 'Ô´',
  83388. 'Õ¥' => 'Ôµ',
  83389. 'Õ¦' => 'Ô¶',
  83390. 'Õ§' => 'Ô·',
  83391. 'Õ¨' => 'Ô¸',
  83392. 'Õ©' => 'Ô¹',
  83393. 'Õª' => 'Ôº',
  83394. 'Õ«' => 'Ô»',
  83395. 'Õ¬' => 'Ô¼',
  83396. 'Õ­' => 'Ô½',
  83397. 'Õ®' => 'Ô¾',
  83398. 'Õ¯' => 'Ô¿',
  83399. 'Õ°' => 'Õ€',
  83400. 'Õ±' => 'Õ�',
  83401. 'Õ²' => 'Õ‚',
  83402. 'Õ³' => 'Õƒ',
  83403. 'Õ´' => 'Õ„',
  83404. 'Õµ' => 'Õ…',
  83405. 'Õ¶' => 'Õ†',
  83406. 'Õ·' => 'Õ‡',
  83407. 'Õ¸' => 'Õˆ',
  83408. 'Õ¹' => 'Õ‰',
  83409. 'Õº' => 'ÕŠ',
  83410. 'Õ»' => 'Õ‹',
  83411. 'ռ' => 'Ռ',
  83412. 'Õ½' => 'Õ�',
  83413. 'Õ¾' => 'ÕŽ',
  83414. 'Õ¿' => 'Õ�',
  83415. 'Ö€' => 'Õ�',
  83416. 'Ö�' => 'Õ‘',
  83417. 'Ö‚' => 'Õ’',
  83418. 'Öƒ' => 'Õ“',
  83419. 'Ö„' => 'Õ”',
  83420. 'Ö…' => 'Õ•',
  83421. 'Ö†' => 'Õ–',
  83422. '�' => '�',
  83423. 'ბ' => 'Ბ',
  83424. 'გ' => 'Გ',
  83425. 'დ' => 'Დ',
  83426. 'ე' => 'Ე',
  83427. 'ვ' => 'Ვ',
  83428. 'ზ' => 'Ზ',
  83429. 'თ' => 'Თ',
  83430. 'ი' => 'Ი',
  83431. 'კ' => 'Კ',
  83432. 'ლ' => 'Ლ',
  83433. 'მ' => 'Მ',
  83434. 'ნ' => 'Ნ',
  83435. '�' => '�',
  83436. 'პ' => 'Პ',
  83437. 'ჟ' => 'Ჟ',
  83438. 'რ' => 'Რ',
  83439. 'ს' => 'Ს',
  83440. 'ტ' => 'Ტ',
  83441. 'უ' => 'Უ',
  83442. 'ფ' => 'Ფ',
  83443. 'ქ' => 'Ქ',
  83444. 'ღ' => 'Ღ',
  83445. 'ყ' => 'Ყ',
  83446. 'შ' => 'Შ',
  83447. 'ჩ' => 'Ჩ',
  83448. 'ც' => 'Ც',
  83449. 'ძ' => 'Ძ',
  83450. 'წ' => 'Წ',
  83451. 'ჭ' => 'Ჭ',
  83452. 'ხ' => 'Ხ',
  83453. 'ჯ' => 'Ჯ',
  83454. 'ჰ' => 'Ჰ',
  83455. 'ჱ' => 'Ჱ',
  83456. 'ჲ' => 'Ჲ',
  83457. 'ჳ' => 'Ჳ',
  83458. 'ჴ' => 'Ჴ',
  83459. 'ჵ' => 'Ჵ',
  83460. 'ჶ' => 'Ჶ',
  83461. 'ჷ' => 'Ჷ',
  83462. 'ჸ' => 'Ჸ',
  83463. 'ჹ' => 'Ჹ',
  83464. 'ჺ' => 'Ჺ',
  83465. 'ჽ' => 'Ჽ',
  83466. 'ჾ' => 'Ჾ',
  83467. 'ჿ' => 'Ჿ',
  83468. '�' => '�',
  83469. '�' => '�',
  83470. '�' => '�',
  83471. '�' => '�',
  83472. '�' => '�',
  83473. '�' => '�',
  83474. 'á²€' => 'Ð’',
  83475. '�' => 'Д',
  83476. 'ᲂ' => 'О',
  83477. 'ᲃ' => 'С',
  83478. 'ᲄ' => 'Т',
  83479. 'ᲅ' => 'Т',
  83480. 'ᲆ' => 'Ъ',
  83481. 'ᲇ' => 'Ѣ',
  83482. 'ᲈ' => 'Ꙋ',
  83483. 'ᵹ' => '�',
  83484. 'áµ½' => 'â±£',
  83485. 'ᶎ' => 'Ᶎ',
  83486. '�' => 'Ḁ',
  83487. 'ḃ' => 'Ḃ',
  83488. 'ḅ' => 'Ḅ',
  83489. 'ḇ' => 'Ḇ',
  83490. 'ḉ' => 'Ḉ',
  83491. 'ḋ' => 'Ḋ',
  83492. '�' => 'Ḍ',
  83493. '�' => 'Ḏ',
  83494. 'ḑ' => '�',
  83495. 'ḓ' => 'Ḓ',
  83496. 'ḕ' => 'Ḕ',
  83497. 'ḗ' => 'Ḗ',
  83498. 'ḙ' => 'Ḙ',
  83499. 'ḛ' => 'Ḛ',
  83500. '�' => 'Ḝ',
  83501. 'ḟ' => 'Ḟ',
  83502. 'ḡ' => 'Ḡ',
  83503. 'ḣ' => 'Ḣ',
  83504. 'ḥ' => 'Ḥ',
  83505. 'ḧ' => 'Ḧ',
  83506. 'ḩ' => 'Ḩ',
  83507. 'ḫ' => 'Ḫ',
  83508. 'ḭ' => 'Ḭ',
  83509. 'ḯ' => 'Ḯ',
  83510. 'ḱ' => 'Ḱ',
  83511. 'ḳ' => 'Ḳ',
  83512. 'ḵ' => 'Ḵ',
  83513. 'ḷ' => 'Ḷ',
  83514. 'ḹ' => 'Ḹ',
  83515. 'ḻ' => 'Ḻ',
  83516. 'ḽ' => 'Ḽ',
  83517. 'ḿ' => 'Ḿ',
  83518. '�' => 'Ṁ',
  83519. 'ṃ' => 'Ṃ',
  83520. 'ṅ' => 'Ṅ',
  83521. 'ṇ' => 'Ṇ',
  83522. 'ṉ' => 'Ṉ',
  83523. 'ṋ' => 'Ṋ',
  83524. '�' => 'Ṍ',
  83525. '�' => 'Ṏ',
  83526. 'ṑ' => '�',
  83527. 'ṓ' => 'Ṓ',
  83528. 'ṕ' => 'Ṕ',
  83529. 'á¹—' => 'á¹–',
  83530. 'ṙ' => 'Ṙ',
  83531. 'ṛ' => 'Ṛ',
  83532. '�' => 'Ṝ',
  83533. 'ṟ' => 'Ṟ',
  83534. 'ṡ' => 'Ṡ',
  83535. 'á¹£' => 'á¹¢',
  83536. 'ṥ' => 'Ṥ',
  83537. 'ṧ' => 'Ṧ',
  83538. 'ṩ' => 'Ṩ',
  83539. 'ṫ' => 'Ṫ',
  83540. 'ṭ' => 'Ṭ',
  83541. 'ṯ' => 'Ṯ',
  83542. 'á¹±' => 'á¹°',
  83543. 'á¹³' => 'á¹²',
  83544. 'á¹µ' => 'á¹´',
  83545. 'ṷ' => 'Ṷ',
  83546. 'ṹ' => 'Ṹ',
  83547. 'ṻ' => 'Ṻ',
  83548. 'á¹½' => 'á¹¼',
  83549. 'ṿ' => 'Ṿ',
  83550. '�' => 'Ẁ',
  83551. 'ẃ' => 'Ẃ',
  83552. 'ẅ' => 'Ẅ',
  83553. 'ẇ' => 'Ẇ',
  83554. 'ẉ' => 'Ẉ',
  83555. 'ẋ' => 'Ẋ',
  83556. '�' => 'Ẍ',
  83557. '�' => 'Ẏ',
  83558. 'ẑ' => '�',
  83559. 'ẓ' => 'Ẓ',
  83560. 'ẕ' => 'Ẕ',
  83561. 'ẛ' => 'Ṡ',
  83562. 'ạ' => 'Ạ',
  83563. 'ả' => 'Ả',
  83564. 'ấ' => 'Ấ',
  83565. 'ầ' => 'Ầ',
  83566. 'ẩ' => 'Ẩ',
  83567. 'ẫ' => 'Ẫ',
  83568. 'ậ' => 'Ậ',
  83569. 'ắ' => 'Ắ',
  83570. 'ằ' => 'Ằ',
  83571. 'ẳ' => 'Ẳ',
  83572. 'ẵ' => 'Ẵ',
  83573. 'ặ' => 'Ặ',
  83574. 'ẹ' => 'Ẹ',
  83575. 'ẻ' => 'Ẻ',
  83576. 'ẽ' => 'Ẽ',
  83577. 'ế' => 'Ế',
  83578. '�' => 'Ề',
  83579. 'ể' => 'Ể',
  83580. 'ễ' => 'Ễ',
  83581. 'ệ' => 'Ệ',
  83582. 'ỉ' => 'Ỉ',
  83583. 'ị' => 'Ị',
  83584. '�' => 'Ọ',
  83585. '�' => 'Ỏ',
  83586. 'ố' => '�',
  83587. 'ồ' => 'Ồ',
  83588. 'ổ' => 'Ổ',
  83589. 'á»—' => 'á»–',
  83590. 'ộ' => 'Ộ',
  83591. 'ớ' => 'Ớ',
  83592. '�' => 'Ờ',
  83593. 'ở' => 'Ở',
  83594. 'ỡ' => 'Ỡ',
  83595. 'ợ' => 'Ợ',
  83596. 'ụ' => 'Ụ',
  83597. 'ủ' => 'Ủ',
  83598. 'ứ' => 'Ứ',
  83599. 'ừ' => 'Ừ',
  83600. 'ử' => 'Ử',
  83601. 'ữ' => 'Ữ',
  83602. 'á»±' => 'á»°',
  83603. 'ỳ' => 'Ỳ',
  83604. 'ỵ' => 'Ỵ',
  83605. 'ỷ' => 'Ỷ',
  83606. 'ỹ' => 'Ỹ',
  83607. 'ỻ' => 'Ỻ',
  83608. 'ỽ' => 'Ỽ',
  83609. 'ỿ' => 'Ỿ',
  83610. 'ἀ' => 'Ἀ',
  83611. '�' => 'Ἁ',
  83612. 'ἂ' => 'Ἂ',
  83613. 'ἃ' => 'Ἃ',
  83614. 'ἄ' => 'Ἄ',
  83615. 'ἅ' => '�',
  83616. 'ἆ' => 'Ἆ',
  83617. 'ἇ' => '�',
  83618. '�' => 'Ἐ',
  83619. 'ἑ' => 'Ἑ',
  83620. 'ἒ' => 'Ἒ',
  83621. 'ἓ' => 'Ἓ',
  83622. 'ἔ' => 'Ἔ',
  83623. 'ἕ' => '�',
  83624. 'ἠ' => 'Ἠ',
  83625. 'ἡ' => 'Ἡ',
  83626. 'ἢ' => 'Ἢ',
  83627. 'ἣ' => 'Ἣ',
  83628. 'ἤ' => 'Ἤ',
  83629. 'á¼¥' => 'á¼­',
  83630. 'ἦ' => 'Ἦ',
  83631. 'ἧ' => 'Ἧ',
  83632. 'ἰ' => 'Ἰ',
  83633. 'á¼±' => 'á¼¹',
  83634. 'ἲ' => 'Ἲ',
  83635. 'á¼³' => 'á¼»',
  83636. 'á¼´' => 'á¼¼',
  83637. 'á¼µ' => 'á¼½',
  83638. 'ἶ' => 'Ἶ',
  83639. 'ἷ' => 'Ἷ',
  83640. 'ὀ' => 'Ὀ',
  83641. '�' => 'Ὁ',
  83642. 'ὂ' => 'Ὂ',
  83643. 'ὃ' => 'Ὃ',
  83644. 'ὄ' => 'Ὄ',
  83645. 'ὅ' => '�',
  83646. 'ὑ' => 'Ὑ',
  83647. 'ὓ' => 'Ὓ',
  83648. 'ὕ' => '�',
  83649. 'ὗ' => 'Ὗ',
  83650. 'ὠ' => 'Ὠ',
  83651. 'ὡ' => 'Ὡ',
  83652. 'ὢ' => 'Ὢ',
  83653. 'ὣ' => 'Ὣ',
  83654. 'ὤ' => 'Ὤ',
  83655. 'á½¥' => 'á½­',
  83656. 'ὦ' => 'Ὦ',
  83657. 'ὧ' => 'Ὧ',
  83658. 'ὰ' => 'Ὰ',
  83659. 'á½±' => 'á¾»',
  83660. 'ὲ' => 'Ὲ',
  83661. 'έ' => 'Έ',
  83662. 'á½´' => 'á¿Š',
  83663. 'á½µ' => 'á¿‹',
  83664. 'ὶ' => 'Ὶ',
  83665. 'á½·' => 'á¿›',
  83666. 'ὸ' => 'Ὸ',
  83667. 'ό' => 'Ό',
  83668. 'ὺ' => 'Ὺ',
  83669. 'á½»' => 'á¿«',
  83670. 'ὼ' => 'Ὼ',
  83671. 'á½½' => 'á¿»',
  83672. 'ᾀ' => 'ἈΙ',
  83673. '�' => 'ἉΙ',
  83674. 'ᾂ' => 'ἊΙ',
  83675. 'ᾃ' => 'ἋΙ',
  83676. 'ᾄ' => 'ἌΙ',
  83677. 'ᾅ' => '�Ι',
  83678. 'ᾆ' => 'ἎΙ',
  83679. 'ᾇ' => '�Ι',
  83680. '�' => 'ἨΙ',
  83681. 'ᾑ' => 'ἩΙ',
  83682. 'ᾒ' => 'ἪΙ',
  83683. 'ᾓ' => 'ἫΙ',
  83684. 'ᾔ' => 'ἬΙ',
  83685. 'ᾕ' => 'ἭΙ',
  83686. 'ᾖ' => 'ἮΙ',
  83687. 'ᾗ' => 'ἯΙ',
  83688. 'ᾠ' => 'ὨΙ',
  83689. 'ᾡ' => 'ὩΙ',
  83690. 'ᾢ' => 'ὪΙ',
  83691. 'ᾣ' => 'ὫΙ',
  83692. 'ᾤ' => 'ὬΙ',
  83693. 'ᾥ' => 'ὭΙ',
  83694. 'ᾦ' => 'ὮΙ',
  83695. 'ᾧ' => 'ὯΙ',
  83696. 'ᾰ' => 'Ᾰ',
  83697. 'á¾±' => 'á¾¹',
  83698. 'ᾳ' => 'ΑΙ',
  83699. 'ι' => 'Ι',
  83700. 'ῃ' => 'ΗΙ',
  83701. '�' => 'Ῐ',
  83702. 'á¿‘' => 'á¿™',
  83703. 'ῠ' => 'Ῠ',
  83704. 'á¿¡' => 'á¿©',
  83705. 'ῥ' => 'Ῥ',
  83706. 'ῳ' => 'ΩΙ',
  83707. 'ⅎ' => 'Ⅎ',
  83708. 'â…°' => 'â… ',
  83709. 'â…±' => 'â…¡',
  83710. 'â…²' => 'â…¢',
  83711. 'â…³' => 'â…£',
  83712. 'â…´' => 'â…¤',
  83713. 'â…µ' => 'â…¥',
  83714. 'â…¶' => 'â…¦',
  83715. 'â…·' => 'â…§',
  83716. 'â…¸' => 'â…¨',
  83717. 'â…¹' => 'â…©',
  83718. 'â…º' => 'â…ª',
  83719. 'â…»' => 'â…«',
  83720. 'â…¼' => 'â…¬',
  83721. 'â…½' => 'â…­',
  83722. 'â…¾' => 'â…®',
  83723. 'â…¿' => 'â…¯',
  83724. 'ↄ' => 'Ↄ',
  83725. '�' => 'Ⓐ',
  83726. 'â“‘' => 'â’·',
  83727. 'â“’' => 'â’¸',
  83728. 'â““' => 'â’¹',
  83729. 'â“”' => 'â’º',
  83730. 'â“•' => 'â’»',
  83731. 'â“–' => 'â’¼',
  83732. 'â“—' => 'â’½',
  83733. 'ⓘ' => 'Ⓘ',
  83734. 'â“™' => 'â’¿',
  83735. 'â“š' => 'â“€',
  83736. 'ⓛ' => '�',
  83737. 'ⓜ' => 'Ⓜ',
  83738. '�' => 'Ⓝ',
  83739. 'â“ž' => 'â“„',
  83740. 'â“Ÿ' => 'â“…',
  83741. 'ⓠ' => 'Ⓠ',
  83742. 'ⓡ' => 'Ⓡ',
  83743. 'ⓢ' => 'Ⓢ',
  83744. 'ⓣ' => 'Ⓣ',
  83745. 'ⓤ' => 'Ⓤ',
  83746. 'â“¥' => 'â“‹',
  83747. 'ⓦ' => 'Ⓦ',
  83748. 'ⓧ' => '�',
  83749. 'ⓨ' => 'Ⓨ',
  83750. 'ⓩ' => '�',
  83751. 'â°°' => 'â°€',
  83752. 'â°±' => 'â°�',
  83753. 'â°²' => 'â°‚',
  83754. 'â°³' => 'â°ƒ',
  83755. 'â°´' => 'â°„',
  83756. 'â°µ' => 'â°…',
  83757. 'â°¶' => 'â°†',
  83758. 'â°·' => 'â°‡',
  83759. 'â°¸' => 'â°ˆ',
  83760. 'â°¹' => 'â°‰',
  83761. 'â°º' => 'â°Š',
  83762. 'â°»' => 'â°‹',
  83763. 'ⰼ' => 'Ⰼ',
  83764. 'â°½' => 'â°�',
  83765. 'â°¾' => 'â°Ž',
  83766. 'â°¿' => 'â°�',
  83767. 'â±€' => 'â°�',
  83768. '�' => 'Ⱁ',
  83769. 'ⱂ' => 'Ⱂ',
  83770. 'ⱃ' => 'Ⱃ',
  83771. 'ⱄ' => 'Ⱄ',
  83772. 'â±…' => 'â°•',
  83773. 'ⱆ' => 'Ⱆ',
  83774. 'ⱇ' => 'Ⱇ',
  83775. 'ⱈ' => 'Ⱈ',
  83776. 'ⱉ' => 'Ⱉ',
  83777. 'ⱊ' => 'Ⱊ',
  83778. 'ⱋ' => 'Ⱋ',
  83779. 'ⱌ' => 'Ⱌ',
  83780. '�' => '�',
  83781. 'ⱎ' => 'Ⱎ',
  83782. '�' => 'Ⱏ',
  83783. '�' => 'Ⱐ',
  83784. 'ⱑ' => 'Ⱑ',
  83785. 'â±’' => 'â°¢',
  83786. 'ⱓ' => 'Ⱓ',
  83787. 'â±”' => 'â°¤',
  83788. 'ⱕ' => 'Ⱕ',
  83789. 'â±–' => 'â°¦',
  83790. 'â±—' => 'â°§',
  83791. 'ⱘ' => 'Ⱘ',
  83792. 'â±™' => 'â°©',
  83793. 'ⱚ' => 'Ⱚ',
  83794. 'â±›' => 'â°«',
  83795. 'ⱜ' => 'Ⱜ',
  83796. '�' => 'Ⱝ',
  83797. 'ⱞ' => 'Ⱞ',
  83798. 'ⱡ' => 'Ⱡ',
  83799. 'ⱥ' => 'Ⱥ',
  83800. 'ⱦ' => 'Ⱦ',
  83801. 'ⱨ' => 'Ⱨ',
  83802. 'ⱪ' => 'Ⱪ',
  83803. 'ⱬ' => 'Ⱬ',
  83804. 'â±³' => 'â±²',
  83805. 'ⱶ' => 'Ⱶ',
  83806. '�' => 'Ⲁ',
  83807. 'ⲃ' => 'Ⲃ',
  83808. 'ⲅ' => 'Ⲅ',
  83809. 'ⲇ' => 'Ⲇ',
  83810. 'ⲉ' => 'Ⲉ',
  83811. 'ⲋ' => 'Ⲋ',
  83812. '�' => 'Ⲍ',
  83813. '�' => 'Ⲏ',
  83814. 'ⲑ' => '�',
  83815. 'ⲓ' => 'Ⲓ',
  83816. 'ⲕ' => 'Ⲕ',
  83817. 'â²—' => 'â²–',
  83818. 'ⲙ' => 'Ⲙ',
  83819. 'ⲛ' => 'Ⲛ',
  83820. '�' => 'Ⲝ',
  83821. 'ⲟ' => 'Ⲟ',
  83822. 'ⲡ' => 'Ⲡ',
  83823. 'â²£' => 'â²¢',
  83824. 'ⲥ' => 'Ⲥ',
  83825. 'ⲧ' => 'Ⲧ',
  83826. 'ⲩ' => 'Ⲩ',
  83827. 'ⲫ' => 'Ⲫ',
  83828. 'ⲭ' => 'Ⲭ',
  83829. 'ⲯ' => 'Ⲯ',
  83830. 'â²±' => 'â²°',
  83831. 'â²³' => 'â²²',
  83832. 'â²µ' => 'â²´',
  83833. 'ⲷ' => 'Ⲷ',
  83834. 'ⲹ' => 'Ⲹ',
  83835. 'ⲻ' => 'Ⲻ',
  83836. 'â²½' => 'â²¼',
  83837. 'ⲿ' => 'Ⲿ',
  83838. '�' => 'Ⳁ',
  83839. 'ⳃ' => 'Ⳃ',
  83840. 'ⳅ' => 'Ⳅ',
  83841. 'ⳇ' => 'Ⳇ',
  83842. 'ⳉ' => 'Ⳉ',
  83843. 'ⳋ' => 'Ⳋ',
  83844. '�' => 'Ⳍ',
  83845. '�' => 'Ⳏ',
  83846. 'ⳑ' => '�',
  83847. 'ⳓ' => 'Ⳓ',
  83848. 'ⳕ' => 'Ⳕ',
  83849. 'â³—' => 'â³–',
  83850. 'ⳙ' => 'Ⳙ',
  83851. 'ⳛ' => 'Ⳛ',
  83852. '�' => 'Ⳝ',
  83853. 'ⳟ' => 'Ⳟ',
  83854. 'ⳡ' => 'Ⳡ',
  83855. 'â³£' => 'â³¢',
  83856. 'ⳬ' => 'Ⳬ',
  83857. 'â³®' => 'â³­',
  83858. 'â³³' => 'â³²',
  83859. 'â´€' => 'á‚ ',
  83860. 'â´�' => 'á‚¡',
  83861. 'â´‚' => 'á‚¢',
  83862. 'â´ƒ' => 'á‚£',
  83863. 'ⴄ' => 'Ⴄ',
  83864. 'â´…' => 'á‚¥',
  83865. 'ⴆ' => 'Ⴆ',
  83866. 'ⴇ' => 'Ⴇ',
  83867. 'ⴈ' => 'Ⴈ',
  83868. 'â´‰' => 'á‚©',
  83869. 'ⴊ' => 'Ⴊ',
  83870. 'â´‹' => 'á‚«',
  83871. 'ⴌ' => 'Ⴌ',
  83872. 'â´�' => 'á‚­',
  83873. 'â´Ž' => 'á‚®',
  83874. '�' => 'Ⴏ',
  83875. 'â´�' => 'á‚°',
  83876. 'ⴑ' => 'Ⴑ',
  83877. 'ⴒ' => 'Ⴒ',
  83878. 'ⴓ' => 'Ⴓ',
  83879. 'â´”' => 'á‚´',
  83880. 'ⴕ' => 'Ⴕ',
  83881. 'ⴖ' => 'Ⴖ',
  83882. 'â´—' => 'á‚·',
  83883. 'ⴘ' => 'Ⴘ',
  83884. 'ⴙ' => 'Ⴙ',
  83885. 'ⴚ' => 'Ⴚ',
  83886. 'â´›' => 'á‚»',
  83887. 'ⴜ' => 'Ⴜ',
  83888. '�' => 'Ⴝ',
  83889. 'ⴞ' => 'Ⴞ',
  83890. 'â´Ÿ' => 'á‚¿',
  83891. 'ⴠ' => 'Ⴠ',
  83892. 'ⴡ' => '�',
  83893. 'ⴢ' => 'Ⴢ',
  83894. 'ⴣ' => 'Ⴣ',
  83895. 'ⴤ' => 'Ⴤ',
  83896. 'ⴥ' => 'Ⴥ',
  83897. 'ⴧ' => 'Ⴧ',
  83898. 'ⴭ' => '�',
  83899. '�' => 'Ꙁ',
  83900. 'ꙃ' => 'Ꙃ',
  83901. 'ꙅ' => 'Ꙅ',
  83902. 'ꙇ' => 'Ꙇ',
  83903. 'ꙉ' => 'Ꙉ',
  83904. 'ꙋ' => 'Ꙋ',
  83905. '�' => 'Ꙍ',
  83906. '�' => 'Ꙏ',
  83907. 'ꙑ' => '�',
  83908. 'ꙓ' => 'Ꙓ',
  83909. 'ꙕ' => 'Ꙕ',
  83910. 'ê™—' => 'ê™–',
  83911. 'ꙙ' => 'Ꙙ',
  83912. 'ꙛ' => 'Ꙛ',
  83913. '�' => 'Ꙝ',
  83914. 'ꙟ' => 'Ꙟ',
  83915. 'ꙡ' => 'Ꙡ',
  83916. 'ꙣ' => 'Ꙣ',
  83917. 'ꙥ' => 'Ꙥ',
  83918. 'ꙧ' => 'Ꙧ',
  83919. 'ꙩ' => 'Ꙩ',
  83920. 'ꙫ' => 'Ꙫ',
  83921. 'ꙭ' => 'Ꙭ',
  83922. '�' => 'Ꚁ',
  83923. 'ꚃ' => 'Ꚃ',
  83924. 'êš…' => 'êš„',
  83925. 'ꚇ' => 'Ꚇ',
  83926. 'ꚉ' => 'Ꚉ',
  83927. 'ꚋ' => 'Ꚋ',
  83928. '�' => 'Ꚍ',
  83929. '�' => 'Ꚏ',
  83930. 'ꚑ' => '�',
  83931. 'êš“' => 'êš’',
  83932. 'êš•' => 'êš”',
  83933. 'êš—' => 'êš–',
  83934. 'ꚙ' => 'Ꚙ',
  83935. 'êš›' => 'êšš',
  83936. 'ꜣ' => 'Ꜣ',
  83937. 'ꜥ' => 'Ꜥ',
  83938. 'ꜧ' => 'Ꜧ',
  83939. 'ꜩ' => 'Ꜩ',
  83940. 'ꜫ' => 'Ꜫ',
  83941. 'ꜭ' => 'Ꜭ',
  83942. 'ꜯ' => 'Ꜯ',
  83943. 'ꜳ' => 'Ꜳ',
  83944. 'ꜵ' => 'Ꜵ',
  83945. 'ꜷ' => 'Ꜷ',
  83946. 'ꜹ' => 'Ꜹ',
  83947. 'ꜻ' => 'Ꜻ',
  83948. 'ꜽ' => 'Ꜽ',
  83949. 'ꜿ' => 'Ꜿ',
  83950. '�' => '�',
  83951. '�' => '�',
  83952. '�' => '�',
  83953. '�' => '�',
  83954. '�' => '�',
  83955. '�' => '�',
  83956. '�' => '�',
  83957. '�' => '�',
  83958. '�' => '�',
  83959. '�' => '�',
  83960. '�' => '�',
  83961. '�' => '�',
  83962. '�' => '�',
  83963. '�' => '�',
  83964. '�' => '�',
  83965. '�' => '�',
  83966. '�' => '�',
  83967. '�' => '�',
  83968. '�' => '�',
  83969. '�' => '�',
  83970. '�' => '�',
  83971. '�' => '�',
  83972. '�' => '�',
  83973. '�' => '�',
  83974. '�' => '�',
  83975. '�' => '�',
  83976. '�' => '�',
  83977. '�' => 'Ꞁ',
  83978. 'ꞃ' => 'Ꞃ',
  83979. 'êž…' => 'êž„',
  83980. 'ꞇ' => 'Ꞇ',
  83981. 'ꞌ' => 'Ꞌ',
  83982. 'ꞑ' => '�',
  83983. 'êž“' => 'êž’',
  83984. 'ꞔ' => 'Ꞔ',
  83985. 'êž—' => 'êž–',
  83986. 'ꞙ' => 'Ꞙ',
  83987. 'êž›' => 'êžš',
  83988. '�' => 'Ꞝ',
  83989. 'ꞟ' => 'Ꞟ',
  83990. 'êž¡' => 'êž ',
  83991. 'ꞣ' => 'Ꞣ',
  83992. 'ꞥ' => 'Ꞥ',
  83993. 'ꞧ' => 'Ꞧ',
  83994. 'ꞩ' => 'Ꞩ',
  83995. 'êžµ' => 'êž´',
  83996. 'ꞷ' => 'Ꞷ',
  83997. 'ꞹ' => 'Ꞹ',
  83998. 'ꞻ' => 'Ꞻ',
  83999. 'êž½' => 'êž¼',
  84000. 'êž¿' => 'êž¾',
  84001. 'ꟃ' => 'Ꟃ',
  84002. 'ꟈ' => 'Ꟈ',
  84003. 'ꟊ' => 'Ꟊ',
  84004. 'ꟶ' => 'Ꟶ',
  84005. 'ê­“' => 'êž³',
  84006. 'ꭰ' => 'Ꭰ',
  84007. 'ꭱ' => 'Ꭱ',
  84008. 'ꭲ' => 'Ꭲ',
  84009. 'ꭳ' => 'Ꭳ',
  84010. 'ꭴ' => 'Ꭴ',
  84011. 'ꭵ' => 'Ꭵ',
  84012. 'ꭶ' => 'Ꭶ',
  84013. 'ꭷ' => 'Ꭷ',
  84014. 'ꭸ' => 'Ꭸ',
  84015. 'ꭹ' => 'Ꭹ',
  84016. 'ꭺ' => 'Ꭺ',
  84017. 'ꭻ' => 'Ꭻ',
  84018. 'ꭼ' => 'Ꭼ',
  84019. 'ꭽ' => 'Ꭽ',
  84020. 'ꭾ' => 'Ꭾ',
  84021. 'ꭿ' => 'Ꭿ',
  84022. 'ꮀ' => 'Ꮀ',
  84023. '�' => 'Ꮁ',
  84024. 'ꮂ' => 'Ꮂ',
  84025. 'ꮃ' => 'Ꮃ',
  84026. 'ꮄ' => 'Ꮄ',
  84027. 'ꮅ' => 'Ꮅ',
  84028. 'ꮆ' => 'Ꮆ',
  84029. 'ꮇ' => 'Ꮇ',
  84030. 'ꮈ' => 'Ꮈ',
  84031. 'ꮉ' => 'Ꮉ',
  84032. 'ꮊ' => 'Ꮊ',
  84033. 'ꮋ' => 'Ꮋ',
  84034. 'ꮌ' => 'Ꮌ',
  84035. '�' => 'Ꮍ',
  84036. 'ꮎ' => 'Ꮎ',
  84037. '�' => 'Ꮏ',
  84038. '�' => '�',
  84039. 'ꮑ' => '�',
  84040. 'ꮒ' => '�',
  84041. 'ꮓ' => '�',
  84042. 'ꮔ' => '�',
  84043. 'ꮕ' => '�',
  84044. 'ꮖ' => '�',
  84045. 'ꮗ' => '�',
  84046. 'ꮘ' => '�',
  84047. 'ꮙ' => '�',
  84048. 'ꮚ' => '�',
  84049. 'ꮛ' => '�',
  84050. 'ꮜ' => '�',
  84051. '�' => '�',
  84052. 'ꮞ' => '�',
  84053. 'ꮟ' => '�',
  84054. 'ꮠ' => '�',
  84055. 'ꮡ' => '�',
  84056. 'ꮢ' => '�',
  84057. 'ꮣ' => '�',
  84058. 'ꮤ' => '�',
  84059. 'ꮥ' => '�',
  84060. 'ꮦ' => '�',
  84061. 'ꮧ' => '�',
  84062. 'ꮨ' => '�',
  84063. 'ꮩ' => '�',
  84064. 'ꮪ' => '�',
  84065. 'ꮫ' => '�',
  84066. 'ꮬ' => '�',
  84067. 'ꮭ' => '�',
  84068. 'ꮮ' => '�',
  84069. 'ꮯ' => '�',
  84070. 'ꮰ' => '�',
  84071. 'ꮱ' => '�',
  84072. 'ꮲ' => '�',
  84073. 'ꮳ' => '�',
  84074. 'ꮴ' => '�',
  84075. 'ꮵ' => '�',
  84076. 'ꮶ' => '�',
  84077. 'ꮷ' => '�',
  84078. 'ꮸ' => '�',
  84079. 'ꮹ' => '�',
  84080. 'ꮺ' => '�',
  84081. 'ꮻ' => '�',
  84082. 'ꮼ' => '�',
  84083. 'ꮽ' => '�',
  84084. 'ꮾ' => '�',
  84085. 'ꮿ' => '�',
  84086. '�' => 'A',
  84087. 'b' => 'B',
  84088. 'c' => 'C',
  84089. 'd' => 'D',
  84090. 'ï½…' => 'ï¼¥',
  84091. 'f' => 'F',
  84092. 'g' => 'G',
  84093. 'h' => 'H',
  84094. 'i' => 'I',
  84095. 'j' => 'J',
  84096. 'k' => 'K',
  84097. 'l' => 'L',
  84098. '�' => 'M',
  84099. 'n' => 'N',
  84100. '�' => 'O',
  84101. '�' => 'P',
  84102. 'q' => 'Q',
  84103. 'ï½’' => 'ï¼²',
  84104. 's' => 'S',
  84105. 'ï½”' => 'ï¼´',
  84106. 'u' => 'U',
  84107. 'v' => 'V',
  84108. 'ï½—' => 'ï¼·',
  84109. 'x' => 'X',
  84110. 'ï½™' => 'ï¼¹',
  84111. 'z' => 'Z',
  84112. '�' => '�',
  84113. '�' => '�',
  84114. '�' => '�',
  84115. '�' => '�',
  84116. '�' => '�',
  84117. '�' => '�',
  84118. '�' => '�',
  84119. '�' => '�',
  84120. '�' => '�',
  84121. '�' => '�',
  84122. '�' => '�',
  84123. '�' => '�',
  84124. '�' => '�',
  84125. '�' => '�',
  84126. '�' => '�',
  84127. '�' => '�',
  84128. '�' => '�',
  84129. '�' => '�',
  84130. '�' => '�',
  84131. '�' => '�',
  84132. '�' => '�',
  84133. '�' => '�',
  84134. '�' => '�',
  84135. '�' => '�',
  84136. '�' => '�',
  84137. '�' => '�',
  84138. '�' => '�',
  84139. '�' => '�',
  84140. '�' => '�',
  84141. '�' => '�',
  84142. '�' => '�',
  84143. '�' => '�',
  84144. '�' => '�',
  84145. '�' => '�',
  84146. '�' => '�',
  84147. '�' => '�',
  84148. '�' => '�',
  84149. '�' => '�',
  84150. '�' => '�',
  84151. '�' => '�',
  84152. '�' => '�',
  84153. '�' => '�',
  84154. '�' => '�',
  84155. '�' => '�',
  84156. '�' => '�',
  84157. '�' => '�',
  84158. '�' => '�',
  84159. '�' => '�',
  84160. '�' => '�',
  84161. '�' => '�',
  84162. '�' => '�',
  84163. '�' => '�',
  84164. '�' => '�',
  84165. '�' => '�',
  84166. '�' => '�',
  84167. '�' => '�',
  84168. '�' => '�',
  84169. '�' => '�',
  84170. '�' => '�',
  84171. '�' => '�',
  84172. '�' => '�',
  84173. '�' => '�',
  84174. '�' => '�',
  84175. '�' => '�',
  84176. '�' => '�',
  84177. '�' => '�',
  84178. '�' => '�',
  84179. '�' => '�',
  84180. '�' => '�',
  84181. '�' => '�',
  84182. '�' => '�',
  84183. '�' => '�',
  84184. '�' => '�',
  84185. '�' => '�',
  84186. '�' => '�',
  84187. '�' => '�',
  84188. '�' => '�',
  84189. '�' => '�',
  84190. '�' => '�',
  84191. '�' => '�',
  84192. '�' => '�',
  84193. '�' => '�',
  84194. '�' => '�',
  84195. '�' => '�',
  84196. '�' => '�',
  84197. '�' => '�',
  84198. '�' => '�',
  84199. '�' => '�',
  84200. '�' => '�',
  84201. '�' => '�',
  84202. '�' => '�',
  84203. '�' => '�',
  84204. '�' => '�',
  84205. '�' => '�',
  84206. '�' => '�',
  84207. '�' => '�',
  84208. '�' => '�',
  84209. '�' => '�',
  84210. '�' => '�',
  84211. '�' => '�',
  84212. '�' => '�',
  84213. '�' => '�',
  84214. '�' => '�',
  84215. '�' => '�',
  84216. '�' => '�',
  84217. '�' => '�',
  84218. '�' => '�',
  84219. '�' => '�',
  84220. '�' => '�',
  84221. '�' => '�',
  84222. '�' => '�',
  84223. '�' => '�',
  84224. '�' => '�',
  84225. '�' => '�',
  84226. '�' => '�',
  84227. '�' => '�',
  84228. '�' => '�',
  84229. '�' => '�',
  84230. '�' => '�',
  84231. '�' => '�',
  84232. '�' => '�',
  84233. '�' => '�',
  84234. '�' => '�',
  84235. '�' => '�',
  84236. '�' => '�',
  84237. '�' => '�',
  84238. '�' => '�',
  84239. 'ð‘£€' => 'ð‘¢ ',
  84240. '�' => '𑢡',
  84241. '𑣂' => '𑢢',
  84242. '𑣃' => '𑢣',
  84243. '𑣄' => '𑢤',
  84244. 'ð‘£…' => 'ð‘¢¥',
  84245. '𑣆' => '𑢦',
  84246. '𑣇' => '𑢧',
  84247. '𑣈' => '𑢨',
  84248. '𑣉' => '𑢩',
  84249. '𑣊' => '𑢪',
  84250. '𑣋' => '𑢫',
  84251. '𑣌' => '𑢬',
  84252. '�' => '𑢭',
  84253. '𑣎' => '𑢮',
  84254. '�' => '𑢯',
  84255. '�' => '𑢰',
  84256. '𑣑' => '𑢱',
  84257. 'ð‘£’' => 'ð‘¢²',
  84258. '𑣓' => '𑢳',
  84259. 'ð‘£”' => 'ð‘¢´',
  84260. '𑣕' => '𑢵',
  84261. '𑣖' => '𑢶',
  84262. 'ð‘£—' => 'ð‘¢·',
  84263. '𑣘' => '𑢸',
  84264. 'ð‘£™' => 'ð‘¢¹',
  84265. '𑣚' => '𑢺',
  84266. 'ð‘£›' => 'ð‘¢»',
  84267. '𑣜' => '𑢼',
  84268. '�' => '𑢽',
  84269. '𑣞' => '𑢾',
  84270. '𑣟' => '𑢿',
  84271. 'ð–¹ ' => 'ð–¹€',
  84272. '𖹡' => '�',
  84273. '𖹢' => '𖹂',
  84274. '𖹣' => '𖹃',
  84275. '𖹤' => '𖹄',
  84276. 'ð–¹¥' => 'ð–¹…',
  84277. '𖹦' => '𖹆',
  84278. '𖹧' => '𖹇',
  84279. '𖹨' => '𖹈',
  84280. '𖹩' => '𖹉',
  84281. '𖹪' => '𖹊',
  84282. '𖹫' => '𖹋',
  84283. '𖹬' => '𖹌',
  84284. '𖹭' => '�',
  84285. '𖹮' => '𖹎',
  84286. '𖹯' => '�',
  84287. '𖹰' => '�',
  84288. '𖹱' => '𖹑',
  84289. 'ð–¹²' => 'ð–¹’',
  84290. '𖹳' => '𖹓',
  84291. 'ð–¹´' => 'ð–¹”',
  84292. '𖹵' => '𖹕',
  84293. '𖹶' => '𖹖',
  84294. 'ð–¹·' => 'ð–¹—',
  84295. '𖹸' => '𖹘',
  84296. 'ð–¹¹' => 'ð–¹™',
  84297. '𖹺' => '𖹚',
  84298. 'ð–¹»' => 'ð–¹›',
  84299. '𖹼' => '𖹜',
  84300. '𖹽' => '�',
  84301. '𖹾' => '𖹞',
  84302. '𖹿' => '𖹟',
  84303. '𞤢' => '𞤀',
  84304. '𞤣' => '�',
  84305. '𞤤' => '𞤂',
  84306. '𞤥' => '𞤃',
  84307. '𞤦' => '𞤄',
  84308. '𞤧' => '𞤅',
  84309. '𞤨' => '𞤆',
  84310. '𞤩' => '𞤇',
  84311. '𞤪' => '𞤈',
  84312. '𞤫' => '𞤉',
  84313. '𞤬' => '𞤊',
  84314. '𞤭' => '𞤋',
  84315. '𞤮' => '𞤌',
  84316. '𞤯' => '�',
  84317. '𞤰' => '𞤎',
  84318. '𞤱' => '�',
  84319. '𞤲' => '�',
  84320. '𞤳' => '𞤑',
  84321. '𞤴' => '𞤒',
  84322. '𞤵' => '𞤓',
  84323. '𞤶' => '𞤔',
  84324. '𞤷' => '𞤕',
  84325. '𞤸' => '𞤖',
  84326. '𞤹' => '𞤗',
  84327. '𞤺' => '𞤘',
  84328. '𞤻' => '𞤙',
  84329. '𞤼' => '𞤚',
  84330. '𞤽' => '𞤛',
  84331. '𞤾' => '𞤜',
  84332. '𞤿' => '�',
  84333. '𞥀' => '𞤞',
  84334. '�' => '𞤟',
  84335. '𞥂' => '𞤠',
  84336. '𞥃' => '𞤡',
  84337. 'ß' => 'SS',
  84338. 'ff' => 'FF',
  84339. '�' => 'FI',
  84340. 'fl' => 'FL',
  84341. 'ffi' => 'FFI',
  84342. 'ffl' => 'FFL',
  84343. 'ſt' => 'ST',
  84344. 'st' => 'ST',
  84345. 'Ö‡' => 'ÔµÕ’',
  84346. 'ﬓ' => 'ՄՆ',
  84347. 'ﬔ' => 'ՄԵ',
  84348. 'ﬕ' => 'ՄԻ',
  84349. 'ﬖ' => 'ՎՆ',
  84350. 'ﬗ' => 'ՄԽ',
  84351. 'ʼn' => 'ʼN',
  84352. '�' => 'Ϊ�',
  84353. 'ΰ' => 'Ϋ�',
  84354. 'ǰ' => 'J̌',
  84355. 'ẖ' => 'H̱',
  84356. 'ẗ' => 'T̈',
  84357. 'ẘ' => 'W̊',
  84358. 'ẙ' => 'Y̊',
  84359. 'ẚ' => 'Aʾ',
  84360. '�' => 'Υ̓',
  84361. 'ὒ' => 'Υ̓̀',
  84362. 'ὔ' => 'Υ̓�',
  84363. 'ὖ' => 'Υ̓͂',
  84364. 'ᾶ' => 'Α͂',
  84365. 'ῆ' => 'Η͂',
  84366. 'ῒ' => 'Ϊ̀',
  84367. 'ΐ' => 'Ϊ�',
  84368. 'ῖ' => 'Ι͂',
  84369. 'ῗ' => 'Ϊ͂',
  84370. 'ῢ' => 'Ϋ̀',
  84371. 'ΰ' => 'Ϋ�',
  84372. 'ῤ' => 'Ρ̓',
  84373. 'ῦ' => 'Υ͂',
  84374. 'ῧ' => 'Ϋ͂',
  84375. 'ῶ' => 'Ω͂',
  84376. 'ᾈ' => 'ἈΙ',
  84377. 'ᾉ' => 'ἉΙ',
  84378. 'ᾊ' => 'ἊΙ',
  84379. 'ᾋ' => 'ἋΙ',
  84380. 'ᾌ' => 'ἌΙ',
  84381. '�' => '�Ι',
  84382. 'ᾎ' => 'ἎΙ',
  84383. '�' => '�Ι',
  84384. 'ᾘ' => 'ἨΙ',
  84385. 'ᾙ' => 'ἩΙ',
  84386. 'ᾚ' => 'ἪΙ',
  84387. 'ᾛ' => 'ἫΙ',
  84388. 'ᾜ' => 'ἬΙ',
  84389. '�' => 'ἭΙ',
  84390. 'ᾞ' => 'ἮΙ',
  84391. 'ᾟ' => 'ἯΙ',
  84392. 'ᾨ' => 'ὨΙ',
  84393. 'ᾩ' => 'ὩΙ',
  84394. 'ᾪ' => 'ὪΙ',
  84395. 'ᾫ' => 'ὫΙ',
  84396. 'ᾬ' => 'ὬΙ',
  84397. 'ᾭ' => 'ὭΙ',
  84398. 'ᾮ' => 'ὮΙ',
  84399. 'ᾯ' => 'ὯΙ',
  84400. 'ᾼ' => 'ΑΙ',
  84401. 'ῌ' => 'ΗΙ',
  84402. 'ῼ' => 'ΩΙ',
  84403. 'ᾲ' => 'ᾺΙ',
  84404. 'ᾴ' => 'ΆΙ',
  84405. 'ῂ' => 'ῊΙ',
  84406. 'ῄ' => 'ΉΙ',
  84407. 'ῲ' => 'ῺΙ',
  84408. 'ῴ' => '�Ι',
  84409. 'ᾷ' => 'Α͂Ι',
  84410. 'ῇ' => 'Η͂Ι',
  84411. 'ῷ' => 'Ω͂Ι',
  84412. );
  84413. <?php
  84414. use Symfony\Polyfill\Mbstring as p;
  84415. if (\PHP_VERSION_ID >= 80000) {
  84416. return require __DIR__.'/bootstrap80.php';
  84417. }
  84418. if (!function_exists('mb_convert_encoding')) {
  84419. function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); }
  84420. }
  84421. if (!function_exists('mb_decode_mimeheader')) {
  84422. function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); }
  84423. }
  84424. if (!function_exists('mb_encode_mimeheader')) {
  84425. function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); }
  84426. }
  84427. if (!function_exists('mb_decode_numericentity')) {
  84428. function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); }
  84429. }
  84430. if (!function_exists('mb_encode_numericentity')) {
  84431. function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); }
  84432. }
  84433. if (!function_exists('mb_convert_case')) {
  84434. function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); }
  84435. }
  84436. if (!function_exists('mb_internal_encoding')) {
  84437. function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); }
  84438. }
  84439. if (!function_exists('mb_language')) {
  84440. function mb_language($language = null) { return p\Mbstring::mb_language($language); }
  84441. }
  84442. if (!function_exists('mb_list_encodings')) {
  84443. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  84444. }
  84445. if (!function_exists('mb_encoding_aliases')) {
  84446. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  84447. }
  84448. if (!function_exists('mb_check_encoding')) {
  84449. function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); }
  84450. }
  84451. if (!function_exists('mb_detect_encoding')) {
  84452. function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); }
  84453. }
  84454. if (!function_exists('mb_detect_order')) {
  84455. function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); }
  84456. }
  84457. if (!function_exists('mb_parse_str')) {
  84458. function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; }
  84459. }
  84460. if (!function_exists('mb_strlen')) {
  84461. function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); }
  84462. }
  84463. if (!function_exists('mb_strpos')) {
  84464. function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); }
  84465. }
  84466. if (!function_exists('mb_strtolower')) {
  84467. function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); }
  84468. }
  84469. if (!function_exists('mb_strtoupper')) {
  84470. function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); }
  84471. }
  84472. if (!function_exists('mb_substitute_character')) {
  84473. function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); }
  84474. }
  84475. if (!function_exists('mb_substr')) {
  84476. function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); }
  84477. }
  84478. if (!function_exists('mb_stripos')) {
  84479. function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); }
  84480. }
  84481. if (!function_exists('mb_stristr')) {
  84482. function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); }
  84483. }
  84484. if (!function_exists('mb_strrchr')) {
  84485. function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); }
  84486. }
  84487. if (!function_exists('mb_strrichr')) {
  84488. function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); }
  84489. }
  84490. if (!function_exists('mb_strripos')) {
  84491. function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); }
  84492. }
  84493. if (!function_exists('mb_strrpos')) {
  84494. function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); }
  84495. }
  84496. if (!function_exists('mb_strstr')) {
  84497. function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); }
  84498. }
  84499. if (!function_exists('mb_get_info')) {
  84500. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  84501. }
  84502. if (!function_exists('mb_http_output')) {
  84503. function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); }
  84504. }
  84505. if (!function_exists('mb_strwidth')) {
  84506. function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); }
  84507. }
  84508. if (!function_exists('mb_substr_count')) {
  84509. function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); }
  84510. }
  84511. if (!function_exists('mb_output_handler')) {
  84512. function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); }
  84513. }
  84514. if (!function_exists('mb_http_input')) {
  84515. function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); }
  84516. }
  84517. if (!function_exists('mb_convert_variables')) {
  84518. function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); }
  84519. }
  84520. if (!function_exists('mb_ord')) {
  84521. function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); }
  84522. }
  84523. if (!function_exists('mb_chr')) {
  84524. function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); }
  84525. }
  84526. if (!function_exists('mb_scrub')) {
  84527. function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); }
  84528. }
  84529. if (!function_exists('mb_str_split')) {
  84530. function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); }
  84531. }
  84532. if (!function_exists('mb_str_pad')) {
  84533. function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
  84534. }
  84535. if (!function_exists('mb_ucfirst')) {
  84536. function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); }
  84537. }
  84538. if (!function_exists('mb_lcfirst')) {
  84539. function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); }
  84540. }
  84541. if (!function_exists('mb_trim')) {
  84542. function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); }
  84543. }
  84544. if (!function_exists('mb_ltrim')) {
  84545. function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); }
  84546. }
  84547. if (!function_exists('mb_rtrim')) {
  84548. function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); }
  84549. }
  84550. if (extension_loaded('mbstring')) {
  84551. return;
  84552. }
  84553. if (!defined('MB_CASE_UPPER')) {
  84554. define('MB_CASE_UPPER', 0);
  84555. }
  84556. if (!defined('MB_CASE_LOWER')) {
  84557. define('MB_CASE_LOWER', 1);
  84558. }
  84559. if (!defined('MB_CASE_TITLE')) {
  84560. define('MB_CASE_TITLE', 2);
  84561. }
  84562. <?php
  84563. use Symfony\Polyfill\Mbstring as p;
  84564. if (!function_exists('mb_convert_encoding')) {
  84565. function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); }
  84566. }
  84567. if (!function_exists('mb_decode_mimeheader')) {
  84568. function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); }
  84569. }
  84570. if (!function_exists('mb_encode_mimeheader')) {
  84571. function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); }
  84572. }
  84573. if (!function_exists('mb_decode_numericentity')) {
  84574. function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); }
  84575. }
  84576. if (!function_exists('mb_encode_numericentity')) {
  84577. function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); }
  84578. }
  84579. if (!function_exists('mb_convert_case')) {
  84580. function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); }
  84581. }
  84582. if (!function_exists('mb_internal_encoding')) {
  84583. function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); }
  84584. }
  84585. if (!function_exists('mb_language')) {
  84586. function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); }
  84587. }
  84588. if (!function_exists('mb_list_encodings')) {
  84589. function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); }
  84590. }
  84591. if (!function_exists('mb_encoding_aliases')) {
  84592. function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); }
  84593. }
  84594. if (!function_exists('mb_check_encoding')) {
  84595. function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); }
  84596. }
  84597. if (!function_exists('mb_detect_encoding')) {
  84598. function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); }
  84599. }
  84600. if (!function_exists('mb_detect_order')) {
  84601. function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); }
  84602. }
  84603. if (!function_exists('mb_parse_str')) {
  84604. function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; }
  84605. }
  84606. if (!function_exists('mb_strlen')) {
  84607. function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); }
  84608. }
  84609. if (!function_exists('mb_strpos')) {
  84610. function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  84611. }
  84612. if (!function_exists('mb_strtolower')) {
  84613. function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); }
  84614. }
  84615. if (!function_exists('mb_strtoupper')) {
  84616. function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); }
  84617. }
  84618. if (!function_exists('mb_substitute_character')) {
  84619. function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); }
  84620. }
  84621. if (!function_exists('mb_substr')) {
  84622. function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); }
  84623. }
  84624. if (!function_exists('mb_stripos')) {
  84625. function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  84626. }
  84627. if (!function_exists('mb_stristr')) {
  84628. function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  84629. }
  84630. if (!function_exists('mb_strrchr')) {
  84631. function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  84632. }
  84633. if (!function_exists('mb_strrichr')) {
  84634. function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  84635. }
  84636. if (!function_exists('mb_strripos')) {
  84637. function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  84638. }
  84639. if (!function_exists('mb_strrpos')) {
  84640. function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
  84641. }
  84642. if (!function_exists('mb_strstr')) {
  84643. function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); }
  84644. }
  84645. if (!function_exists('mb_get_info')) {
  84646. function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); }
  84647. }
  84648. if (!function_exists('mb_http_output')) {
  84649. function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); }
  84650. }
  84651. if (!function_exists('mb_strwidth')) {
  84652. function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); }
  84653. }
  84654. if (!function_exists('mb_substr_count')) {
  84655. function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); }
  84656. }
  84657. if (!function_exists('mb_output_handler')) {
  84658. function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); }
  84659. }
  84660. if (!function_exists('mb_http_input')) {
  84661. function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); }
  84662. }
  84663. if (!function_exists('mb_convert_variables')) {
  84664. function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); }
  84665. }
  84666. if (!function_exists('mb_ord')) {
  84667. function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); }
  84668. }
  84669. if (!function_exists('mb_chr')) {
  84670. function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); }
  84671. }
  84672. if (!function_exists('mb_scrub')) {
  84673. function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); }
  84674. }
  84675. if (!function_exists('mb_str_split')) {
  84676. function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); }
  84677. }
  84678. if (!function_exists('mb_str_pad')) {
  84679. function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); }
  84680. }
  84681. if (!function_exists('mb_ucfirst')) {
  84682. function mb_ucfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); }
  84683. }
  84684. if (!function_exists('mb_lcfirst')) {
  84685. function mb_lcfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); }
  84686. }
  84687. if (!function_exists('mb_trim')) {
  84688. function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); }
  84689. }
  84690. if (!function_exists('mb_ltrim')) {
  84691. function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); }
  84692. }
  84693. if (!function_exists('mb_rtrim')) {
  84694. function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); }
  84695. }
  84696. if (extension_loaded('mbstring')) {
  84697. return;
  84698. }
  84699. if (!defined('MB_CASE_UPPER')) {
  84700. define('MB_CASE_UPPER', 0);
  84701. }
  84702. if (!defined('MB_CASE_LOWER')) {
  84703. define('MB_CASE_LOWER', 1);
  84704. }
  84705. if (!defined('MB_CASE_TITLE')) {
  84706. define('MB_CASE_TITLE', 2);
  84707. }
  84708. Copyright (c) 2018-present Fabien Potencier
  84709. Permission is hereby granted, free of charge, to any person obtaining a copy
  84710. of this software and associated documentation files (the "Software"), to deal
  84711. in the Software without restriction, including without limitation the rights
  84712. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  84713. copies of the Software, and to permit persons to whom the Software is furnished
  84714. to do so, subject to the following conditions:
  84715. The above copyright notice and this permission notice shall be included in all
  84716. copies or substantial portions of the Software.
  84717. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  84718. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  84719. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  84720. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  84721. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  84722. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  84723. THE SOFTWARE.
  84724. <?php
  84725. namespace Symfony\Polyfill\Php73;
  84726. final class Php73
  84727. {
  84728. public static $startAt = 1533462603;
  84729. public static function hrtime($asNum = false)
  84730. {
  84731. $ns = microtime(false);
  84732. $s = substr($ns, 11) - self::$startAt;
  84733. $ns = 1E9 * (float) $ns;
  84734. if ($asNum) {
  84735. $ns += $s * 1E9;
  84736. return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
  84737. }
  84738. return [$s, (int) $ns];
  84739. }
  84740. }
  84741. <?php
  84742. if (\PHP_VERSION_ID < 70300) {
  84743. class JsonException extends Exception
  84744. {
  84745. }
  84746. }
  84747. <?php
  84748. use Symfony\Polyfill\Php73 as p;
  84749. if (\PHP_VERSION_ID >= 70300) {
  84750. return;
  84751. }
  84752. if (!function_exists('is_countable')) {
  84753. function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; }
  84754. }
  84755. if (!function_exists('hrtime')) {
  84756. require_once __DIR__.'/Php73.php';
  84757. p\Php73::$startAt = (int) microtime(true);
  84758. function hrtime($as_number = false) { return p\Php73::hrtime($as_number); }
  84759. }
  84760. if (!function_exists('array_key_first')) {
  84761. function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } }
  84762. }
  84763. if (!function_exists('array_key_last')) {
  84764. function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); }
  84765. }
  84766. Copyright (c) 2020-present Fabien Potencier
  84767. Permission is hereby granted, free of charge, to any person obtaining a copy
  84768. of this software and associated documentation files (the "Software"), to deal
  84769. in the Software without restriction, including without limitation the rights
  84770. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  84771. copies of the Software, and to permit persons to whom the Software is furnished
  84772. to do so, subject to the following conditions:
  84773. The above copyright notice and this permission notice shall be included in all
  84774. copies or substantial portions of the Software.
  84775. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  84776. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  84777. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  84778. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  84779. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  84780. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  84781. THE SOFTWARE.
  84782. <?php
  84783. namespace Symfony\Polyfill\Php80;
  84784. final class Php80
  84785. {
  84786. public static function fdiv(float $dividend, float $divisor): float
  84787. {
  84788. return @($dividend / $divisor);
  84789. }
  84790. public static function get_debug_type($value): string
  84791. {
  84792. switch (true) {
  84793. case null === $value: return 'null';
  84794. case \is_bool($value): return 'bool';
  84795. case \is_string($value): return 'string';
  84796. case \is_array($value): return 'array';
  84797. case \is_int($value): return 'int';
  84798. case \is_float($value): return 'float';
  84799. case \is_object($value): break;
  84800. case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
  84801. default:
  84802. if (null === $type = @get_resource_type($value)) {
  84803. return 'unknown';
  84804. }
  84805. if ('Unknown' === $type) {
  84806. $type = 'closed';
  84807. }
  84808. return "resource ($type)";
  84809. }
  84810. $class = \get_class($value);
  84811. if (false === strpos($class, '@')) {
  84812. return $class;
  84813. }
  84814. return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
  84815. }
  84816. public static function get_resource_id($res): int
  84817. {
  84818. if (!\is_resource($res) && null === @get_resource_type($res)) {
  84819. throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
  84820. }
  84821. return (int) $res;
  84822. }
  84823. public static function preg_last_error_msg(): string
  84824. {
  84825. switch (preg_last_error()) {
  84826. case \PREG_INTERNAL_ERROR:
  84827. return 'Internal error';
  84828. case \PREG_BAD_UTF8_ERROR:
  84829. return 'Malformed UTF-8 characters, possibly incorrectly encoded';
  84830. case \PREG_BAD_UTF8_OFFSET_ERROR:
  84831. return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
  84832. case \PREG_BACKTRACK_LIMIT_ERROR:
  84833. return 'Backtrack limit exhausted';
  84834. case \PREG_RECURSION_LIMIT_ERROR:
  84835. return 'Recursion limit exhausted';
  84836. case \PREG_JIT_STACKLIMIT_ERROR:
  84837. return 'JIT stack limit exhausted';
  84838. case \PREG_NO_ERROR:
  84839. return 'No error';
  84840. default:
  84841. return 'Unknown error';
  84842. }
  84843. }
  84844. public static function str_contains(string $haystack, string $needle): bool
  84845. {
  84846. return '' === $needle || false !== strpos($haystack, $needle);
  84847. }
  84848. public static function str_starts_with(string $haystack, string $needle): bool
  84849. {
  84850. return 0 === strncmp($haystack, $needle, \strlen($needle));
  84851. }
  84852. public static function str_ends_with(string $haystack, string $needle): bool
  84853. {
  84854. if ('' === $needle || $needle === $haystack) {
  84855. return true;
  84856. }
  84857. if ('' === $haystack) {
  84858. return false;
  84859. }
  84860. $needleLength = \strlen($needle);
  84861. return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
  84862. }
  84863. }
  84864. <?php
  84865. namespace Symfony\Polyfill\Php80;
  84866. class PhpToken implements \Stringable
  84867. {
  84868. public $id;
  84869. public $text;
  84870. public $line;
  84871. public $pos;
  84872. public function __construct(int $id, string $text, int $line = -1, int $position = -1)
  84873. {
  84874. $this->id = $id;
  84875. $this->text = $text;
  84876. $this->line = $line;
  84877. $this->pos = $position;
  84878. }
  84879. public function getTokenName(): ?string
  84880. {
  84881. if ('UNKNOWN' === $name = token_name($this->id)) {
  84882. $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
  84883. }
  84884. return $name;
  84885. }
  84886. public function is($kind): bool
  84887. {
  84888. foreach ((array) $kind as $value) {
  84889. if (\in_array($value, [$this->id, $this->text], true)) {
  84890. return true;
  84891. }
  84892. }
  84893. return false;
  84894. }
  84895. public function isIgnorable(): bool
  84896. {
  84897. return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true);
  84898. }
  84899. public function __toString(): string
  84900. {
  84901. return (string) $this->text;
  84902. }
  84903. public static function tokenize(string $code, int $flags = 0): array
  84904. {
  84905. $line = 1;
  84906. $position = 0;
  84907. $tokens = token_get_all($code, $flags);
  84908. foreach ($tokens as $index => $token) {
  84909. if (\is_string($token)) {
  84910. $id = \ord($token);
  84911. $text = $token;
  84912. } else {
  84913. [$id, $text, $line] = $token;
  84914. }
  84915. $tokens[$index] = new static($id, $text, $line, $position);
  84916. $position += \strlen($text);
  84917. }
  84918. return $tokens;
  84919. }
  84920. }
  84921. <?php
  84922. #[Attribute(Attribute::TARGET_CLASS)]
  84923. final class Attribute
  84924. {
  84925. public const TARGET_CLASS = 1;
  84926. public const TARGET_FUNCTION = 2;
  84927. public const TARGET_METHOD = 4;
  84928. public const TARGET_PROPERTY = 8;
  84929. public const TARGET_CLASS_CONSTANT = 16;
  84930. public const TARGET_PARAMETER = 32;
  84931. public const TARGET_ALL = 63;
  84932. public const IS_REPEATABLE = 64;
  84933. public $flags;
  84934. public function __construct(int $flags = self::TARGET_ALL)
  84935. {
  84936. $this->flags = $flags;
  84937. }
  84938. }
  84939. <?php
  84940. if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) {
  84941. class PhpToken extends Symfony\Polyfill\Php80\PhpToken
  84942. {
  84943. }
  84944. }
  84945. <?php
  84946. if (\PHP_VERSION_ID < 80000) {
  84947. interface Stringable
  84948. {
  84949. public function __toString();
  84950. }
  84951. }
  84952. <?php
  84953. if (\PHP_VERSION_ID < 80000) {
  84954. class UnhandledMatchError extends Error
  84955. {
  84956. }
  84957. }
  84958. <?php
  84959. if (\PHP_VERSION_ID < 80000) {
  84960. class ValueError extends Error
  84961. {
  84962. }
  84963. }
  84964. <?php
  84965. use Symfony\Polyfill\Php80 as p;
  84966. if (\PHP_VERSION_ID >= 80000) {
  84967. return;
  84968. }
  84969. if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
  84970. define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
  84971. }
  84972. if (!function_exists('fdiv')) {
  84973. function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
  84974. }
  84975. if (!function_exists('preg_last_error_msg')) {
  84976. function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
  84977. }
  84978. if (!function_exists('str_contains')) {
  84979. function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
  84980. }
  84981. if (!function_exists('str_starts_with')) {
  84982. function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
  84983. }
  84984. if (!function_exists('str_ends_with')) {
  84985. function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
  84986. }
  84987. if (!function_exists('get_debug_type')) {
  84988. function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
  84989. }
  84990. if (!function_exists('get_resource_id')) {
  84991. function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
  84992. }
  84993. Copyright (c) 2021-present Fabien Potencier
  84994. Permission is hereby granted, free of charge, to any person obtaining a copy
  84995. of this software and associated documentation files (the "Software"), to deal
  84996. in the Software without restriction, including without limitation the rights
  84997. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  84998. copies of the Software, and to permit persons to whom the Software is furnished
  84999. to do so, subject to the following conditions:
  85000. The above copyright notice and this permission notice shall be included in all
  85001. copies or substantial portions of the Software.
  85002. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  85003. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  85004. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  85005. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  85006. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  85007. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  85008. THE SOFTWARE.
  85009. <?php
  85010. namespace Symfony\Polyfill\Php81;
  85011. final class Php81
  85012. {
  85013. public static function array_is_list(array $array): bool
  85014. {
  85015. if ([] === $array || $array === array_values($array)) {
  85016. return true;
  85017. }
  85018. $nextKey = -1;
  85019. foreach ($array as $k => $v) {
  85020. if ($k !== ++$nextKey) {
  85021. return false;
  85022. }
  85023. }
  85024. return true;
  85025. }
  85026. }
  85027. <?php
  85028. if (\PHP_VERSION_ID >= 70400 && extension_loaded('curl')) {
  85029. class CURLStringFile extends CURLFile
  85030. {
  85031. private $data;
  85032. public function __construct(string $data, string $postname, string $mime = 'application/octet-stream')
  85033. {
  85034. $this->data = $data;
  85035. parent::__construct('data://application/octet-stream;base64,'.base64_encode($data), $mime, $postname);
  85036. }
  85037. public function __set(string $name, $value): void
  85038. {
  85039. if ('data' !== $name) {
  85040. $this->$name = $value;
  85041. return;
  85042. }
  85043. if (is_object($value) ? !method_exists($value, '__toString') : !is_scalar($value)) {
  85044. throw new TypeError('Cannot assign '.gettype($value).' to property CURLStringFile::$data of type string');
  85045. }
  85046. $this->name = 'data://application/octet-stream;base64,'.base64_encode($value);
  85047. }
  85048. public function __isset(string $name): bool
  85049. {
  85050. return isset($this->$name);
  85051. }
  85052. public function &__get(string $name)
  85053. {
  85054. return $this->$name;
  85055. }
  85056. }
  85057. }
  85058. <?php
  85059. if (\PHP_VERSION_ID < 80100) {
  85060. #[Attribute(Attribute::TARGET_METHOD)]
  85061. final class ReturnTypeWillChange
  85062. {
  85063. public function __construct()
  85064. {
  85065. }
  85066. }
  85067. }
  85068. <?php
  85069. use Symfony\Polyfill\Php81 as p;
  85070. if (\PHP_VERSION_ID >= 80100) {
  85071. return;
  85072. }
  85073. if (defined('MYSQLI_REFRESH_SLAVE') && !defined('MYSQLI_REFRESH_REPLICA')) {
  85074. define('MYSQLI_REFRESH_REPLICA', 64);
  85075. }
  85076. if (!function_exists('array_is_list')) {
  85077. function array_is_list(array $array): bool { return p\Php81::array_is_list($array); }
  85078. }
  85079. if (!function_exists('enum_exists')) {
  85080. function enum_exists(string $enum, bool $autoload = true): bool { return $autoload && class_exists($enum) && false; }
  85081. }
  85082. <?php
  85083. namespace Symfony\Component\Process\Exception;
  85084. interface ExceptionInterface extends \Throwable
  85085. {
  85086. }
  85087. <?php
  85088. namespace Symfony\Component\Process\Exception;
  85089. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  85090. {
  85091. }
  85092. <?php
  85093. namespace Symfony\Component\Process\Exception;
  85094. class LogicException extends \LogicException implements ExceptionInterface
  85095. {
  85096. }
  85097. <?php
  85098. namespace Symfony\Component\Process\Exception;
  85099. use Symfony\Component\Process\Process;
  85100. class ProcessFailedException extends RuntimeException
  85101. {
  85102. private $process;
  85103. public function __construct(Process $process)
  85104. {
  85105. if ($process->isSuccessful()) {
  85106. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  85107. }
  85108. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  85109. $process->getCommandLine(),
  85110. $process->getExitCode(),
  85111. $process->getExitCodeText(),
  85112. $process->getWorkingDirectory()
  85113. );
  85114. if (!$process->isOutputDisabled()) {
  85115. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  85116. $process->getOutput(),
  85117. $process->getErrorOutput()
  85118. );
  85119. }
  85120. parent::__construct($error);
  85121. $this->process = $process;
  85122. }
  85123. public function getProcess()
  85124. {
  85125. return $this->process;
  85126. }
  85127. }
  85128. <?php
  85129. namespace Symfony\Component\Process\Exception;
  85130. use Symfony\Component\Process\Process;
  85131. final class ProcessSignaledException extends RuntimeException
  85132. {
  85133. private $process;
  85134. public function __construct(Process $process)
  85135. {
  85136. $this->process = $process;
  85137. parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
  85138. }
  85139. public function getProcess(): Process
  85140. {
  85141. return $this->process;
  85142. }
  85143. public function getSignal(): int
  85144. {
  85145. return $this->getProcess()->getTermSignal();
  85146. }
  85147. }
  85148. <?php
  85149. namespace Symfony\Component\Process\Exception;
  85150. use Symfony\Component\Process\Process;
  85151. class ProcessTimedOutException extends RuntimeException
  85152. {
  85153. public const TYPE_GENERAL = 1;
  85154. public const TYPE_IDLE = 2;
  85155. private $process;
  85156. private $timeoutType;
  85157. public function __construct(Process $process, int $timeoutType)
  85158. {
  85159. $this->process = $process;
  85160. $this->timeoutType = $timeoutType;
  85161. parent::__construct(sprintf(
  85162. 'The process "%s" exceeded the timeout of %s seconds.',
  85163. $process->getCommandLine(),
  85164. $this->getExceededTimeout()
  85165. ));
  85166. }
  85167. public function getProcess()
  85168. {
  85169. return $this->process;
  85170. }
  85171. public function isGeneralTimeout()
  85172. {
  85173. return self::TYPE_GENERAL === $this->timeoutType;
  85174. }
  85175. public function isIdleTimeout()
  85176. {
  85177. return self::TYPE_IDLE === $this->timeoutType;
  85178. }
  85179. public function getExceededTimeout()
  85180. {
  85181. switch ($this->timeoutType) {
  85182. case self::TYPE_GENERAL:
  85183. return $this->process->getTimeout();
  85184. case self::TYPE_IDLE:
  85185. return $this->process->getIdleTimeout();
  85186. default:
  85187. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  85188. }
  85189. }
  85190. }
  85191. <?php
  85192. namespace Symfony\Component\Process\Exception;
  85193. class RuntimeException extends \RuntimeException implements ExceptionInterface
  85194. {
  85195. }
  85196. <?php
  85197. namespace Symfony\Component\Process;
  85198. class ExecutableFinder
  85199. {
  85200. private const CMD_BUILTINS = [
  85201. 'assoc', 'break', 'call', 'cd', 'chdir', 'cls', 'color', 'copy', 'date',
  85202. 'del', 'dir', 'echo', 'endlocal', 'erase', 'exit', 'for', 'ftype', 'goto',
  85203. 'help', 'if', 'label', 'md', 'mkdir', 'mklink', 'move', 'path', 'pause',
  85204. 'popd', 'prompt', 'pushd', 'rd', 'rem', 'ren', 'rename', 'rmdir', 'set',
  85205. 'setlocal', 'shift', 'start', 'time', 'title', 'type', 'ver', 'vol',
  85206. ];
  85207. private $suffixes = [];
  85208. public function setSuffixes(array $suffixes)
  85209. {
  85210. $this->suffixes = $suffixes;
  85211. }
  85212. public function addSuffix(string $suffix)
  85213. {
  85214. $this->suffixes[] = $suffix;
  85215. }
  85216. public function find(string $name, ?string $default = null, array $extraDirs = [])
  85217. {
  85218. if ('\\' === \DIRECTORY_SEPARATOR && \in_array(strtolower($name), self::CMD_BUILTINS, true)) {
  85219. return $name;
  85220. }
  85221. $dirs = array_merge(
  85222. explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  85223. $extraDirs
  85224. );
  85225. $suffixes = [];
  85226. if ('\\' === \DIRECTORY_SEPARATOR) {
  85227. $pathExt = getenv('PATHEXT');
  85228. $suffixes = $this->suffixes;
  85229. $suffixes = array_merge($suffixes, $pathExt ? explode(\PATH_SEPARATOR, $pathExt) : ['.exe', '.bat', '.cmd', '.com']);
  85230. }
  85231. $suffixes = '' !== pathinfo($name, PATHINFO_EXTENSION) ? array_merge([''], $suffixes) : array_merge($suffixes, ['']);
  85232. foreach ($suffixes as $suffix) {
  85233. foreach ($dirs as $dir) {
  85234. if ('' === $dir) {
  85235. $dir = '.';
  85236. }
  85237. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  85238. return $file;
  85239. }
  85240. if (!@is_dir($dir) && basename($dir) === $name.$suffix && @is_executable($dir)) {
  85241. return $dir;
  85242. }
  85243. }
  85244. }
  85245. if ('\\' === \DIRECTORY_SEPARATOR || !\function_exists('exec') || \strlen($name) !== strcspn($name, '/'.\DIRECTORY_SEPARATOR)) {
  85246. return $default;
  85247. }
  85248. $execResult = exec('command -v -- '.escapeshellarg($name));
  85249. if (($executablePath = substr($execResult, 0, strpos($execResult, \PHP_EOL) ?: null)) && @is_executable($executablePath)) {
  85250. return $executablePath;
  85251. }
  85252. return $default;
  85253. }
  85254. }
  85255. <?php
  85256. namespace Symfony\Component\Process;
  85257. use Symfony\Component\Process\Exception\RuntimeException;
  85258. class InputStream implements \IteratorAggregate
  85259. {
  85260. private $onEmpty = null;
  85261. private $input = [];
  85262. private $open = true;
  85263. public function onEmpty(?callable $onEmpty = null)
  85264. {
  85265. $this->onEmpty = $onEmpty;
  85266. }
  85267. public function write($input)
  85268. {
  85269. if (null === $input) {
  85270. return;
  85271. }
  85272. if ($this->isClosed()) {
  85273. throw new RuntimeException(sprintf('"%s" is closed.', static::class));
  85274. }
  85275. $this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
  85276. }
  85277. public function close()
  85278. {
  85279. $this->open = false;
  85280. }
  85281. public function isClosed()
  85282. {
  85283. return !$this->open;
  85284. }
  85285. #[\ReturnTypeWillChange]
  85286. public function getIterator()
  85287. {
  85288. $this->open = true;
  85289. while ($this->open || $this->input) {
  85290. if (!$this->input) {
  85291. yield '';
  85292. continue;
  85293. }
  85294. $current = array_shift($this->input);
  85295. if ($current instanceof \Iterator) {
  85296. yield from $current;
  85297. } else {
  85298. yield $current;
  85299. }
  85300. if (!$this->input && $this->open && null !== $onEmpty = $this->onEmpty) {
  85301. $this->write($onEmpty($this));
  85302. }
  85303. }
  85304. }
  85305. }
  85306. Copyright (c) 2004-present Fabien Potencier
  85307. Permission is hereby granted, free of charge, to any person obtaining a copy
  85308. of this software and associated documentation files (the "Software"), to deal
  85309. in the Software without restriction, including without limitation the rights
  85310. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  85311. copies of the Software, and to permit persons to whom the Software is furnished
  85312. to do so, subject to the following conditions:
  85313. The above copyright notice and this permission notice shall be included in all
  85314. copies or substantial portions of the Software.
  85315. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  85316. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  85317. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  85318. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  85319. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  85320. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  85321. THE SOFTWARE.
  85322. <?php
  85323. namespace Symfony\Component\Process;
  85324. class PhpExecutableFinder
  85325. {
  85326. private $executableFinder;
  85327. public function __construct()
  85328. {
  85329. $this->executableFinder = new ExecutableFinder();
  85330. }
  85331. public function find(bool $includeArgs = true)
  85332. {
  85333. if ($php = getenv('PHP_BINARY')) {
  85334. if (!is_executable($php) && !$php = $this->executableFinder->find($php)) {
  85335. return false;
  85336. }
  85337. if (@is_dir($php)) {
  85338. return false;
  85339. }
  85340. return $php;
  85341. }
  85342. $args = $this->findArguments();
  85343. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  85344. if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) {
  85345. return \PHP_BINARY.$args;
  85346. }
  85347. if ($php = getenv('PHP_PATH')) {
  85348. if (!@is_executable($php) || @is_dir($php)) {
  85349. return false;
  85350. }
  85351. return $php;
  85352. }
  85353. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  85354. if (@is_executable($php) && !@is_dir($php)) {
  85355. return $php;
  85356. }
  85357. }
  85358. if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php')) && !@is_dir($php)) {
  85359. return $php;
  85360. }
  85361. $dirs = [\PHP_BINDIR];
  85362. if ('\\' === \DIRECTORY_SEPARATOR) {
  85363. $dirs[] = 'C:\xampp\php\\';
  85364. }
  85365. return $this->executableFinder->find('php', false, $dirs);
  85366. }
  85367. public function findArguments()
  85368. {
  85369. $arguments = [];
  85370. if ('phpdbg' === \PHP_SAPI) {
  85371. $arguments[] = '-qrr';
  85372. }
  85373. return $arguments;
  85374. }
  85375. }
  85376. <?php
  85377. namespace Symfony\Component\Process;
  85378. use Symfony\Component\Process\Exception\LogicException;
  85379. use Symfony\Component\Process\Exception\RuntimeException;
  85380. class PhpProcess extends Process
  85381. {
  85382. public function __construct(string $script, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)
  85383. {
  85384. if (null === $php) {
  85385. $executableFinder = new PhpExecutableFinder();
  85386. $php = $executableFinder->find(false);
  85387. $php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
  85388. }
  85389. if ('phpdbg' === \PHP_SAPI) {
  85390. $file = tempnam(sys_get_temp_dir(), 'dbg');
  85391. file_put_contents($file, $script);
  85392. register_shutdown_function('unlink', $file);
  85393. $php[] = $file;
  85394. $script = null;
  85395. }
  85396. parent::__construct($php, $cwd, $env, $script, $timeout);
  85397. }
  85398. public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
  85399. {
  85400. throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
  85401. }
  85402. public function start(?callable $callback = null, array $env = [])
  85403. {
  85404. if (null === $this->getCommandLine()) {
  85405. throw new RuntimeException('Unable to find the PHP executable.');
  85406. }
  85407. parent::start($callback, $env);
  85408. }
  85409. }
  85410. <?php
  85411. namespace Symfony\Component\Process\Pipes;
  85412. use Symfony\Component\Process\Exception\InvalidArgumentException;
  85413. abstract class AbstractPipes implements PipesInterface
  85414. {
  85415. public $pipes = [];
  85416. private $inputBuffer = '';
  85417. private $input;
  85418. private $blocked = true;
  85419. private $lastError;
  85420. public function __construct($input)
  85421. {
  85422. if (\is_resource($input) || $input instanceof \Iterator) {
  85423. $this->input = $input;
  85424. } elseif (\is_string($input)) {
  85425. $this->inputBuffer = $input;
  85426. } else {
  85427. $this->inputBuffer = (string) $input;
  85428. }
  85429. }
  85430. public function close()
  85431. {
  85432. foreach ($this->pipes as $pipe) {
  85433. if (\is_resource($pipe)) {
  85434. fclose($pipe);
  85435. }
  85436. }
  85437. $this->pipes = [];
  85438. }
  85439. protected function hasSystemCallBeenInterrupted(): bool
  85440. {
  85441. $lastError = $this->lastError;
  85442. $this->lastError = null;
  85443. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  85444. }
  85445. protected function unblock()
  85446. {
  85447. if (!$this->blocked) {
  85448. return;
  85449. }
  85450. foreach ($this->pipes as $pipe) {
  85451. stream_set_blocking($pipe, 0);
  85452. }
  85453. if (\is_resource($this->input)) {
  85454. stream_set_blocking($this->input, 0);
  85455. }
  85456. $this->blocked = false;
  85457. }
  85458. protected function write(): ?array
  85459. {
  85460. if (!isset($this->pipes[0])) {
  85461. return null;
  85462. }
  85463. $input = $this->input;
  85464. if ($input instanceof \Iterator) {
  85465. if (!$input->valid()) {
  85466. $input = null;
  85467. } elseif (\is_resource($input = $input->current())) {
  85468. stream_set_blocking($input, 0);
  85469. } elseif (!isset($this->inputBuffer[0])) {
  85470. if (!\is_string($input)) {
  85471. if (!\is_scalar($input)) {
  85472. throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
  85473. }
  85474. $input = (string) $input;
  85475. }
  85476. $this->inputBuffer = $input;
  85477. $this->input->next();
  85478. $input = null;
  85479. } else {
  85480. $input = null;
  85481. }
  85482. }
  85483. $r = $e = [];
  85484. $w = [$this->pipes[0]];
  85485. if (false === @stream_select($r, $w, $e, 0, 0)) {
  85486. return null;
  85487. }
  85488. foreach ($w as $stdin) {
  85489. if (isset($this->inputBuffer[0])) {
  85490. $written = fwrite($stdin, $this->inputBuffer);
  85491. $this->inputBuffer = substr($this->inputBuffer, $written);
  85492. if (isset($this->inputBuffer[0])) {
  85493. return [$this->pipes[0]];
  85494. }
  85495. }
  85496. if ($input) {
  85497. while (true) {
  85498. $data = fread($input, self::CHUNK_SIZE);
  85499. if (!isset($data[0])) {
  85500. break;
  85501. }
  85502. $written = fwrite($stdin, $data);
  85503. $data = substr($data, $written);
  85504. if (isset($data[0])) {
  85505. $this->inputBuffer = $data;
  85506. return [$this->pipes[0]];
  85507. }
  85508. }
  85509. if (feof($input)) {
  85510. if ($this->input instanceof \Iterator) {
  85511. $this->input->next();
  85512. } else {
  85513. $this->input = null;
  85514. }
  85515. }
  85516. }
  85517. }
  85518. if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
  85519. $this->input = null;
  85520. fclose($this->pipes[0]);
  85521. unset($this->pipes[0]);
  85522. } elseif (!$w) {
  85523. return [$this->pipes[0]];
  85524. }
  85525. return null;
  85526. }
  85527. public function handleError(int $type, string $msg)
  85528. {
  85529. $this->lastError = $msg;
  85530. }
  85531. }
  85532. <?php
  85533. namespace Symfony\Component\Process\Pipes;
  85534. interface PipesInterface
  85535. {
  85536. public const CHUNK_SIZE = 16384;
  85537. public function getDescriptors(): array;
  85538. public function getFiles(): array;
  85539. public function readAndWrite(bool $blocking, bool $close = false): array;
  85540. public function areOpen(): bool;
  85541. public function haveReadSupport(): bool;
  85542. public function close();
  85543. }
  85544. <?php
  85545. namespace Symfony\Component\Process\Pipes;
  85546. use Symfony\Component\Process\Process;
  85547. class UnixPipes extends AbstractPipes
  85548. {
  85549. private $ttyMode;
  85550. private $ptyMode;
  85551. private $haveReadSupport;
  85552. public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport)
  85553. {
  85554. $this->ttyMode = $ttyMode;
  85555. $this->ptyMode = $ptyMode;
  85556. $this->haveReadSupport = $haveReadSupport;
  85557. parent::__construct($input);
  85558. }
  85559. public function __sleep(): array
  85560. {
  85561. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  85562. }
  85563. public function __wakeup()
  85564. {
  85565. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  85566. }
  85567. public function __destruct()
  85568. {
  85569. $this->close();
  85570. }
  85571. public function getDescriptors(): array
  85572. {
  85573. if (!$this->haveReadSupport) {
  85574. $nullstream = fopen('/dev/null', 'c');
  85575. return [
  85576. ['pipe', 'r'],
  85577. $nullstream,
  85578. $nullstream,
  85579. ];
  85580. }
  85581. if ($this->ttyMode) {
  85582. return [
  85583. ['file', '/dev/tty', 'r'],
  85584. ['file', '/dev/tty', 'w'],
  85585. ['file', '/dev/tty', 'w'],
  85586. ];
  85587. }
  85588. if ($this->ptyMode && Process::isPtySupported()) {
  85589. return [
  85590. ['pty'],
  85591. ['pty'],
  85592. ['pty'],
  85593. ];
  85594. }
  85595. return [
  85596. ['pipe', 'r'],
  85597. ['pipe', 'w'],
  85598. ['pipe', 'w'],
  85599. ];
  85600. }
  85601. public function getFiles(): array
  85602. {
  85603. return [];
  85604. }
  85605. public function readAndWrite(bool $blocking, bool $close = false): array
  85606. {
  85607. $this->unblock();
  85608. $w = $this->write();
  85609. $read = $e = [];
  85610. $r = $this->pipes;
  85611. unset($r[0]);
  85612. set_error_handler([$this, 'handleError']);
  85613. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  85614. restore_error_handler();
  85615. if (!$this->hasSystemCallBeenInterrupted()) {
  85616. $this->pipes = [];
  85617. }
  85618. return $read;
  85619. }
  85620. restore_error_handler();
  85621. foreach ($r as $pipe) {
  85622. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  85623. do {
  85624. $data = @fread($pipe, self::CHUNK_SIZE);
  85625. $read[$type] .= $data;
  85626. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  85627. if (!isset($read[$type][0])) {
  85628. unset($read[$type]);
  85629. }
  85630. if ($close && feof($pipe)) {
  85631. fclose($pipe);
  85632. unset($this->pipes[$type]);
  85633. }
  85634. }
  85635. return $read;
  85636. }
  85637. public function haveReadSupport(): bool
  85638. {
  85639. return $this->haveReadSupport;
  85640. }
  85641. public function areOpen(): bool
  85642. {
  85643. return (bool) $this->pipes;
  85644. }
  85645. }
  85646. <?php
  85647. namespace Symfony\Component\Process\Pipes;
  85648. use Symfony\Component\Process\Exception\RuntimeException;
  85649. use Symfony\Component\Process\Process;
  85650. class WindowsPipes extends AbstractPipes
  85651. {
  85652. private $files = [];
  85653. private $fileHandles = [];
  85654. private $lockHandles = [];
  85655. private $readBytes = [
  85656. Process::STDOUT => 0,
  85657. Process::STDERR => 0,
  85658. ];
  85659. private $haveReadSupport;
  85660. public function __construct($input, bool $haveReadSupport)
  85661. {
  85662. $this->haveReadSupport = $haveReadSupport;
  85663. if ($this->haveReadSupport) {
  85664. $pipes = [
  85665. Process::STDOUT => Process::OUT,
  85666. Process::STDERR => Process::ERR,
  85667. ];
  85668. $tmpDir = sys_get_temp_dir();
  85669. $lastError = 'unknown reason';
  85670. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  85671. for ($i = 0;; ++$i) {
  85672. foreach ($pipes as $pipe => $name) {
  85673. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  85674. if (!$h = fopen($file.'.lock', 'w')) {
  85675. if (file_exists($file.'.lock')) {
  85676. continue 2;
  85677. }
  85678. restore_error_handler();
  85679. throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
  85680. }
  85681. if (!flock($h, \LOCK_EX | \LOCK_NB)) {
  85682. continue 2;
  85683. }
  85684. if (isset($this->lockHandles[$pipe])) {
  85685. flock($this->lockHandles[$pipe], \LOCK_UN);
  85686. fclose($this->lockHandles[$pipe]);
  85687. }
  85688. $this->lockHandles[$pipe] = $h;
  85689. if (!($h = fopen($file, 'w')) || !fclose($h) || !$h = fopen($file, 'r')) {
  85690. flock($this->lockHandles[$pipe], \LOCK_UN);
  85691. fclose($this->lockHandles[$pipe]);
  85692. unset($this->lockHandles[$pipe]);
  85693. continue 2;
  85694. }
  85695. $this->fileHandles[$pipe] = $h;
  85696. $this->files[$pipe] = $file;
  85697. }
  85698. break;
  85699. }
  85700. restore_error_handler();
  85701. }
  85702. parent::__construct($input);
  85703. }
  85704. public function __sleep(): array
  85705. {
  85706. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  85707. }
  85708. public function __wakeup()
  85709. {
  85710. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  85711. }
  85712. public function __destruct()
  85713. {
  85714. $this->close();
  85715. }
  85716. public function getDescriptors(): array
  85717. {
  85718. if (!$this->haveReadSupport) {
  85719. $nullstream = fopen('NUL', 'c');
  85720. return [
  85721. ['pipe', 'r'],
  85722. $nullstream,
  85723. $nullstream,
  85724. ];
  85725. }
  85726. return [
  85727. ['pipe', 'r'],
  85728. ['file', 'NUL', 'w'],
  85729. ['file', 'NUL', 'w'],
  85730. ];
  85731. }
  85732. public function getFiles(): array
  85733. {
  85734. return $this->files;
  85735. }
  85736. public function readAndWrite(bool $blocking, bool $close = false): array
  85737. {
  85738. $this->unblock();
  85739. $w = $this->write();
  85740. $read = $r = $e = [];
  85741. if ($blocking) {
  85742. if ($w) {
  85743. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  85744. } elseif ($this->fileHandles) {
  85745. usleep((int) (Process::TIMEOUT_PRECISION * 1E6));
  85746. }
  85747. }
  85748. foreach ($this->fileHandles as $type => $fileHandle) {
  85749. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  85750. if (isset($data[0])) {
  85751. $this->readBytes[$type] += \strlen($data);
  85752. $read[$type] = $data;
  85753. }
  85754. if ($close) {
  85755. ftruncate($fileHandle, 0);
  85756. fclose($fileHandle);
  85757. flock($this->lockHandles[$type], \LOCK_UN);
  85758. fclose($this->lockHandles[$type]);
  85759. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  85760. }
  85761. }
  85762. return $read;
  85763. }
  85764. public function haveReadSupport(): bool
  85765. {
  85766. return $this->haveReadSupport;
  85767. }
  85768. public function areOpen(): bool
  85769. {
  85770. return $this->pipes && $this->fileHandles;
  85771. }
  85772. public function close()
  85773. {
  85774. parent::close();
  85775. foreach ($this->fileHandles as $type => $handle) {
  85776. ftruncate($handle, 0);
  85777. fclose($handle);
  85778. flock($this->lockHandles[$type], \LOCK_UN);
  85779. fclose($this->lockHandles[$type]);
  85780. }
  85781. $this->fileHandles = $this->lockHandles = [];
  85782. }
  85783. }
  85784. <?php
  85785. namespace Symfony\Component\Process;
  85786. use Symfony\Component\Process\Exception\InvalidArgumentException;
  85787. use Symfony\Component\Process\Exception\LogicException;
  85788. use Symfony\Component\Process\Exception\ProcessFailedException;
  85789. use Symfony\Component\Process\Exception\ProcessSignaledException;
  85790. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  85791. use Symfony\Component\Process\Exception\RuntimeException;
  85792. use Symfony\Component\Process\Pipes\PipesInterface;
  85793. use Symfony\Component\Process\Pipes\UnixPipes;
  85794. use Symfony\Component\Process\Pipes\WindowsPipes;
  85795. class Process implements \IteratorAggregate
  85796. {
  85797. public const ERR = 'err';
  85798. public const OUT = 'out';
  85799. public const STATUS_READY = 'ready';
  85800. public const STATUS_STARTED = 'started';
  85801. public const STATUS_TERMINATED = 'terminated';
  85802. public const STDIN = 0;
  85803. public const STDOUT = 1;
  85804. public const STDERR = 2;
  85805. public const TIMEOUT_PRECISION = 0.2;
  85806. public const ITER_NON_BLOCKING = 1;
  85807. public const ITER_KEEP_OUTPUT = 2;
  85808. public const ITER_SKIP_OUT = 4;
  85809. public const ITER_SKIP_ERR = 8;
  85810. private $callback;
  85811. private $hasCallback = false;
  85812. private $commandline;
  85813. private $cwd;
  85814. private $env = [];
  85815. private $input;
  85816. private $starttime;
  85817. private $lastOutputTime;
  85818. private $timeout;
  85819. private $idleTimeout;
  85820. private $exitcode;
  85821. private $fallbackStatus = [];
  85822. private $processInformation;
  85823. private $outputDisabled = false;
  85824. private $stdout;
  85825. private $stderr;
  85826. private $process;
  85827. private $status = self::STATUS_READY;
  85828. private $incrementalOutputOffset = 0;
  85829. private $incrementalErrorOutputOffset = 0;
  85830. private $tty = false;
  85831. private $pty;
  85832. private $options = ['suppress_errors' => true, 'bypass_shell' => true];
  85833. private $useFileHandles = false;
  85834. private $processPipes;
  85835. private $latestSignal;
  85836. private $cachedExitCode;
  85837. private static $sigchild;
  85838. public static $exitCodes = [
  85839. 0 => 'OK',
  85840. 1 => 'General error',
  85841. 2 => 'Misuse of shell builtins',
  85842. 126 => 'Invoked command cannot execute',
  85843. 127 => 'Command not found',
  85844. 128 => 'Invalid exit argument',
  85845. 129 => 'Hangup',
  85846. 130 => 'Interrupt',
  85847. 131 => 'Quit and dump core',
  85848. 132 => 'Illegal instruction',
  85849. 133 => 'Trace/breakpoint trap',
  85850. 134 => 'Process aborted',
  85851. 135 => 'Bus error: "access to undefined portion of memory object"',
  85852. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  85853. 137 => 'Kill (terminate immediately)',
  85854. 138 => 'User-defined 1',
  85855. 139 => 'Segmentation violation',
  85856. 140 => 'User-defined 2',
  85857. 141 => 'Write to pipe with no one reading',
  85858. 142 => 'Signal raised by alarm',
  85859. 143 => 'Termination (request to terminate)',
  85860. 145 => 'Child process terminated, stopped (or continued*)',
  85861. 146 => 'Continue if stopped',
  85862. 147 => 'Stop executing temporarily',
  85863. 148 => 'Terminal stop signal',
  85864. 149 => 'Background process attempting to read from tty ("in")',
  85865. 150 => 'Background process attempting to write to tty ("out")',
  85866. 151 => 'Urgent data available on socket',
  85867. 152 => 'CPU time limit exceeded',
  85868. 153 => 'File size limit exceeded',
  85869. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  85870. 155 => 'Profiling timer expired',
  85871. 157 => 'Pollable event',
  85872. 159 => 'Bad syscall',
  85873. ];
  85874. public function __construct(array $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
  85875. {
  85876. if (!\function_exists('proc_open')) {
  85877. throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
  85878. }
  85879. $this->commandline = $command;
  85880. $this->cwd = $cwd;
  85881. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  85882. $this->cwd = getcwd();
  85883. }
  85884. if (null !== $env) {
  85885. $this->setEnv($env);
  85886. }
  85887. $this->setInput($input);
  85888. $this->setTimeout($timeout);
  85889. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  85890. $this->pty = false;
  85891. }
  85892. public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60)
  85893. {
  85894. $process = new static([], $cwd, $env, $input, $timeout);
  85895. $process->commandline = $command;
  85896. return $process;
  85897. }
  85898. public function __sleep()
  85899. {
  85900. throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
  85901. }
  85902. public function __wakeup()
  85903. {
  85904. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  85905. }
  85906. public function __destruct()
  85907. {
  85908. if ($this->options['create_new_console'] ?? false) {
  85909. $this->processPipes->close();
  85910. } else {
  85911. $this->stop(0);
  85912. }
  85913. }
  85914. public function __clone()
  85915. {
  85916. $this->resetProcessData();
  85917. }
  85918. public function run(?callable $callback = null, array $env = []): int
  85919. {
  85920. $this->start($callback, $env);
  85921. return $this->wait();
  85922. }
  85923. public function mustRun(?callable $callback = null, array $env = []): self
  85924. {
  85925. if (0 !== $this->run($callback, $env)) {
  85926. throw new ProcessFailedException($this);
  85927. }
  85928. return $this;
  85929. }
  85930. public function start(?callable $callback = null, array $env = [])
  85931. {
  85932. if ($this->isRunning()) {
  85933. throw new RuntimeException('Process is already running.');
  85934. }
  85935. $this->resetProcessData();
  85936. $this->starttime = $this->lastOutputTime = microtime(true);
  85937. $this->callback = $this->buildCallback($callback);
  85938. $this->hasCallback = null !== $callback;
  85939. $descriptors = $this->getDescriptors();
  85940. if ($this->env) {
  85941. $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->env, $env, 'strcasecmp') : $this->env;
  85942. }
  85943. $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->getDefaultEnv(), $env, 'strcasecmp') : $this->getDefaultEnv();
  85944. if (\is_array($commandline = $this->commandline)) {
  85945. $commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline));
  85946. if ('\\' !== \DIRECTORY_SEPARATOR) {
  85947. $commandline = 'exec '.$commandline;
  85948. }
  85949. } else {
  85950. $commandline = $this->replacePlaceholders($commandline, $env);
  85951. }
  85952. if ('\\' === \DIRECTORY_SEPARATOR) {
  85953. $commandline = $this->prepareWindowsCommandLine($commandline, $env);
  85954. } elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
  85955. $descriptors[3] = ['pipe', 'w'];
  85956. $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  85957. $commandline .= 'pid=$!; echo $pid >&3; wait $pid 2>/dev/null; code=$?; echo $code >&3; exit $code';
  85958. $ptsWorkaround = fopen(__FILE__, 'r');
  85959. }
  85960. $envPairs = [];
  85961. foreach ($env as $k => $v) {
  85962. if (false !== $v && false === \in_array($k, ['argc', 'argv', 'ARGC', 'ARGV'], true)) {
  85963. $envPairs[] = $k.'='.$v;
  85964. }
  85965. }
  85966. if (!is_dir($this->cwd)) {
  85967. throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
  85968. }
  85969. $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
  85970. if (!$this->process) {
  85971. throw new RuntimeException('Unable to launch a new process.');
  85972. }
  85973. $this->status = self::STATUS_STARTED;
  85974. if (isset($descriptors[3])) {
  85975. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  85976. }
  85977. if ($this->tty) {
  85978. return;
  85979. }
  85980. $this->updateStatus(false);
  85981. $this->checkTimeout();
  85982. }
  85983. public function restart(?callable $callback = null, array $env = []): self
  85984. {
  85985. if ($this->isRunning()) {
  85986. throw new RuntimeException('Process is already running.');
  85987. }
  85988. $process = clone $this;
  85989. $process->start($callback, $env);
  85990. return $process;
  85991. }
  85992. public function wait(?callable $callback = null)
  85993. {
  85994. $this->requireProcessIsStarted(__FUNCTION__);
  85995. $this->updateStatus(false);
  85996. if (null !== $callback) {
  85997. if (!$this->processPipes->haveReadSupport()) {
  85998. $this->stop(0);
  85999. throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::wait".');
  86000. }
  86001. $this->callback = $this->buildCallback($callback);
  86002. }
  86003. do {
  86004. $this->checkTimeout();
  86005. $running = $this->isRunning() && ('\\' === \DIRECTORY_SEPARATOR || $this->processPipes->areOpen());
  86006. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  86007. } while ($running);
  86008. while ($this->isRunning()) {
  86009. $this->checkTimeout();
  86010. usleep(1000);
  86011. }
  86012. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  86013. throw new ProcessSignaledException($this);
  86014. }
  86015. return $this->exitcode;
  86016. }
  86017. public function waitUntil(callable $callback): bool
  86018. {
  86019. $this->requireProcessIsStarted(__FUNCTION__);
  86020. $this->updateStatus(false);
  86021. if (!$this->processPipes->haveReadSupport()) {
  86022. $this->stop(0);
  86023. throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::waitUntil".');
  86024. }
  86025. $callback = $this->buildCallback($callback);
  86026. $ready = false;
  86027. while (true) {
  86028. $this->checkTimeout();
  86029. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  86030. $output = $this->processPipes->readAndWrite($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  86031. foreach ($output as $type => $data) {
  86032. if (3 !== $type) {
  86033. $ready = $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data) || $ready;
  86034. } elseif (!isset($this->fallbackStatus['signaled'])) {
  86035. $this->fallbackStatus['exitcode'] = (int) $data;
  86036. }
  86037. }
  86038. if ($ready) {
  86039. return true;
  86040. }
  86041. if (!$running) {
  86042. return false;
  86043. }
  86044. usleep(1000);
  86045. }
  86046. }
  86047. public function getPid()
  86048. {
  86049. return $this->isRunning() ? $this->processInformation['pid'] : null;
  86050. }
  86051. public function signal(int $signal)
  86052. {
  86053. $this->doSignal($signal, true);
  86054. return $this;
  86055. }
  86056. public function disableOutput()
  86057. {
  86058. if ($this->isRunning()) {
  86059. throw new RuntimeException('Disabling output while the process is running is not possible.');
  86060. }
  86061. if (null !== $this->idleTimeout) {
  86062. throw new LogicException('Output cannot be disabled while an idle timeout is set.');
  86063. }
  86064. $this->outputDisabled = true;
  86065. return $this;
  86066. }
  86067. public function enableOutput()
  86068. {
  86069. if ($this->isRunning()) {
  86070. throw new RuntimeException('Enabling output while the process is running is not possible.');
  86071. }
  86072. $this->outputDisabled = false;
  86073. return $this;
  86074. }
  86075. public function isOutputDisabled()
  86076. {
  86077. return $this->outputDisabled;
  86078. }
  86079. public function getOutput()
  86080. {
  86081. $this->readPipesForOutput(__FUNCTION__);
  86082. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  86083. return '';
  86084. }
  86085. return $ret;
  86086. }
  86087. public function getIncrementalOutput()
  86088. {
  86089. $this->readPipesForOutput(__FUNCTION__);
  86090. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  86091. $this->incrementalOutputOffset = ftell($this->stdout);
  86092. if (false === $latest) {
  86093. return '';
  86094. }
  86095. return $latest;
  86096. }
  86097. #[\ReturnTypeWillChange]
  86098. public function getIterator(int $flags = 0)
  86099. {
  86100. $this->readPipesForOutput(__FUNCTION__, false);
  86101. $clearOutput = !(self::ITER_KEEP_OUTPUT & $flags);
  86102. $blocking = !(self::ITER_NON_BLOCKING & $flags);
  86103. $yieldOut = !(self::ITER_SKIP_OUT & $flags);
  86104. $yieldErr = !(self::ITER_SKIP_ERR & $flags);
  86105. while (null !== $this->callback || ($yieldOut && !feof($this->stdout)) || ($yieldErr && !feof($this->stderr))) {
  86106. if ($yieldOut) {
  86107. $out = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  86108. if (isset($out[0])) {
  86109. if ($clearOutput) {
  86110. $this->clearOutput();
  86111. } else {
  86112. $this->incrementalOutputOffset = ftell($this->stdout);
  86113. }
  86114. yield self::OUT => $out;
  86115. }
  86116. }
  86117. if ($yieldErr) {
  86118. $err = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  86119. if (isset($err[0])) {
  86120. if ($clearOutput) {
  86121. $this->clearErrorOutput();
  86122. } else {
  86123. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  86124. }
  86125. yield self::ERR => $err;
  86126. }
  86127. }
  86128. if (!$blocking && !isset($out[0]) && !isset($err[0])) {
  86129. yield self::OUT => '';
  86130. }
  86131. $this->checkTimeout();
  86132. $this->readPipesForOutput(__FUNCTION__, $blocking);
  86133. }
  86134. }
  86135. public function clearOutput()
  86136. {
  86137. ftruncate($this->stdout, 0);
  86138. fseek($this->stdout, 0);
  86139. $this->incrementalOutputOffset = 0;
  86140. return $this;
  86141. }
  86142. public function getErrorOutput()
  86143. {
  86144. $this->readPipesForOutput(__FUNCTION__);
  86145. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  86146. return '';
  86147. }
  86148. return $ret;
  86149. }
  86150. public function getIncrementalErrorOutput()
  86151. {
  86152. $this->readPipesForOutput(__FUNCTION__);
  86153. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  86154. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  86155. if (false === $latest) {
  86156. return '';
  86157. }
  86158. return $latest;
  86159. }
  86160. public function clearErrorOutput()
  86161. {
  86162. ftruncate($this->stderr, 0);
  86163. fseek($this->stderr, 0);
  86164. $this->incrementalErrorOutputOffset = 0;
  86165. return $this;
  86166. }
  86167. public function getExitCode()
  86168. {
  86169. $this->updateStatus(false);
  86170. return $this->exitcode;
  86171. }
  86172. public function getExitCodeText()
  86173. {
  86174. if (null === $exitcode = $this->getExitCode()) {
  86175. return null;
  86176. }
  86177. return self::$exitCodes[$exitcode] ?? 'Unknown error';
  86178. }
  86179. public function isSuccessful()
  86180. {
  86181. return 0 === $this->getExitCode();
  86182. }
  86183. public function hasBeenSignaled()
  86184. {
  86185. $this->requireProcessIsTerminated(__FUNCTION__);
  86186. return $this->processInformation['signaled'];
  86187. }
  86188. public function getTermSignal()
  86189. {
  86190. $this->requireProcessIsTerminated(__FUNCTION__);
  86191. if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
  86192. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.');
  86193. }
  86194. return $this->processInformation['termsig'];
  86195. }
  86196. public function hasBeenStopped()
  86197. {
  86198. $this->requireProcessIsTerminated(__FUNCTION__);
  86199. return $this->processInformation['stopped'];
  86200. }
  86201. public function getStopSignal()
  86202. {
  86203. $this->requireProcessIsTerminated(__FUNCTION__);
  86204. return $this->processInformation['stopsig'];
  86205. }
  86206. public function isRunning()
  86207. {
  86208. if (self::STATUS_STARTED !== $this->status) {
  86209. return false;
  86210. }
  86211. $this->updateStatus(false);
  86212. return $this->processInformation['running'];
  86213. }
  86214. public function isStarted()
  86215. {
  86216. return self::STATUS_READY != $this->status;
  86217. }
  86218. public function isTerminated()
  86219. {
  86220. $this->updateStatus(false);
  86221. return self::STATUS_TERMINATED == $this->status;
  86222. }
  86223. public function getStatus()
  86224. {
  86225. $this->updateStatus(false);
  86226. return $this->status;
  86227. }
  86228. public function stop(float $timeout = 10, ?int $signal = null)
  86229. {
  86230. $timeoutMicro = microtime(true) + $timeout;
  86231. if ($this->isRunning()) {
  86232. $this->doSignal(15, false);
  86233. do {
  86234. usleep(1000);
  86235. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  86236. if ($this->isRunning()) {
  86237. $this->doSignal($signal ?: 9, false);
  86238. }
  86239. }
  86240. if ($this->isRunning()) {
  86241. if (isset($this->fallbackStatus['pid'])) {
  86242. unset($this->fallbackStatus['pid']);
  86243. return $this->stop(0, $signal);
  86244. }
  86245. $this->close();
  86246. }
  86247. return $this->exitcode;
  86248. }
  86249. public function addOutput(string $line)
  86250. {
  86251. $this->lastOutputTime = microtime(true);
  86252. fseek($this->stdout, 0, \SEEK_END);
  86253. fwrite($this->stdout, $line);
  86254. fseek($this->stdout, $this->incrementalOutputOffset);
  86255. }
  86256. public function addErrorOutput(string $line)
  86257. {
  86258. $this->lastOutputTime = microtime(true);
  86259. fseek($this->stderr, 0, \SEEK_END);
  86260. fwrite($this->stderr, $line);
  86261. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  86262. }
  86263. public function getLastOutputTime(): ?float
  86264. {
  86265. return $this->lastOutputTime;
  86266. }
  86267. public function getCommandLine()
  86268. {
  86269. return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline;
  86270. }
  86271. public function getTimeout()
  86272. {
  86273. return $this->timeout;
  86274. }
  86275. public function getIdleTimeout()
  86276. {
  86277. return $this->idleTimeout;
  86278. }
  86279. public function setTimeout(?float $timeout)
  86280. {
  86281. $this->timeout = $this->validateTimeout($timeout);
  86282. return $this;
  86283. }
  86284. public function setIdleTimeout(?float $timeout)
  86285. {
  86286. if (null !== $timeout && $this->outputDisabled) {
  86287. throw new LogicException('Idle timeout cannot be set while the output is disabled.');
  86288. }
  86289. $this->idleTimeout = $this->validateTimeout($timeout);
  86290. return $this;
  86291. }
  86292. public function setTty(bool $tty)
  86293. {
  86294. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  86295. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  86296. }
  86297. if ($tty && !self::isTtySupported()) {
  86298. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  86299. }
  86300. $this->tty = $tty;
  86301. return $this;
  86302. }
  86303. public function isTty()
  86304. {
  86305. return $this->tty;
  86306. }
  86307. public function setPty(bool $bool)
  86308. {
  86309. $this->pty = $bool;
  86310. return $this;
  86311. }
  86312. public function isPty()
  86313. {
  86314. return $this->pty;
  86315. }
  86316. public function getWorkingDirectory()
  86317. {
  86318. if (null === $this->cwd) {
  86319. return getcwd() ?: null;
  86320. }
  86321. return $this->cwd;
  86322. }
  86323. public function setWorkingDirectory(string $cwd)
  86324. {
  86325. $this->cwd = $cwd;
  86326. return $this;
  86327. }
  86328. public function getEnv()
  86329. {
  86330. return $this->env;
  86331. }
  86332. public function setEnv(array $env)
  86333. {
  86334. $this->env = $env;
  86335. return $this;
  86336. }
  86337. public function getInput()
  86338. {
  86339. return $this->input;
  86340. }
  86341. public function setInput($input)
  86342. {
  86343. if ($this->isRunning()) {
  86344. throw new LogicException('Input cannot be set while the process is running.');
  86345. }
  86346. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  86347. return $this;
  86348. }
  86349. public function checkTimeout()
  86350. {
  86351. if (self::STATUS_STARTED !== $this->status) {
  86352. return;
  86353. }
  86354. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  86355. $this->stop(0);
  86356. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  86357. }
  86358. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  86359. $this->stop(0);
  86360. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  86361. }
  86362. }
  86363. public function getStartTime(): float
  86364. {
  86365. if (!$this->isStarted()) {
  86366. throw new LogicException('Start time is only available after process start.');
  86367. }
  86368. return $this->starttime;
  86369. }
  86370. public function setOptions(array $options)
  86371. {
  86372. if ($this->isRunning()) {
  86373. throw new RuntimeException('Setting options while the process is running is not possible.');
  86374. }
  86375. $defaultOptions = $this->options;
  86376. $existingOptions = ['blocking_pipes', 'create_process_group', 'create_new_console'];
  86377. foreach ($options as $key => $value) {
  86378. if (!\in_array($key, $existingOptions)) {
  86379. $this->options = $defaultOptions;
  86380. throw new LogicException(sprintf('Invalid option "%s" passed to "%s()". Supported options are "%s".', $key, __METHOD__, implode('", "', $existingOptions)));
  86381. }
  86382. $this->options[$key] = $value;
  86383. }
  86384. }
  86385. public static function isTtySupported(): bool
  86386. {
  86387. static $isTtySupported;
  86388. if (null === $isTtySupported) {
  86389. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
  86390. }
  86391. return $isTtySupported;
  86392. }
  86393. public static function isPtySupported()
  86394. {
  86395. static $result;
  86396. if (null !== $result) {
  86397. return $result;
  86398. }
  86399. if ('\\' === \DIRECTORY_SEPARATOR) {
  86400. return $result = false;
  86401. }
  86402. return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['pty']], $pipes);
  86403. }
  86404. private function getDescriptors(): array
  86405. {
  86406. if ($this->input instanceof \Iterator) {
  86407. $this->input->rewind();
  86408. }
  86409. if ('\\' === \DIRECTORY_SEPARATOR) {
  86410. $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
  86411. } else {
  86412. $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
  86413. }
  86414. return $this->processPipes->getDescriptors();
  86415. }
  86416. protected function buildCallback(?callable $callback = null)
  86417. {
  86418. if ($this->outputDisabled) {
  86419. return function ($type, $data) use ($callback): bool {
  86420. return null !== $callback && $callback($type, $data);
  86421. };
  86422. }
  86423. $out = self::OUT;
  86424. return function ($type, $data) use ($callback, $out): bool {
  86425. if ($out == $type) {
  86426. $this->addOutput($data);
  86427. } else {
  86428. $this->addErrorOutput($data);
  86429. }
  86430. return null !== $callback && $callback($type, $data);
  86431. };
  86432. }
  86433. protected function updateStatus(bool $blocking)
  86434. {
  86435. if (self::STATUS_STARTED !== $this->status) {
  86436. return;
  86437. }
  86438. $this->processInformation = proc_get_status($this->process);
  86439. $running = $this->processInformation['running'];
  86440. if (\PHP_VERSION_ID < 80300) {
  86441. if (!isset($this->cachedExitCode) && !$running && -1 !== $this->processInformation['exitcode']) {
  86442. $this->cachedExitCode = $this->processInformation['exitcode'];
  86443. }
  86444. if (isset($this->cachedExitCode) && !$running && -1 === $this->processInformation['exitcode']) {
  86445. $this->processInformation['exitcode'] = $this->cachedExitCode;
  86446. }
  86447. }
  86448. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  86449. if ($this->fallbackStatus && $this->isSigchildEnabled()) {
  86450. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  86451. }
  86452. if (!$running) {
  86453. $this->close();
  86454. }
  86455. }
  86456. protected function isSigchildEnabled()
  86457. {
  86458. if (null !== self::$sigchild) {
  86459. return self::$sigchild;
  86460. }
  86461. if (!\function_exists('phpinfo')) {
  86462. return self::$sigchild = false;
  86463. }
  86464. ob_start();
  86465. phpinfo(\INFO_GENERAL);
  86466. return self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
  86467. }
  86468. private function readPipesForOutput(string $caller, bool $blocking = false)
  86469. {
  86470. if ($this->outputDisabled) {
  86471. throw new LogicException('Output has been disabled.');
  86472. }
  86473. $this->requireProcessIsStarted($caller);
  86474. $this->updateStatus($blocking);
  86475. }
  86476. private function validateTimeout(?float $timeout): ?float
  86477. {
  86478. $timeout = (float) $timeout;
  86479. if (0.0 === $timeout) {
  86480. $timeout = null;
  86481. } elseif ($timeout < 0) {
  86482. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  86483. }
  86484. return $timeout;
  86485. }
  86486. private function readPipes(bool $blocking, bool $close)
  86487. {
  86488. $result = $this->processPipes->readAndWrite($blocking, $close);
  86489. $callback = $this->callback;
  86490. foreach ($result as $type => $data) {
  86491. if (3 !== $type) {
  86492. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  86493. } elseif (!isset($this->fallbackStatus['signaled'])) {
  86494. $this->fallbackStatus['exitcode'] = (int) $data;
  86495. }
  86496. }
  86497. }
  86498. private function close(): int
  86499. {
  86500. $this->processPipes->close();
  86501. if ($this->process) {
  86502. proc_close($this->process);
  86503. $this->process = null;
  86504. }
  86505. $this->exitcode = $this->processInformation['exitcode'];
  86506. $this->status = self::STATUS_TERMINATED;
  86507. if (-1 === $this->exitcode) {
  86508. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  86509. $this->exitcode = 128 + $this->processInformation['termsig'];
  86510. } elseif ($this->isSigchildEnabled()) {
  86511. $this->processInformation['signaled'] = true;
  86512. $this->processInformation['termsig'] = -1;
  86513. }
  86514. }
  86515. $this->callback = null;
  86516. return $this->exitcode;
  86517. }
  86518. private function resetProcessData()
  86519. {
  86520. $this->starttime = null;
  86521. $this->callback = null;
  86522. $this->exitcode = null;
  86523. $this->fallbackStatus = [];
  86524. $this->processInformation = null;
  86525. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
  86526. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
  86527. $this->process = null;
  86528. $this->latestSignal = null;
  86529. $this->status = self::STATUS_READY;
  86530. $this->incrementalOutputOffset = 0;
  86531. $this->incrementalErrorOutputOffset = 0;
  86532. }
  86533. private function doSignal(int $signal, bool $throwException): bool
  86534. {
  86535. if (null === $pid = $this->getPid()) {
  86536. if ($throwException) {
  86537. throw new LogicException('Cannot send signal on a non running process.');
  86538. }
  86539. return false;
  86540. }
  86541. if ('\\' === \DIRECTORY_SEPARATOR) {
  86542. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  86543. if ($exitCode && $this->isRunning()) {
  86544. if ($throwException) {
  86545. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  86546. }
  86547. return false;
  86548. }
  86549. } else {
  86550. if (!$this->isSigchildEnabled()) {
  86551. $ok = @proc_terminate($this->process, $signal);
  86552. } elseif (\function_exists('posix_kill')) {
  86553. $ok = @posix_kill($pid, $signal);
  86554. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) {
  86555. $ok = false === fgets($pipes[2]);
  86556. }
  86557. if (!$ok) {
  86558. if ($throwException) {
  86559. throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
  86560. }
  86561. return false;
  86562. }
  86563. }
  86564. $this->latestSignal = $signal;
  86565. $this->fallbackStatus['signaled'] = true;
  86566. $this->fallbackStatus['exitcode'] = -1;
  86567. $this->fallbackStatus['termsig'] = $this->latestSignal;
  86568. return true;
  86569. }
  86570. private function prepareWindowsCommandLine(string $cmd, array &$env): string
  86571. {
  86572. $uid = uniqid('', true);
  86573. $varCount = 0;
  86574. $varCache = [];
  86575. $cmd = preg_replace_callback(
  86576. '/"(?:(
  86577. [^"%!^]*+
  86578. (?:
  86579. (?: !LF! | "(?:\^[%!^])?+" )
  86580. [^"%!^]*+
  86581. )++
  86582. ) | [^"]*+ )"/x',
  86583. function ($m) use (&$env, &$varCache, &$varCount, $uid) {
  86584. if (!isset($m[1])) {
  86585. return $m[0];
  86586. }
  86587. if (isset($varCache[$m[0]])) {
  86588. return $varCache[$m[0]];
  86589. }
  86590. if (str_contains($value = $m[1], "\0")) {
  86591. $value = str_replace("\0", '?', $value);
  86592. }
  86593. if (false === strpbrk($value, "\"%!\n")) {
  86594. return '"'.$value.'"';
  86595. }
  86596. $value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value);
  86597. $value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"';
  86598. $var = $uid.++$varCount;
  86599. $env[$var] = $value;
  86600. return $varCache[$m[0]] = '!'.$var.'!';
  86601. },
  86602. $cmd
  86603. );
  86604. static $comSpec;
  86605. if (!$comSpec && $comSpec = (new ExecutableFinder())->find('cmd.exe')) {
  86606. $comSpec = '"'.preg_replace('{(\\\\*+)"}', '$1$1\"', $comSpec) .'"';
  86607. }
  86608. $cmd = ($comSpec ?? 'cmd').' /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
  86609. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  86610. $cmd .= ' '.$offset.'>"'.$filename.'"';
  86611. }
  86612. return $cmd;
  86613. }
  86614. private function requireProcessIsStarted(string $functionName)
  86615. {
  86616. if (!$this->isStarted()) {
  86617. throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
  86618. }
  86619. }
  86620. private function requireProcessIsTerminated(string $functionName)
  86621. {
  86622. if (!$this->isTerminated()) {
  86623. throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));
  86624. }
  86625. }
  86626. private function escapeArgument(?string $argument): string
  86627. {
  86628. if ('' === $argument || null === $argument) {
  86629. return '""';
  86630. }
  86631. if ('\\' !== \DIRECTORY_SEPARATOR) {
  86632. return "'".str_replace("'", "'\\''", $argument)."'";
  86633. }
  86634. if (str_contains($argument, "\0")) {
  86635. $argument = str_replace("\0", '?', $argument);
  86636. }
  86637. if (!preg_match('/[()%!^"<>&|\s]/', $argument)) {
  86638. return $argument;
  86639. }
  86640. $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);
  86641. return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"';
  86642. }
  86643. private function replacePlaceholders(string $commandline, array $env)
  86644. {
  86645. return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
  86646. if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
  86647. throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]).$commandline);
  86648. }
  86649. return $this->escapeArgument($env[$matches[1]]);
  86650. }, $commandline);
  86651. }
  86652. private function getDefaultEnv(): array
  86653. {
  86654. $env = getenv();
  86655. $env = ('\\' === \DIRECTORY_SEPARATOR ? array_intersect_ukey($env, $_SERVER, 'strcasecmp') : array_intersect_key($env, $_SERVER)) ?: $env;
  86656. return $_ENV + ('\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($env, $_ENV, 'strcasecmp') : $env);
  86657. }
  86658. }
  86659. <?php
  86660. namespace Symfony\Component\Process;
  86661. use Symfony\Component\Process\Exception\InvalidArgumentException;
  86662. class ProcessUtils
  86663. {
  86664. private function __construct()
  86665. {
  86666. }
  86667. public static function validateInput(string $caller, $input)
  86668. {
  86669. if (null !== $input) {
  86670. if (\is_resource($input)) {
  86671. return $input;
  86672. }
  86673. if (\is_string($input)) {
  86674. return $input;
  86675. }
  86676. if (\is_scalar($input)) {
  86677. return (string) $input;
  86678. }
  86679. if ($input instanceof Process) {
  86680. return $input->getIterator($input::ITER_SKIP_ERR);
  86681. }
  86682. if ($input instanceof \Iterator) {
  86683. return $input;
  86684. }
  86685. if ($input instanceof \Traversable) {
  86686. return new \IteratorIterator($input);
  86687. }
  86688. throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
  86689. }
  86690. return $input;
  86691. }
  86692. }
  86693. <?php
  86694. namespace Symfony\Contracts\Service\Attribute;
  86695. #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
  86696. final class Required
  86697. {
  86698. }
  86699. <?php
  86700. namespace Symfony\Contracts\Service\Attribute;
  86701. use Symfony\Contracts\Service\ServiceSubscriberTrait;
  86702. #[\Attribute(\Attribute::TARGET_METHOD)]
  86703. final class SubscribedService
  86704. {
  86705. public function __construct(
  86706. public ?string $key = null
  86707. ) {
  86708. }
  86709. }
  86710. Copyright (c) 2018-present Fabien Potencier
  86711. Permission is hereby granted, free of charge, to any person obtaining a copy
  86712. of this software and associated documentation files (the "Software"), to deal
  86713. in the Software without restriction, including without limitation the rights
  86714. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  86715. copies of the Software, and to permit persons to whom the Software is furnished
  86716. to do so, subject to the following conditions:
  86717. The above copyright notice and this permission notice shall be included in all
  86718. copies or substantial portions of the Software.
  86719. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  86720. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  86721. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  86722. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  86723. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  86724. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  86725. THE SOFTWARE.
  86726. <?php
  86727. namespace Symfony\Contracts\Service;
  86728. interface ResetInterface
  86729. {
  86730. public function reset();
  86731. }
  86732. <?php
  86733. namespace Symfony\Contracts\Service;
  86734. use Psr\Container\ContainerExceptionInterface;
  86735. use Psr\Container\NotFoundExceptionInterface;
  86736. class_exists(ContainerExceptionInterface::class);
  86737. class_exists(NotFoundExceptionInterface::class);
  86738. trait ServiceLocatorTrait
  86739. {
  86740. private $factories;
  86741. private $loading = [];
  86742. private $providedTypes;
  86743. public function __construct(array $factories)
  86744. {
  86745. $this->factories = $factories;
  86746. }
  86747. public function has(string $id)
  86748. {
  86749. return isset($this->factories[$id]);
  86750. }
  86751. public function get(string $id)
  86752. {
  86753. if (!isset($this->factories[$id])) {
  86754. throw $this->createNotFoundException($id);
  86755. }
  86756. if (isset($this->loading[$id])) {
  86757. $ids = array_values($this->loading);
  86758. $ids = \array_slice($this->loading, array_search($id, $ids));
  86759. $ids[] = $id;
  86760. throw $this->createCircularReferenceException($id, $ids);
  86761. }
  86762. $this->loading[$id] = $id;
  86763. try {
  86764. return $this->factories[$id]($this);
  86765. } finally {
  86766. unset($this->loading[$id]);
  86767. }
  86768. }
  86769. public function getProvidedServices(): array
  86770. {
  86771. if (null === $this->providedTypes) {
  86772. $this->providedTypes = [];
  86773. foreach ($this->factories as $name => $factory) {
  86774. if (!\is_callable($factory)) {
  86775. $this->providedTypes[$name] = '?';
  86776. } else {
  86777. $type = (new \ReflectionFunction($factory))->getReturnType();
  86778. $this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
  86779. }
  86780. }
  86781. }
  86782. return $this->providedTypes;
  86783. }
  86784. private function createNotFoundException(string $id): NotFoundExceptionInterface
  86785. {
  86786. if (!$alternatives = array_keys($this->factories)) {
  86787. $message = 'is empty...';
  86788. } else {
  86789. $last = array_pop($alternatives);
  86790. if ($alternatives) {
  86791. $message = sprintf('only knows about the "%s" and "%s" services.', implode('", "', $alternatives), $last);
  86792. } else {
  86793. $message = sprintf('only knows about the "%s" service.', $last);
  86794. }
  86795. }
  86796. if ($this->loading) {
  86797. $message = sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $message);
  86798. } else {
  86799. $message = sprintf('Service "%s" not found: the current service locator %s', $id, $message);
  86800. }
  86801. return new class($message) extends \InvalidArgumentException implements NotFoundExceptionInterface {
  86802. };
  86803. }
  86804. private function createCircularReferenceException(string $id, array $path): ContainerExceptionInterface
  86805. {
  86806. return new class(sprintf('Circular reference detected for service "%s", path: "%s".', $id, implode(' -> ', $path))) extends \RuntimeException implements ContainerExceptionInterface {
  86807. };
  86808. }
  86809. }
  86810. <?php
  86811. namespace Symfony\Contracts\Service;
  86812. use Psr\Container\ContainerInterface;
  86813. interface ServiceProviderInterface extends ContainerInterface
  86814. {
  86815. public function getProvidedServices(): array;
  86816. }
  86817. <?php
  86818. namespace Symfony\Contracts\Service;
  86819. interface ServiceSubscriberInterface
  86820. {
  86821. public static function getSubscribedServices();
  86822. }
  86823. <?php
  86824. namespace Symfony\Contracts\Service;
  86825. use Psr\Container\ContainerInterface;
  86826. use Symfony\Contracts\Service\Attribute\SubscribedService;
  86827. trait ServiceSubscriberTrait
  86828. {
  86829. protected $container;
  86830. public static function getSubscribedServices(): array
  86831. {
  86832. $services = method_exists(get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : [];
  86833. $attributeOptIn = false;
  86834. if (\PHP_VERSION_ID >= 80000) {
  86835. foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
  86836. if (self::class !== $method->getDeclaringClass()->name) {
  86837. continue;
  86838. }
  86839. if (!$attribute = $method->getAttributes(SubscribedService::class)[0] ?? null) {
  86840. continue;
  86841. }
  86842. if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
  86843. throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
  86844. }
  86845. if (!$returnType = $method->getReturnType()) {
  86846. throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
  86847. }
  86848. $serviceId = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType;
  86849. if ($returnType->allowsNull()) {
  86850. $serviceId = '?'.$serviceId;
  86851. }
  86852. $services[$attribute->newInstance()->key ?? self::class.'::'.$method->name] = $serviceId;
  86853. $attributeOptIn = true;
  86854. }
  86855. }
  86856. if (!$attributeOptIn) {
  86857. foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
  86858. if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
  86859. continue;
  86860. }
  86861. if (self::class !== $method->getDeclaringClass()->name) {
  86862. continue;
  86863. }
  86864. if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) {
  86865. continue;
  86866. }
  86867. if ($returnType->isBuiltin()) {
  86868. continue;
  86869. }
  86870. if (\PHP_VERSION_ID >= 80000) {
  86871. trigger_deprecation('symfony/service-contracts', '2.5', 'Using "%s" in "%s" without using the "%s" attribute on any method is deprecated.', ServiceSubscriberTrait::class, self::class, SubscribedService::class);
  86872. }
  86873. $services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType);
  86874. }
  86875. }
  86876. return $services;
  86877. }
  86878. public function setContainer(ContainerInterface $container)
  86879. {
  86880. $ret = null;
  86881. if (method_exists(get_parent_class(self::class) ?: '', __FUNCTION__)) {
  86882. $ret = parent::setContainer($container);
  86883. }
  86884. $this->container = $container;
  86885. return $ret;
  86886. }
  86887. }
  86888. <?php
  86889. namespace Symfony\Contracts\Service\Test;
  86890. class_alias(ServiceLocatorTestCase::class, ServiceLocatorTest::class);
  86891. if (false) {
  86892. class ServiceLocatorTest
  86893. {
  86894. }
  86895. }
  86896. <?php
  86897. namespace Symfony\Contracts\Service\Test;
  86898. use PHPUnit\Framework\TestCase;
  86899. use Psr\Container\ContainerInterface;
  86900. use Symfony\Contracts\Service\ServiceLocatorTrait;
  86901. abstract class ServiceLocatorTestCase extends TestCase
  86902. {
  86903. protected function getServiceLocator(array $factories)
  86904. {
  86905. return new class($factories) implements ContainerInterface {
  86906. use ServiceLocatorTrait;
  86907. };
  86908. }
  86909. public function testHas()
  86910. {
  86911. $locator = $this->getServiceLocator([
  86912. 'foo' => function () { return 'bar'; },
  86913. 'bar' => function () { return 'baz'; },
  86914. function () { return 'dummy'; },
  86915. ]);
  86916. $this->assertTrue($locator->has('foo'));
  86917. $this->assertTrue($locator->has('bar'));
  86918. $this->assertFalse($locator->has('dummy'));
  86919. }
  86920. public function testGet()
  86921. {
  86922. $locator = $this->getServiceLocator([
  86923. 'foo' => function () { return 'bar'; },
  86924. 'bar' => function () { return 'baz'; },
  86925. ]);
  86926. $this->assertSame('bar', $locator->get('foo'));
  86927. $this->assertSame('baz', $locator->get('bar'));
  86928. }
  86929. public function testGetDoesNotMemoize()
  86930. {
  86931. $i = 0;
  86932. $locator = $this->getServiceLocator([
  86933. 'foo' => function () use (&$i) {
  86934. ++$i;
  86935. return 'bar';
  86936. },
  86937. ]);
  86938. $this->assertSame('bar', $locator->get('foo'));
  86939. $this->assertSame('bar', $locator->get('foo'));
  86940. $this->assertSame(2, $i);
  86941. }
  86942. public function testThrowsOnUndefinedInternalService()
  86943. {
  86944. if (!$this->getExpectedException()) {
  86945. $this->expectException(\Psr\Container\NotFoundExceptionInterface::class);
  86946. $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
  86947. }
  86948. $locator = $this->getServiceLocator([
  86949. 'foo' => function () use (&$locator) { return $locator->get('bar'); },
  86950. ]);
  86951. $locator->get('foo');
  86952. }
  86953. public function testThrowsOnCircularReference()
  86954. {
  86955. $this->expectException(\Psr\Container\ContainerExceptionInterface::class);
  86956. $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
  86957. $locator = $this->getServiceLocator([
  86958. 'foo' => function () use (&$locator) { return $locator->get('bar'); },
  86959. 'bar' => function () use (&$locator) { return $locator->get('baz'); },
  86960. 'baz' => function () use (&$locator) { return $locator->get('bar'); },
  86961. ]);
  86962. $locator->get('foo');
  86963. }
  86964. }
  86965. <?php
  86966. namespace Symfony\Component\String;
  86967. use Symfony\Component\String\Exception\ExceptionInterface;
  86968. use Symfony\Component\String\Exception\InvalidArgumentException;
  86969. use Symfony\Component\String\Exception\RuntimeException;
  86970. abstract class AbstractString implements \Stringable, \JsonSerializable
  86971. {
  86972. public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER;
  86973. public const PREG_SET_ORDER = \PREG_SET_ORDER;
  86974. public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE;
  86975. public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL;
  86976. public const PREG_SPLIT = 0;
  86977. public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY;
  86978. public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE;
  86979. public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE;
  86980. protected $string = '';
  86981. protected $ignoreCase = false;
  86982. abstract public function __construct(string $string = '');
  86983. public static function unwrap(array $values): array
  86984. {
  86985. foreach ($values as $k => $v) {
  86986. if ($v instanceof self) {
  86987. $values[$k] = $v->__toString();
  86988. } elseif (\is_array($v) && $values[$k] !== $v = static::unwrap($v)) {
  86989. $values[$k] = $v;
  86990. }
  86991. }
  86992. return $values;
  86993. }
  86994. public static function wrap(array $values): array
  86995. {
  86996. $i = 0;
  86997. $keys = null;
  86998. foreach ($values as $k => $v) {
  86999. if (\is_string($k) && '' !== $k && $k !== $j = (string) new static($k)) {
  87000. $keys = $keys ?? array_keys($values);
  87001. $keys[$i] = $j;
  87002. }
  87003. if (\is_string($v)) {
  87004. $values[$k] = new static($v);
  87005. } elseif (\is_array($v) && $values[$k] !== $v = static::wrap($v)) {
  87006. $values[$k] = $v;
  87007. }
  87008. ++$i;
  87009. }
  87010. return null !== $keys ? array_combine($keys, $values) : $values;
  87011. }
  87012. public function after($needle, bool $includeNeedle = false, int $offset = 0): self
  87013. {
  87014. $str = clone $this;
  87015. $i = \PHP_INT_MAX;
  87016. foreach ((array) $needle as $n) {
  87017. $n = (string) $n;
  87018. $j = $this->indexOf($n, $offset);
  87019. if (null !== $j && $j < $i) {
  87020. $i = $j;
  87021. $str->string = $n;
  87022. }
  87023. }
  87024. if (\PHP_INT_MAX === $i) {
  87025. return $str;
  87026. }
  87027. if (!$includeNeedle) {
  87028. $i += $str->length();
  87029. }
  87030. return $this->slice($i);
  87031. }
  87032. public function afterLast($needle, bool $includeNeedle = false, int $offset = 0): self
  87033. {
  87034. $str = clone $this;
  87035. $i = null;
  87036. foreach ((array) $needle as $n) {
  87037. $n = (string) $n;
  87038. $j = $this->indexOfLast($n, $offset);
  87039. if (null !== $j && $j >= $i) {
  87040. $i = $offset = $j;
  87041. $str->string = $n;
  87042. }
  87043. }
  87044. if (null === $i) {
  87045. return $str;
  87046. }
  87047. if (!$includeNeedle) {
  87048. $i += $str->length();
  87049. }
  87050. return $this->slice($i);
  87051. }
  87052. abstract public function append(string ...$suffix): self;
  87053. public function before($needle, bool $includeNeedle = false, int $offset = 0): self
  87054. {
  87055. $str = clone $this;
  87056. $i = \PHP_INT_MAX;
  87057. foreach ((array) $needle as $n) {
  87058. $n = (string) $n;
  87059. $j = $this->indexOf($n, $offset);
  87060. if (null !== $j && $j < $i) {
  87061. $i = $j;
  87062. $str->string = $n;
  87063. }
  87064. }
  87065. if (\PHP_INT_MAX === $i) {
  87066. return $str;
  87067. }
  87068. if ($includeNeedle) {
  87069. $i += $str->length();
  87070. }
  87071. return $this->slice(0, $i);
  87072. }
  87073. public function beforeLast($needle, bool $includeNeedle = false, int $offset = 0): self
  87074. {
  87075. $str = clone $this;
  87076. $i = null;
  87077. foreach ((array) $needle as $n) {
  87078. $n = (string) $n;
  87079. $j = $this->indexOfLast($n, $offset);
  87080. if (null !== $j && $j >= $i) {
  87081. $i = $offset = $j;
  87082. $str->string = $n;
  87083. }
  87084. }
  87085. if (null === $i) {
  87086. return $str;
  87087. }
  87088. if ($includeNeedle) {
  87089. $i += $str->length();
  87090. }
  87091. return $this->slice(0, $i);
  87092. }
  87093. public function bytesAt(int $offset): array
  87094. {
  87095. $str = $this->slice($offset, 1);
  87096. return '' === $str->string ? [] : array_values(unpack('C*', $str->string));
  87097. }
  87098. abstract public function camel(): self;
  87099. abstract public function chunk(int $length = 1): array;
  87100. public function collapseWhitespace(): self
  87101. {
  87102. $str = clone $this;
  87103. $str->string = trim(preg_replace("/(?:[ \n\r\t\x0C]{2,}+|[\n\r\t\x0C])/", ' ', $str->string), " \n\r\t\x0C");
  87104. return $str;
  87105. }
  87106. public function containsAny($needle): bool
  87107. {
  87108. return null !== $this->indexOf($needle);
  87109. }
  87110. public function endsWith($suffix): bool
  87111. {
  87112. if (!\is_array($suffix) && !$suffix instanceof \Traversable) {
  87113. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  87114. }
  87115. foreach ($suffix as $s) {
  87116. if ($this->endsWith((string) $s)) {
  87117. return true;
  87118. }
  87119. }
  87120. return false;
  87121. }
  87122. public function ensureEnd(string $suffix): self
  87123. {
  87124. if (!$this->endsWith($suffix)) {
  87125. return $this->append($suffix);
  87126. }
  87127. $suffix = preg_quote($suffix);
  87128. $regex = '{('.$suffix.')(?:'.$suffix.')++$}D';
  87129. return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1');
  87130. }
  87131. public function ensureStart(string $prefix): self
  87132. {
  87133. $prefix = new static($prefix);
  87134. if (!$this->startsWith($prefix)) {
  87135. return $this->prepend($prefix);
  87136. }
  87137. $str = clone $this;
  87138. $i = $prefixLen = $prefix->length();
  87139. while ($this->indexOf($prefix, $i) === $i) {
  87140. $str = $str->slice($prefixLen);
  87141. $i += $prefixLen;
  87142. }
  87143. return $str;
  87144. }
  87145. public function equalsTo($string): bool
  87146. {
  87147. if (!\is_array($string) && !$string instanceof \Traversable) {
  87148. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  87149. }
  87150. foreach ($string as $s) {
  87151. if ($this->equalsTo((string) $s)) {
  87152. return true;
  87153. }
  87154. }
  87155. return false;
  87156. }
  87157. abstract public function folded(): self;
  87158. public function ignoreCase(): self
  87159. {
  87160. $str = clone $this;
  87161. $str->ignoreCase = true;
  87162. return $str;
  87163. }
  87164. public function indexOf($needle, int $offset = 0): ?int
  87165. {
  87166. if (!\is_array($needle) && !$needle instanceof \Traversable) {
  87167. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  87168. }
  87169. $i = \PHP_INT_MAX;
  87170. foreach ($needle as $n) {
  87171. $j = $this->indexOf((string) $n, $offset);
  87172. if (null !== $j && $j < $i) {
  87173. $i = $j;
  87174. }
  87175. }
  87176. return \PHP_INT_MAX === $i ? null : $i;
  87177. }
  87178. public function indexOfLast($needle, int $offset = 0): ?int
  87179. {
  87180. if (!\is_array($needle) && !$needle instanceof \Traversable) {
  87181. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  87182. }
  87183. $i = null;
  87184. foreach ($needle as $n) {
  87185. $j = $this->indexOfLast((string) $n, $offset);
  87186. if (null !== $j && $j >= $i) {
  87187. $i = $offset = $j;
  87188. }
  87189. }
  87190. return $i;
  87191. }
  87192. public function isEmpty(): bool
  87193. {
  87194. return '' === $this->string;
  87195. }
  87196. abstract public function join(array $strings, ?string $lastGlue = null): self;
  87197. public function jsonSerialize(): string
  87198. {
  87199. return $this->string;
  87200. }
  87201. abstract public function length(): int;
  87202. abstract public function lower(): self;
  87203. abstract public function match(string $regexp, int $flags = 0, int $offset = 0): array;
  87204. abstract public function padBoth(int $length, string $padStr = ' '): self;
  87205. abstract public function padEnd(int $length, string $padStr = ' '): self;
  87206. abstract public function padStart(int $length, string $padStr = ' '): self;
  87207. abstract public function prepend(string ...$prefix): self;
  87208. public function repeat(int $multiplier): self
  87209. {
  87210. if (0 > $multiplier) {
  87211. throw new InvalidArgumentException(sprintf('Multiplier must be positive, %d given.', $multiplier));
  87212. }
  87213. $str = clone $this;
  87214. $str->string = str_repeat($str->string, $multiplier);
  87215. return $str;
  87216. }
  87217. abstract public function replace(string $from, string $to): self;
  87218. abstract public function replaceMatches(string $fromRegexp, $to): self;
  87219. abstract public function reverse(): self;
  87220. abstract public function slice(int $start = 0, ?int $length = null): self;
  87221. abstract public function snake(): self;
  87222. abstract public function splice(string $replacement, int $start = 0, ?int $length = null): self;
  87223. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  87224. {
  87225. if (null === $flags) {
  87226. throw new \TypeError('Split behavior when $flags is null must be implemented by child classes.');
  87227. }
  87228. if ($this->ignoreCase) {
  87229. $delimiter .= 'i';
  87230. }
  87231. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  87232. try {
  87233. if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) {
  87234. $lastError = preg_last_error();
  87235. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  87236. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  87237. throw new RuntimeException('Splitting failed with '.$k.'.');
  87238. }
  87239. }
  87240. throw new RuntimeException('Splitting failed with unknown error code.');
  87241. }
  87242. } finally {
  87243. restore_error_handler();
  87244. }
  87245. $str = clone $this;
  87246. if (self::PREG_SPLIT_OFFSET_CAPTURE & $flags) {
  87247. foreach ($chunks as &$chunk) {
  87248. $str->string = $chunk[0];
  87249. $chunk[0] = clone $str;
  87250. }
  87251. } else {
  87252. foreach ($chunks as &$chunk) {
  87253. $str->string = $chunk;
  87254. $chunk = clone $str;
  87255. }
  87256. }
  87257. return $chunks;
  87258. }
  87259. public function startsWith($prefix): bool
  87260. {
  87261. if (!\is_array($prefix) && !$prefix instanceof \Traversable) {
  87262. throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
  87263. }
  87264. foreach ($prefix as $prefix) {
  87265. if ($this->startsWith((string) $prefix)) {
  87266. return true;
  87267. }
  87268. }
  87269. return false;
  87270. }
  87271. abstract public function title(bool $allWords = false): self;
  87272. public function toByteString(?string $toEncoding = null): ByteString
  87273. {
  87274. $b = new ByteString();
  87275. $toEncoding = \in_array($toEncoding, ['utf8', 'utf-8', 'UTF8'], true) ? 'UTF-8' : $toEncoding;
  87276. if (null === $toEncoding || $toEncoding === $fromEncoding = $this instanceof AbstractUnicodeString || preg_match('//u', $b->string) ? 'UTF-8' : 'Windows-1252') {
  87277. $b->string = $this->string;
  87278. return $b;
  87279. }
  87280. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  87281. try {
  87282. try {
  87283. $b->string = mb_convert_encoding($this->string, $toEncoding, 'UTF-8');
  87284. } catch (InvalidArgumentException|\ValueError $e) {
  87285. if (!\function_exists('iconv')) {
  87286. if ($e instanceof \ValueError) {
  87287. throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
  87288. }
  87289. throw $e;
  87290. }
  87291. $b->string = iconv('UTF-8', $toEncoding, $this->string);
  87292. }
  87293. } finally {
  87294. restore_error_handler();
  87295. }
  87296. return $b;
  87297. }
  87298. public function toCodePointString(): CodePointString
  87299. {
  87300. return new CodePointString($this->string);
  87301. }
  87302. public function toString(): string
  87303. {
  87304. return $this->string;
  87305. }
  87306. public function toUnicodeString(): UnicodeString
  87307. {
  87308. return new UnicodeString($this->string);
  87309. }
  87310. abstract public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  87311. abstract public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  87312. public function trimPrefix($prefix): self
  87313. {
  87314. if (\is_array($prefix) || $prefix instanceof \Traversable) {
  87315. foreach ($prefix as $s) {
  87316. $t = $this->trimPrefix($s);
  87317. if ($t->string !== $this->string) {
  87318. return $t;
  87319. }
  87320. }
  87321. return clone $this;
  87322. }
  87323. $str = clone $this;
  87324. if ($prefix instanceof self) {
  87325. $prefix = $prefix->string;
  87326. } else {
  87327. $prefix = (string) $prefix;
  87328. }
  87329. if ('' !== $prefix && \strlen($this->string) >= \strlen($prefix) && 0 === substr_compare($this->string, $prefix, 0, \strlen($prefix), $this->ignoreCase)) {
  87330. $str->string = substr($this->string, \strlen($prefix));
  87331. }
  87332. return $str;
  87333. }
  87334. abstract public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): self;
  87335. public function trimSuffix($suffix): self
  87336. {
  87337. if (\is_array($suffix) || $suffix instanceof \Traversable) {
  87338. foreach ($suffix as $s) {
  87339. $t = $this->trimSuffix($s);
  87340. if ($t->string !== $this->string) {
  87341. return $t;
  87342. }
  87343. }
  87344. return clone $this;
  87345. }
  87346. $str = clone $this;
  87347. if ($suffix instanceof self) {
  87348. $suffix = $suffix->string;
  87349. } else {
  87350. $suffix = (string) $suffix;
  87351. }
  87352. if ('' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase)) {
  87353. $str->string = substr($this->string, 0, -\strlen($suffix));
  87354. }
  87355. return $str;
  87356. }
  87357. public function truncate(int $length, string $ellipsis = '', bool $cut = true): self
  87358. {
  87359. $stringLength = $this->length();
  87360. if ($stringLength <= $length) {
  87361. return clone $this;
  87362. }
  87363. $ellipsisLength = '' !== $ellipsis ? (new static($ellipsis))->length() : 0;
  87364. if ($length < $ellipsisLength) {
  87365. $ellipsisLength = 0;
  87366. }
  87367. if (!$cut) {
  87368. if (null === $length = $this->indexOf([' ', "\r", "\n", "\t"], ($length ?: 1) - 1)) {
  87369. return clone $this;
  87370. }
  87371. $length += $ellipsisLength;
  87372. }
  87373. $str = $this->slice(0, $length - $ellipsisLength);
  87374. return $ellipsisLength ? $str->trimEnd()->append($ellipsis) : $str;
  87375. }
  87376. abstract public function upper(): self;
  87377. abstract public function width(bool $ignoreAnsiDecoration = true): int;
  87378. public function wordwrap(int $width = 75, string $break = "\n", bool $cut = false): self
  87379. {
  87380. $lines = '' !== $break ? $this->split($break) : [clone $this];
  87381. $chars = [];
  87382. $mask = '';
  87383. if (1 === \count($lines) && '' === $lines[0]->string) {
  87384. return $lines[0];
  87385. }
  87386. foreach ($lines as $i => $line) {
  87387. if ($i) {
  87388. $chars[] = $break;
  87389. $mask .= '#';
  87390. }
  87391. foreach ($line->chunk() as $char) {
  87392. $chars[] = $char->string;
  87393. $mask .= ' ' === $char->string ? ' ' : '?';
  87394. }
  87395. }
  87396. $string = '';
  87397. $j = 0;
  87398. $b = $i = -1;
  87399. $mask = wordwrap($mask, $width, '#', $cut);
  87400. while (false !== $b = strpos($mask, '#', $b + 1)) {
  87401. for (++$i; $i < $b; ++$i) {
  87402. $string .= $chars[$j];
  87403. unset($chars[$j++]);
  87404. }
  87405. if ($break === $chars[$j] || ' ' === $chars[$j]) {
  87406. unset($chars[$j++]);
  87407. }
  87408. $string .= $break;
  87409. }
  87410. $str = clone $this;
  87411. $str->string = $string.implode('', $chars);
  87412. return $str;
  87413. }
  87414. public function __sleep(): array
  87415. {
  87416. return ['string'];
  87417. }
  87418. public function __clone()
  87419. {
  87420. $this->ignoreCase = false;
  87421. }
  87422. public function __toString(): string
  87423. {
  87424. return $this->string;
  87425. }
  87426. }
  87427. <?php
  87428. namespace Symfony\Component\String;
  87429. use Symfony\Component\String\Exception\ExceptionInterface;
  87430. use Symfony\Component\String\Exception\InvalidArgumentException;
  87431. use Symfony\Component\String\Exception\RuntimeException;
  87432. abstract class AbstractUnicodeString extends AbstractString
  87433. {
  87434. public const NFC = \Normalizer::NFC;
  87435. public const NFD = \Normalizer::NFD;
  87436. public const NFKC = \Normalizer::NFKC;
  87437. public const NFKD = \Normalizer::NFKD;
  87438. private const ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
  87439. private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', '�', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'ʼn', 'ǰ', '�', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', '�', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', '�', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', '�', 'ᾎ', '�', '�', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', '�', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', '�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ'];
  87440. private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', 'ṡ', 'ι', 'ss', 'ʼn', 'ǰ', '�', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', '�', 'ὒ', 'ὔ', 'ὖ', 'ἀι', '�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', '�ι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ'];
  87441. private const UPPER_FROM = ['ß', 'ff', '�', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', '�', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', '�', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ'];
  87442. private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ�', 'Ϋ�', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓�', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ�', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ�', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂'];
  87443. private const TRANSLIT_FROM = ['Æ', '�', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', '�', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', '�', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', '�', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', '�', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', '�', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', '�', 'Ɏ', '�', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', '�', '�', 'ʑ', 'ʙ', 'ʛ', 'ʜ', '�', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', '�', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', '�', '�', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', '�', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', '�', 'ᶎ', '�', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', '�', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '�', '�', '�', '�', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '�', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '�', '„', '‟', '′', '″', '�', '〞', '«', '»', '‹', '›', '�', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '�', '�', '�', '�', '�', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '�', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆'];
  87444. private const TRANSLIT_TO = ['AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))'];
  87445. private static $transliterators = [];
  87446. private static $tableZero;
  87447. private static $tableWide;
  87448. public static function fromCodePoints(int ...$codes): self
  87449. {
  87450. $string = '';
  87451. foreach ($codes as $code) {
  87452. if (0x80 > $code %= 0x200000) {
  87453. $string .= \chr($code);
  87454. } elseif (0x800 > $code) {
  87455. $string .= \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  87456. } elseif (0x10000 > $code) {
  87457. $string .= \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  87458. } else {
  87459. $string .= \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  87460. }
  87461. }
  87462. return new static($string);
  87463. }
  87464. public function ascii(array $rules = []): self
  87465. {
  87466. $str = clone $this;
  87467. $s = $str->string;
  87468. $str->string = '';
  87469. array_unshift($rules, 'nfd');
  87470. $rules[] = 'latin-ascii';
  87471. if (\function_exists('transliterator_transliterate')) {
  87472. $rules[] = 'any-latin/bgn';
  87473. }
  87474. $rules[] = 'nfkd';
  87475. $rules[] = '[:nonspacing mark:] remove';
  87476. while (\strlen($s) - 1 > $i = strspn($s, self::ASCII)) {
  87477. if (0 < --$i) {
  87478. $str->string .= substr($s, 0, $i);
  87479. $s = substr($s, $i);
  87480. }
  87481. if (!$rule = array_shift($rules)) {
  87482. $rules = [];
  87483. }
  87484. if ($rule instanceof \Transliterator) {
  87485. $s = $rule->transliterate($s);
  87486. } elseif ($rule instanceof \Closure) {
  87487. $s = $rule($s);
  87488. } elseif ($rule) {
  87489. if ('nfd' === $rule = strtolower($rule)) {
  87490. normalizer_is_normalized($s, self::NFD) ?: $s = normalizer_normalize($s, self::NFD);
  87491. } elseif ('nfkd' === $rule) {
  87492. normalizer_is_normalized($s, self::NFKD) ?: $s = normalizer_normalize($s, self::NFKD);
  87493. } elseif ('[:nonspacing mark:] remove' === $rule) {
  87494. $s = preg_replace('/\p{Mn}++/u', '', $s);
  87495. } elseif ('latin-ascii' === $rule) {
  87496. $s = str_replace(self::TRANSLIT_FROM, self::TRANSLIT_TO, $s);
  87497. } elseif ('de-ascii' === $rule) {
  87498. $s = preg_replace("/([AUO])\u{0308}(?=\p{Ll})/u", '$1e', $s);
  87499. $s = str_replace(["a\u{0308}", "o\u{0308}", "u\u{0308}", "A\u{0308}", "O\u{0308}", "U\u{0308}"], ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'], $s);
  87500. } elseif (\function_exists('transliterator_transliterate')) {
  87501. if (null === $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule)) {
  87502. if ('any-latin/bgn' === $rule) {
  87503. $rule = 'any-latin';
  87504. $transliterator = self::$transliterators[$rule] ?? self::$transliterators[$rule] = \Transliterator::create($rule);
  87505. }
  87506. if (null === $transliterator) {
  87507. throw new InvalidArgumentException(sprintf('Unknown transliteration rule "%s".', $rule));
  87508. }
  87509. self::$transliterators['any-latin/bgn'] = $transliterator;
  87510. }
  87511. $s = $transliterator->transliterate($s);
  87512. }
  87513. } elseif (!\function_exists('iconv')) {
  87514. $s = preg_replace('/[^\x00-\x7F]/u', '?', $s);
  87515. } else {
  87516. $s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
  87517. $c = (string) iconv('UTF-8', 'ASCII//TRANSLIT', $c[0]);
  87518. if ('' === $c && '' === iconv('UTF-8', 'ASCII//TRANSLIT', '²')) {
  87519. throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class));
  87520. }
  87521. return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : ('' !== $c ? $c : '?');
  87522. }, $s);
  87523. }
  87524. }
  87525. $str->string .= $s;
  87526. return $str;
  87527. }
  87528. public function camel(): parent
  87529. {
  87530. $str = clone $this;
  87531. $str->string = str_replace(' ', '', preg_replace_callback('/\b.(?!\p{Lu})/u', static function ($m) use (&$i) {
  87532. return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
  87533. }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string)));
  87534. return $str;
  87535. }
  87536. public function codePointsAt(int $offset): array
  87537. {
  87538. $str = $this->slice($offset, 1);
  87539. if ('' === $str->string) {
  87540. return [];
  87541. }
  87542. $codePoints = [];
  87543. foreach (preg_split('//u', $str->string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
  87544. $codePoints[] = mb_ord($c, 'UTF-8');
  87545. }
  87546. return $codePoints;
  87547. }
  87548. public function folded(bool $compat = true): parent
  87549. {
  87550. $str = clone $this;
  87551. if (!$compat || \PHP_VERSION_ID < 70300 || !\defined('Normalizer::NFKC_CF')) {
  87552. $str->string = normalizer_normalize($str->string, $compat ? \Normalizer::NFKC : \Normalizer::NFC);
  87553. $str->string = mb_strtolower(str_replace(self::FOLD_FROM, self::FOLD_TO, $str->string), 'UTF-8');
  87554. } else {
  87555. $str->string = normalizer_normalize($str->string, \Normalizer::NFKC_CF);
  87556. }
  87557. return $str;
  87558. }
  87559. public function join(array $strings, ?string $lastGlue = null): parent
  87560. {
  87561. $str = clone $this;
  87562. $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
  87563. $str->string = implode($this->string, $strings).$tail;
  87564. if (!preg_match('//u', $str->string)) {
  87565. throw new InvalidArgumentException('Invalid UTF-8 string.');
  87566. }
  87567. return $str;
  87568. }
  87569. public function lower(): parent
  87570. {
  87571. $str = clone $this;
  87572. $str->string = mb_strtolower(str_replace('İ', 'i̇', $str->string), 'UTF-8');
  87573. return $str;
  87574. }
  87575. public function match(string $regexp, int $flags = 0, int $offset = 0): array
  87576. {
  87577. $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
  87578. if ($this->ignoreCase) {
  87579. $regexp .= 'i';
  87580. }
  87581. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  87582. try {
  87583. if (false === $match($regexp.'u', $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
  87584. $lastError = preg_last_error();
  87585. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  87586. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  87587. throw new RuntimeException('Matching failed with '.$k.'.');
  87588. }
  87589. }
  87590. throw new RuntimeException('Matching failed with unknown error code.');
  87591. }
  87592. } finally {
  87593. restore_error_handler();
  87594. }
  87595. return $matches;
  87596. }
  87597. public function normalize(int $form = self::NFC): self
  87598. {
  87599. if (!\in_array($form, [self::NFC, self::NFD, self::NFKC, self::NFKD])) {
  87600. throw new InvalidArgumentException('Unsupported normalization form.');
  87601. }
  87602. $str = clone $this;
  87603. normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
  87604. return $str;
  87605. }
  87606. public function padBoth(int $length, string $padStr = ' '): parent
  87607. {
  87608. if ('' === $padStr || !preg_match('//u', $padStr)) {
  87609. throw new InvalidArgumentException('Invalid UTF-8 string.');
  87610. }
  87611. $pad = clone $this;
  87612. $pad->string = $padStr;
  87613. return $this->pad($length, $pad, \STR_PAD_BOTH);
  87614. }
  87615. public function padEnd(int $length, string $padStr = ' '): parent
  87616. {
  87617. if ('' === $padStr || !preg_match('//u', $padStr)) {
  87618. throw new InvalidArgumentException('Invalid UTF-8 string.');
  87619. }
  87620. $pad = clone $this;
  87621. $pad->string = $padStr;
  87622. return $this->pad($length, $pad, \STR_PAD_RIGHT);
  87623. }
  87624. public function padStart(int $length, string $padStr = ' '): parent
  87625. {
  87626. if ('' === $padStr || !preg_match('//u', $padStr)) {
  87627. throw new InvalidArgumentException('Invalid UTF-8 string.');
  87628. }
  87629. $pad = clone $this;
  87630. $pad->string = $padStr;
  87631. return $this->pad($length, $pad, \STR_PAD_LEFT);
  87632. }
  87633. public function replaceMatches(string $fromRegexp, $to): parent
  87634. {
  87635. if ($this->ignoreCase) {
  87636. $fromRegexp .= 'i';
  87637. }
  87638. if (\is_array($to) || $to instanceof \Closure) {
  87639. if (!\is_callable($to)) {
  87640. throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
  87641. }
  87642. $replace = 'preg_replace_callback';
  87643. $to = static function (array $m) use ($to): string {
  87644. $to = $to($m);
  87645. if ('' !== $to && (!\is_string($to) || !preg_match('//u', $to))) {
  87646. throw new InvalidArgumentException('Replace callback must return a valid UTF-8 string.');
  87647. }
  87648. return $to;
  87649. };
  87650. } elseif ('' !== $to && !preg_match('//u', $to)) {
  87651. throw new InvalidArgumentException('Invalid UTF-8 string.');
  87652. } else {
  87653. $replace = 'preg_replace';
  87654. }
  87655. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  87656. try {
  87657. if (null === $string = $replace($fromRegexp.'u', $to, $this->string)) {
  87658. $lastError = preg_last_error();
  87659. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  87660. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  87661. throw new RuntimeException('Matching failed with '.$k.'.');
  87662. }
  87663. }
  87664. throw new RuntimeException('Matching failed with unknown error code.');
  87665. }
  87666. } finally {
  87667. restore_error_handler();
  87668. }
  87669. $str = clone $this;
  87670. $str->string = $string;
  87671. return $str;
  87672. }
  87673. public function reverse(): parent
  87674. {
  87675. $str = clone $this;
  87676. $str->string = implode('', array_reverse(preg_split('/(\X)/u', $str->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY)));
  87677. return $str;
  87678. }
  87679. public function snake(): parent
  87680. {
  87681. $str = $this->camel();
  87682. $str->string = mb_strtolower(preg_replace(['/(\p{Lu}+)(\p{Lu}\p{Ll})/u', '/([\p{Ll}0-9])(\p{Lu})/u'], '\1_\2', $str->string), 'UTF-8');
  87683. return $str;
  87684. }
  87685. public function title(bool $allWords = false): parent
  87686. {
  87687. $str = clone $this;
  87688. $limit = $allWords ? -1 : 1;
  87689. $str->string = preg_replace_callback('/\b./u', static function (array $m): string {
  87690. return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8');
  87691. }, $str->string, $limit);
  87692. return $str;
  87693. }
  87694. public function trim(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  87695. {
  87696. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  87697. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  87698. }
  87699. $chars = preg_quote($chars);
  87700. $str = clone $this;
  87701. $str->string = preg_replace("{^[$chars]++|[$chars]++$}uD", '', $str->string);
  87702. return $str;
  87703. }
  87704. public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  87705. {
  87706. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  87707. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  87708. }
  87709. $chars = preg_quote($chars);
  87710. $str = clone $this;
  87711. $str->string = preg_replace("{[$chars]++$}uD", '', $str->string);
  87712. return $str;
  87713. }
  87714. public function trimPrefix($prefix): parent
  87715. {
  87716. if (!$this->ignoreCase) {
  87717. return parent::trimPrefix($prefix);
  87718. }
  87719. $str = clone $this;
  87720. if ($prefix instanceof \Traversable) {
  87721. $prefix = iterator_to_array($prefix, false);
  87722. } elseif ($prefix instanceof parent) {
  87723. $prefix = $prefix->string;
  87724. }
  87725. $prefix = implode('|', array_map('preg_quote', (array) $prefix));
  87726. $str->string = preg_replace("{^(?:$prefix)}iuD", '', $this->string);
  87727. return $str;
  87728. }
  87729. public function trimStart(string $chars = " \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}"): parent
  87730. {
  87731. if (" \t\n\r\0\x0B\x0C\u{A0}\u{FEFF}" !== $chars && !preg_match('//u', $chars)) {
  87732. throw new InvalidArgumentException('Invalid UTF-8 chars.');
  87733. }
  87734. $chars = preg_quote($chars);
  87735. $str = clone $this;
  87736. $str->string = preg_replace("{^[$chars]++}uD", '', $str->string);
  87737. return $str;
  87738. }
  87739. public function trimSuffix($suffix): parent
  87740. {
  87741. if (!$this->ignoreCase) {
  87742. return parent::trimSuffix($suffix);
  87743. }
  87744. $str = clone $this;
  87745. if ($suffix instanceof \Traversable) {
  87746. $suffix = iterator_to_array($suffix, false);
  87747. } elseif ($suffix instanceof parent) {
  87748. $suffix = $suffix->string;
  87749. }
  87750. $suffix = implode('|', array_map('preg_quote', (array) $suffix));
  87751. $str->string = preg_replace("{(?:$suffix)$}iuD", '', $this->string);
  87752. return $str;
  87753. }
  87754. public function upper(): parent
  87755. {
  87756. $str = clone $this;
  87757. $str->string = mb_strtoupper($str->string, 'UTF-8');
  87758. if (\PHP_VERSION_ID < 70300) {
  87759. $str->string = str_replace(self::UPPER_FROM, self::UPPER_TO, $str->string);
  87760. }
  87761. return $str;
  87762. }
  87763. public function width(bool $ignoreAnsiDecoration = true): int
  87764. {
  87765. $width = 0;
  87766. $s = str_replace(["\x00", "\x05", "\x07"], '', $this->string);
  87767. if (false !== strpos($s, "\r")) {
  87768. $s = str_replace(["\r\n", "\r"], "\n", $s);
  87769. }
  87770. if (!$ignoreAnsiDecoration) {
  87771. $s = preg_replace('/[\p{Cc}\x7F]++/u', '', $s);
  87772. }
  87773. foreach (explode("\n", $s) as $s) {
  87774. if ($ignoreAnsiDecoration) {
  87775. $s = preg_replace('/(?:\x1B(?:
  87776. \[ [\x30-\x3F]*+ [\x20-\x2F]*+ [\x40-\x7E]
  87777. | [P\]X^_] .*? \x1B\\\\
  87778. | [\x41-\x7E]
  87779. )|[\p{Cc}\x7F]++)/xu', '', $s);
  87780. }
  87781. $lineWidth = $this->wcswidth($s);
  87782. if ($lineWidth > $width) {
  87783. $width = $lineWidth;
  87784. }
  87785. }
  87786. return $width;
  87787. }
  87788. private function pad(int $len, self $pad, int $type): parent
  87789. {
  87790. $sLen = $this->length();
  87791. if ($len <= $sLen) {
  87792. return clone $this;
  87793. }
  87794. $padLen = $pad->length();
  87795. $freeLen = $len - $sLen;
  87796. $len = $freeLen % $padLen;
  87797. switch ($type) {
  87798. case \STR_PAD_RIGHT:
  87799. return $this->append(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  87800. case \STR_PAD_LEFT:
  87801. return $this->prepend(str_repeat($pad->string, intdiv($freeLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  87802. case \STR_PAD_BOTH:
  87803. $freeLen /= 2;
  87804. $rightLen = ceil($freeLen);
  87805. $len = $rightLen % $padLen;
  87806. $str = $this->append(str_repeat($pad->string, intdiv($rightLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  87807. $leftLen = floor($freeLen);
  87808. $len = $leftLen % $padLen;
  87809. return $str->prepend(str_repeat($pad->string, intdiv($leftLen, $padLen)).($len ? $pad->slice(0, $len) : ''));
  87810. default:
  87811. throw new InvalidArgumentException('Invalid padding type.');
  87812. }
  87813. }
  87814. private function wcswidth(string $string): int
  87815. {
  87816. $width = 0;
  87817. foreach (preg_split('//u', $string, -1, \PREG_SPLIT_NO_EMPTY) as $c) {
  87818. $codePoint = mb_ord($c, 'UTF-8');
  87819. if (0 === $codePoint
  87820. || 0x034F === $codePoint
  87821. || (0x200B <= $codePoint && 0x200F >= $codePoint)
  87822. || 0x2028 === $codePoint
  87823. || 0x2029 === $codePoint
  87824. || (0x202A <= $codePoint && 0x202E >= $codePoint)
  87825. || (0x2060 <= $codePoint && 0x2063 >= $codePoint)
  87826. ) {
  87827. continue;
  87828. }
  87829. if (32 > $codePoint
  87830. || (0x07F <= $codePoint && 0x0A0 > $codePoint)
  87831. ) {
  87832. return -1;
  87833. }
  87834. if (null === self::$tableZero) {
  87835. self::$tableZero = require __DIR__.'/Resources/data/wcswidth_table_zero.php';
  87836. }
  87837. if ($codePoint >= self::$tableZero[0][0] && $codePoint <= self::$tableZero[$ubound = \count(self::$tableZero) - 1][1]) {
  87838. $lbound = 0;
  87839. while ($ubound >= $lbound) {
  87840. $mid = floor(($lbound + $ubound) / 2);
  87841. if ($codePoint > self::$tableZero[$mid][1]) {
  87842. $lbound = $mid + 1;
  87843. } elseif ($codePoint < self::$tableZero[$mid][0]) {
  87844. $ubound = $mid - 1;
  87845. } else {
  87846. continue 2;
  87847. }
  87848. }
  87849. }
  87850. if (null === self::$tableWide) {
  87851. self::$tableWide = require __DIR__.'/Resources/data/wcswidth_table_wide.php';
  87852. }
  87853. if ($codePoint >= self::$tableWide[0][0] && $codePoint <= self::$tableWide[$ubound = \count(self::$tableWide) - 1][1]) {
  87854. $lbound = 0;
  87855. while ($ubound >= $lbound) {
  87856. $mid = floor(($lbound + $ubound) / 2);
  87857. if ($codePoint > self::$tableWide[$mid][1]) {
  87858. $lbound = $mid + 1;
  87859. } elseif ($codePoint < self::$tableWide[$mid][0]) {
  87860. $ubound = $mid - 1;
  87861. } else {
  87862. $width += 2;
  87863. continue 2;
  87864. }
  87865. }
  87866. }
  87867. ++$width;
  87868. }
  87869. return $width;
  87870. }
  87871. }
  87872. <?php
  87873. namespace Symfony\Component\String;
  87874. use Symfony\Component\String\Exception\ExceptionInterface;
  87875. use Symfony\Component\String\Exception\InvalidArgumentException;
  87876. use Symfony\Component\String\Exception\RuntimeException;
  87877. class ByteString extends AbstractString
  87878. {
  87879. private const ALPHABET_ALPHANUMERIC = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
  87880. public function __construct(string $string = '')
  87881. {
  87882. $this->string = $string;
  87883. }
  87884. public static function fromRandom(int $length = 16, ?string $alphabet = null): self
  87885. {
  87886. if ($length <= 0) {
  87887. throw new InvalidArgumentException(sprintf('A strictly positive length is expected, "%d" given.', $length));
  87888. }
  87889. $alphabet = $alphabet ?? self::ALPHABET_ALPHANUMERIC;
  87890. $alphabetSize = \strlen($alphabet);
  87891. $bits = (int) ceil(log($alphabetSize, 2.0));
  87892. if ($bits <= 0 || $bits > 56) {
  87893. throw new InvalidArgumentException('The length of the alphabet must in the [2^1, 2^56] range.');
  87894. }
  87895. $ret = '';
  87896. while ($length > 0) {
  87897. $urandomLength = (int) ceil(2 * $length * $bits / 8.0);
  87898. $data = random_bytes($urandomLength);
  87899. $unpackedData = 0;
  87900. $unpackedBits = 0;
  87901. for ($i = 0; $i < $urandomLength && $length > 0; ++$i) {
  87902. $unpackedData = ($unpackedData << 8) | \ord($data[$i]);
  87903. $unpackedBits += 8;
  87904. for (; $unpackedBits >= $bits && $length > 0; $unpackedBits -= $bits) {
  87905. $index = ($unpackedData & ((1 << $bits) - 1));
  87906. $unpackedData >>= $bits;
  87907. if ($index < $alphabetSize) {
  87908. $ret .= $alphabet[$index];
  87909. --$length;
  87910. }
  87911. }
  87912. }
  87913. }
  87914. return new static($ret);
  87915. }
  87916. public function bytesAt(int $offset): array
  87917. {
  87918. $str = $this->string[$offset] ?? '';
  87919. return '' === $str ? [] : [\ord($str)];
  87920. }
  87921. public function append(string ...$suffix): parent
  87922. {
  87923. $str = clone $this;
  87924. $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
  87925. return $str;
  87926. }
  87927. public function camel(): parent
  87928. {
  87929. $str = clone $this;
  87930. $parts = explode(' ', trim(ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $this->string))));
  87931. $parts[0] = 1 !== \strlen($parts[0]) && ctype_upper($parts[0]) ? $parts[0] : lcfirst($parts[0]);
  87932. $str->string = implode('', $parts);
  87933. return $str;
  87934. }
  87935. public function chunk(int $length = 1): array
  87936. {
  87937. if (1 > $length) {
  87938. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  87939. }
  87940. if ('' === $this->string) {
  87941. return [];
  87942. }
  87943. $str = clone $this;
  87944. $chunks = [];
  87945. foreach (str_split($this->string, $length) as $chunk) {
  87946. $str->string = $chunk;
  87947. $chunks[] = clone $str;
  87948. }
  87949. return $chunks;
  87950. }
  87951. public function endsWith($suffix): bool
  87952. {
  87953. if ($suffix instanceof parent) {
  87954. $suffix = $suffix->string;
  87955. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  87956. return parent::endsWith($suffix);
  87957. } else {
  87958. $suffix = (string) $suffix;
  87959. }
  87960. return '' !== $suffix && \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix), null, $this->ignoreCase);
  87961. }
  87962. public function equalsTo($string): bool
  87963. {
  87964. if ($string instanceof parent) {
  87965. $string = $string->string;
  87966. } elseif (\is_array($string) || $string instanceof \Traversable) {
  87967. return parent::equalsTo($string);
  87968. } else {
  87969. $string = (string) $string;
  87970. }
  87971. if ('' !== $string && $this->ignoreCase) {
  87972. return 0 === strcasecmp($string, $this->string);
  87973. }
  87974. return $string === $this->string;
  87975. }
  87976. public function folded(): parent
  87977. {
  87978. $str = clone $this;
  87979. $str->string = strtolower($str->string);
  87980. return $str;
  87981. }
  87982. public function indexOf($needle, int $offset = 0): ?int
  87983. {
  87984. if ($needle instanceof parent) {
  87985. $needle = $needle->string;
  87986. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  87987. return parent::indexOf($needle, $offset);
  87988. } else {
  87989. $needle = (string) $needle;
  87990. }
  87991. if ('' === $needle) {
  87992. return null;
  87993. }
  87994. $i = $this->ignoreCase ? stripos($this->string, $needle, $offset) : strpos($this->string, $needle, $offset);
  87995. return false === $i ? null : $i;
  87996. }
  87997. public function indexOfLast($needle, int $offset = 0): ?int
  87998. {
  87999. if ($needle instanceof parent) {
  88000. $needle = $needle->string;
  88001. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  88002. return parent::indexOfLast($needle, $offset);
  88003. } else {
  88004. $needle = (string) $needle;
  88005. }
  88006. if ('' === $needle) {
  88007. return null;
  88008. }
  88009. $i = $this->ignoreCase ? strripos($this->string, $needle, $offset) : strrpos($this->string, $needle, $offset);
  88010. return false === $i ? null : $i;
  88011. }
  88012. public function isUtf8(): bool
  88013. {
  88014. return '' === $this->string || preg_match('//u', $this->string);
  88015. }
  88016. public function join(array $strings, ?string $lastGlue = null): parent
  88017. {
  88018. $str = clone $this;
  88019. $tail = null !== $lastGlue && 1 < \count($strings) ? $lastGlue.array_pop($strings) : '';
  88020. $str->string = implode($this->string, $strings).$tail;
  88021. return $str;
  88022. }
  88023. public function length(): int
  88024. {
  88025. return \strlen($this->string);
  88026. }
  88027. public function lower(): parent
  88028. {
  88029. $str = clone $this;
  88030. $str->string = strtolower($str->string);
  88031. return $str;
  88032. }
  88033. public function match(string $regexp, int $flags = 0, int $offset = 0): array
  88034. {
  88035. $match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
  88036. if ($this->ignoreCase) {
  88037. $regexp .= 'i';
  88038. }
  88039. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  88040. try {
  88041. if (false === $match($regexp, $this->string, $matches, $flags | \PREG_UNMATCHED_AS_NULL, $offset)) {
  88042. $lastError = preg_last_error();
  88043. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  88044. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  88045. throw new RuntimeException('Matching failed with '.$k.'.');
  88046. }
  88047. }
  88048. throw new RuntimeException('Matching failed with unknown error code.');
  88049. }
  88050. } finally {
  88051. restore_error_handler();
  88052. }
  88053. return $matches;
  88054. }
  88055. public function padBoth(int $length, string $padStr = ' '): parent
  88056. {
  88057. $str = clone $this;
  88058. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_BOTH);
  88059. return $str;
  88060. }
  88061. public function padEnd(int $length, string $padStr = ' '): parent
  88062. {
  88063. $str = clone $this;
  88064. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_RIGHT);
  88065. return $str;
  88066. }
  88067. public function padStart(int $length, string $padStr = ' '): parent
  88068. {
  88069. $str = clone $this;
  88070. $str->string = str_pad($this->string, $length, $padStr, \STR_PAD_LEFT);
  88071. return $str;
  88072. }
  88073. public function prepend(string ...$prefix): parent
  88074. {
  88075. $str = clone $this;
  88076. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$str->string;
  88077. return $str;
  88078. }
  88079. public function replace(string $from, string $to): parent
  88080. {
  88081. $str = clone $this;
  88082. if ('' !== $from) {
  88083. $str->string = $this->ignoreCase ? str_ireplace($from, $to, $this->string) : str_replace($from, $to, $this->string);
  88084. }
  88085. return $str;
  88086. }
  88087. public function replaceMatches(string $fromRegexp, $to): parent
  88088. {
  88089. if ($this->ignoreCase) {
  88090. $fromRegexp .= 'i';
  88091. }
  88092. if (\is_array($to)) {
  88093. if (!\is_callable($to)) {
  88094. throw new \TypeError(sprintf('Argument 2 passed to "%s::replaceMatches()" must be callable, array given.', static::class));
  88095. }
  88096. $replace = 'preg_replace_callback';
  88097. } else {
  88098. $replace = $to instanceof \Closure ? 'preg_replace_callback' : 'preg_replace';
  88099. }
  88100. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  88101. try {
  88102. if (null === $string = $replace($fromRegexp, $to, $this->string)) {
  88103. $lastError = preg_last_error();
  88104. foreach (get_defined_constants(true)['pcre'] as $k => $v) {
  88105. if ($lastError === $v && '_ERROR' === substr($k, -6)) {
  88106. throw new RuntimeException('Matching failed with '.$k.'.');
  88107. }
  88108. }
  88109. throw new RuntimeException('Matching failed with unknown error code.');
  88110. }
  88111. } finally {
  88112. restore_error_handler();
  88113. }
  88114. $str = clone $this;
  88115. $str->string = $string;
  88116. return $str;
  88117. }
  88118. public function reverse(): parent
  88119. {
  88120. $str = clone $this;
  88121. $str->string = strrev($str->string);
  88122. return $str;
  88123. }
  88124. public function slice(int $start = 0, ?int $length = null): parent
  88125. {
  88126. $str = clone $this;
  88127. $str->string = (string) substr($this->string, $start, $length ?? \PHP_INT_MAX);
  88128. return $str;
  88129. }
  88130. public function snake(): parent
  88131. {
  88132. $str = $this->camel();
  88133. $str->string = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $str->string));
  88134. return $str;
  88135. }
  88136. public function splice(string $replacement, int $start = 0, ?int $length = null): parent
  88137. {
  88138. $str = clone $this;
  88139. $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
  88140. return $str;
  88141. }
  88142. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  88143. {
  88144. if (1 > $limit = $limit ?? \PHP_INT_MAX) {
  88145. throw new InvalidArgumentException('Split limit must be a positive integer.');
  88146. }
  88147. if ('' === $delimiter) {
  88148. throw new InvalidArgumentException('Split delimiter is empty.');
  88149. }
  88150. if (null !== $flags) {
  88151. return parent::split($delimiter, $limit, $flags);
  88152. }
  88153. $str = clone $this;
  88154. $chunks = $this->ignoreCase
  88155. ? preg_split('{'.preg_quote($delimiter).'}iD', $this->string, $limit)
  88156. : explode($delimiter, $this->string, $limit);
  88157. foreach ($chunks as &$chunk) {
  88158. $str->string = $chunk;
  88159. $chunk = clone $str;
  88160. }
  88161. return $chunks;
  88162. }
  88163. public function startsWith($prefix): bool
  88164. {
  88165. if ($prefix instanceof parent) {
  88166. $prefix = $prefix->string;
  88167. } elseif (!\is_string($prefix)) {
  88168. return parent::startsWith($prefix);
  88169. }
  88170. return '' !== $prefix && 0 === ($this->ignoreCase ? strncasecmp($this->string, $prefix, \strlen($prefix)) : strncmp($this->string, $prefix, \strlen($prefix)));
  88171. }
  88172. public function title(bool $allWords = false): parent
  88173. {
  88174. $str = clone $this;
  88175. $str->string = $allWords ? ucwords($str->string) : ucfirst($str->string);
  88176. return $str;
  88177. }
  88178. public function toUnicodeString(?string $fromEncoding = null): UnicodeString
  88179. {
  88180. return new UnicodeString($this->toCodePointString($fromEncoding)->string);
  88181. }
  88182. public function toCodePointString(?string $fromEncoding = null): CodePointString
  88183. {
  88184. $u = new CodePointString();
  88185. if (\in_array($fromEncoding, [null, 'utf8', 'utf-8', 'UTF8', 'UTF-8'], true) && preg_match('//u', $this->string)) {
  88186. $u->string = $this->string;
  88187. return $u;
  88188. }
  88189. set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); });
  88190. try {
  88191. try {
  88192. $validEncoding = false !== mb_detect_encoding($this->string, $fromEncoding ?? 'Windows-1252', true);
  88193. } catch (InvalidArgumentException $e) {
  88194. if (!\function_exists('iconv')) {
  88195. throw $e;
  88196. }
  88197. $u->string = iconv($fromEncoding ?? 'Windows-1252', 'UTF-8', $this->string);
  88198. return $u;
  88199. }
  88200. } finally {
  88201. restore_error_handler();
  88202. }
  88203. if (!$validEncoding) {
  88204. throw new InvalidArgumentException(sprintf('Invalid "%s" string.', $fromEncoding ?? 'Windows-1252'));
  88205. }
  88206. $u->string = mb_convert_encoding($this->string, 'UTF-8', $fromEncoding ?? 'Windows-1252');
  88207. return $u;
  88208. }
  88209. public function trim(string $chars = " \t\n\r\0\x0B\x0C"): parent
  88210. {
  88211. $str = clone $this;
  88212. $str->string = trim($str->string, $chars);
  88213. return $str;
  88214. }
  88215. public function trimEnd(string $chars = " \t\n\r\0\x0B\x0C"): parent
  88216. {
  88217. $str = clone $this;
  88218. $str->string = rtrim($str->string, $chars);
  88219. return $str;
  88220. }
  88221. public function trimStart(string $chars = " \t\n\r\0\x0B\x0C"): parent
  88222. {
  88223. $str = clone $this;
  88224. $str->string = ltrim($str->string, $chars);
  88225. return $str;
  88226. }
  88227. public function upper(): parent
  88228. {
  88229. $str = clone $this;
  88230. $str->string = strtoupper($str->string);
  88231. return $str;
  88232. }
  88233. public function width(bool $ignoreAnsiDecoration = true): int
  88234. {
  88235. $string = preg_match('//u', $this->string) ? $this->string : preg_replace('/[\x80-\xFF]/', '?', $this->string);
  88236. return (new CodePointString($string))->width($ignoreAnsiDecoration);
  88237. }
  88238. }
  88239. <?php
  88240. namespace Symfony\Component\String;
  88241. use Symfony\Component\String\Exception\ExceptionInterface;
  88242. use Symfony\Component\String\Exception\InvalidArgumentException;
  88243. class CodePointString extends AbstractUnicodeString
  88244. {
  88245. public function __construct(string $string = '')
  88246. {
  88247. if ('' !== $string && !preg_match('//u', $string)) {
  88248. throw new InvalidArgumentException('Invalid UTF-8 string.');
  88249. }
  88250. $this->string = $string;
  88251. }
  88252. public function append(string ...$suffix): AbstractString
  88253. {
  88254. $str = clone $this;
  88255. $str->string .= 1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix);
  88256. if (!preg_match('//u', $str->string)) {
  88257. throw new InvalidArgumentException('Invalid UTF-8 string.');
  88258. }
  88259. return $str;
  88260. }
  88261. public function chunk(int $length = 1): array
  88262. {
  88263. if (1 > $length) {
  88264. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  88265. }
  88266. if ('' === $this->string) {
  88267. return [];
  88268. }
  88269. $rx = '/(';
  88270. while (65535 < $length) {
  88271. $rx .= '.{65535}';
  88272. $length -= 65535;
  88273. }
  88274. $rx .= '.{'.$length.'})/us';
  88275. $str = clone $this;
  88276. $chunks = [];
  88277. foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
  88278. $str->string = $chunk;
  88279. $chunks[] = clone $str;
  88280. }
  88281. return $chunks;
  88282. }
  88283. public function codePointsAt(int $offset): array
  88284. {
  88285. $str = $offset ? $this->slice($offset, 1) : $this;
  88286. return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')];
  88287. }
  88288. public function endsWith($suffix): bool
  88289. {
  88290. if ($suffix instanceof AbstractString) {
  88291. $suffix = $suffix->string;
  88292. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  88293. return parent::endsWith($suffix);
  88294. } else {
  88295. $suffix = (string) $suffix;
  88296. }
  88297. if ('' === $suffix || !preg_match('//u', $suffix)) {
  88298. return false;
  88299. }
  88300. if ($this->ignoreCase) {
  88301. return preg_match('{'.preg_quote($suffix).'$}iuD', $this->string);
  88302. }
  88303. return \strlen($this->string) >= \strlen($suffix) && 0 === substr_compare($this->string, $suffix, -\strlen($suffix));
  88304. }
  88305. public function equalsTo($string): bool
  88306. {
  88307. if ($string instanceof AbstractString) {
  88308. $string = $string->string;
  88309. } elseif (\is_array($string) || $string instanceof \Traversable) {
  88310. return parent::equalsTo($string);
  88311. } else {
  88312. $string = (string) $string;
  88313. }
  88314. if ('' !== $string && $this->ignoreCase) {
  88315. return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
  88316. }
  88317. return $string === $this->string;
  88318. }
  88319. public function indexOf($needle, int $offset = 0): ?int
  88320. {
  88321. if ($needle instanceof AbstractString) {
  88322. $needle = $needle->string;
  88323. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  88324. return parent::indexOf($needle, $offset);
  88325. } else {
  88326. $needle = (string) $needle;
  88327. }
  88328. if ('' === $needle) {
  88329. return null;
  88330. }
  88331. $i = $this->ignoreCase ? mb_stripos($this->string, $needle, $offset, 'UTF-8') : mb_strpos($this->string, $needle, $offset, 'UTF-8');
  88332. return false === $i ? null : $i;
  88333. }
  88334. public function indexOfLast($needle, int $offset = 0): ?int
  88335. {
  88336. if ($needle instanceof AbstractString) {
  88337. $needle = $needle->string;
  88338. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  88339. return parent::indexOfLast($needle, $offset);
  88340. } else {
  88341. $needle = (string) $needle;
  88342. }
  88343. if ('' === $needle) {
  88344. return null;
  88345. }
  88346. $i = $this->ignoreCase ? mb_strripos($this->string, $needle, $offset, 'UTF-8') : mb_strrpos($this->string, $needle, $offset, 'UTF-8');
  88347. return false === $i ? null : $i;
  88348. }
  88349. public function length(): int
  88350. {
  88351. return mb_strlen($this->string, 'UTF-8');
  88352. }
  88353. public function prepend(string ...$prefix): AbstractString
  88354. {
  88355. $str = clone $this;
  88356. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
  88357. if (!preg_match('//u', $str->string)) {
  88358. throw new InvalidArgumentException('Invalid UTF-8 string.');
  88359. }
  88360. return $str;
  88361. }
  88362. public function replace(string $from, string $to): AbstractString
  88363. {
  88364. $str = clone $this;
  88365. if ('' === $from || !preg_match('//u', $from)) {
  88366. return $str;
  88367. }
  88368. if ('' !== $to && !preg_match('//u', $to)) {
  88369. throw new InvalidArgumentException('Invalid UTF-8 string.');
  88370. }
  88371. if ($this->ignoreCase) {
  88372. $str->string = implode($to, preg_split('{'.preg_quote($from).'}iuD', $this->string));
  88373. } else {
  88374. $str->string = str_replace($from, $to, $this->string);
  88375. }
  88376. return $str;
  88377. }
  88378. public function slice(int $start = 0, ?int $length = null): AbstractString
  88379. {
  88380. $str = clone $this;
  88381. $str->string = mb_substr($this->string, $start, $length, 'UTF-8');
  88382. return $str;
  88383. }
  88384. public function splice(string $replacement, int $start = 0, ?int $length = null): AbstractString
  88385. {
  88386. if (!preg_match('//u', $replacement)) {
  88387. throw new InvalidArgumentException('Invalid UTF-8 string.');
  88388. }
  88389. $str = clone $this;
  88390. $start = $start ? \strlen(mb_substr($this->string, 0, $start, 'UTF-8')) : 0;
  88391. $length = $length ? \strlen(mb_substr($this->string, $start, $length, 'UTF-8')) : $length;
  88392. $str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
  88393. return $str;
  88394. }
  88395. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  88396. {
  88397. if (1 > $limit = $limit ?? \PHP_INT_MAX) {
  88398. throw new InvalidArgumentException('Split limit must be a positive integer.');
  88399. }
  88400. if ('' === $delimiter) {
  88401. throw new InvalidArgumentException('Split delimiter is empty.');
  88402. }
  88403. if (null !== $flags) {
  88404. return parent::split($delimiter.'u', $limit, $flags);
  88405. }
  88406. if (!preg_match('//u', $delimiter)) {
  88407. throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
  88408. }
  88409. $str = clone $this;
  88410. $chunks = $this->ignoreCase
  88411. ? preg_split('{'.preg_quote($delimiter).'}iuD', $this->string, $limit)
  88412. : explode($delimiter, $this->string, $limit);
  88413. foreach ($chunks as &$chunk) {
  88414. $str->string = $chunk;
  88415. $chunk = clone $str;
  88416. }
  88417. return $chunks;
  88418. }
  88419. public function startsWith($prefix): bool
  88420. {
  88421. if ($prefix instanceof AbstractString) {
  88422. $prefix = $prefix->string;
  88423. } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
  88424. return parent::startsWith($prefix);
  88425. } else {
  88426. $prefix = (string) $prefix;
  88427. }
  88428. if ('' === $prefix || !preg_match('//u', $prefix)) {
  88429. return false;
  88430. }
  88431. if ($this->ignoreCase) {
  88432. return 0 === mb_stripos($this->string, $prefix, 0, 'UTF-8');
  88433. }
  88434. return 0 === strncmp($this->string, $prefix, \strlen($prefix));
  88435. }
  88436. }
  88437. <?php
  88438. namespace Symfony\Component\String\Exception;
  88439. interface ExceptionInterface extends \Throwable
  88440. {
  88441. }
  88442. <?php
  88443. namespace Symfony\Component\String\Exception;
  88444. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  88445. {
  88446. }
  88447. <?php
  88448. namespace Symfony\Component\String\Exception;
  88449. class RuntimeException extends \RuntimeException implements ExceptionInterface
  88450. {
  88451. }
  88452. <?php
  88453. namespace Symfony\Component\String\Inflector;
  88454. final class EnglishInflector implements InflectorInterface
  88455. {
  88456. private const PLURAL_MAP = [
  88457. ['airetcab', 8, true, true, 'bacterium'],
  88458. ['aroproc', 7, true, true, 'corpus'],
  88459. ['airetirc', 8, true, true, 'criterion'],
  88460. ['alucirruc', 9, true, true, 'curriculum'],
  88461. ['areneg', 6, true, true, 'genus'],
  88462. ['aidem', 5, true, true, 'medium'],
  88463. ['adnaromem', 9, true, true, 'memorandum'],
  88464. ['anemonehp', 9, true, true, 'phenomenon'],
  88465. ['atarts', 6, true, true, 'stratum'],
  88466. ['ea', 2, true, true, 'a'],
  88467. ['secivres', 8, true, true, 'service'],
  88468. ['eci', 3, false, true, 'ouse'],
  88469. ['esee', 4, false, true, 'oose'],
  88470. ['i', 1, true, true, 'us'],
  88471. ['nem', 3, true, true, 'man'],
  88472. ['nerdlihc', 8, true, true, 'child'],
  88473. ['nexo', 4, false, false, 'ox'],
  88474. ['seci', 4, false, true, ['ex', 'ix', 'ice']],
  88475. ['sedoc', 5, false, true, 'code'],
  88476. ['seifles', 7, true, true, 'selfie'],
  88477. ['seibmoz', 7, true, true, 'zombie'],
  88478. ['seivom', 6, true, true, 'movie'],
  88479. ['seman', 5, true, false, 'name'],
  88480. ['sesutcep', 8, true, true, 'pectus'],
  88481. ['teef', 4, true, true, 'foot'],
  88482. ['eseeg', 5, true, true, 'goose'],
  88483. ['hteet', 5, true, true, 'tooth'],
  88484. ['swen', 4, true, true, 'news'],
  88485. ['seires', 6, true, true, 'series'],
  88486. ['sei', 3, false, true, 'y'],
  88487. ['sess', 4, true, false, 'ss'],
  88488. ['sesutats', 8, true, true, 'status'],
  88489. ['sel', 3, true, true, 'le'],
  88490. ['ses', 3, true, true, ['s', 'se', 'sis']],
  88491. ['sevit', 5, true, true, 'tive'],
  88492. ['sevird', 6, false, true, 'drive'],
  88493. ['sevi', 4, false, true, 'ife'],
  88494. ['sevom', 5, true, true, 'move'],
  88495. ['sev', 3, true, true, ['f', 've', 'ff']],
  88496. ['sexa', 4, false, false, ['ax', 'axe', 'axis']],
  88497. ['sex', 3, true, false, 'x'],
  88498. ['sezz', 4, true, false, 'z'],
  88499. ['suae', 4, false, true, 'eau'],
  88500. ['see', 3, true, true, 'ee'],
  88501. ['segd', 4, true, true, 'dge'],
  88502. ['se', 2, true, true, ['', 'e']],
  88503. ['sutats', 6, true, true, 'status'],
  88504. ['s', 1, true, true, ''],
  88505. ['xuae', 4, false, true, 'eau'],
  88506. ['elpoep', 6, true, true, 'person'],
  88507. ];
  88508. private const SINGULAR_MAP = [
  88509. ['sixa', 4, false, false, 'axes'],
  88510. ['airetirc', 8, false, false, 'criterion'],
  88511. ['aluben', 6, false, false, 'nebulae'],
  88512. ['dlihc', 5, true, true, 'children'],
  88513. ['eci', 3, false, true, 'ices'],
  88514. ['ecivres', 7, true, true, 'services'],
  88515. ['efi', 3, false, true, 'ives'],
  88516. ['eifles', 6, true, true, 'selfies'],
  88517. ['eivom', 5, true, true, 'movies'],
  88518. ['esuol', 5, false, true, 'lice'],
  88519. ['esuom', 5, false, true, 'mice'],
  88520. ['esoo', 4, false, true, 'eese'],
  88521. ['es', 2, true, true, 'ses'],
  88522. ['esoog', 5, true, true, 'geese'],
  88523. ['ev', 2, true, true, 'ves'],
  88524. ['evird', 5, false, true, 'drives'],
  88525. ['evit', 4, true, true, 'tives'],
  88526. ['evom', 4, true, true, 'moves'],
  88527. ['ffats', 5, true, true, 'staves'],
  88528. ['ff', 2, true, true, 'ffs'],
  88529. ['f', 1, true, true, ['fs', 'ves']],
  88530. ['hc', 2, true, true, 'ches'],
  88531. ['hs', 2, true, true, 'shes'],
  88532. ['htoot', 5, true, true, 'teeth'],
  88533. ['mubla', 5, true, true, 'albums'],
  88534. ['mu', 2, true, true, 'a'],
  88535. ['nam', 3, true, true, 'men'],
  88536. ['nosrep', 6, true, true, ['persons', 'people']],
  88537. ['noiretirc', 9, true, true, 'criteria'],
  88538. ['nonemonehp', 10, true, true, 'phenomena'],
  88539. ['ohce', 4, true, true, 'echoes'],
  88540. ['oreh', 4, true, true, 'heroes'],
  88541. ['salta', 5, true, true, 'atlases'],
  88542. ['saila', 5, true, true, 'aliases'],
  88543. ['siri', 4, true, true, 'irises'],
  88544. ['sis', 3, true, true, 'ses'],
  88545. ['ss', 2, true, false, 'sses'],
  88546. ['suballys', 8, true, true, 'syllabi'],
  88547. ['sub', 3, true, true, 'buses'],
  88548. ['suc', 3, true, true, 'cuses'],
  88549. ['supmacoppih', 11, false, false, 'hippocampi'],
  88550. ['sup', 3, true, true, 'puses'],
  88551. ['sutats', 6, true, true, ['status', 'statuses']],
  88552. ['sutcep', 6, true, true, 'pectuses'],
  88553. ['su', 2, true, true, 'i'],
  88554. ['swen', 4, true, true, 'news'],
  88555. ['toof', 4, true, true, 'feet'],
  88556. ['uae', 3, false, true, ['eaus', 'eaux']],
  88557. ['xo', 2, false, false, 'oxen'],
  88558. ['xaoh', 4, true, false, 'hoaxes'],
  88559. ['xedni', 5, false, true, ['indicies', 'indexes']],
  88560. ['xaf', 3, true, true, ['faxes', 'faxxes']],
  88561. ['xo', 2, false, true, 'oxes'],
  88562. ['x', 1, true, false, ['ces', 'xes']],
  88563. ['y', 1, false, true, 'ies'],
  88564. ['ziuq', 4, true, false, 'quizzes'],
  88565. ['z', 1, true, true, 'zes'],
  88566. ];
  88567. private const UNINFLECTED = [
  88568. '',
  88569. 'atad',
  88570. 'reed',
  88571. 'tnempiuqe',
  88572. 'kcabdeef',
  88573. 'hsif',
  88574. 'htlaeh',
  88575. 'yrotsih',
  88576. 'ofni',
  88577. 'noitamrofni',
  88578. 'yenom',
  88579. 'esoom',
  88580. 'seires',
  88581. 'peehs',
  88582. 'seiceps',
  88583. 'ciffart',
  88584. 'tfarcria',
  88585. 'erawdrah',
  88586. ];
  88587. public function singularize(string $plural): array
  88588. {
  88589. $pluralRev = strrev($plural);
  88590. $lowerPluralRev = strtolower($pluralRev);
  88591. $pluralLength = \strlen($lowerPluralRev);
  88592. if (\in_array($lowerPluralRev, self::UNINFLECTED, true)) {
  88593. return [$plural];
  88594. }
  88595. foreach (self::PLURAL_MAP as $map) {
  88596. $suffix = $map[0];
  88597. $suffixLength = $map[1];
  88598. $j = 0;
  88599. while ($suffix[$j] === $lowerPluralRev[$j]) {
  88600. ++$j;
  88601. if ($j === $suffixLength) {
  88602. if ($j < $pluralLength) {
  88603. $nextIsVowel = str_contains('aeiou', $lowerPluralRev[$j]);
  88604. if (!$map[2] && $nextIsVowel) {
  88605. break;
  88606. }
  88607. if (!$map[3] && !$nextIsVowel) {
  88608. break;
  88609. }
  88610. }
  88611. $newBase = substr($plural, 0, $pluralLength - $suffixLength);
  88612. $newSuffix = $map[4];
  88613. $firstUpper = ctype_upper($pluralRev[$j - 1]);
  88614. if (\is_array($newSuffix)) {
  88615. $singulars = [];
  88616. foreach ($newSuffix as $newSuffixEntry) {
  88617. $singulars[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
  88618. }
  88619. return $singulars;
  88620. }
  88621. return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
  88622. }
  88623. if ($j === $pluralLength) {
  88624. break;
  88625. }
  88626. }
  88627. }
  88628. return [$plural];
  88629. }
  88630. public function pluralize(string $singular): array
  88631. {
  88632. $singularRev = strrev($singular);
  88633. $lowerSingularRev = strtolower($singularRev);
  88634. $singularLength = \strlen($lowerSingularRev);
  88635. if (\in_array($lowerSingularRev, self::UNINFLECTED, true)) {
  88636. return [$singular];
  88637. }
  88638. foreach (self::SINGULAR_MAP as $map) {
  88639. $suffix = $map[0];
  88640. $suffixLength = $map[1];
  88641. $j = 0;
  88642. while ($suffix[$j] === $lowerSingularRev[$j]) {
  88643. ++$j;
  88644. if ($j === $suffixLength) {
  88645. if ($j < $singularLength) {
  88646. $nextIsVowel = str_contains('aeiou', $lowerSingularRev[$j]);
  88647. if (!$map[2] && $nextIsVowel) {
  88648. break;
  88649. }
  88650. if (!$map[3] && !$nextIsVowel) {
  88651. break;
  88652. }
  88653. }
  88654. $newBase = substr($singular, 0, $singularLength - $suffixLength);
  88655. $newSuffix = $map[4];
  88656. $firstUpper = ctype_upper($singularRev[$j - 1]);
  88657. if (\is_array($newSuffix)) {
  88658. $plurals = [];
  88659. foreach ($newSuffix as $newSuffixEntry) {
  88660. $plurals[] = $newBase.($firstUpper ? ucfirst($newSuffixEntry) : $newSuffixEntry);
  88661. }
  88662. return $plurals;
  88663. }
  88664. return [$newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix)];
  88665. }
  88666. if ($j === $singularLength) {
  88667. break;
  88668. }
  88669. }
  88670. }
  88671. return [$singular.'s'];
  88672. }
  88673. }
  88674. <?php
  88675. namespace Symfony\Component\String\Inflector;
  88676. final class FrenchInflector implements InflectorInterface
  88677. {
  88678. private const PLURALIZE_REGEXP = [
  88679. ['/(s|x|z)$/i', '\1'],
  88680. ['/(eau)$/i', '\1x'],
  88681. ['/^(landau)$/i', '\1s'],
  88682. ['/(au)$/i', '\1x'],
  88683. ['/^(pneu|bleu|émeu)$/i', '\1s'],
  88684. ['/(eu)$/i', '\1x'],
  88685. ['/^(bal|carnaval|caracal|chacal|choral|corral|étal|festival|récital|val)$/i', '\1s'],
  88686. ['/al$/i', '\1aux'],
  88687. ['/^(aspir|b|cor|ém|ferm|soupir|trav|vant|vitr)ail$/i', '\1aux'],
  88688. ['/^(bij|caill|ch|gen|hib|jouj|p)ou$/i', '\1oux'],
  88689. ['/^(cinquante|soixante|mille)$/i', '\1'],
  88690. ['/^(mon|ma)(sieur|dame|demoiselle|seigneur)$/', 'mes\2s'],
  88691. ['/^(Mon|Ma)(sieur|dame|demoiselle|seigneur)$/', 'Mes\2s'],
  88692. ];
  88693. private const SINGULARIZE_REGEXP = [
  88694. ['/((aspir|b|cor|ém|ferm|soupir|trav|vant|vitr))aux$/i', '\1ail'],
  88695. ['/(eau)x$/i', '\1'],
  88696. ['/(amir|anim|arsen|boc|can|capit|capor|chev|crist|génér|hopit|hôpit|idé|journ|littor|loc|m|mét|minér|princip|radic|termin)aux$/i', '\1al'],
  88697. ['/(au)x$/i', '\1'],
  88698. ['/(eu)x$/i', '\1'],
  88699. ['/(bij|caill|ch|gen|hib|jouj|p)oux$/i', '\1ou'],
  88700. ['/^mes(dame|demoiselle)s$/', 'ma\1'],
  88701. ['/^Mes(dame|demoiselle)s$/', 'Ma\1'],
  88702. ['/^mes(sieur|seigneur)s$/', 'mon\1'],
  88703. ['/^Mes(sieur|seigneur)s$/', 'Mon\1'],
  88704. ['/s$/i', ''],
  88705. ];
  88706. private const UNINFLECTED = '/^(abcès|accès|abus|albatros|anchois|anglais|autobus|bois|brebis|carquois|cas|chas|colis|concours|corps|cours|cyprès|décès|devis|discours|dos|embarras|engrais|entrelacs|excès|fils|fois|gâchis|gars|glas|héros|intrus|jars|jus|kermès|lacis|legs|lilas|marais|mars|matelas|mépris|mets|mois|mors|obus|os|palais|paradis|parcours|pardessus|pays|plusieurs|poids|pois|pouls|printemps|processus|progrès|puits|pus|rabais|radis|recors|recours|refus|relais|remords|remous|rictus|rhinocéros|repas|rubis|sans|sas|secours|sens|souris|succès|talus|tapis|tas|taudis|temps|tiers|univers|velours|verglas|vernis|virus)$/i';
  88707. public function singularize(string $plural): array
  88708. {
  88709. if ($this->isInflectedWord($plural)) {
  88710. return [$plural];
  88711. }
  88712. foreach (self::SINGULARIZE_REGEXP as $rule) {
  88713. [$regexp, $replace] = $rule;
  88714. if (1 === preg_match($regexp, $plural)) {
  88715. return [preg_replace($regexp, $replace, $plural)];
  88716. }
  88717. }
  88718. return [$plural];
  88719. }
  88720. public function pluralize(string $singular): array
  88721. {
  88722. if ($this->isInflectedWord($singular)) {
  88723. return [$singular];
  88724. }
  88725. foreach (self::PLURALIZE_REGEXP as $rule) {
  88726. [$regexp, $replace] = $rule;
  88727. if (1 === preg_match($regexp, $singular)) {
  88728. return [preg_replace($regexp, $replace, $singular)];
  88729. }
  88730. }
  88731. return [$singular.'s'];
  88732. }
  88733. private function isInflectedWord(string $word): bool
  88734. {
  88735. return 1 === preg_match(self::UNINFLECTED, $word);
  88736. }
  88737. }
  88738. <?php
  88739. namespace Symfony\Component\String\Inflector;
  88740. interface InflectorInterface
  88741. {
  88742. public function singularize(string $plural): array;
  88743. public function pluralize(string $singular): array;
  88744. }
  88745. Copyright (c) 2019-present Fabien Potencier
  88746. Permission is hereby granted, free of charge, to any person obtaining a copy
  88747. of this software and associated documentation files (the "Software"), to deal
  88748. in the Software without restriction, including without limitation the rights
  88749. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  88750. copies of the Software, and to permit persons to whom the Software is furnished
  88751. to do so, subject to the following conditions:
  88752. The above copyright notice and this permission notice shall be included in all
  88753. copies or substantial portions of the Software.
  88754. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  88755. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  88756. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  88757. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  88758. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  88759. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  88760. THE SOFTWARE.
  88761. <?php
  88762. namespace Symfony\Component\String;
  88763. class LazyString implements \Stringable, \JsonSerializable
  88764. {
  88765. private $value;
  88766. public static function fromCallable($callback, ...$arguments): self
  88767. {
  88768. if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) {
  88769. throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, get_debug_type($callback)));
  88770. }
  88771. $lazyString = new static();
  88772. $lazyString->value = static function () use (&$callback, &$arguments, &$value): string {
  88773. if (null !== $arguments) {
  88774. if (!\is_callable($callback)) {
  88775. $callback[0] = $callback[0]();
  88776. $callback[1] = $callback[1] ?? '__invoke';
  88777. }
  88778. $value = $callback(...$arguments);
  88779. $callback = self::getPrettyName($callback);
  88780. $arguments = null;
  88781. }
  88782. return $value ?? '';
  88783. };
  88784. return $lazyString;
  88785. }
  88786. public static function fromStringable($value): self
  88787. {
  88788. if (!self::isStringable($value)) {
  88789. throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, get_debug_type($value)));
  88790. }
  88791. if (\is_object($value)) {
  88792. return static::fromCallable([$value, '__toString']);
  88793. }
  88794. $lazyString = new static();
  88795. $lazyString->value = (string) $value;
  88796. return $lazyString;
  88797. }
  88798. final public static function isStringable($value): bool
  88799. {
  88800. return \is_string($value) || $value instanceof self || (\is_object($value) ? method_exists($value, '__toString') : \is_scalar($value));
  88801. }
  88802. final public static function resolve($value): string
  88803. {
  88804. return $value;
  88805. }
  88806. public function __toString()
  88807. {
  88808. if (\is_string($this->value)) {
  88809. return $this->value;
  88810. }
  88811. try {
  88812. return $this->value = ($this->value)();
  88813. } catch (\Throwable $e) {
  88814. if (\TypeError::class === \get_class($e) && __FILE__ === $e->getFile()) {
  88815. $type = explode(', ', $e->getMessage());
  88816. $type = substr(array_pop($type), 0, -\strlen(' returned'));
  88817. $r = new \ReflectionFunction($this->value);
  88818. $callback = $r->getStaticVariables()['callback'];
  88819. $e = new \TypeError(sprintf('Return value of %s() passed to %s::fromCallable() must be of the type string, %s returned.', $callback, static::class, $type));
  88820. }
  88821. if (\PHP_VERSION_ID < 70400) {
  88822. return trigger_error($e, \E_USER_ERROR);
  88823. }
  88824. throw $e;
  88825. }
  88826. }
  88827. public function __sleep(): array
  88828. {
  88829. $this->__toString();
  88830. return ['value'];
  88831. }
  88832. public function jsonSerialize(): string
  88833. {
  88834. return $this->__toString();
  88835. }
  88836. private function __construct()
  88837. {
  88838. }
  88839. private static function getPrettyName(callable $callback): string
  88840. {
  88841. if (\is_string($callback)) {
  88842. return $callback;
  88843. }
  88844. if (\is_array($callback)) {
  88845. $class = \is_object($callback[0]) ? get_debug_type($callback[0]) : $callback[0];
  88846. $method = $callback[1];
  88847. } elseif ($callback instanceof \Closure) {
  88848. $r = new \ReflectionFunction($callback);
  88849. if (str_contains($r->name, '{closure') || !$class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) {
  88850. return $r->name;
  88851. }
  88852. $class = $class->name;
  88853. $method = $r->name;
  88854. } else {
  88855. $class = get_debug_type($callback);
  88856. $method = '__invoke';
  88857. }
  88858. return $class.'::'.$method;
  88859. }
  88860. }
  88861. <?php
  88862. return [
  88863. [
  88864. 4352,
  88865. 4447,
  88866. ],
  88867. [
  88868. 8986,
  88869. 8987,
  88870. ],
  88871. [
  88872. 9001,
  88873. 9001,
  88874. ],
  88875. [
  88876. 9002,
  88877. 9002,
  88878. ],
  88879. [
  88880. 9193,
  88881. 9196,
  88882. ],
  88883. [
  88884. 9200,
  88885. 9200,
  88886. ],
  88887. [
  88888. 9203,
  88889. 9203,
  88890. ],
  88891. [
  88892. 9725,
  88893. 9726,
  88894. ],
  88895. [
  88896. 9748,
  88897. 9749,
  88898. ],
  88899. [
  88900. 9776,
  88901. 9783,
  88902. ],
  88903. [
  88904. 9800,
  88905. 9811,
  88906. ],
  88907. [
  88908. 9855,
  88909. 9855,
  88910. ],
  88911. [
  88912. 9866,
  88913. 9871,
  88914. ],
  88915. [
  88916. 9875,
  88917. 9875,
  88918. ],
  88919. [
  88920. 9889,
  88921. 9889,
  88922. ],
  88923. [
  88924. 9898,
  88925. 9899,
  88926. ],
  88927. [
  88928. 9917,
  88929. 9918,
  88930. ],
  88931. [
  88932. 9924,
  88933. 9925,
  88934. ],
  88935. [
  88936. 9934,
  88937. 9934,
  88938. ],
  88939. [
  88940. 9940,
  88941. 9940,
  88942. ],
  88943. [
  88944. 9962,
  88945. 9962,
  88946. ],
  88947. [
  88948. 9970,
  88949. 9971,
  88950. ],
  88951. [
  88952. 9973,
  88953. 9973,
  88954. ],
  88955. [
  88956. 9978,
  88957. 9978,
  88958. ],
  88959. [
  88960. 9981,
  88961. 9981,
  88962. ],
  88963. [
  88964. 9989,
  88965. 9989,
  88966. ],
  88967. [
  88968. 9994,
  88969. 9995,
  88970. ],
  88971. [
  88972. 10024,
  88973. 10024,
  88974. ],
  88975. [
  88976. 10060,
  88977. 10060,
  88978. ],
  88979. [
  88980. 10062,
  88981. 10062,
  88982. ],
  88983. [
  88984. 10067,
  88985. 10069,
  88986. ],
  88987. [
  88988. 10071,
  88989. 10071,
  88990. ],
  88991. [
  88992. 10133,
  88993. 10135,
  88994. ],
  88995. [
  88996. 10160,
  88997. 10160,
  88998. ],
  88999. [
  89000. 10175,
  89001. 10175,
  89002. ],
  89003. [
  89004. 11035,
  89005. 11036,
  89006. ],
  89007. [
  89008. 11088,
  89009. 11088,
  89010. ],
  89011. [
  89012. 11093,
  89013. 11093,
  89014. ],
  89015. [
  89016. 11904,
  89017. 11929,
  89018. ],
  89019. [
  89020. 11931,
  89021. 12019,
  89022. ],
  89023. [
  89024. 12032,
  89025. 12245,
  89026. ],
  89027. [
  89028. 12272,
  89029. 12287,
  89030. ],
  89031. [
  89032. 12288,
  89033. 12288,
  89034. ],
  89035. [
  89036. 12289,
  89037. 12291,
  89038. ],
  89039. [
  89040. 12292,
  89041. 12292,
  89042. ],
  89043. [
  89044. 12293,
  89045. 12293,
  89046. ],
  89047. [
  89048. 12294,
  89049. 12294,
  89050. ],
  89051. [
  89052. 12295,
  89053. 12295,
  89054. ],
  89055. [
  89056. 12296,
  89057. 12296,
  89058. ],
  89059. [
  89060. 12297,
  89061. 12297,
  89062. ],
  89063. [
  89064. 12298,
  89065. 12298,
  89066. ],
  89067. [
  89068. 12299,
  89069. 12299,
  89070. ],
  89071. [
  89072. 12300,
  89073. 12300,
  89074. ],
  89075. [
  89076. 12301,
  89077. 12301,
  89078. ],
  89079. [
  89080. 12302,
  89081. 12302,
  89082. ],
  89083. [
  89084. 12303,
  89085. 12303,
  89086. ],
  89087. [
  89088. 12304,
  89089. 12304,
  89090. ],
  89091. [
  89092. 12305,
  89093. 12305,
  89094. ],
  89095. [
  89096. 12306,
  89097. 12307,
  89098. ],
  89099. [
  89100. 12308,
  89101. 12308,
  89102. ],
  89103. [
  89104. 12309,
  89105. 12309,
  89106. ],
  89107. [
  89108. 12310,
  89109. 12310,
  89110. ],
  89111. [
  89112. 12311,
  89113. 12311,
  89114. ],
  89115. [
  89116. 12312,
  89117. 12312,
  89118. ],
  89119. [
  89120. 12313,
  89121. 12313,
  89122. ],
  89123. [
  89124. 12314,
  89125. 12314,
  89126. ],
  89127. [
  89128. 12315,
  89129. 12315,
  89130. ],
  89131. [
  89132. 12316,
  89133. 12316,
  89134. ],
  89135. [
  89136. 12317,
  89137. 12317,
  89138. ],
  89139. [
  89140. 12318,
  89141. 12319,
  89142. ],
  89143. [
  89144. 12320,
  89145. 12320,
  89146. ],
  89147. [
  89148. 12321,
  89149. 12329,
  89150. ],
  89151. [
  89152. 12330,
  89153. 12333,
  89154. ],
  89155. [
  89156. 12334,
  89157. 12335,
  89158. ],
  89159. [
  89160. 12336,
  89161. 12336,
  89162. ],
  89163. [
  89164. 12337,
  89165. 12341,
  89166. ],
  89167. [
  89168. 12342,
  89169. 12343,
  89170. ],
  89171. [
  89172. 12344,
  89173. 12346,
  89174. ],
  89175. [
  89176. 12347,
  89177. 12347,
  89178. ],
  89179. [
  89180. 12348,
  89181. 12348,
  89182. ],
  89183. [
  89184. 12349,
  89185. 12349,
  89186. ],
  89187. [
  89188. 12350,
  89189. 12350,
  89190. ],
  89191. [
  89192. 12353,
  89193. 12438,
  89194. ],
  89195. [
  89196. 12441,
  89197. 12442,
  89198. ],
  89199. [
  89200. 12443,
  89201. 12444,
  89202. ],
  89203. [
  89204. 12445,
  89205. 12446,
  89206. ],
  89207. [
  89208. 12447,
  89209. 12447,
  89210. ],
  89211. [
  89212. 12448,
  89213. 12448,
  89214. ],
  89215. [
  89216. 12449,
  89217. 12538,
  89218. ],
  89219. [
  89220. 12539,
  89221. 12539,
  89222. ],
  89223. [
  89224. 12540,
  89225. 12542,
  89226. ],
  89227. [
  89228. 12543,
  89229. 12543,
  89230. ],
  89231. [
  89232. 12549,
  89233. 12591,
  89234. ],
  89235. [
  89236. 12593,
  89237. 12686,
  89238. ],
  89239. [
  89240. 12688,
  89241. 12689,
  89242. ],
  89243. [
  89244. 12690,
  89245. 12693,
  89246. ],
  89247. [
  89248. 12694,
  89249. 12703,
  89250. ],
  89251. [
  89252. 12704,
  89253. 12735,
  89254. ],
  89255. [
  89256. 12736,
  89257. 12773,
  89258. ],
  89259. [
  89260. 12783,
  89261. 12783,
  89262. ],
  89263. [
  89264. 12784,
  89265. 12799,
  89266. ],
  89267. [
  89268. 12800,
  89269. 12830,
  89270. ],
  89271. [
  89272. 12832,
  89273. 12841,
  89274. ],
  89275. [
  89276. 12842,
  89277. 12871,
  89278. ],
  89279. [
  89280. 12880,
  89281. 12880,
  89282. ],
  89283. [
  89284. 12881,
  89285. 12895,
  89286. ],
  89287. [
  89288. 12896,
  89289. 12927,
  89290. ],
  89291. [
  89292. 12928,
  89293. 12937,
  89294. ],
  89295. [
  89296. 12938,
  89297. 12976,
  89298. ],
  89299. [
  89300. 12977,
  89301. 12991,
  89302. ],
  89303. [
  89304. 12992,
  89305. 13055,
  89306. ],
  89307. [
  89308. 13056,
  89309. 13311,
  89310. ],
  89311. [
  89312. 13312,
  89313. 19903,
  89314. ],
  89315. [
  89316. 19904,
  89317. 19967,
  89318. ],
  89319. [
  89320. 19968,
  89321. 40959,
  89322. ],
  89323. [
  89324. 40960,
  89325. 40980,
  89326. ],
  89327. [
  89328. 40981,
  89329. 40981,
  89330. ],
  89331. [
  89332. 40982,
  89333. 42124,
  89334. ],
  89335. [
  89336. 42128,
  89337. 42182,
  89338. ],
  89339. [
  89340. 43360,
  89341. 43388,
  89342. ],
  89343. [
  89344. 44032,
  89345. 55203,
  89346. ],
  89347. [
  89348. 63744,
  89349. 64109,
  89350. ],
  89351. [
  89352. 64110,
  89353. 64111,
  89354. ],
  89355. [
  89356. 64112,
  89357. 64217,
  89358. ],
  89359. [
  89360. 64218,
  89361. 64255,
  89362. ],
  89363. [
  89364. 65040,
  89365. 65046,
  89366. ],
  89367. [
  89368. 65047,
  89369. 65047,
  89370. ],
  89371. [
  89372. 65048,
  89373. 65048,
  89374. ],
  89375. [
  89376. 65049,
  89377. 65049,
  89378. ],
  89379. [
  89380. 65072,
  89381. 65072,
  89382. ],
  89383. [
  89384. 65073,
  89385. 65074,
  89386. ],
  89387. [
  89388. 65075,
  89389. 65076,
  89390. ],
  89391. [
  89392. 65077,
  89393. 65077,
  89394. ],
  89395. [
  89396. 65078,
  89397. 65078,
  89398. ],
  89399. [
  89400. 65079,
  89401. 65079,
  89402. ],
  89403. [
  89404. 65080,
  89405. 65080,
  89406. ],
  89407. [
  89408. 65081,
  89409. 65081,
  89410. ],
  89411. [
  89412. 65082,
  89413. 65082,
  89414. ],
  89415. [
  89416. 65083,
  89417. 65083,
  89418. ],
  89419. [
  89420. 65084,
  89421. 65084,
  89422. ],
  89423. [
  89424. 65085,
  89425. 65085,
  89426. ],
  89427. [
  89428. 65086,
  89429. 65086,
  89430. ],
  89431. [
  89432. 65087,
  89433. 65087,
  89434. ],
  89435. [
  89436. 65088,
  89437. 65088,
  89438. ],
  89439. [
  89440. 65089,
  89441. 65089,
  89442. ],
  89443. [
  89444. 65090,
  89445. 65090,
  89446. ],
  89447. [
  89448. 65091,
  89449. 65091,
  89450. ],
  89451. [
  89452. 65092,
  89453. 65092,
  89454. ],
  89455. [
  89456. 65093,
  89457. 65094,
  89458. ],
  89459. [
  89460. 65095,
  89461. 65095,
  89462. ],
  89463. [
  89464. 65096,
  89465. 65096,
  89466. ],
  89467. [
  89468. 65097,
  89469. 65100,
  89470. ],
  89471. [
  89472. 65101,
  89473. 65103,
  89474. ],
  89475. [
  89476. 65104,
  89477. 65106,
  89478. ],
  89479. [
  89480. 65108,
  89481. 65111,
  89482. ],
  89483. [
  89484. 65112,
  89485. 65112,
  89486. ],
  89487. [
  89488. 65113,
  89489. 65113,
  89490. ],
  89491. [
  89492. 65114,
  89493. 65114,
  89494. ],
  89495. [
  89496. 65115,
  89497. 65115,
  89498. ],
  89499. [
  89500. 65116,
  89501. 65116,
  89502. ],
  89503. [
  89504. 65117,
  89505. 65117,
  89506. ],
  89507. [
  89508. 65118,
  89509. 65118,
  89510. ],
  89511. [
  89512. 65119,
  89513. 65121,
  89514. ],
  89515. [
  89516. 65122,
  89517. 65122,
  89518. ],
  89519. [
  89520. 65123,
  89521. 65123,
  89522. ],
  89523. [
  89524. 65124,
  89525. 65126,
  89526. ],
  89527. [
  89528. 65128,
  89529. 65128,
  89530. ],
  89531. [
  89532. 65129,
  89533. 65129,
  89534. ],
  89535. [
  89536. 65130,
  89537. 65131,
  89538. ],
  89539. [
  89540. 65281,
  89541. 65283,
  89542. ],
  89543. [
  89544. 65284,
  89545. 65284,
  89546. ],
  89547. [
  89548. 65285,
  89549. 65287,
  89550. ],
  89551. [
  89552. 65288,
  89553. 65288,
  89554. ],
  89555. [
  89556. 65289,
  89557. 65289,
  89558. ],
  89559. [
  89560. 65290,
  89561. 65290,
  89562. ],
  89563. [
  89564. 65291,
  89565. 65291,
  89566. ],
  89567. [
  89568. 65292,
  89569. 65292,
  89570. ],
  89571. [
  89572. 65293,
  89573. 65293,
  89574. ],
  89575. [
  89576. 65294,
  89577. 65295,
  89578. ],
  89579. [
  89580. 65296,
  89581. 65305,
  89582. ],
  89583. [
  89584. 65306,
  89585. 65307,
  89586. ],
  89587. [
  89588. 65308,
  89589. 65310,
  89590. ],
  89591. [
  89592. 65311,
  89593. 65312,
  89594. ],
  89595. [
  89596. 65313,
  89597. 65338,
  89598. ],
  89599. [
  89600. 65339,
  89601. 65339,
  89602. ],
  89603. [
  89604. 65340,
  89605. 65340,
  89606. ],
  89607. [
  89608. 65341,
  89609. 65341,
  89610. ],
  89611. [
  89612. 65342,
  89613. 65342,
  89614. ],
  89615. [
  89616. 65343,
  89617. 65343,
  89618. ],
  89619. [
  89620. 65344,
  89621. 65344,
  89622. ],
  89623. [
  89624. 65345,
  89625. 65370,
  89626. ],
  89627. [
  89628. 65371,
  89629. 65371,
  89630. ],
  89631. [
  89632. 65372,
  89633. 65372,
  89634. ],
  89635. [
  89636. 65373,
  89637. 65373,
  89638. ],
  89639. [
  89640. 65374,
  89641. 65374,
  89642. ],
  89643. [
  89644. 65375,
  89645. 65375,
  89646. ],
  89647. [
  89648. 65376,
  89649. 65376,
  89650. ],
  89651. [
  89652. 65504,
  89653. 65505,
  89654. ],
  89655. [
  89656. 65506,
  89657. 65506,
  89658. ],
  89659. [
  89660. 65507,
  89661. 65507,
  89662. ],
  89663. [
  89664. 65508,
  89665. 65508,
  89666. ],
  89667. [
  89668. 65509,
  89669. 65510,
  89670. ],
  89671. [
  89672. 94176,
  89673. 94177,
  89674. ],
  89675. [
  89676. 94178,
  89677. 94178,
  89678. ],
  89679. [
  89680. 94179,
  89681. 94179,
  89682. ],
  89683. [
  89684. 94180,
  89685. 94180,
  89686. ],
  89687. [
  89688. 94192,
  89689. 94193,
  89690. ],
  89691. [
  89692. 94208,
  89693. 100343,
  89694. ],
  89695. [
  89696. 100352,
  89697. 101119,
  89698. ],
  89699. [
  89700. 101120,
  89701. 101589,
  89702. ],
  89703. [
  89704. 101631,
  89705. 101631,
  89706. ],
  89707. [
  89708. 101632,
  89709. 101640,
  89710. ],
  89711. [
  89712. 110576,
  89713. 110579,
  89714. ],
  89715. [
  89716. 110581,
  89717. 110587,
  89718. ],
  89719. [
  89720. 110589,
  89721. 110590,
  89722. ],
  89723. [
  89724. 110592,
  89725. 110847,
  89726. ],
  89727. [
  89728. 110848,
  89729. 110882,
  89730. ],
  89731. [
  89732. 110898,
  89733. 110898,
  89734. ],
  89735. [
  89736. 110928,
  89737. 110930,
  89738. ],
  89739. [
  89740. 110933,
  89741. 110933,
  89742. ],
  89743. [
  89744. 110948,
  89745. 110951,
  89746. ],
  89747. [
  89748. 110960,
  89749. 111355,
  89750. ],
  89751. [
  89752. 119552,
  89753. 119638,
  89754. ],
  89755. [
  89756. 119648,
  89757. 119670,
  89758. ],
  89759. [
  89760. 126980,
  89761. 126980,
  89762. ],
  89763. [
  89764. 127183,
  89765. 127183,
  89766. ],
  89767. [
  89768. 127374,
  89769. 127374,
  89770. ],
  89771. [
  89772. 127377,
  89773. 127386,
  89774. ],
  89775. [
  89776. 127488,
  89777. 127490,
  89778. ],
  89779. [
  89780. 127504,
  89781. 127547,
  89782. ],
  89783. [
  89784. 127552,
  89785. 127560,
  89786. ],
  89787. [
  89788. 127568,
  89789. 127569,
  89790. ],
  89791. [
  89792. 127584,
  89793. 127589,
  89794. ],
  89795. [
  89796. 127744,
  89797. 127776,
  89798. ],
  89799. [
  89800. 127789,
  89801. 127797,
  89802. ],
  89803. [
  89804. 127799,
  89805. 127868,
  89806. ],
  89807. [
  89808. 127870,
  89809. 127891,
  89810. ],
  89811. [
  89812. 127904,
  89813. 127946,
  89814. ],
  89815. [
  89816. 127951,
  89817. 127955,
  89818. ],
  89819. [
  89820. 127968,
  89821. 127984,
  89822. ],
  89823. [
  89824. 127988,
  89825. 127988,
  89826. ],
  89827. [
  89828. 127992,
  89829. 127994,
  89830. ],
  89831. [
  89832. 127995,
  89833. 127999,
  89834. ],
  89835. [
  89836. 128000,
  89837. 128062,
  89838. ],
  89839. [
  89840. 128064,
  89841. 128064,
  89842. ],
  89843. [
  89844. 128066,
  89845. 128252,
  89846. ],
  89847. [
  89848. 128255,
  89849. 128317,
  89850. ],
  89851. [
  89852. 128331,
  89853. 128334,
  89854. ],
  89855. [
  89856. 128336,
  89857. 128359,
  89858. ],
  89859. [
  89860. 128378,
  89861. 128378,
  89862. ],
  89863. [
  89864. 128405,
  89865. 128406,
  89866. ],
  89867. [
  89868. 128420,
  89869. 128420,
  89870. ],
  89871. [
  89872. 128507,
  89873. 128511,
  89874. ],
  89875. [
  89876. 128512,
  89877. 128591,
  89878. ],
  89879. [
  89880. 128640,
  89881. 128709,
  89882. ],
  89883. [
  89884. 128716,
  89885. 128716,
  89886. ],
  89887. [
  89888. 128720,
  89889. 128722,
  89890. ],
  89891. [
  89892. 128725,
  89893. 128727,
  89894. ],
  89895. [
  89896. 128732,
  89897. 128735,
  89898. ],
  89899. [
  89900. 128747,
  89901. 128748,
  89902. ],
  89903. [
  89904. 128756,
  89905. 128764,
  89906. ],
  89907. [
  89908. 128992,
  89909. 129003,
  89910. ],
  89911. [
  89912. 129008,
  89913. 129008,
  89914. ],
  89915. [
  89916. 129292,
  89917. 129338,
  89918. ],
  89919. [
  89920. 129340,
  89921. 129349,
  89922. ],
  89923. [
  89924. 129351,
  89925. 129535,
  89926. ],
  89927. [
  89928. 129648,
  89929. 129660,
  89930. ],
  89931. [
  89932. 129664,
  89933. 129673,
  89934. ],
  89935. [
  89936. 129679,
  89937. 129734,
  89938. ],
  89939. [
  89940. 129742,
  89941. 129756,
  89942. ],
  89943. [
  89944. 129759,
  89945. 129769,
  89946. ],
  89947. [
  89948. 129776,
  89949. 129784,
  89950. ],
  89951. [
  89952. 131072,
  89953. 173791,
  89954. ],
  89955. [
  89956. 173792,
  89957. 173823,
  89958. ],
  89959. [
  89960. 173824,
  89961. 177977,
  89962. ],
  89963. [
  89964. 177978,
  89965. 177983,
  89966. ],
  89967. [
  89968. 177984,
  89969. 178205,
  89970. ],
  89971. [
  89972. 178206,
  89973. 178207,
  89974. ],
  89975. [
  89976. 178208,
  89977. 183969,
  89978. ],
  89979. [
  89980. 183970,
  89981. 183983,
  89982. ],
  89983. [
  89984. 183984,
  89985. 191456,
  89986. ],
  89987. [
  89988. 191457,
  89989. 191471,
  89990. ],
  89991. [
  89992. 191472,
  89993. 192093,
  89994. ],
  89995. [
  89996. 192094,
  89997. 194559,
  89998. ],
  89999. [
  90000. 194560,
  90001. 195101,
  90002. ],
  90003. [
  90004. 195102,
  90005. 195103,
  90006. ],
  90007. [
  90008. 195104,
  90009. 196605,
  90010. ],
  90011. [
  90012. 196608,
  90013. 201546,
  90014. ],
  90015. [
  90016. 201547,
  90017. 201551,
  90018. ],
  90019. [
  90020. 201552,
  90021. 205743,
  90022. ],
  90023. [
  90024. 205744,
  90025. 262141,
  90026. ],
  90027. ];
  90028. <?php
  90029. return [
  90030. [
  90031. 768,
  90032. 879,
  90033. ],
  90034. [
  90035. 1155,
  90036. 1159,
  90037. ],
  90038. [
  90039. 1160,
  90040. 1161,
  90041. ],
  90042. [
  90043. 1425,
  90044. 1469,
  90045. ],
  90046. [
  90047. 1471,
  90048. 1471,
  90049. ],
  90050. [
  90051. 1473,
  90052. 1474,
  90053. ],
  90054. [
  90055. 1476,
  90056. 1477,
  90057. ],
  90058. [
  90059. 1479,
  90060. 1479,
  90061. ],
  90062. [
  90063. 1552,
  90064. 1562,
  90065. ],
  90066. [
  90067. 1611,
  90068. 1631,
  90069. ],
  90070. [
  90071. 1648,
  90072. 1648,
  90073. ],
  90074. [
  90075. 1750,
  90076. 1756,
  90077. ],
  90078. [
  90079. 1759,
  90080. 1764,
  90081. ],
  90082. [
  90083. 1767,
  90084. 1768,
  90085. ],
  90086. [
  90087. 1770,
  90088. 1773,
  90089. ],
  90090. [
  90091. 1809,
  90092. 1809,
  90093. ],
  90094. [
  90095. 1840,
  90096. 1866,
  90097. ],
  90098. [
  90099. 1958,
  90100. 1968,
  90101. ],
  90102. [
  90103. 2027,
  90104. 2035,
  90105. ],
  90106. [
  90107. 2045,
  90108. 2045,
  90109. ],
  90110. [
  90111. 2070,
  90112. 2073,
  90113. ],
  90114. [
  90115. 2075,
  90116. 2083,
  90117. ],
  90118. [
  90119. 2085,
  90120. 2087,
  90121. ],
  90122. [
  90123. 2089,
  90124. 2093,
  90125. ],
  90126. [
  90127. 2137,
  90128. 2139,
  90129. ],
  90130. [
  90131. 2199,
  90132. 2207,
  90133. ],
  90134. [
  90135. 2250,
  90136. 2273,
  90137. ],
  90138. [
  90139. 2275,
  90140. 2306,
  90141. ],
  90142. [
  90143. 2362,
  90144. 2362,
  90145. ],
  90146. [
  90147. 2364,
  90148. 2364,
  90149. ],
  90150. [
  90151. 2369,
  90152. 2376,
  90153. ],
  90154. [
  90155. 2381,
  90156. 2381,
  90157. ],
  90158. [
  90159. 2385,
  90160. 2391,
  90161. ],
  90162. [
  90163. 2402,
  90164. 2403,
  90165. ],
  90166. [
  90167. 2433,
  90168. 2433,
  90169. ],
  90170. [
  90171. 2492,
  90172. 2492,
  90173. ],
  90174. [
  90175. 2497,
  90176. 2500,
  90177. ],
  90178. [
  90179. 2509,
  90180. 2509,
  90181. ],
  90182. [
  90183. 2530,
  90184. 2531,
  90185. ],
  90186. [
  90187. 2558,
  90188. 2558,
  90189. ],
  90190. [
  90191. 2561,
  90192. 2562,
  90193. ],
  90194. [
  90195. 2620,
  90196. 2620,
  90197. ],
  90198. [
  90199. 2625,
  90200. 2626,
  90201. ],
  90202. [
  90203. 2631,
  90204. 2632,
  90205. ],
  90206. [
  90207. 2635,
  90208. 2637,
  90209. ],
  90210. [
  90211. 2641,
  90212. 2641,
  90213. ],
  90214. [
  90215. 2672,
  90216. 2673,
  90217. ],
  90218. [
  90219. 2677,
  90220. 2677,
  90221. ],
  90222. [
  90223. 2689,
  90224. 2690,
  90225. ],
  90226. [
  90227. 2748,
  90228. 2748,
  90229. ],
  90230. [
  90231. 2753,
  90232. 2757,
  90233. ],
  90234. [
  90235. 2759,
  90236. 2760,
  90237. ],
  90238. [
  90239. 2765,
  90240. 2765,
  90241. ],
  90242. [
  90243. 2786,
  90244. 2787,
  90245. ],
  90246. [
  90247. 2810,
  90248. 2815,
  90249. ],
  90250. [
  90251. 2817,
  90252. 2817,
  90253. ],
  90254. [
  90255. 2876,
  90256. 2876,
  90257. ],
  90258. [
  90259. 2879,
  90260. 2879,
  90261. ],
  90262. [
  90263. 2881,
  90264. 2884,
  90265. ],
  90266. [
  90267. 2893,
  90268. 2893,
  90269. ],
  90270. [
  90271. 2901,
  90272. 2902,
  90273. ],
  90274. [
  90275. 2914,
  90276. 2915,
  90277. ],
  90278. [
  90279. 2946,
  90280. 2946,
  90281. ],
  90282. [
  90283. 3008,
  90284. 3008,
  90285. ],
  90286. [
  90287. 3021,
  90288. 3021,
  90289. ],
  90290. [
  90291. 3072,
  90292. 3072,
  90293. ],
  90294. [
  90295. 3076,
  90296. 3076,
  90297. ],
  90298. [
  90299. 3132,
  90300. 3132,
  90301. ],
  90302. [
  90303. 3134,
  90304. 3136,
  90305. ],
  90306. [
  90307. 3142,
  90308. 3144,
  90309. ],
  90310. [
  90311. 3146,
  90312. 3149,
  90313. ],
  90314. [
  90315. 3157,
  90316. 3158,
  90317. ],
  90318. [
  90319. 3170,
  90320. 3171,
  90321. ],
  90322. [
  90323. 3201,
  90324. 3201,
  90325. ],
  90326. [
  90327. 3260,
  90328. 3260,
  90329. ],
  90330. [
  90331. 3263,
  90332. 3263,
  90333. ],
  90334. [
  90335. 3270,
  90336. 3270,
  90337. ],
  90338. [
  90339. 3276,
  90340. 3277,
  90341. ],
  90342. [
  90343. 3298,
  90344. 3299,
  90345. ],
  90346. [
  90347. 3328,
  90348. 3329,
  90349. ],
  90350. [
  90351. 3387,
  90352. 3388,
  90353. ],
  90354. [
  90355. 3393,
  90356. 3396,
  90357. ],
  90358. [
  90359. 3405,
  90360. 3405,
  90361. ],
  90362. [
  90363. 3426,
  90364. 3427,
  90365. ],
  90366. [
  90367. 3457,
  90368. 3457,
  90369. ],
  90370. [
  90371. 3530,
  90372. 3530,
  90373. ],
  90374. [
  90375. 3538,
  90376. 3540,
  90377. ],
  90378. [
  90379. 3542,
  90380. 3542,
  90381. ],
  90382. [
  90383. 3633,
  90384. 3633,
  90385. ],
  90386. [
  90387. 3636,
  90388. 3642,
  90389. ],
  90390. [
  90391. 3655,
  90392. 3662,
  90393. ],
  90394. [
  90395. 3761,
  90396. 3761,
  90397. ],
  90398. [
  90399. 3764,
  90400. 3772,
  90401. ],
  90402. [
  90403. 3784,
  90404. 3790,
  90405. ],
  90406. [
  90407. 3864,
  90408. 3865,
  90409. ],
  90410. [
  90411. 3893,
  90412. 3893,
  90413. ],
  90414. [
  90415. 3895,
  90416. 3895,
  90417. ],
  90418. [
  90419. 3897,
  90420. 3897,
  90421. ],
  90422. [
  90423. 3953,
  90424. 3966,
  90425. ],
  90426. [
  90427. 3968,
  90428. 3972,
  90429. ],
  90430. [
  90431. 3974,
  90432. 3975,
  90433. ],
  90434. [
  90435. 3981,
  90436. 3991,
  90437. ],
  90438. [
  90439. 3993,
  90440. 4028,
  90441. ],
  90442. [
  90443. 4038,
  90444. 4038,
  90445. ],
  90446. [
  90447. 4141,
  90448. 4144,
  90449. ],
  90450. [
  90451. 4146,
  90452. 4151,
  90453. ],
  90454. [
  90455. 4153,
  90456. 4154,
  90457. ],
  90458. [
  90459. 4157,
  90460. 4158,
  90461. ],
  90462. [
  90463. 4184,
  90464. 4185,
  90465. ],
  90466. [
  90467. 4190,
  90468. 4192,
  90469. ],
  90470. [
  90471. 4209,
  90472. 4212,
  90473. ],
  90474. [
  90475. 4226,
  90476. 4226,
  90477. ],
  90478. [
  90479. 4229,
  90480. 4230,
  90481. ],
  90482. [
  90483. 4237,
  90484. 4237,
  90485. ],
  90486. [
  90487. 4253,
  90488. 4253,
  90489. ],
  90490. [
  90491. 4957,
  90492. 4959,
  90493. ],
  90494. [
  90495. 5906,
  90496. 5908,
  90497. ],
  90498. [
  90499. 5938,
  90500. 5939,
  90501. ],
  90502. [
  90503. 5970,
  90504. 5971,
  90505. ],
  90506. [
  90507. 6002,
  90508. 6003,
  90509. ],
  90510. [
  90511. 6068,
  90512. 6069,
  90513. ],
  90514. [
  90515. 6071,
  90516. 6077,
  90517. ],
  90518. [
  90519. 6086,
  90520. 6086,
  90521. ],
  90522. [
  90523. 6089,
  90524. 6099,
  90525. ],
  90526. [
  90527. 6109,
  90528. 6109,
  90529. ],
  90530. [
  90531. 6155,
  90532. 6157,
  90533. ],
  90534. [
  90535. 6159,
  90536. 6159,
  90537. ],
  90538. [
  90539. 6277,
  90540. 6278,
  90541. ],
  90542. [
  90543. 6313,
  90544. 6313,
  90545. ],
  90546. [
  90547. 6432,
  90548. 6434,
  90549. ],
  90550. [
  90551. 6439,
  90552. 6440,
  90553. ],
  90554. [
  90555. 6450,
  90556. 6450,
  90557. ],
  90558. [
  90559. 6457,
  90560. 6459,
  90561. ],
  90562. [
  90563. 6679,
  90564. 6680,
  90565. ],
  90566. [
  90567. 6683,
  90568. 6683,
  90569. ],
  90570. [
  90571. 6742,
  90572. 6742,
  90573. ],
  90574. [
  90575. 6744,
  90576. 6750,
  90577. ],
  90578. [
  90579. 6752,
  90580. 6752,
  90581. ],
  90582. [
  90583. 6754,
  90584. 6754,
  90585. ],
  90586. [
  90587. 6757,
  90588. 6764,
  90589. ],
  90590. [
  90591. 6771,
  90592. 6780,
  90593. ],
  90594. [
  90595. 6783,
  90596. 6783,
  90597. ],
  90598. [
  90599. 6832,
  90600. 6845,
  90601. ],
  90602. [
  90603. 6846,
  90604. 6846,
  90605. ],
  90606. [
  90607. 6847,
  90608. 6862,
  90609. ],
  90610. [
  90611. 6912,
  90612. 6915,
  90613. ],
  90614. [
  90615. 6964,
  90616. 6964,
  90617. ],
  90618. [
  90619. 6966,
  90620. 6970,
  90621. ],
  90622. [
  90623. 6972,
  90624. 6972,
  90625. ],
  90626. [
  90627. 6978,
  90628. 6978,
  90629. ],
  90630. [
  90631. 7019,
  90632. 7027,
  90633. ],
  90634. [
  90635. 7040,
  90636. 7041,
  90637. ],
  90638. [
  90639. 7074,
  90640. 7077,
  90641. ],
  90642. [
  90643. 7080,
  90644. 7081,
  90645. ],
  90646. [
  90647. 7083,
  90648. 7085,
  90649. ],
  90650. [
  90651. 7142,
  90652. 7142,
  90653. ],
  90654. [
  90655. 7144,
  90656. 7145,
  90657. ],
  90658. [
  90659. 7149,
  90660. 7149,
  90661. ],
  90662. [
  90663. 7151,
  90664. 7153,
  90665. ],
  90666. [
  90667. 7212,
  90668. 7219,
  90669. ],
  90670. [
  90671. 7222,
  90672. 7223,
  90673. ],
  90674. [
  90675. 7376,
  90676. 7378,
  90677. ],
  90678. [
  90679. 7380,
  90680. 7392,
  90681. ],
  90682. [
  90683. 7394,
  90684. 7400,
  90685. ],
  90686. [
  90687. 7405,
  90688. 7405,
  90689. ],
  90690. [
  90691. 7412,
  90692. 7412,
  90693. ],
  90694. [
  90695. 7416,
  90696. 7417,
  90697. ],
  90698. [
  90699. 7616,
  90700. 7679,
  90701. ],
  90702. [
  90703. 8400,
  90704. 8412,
  90705. ],
  90706. [
  90707. 8413,
  90708. 8416,
  90709. ],
  90710. [
  90711. 8417,
  90712. 8417,
  90713. ],
  90714. [
  90715. 8418,
  90716. 8420,
  90717. ],
  90718. [
  90719. 8421,
  90720. 8432,
  90721. ],
  90722. [
  90723. 11503,
  90724. 11505,
  90725. ],
  90726. [
  90727. 11647,
  90728. 11647,
  90729. ],
  90730. [
  90731. 11744,
  90732. 11775,
  90733. ],
  90734. [
  90735. 12330,
  90736. 12333,
  90737. ],
  90738. [
  90739. 12441,
  90740. 12442,
  90741. ],
  90742. [
  90743. 42607,
  90744. 42607,
  90745. ],
  90746. [
  90747. 42608,
  90748. 42610,
  90749. ],
  90750. [
  90751. 42612,
  90752. 42621,
  90753. ],
  90754. [
  90755. 42654,
  90756. 42655,
  90757. ],
  90758. [
  90759. 42736,
  90760. 42737,
  90761. ],
  90762. [
  90763. 43010,
  90764. 43010,
  90765. ],
  90766. [
  90767. 43014,
  90768. 43014,
  90769. ],
  90770. [
  90771. 43019,
  90772. 43019,
  90773. ],
  90774. [
  90775. 43045,
  90776. 43046,
  90777. ],
  90778. [
  90779. 43052,
  90780. 43052,
  90781. ],
  90782. [
  90783. 43204,
  90784. 43205,
  90785. ],
  90786. [
  90787. 43232,
  90788. 43249,
  90789. ],
  90790. [
  90791. 43263,
  90792. 43263,
  90793. ],
  90794. [
  90795. 43302,
  90796. 43309,
  90797. ],
  90798. [
  90799. 43335,
  90800. 43345,
  90801. ],
  90802. [
  90803. 43392,
  90804. 43394,
  90805. ],
  90806. [
  90807. 43443,
  90808. 43443,
  90809. ],
  90810. [
  90811. 43446,
  90812. 43449,
  90813. ],
  90814. [
  90815. 43452,
  90816. 43453,
  90817. ],
  90818. [
  90819. 43493,
  90820. 43493,
  90821. ],
  90822. [
  90823. 43561,
  90824. 43566,
  90825. ],
  90826. [
  90827. 43569,
  90828. 43570,
  90829. ],
  90830. [
  90831. 43573,
  90832. 43574,
  90833. ],
  90834. [
  90835. 43587,
  90836. 43587,
  90837. ],
  90838. [
  90839. 43596,
  90840. 43596,
  90841. ],
  90842. [
  90843. 43644,
  90844. 43644,
  90845. ],
  90846. [
  90847. 43696,
  90848. 43696,
  90849. ],
  90850. [
  90851. 43698,
  90852. 43700,
  90853. ],
  90854. [
  90855. 43703,
  90856. 43704,
  90857. ],
  90858. [
  90859. 43710,
  90860. 43711,
  90861. ],
  90862. [
  90863. 43713,
  90864. 43713,
  90865. ],
  90866. [
  90867. 43756,
  90868. 43757,
  90869. ],
  90870. [
  90871. 43766,
  90872. 43766,
  90873. ],
  90874. [
  90875. 44005,
  90876. 44005,
  90877. ],
  90878. [
  90879. 44008,
  90880. 44008,
  90881. ],
  90882. [
  90883. 44013,
  90884. 44013,
  90885. ],
  90886. [
  90887. 64286,
  90888. 64286,
  90889. ],
  90890. [
  90891. 65024,
  90892. 65039,
  90893. ],
  90894. [
  90895. 65056,
  90896. 65071,
  90897. ],
  90898. [
  90899. 66045,
  90900. 66045,
  90901. ],
  90902. [
  90903. 66272,
  90904. 66272,
  90905. ],
  90906. [
  90907. 66422,
  90908. 66426,
  90909. ],
  90910. [
  90911. 68097,
  90912. 68099,
  90913. ],
  90914. [
  90915. 68101,
  90916. 68102,
  90917. ],
  90918. [
  90919. 68108,
  90920. 68111,
  90921. ],
  90922. [
  90923. 68152,
  90924. 68154,
  90925. ],
  90926. [
  90927. 68159,
  90928. 68159,
  90929. ],
  90930. [
  90931. 68325,
  90932. 68326,
  90933. ],
  90934. [
  90935. 68900,
  90936. 68903,
  90937. ],
  90938. [
  90939. 68969,
  90940. 68973,
  90941. ],
  90942. [
  90943. 69291,
  90944. 69292,
  90945. ],
  90946. [
  90947. 69372,
  90948. 69375,
  90949. ],
  90950. [
  90951. 69446,
  90952. 69456,
  90953. ],
  90954. [
  90955. 69506,
  90956. 69509,
  90957. ],
  90958. [
  90959. 69633,
  90960. 69633,
  90961. ],
  90962. [
  90963. 69688,
  90964. 69702,
  90965. ],
  90966. [
  90967. 69744,
  90968. 69744,
  90969. ],
  90970. [
  90971. 69747,
  90972. 69748,
  90973. ],
  90974. [
  90975. 69759,
  90976. 69761,
  90977. ],
  90978. [
  90979. 69811,
  90980. 69814,
  90981. ],
  90982. [
  90983. 69817,
  90984. 69818,
  90985. ],
  90986. [
  90987. 69826,
  90988. 69826,
  90989. ],
  90990. [
  90991. 69888,
  90992. 69890,
  90993. ],
  90994. [
  90995. 69927,
  90996. 69931,
  90997. ],
  90998. [
  90999. 69933,
  91000. 69940,
  91001. ],
  91002. [
  91003. 70003,
  91004. 70003,
  91005. ],
  91006. [
  91007. 70016,
  91008. 70017,
  91009. ],
  91010. [
  91011. 70070,
  91012. 70078,
  91013. ],
  91014. [
  91015. 70089,
  91016. 70092,
  91017. ],
  91018. [
  91019. 70095,
  91020. 70095,
  91021. ],
  91022. [
  91023. 70191,
  91024. 70193,
  91025. ],
  91026. [
  91027. 70196,
  91028. 70196,
  91029. ],
  91030. [
  91031. 70198,
  91032. 70199,
  91033. ],
  91034. [
  91035. 70206,
  91036. 70206,
  91037. ],
  91038. [
  91039. 70209,
  91040. 70209,
  91041. ],
  91042. [
  91043. 70367,
  91044. 70367,
  91045. ],
  91046. [
  91047. 70371,
  91048. 70378,
  91049. ],
  91050. [
  91051. 70400,
  91052. 70401,
  91053. ],
  91054. [
  91055. 70459,
  91056. 70460,
  91057. ],
  91058. [
  91059. 70464,
  91060. 70464,
  91061. ],
  91062. [
  91063. 70502,
  91064. 70508,
  91065. ],
  91066. [
  91067. 70512,
  91068. 70516,
  91069. ],
  91070. [
  91071. 70587,
  91072. 70592,
  91073. ],
  91074. [
  91075. 70606,
  91076. 70606,
  91077. ],
  91078. [
  91079. 70608,
  91080. 70608,
  91081. ],
  91082. [
  91083. 70610,
  91084. 70610,
  91085. ],
  91086. [
  91087. 70625,
  91088. 70626,
  91089. ],
  91090. [
  91091. 70712,
  91092. 70719,
  91093. ],
  91094. [
  91095. 70722,
  91096. 70724,
  91097. ],
  91098. [
  91099. 70726,
  91100. 70726,
  91101. ],
  91102. [
  91103. 70750,
  91104. 70750,
  91105. ],
  91106. [
  91107. 70835,
  91108. 70840,
  91109. ],
  91110. [
  91111. 70842,
  91112. 70842,
  91113. ],
  91114. [
  91115. 70847,
  91116. 70848,
  91117. ],
  91118. [
  91119. 70850,
  91120. 70851,
  91121. ],
  91122. [
  91123. 71090,
  91124. 71093,
  91125. ],
  91126. [
  91127. 71100,
  91128. 71101,
  91129. ],
  91130. [
  91131. 71103,
  91132. 71104,
  91133. ],
  91134. [
  91135. 71132,
  91136. 71133,
  91137. ],
  91138. [
  91139. 71219,
  91140. 71226,
  91141. ],
  91142. [
  91143. 71229,
  91144. 71229,
  91145. ],
  91146. [
  91147. 71231,
  91148. 71232,
  91149. ],
  91150. [
  91151. 71339,
  91152. 71339,
  91153. ],
  91154. [
  91155. 71341,
  91156. 71341,
  91157. ],
  91158. [
  91159. 71344,
  91160. 71349,
  91161. ],
  91162. [
  91163. 71351,
  91164. 71351,
  91165. ],
  91166. [
  91167. 71453,
  91168. 71453,
  91169. ],
  91170. [
  91171. 71455,
  91172. 71455,
  91173. ],
  91174. [
  91175. 71458,
  91176. 71461,
  91177. ],
  91178. [
  91179. 71463,
  91180. 71467,
  91181. ],
  91182. [
  91183. 71727,
  91184. 71735,
  91185. ],
  91186. [
  91187. 71737,
  91188. 71738,
  91189. ],
  91190. [
  91191. 71995,
  91192. 71996,
  91193. ],
  91194. [
  91195. 71998,
  91196. 71998,
  91197. ],
  91198. [
  91199. 72003,
  91200. 72003,
  91201. ],
  91202. [
  91203. 72148,
  91204. 72151,
  91205. ],
  91206. [
  91207. 72154,
  91208. 72155,
  91209. ],
  91210. [
  91211. 72160,
  91212. 72160,
  91213. ],
  91214. [
  91215. 72193,
  91216. 72202,
  91217. ],
  91218. [
  91219. 72243,
  91220. 72248,
  91221. ],
  91222. [
  91223. 72251,
  91224. 72254,
  91225. ],
  91226. [
  91227. 72263,
  91228. 72263,
  91229. ],
  91230. [
  91231. 72273,
  91232. 72278,
  91233. ],
  91234. [
  91235. 72281,
  91236. 72283,
  91237. ],
  91238. [
  91239. 72330,
  91240. 72342,
  91241. ],
  91242. [
  91243. 72344,
  91244. 72345,
  91245. ],
  91246. [
  91247. 72752,
  91248. 72758,
  91249. ],
  91250. [
  91251. 72760,
  91252. 72765,
  91253. ],
  91254. [
  91255. 72767,
  91256. 72767,
  91257. ],
  91258. [
  91259. 72850,
  91260. 72871,
  91261. ],
  91262. [
  91263. 72874,
  91264. 72880,
  91265. ],
  91266. [
  91267. 72882,
  91268. 72883,
  91269. ],
  91270. [
  91271. 72885,
  91272. 72886,
  91273. ],
  91274. [
  91275. 73009,
  91276. 73014,
  91277. ],
  91278. [
  91279. 73018,
  91280. 73018,
  91281. ],
  91282. [
  91283. 73020,
  91284. 73021,
  91285. ],
  91286. [
  91287. 73023,
  91288. 73029,
  91289. ],
  91290. [
  91291. 73031,
  91292. 73031,
  91293. ],
  91294. [
  91295. 73104,
  91296. 73105,
  91297. ],
  91298. [
  91299. 73109,
  91300. 73109,
  91301. ],
  91302. [
  91303. 73111,
  91304. 73111,
  91305. ],
  91306. [
  91307. 73459,
  91308. 73460,
  91309. ],
  91310. [
  91311. 73472,
  91312. 73473,
  91313. ],
  91314. [
  91315. 73526,
  91316. 73530,
  91317. ],
  91318. [
  91319. 73536,
  91320. 73536,
  91321. ],
  91322. [
  91323. 73538,
  91324. 73538,
  91325. ],
  91326. [
  91327. 73562,
  91328. 73562,
  91329. ],
  91330. [
  91331. 78912,
  91332. 78912,
  91333. ],
  91334. [
  91335. 78919,
  91336. 78933,
  91337. ],
  91338. [
  91339. 90398,
  91340. 90409,
  91341. ],
  91342. [
  91343. 90413,
  91344. 90415,
  91345. ],
  91346. [
  91347. 92912,
  91348. 92916,
  91349. ],
  91350. [
  91351. 92976,
  91352. 92982,
  91353. ],
  91354. [
  91355. 94031,
  91356. 94031,
  91357. ],
  91358. [
  91359. 94095,
  91360. 94098,
  91361. ],
  91362. [
  91363. 94180,
  91364. 94180,
  91365. ],
  91366. [
  91367. 113821,
  91368. 113822,
  91369. ],
  91370. [
  91371. 118528,
  91372. 118573,
  91373. ],
  91374. [
  91375. 118576,
  91376. 118598,
  91377. ],
  91378. [
  91379. 119143,
  91380. 119145,
  91381. ],
  91382. [
  91383. 119163,
  91384. 119170,
  91385. ],
  91386. [
  91387. 119173,
  91388. 119179,
  91389. ],
  91390. [
  91391. 119210,
  91392. 119213,
  91393. ],
  91394. [
  91395. 119362,
  91396. 119364,
  91397. ],
  91398. [
  91399. 121344,
  91400. 121398,
  91401. ],
  91402. [
  91403. 121403,
  91404. 121452,
  91405. ],
  91406. [
  91407. 121461,
  91408. 121461,
  91409. ],
  91410. [
  91411. 121476,
  91412. 121476,
  91413. ],
  91414. [
  91415. 121499,
  91416. 121503,
  91417. ],
  91418. [
  91419. 121505,
  91420. 121519,
  91421. ],
  91422. [
  91423. 122880,
  91424. 122886,
  91425. ],
  91426. [
  91427. 122888,
  91428. 122904,
  91429. ],
  91430. [
  91431. 122907,
  91432. 122913,
  91433. ],
  91434. [
  91435. 122915,
  91436. 122916,
  91437. ],
  91438. [
  91439. 122918,
  91440. 122922,
  91441. ],
  91442. [
  91443. 123023,
  91444. 123023,
  91445. ],
  91446. [
  91447. 123184,
  91448. 123190,
  91449. ],
  91450. [
  91451. 123566,
  91452. 123566,
  91453. ],
  91454. [
  91455. 123628,
  91456. 123631,
  91457. ],
  91458. [
  91459. 124140,
  91460. 124143,
  91461. ],
  91462. [
  91463. 124398,
  91464. 124399,
  91465. ],
  91466. [
  91467. 125136,
  91468. 125142,
  91469. ],
  91470. [
  91471. 125252,
  91472. 125258,
  91473. ],
  91474. [
  91475. 917760,
  91476. 917999,
  91477. ],
  91478. ];
  91479. <?php
  91480. namespace Symfony\Component\String;
  91481. if (!\function_exists(u::class)) {
  91482. function u(?string $string = ''): UnicodeString
  91483. {
  91484. return new UnicodeString($string ?? '');
  91485. }
  91486. }
  91487. if (!\function_exists(b::class)) {
  91488. function b(?string $string = ''): ByteString
  91489. {
  91490. return new ByteString($string ?? '');
  91491. }
  91492. }
  91493. if (!\function_exists(s::class)) {
  91494. function s(?string $string = ''): AbstractString
  91495. {
  91496. $string = $string ?? '';
  91497. return preg_match('//u', $string) ? new UnicodeString($string) : new ByteString($string);
  91498. }
  91499. }
  91500. <?php
  91501. namespace Symfony\Component\String\Slugger;
  91502. use Symfony\Component\String\AbstractUnicodeString;
  91503. use Symfony\Component\String\UnicodeString;
  91504. use Symfony\Contracts\Translation\LocaleAwareInterface;
  91505. if (!interface_exists(LocaleAwareInterface::class)) {
  91506. throw new \LogicException('You cannot use the "Symfony\Component\String\Slugger\AsciiSlugger" as the "symfony/translation-contracts" package is not installed. Try running "composer require symfony/translation-contracts".');
  91507. }
  91508. class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
  91509. {
  91510. private const LOCALE_TO_TRANSLITERATOR_ID = [
  91511. 'am' => 'Amharic-Latin',
  91512. 'ar' => 'Arabic-Latin',
  91513. 'az' => 'Azerbaijani-Latin',
  91514. 'be' => 'Belarusian-Latin',
  91515. 'bg' => 'Bulgarian-Latin',
  91516. 'bn' => 'Bengali-Latin',
  91517. 'de' => 'de-ASCII',
  91518. 'el' => 'Greek-Latin',
  91519. 'fa' => 'Persian-Latin',
  91520. 'he' => 'Hebrew-Latin',
  91521. 'hy' => 'Armenian-Latin',
  91522. 'ka' => 'Georgian-Latin',
  91523. 'kk' => 'Kazakh-Latin',
  91524. 'ky' => 'Kirghiz-Latin',
  91525. 'ko' => 'Korean-Latin',
  91526. 'mk' => 'Macedonian-Latin',
  91527. 'mn' => 'Mongolian-Latin',
  91528. 'or' => 'Oriya-Latin',
  91529. 'ps' => 'Pashto-Latin',
  91530. 'ru' => 'Russian-Latin',
  91531. 'sr' => 'Serbian-Latin',
  91532. 'sr_Cyrl' => 'Serbian-Latin',
  91533. 'th' => 'Thai-Latin',
  91534. 'tk' => 'Turkmen-Latin',
  91535. 'uk' => 'Ukrainian-Latin',
  91536. 'uz' => 'Uzbek-Latin',
  91537. 'zh' => 'Han-Latin',
  91538. ];
  91539. private $defaultLocale;
  91540. private $symbolsMap = [
  91541. 'en' => ['@' => 'at', '&' => 'and'],
  91542. ];
  91543. private $transliterators = [];
  91544. public function __construct(?string $defaultLocale = null, $symbolsMap = null)
  91545. {
  91546. if (null !== $symbolsMap && !\is_array($symbolsMap) && !$symbolsMap instanceof \Closure) {
  91547. throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be array, Closure or null, "%s" given.', __METHOD__, \gettype($symbolsMap)));
  91548. }
  91549. $this->defaultLocale = $defaultLocale;
  91550. $this->symbolsMap = $symbolsMap ?? $this->symbolsMap;
  91551. }
  91552. public function setLocale($locale)
  91553. {
  91554. $this->defaultLocale = $locale;
  91555. }
  91556. public function getLocale()
  91557. {
  91558. return $this->defaultLocale;
  91559. }
  91560. public function slug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString
  91561. {
  91562. $locale = $locale ?? $this->defaultLocale;
  91563. $transliterator = [];
  91564. if ($locale && ('de' === $locale || 0 === strpos($locale, 'de_'))) {
  91565. $transliterator = ['de-ASCII'];
  91566. } elseif (\function_exists('transliterator_transliterate') && $locale) {
  91567. $transliterator = (array) $this->createTransliterator($locale);
  91568. }
  91569. if ($this->symbolsMap instanceof \Closure) {
  91570. $symbolsMap = $this->symbolsMap;
  91571. array_unshift($transliterator, static function ($s) use ($symbolsMap, $locale) {
  91572. return $symbolsMap($s, $locale);
  91573. });
  91574. }
  91575. $unicodeString = (new UnicodeString($string))->ascii($transliterator);
  91576. if (\is_array($this->symbolsMap)) {
  91577. $map = null;
  91578. if (isset($this->symbolsMap[$locale])) {
  91579. $map = $this->symbolsMap[$locale];
  91580. } else {
  91581. $parent = self::getParentLocale($locale);
  91582. if ($parent && isset($this->symbolsMap[$parent])) {
  91583. $map = $this->symbolsMap[$parent];
  91584. }
  91585. }
  91586. if ($map) {
  91587. foreach ($map as $char => $replace) {
  91588. $unicodeString = $unicodeString->replace($char, ' '.$replace.' ');
  91589. }
  91590. }
  91591. }
  91592. return $unicodeString
  91593. ->replaceMatches('/[^A-Za-z0-9]++/', $separator)
  91594. ->trim($separator)
  91595. ;
  91596. }
  91597. private function createTransliterator(string $locale): ?\Transliterator
  91598. {
  91599. if (\array_key_exists($locale, $this->transliterators)) {
  91600. return $this->transliterators[$locale];
  91601. }
  91602. if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$locale] ?? null) {
  91603. return $this->transliterators[$locale] = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
  91604. }
  91605. if (!$parent = self::getParentLocale($locale)) {
  91606. return $this->transliterators[$locale] = null;
  91607. }
  91608. if ($id = self::LOCALE_TO_TRANSLITERATOR_ID[$parent] ?? null) {
  91609. $transliterator = \Transliterator::create($id.'/BGN') ?? \Transliterator::create($id);
  91610. }
  91611. return $this->transliterators[$locale] = $this->transliterators[$parent] = $transliterator ?? null;
  91612. }
  91613. private static function getParentLocale(?string $locale): ?string
  91614. {
  91615. if (!$locale) {
  91616. return null;
  91617. }
  91618. if (false === $str = strrchr($locale, '_')) {
  91619. return null;
  91620. }
  91621. return substr($locale, 0, -\strlen($str));
  91622. }
  91623. }
  91624. <?php
  91625. namespace Symfony\Component\String\Slugger;
  91626. use Symfony\Component\String\AbstractUnicodeString;
  91627. interface SluggerInterface
  91628. {
  91629. public function slug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString;
  91630. }
  91631. <?php
  91632. namespace Symfony\Component\String;
  91633. use Symfony\Component\String\Exception\ExceptionInterface;
  91634. use Symfony\Component\String\Exception\InvalidArgumentException;
  91635. class UnicodeString extends AbstractUnicodeString
  91636. {
  91637. public function __construct(string $string = '')
  91638. {
  91639. $this->string = normalizer_is_normalized($string) ? $string : normalizer_normalize($string);
  91640. if (false === $this->string) {
  91641. throw new InvalidArgumentException('Invalid UTF-8 string.');
  91642. }
  91643. }
  91644. public function append(string ...$suffix): AbstractString
  91645. {
  91646. $str = clone $this;
  91647. $str->string = $this->string.(1 >= \count($suffix) ? ($suffix[0] ?? '') : implode('', $suffix));
  91648. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  91649. if (false === $str->string) {
  91650. throw new InvalidArgumentException('Invalid UTF-8 string.');
  91651. }
  91652. return $str;
  91653. }
  91654. public function chunk(int $length = 1): array
  91655. {
  91656. if (1 > $length) {
  91657. throw new InvalidArgumentException('The chunk length must be greater than zero.');
  91658. }
  91659. if ('' === $this->string) {
  91660. return [];
  91661. }
  91662. $rx = '/(';
  91663. while (65535 < $length) {
  91664. $rx .= '\X{65535}';
  91665. $length -= 65535;
  91666. }
  91667. $rx .= '\X{'.$length.'})/u';
  91668. $str = clone $this;
  91669. $chunks = [];
  91670. foreach (preg_split($rx, $this->string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY) as $chunk) {
  91671. $str->string = $chunk;
  91672. $chunks[] = clone $str;
  91673. }
  91674. return $chunks;
  91675. }
  91676. public function endsWith($suffix): bool
  91677. {
  91678. if ($suffix instanceof AbstractString) {
  91679. $suffix = $suffix->string;
  91680. } elseif (\is_array($suffix) || $suffix instanceof \Traversable) {
  91681. return parent::endsWith($suffix);
  91682. } else {
  91683. $suffix = (string) $suffix;
  91684. }
  91685. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  91686. normalizer_is_normalized($suffix, $form) ?: $suffix = normalizer_normalize($suffix, $form);
  91687. if ('' === $suffix || false === $suffix) {
  91688. return false;
  91689. }
  91690. if ($this->ignoreCase) {
  91691. return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix)), $suffix, 0, 'UTF-8');
  91692. }
  91693. return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
  91694. }
  91695. public function equalsTo($string): bool
  91696. {
  91697. if ($string instanceof AbstractString) {
  91698. $string = $string->string;
  91699. } elseif (\is_array($string) || $string instanceof \Traversable) {
  91700. return parent::equalsTo($string);
  91701. } else {
  91702. $string = (string) $string;
  91703. }
  91704. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  91705. normalizer_is_normalized($string, $form) ?: $string = normalizer_normalize($string, $form);
  91706. if ('' !== $string && false !== $string && $this->ignoreCase) {
  91707. return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
  91708. }
  91709. return $string === $this->string;
  91710. }
  91711. public function indexOf($needle, int $offset = 0): ?int
  91712. {
  91713. if ($needle instanceof AbstractString) {
  91714. $needle = $needle->string;
  91715. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  91716. return parent::indexOf($needle, $offset);
  91717. } else {
  91718. $needle = (string) $needle;
  91719. }
  91720. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  91721. normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
  91722. if ('' === $needle || false === $needle) {
  91723. return null;
  91724. }
  91725. try {
  91726. $i = $this->ignoreCase ? grapheme_stripos($this->string, $needle, $offset) : grapheme_strpos($this->string, $needle, $offset);
  91727. } catch (\ValueError $e) {
  91728. return null;
  91729. }
  91730. return false === $i ? null : $i;
  91731. }
  91732. public function indexOfLast($needle, int $offset = 0): ?int
  91733. {
  91734. if ($needle instanceof AbstractString) {
  91735. $needle = $needle->string;
  91736. } elseif (\is_array($needle) || $needle instanceof \Traversable) {
  91737. return parent::indexOfLast($needle, $offset);
  91738. } else {
  91739. $needle = (string) $needle;
  91740. }
  91741. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  91742. normalizer_is_normalized($needle, $form) ?: $needle = normalizer_normalize($needle, $form);
  91743. if ('' === $needle || false === $needle) {
  91744. return null;
  91745. }
  91746. $string = $this->string;
  91747. if (0 > $offset) {
  91748. if (0 > $offset += grapheme_strlen($needle)) {
  91749. $string = grapheme_substr($string, 0, $offset);
  91750. }
  91751. $offset = 0;
  91752. }
  91753. $i = $this->ignoreCase ? grapheme_strripos($string, $needle, $offset) : grapheme_strrpos($string, $needle, $offset);
  91754. return false === $i ? null : $i;
  91755. }
  91756. public function join(array $strings, ?string $lastGlue = null): AbstractString
  91757. {
  91758. $str = parent::join($strings, $lastGlue);
  91759. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  91760. return $str;
  91761. }
  91762. public function length(): int
  91763. {
  91764. return grapheme_strlen($this->string);
  91765. }
  91766. public function normalize(int $form = self::NFC): parent
  91767. {
  91768. $str = clone $this;
  91769. if (\in_array($form, [self::NFC, self::NFKC], true)) {
  91770. normalizer_is_normalized($str->string, $form) ?: $str->string = normalizer_normalize($str->string, $form);
  91771. } elseif (!\in_array($form, [self::NFD, self::NFKD], true)) {
  91772. throw new InvalidArgumentException('Unsupported normalization form.');
  91773. } elseif (!normalizer_is_normalized($str->string, $form)) {
  91774. $str->string = normalizer_normalize($str->string, $form);
  91775. $str->ignoreCase = null;
  91776. }
  91777. return $str;
  91778. }
  91779. public function prepend(string ...$prefix): AbstractString
  91780. {
  91781. $str = clone $this;
  91782. $str->string = (1 >= \count($prefix) ? ($prefix[0] ?? '') : implode('', $prefix)).$this->string;
  91783. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  91784. if (false === $str->string) {
  91785. throw new InvalidArgumentException('Invalid UTF-8 string.');
  91786. }
  91787. return $str;
  91788. }
  91789. public function replace(string $from, string $to): AbstractString
  91790. {
  91791. $str = clone $this;
  91792. normalizer_is_normalized($from) ?: $from = normalizer_normalize($from);
  91793. if ('' !== $from && false !== $from) {
  91794. $tail = $str->string;
  91795. $result = '';
  91796. $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
  91797. while ('' !== $tail && false !== $i = $indexOf($tail, $from)) {
  91798. $slice = grapheme_substr($tail, 0, $i);
  91799. $result .= $slice.$to;
  91800. $tail = substr($tail, \strlen($slice) + \strlen($from));
  91801. }
  91802. $str->string = $result.$tail;
  91803. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  91804. if (false === $str->string) {
  91805. throw new InvalidArgumentException('Invalid UTF-8 string.');
  91806. }
  91807. }
  91808. return $str;
  91809. }
  91810. public function replaceMatches(string $fromRegexp, $to): AbstractString
  91811. {
  91812. $str = parent::replaceMatches($fromRegexp, $to);
  91813. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  91814. return $str;
  91815. }
  91816. public function slice(int $start = 0, ?int $length = null): AbstractString
  91817. {
  91818. $str = clone $this;
  91819. if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
  91820. $start = 0;
  91821. }
  91822. $str->string = (string) grapheme_substr($this->string, $start, $length ?? 2147483647);
  91823. return $str;
  91824. }
  91825. public function splice(string $replacement, int $start = 0, ?int $length = null): AbstractString
  91826. {
  91827. $str = clone $this;
  91828. if (\PHP_VERSION_ID < 80000 && 0 > $start && grapheme_strlen($this->string) < -$start) {
  91829. $start = 0;
  91830. }
  91831. $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0;
  91832. $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length;
  91833. $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647);
  91834. normalizer_is_normalized($str->string) ?: $str->string = normalizer_normalize($str->string);
  91835. if (false === $str->string) {
  91836. throw new InvalidArgumentException('Invalid UTF-8 string.');
  91837. }
  91838. return $str;
  91839. }
  91840. public function split(string $delimiter, ?int $limit = null, ?int $flags = null): array
  91841. {
  91842. if (1 > $limit = $limit ?? 2147483647) {
  91843. throw new InvalidArgumentException('Split limit must be a positive integer.');
  91844. }
  91845. if ('' === $delimiter) {
  91846. throw new InvalidArgumentException('Split delimiter is empty.');
  91847. }
  91848. if (null !== $flags) {
  91849. return parent::split($delimiter.'u', $limit, $flags);
  91850. }
  91851. normalizer_is_normalized($delimiter) ?: $delimiter = normalizer_normalize($delimiter);
  91852. if (false === $delimiter) {
  91853. throw new InvalidArgumentException('Split delimiter is not a valid UTF-8 string.');
  91854. }
  91855. $str = clone $this;
  91856. $tail = $this->string;
  91857. $chunks = [];
  91858. $indexOf = $this->ignoreCase ? 'grapheme_stripos' : 'grapheme_strpos';
  91859. while (1 < $limit && false !== $i = $indexOf($tail, $delimiter)) {
  91860. $str->string = grapheme_substr($tail, 0, $i);
  91861. $chunks[] = clone $str;
  91862. $tail = substr($tail, \strlen($str->string) + \strlen($delimiter));
  91863. --$limit;
  91864. }
  91865. $str->string = $tail;
  91866. $chunks[] = clone $str;
  91867. return $chunks;
  91868. }
  91869. public function startsWith($prefix): bool
  91870. {
  91871. if ($prefix instanceof AbstractString) {
  91872. $prefix = $prefix->string;
  91873. } elseif (\is_array($prefix) || $prefix instanceof \Traversable) {
  91874. return parent::startsWith($prefix);
  91875. } else {
  91876. $prefix = (string) $prefix;
  91877. }
  91878. $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
  91879. normalizer_is_normalized($prefix, $form) ?: $prefix = normalizer_normalize($prefix, $form);
  91880. if ('' === $prefix || false === $prefix) {
  91881. return false;
  91882. }
  91883. if ($this->ignoreCase) {
  91884. return 0 === mb_stripos(grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES), $prefix, 0, 'UTF-8');
  91885. }
  91886. return $prefix === grapheme_extract($this->string, \strlen($prefix), \GRAPHEME_EXTR_MAXBYTES);
  91887. }
  91888. public function __wakeup()
  91889. {
  91890. if (!\is_string($this->string)) {
  91891. throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
  91892. }
  91893. normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
  91894. }
  91895. public function __clone()
  91896. {
  91897. if (null === $this->ignoreCase) {
  91898. normalizer_is_normalized($this->string) ?: $this->string = normalizer_normalize($this->string);
  91899. }
  91900. $this->ignoreCase = false;
  91901. }
  91902. }
  91903. <?php
  91904. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  91905. if (0 === strpos(__FILE__, 'phar:') && ini_get('register_argc_argv')) {
  91906. echo 'Composer cannot be run safely on non-CLI SAPIs with register_argc_argv=On. Aborting.'.PHP_EOL;
  91907. exit(1);
  91908. }
  91909. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  91910. }
  91911. if (PHP_VERSION_ID < 70205) {
  91912. echo 'Composer 2.3.0 dropped support for PHP <7.2.5 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
  91913. exit(1);
  91914. }
  91915. setlocale(LC_ALL, 'C');
  91916. require __DIR__.'/../src/bootstrap.php';
  91917. use Composer\Console\Application;
  91918. use Composer\XdebugHandler\XdebugHandler;
  91919. use Composer\Util\Platform;
  91920. use Composer\Util\ErrorHandler;
  91921. error_reporting(-1);
  91922. // Restart without Xdebug
  91923. $xdebug = new XdebugHandler('Composer');
  91924. $xdebug->check();
  91925. unset($xdebug);
  91926. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  91927. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  91928. exit(1);
  91929. }
  91930. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  91931. echo 'The iconv OR mbstring extension is required and both are missing.'
  91932. .PHP_EOL.'Install either of them or recompile php without --disable-iconv.'
  91933. .PHP_EOL.'Aborting.'.PHP_EOL;
  91934. exit(1);
  91935. }
  91936. if (function_exists('ini_set')) {
  91937. @ini_set('display_errors', '1');
  91938. // Set user defined memory limit
  91939. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  91940. @ini_set('memory_limit', $memoryLimit);
  91941. } else {
  91942. $memoryInBytes = function ($value) {
  91943. $unit = strtolower(substr($value, -1, 1));
  91944. $value = (int) $value;
  91945. switch($unit) {
  91946. case 'g':
  91947. $value *= 1024;
  91948. // no break (cumulative multiplier)
  91949. case 'm':
  91950. $value *= 1024;
  91951. // no break (cumulative multiplier)
  91952. case 'k':
  91953. $value *= 1024;
  91954. }
  91955. return $value;
  91956. };
  91957. $memoryLimit = trim(ini_get('memory_limit'));
  91958. // Increase memory_limit if it is lower than 1.5GB
  91959. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  91960. @ini_set('memory_limit', '1536M');
  91961. }
  91962. unset($memoryInBytes);
  91963. }
  91964. unset($memoryLimit);
  91965. }
  91966. // Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER
  91967. // see https://github.com/php/php-src/issues/7896
  91968. if (PHP_VERSION_ID >= 70113 && (PHP_VERSION_ID < 80016 || (PHP_VERSION_ID >= 80100 && PHP_VERSION_ID < 80103)) && Platform::isWindows()) {
  91969. foreach ($_SERVER as $serverVar => $serverVal) {
  91970. if (($serverVal = getenv($serverVar)) !== false) {
  91971. $_SERVER[$serverVar] = $serverVal;
  91972. }
  91973. }
  91974. }
  91975. Platform::putEnv('COMPOSER_BINARY', realpath($_SERVER['argv'][0]));
  91976. ErrorHandler::register();
  91977. // run the command application
  91978. $application = new Application();
  91979. $application->run();
  91980. Copyright (c) Nils Adermann, Jordi Boggiano
  91981. Permission is hereby granted, free of charge, to any person obtaining a copy
  91982. of this software and associated documentation files (the "Software"), to deal
  91983. in the Software without restriction, including without limitation the rights
  91984. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  91985. copies of the Software, and to permit persons to whom the Software is furnished
  91986. to do so, subject to the following conditions:
  91987. The above copyright notice and this permission notice shall be included in all
  91988. copies or substantial portions of the Software.
  91989. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  91990. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  91991. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  91992. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  91993. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  91994. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  91995. THE SOFTWARE.
  91996. ¿of]vƒ^¶Ûl5q½Òü�÷`dùç¸È�%†g`}DÉ“±uNÉçH#B„S^à�Š„}86ׇIU+yZ���GBMB